Add a warning about the use of Debug or "" in CMAKE_BUILD_TYPE

This commit is contained in:
Laurent Rineau 2018-03-20 16:47:19 +01:00
parent d266481a16
commit 66b4ec4214
5 changed files with 34 additions and 0 deletions

View File

@ -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}" )

View File

@ -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")

View File

@ -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")

View File

@ -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)

View File

@ -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")