# - BasicConfiguration # Some basic functions used by CMake Tool Kit # SET(myindent "${myindent}\t") message(STATUS "${myindent}# \"BasicConfiguration\" included!") if(__BasicConfiguration_INCLUDED) return() endif() set(__BasicConfiguration_INCLUDED TRUE) #------------------------------------------------------------------------------- # Basic configuration #------------------------------------------------------------------------------- # ``icedust_cmake_dir``: ``cmake`` directory for this package. Set to current directory. get_filename_component(icedust_cmakeModule_dir ${CMAKE_CURRENT_LIST_FILE} PATH) get_filename_component(icedust_cmake_dir ${icedust_cmakeModule_dir} PATH) set(icedust_cmakeScripts_dir "${icedust_cmake_dir}/scripts") # ``CMAKE_MODULE_PATH``: module search path. Set from the environment if not already defined. Add the default directories (``upmostdir/cmake/``, ``upmostdir/cmake/modules/``) to the module search path if(NOT CMAKE_MODULE_PATH) # Note: this works even if the envirnoment variable is not set. file(TO_CMAKE_PATH "$ENV{CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH) endif() LIST(APPEND CMAKE_MODULE_PATH ${icedust_cmake_dir} ${icedust_cmakeModule_dir}) LIST(REMOVE_DUPLICATES CMAKE_MODULE_PATH) message(STATUS "${myindent}CMAKE_MODULE_PATH= \"${CMAKE_MODULE_PATH}\"") message(STATUS "${myindent}icedust_cmake_dir = \"${icedust_cmake_dir}\"") message(STATUS "${myindent}icedust_cmakeScripts_dir= \"${icedust_cmakeScripts_dir}\"") message(STATUS "${myindent}icedust_cmakeModule_dir= \"${icedust_cmakeModule_dir}\"") # Other settings ... set(CMAKE_VERBOSE_MAKEFILES OFF) set(CMAKE_INCLUDE_CURRENT_DIR ON) # Ensure that the include directories added are always taken first. set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON) #set(CMAKE_SKIP_BUILD_RPATH TRUE) find_program(ccache_cmd ccache) find_program(distcc_cmd distcc) mark_as_advanced(ccache_cmd distcc_cmd) if(ccache_cmd) option(CMAKE_USE_CCACHE "Use ccache to speed up compilation." OFF) if(CMAKE_USE_CCACHE) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${ccache_cmd}) message(STATUS "${myindent}Using ccache for building") endif() endif() if(distcc_cmd) option(CMAKE_USE_DISTCC "Use distcc to speed up compilation." OFF) if(CMAKE_USE_DISTCC) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${distcc_cmd}) message(STATUS "${myindent}Using distcc for building") if(CMAKE_USE_CCACHE) message(WARNING "Cannot use distcc and ccache at the same time: using distcc") endif() endif() endif() # This option make sense only if we have 'objcopy' if(CMAKE_OBJCOPY) option(ICEDUST_DETACHED_DEBINFO "When CMAKE_BUILD_TYPE is RelWithDebInfo, save the debug information on a different file." ON) else() set(ICEDUST_DETACHED_DEBINFO OFF) endif() # Programs and utilities needed for the build include(CMakeParseArguments) find_package(PythonInterp) string(REGEX REPLACE "(\t*)\t" "\\1" myindent "${myindent}")