diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 96e28b4a949..73386fe866f 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -378,6 +378,7 @@ set( CGAL_MODULES_REL_DIR cmake/modules ) set( CGAL_MODULES_DIR ${CGAL_INSTALLATION_PACKAGE_DIR}/${CGAL_MODULES_REL_DIR} ) include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) +include(${CGAL_MODULES_DIR}/CGAL_enable_end_of_configuration_hook.cmake) cgal_setup_module_path() message( STATUS "CGAL_REFERENCE_CACHE_DIR=${CGAL_REFERENCE_CACHE_DIR}" ) diff --git a/Installation/cmake/modules/CGALConfig_binary.cmake.in b/Installation/cmake/modules/CGALConfig_binary.cmake.in index 2ce6c32deae..de25926bf51 100644 --- a/Installation/cmake/modules/CGALConfig_binary.cmake.in +++ b/Installation/cmake/modules/CGALConfig_binary.cmake.in @@ -190,3 +190,5 @@ if( CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST ) # Nov. 2017). -- Laurent Rineau include(CGAL_SetupFlags) endif() + +include("${CGAL_MODULES_DIR}/CGAL_enable_end_of_configuration_hook.cmake") diff --git a/Installation/cmake/modules/CGALConfig_install.cmake.in b/Installation/cmake/modules/CGALConfig_install.cmake.in index 7c8f327a23b..59fc4927bdb 100644 --- a/Installation/cmake/modules/CGALConfig_install.cmake.in +++ b/Installation/cmake/modules/CGALConfig_install.cmake.in @@ -165,3 +165,4 @@ if( CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST ) # Nov. 2017). -- Laurent Rineau include(CGAL_SetupFlags) endif() +include("${CGAL_MODULES_DIR}/CGAL_enable_end_of_configuration_hook.cmake") diff --git a/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake new file mode 100644 index 00000000000..52483dfd151 --- /dev/null +++ b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake @@ -0,0 +1,28 @@ +function(CGAL_run_at_the_end_of_configuration variable access value current_list_file stack) + if(value) + # Only do something at the end of the CMake process + return() + endif() + # Warn when CMAKE_BUILD_TYPE is empty or Debug + if(DEFINED CMAKE_BUILD_TYPE AND ( NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "Debug") ) + set(keyword WARNING) + if(RUNNING_CGAL_AUTO_TEST) + # No warning in the CMake test suite, but a status message + set(keyword ) + endif() + if(NOT CGAL_DO_NOT_WARN_ABOUT_CMAKE_BUILD_TYPE) + message(${keyword} "\ +=======================================================================\n\ +CGAL performance notice:\n\ +The variable CMAKE_BUILD_TYPE is set to \"${CMAKE_BUILD_TYPE}\". That \ +value should be used only for debugging. For performance reasons, you \ +should set CMAKE_BUILD_TYPE to \"Release\".\n\ +Set CGAL_DO_NOT_WARN_ABOUT_CMAKE_BUILD_TYPE to TRUE if you want to \ +disable this warning.\n\ +=======================================================================\ +") + endif() + endif() +endfunction() + +variable_watch("CMAKE_CURRENT_LIST_DIR" CGAL_run_at_the_end_of_configuration) diff --git a/Installation/lib/cmake/CGAL/CGALConfig.cmake b/Installation/lib/cmake/CGAL/CGALConfig.cmake index d0fda5865a2..2a7a256add5 100644 --- a/Installation/lib/cmake/CGAL/CGALConfig.cmake +++ b/Installation/lib/cmake/CGAL/CGALConfig.cmake @@ -139,3 +139,5 @@ include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) cgal_setup_module_path() set(CGAL_USE_FILE ${CGAL_MODULES_DIR}/UseCGAL.cmake) + +include("${CGAL_MODULES_DIR}/CGAL_enable_end_of_configuration_hook.cmake")