diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 27c24ca7dff..f489f95477d 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -24,7 +24,7 @@ endif() if(POLICY CMP0054) # http://www.cmake.org/cmake/help/v3.1/policy/CMP0054.html # See the discussion https://github.com/CGAL/cgal/issues/189 - cmake_policy(SET CMP0054 OLD) + cmake_policy(SET CMP0054 NEW) endif() @@ -430,7 +430,7 @@ if( MSVC ) endif() -if( "${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro ) +if( "\"${CMAKE_CXX_COMPILER_ID}\"" MATCHES "SunPro" ) message( STATUS "Using SunPro compiler, using STLPort 4." ) uniquely_add_flags( CGAL_CXX_FLAGS "-features=extensions;-library=stlport4;-D_GNU_SOURCE" ) @@ -522,16 +522,6 @@ message("== Set up flags (DONE) ==\n") message("== Detect external libraries ==") -macro( add_config_flag flag ) - - if ( ${flag} ) - file( APPEND ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "#define ${flag} 1\n\n") - else() - file( APPEND ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "//#define ${flag} 1\n\n") - endif() - -endmacro() - # this is the place to tell which external libs are supporting # Remarks: # External libs Qt3 and Qt34are configured when Qt3 or Qt5 as lib of cgal are required @@ -612,10 +602,6 @@ foreach (lib ${CGAL_SUPPORTING_3RD_PARTY_LIBRARIES}) option(WITH_${lib} "Select external library ${lib}" OFF) endif() - if (WITH_${lib}) - add_config_flag( ${CGAL_EXT_LIB_${lib}_PREFIX} ) - endif() - endforeach() #-------------------------------------------------------------------------------------------------- @@ -662,45 +648,41 @@ message("== Detect external libraries (DONE) ==\n") message("== Write compiler_config.h ==") +macro(add_config_flag flag) + if(${flag}) + file(APPEND ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "#define ${flag} 1\n\n") + else() + file(APPEND ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "//#define ${flag} 1\n\n") + endif() +endmacro() + file(GLOB all_config_tests "${CGAL_INSTALLATION_PACKAGE_DIR}/config/testfiles/*.cpp") +list(SORT all_config_tests) -list( SORT all_config_tests ) - -file( WRITE ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "//\n// compiler_config.h is included by CGAL headers to load the needed compiler settings.\n//\n// DO NOT EDIT compiler_config.h. It is generated by CMake.\n//\n\n") - -cache_get(CONFIG_CXX_FLAGS) +file(WRITE ${CMAKE_BINARY_DIR}/include/CGAL/compiler_config.h "//\n// compiler_config.h is included by CGAL headers to load the needed compiler settings.\n//\n// DO NOT EDIT compiler_config.h. It is generated by CMake.\n//\n\n") foreach(config_test_cpp ${all_config_tests}) - - # Test's name is .cpp's base name - get_filename_component(config_test_name ${config_test_cpp} NAME_WE) - - # Compile and run ${config_test_cpp}. Exit code is stored in ${config_test_name}. - if( RUNNING_CGAL_AUTO_TEST OR "${config_test_name}" MATCHES "^${config_test_name}$" OR NOT ${CONFIG_CXX_FLAGS} STREQUAL ${CMAKE_CXX_FLAGS}) + # Test's name is .cpp's base name + get_filename_component(config_test_name ${config_test_cpp} NAME_WE) - CHECK_CXX_FILE_RUNS(${config_test_cpp} ${config_test_name} ${config_test_name}) + # Compile and run ${config_test_cpp}. Exit code is stored in ${config_test_name}. + CHECK_CXX_FILE_RUNS(${config_test_cpp} ${config_test_name} ${config_test_name}) + if(${config_test_name}) + set(${config_test_name} 0) + else() + set(${config_test_name} 1) + endif() - if ( ${config_test_name} ) - cache_set ( ${config_test_name} 0 ) - else() - cache_set ( ${config_test_name} 1 ) - endif() - - endif() - - add_config_flag( ${config_test_name} ${config_test_name} ) - + add_config_flag(${config_test_name} ${config_test_name}) endforeach() -cache_set(CONFIG_CXX_FLAGS ${CMAKE_CXX_FLAGS}) - -add_config_flag( CGAL_USE_GMP ) -add_config_flag( CGAL_USE_MPFR ) -add_config_flag( CGAL_USE_GMPXX ) -add_config_flag( CGAL_USE_LEDA ) -add_config_flag( CGAL_USE_MPFI ) -add_config_flag( CGAL_USE_RS ) -add_config_flag( CGAL_USE_NTL ) +add_config_flag(CGAL_USE_GMP) +add_config_flag(CGAL_USE_MPFR) +add_config_flag(CGAL_USE_GMPXX) +add_config_flag(CGAL_USE_LEDA) +add_config_flag(CGAL_USE_MPFI) +add_config_flag(CGAL_USE_RS) +add_config_flag(CGAL_USE_NTL) add_config_flag( CGAL_BUILD_SHARED_LIBS ) @@ -952,7 +934,7 @@ if( WITH_CPACK AND EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake" ) set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}) endif() - if(${CPACK_SYSTEM_NAME} MATCHES Windows) + if(${CPACK_SYSTEM_NAME} MATCHES "Windows") if(CMAKE_CL_64) set(CPACK_SYSTEM_NAME win64-${CMAKE_SYSTEM_PROCESSOR}) else()