# C M A K E L I S T S . T X T # BRL-CAD # # Copyright (c) 2010-2013 United States Government as represented by # the U.S. Army Research Laboratory. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # # 3. The name of the author may not be used to endorse or promote # products derived from this software without specific prior written # permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # NOTE: BRL-CAD as a collective work is distributed under the LGPL. # BRL-CAD's build system is under the BSD license. # See the COPYING file for more details. # # ****************************************************************** # # Early versions of this CMakeLists.txt file were based on the VTK # CMakeLists.txt file, also licensed under Modified BSD. # ******************************************************************* # *** BRL-CAD's CMakeLists.txt *** # ******************************************************************* # # This file defines the toplevel CMake build logic for BRL-CAD. # As best as is reasonably possible, proper ordering and # separation of tests and settings should be maintained per the # recommended standard layout. The tests should be added to the # labeled sections below so that they are organized as follows: # # 0) information on the package and toplevel CMake settings # 1) define top level options # 2) check programs # 3) check compiler characteristics # 4) check libraries # 5) check headers # 6) check types/structures # 7) check functions # 8) check system services # 9) output a summary # # The output summary should report key information about the final # configuration of the build. Comprehensive information is available # in the CMake cache file in the build directory, so just hit the # high points in the summary. # ******************************************************************* # *** Top Level Settings *** # ******************************************************************* # This file contains the top level CMakeLists.txt logic for the # BRL-CAD software package. # We want to support a "distclean" build target that will clear all # CMake-generated files from a source directory in the case of an # in-source-dir configuration. Not recommended, but we'll try to # recover if it happens. define_property(GLOBAL PROPERTY CMAKE_DISTCLEAN_TARGET_LIST BRIEF_DOCS "All CMake generated files" FULL_DOCS "List of all files generated by CMake") macro(DISTCLEAN) foreach(item ${ARGN}) set_property(GLOBAL APPEND PROPERTY CMAKE_DISTCLEAN_TARGET_LIST "${item}") endforeach(item ${ARGN}) endmacro(DISTCLEAN) # Stash the initial CMakeCache.txt file, if it exists, for subsequent # comparison if(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt) configure_file(${CMAKE_BINARY_DIR}/CMakeCache.txt ${CMAKE_BINARY_DIR}/CMakeCache.txt.prev COPYONLY) DISTCLEAN(${CMAKE_BINARY_DIR}/CMakeCache.txt.prev) endif(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt) DISTCLEAN(${CMAKE_BINARY_DIR}/CMakeCache.txt) # Minimum required version of CMake cmake_minimum_required(VERSION 2.8.4) if(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0003 NEW) CMAKE_POLICY(SET CMP0007 OLD) CMAKE_POLICY(SET CMP0017 OLD) endif(COMMAND CMAKE_POLICY) # set CMake project name project(BRLCAD) #--------------------------------------------------------------------- # Write out entries to populate a tm struct (will be used for time # delta calculations later) if(NOT BRLCAD_IS_SUBBUILD) set(DELTA_START "${CMAKE_BINARY_DIR}/CMakeTmp/DELTA_START") configure_file(${CMAKE_SOURCE_DIR}/misc/CMake/test_srcs/timedelta_start.c.in ${CMAKE_BINARY_DIR}/CMakeTmp/timedelta_start.c) TRY_RUN(TIME_RESULT TIME_COMPILED ${CMAKE_BINARY_DIR}/CMakeTmp ${CMAKE_BINARY_DIR}/CMakeTmp/timedelta_start.c OUTPUT_VARIABLE COMPILEMESSAGES) endif(NOT BRLCAD_IS_SUBBUILD) #--------------------------------------------------------------------- # If it exists, load a BRL-CAD_CONFIG.GLOBAL file. This allows # advanced users to specify options or preferences they want to always # use by default even when doing clean BRL-CAD builds without a # CMakeCache.txt file - for example, to always enable all local libs # the following line can be added to BRL-CAD_CONFIG.GLOBAL: # # set(BRLCAD_BUNDLED_LIBS "Bundled" CACHE STRING "Enable all local libs") # The user's configuration file can be defined by environment variable # "BRLCAD_USER_GLOBAL_CONFIG_FILE" or, in its absence, by a file named # "BRL-CAD_CONFIG.GLOBAL" located either above or in the BRL-CAD # source directory. set(BRLCAD_USER_GLOBAL_CONFIG_FILE "$ENV{BRLCAD_USER_GLOBAL_CONFIG_FILE}") if(BRLCAD_USER_GLOBAL_CONFIG_FILE AND EXISTS ${BRLCAD_USER_GLOBAL_CONFIG_FILE}) message("Reading user preference file '${BRLCAD_USER_GLOBAL_CONFIG_FILE}'") include(${BRLCAD_USER_GLOBAL_CONFIG_FILE}) elseif(EXISTS ${BRLCAD_SOURCE_DIR}/../BRL-CAD_CONFIG.GLOBAL) message("Reading user preference file '${BRLCAD_SOURCE_DIR}/../BRL-CAD_CONFIG.GLOBAL'") include(${BRLCAD_SOURCE_DIR}/../BRL-CAD_CONFIG.GLOBAL) elseif(EXISTS ${BRLCAD_SOURCE_DIR}/BRL-CAD_CONFIG.GLOBAL) message("Reading user preference file '${BRLCAD_SOURCE_DIR}/BRL-CAD_CONFIG.GLOBAL'") include(${BRLCAD_SOURCE_DIR}/BRL-CAD_CONFIG.GLOBAL) else(BRLCAD_USER_GLOBAL_CONFIG_FILE AND EXISTS ${BRLCAD_USER_GLOBAL_CONFIG_FILE}) if(BRLCAD_USER_GLOBAL_CONFIG_FILE) message(WARNING "User preference file ${BRLCAD_USER_GLOBAL_CONFIG_FILE} specified but not found...") endif(BRLCAD_USER_GLOBAL_CONFIG_FILE) endif(BRLCAD_USER_GLOBAL_CONFIG_FILE AND EXISTS ${BRLCAD_USER_GLOBAL_CONFIG_FILE}) #--------------------------------------------------------------------- # Allow the BRLCAD_ROOT environment variable to set CMAKE_INSTALL_PREFIX # but be noisy about it. This is generally not a good idea. find_program(SLEEP_EXEC sleep) mark_as_advanced(SLEEP_EXEC) set(BRLCAD_ROOT "$ENV{BRLCAD_ROOT}") if(BRLCAD_ROOT) if(NOT BRLCAD_ROOT_OVERRIDE) message(WARNING "}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}\nBRLCAD_ROOT should only be used to override an install directory at runtime. BRLCAD_ROOT is presently set to \"${BRLCAD_ROOT}\" It is *highly* recommended that BRLCAD_ROOT be unset and not used.\n}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}") if(CMAKE_INSTALL_PREFIX AND NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT ) if(${BRLCAD_ROOT} STREQUAL "${CMAKE_INSTALL_PREFIX}") message("BRLCAD_ROOT is not necessary and may cause unexpected behavior") else(${BRLCAD_ROOT} STREQUAL "${CMAKE_INSTALL_PREFIX}") message(FATAL_ERROR "BRLCAD_ROOT environment variable conflicts with CMAKE_INSTALL_PREFIX") endif(${BRLCAD_ROOT} STREQUAL "${CMAKE_INSTALL_PREFIX}") endif(CMAKE_INSTALL_PREFIX AND NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT ) if(SLEEP_EXEC) execute_process(COMMAND ${SLEEP_EXEC} 2) endif(SLEEP_EXEC) endif(NOT BRLCAD_ROOT_OVERRIDE) endif(BRLCAD_ROOT) if(NOT BRLCAD_ROOT_OVERRIDE) if(BRLCAD_ROOT STREQUAL "/usr" OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr") message(WARNING "}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}\nIt is STRONGLY recommended that you DO NOT install BRL-CAD into /usr as BRL-CAD provides several libraries that may conflict with other libraries (e.g. librt, libbu, libbn) on certain system configurations.\nSince our libraries predate all those that we're known to conflict with and are at the very core of our geometry services and project heritage, we have no plans to change the names of our libraries at this time.\nINSTALLING INTO /usr CAN MAKE A SYSTEM COMPLETELY UNUSABLE. If you choose to continue installing into /usr, you do so entirely at your own risk. You have been warned.\n}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}") if(SLEEP_EXEC) message("Pausing 15 seconds...") execute_process(COMMAND ${SLEEP_EXEC} 15) endif(SLEEP_EXEC) if(${CMAKE_INSTALL_PREFIX} STREQUAL "/usr") message(FATAL_ERROR "If you wish to proceed using /usr as your prefix, define BRLCAD_ROOT_OVERRIDE=1 for CMake") endif(${CMAKE_INSTALL_PREFIX} STREQUAL "/usr") endif(BRLCAD_ROOT STREQUAL "/usr" OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr") endif(NOT BRLCAD_ROOT_OVERRIDE) # While we're at it, complain if BRLCAD_DATA is set set(BRLCAD_DATA_ENV "$ENV{BRLCAD_DATA}") if(BRLCAD_DATA_ENV) message(WARNING "}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}\nBRLCAD_DATA should only be used to override an install directory at runtime. BRLCAD_DATA is presently set to \"${BRLCAD_DATA_ENV}\" It is *highly* recommended that BRLCAD_DATA be unset and not used.\n}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}") if(SLEEP_EXEC) execute_process(COMMAND ${SLEEP_EXEC} 2) endif(SLEEP_EXEC) endif(BRLCAD_DATA_ENV) #--------------------------------------------------------------------- # Load general utility routines for BRL-CAD CMake logic include(${CMAKE_SOURCE_DIR}/misc/CMake/BRLCAD_Util.cmake) # Define CMake routines for bookkeeping of build files include(${CMAKE_SOURCE_DIR}/misc/CMake/BRLCAD_CMakeFiles.cmake) # Make sure the BRL-CAD library list is initialized empty - this way # if pieces are disabled between one configure and the next, they # won't linger in the list set(BRLCAD_LIBS "" CACHE STRING "BRL-CAD libraries" FORCE) #--------------------------------------------------------------------- # Define the current BRL-CAD version. # See HACKING for details on how to properly update the version file(READ ${BRLCAD_SOURCE_DIR}/include/conf/MAJOR BRLCAD_MAJOR_VERSION) string(STRIP ${BRLCAD_MAJOR_VERSION} BRLCAD_MAJOR_VERSION) file(READ ${BRLCAD_SOURCE_DIR}/include/conf/MINOR BRLCAD_MINOR_VERSION) string(STRIP ${BRLCAD_MINOR_VERSION} BRLCAD_MINOR_VERSION) file(READ ${BRLCAD_SOURCE_DIR}/include/conf/PATCH BRLCAD_PATCH_VERSION) string(STRIP ${BRLCAD_PATCH_VERSION} BRLCAD_PATCH_VERSION) set(BRLCAD_VERSION "${BRLCAD_MAJOR_VERSION}.${BRLCAD_MINOR_VERSION}.${BRLCAD_PATCH_VERSION}") # Create an integer corresponding to the BRL-CAD version to simplify # comparisons - format is MMmmpp (e.g., 72400) math(EXPR BRLCAD_VERSION_NUMBER "${BRLCAD_MAJOR_VERSION} * 10000 + ${BRLCAD_MINOR_VERSION} * 100 + ${BRLCAD_PATCH_VERSION}") #--------------------------------------------------------------------- # Define relative install locations. Don't set these if they have already # been set by some other means (like a higher level CMakeLists.txt file # including this one.) # The location in which to install BRL-CAD executables. if(NOT BIN_DIR) set(BIN_DIR bin) endif(NOT BIN_DIR) # The location in which to install BRL-CAD header files. if(NOT INCLUDE_DIR) set(INCLUDE_DIR include) endif(NOT INCLUDE_DIR) # The location in which to install BRL-CAD libraries. if(NOT LIB_DIR) set(LIB_DIR lib) endif(NOT LIB_DIR) # The location in which to install BRL-CAD configuration files. if(NOT CONF_DIR) set(CONF_DIR etc) endif(NOT CONF_DIR) # The location in which to install BRL-CAD data files if(NOT DATA_DIR) set(DATA_DIR share) endif(NOT DATA_DIR) # The location in which to install BRL-CAD Manual pages if(NOT MAN_DIR) set(MAN_DIR ${DATA_DIR}/man) endif(NOT MAN_DIR) # The location in which to install BRL-CAD documentation files if(NOT DOC_DIR) set(DOC_DIR ${DATA_DIR}/doc) endif(NOT DOC_DIR) # Make sure no absolute paths have been supplied to these variables set(INSTALL_DIRS BIN INCLUDE LIB CONF DATA MAN DOC) foreach(instdir ${INSTALL_DIRS}) get_filename_component(instdir_full ${${instdir}_DIR} ABSOLUTE) if("${${instdir}_DIR}" STREQUAL "${instdir_full}") message(FATAL_ERROR "Error - absolute path supplied for ${instdir}_DIR. This path must be relative - e.g. \"bin\" instead of \"/usr/bin\"") set(HAVE_INSTALL_DIR_FULL_PATH 1) endif("${${instdir}_DIR}" STREQUAL "${instdir_full}") endforeach(instdir ${INSTALL_DIRS}) #--------------------------------------------------------------------- # Searching the system for packages presents something of a dilemma - # in most situations it is Very Bad for a BRL-CAD build to be using # older versions of libraries in install directories as search results. # Generally, the desired behavior is to ignore whatever libraries are # in the install directories, and only use external library results if # they are something already found on the system due to non-BRL-CAD # installation (source compile, package managers, etc.). Unfortunately, # CMake's standard behavior is to add CMAKE_INSTALL_PREFIX to the search # path once defined, resulting in (for us) the unexpected behavior of # returning old installed libraries when CMake is re-run in a directory. # # To work around this, there are two possible approaches. One, # identified by Maik Beckmann, operates on CMAKE_SYSTEM_PREFIX_PATH: # # http://www.cmake.org/pipermail/cmake/2010-October/040292.html # # The other, pointed out by Michael Hertling, uses the # CMake_[SYSTEM_]IGNORE_PATH variables. # # http://www.cmake.org/pipermail/cmake/2011-May/044503.html # # BRL-CAD initially operated on CMAKE_SYSTEM_PREFIX_PATH, but has # switched to using the *_IGNORE_PATH variables. This requires # CMake 2.8.3 or later. # # The complication with ignoring install paths is if we are # installing to a "legitimate" system search path - i.e. our # CMAKE_INSTALL_PREFIX value is standard enough that it is a legitimate # search target for find_package. In this case, we can't exclude # accidental hits on our libraries without also excluding legitimate # find_package results. So the net results are: # # 1. If you are planning to install to a system directory (typically # a bad idea but the settings are legal) clean out the old system # first or accept that the old libraries will be found and used. # # 2. For more custom paths, the logic below will avoid the value # of CMAKE_INSTALL_PREFIX in find_package searches # # (Note: CMAKE_INSTALL_PREFIX must be checked in the case where someone # sets it on the command line prior to CMake being run. BRLCAD_PREFIX # preserves the CMAKE_INSTALL_PREFIX setting from the previous CMake run. # CMAKE_INSTALL_PREFIX does not seem to be immediately set in this context # when CMake is re-run unless specified explicitly on the command line. # To ensure the previous (and internally set) CMAKE_INSTALL_PREFIX value # is available, BRLCAD_PREFIX is used to store the value in the cache.) if(CMAKE_INSTALL_PREFIX) if(NOT ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr" AND NOT ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local") get_filename_component(PATH_NORMALIZED ${CMAKE_INSTALL_PREFIX}/${LIB_DIR} ABSOLUTE) set(CMAKE_SYSTEM_IGNORE_PATH ${PATH_NORMALIZED}) endif(NOT ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr" AND NOT ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local") endif(CMAKE_INSTALL_PREFIX) if(BRLCAD_PREFIX) if(NOT ${BRLCAD_PREFIX} STREQUAL "/usr" AND NOT ${BRLCAD_PREFIX} STREQUAL "/usr/local") get_filename_component(PATH_NORMALIZED ${BRLCAD_PREFIX}/${LIB_DIR} ABSOLUTE) set(CMAKE_SYSTEM_IGNORE_PATH ${PATH_NORMALIZED}) endif(NOT ${BRLCAD_PREFIX} STREQUAL "/usr" AND NOT ${BRLCAD_PREFIX} STREQUAL "/usr/local") endif(BRLCAD_PREFIX) mark_as_advanced(CMAKE_SYSTEM_IGNORE_PATH) #--------------------------------------------------------------------- # For cleaning files as part of the distclean command, CMake needs # to be aware of what various generators will (or might) write out # in each build directory. set(DISTCLEAN_OUTFILES CTestTestfile.cmake) if("${CMAKE_GENERATOR}" MATCHES "Make") set(DISTCLEAN_OUTFILES ${DISTCLEAN_OUTFILES} Makefile) endif("${CMAKE_GENERATOR}" MATCHES "Make") if("${CMAKE_GENERATOR}" MATCHES "Ninja") set(DISTCLEAN_OUTFILES ${DISTCLEAN_OUTFILES} build.ninja rules.ninja) endif("${CMAKE_GENERATOR}" MATCHES "Ninja") #--------------------------------------------------------------------- # By default (as of version 2.8.2) CMake does not provide access to # global lists of executable and library targets. This is useful # in a number of situations related to formulating custom rules and # target dependency management. To avoid the necessity of replacing # add_library and add_executable calls with custom macros, override # the function names and call the _add_* functions to access the CMake # functionality previously available under the add_* functions. See # http://www.cmake.org/pipermail/cmake/2010-September/039388.html # To allow a hypothetical parent build to disable this mechanism and # replace it, we wrap the whole show in an IF conditional. To avoid # the distcheck setup, the parent file should define the variable # BRLCAD_IS_SUBBUILD to ON. Note that this also disables the # liblib prefix check in add_library, making that the responsibility # of the parent build as well, and disables the mechanism for ensuring # that the timing code runs at the correct points during the build. # We also need to provide bookkeeping logic here for the distribution # verification or "distcheck" routines that will validate the state # of the source tree against that expected and accounted for in the # build files. The global coverage needed for the purpose results in # the add_library/add_executable command override mechanism having # to serve two purposes at once; since we only override these functions # once the logic for both jobs is intertwined below. if(NOT BRLCAD_IS_SUBBUILD) # Functions in CMake have local variable scope, # hence the use of properties to allow access to directory-specific # and global information scopes. define_property(GLOBAL PROPERTY CMAKE_LIBRARY_TARGET_LIST BRIEF_DOCS "libtarget list" FULL_DOCS "Library target list") define_property(GLOBAL PROPERTY CMAKE_EXEC_TARGET_LIST BRIEF_DOCS "exec target list" FULL_DOCS "Executable target list") define_property(GLOBAL PROPERTY CMAKE_CUSTOM_TARGET_LIST BRIEF_DOCS "custom target list" FULL_DOCS "Custom target list") define_property(GLOBAL PROPERTY CMAKE_EXTERNAL_TARGET_LIST BRIEF_DOCS "external target list" FULL_DOCS "External target list") mark_as_advanced(CMAKE_LIBRARY_TARGET_LIST) mark_as_advanced(CMAKE_EXEC_TARGET_LIST) mark_as_advanced(CMAKE_CUSTOM_TARGET_LIST) mark_as_advanced(CMAKE_EXTERNAL_TARGET_LIST) # Override and wrap add_library. While we're at it, avoid doubling up # on the lib prefix for libraries if the target name is lib function(add_library name) _add_library(${name} ${ARGN}) CMAKEFILES(${ARGN}) if(${name} MATCHES "^lib*") set_target_properties(${name} PROPERTIES PREFIX "") endif(${name} MATCHES "^lib*") set_property(GLOBAL APPEND PROPERTY CMAKE_LIBRARY_TARGET_LIST ${name}) endfunction(add_library) # Override and wrap add_executable function(add_executable name) _add_executable(${name} ${ARGN}) CMAKEFILES(${ARGN}) set_property(GLOBAL APPEND PROPERTY CMAKE_EXEC_TARGET_LIST ${name}) endfunction(add_executable) # Override and wrap add_custom_target function(add_custom_target name) _add_custom_target(${name} ${ARGN}) set_property(GLOBAL APPEND PROPERTY CMAKE_CUSTOM_TARGET_LIST ${name}) endfunction(add_custom_target) # Note that at the moment we do not need to override CMake's external # project mechanisms because CMake does not use them, but if that changes # in the future an override will need to be added here - probably of the # ExternalProject_Add functionality. # Override and wrap configure_file. In the case of configure_file, we'll # check that the file is part of the source tree and not itself a # generated file, but not reject full-path entries since there are quite a # few of them. This means that, unlike CMAKEFILES's reliance on full vs. # relative path comparisons, generated files supplied to configure_file # need to have the GENERATED property set in order to reliably tell which # files should be added to the build system's lists. Not # so critical with not-in-src-dir builds, but makes a big difference # spotting files to avoid when all generated files have source directory # prefixes. function(configure_file file targetfile) _configure_file(${file} ${targetfile} ${ARGN}) # Tag output from configure with the GENERATED tag set_source_files_properties(${targetfile} PROPERTIES GENERATED TRUE) # If it's a generated file, don't register it get_property(IS_GENERATED SOURCE ${file} PROPERTY GENERATED) if(NOT IS_GENERATED) get_filename_component(item_absolute ${file} ABSOLUTE) # If we're not in the source dir, we can do some extra checking. if(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") IS_SUBPATH("${CMAKE_BINARY_DIR}" "${item_absolute}" SUBPATH_TEST) else(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") set(SUBPATH_TEST "0") endif(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") if("${SUBPATH_TEST}" STREQUAL "0") IS_SUBPATH("${CMAKE_SOURCE_DIR}" "${item_absolute}" SUBPATH_TEST) if("${SUBPATH_TEST}" STREQUAL "1") set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES "${item_absolute}") endif("${SUBPATH_TEST}" STREQUAL "1") else("${SUBPATH_TEST}" STREQUAL "0") message(WARNING "The generated file ${file} is passed to configure_file but does not have the GENERATED source file property set in CMake. It is HIGHLY recommended that the generated property be set for this file in ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt using a command with the following form:\nset_source_files_properties( PROPERTIES GENERATED TRUE)\n(or in ${CMAKE_SOURCE_DIR}/src/other/CMakeLists.txt for third party components with their own build system.)\n") endif("${SUBPATH_TEST}" STREQUAL "0") endif(NOT IS_GENERATED) if(NOT ${targetfile} MATCHES "distclean") DISTCLEAN(${targetfile}) endif(NOT ${targetfile} MATCHES "distclean") endfunction(configure_file) # Override and wrap add_subdirectory. function(add_subdirectory name) _add_subdirectory(${name} ${ARGN}) set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${name}") set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${name}/CMakeLists.txt") DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/${name}/CMakeFiles) DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/${name}/cmake_install.cmake) foreach(clearpattern ${DISTCLEAN_OUTFILES}) DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/${name}/${clearpattern}) endforeach(clearpattern ${DISTCLEAN_OUTFILES}) endfunction(add_subdirectory) endif(NOT BRLCAD_IS_SUBBUILD) # We wrap the message function to also append ALL messages to CMakeOutput.log, # as well as printing them on the console output. if(NOT BRLCAD_IS_SUBBUILD) function(message) _message(${ARGN}) string(REPLACE ";" ": " msg "${ARGV}") file(APPEND ${BRLCAD_BINARY_DIR}/CMakeFiles/CMakeOutput.log "${msg}\n") endfunction(message) endif(NOT BRLCAD_IS_SUBBUILD) #--------------------------------------------------------------------- # CMake derives much of its functionality from modules, typically # stored in one directory - let CMake know where to find them. If we # are a subbuild, let the parent's CMAKE_MODULE_PATH supply files before # our own, otherwise misc/CMake takes first priority. set(BRLCAD_CMAKE_DIR "${BRLCAD_SOURCE_DIR}/misc/CMake") if(BRLCAD_IS_SUBBUILD) set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${BRLCAD_CMAKE_DIR}") else(BRLCAD_IS_SUBBUILD) set(CMAKE_MODULE_PATH "${BRLCAD_CMAKE_DIR};${CMAKE_MODULE_PATH}") endif(BRLCAD_IS_SUBBUILD) # Load macros that will be used to define the BRL-CAD # build logic include(${BRLCAD_CMAKE_DIR}/BRLCAD_Options.cmake) include(${BRLCAD_CMAKE_DIR}/BRLCAD_Targets.cmake) include(CheckTypeSize) #--------------------------------------------------------------------- # Save the current LC_ALL, LC_MESSAGES, and LANG environment variables # and set them to "C" so things like date output are as expected. set(_orig_lc_all $ENV{LC_ALL}) set(_orig_lc_messages $ENV{LC_MESSAGES}) set(_orig_lang $ENV{LANG}) if(_orig_lc_all) set(ENV{LC_ALL} C) endif(_orig_lc_all) if(_orig_lc_messages) set(ENV{LC_MESSAGES} C) endif(_orig_lc_messages) if(_orig_lang) set(ENV{LANG} C) endif(_orig_lang) #--------------------------------------------------------------------- # Package creation with CMake depends on the value of umask - if permissions # are such that temporary files are created without permissions needed for # generated packages, the resulting packages may behave badly when installed. # In particular, RPM packages may improperly reset permissions on core # directories such as /usr. macro(CHECK_UMASK umask_val status_var) string(REGEX REPLACE "[^x]" "" umask_x "${umask_val}") string(REGEX REPLACE "[^r]" "" umask_r "${umask_val}") string(LENGTH "${umask_r}" UMASK_HAVE_R) set(${status_var} 0) if(UMASK_HAVE_R AND "${umask_x}" STREQUAL "xxx") set(${status_var} 1) endif(UMASK_HAVE_R AND "${umask_x}" STREQUAL "xxx") endmacro(CHECK_UMASK) # Note - umask is not always an executable, so we can't use find_program # to determine whether the umask check is appropriate. IF(NOT WIN32) exec_program(umask ARGS -S OUTPUT_VARIABLE umask_curr) string(STRIP "${umask_curr}" umask_curr) CHECK_UMASK("${umask_curr}" UMASK_OK) if (NOT UMASK_OK) message(" ") message(WARNING "umask is set to ${umask_curr} - this setting is not recommended if one of the goals of this build is to generate packages. Use 'umask 022' for improved package behavior.") if(SLEEP_EXEC) execute_process(COMMAND ${SLEEP_EXEC} 1) endif(SLEEP_EXEC) endif (NOT UMASK_OK) ENDIF(NOT WIN32) #--------------------------------------------------------------------- # Unfortunately, CMake doesn't give you variables with current day, # month, etc. There are several possible approaches to this, but most # (e.g. the date command) are not cross platform. We build a small C # file which writes out the needed values to files in the build # directory. Those files are then read and stripped by CMake. set(CONFIG_TIME_DAY_FILE "${BRLCAD_BINARY_DIR}/include/conf/CONFIG_TIME_DAY") set(CONFIG_TIME_MONTH_FILE "${BRLCAD_BINARY_DIR}/include/conf/CONFIG_TIME_MONTH") set(CONFIG_TIME_YEAR_FILE "${BRLCAD_BINARY_DIR}/include/conf/CONFIG_TIME_YEAR") set(CONFIG_TIMESTAMP_FILE "${BRLCAD_BINARY_DIR}/include/conf/CONFIG_TIMESTAMP") DISTCLEAN(${CONFIG_TIME_DAY_FILE} ${CONFIG_TIME_MONTH_FILE} ${CONFIG_TIME_YEAR_FILE} ${CONFIG_TIMESTAMP_FILE}) file(MAKE_DIRECTORY "${BRLCAD_BINARY_DIR}/include") file(MAKE_DIRECTORY "${BRLCAD_BINARY_DIR}/include/conf") configure_file(${BRLCAD_CMAKE_DIR}/test_srcs/time.c.in ${CMAKE_BINARY_DIR}/CMakeTmp/time.c) TRY_RUN(TIME_RESULT TIME_COMPILED ${CMAKE_BINARY_DIR}/CMakeTmp ${CMAKE_BINARY_DIR}/CMakeTmp/time.c OUTPUT_VARIABLE COMPILEMESSAGES) if(TIME_RESULT MATCHES "^0$") file(READ ${CONFIG_TIME_DAY_FILE} CONFIG_DAY) string(STRIP ${CONFIG_DAY} CONFIG_DAY) file(READ ${CONFIG_TIME_MONTH_FILE} CONFIG_MONTH) string(STRIP ${CONFIG_MONTH} CONFIG_MONTH) file(READ ${CONFIG_TIME_YEAR_FILE} CONFIG_YEAR) string(STRIP ${CONFIG_YEAR} CONFIG_YEAR) set(CONFIG_DATE "${CONFIG_YEAR}${CONFIG_MONTH}${CONFIG_DAY}") else(TIME_RESULT MATCHES "^0$") message(FATAL_ERROR "Code to determine current date and time failed!\n") endif(TIME_RESULT MATCHES "^0$") #--------------------------------------------------------------------- # print out the title with a pretty box computed to wrap around BOX_PRINT("*** Configuring BRL-CAD Release ${BRLCAD_VERSION}, Build ${CONFIG_DATE} ***" "*") #--------------------------------------------------------------------- # CMake by default provides four different configurations for multi- # configuration build tools. We want only two - Debug and Release. if(CMAKE_CONFIGURATION_TYPES) set(CMAKE_CONFIGURATION_TYPES Debug Release) endif(CMAKE_CONFIGURATION_TYPES) #--------------------------------------------------------------------- # We want to check /usr/local by default, so add it set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /usr/local) set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} /usr/local/include) #--------------------------------------------------------------------- # Normalize the build type capitalization if(CMAKE_BUILD_TYPE) string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_UPPER) if ("${BUILD_TYPE_UPPER}" STREQUAL "RELEASE") set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type" FORCE) endif ("${BUILD_TYPE_UPPER}" STREQUAL "RELEASE") if ("${BUILD_TYPE_UPPER}" STREQUAL "DEBUG") set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Type" FORCE) endif ("${BUILD_TYPE_UPPER}" STREQUAL "DEBUG") endif(CMAKE_BUILD_TYPE) # Stash the build type so we can set up a drop-down menu in the gui if(NOT BRLCAD_IS_SUBBUILD) set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "BRL-CAD high level build configuration") set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "" Debug Release) endif(NOT BRLCAD_IS_SUBBUILD) #--------------------------------------------------------------------- # The location in which to install BRL-CAD. Only do this if # CMAKE_INSTALL_PREFIX hasn't been set already, to try and allow # parent builds (if any) some control. if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX) if(NOT CMAKE_CONFIGURATION_TYPES) if("${CMAKE_BUILD_TYPE}" MATCHES "Release") set(CMAKE_INSTALL_PREFIX "/usr/brlcad/rel-${BRLCAD_VERSION}") else("${CMAKE_BUILD_TYPE}" MATCHES "Release") set(CMAKE_INSTALL_PREFIX "/usr/brlcad/dev-${BRLCAD_VERSION}") endif("${CMAKE_BUILD_TYPE}" MATCHES "Release") else(NOT CMAKE_CONFIGURATION_TYPES) if(MSVC) if(CMAKE_CL_64) set(CMAKE_INSTALL_PREFIX "C:/Program Files/BRL-CAD ${BRLCAD_VERSION}") else(CMAKE_CL_64) set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/BRL-CAD ${BRLCAD_VERSION}") endif(CMAKE_CL_64) else(MSVC) set(CMAKE_INSTALL_PREFIX "/usr/brlcad/dev-${BRLCAD_VERSION}") endif(MSVC) endif(NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "BRL-CAD install prefix" FORCE) set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 0) endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX) set(BRLCAD_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE STRING "BRL-CAD install prefix") mark_as_advanced(BRLCAD_PREFIX) # If we've got a Release build with a Debug path or vice versa, warn about it # A "make install" of a Release build into a dev install directory or vice # versa is going to result in an install that doesn't respect BRL-CAD standard # naming conventions if("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/brlcad/dev-${BRLCAD_VERSION}") message(FATAL_ERROR "\nInstallation directory (CMAKE_INSTALL_PREFIX) is set to /usr/brlcad/dev-${BRLCAD_VERSION}, but build type is set to Release!\n") endif("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/brlcad/dev-${BRLCAD_VERSION}") if("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/brlcad/rel-${BRLCAD_VERSION}") message(FATAL_ERROR "\nInstallation directory (CMAKE_INSTALL_PREFIX) is set to /usr/brlcad/rel-${BRLCAD_VERSION}, but build type is set to Debug!\n") endif("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/brlcad/rel-${BRLCAD_VERSION}") #--------------------------------------------------------------------- # The following logic is what allows binaries to run successfully in # the build directory AND install directory. Thanks to plplot for # identifying the necessity of setting CMAKE_INSTALL_NAME_DIR on OSX. # Documentation of these options is available at # http://www.cmake.org/Wiki/CMake_RPATH_handling # use, i.e. don't skip the full RPATH for the build tree set(CMAKE_SKIP_BUILD_RPATH FALSE) # when building, don't use the install RPATH already # (but later on when installing) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) # the RPATH/INSTALL_NAME_DIR to be used when installing if (NOT APPLE) set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}:\$ORIGIN/../${LIB_DIR}") endif(NOT APPLE) # On OSX, we need to set INSTALL_NAME_DIR instead of RPATH # http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_INSTALL_NAME_DIR set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}") # add the automatically determined parts of the RPATH which point to # directories outside the build tree to the install RPATH set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) #--------------------------------------------------------------------- # Output directories - this is where built library and executable # files will be placed after building but prior to install. The # necessary variables change between single and multi configuration # build systems, so it is necessary to handle both cases on a # conditional basis. if(NOT CMAKE_CONFIGURATION_TYPES) # If we're not doing multi-configuration, just set the three main # variables to the correct values. if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BRLCAD_BINARY_DIR}/${LIB_DIR} CACHE INTERNAL "Single output directory for building all libraries.") endif(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${BRLCAD_BINARY_DIR}/${LIB_DIR} CACHE INTERNAL "Single output directory for building all archives.") endif(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BRLCAD_BINARY_DIR}/${BIN_DIR} CACHE INTERNAL "Single output directory for building all executables.") endif(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) else(NOT CMAKE_CONFIGURATION_TYPES) # Multi-configuration is more difficult. Not only do we need to # properly set the output directories, but we also need to # identify the "toplevel" directory for each configuration so # we can place files, documentation, etc. in the correct # relative positions. Because files may be placed by CMake # without a build target to put them in their proper relative build # directory position using these paths, we must fully qualify them # without using CMAKE_CFG_INTDIR. # # We define directories that may not be quite "standard" # for a particular build tool - for example, native VS2010 projects use # another directory to denote CPU type being compiled for - but CMake only # supports multi-configuration setups having multiple configurations, # not multiple compilers. # # One additional wrinkle we must watch for here is the case where # a multi-configuration setup uses "." for its internal directory - # if that's the case, we need to just set the various config output # directories to the same value. set(CFG_ROOT ${BRLCAD_BINARY_DIR}) foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES}) if(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".") set(CFG_ROOT ${BRLCAD_BINARY_DIR}/${CFG_TYPE}) endif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".") string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER) if(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}") set("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}" ${CFG_ROOT}/${LIB_DIR} CACHE INTERNAL "Single output directory for building ${CFG_TYPE} libraries.") endif(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}") if(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}") set("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}" ${CFG_ROOT}/${LIB_DIR} CACHE INTERNAL "Single output directory for building ${CFG_TYPE} archives.") endif(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}") if(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}") set("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}" ${CFG_ROOT}/${BIN_DIR} CACHE INTERNAL "Single output directory for building ${CFG_TYPE} executables.") endif(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}") if(NOT "CMAKE_BINARY_DIR_${CFG_TYPE_UPPER}") set("CMAKE_BINARY_DIR_${CFG_TYPE_UPPER}" ${CFG_ROOT} CACHE INTERNAL "Toplevel binary dir for ${CFG_TYPE} building.") endif(NOT "CMAKE_BINARY_DIR_${CFG_TYPE_UPPER}") if(NOT "BRLCAD_BINARY_DIR_${CFG_TYPE_UPPER}") set("BRLCAD_BINARY_DIR_${CFG_TYPE_UPPER}" ${CFG_ROOT} CACHE INTERNAL "Toplevel binary dir for ${CFG_TYPE} building.") endif(NOT "BRLCAD_BINARY_DIR_${CFG_TYPE_UPPER}") endforeach() endif(NOT CMAKE_CONFIGURATION_TYPES) #--------------------------------------------------------------------- # We will need a brlcad_config.h.in file to hold all the #cmakedefine # statements, which will in turn be used to generate a brlcad_conf.h # file. In autotools this process is handled by autoheader - in the # case of CMake we wrap the CHECK_* functions and the creation of the # entry in the brlcad_config.h.in file into one step via a macro. # # To avoid hitting the disk I/O any harder than necessary, we store # the eventual contents of brlcad_config.h.in as a CMake string until # it is ready to process. A global property is needed to hold the # contents, because subdirectories (in particular, src/other) may # have content to contribute to the top level config.h.in file and # the default local variable scope in subdirectories means those # changes would not automatically propagate back up. # # We also allow for multiple projects with this macro, in case # subprojects are also managing a config.h.in file of their own. set(CONFIG_H_FILE "${BRLCAD_BINARY_DIR}/include/brlcad_config.h.in") set_source_files_properties(${CONFIG_H_FILE} PROPERTIES GENERATED TRUE) set(CMAKE_CURRENT_PROJECT BRLCAD) define_property(GLOBAL PROPERTY BRLCAD_CONFIG_H_CONTENTS BRIEF_DOCS "config.h.in contents" FULL_DOCS "config.h.in contents for BRL-CAD project") if(NOT COMMAND CONFIG_H_APPEND) macro(CONFIG_H_APPEND PROJECT_NAME NEW_CONTENTS) if(PROJECT_NAME) get_property(${PROJECT_NAME}_CONFIG_H_CONTENTS GLOBAL PROPERTY ${PROJECT_NAME}_CONFIG_H_CONTENTS) set(${PROJECT_NAME}_CONFIG_H_FILE_CONTENTS "${${PROJECT_NAME}_CONFIG_H_CONTENTS}${NEW_CONTENTS}") set_property(GLOBAL PROPERTY ${PROJECT_NAME}_CONFIG_H_CONTENTS "${${PROJECT_NAME}_CONFIG_H_FILE_CONTENTS}") endif(PROJECT_NAME) endmacro(CONFIG_H_APPEND NEW_CONTENTS) endif(NOT COMMAND CONFIG_H_APPEND) CONFIG_H_APPEND(BRLCAD "/**** Define statements for CMake ****/\n") CONFIG_H_APPEND(BRLCAD "#ifndef __CONFIG_H__\n") CONFIG_H_APPEND(BRLCAD "#define __CONFIG_H__\n") # Set up some of the define statements for path information and other basics CONFIG_H_APPEND(BRLCAD "#define PACKAGE \"brlcad\"\n") CONFIG_H_APPEND(BRLCAD "#define PACKAGE_BUGREPORT \"http://brlcad.org\"\n") CONFIG_H_APPEND(BRLCAD "#define PACKAGE_NAME \"BRL-CAD\"\n") CONFIG_H_APPEND(BRLCAD "#define PACKAGE_STRING \"BRL-CAD ${BRLCAD_VERSION}\"\n") CONFIG_H_APPEND(BRLCAD "#define PACKAGE_TARNAME \"brlcad\"\n") CONFIG_H_APPEND(BRLCAD "#define BRLCAD_DATA \"${CMAKE_INSTALL_PREFIX}/${DATA_DIR}\"\n") CONFIG_H_APPEND(BRLCAD "#define BRLCAD_ROOT \"${CMAKE_INSTALL_PREFIX}\"\n") CONFIG_H_APPEND(BRLCAD "#define BRLCAD_BIN_DIR \"${BIN_DIR}\"\n") CONFIG_H_APPEND(BRLCAD "#define BRLCAD_LIB_DIR \"${LIB_DIR}\"\n") CONFIG_H_APPEND(BRLCAD "#define BRLCAD_INCLUDE_DIR \"${INCLUDE_DIR}\"\n") CONFIG_H_APPEND(BRLCAD "#define BRLCAD_DATA_DIR \"${DATA_DIR}\"\n") CONFIG_H_APPEND(BRLCAD "#define BRLCAD_DOC_DIR \"${DOC_DIR}\"\n") CONFIG_H_APPEND(BRLCAD "#define BRLCAD_MAN_DIR \"${MAN_DIR}\"\n") CONFIG_H_APPEND(BRLCAD "#define PACKAGE_VERSION \"${BRLCAD_VERSION}\"\n") CONFIG_H_APPEND(BRLCAD "#define VERSION \"${BRLCAD_VERSION}\"\n") CONFIG_H_APPEND(BRLCAD "#define BRLCAD_VERSION_NUMBER ${BRLCAD_VERSION_NUMBER}\n") #---------------------------------------------------------------------- # Decide whether to do a 32 or a 64 bit build. set(WORD_SIZE_LABEL "Compile as 32BIT or 64BIT?") if(NOT BRLCAD_WORD_SIZE) set(BRLCAD_WORD_SIZE "AUTO" CACHE STRING WORD_SIZE_LABEL) endif(NOT BRLCAD_WORD_SIZE) set_property(CACHE BRLCAD_WORD_SIZE PROPERTY STRINGS AUTO 32BIT 64BIT) string(TOUPPER "${BRLCAD_WORD_SIZE}" BRLCAD_WORD_SIZE_UPPER) set(BRLCAD_WORD_SIZE "${BRLCAD_WORD_SIZE_UPPER}" CACHE STRING WORD_SIZE_LABEL FORCE) if(NOT BRLCAD_WORD_SIZE MATCHES "AUTO" AND NOT BRLCAD_WORD_SIZE MATCHES "64BIT" AND NOT BRLCAD_WORD_SIZE MATCHES "32BIT") message(WARNING "Unknown value ${BRLCAD_WORD_SIZE} supplied for BRLCAD_WORD_SIZE - defaulting to AUTO") message(WARNING "Valid options are AUTO, 32BIT and 64BIT") set(BRLCAD_WORD_SIZE "AUTO" CACHE STRING WORD_SIZE_LABEL FORCE) endif(NOT BRLCAD_WORD_SIZE MATCHES "AUTO" AND NOT BRLCAD_WORD_SIZE MATCHES "64BIT" AND NOT BRLCAD_WORD_SIZE MATCHES "32BIT") # On Windows, we can't set word size at CMake configure time - the # compiler chosen at the beginning dictates the result. Mark as # advanced in that situation. if(MSVC) mark_as_advanced(BRLCAD_WORD_SIZE) endif(MSVC) # calculate the size of a pointer if we haven't already CHECK_TYPE_SIZE("void *" CMAKE_SIZEOF_VOID_P) # still not defined? if(NOT CMAKE_SIZEOF_VOID_P) message(WARNING "CMAKE_SIZEOF_VOID_P is not defined - assuming 32 bit platform") set(CMAKE_SIZEOF_VOID_P 4) endif(NOT CMAKE_SIZEOF_VOID_P) if(${BRLCAD_WORD_SIZE} MATCHES "AUTO") if(${CMAKE_SIZEOF_VOID_P} MATCHES "^8$") set(CMAKE_WORD_SIZE "64BIT") set(BRLCAD_WORD_SIZE "64BIT (AUTO)" CACHE STRING WORD_SIZE_LABEL FORCE) else(${CMAKE_SIZEOF_VOID_P} MATCHES "^8$") if(${CMAKE_SIZEOF_VOID_P} MATCHES "^4$") set(CMAKE_WORD_SIZE "32BIT") set(BRLCAD_WORD_SIZE "32BIT (AUTO)" CACHE STRING WORD_SIZE_LABEL FORCE) else(${CMAKE_SIZEOF_VOID_P} MATCHES "^4$") if(${CMAKE_SIZEOF_VOID_P} MATCHES "^2$") set(CMAKE_WORD_SIZE "16BIT") set(BRLCAD_WORD_SIZE "16BIT (AUTO)" CACHE STRING WORD_SIZE_LABEL FORCE) else(${CMAKE_SIZEOF_VOID_P} MATCHES "^2$") set(CMAKE_WORD_SIZE "8BIT") set(BRLCAD_WORD_SIZE "8BIT (AUTO)" CACHE STRING WORD_SIZE_LABEL FORCE) endif(${CMAKE_SIZEOF_VOID_P} MATCHES "^2$") endif(${CMAKE_SIZEOF_VOID_P} MATCHES "^4$") endif(${CMAKE_SIZEOF_VOID_P} MATCHES "^8$") else(${BRLCAD_WORD_SIZE} MATCHES "AUTO") set(CMAKE_WORD_SIZE "${BRLCAD_WORD_SIZE}") endif(${BRLCAD_WORD_SIZE} MATCHES "AUTO") CONFIG_H_APPEND(BRLCAD "#define SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}\n") # Enable/disable 64-bit build settings for MSVC, which is apparently # determined at the CMake generator level - need to override other # settings if the compiler disagrees with them. if(MSVC) if(CMAKE_CL_64) if(NOT ${CMAKE_WORD_SIZE} MATCHES "64BIT") set(CMAKE_WORD_SIZE "64BIT") if(NOT "${BRLCAD_WORD_SIZE}" MATCHES "AUTO") message(WARNING "Selected MSVC compiler is 64BIT - setting word size to 64BIT. To perform a 32BIT MSVC build, select the 32BIT MSVC CMake generator.") set(BRLCAD_WORD_SIZE "64BIT" CACHE STRING WORD_SIZE_LABEL FORCE) endif(NOT "${BRLCAD_WORD_SIZE}" MATCHES "AUTO") endif(NOT ${CMAKE_WORD_SIZE} MATCHES "64BIT") add_definitions("-D_WIN64") else(CMAKE_CL_64) if(NOT ${CMAKE_WORD_SIZE} MATCHES "32BIT") set(CMAKE_WORD_SIZE "32BIT") if(NOT "${BRLCAD_WORD_SIZE}" MATCHES "AUTO") message(WARNING "Selected MSVC compiler is 32BIT - setting word size to 32BIT. To perform a 64BIT MSVC build, select the 64BIT MSVC CMake generator.") set(BRLCAD_WORD_SIZE "32BIT" CACHE STRING WORD_SIZE_LABEL FORCE) endif(NOT "${BRLCAD_WORD_SIZE}" MATCHES "AUTO") endif(NOT ${CMAKE_WORD_SIZE} MATCHES "32BIT") endif(CMAKE_CL_64) endif(MSVC) # Based on what we are doing, we may need to constrain our search paths # # NOTE: Ideally we would set a matching property for 32 bit paths # on systems that default to 64 bit - as of 2.8.8 CMake doesn't yet # support FIND_LIBRARY_USE_LIB32_PATHS. There is a bug report on the # topic here: http://www.cmake.org/Bug/view.php?id=11260 # if(${CMAKE_WORD_SIZE} MATCHES "32BIT") set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF) else(${CMAKE_WORD_SIZE} MATCHES "32BIT") set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON) endif(${CMAKE_WORD_SIZE} MATCHES "32BIT") # One of the problems with 32/64 building is we need to search anew # for 64 bit libs after a 32 bit configure, or vice versa. if(PREVIOUS_CONFIGURE_TYPE) if(NOT ${PREVIOUS_CONFIGURE_TYPE} MATCHES ${CMAKE_WORD_SIZE}) include(${BRLCAD_CMAKE_DIR}/ResetCache.cmake) RESET_CACHE_file() endif(NOT ${PREVIOUS_CONFIGURE_TYPE} MATCHES ${CMAKE_WORD_SIZE}) endif(PREVIOUS_CONFIGURE_TYPE) set(PREVIOUS_CONFIGURE_TYPE ${CMAKE_WORD_SIZE} CACHE STRING "Previous configuration word size" FORCE) mark_as_advanced(PREVIOUS_CONFIGURE_TYPE) # Auto-reconfiguration - by default, a CMake generated build system # will re-run CMake if it detects that build system logic has changed. # This is normally a good thing, but becomes problematic when using # Visual Studio - recent versions of MSVC will individually prompt for # a re-loading of generated solution files one at a time. Since # BRL-CAD has over a thousand such files in a default build, the only # viable approach is to close Visual Studio, re-run CMake manually, # and re-open the project in Visual Studio. if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") set(CMAKE_SUPPRESS_REGENERATION ON) endif("${CMAKE_GENERATOR}" MATCHES "Visual Studio") # ******************************************************************* # *** Top Level Configure Options - Stage 1 of 9 *** # ******************************************************************* # # Now we define the various options for BRL-CAD - ways to enable and # disable features, select which parts of the system to build, etc. # As much as possible, sane default options are either selected or # detected. Because documentation is autogenerated for BRL-CAD # options, be sure to initialize the file. set(CONFIG_OPT_STRING "CONFIGURATION OPTIONS\n---------------------\n") file(WRITE ${CMAKE_BINARY_DIR}/OPTIONS "${CONFIG_OPT_STRING}") # The BRL-CAD CMake build will also generate a configure script # that emulates the command option style of GNU Autotool's # configure. Write the pre-defined header into the build-dir template # to initialize the file. file(REMOVE ${CMAKE_BINARY_DIR}/configure.new) file(READ ${BRLCAD_CMAKE_DIR}/configure_prefix.sh CONFIG_PREFIX) file(WRITE ${CMAKE_BINARY_DIR}/configure.new.tmp "${CONFIG_PREFIX}") file(COPY ${CMAKE_BINARY_DIR}/configure.new.tmp DESTINATION ${CMAKE_BINARY_DIR}/CMakeFiles FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) file(REMOVE ${CMAKE_BINARY_DIR}/configure.new.tmp) file(RENAME ${CMAKE_BINARY_DIR}/CMakeFiles/configure.new.tmp ${CMAKE_BINARY_DIR}/configure.new) # Build shared libs by default. Mark this as advanced - turning off # ALL shared library building is unlikely to result in a working build # and is not a typical configuration. Note that turning this option off # will not disable libraries specifically added as SHARED. option(BUILD_SHARED_LIBS "Build shared libraries" ON) mark_as_advanced(BUILD_SHARED_LIBS) # Build static libs by default unless we're debugging. Note: this # option will not disable libraries specifically added as STATIC even # when OFF. For multi-configuration options the build type determination # is made at build time, so just default to "ON". if(NOT CMAKE_CONFIGURATION_TYPES) AUTO_OPTION(BRLCAD_BUILD_STATIC_LIBS BUILD_STATIC_LIBS "OFF" "ON") else(NOT CMAKE_CONFIGURATION_TYPES) if("${BRLCAD_BUILD_STATIC_LIBS}" STREQUAL "") set(BRLCAD_BUILD_STATIC_LIBS ON) endif("${BRLCAD_BUILD_STATIC_LIBS}" STREQUAL "") set(BUILD_STATIC_LIBS "${BRLCAD_BUILD_STATIC_LIBS}") endif(NOT CMAKE_CONFIGURATION_TYPES) # On Mac OS X, it is common to have third party package managers # present for easy software installation (currently we're aware of # Fink and MacPorts). This can seriously complicate find_* results, # so provide an option to specify whether or which of the third # party setup to use. include(${BRLCAD_CMAKE_DIR}/Fink_MacPorts.cmake) # Option for librtserver, used to help Java programs interface with librt. # Find Java and JNI, and conditionalize the default setting on Java's # availability FIND_PACKAGE(Java) FIND_PACKAGE(JNI) if(JNI_FOUND AND JAVA_FOUND) option(BRLCAD_ENABLE_RTSERVER "Enable the librtserver target." ON) else(JNI_FOUND AND JAVA_FOUND) option(BRLCAD_ENABLE_RTSERVER "Enable the librtserver target." OFF) endif(JNI_FOUND AND JAVA_FOUND) # Turn off the brlcad.dll build. # It's an expert's setting at the moment. option(BRLCAD_ENABLE_BRLCAD_LIBRARY "Build the brlcad.dll" OFF) mark_as_advanced(BRLCAD_ENABLE_BRLCAD_LIBRARY) # Global third party controls - these options enable and disable ALL # local copies of libraries in src/other. Forcing all local # libraries off is not usually recommended unless attempting to # build packages for a distribution. If both of these options are # on the enabling of local packages is the "senior" option and will # force the system libs option to off. set(BRLCAD_BUNDLED_LIBS_ALIASES "ENABLE_ALL") set(BRLCAD_BUNDLED_LIBS_DESCRIPTION " Enables compilation of all 3rd party sources that are provided within a BRL-CAD source distribution. If used this option sets all other 3rd party library build flags to ON by default. However, that setting can be overridden by manually setting individual variables. Default is \"AUTO\" - 3rd party sources are compiled only if they are not detected as being available and functioning as expected. ") if(MSVC) set(BRLCAD_BUNDLED_LIBS_DEFAULT "BUNDLED") else(MSVC) set(BRLCAD_BUNDLED_LIBS_DEFAULT "AUTO") endif(MSVC) BRLCAD_OPTION(${BRLCAD_BUNDLED_LIBS_DEFAULT} BRLCAD_BUNDLED_LIBS BRLCAD_BUNDLED_LIBS_ALIASES BRLCAD_BUNDLED_LIBS_DESCRIPTION) set_property(CACHE BRLCAD_BUNDLED_LIBS PROPERTY STRINGS AUTO BUNDLED SYSTEM) string(TOUPPER "${BRLCAD_BUNDLED_LIBS}" BRLCAD_BUNDLED_LIBS_UPPER) set(BRLCAD_BUNDLED_LIBS "${BRLCAD_BUNDLED_LIBS_UPPER}" CACHE STRING "Build bundled libraries." FORCE) if(${BRLCAD_BUNDLED_LIBS} MATCHES "ON") set(BRLCAD_BUNDLED_LIBS "BUNDLED" CACHE STRING "Build bundled libraries." FORCE) endif(${BRLCAD_BUNDLED_LIBS} MATCHES "ON") if(${BRLCAD_BUNDLED_LIBS} MATCHES "OFF") set(BRLCAD_BUNDLED_LIBS "SYSTEM" CACHE STRING "Build bundled libraries." FORCE) endif(${BRLCAD_BUNDLED_LIBS} MATCHES "OFF") if(NOT BRLCAD_BUNDLED_LIBS MATCHES "AUTO" AND NOT BRLCAD_BUNDLED_LIBS MATCHES "BUNDLED" AND NOT BRLCAD_BUNDLED_LIBS MATCHES "SYSTEM") message(WARNING "Unknown value BRLCAD_BUNDLED_LIBS supplied for BRLCAD_BUNDLED_LIBS - defaulting to AUTO") message(WARNING "Valid options are AUTO, BUNDLED and SYSTEM") set(BRLCAD_BUNDLED_LIBS "AUTO" CACHE STRING "Build bundled libraries." FORCE) endif(NOT BRLCAD_BUNDLED_LIBS MATCHES "AUTO" AND NOT BRLCAD_BUNDLED_LIBS MATCHES "BUNDLED" AND NOT BRLCAD_BUNDLED_LIBS MATCHES "SYSTEM") # Enable Aqua widgets on Mac OSX. This impacts Tcl/Tk building and OpenGL # building. Not currently working - needs work in at least Tk # CMake logic (probably more), and the display manager/framebuffer codes are known to depend # on either GLX or WGL specifically in their current forms. option(BRLCAD_ENABLE_AQUA "Use Aqua instead of X11 whenever possible on OSX." OFF) mark_as_advanced(BRLCAD_ENABLE_AQUA) # Install example BRL-CAD Geometry Files option(BRLCAD_INSTALL_EXAMPLE_GEOMETRY "Install the example BRL-CAD geometry files." ON) # test for X11 on all platforms since we don't know when/where we'll find it include(${BRLCAD_CMAKE_DIR}/FindX11.cmake) # Set whether X11 is enabled or disabled by default if(WIN32) # even if there is x11, we default to native option(BRLCAD_ENABLE_X11 "Use X11." OFF) elseif(BRLCAD_ENABLE_AQUA) # aqua implies no X11 option(BRLCAD_ENABLE_X11 "Use X11." OFF) else(WIN32) # make everywhere else depend on whether we found a suitable X11 if(X11_X11_LIB AND X11_Xext_LIB AND X11_Xi_LIB AND X11_Xlib_INCLUDE_PATH) option(BRLCAD_ENABLE_X11 "Use X11." ON) else(X11_X11_LIB AND X11_Xext_LIB AND X11_Xi_LIB AND X11_Xlib_INCLUDE_PATH) option(BRLCAD_ENABLE_X11 "Use X11." OFF) endif(X11_X11_LIB AND X11_Xext_LIB AND X11_Xi_LIB AND X11_Xlib_INCLUDE_PATH) endif(WIN32) mark_as_advanced(BRLCAD_ENABLE_X11) # if X11 is enabled, make sure aqua is off if(BRLCAD_ENABLE_X11) set(BRLCAD_ENABLE_AQUA OFF CACHE STRING "Don't use Aqua if we're doing X11" FORCE) set(OPENGL_USE_AQUA OFF CACHE STRING "Don't use Aqua if we're doing X11" FORCE) endif(BRLCAD_ENABLE_X11) mark_as_advanced(OPENGL_USE_AQUA) # Enable/disable features requiring the Tk toolkit - usually this should # be on, as a lot of functionality in BRL-CAD depends on Tk option(BRLCAD_ENABLE_TK "Enable features requiring the Tk toolkit" ON) mark_as_advanced(BRLCAD_ENABLE_TK) if(NOT BRLCAD_ENABLE_X11 AND NOT BRLCAD_ENABLE_AQUA AND NOT WIN32) set(BRLCAD_ENABLE_TK OFF) endif(NOT BRLCAD_ENABLE_X11 AND NOT BRLCAD_ENABLE_AQUA AND NOT WIN32) if(BRLCAD_ENABLE_X11) set(TK_X11_GRAPHICS ON CACHE STRING "Need X11 Tk" FORCE) endif(BRLCAD_ENABLE_X11) # Enable features requiring OPENGL # Be smart about this - if we don't have X11 or Aqua and we're # not on Windows, we're non-graphical and that means OpenGL is # a no-go. The Windows version would have to be some sort of # option for the WIN32 graphics layer? Should probably think # about that... for now, on Win32 don't try OpenGL if Tk is # off. That'll hold until we get a non-Tk based GUI - then # setting non-graphical on Windows will take more thought. if(NOT BRLCAD_ENABLE_X11 AND NOT BRLCAD_ENABLE_AQUA AND NOT WIN32) set(OPENGL_FOUND OFF) set(BRLCAD_ENABLE_OPENGL OFF CACHE BOOL "Disabled - NOT BRLCAD_ENABLE_X11 and NOT BRLCAD_ENABLE_AQUA" FORCE) else(NOT BRLCAD_ENABLE_X11 AND NOT BRLCAD_ENABLE_AQUA AND NOT WIN32) include(${BRLCAD_CMAKE_DIR}/FindGL.cmake) endif(NOT BRLCAD_ENABLE_X11 AND NOT BRLCAD_ENABLE_AQUA AND NOT WIN32) set(BRLCAD_ENABLE_OPENGL_ALIASES ENABLE_OPENGL ) set(BRLCAD_ENABLE_OPENGL_DESCRIPTION " Enable support for OpenGL based Display Managers in BRL-CAD. Default depends on whether OpenGL is successfully detected - if it is, default is to enable. ") BRLCAD_OPTION(${OPENGL_FOUND} BRLCAD_ENABLE_OPENGL BRLCAD_ENABLE_OPENGL_ALIASES BRLCAD_ENABLE_OPENGL_DESCRIPTION) # Enable RTGL. Requires an enabled OpenGL. option(BRLCAD_ENABLE_RTGL "Enable experimental RTGL code." OFF) mark_as_advanced(BRLCAD_ENABLE_RTGL) if(NOT BRLCAD_ENABLE_OPENGL AND BRLCAD_ENABLE_RTGL) message("RTGL requested, but OpenGL is not enabled - disabling") set(BRLCAD_ENABLE_RTGL OFF CACHE BOOL "Enable experimental RTGL code." FORCE) endif(NOT BRLCAD_ENABLE_OPENGL AND BRLCAD_ENABLE_RTGL) if(NOT BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_RTGL) message("RTGL currently works only with GLX, and X11 is not enabled - disabling") set(BRLCAD_ENABLE_RTGL OFF CACHE BOOL "Enable experimental RTGL code." FORCE) endif(NOT BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_RTGL) if(BRLCAD_ENABLE_AQUA) set(OPENGL_USE_AQUA ON CACHE STRING "Aqua enabled - use Aqua OpenGL" FORCE) endif(BRLCAD_ENABLE_AQUA) # Enable features requiring Qt find_package(Qt5Widgets QUIET) option(BRLCAD_ENABLE_QT "Enable features requiring Qt" OFF) mark_as_advanced(BRLCAD_ENABLE_QT) if(NOT Qt5Widgets_FOUND AND BRLCAD_ENABLE_QT) message("QT interface requested, but QT5 is not found - disabling") set(BRLCAD_ENABLE_QT OFF) endif(NOT Qt5Widgets_FOUND AND BRLCAD_ENABLE_QT) mark_as_advanced(Qt5Widgets_DIR) #---------------------------------------------------------------------- # The following are fine-grained options for enabling/disabling compiler # and source code definition settings. Typically these are set to # various configurations by the toplevel CMAKE_BUILD_TYPE setting, but # can also be individually set. # Enable/disable runtime debugging - these are protections for # minimizing the possibility of corrupted data files. Generally # speaking these should be left on. set(BRLCAD_ENABLE_RUNTIME_DEBUG_ALIASES ENABLE_RUNTIME_DEBUG ENABLE_RUN_TIME_DEBUG ENABLE_RUNTIME_DEBUGGING ENABLE_RUN_TIME_DEBUGGING) set(BRLCAD_ENABLE_RUNTIME_DEBUG_DESCRIPTION " Enables support for application and library debugging facilities. Disabling the run-time debugging facilities can provide a significant (10%-30%) performance boost at the expense of extensive error checking (that in turn help prevent corruption of your data). Default is \"ON\", and should only be disabled for read-only render work where performance is critical. ") BRLCAD_OPTION(ON BRLCAD_ENABLE_RUNTIME_DEBUG BRLCAD_ENABLE_RUNTIME_DEBUG_ALIASES BRLCAD_ENABLE_RUNTIME_DEBUG_DESCRIPTION) mark_as_advanced(BRLCAD_ENABLE_RUNTIME_DEBUG) if(NOT BRLCAD_ENABLE_RUNTIME_DEBUG) message("}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}") message("While disabling run-time debugging should increase") message("performance, it will likewise remove several") message("data-protection safeguards that are in place to") message("minimize the possibility of corrupted data files") message("in the inevitable event of a user encountering a bug.") message("You have been warned. Proceed at your own risk.") message("{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{") CONFIG_H_APPEND(BRLCAD "/*Define to not do anything for macros that only bomb on a fatal error. */\n") CONFIG_H_APPEND(BRLCAD "#define NO_BOMBING_MACROS 1\n") CONFIG_H_APPEND(BRLCAD "/*Define to not perform magic number checking */\n") CONFIG_H_APPEND(BRLCAD "#define NO_MAGIC_CHECKING 1\n") CONFIG_H_APPEND(BRLCAD "/*Define to not provide run-time debug facilities via RTG.debug */\n") CONFIG_H_APPEND(BRLCAD "#define NO_DEBUG_CHECKING 1\n") endif(NOT BRLCAD_ENABLE_RUNTIME_DEBUG) # Enable debug flags during compilation - we always want to use these # unless explicitly told not to. set(BRLCAD_FLAGS_DEBUG_ALIASES ENABLE_DEBUG ENABLE_FLAGS_DEBUG ENABLE_DEBUG_FLAGS ) set(BRLCAD_FLAGS_DEBUG_DESCRIPTION " Add compiler flags to aid in program debugging. Defaults to ON. ") BRLCAD_OPTION(ON BRLCAD_FLAGS_DEBUG BRLCAD_FLAGS_DEBUG_ALIASES BRLCAD_FLAGS_DEBUG_DESCRIPTION) # A variety of debugging messages in the code key off of the DEBUG # definition - set it according to whether we're using debug flags. if(BRLCAD_FLAGS_DEBUG) CONFIG_H_APPEND(BRLCAD "#define DEBUG 1\n") endif(BRLCAD_FLAGS_DEBUG) # Build with compiler warning flags set(BRLCAD_ENABLE_COMPILER_WARNINGS_ALIASES ENABLE_WARNINGS ENABLE_COMPILER_WARNINGS ) set(BRLCAD_ENABLE_COMPILER_WARNINGS_DESCRIPTION " Use extra compiler warning flags when compiling C/C++ code. Defaults to ON. ") BRLCAD_OPTION(ON BRLCAD_ENABLE_COMPILER_WARNINGS BRLCAD_ENABLE_COMPILER_WARNINGS_ALIASES BRLCAD_ENABLE_COMPILER_WARNINGS_DESCRIPTION) mark_as_advanced(BRLCAD_ENABLE_COMPILER_WARNINGS) # Enable/disable strict compiler settings - these are used for building # BRL-CAD by default, but not src/other code. Always used for BRL-CAD # code unless the NO_STRICT option is specified when defining a target # with BRLCAD_ADDEXEC or BRLCAD_ADDLIB. If only C++ files in a target # are not compatible with strict, the NO_STRICT_CXX option can be used. set(BRLCAD_ENABLE_STRICT_ALIASES ENABLE_STRICT ENABLE_STRICT_COMPILE ENABLE_STRICT_COMPILE_FLAGS) set(BRLCAD_ENABLE_STRICT_DESCRIPTION " Causes all compilation warnings for C code to be treated as errors. This is now the default for BRL-CAD source code, and developers should address issues discovered by these flags whenever possible rather than disabling strict mode. ") BRLCAD_OPTION(ON BRLCAD_ENABLE_STRICT BRLCAD_ENABLE_STRICT_ALIASES BRLCAD_ENABLE_STRICT_DESCRIPTION) if(BRLCAD_ENABLE_STRICT) mark_as_advanced(BRLCAD_ENABLE_STRICT) CONFIG_H_APPEND(BRLCAD "#define STRICT_FLAGS 1\n") endif(BRLCAD_ENABLE_STRICT) # Build with compiler optimization flags. This should normally be on for # release builds. AUTO_OPTION(BRLCAD_FLAGS_OPTIMIZATION BRLCAD_OPTIMIZED_BUILD "OFF" "ON") # By default, we don't want any error reports at all from src/other option(BRLCAD_DISABLE_SRC_OTHER_WARN "Disable warnings for src/other" ON) mark_as_advanced(BRLCAD_DISABLE_SRC_OTHER_WARN) # Build with full compiler lines visible by default (won't need make # VERBOSE=1) on command line option(BRLCAD_ENABLE_VERBOSE_PROGRESS "verbose output" OFF) mark_as_advanced(BRLCAD_ENABLE_VERBOSE_PROGRESS) if(BRLCAD_ENABLE_VERBOSE_PROGRESS) set(CMAKE_VERBOSE_MAKEFILE ON) endif(BRLCAD_ENABLE_VERBOSE_PROGRESS) # Build with profiling support option(BRLCAD_ENABLE_PROFILING "Build with profiling support" OFF) mark_as_advanced(BRLCAD_ENABLE_PROFILING) # Build with dtrace support option(BRLCAD_ENABLE_DTRACE "Build with dtrace support" OFF) mark_as_advanced(BRLCAD_ENABLE_DTRACE) if(BRLCAD_ENABLE_DTRACE) BRLCAD_INCLUDE_FILE(sys/sdt.h HAVE_SYS_SDT_H) if(NOT HAVE_SYS_SDT_H) set(BRLCAD_ENABLE_DTRACE OFF) endif(NOT HAVE_SYS_SDT_H) endif(BRLCAD_ENABLE_DTRACE) # Take advantage of parallel processors if available - highly recommended option(BRLCAD_ENABLE_SMP "Enable SMP architecture parallel computation support" ON) if(WIN32 AND BRLCAD_ENABLE_SMP) message("SMP Support is not ready on Windows - disabling") set(BRLCAD_ENABLE_SMP OFF) endif(WIN32 AND BRLCAD_ENABLE_SMP) mark_as_advanced(BRLCAD_ENABLE_SMP) if(BRLCAD_ENABLE_SMP) CONFIG_H_APPEND(BRLCAD "#define PARALLEL 1\n") endif(BRLCAD_ENABLE_SMP) #---------------------------------------------------------------------- # There are extra documentation files available requiring DocBook # They are quite useful in graphical interfaces, but also add considerably # to the overall build time. If necessary BRL-CAD provides its own # xsltproc (see src/other/xmltools), so the html and man page # outputs are always potentially available. PDF output, on the other hand, # needs Apache FOP. FOP is not a candidate for bundling with BRL-CAD for # a number of reasons, so we simply check to see if it is present and set # the options accordingly. # Do we have the environment variable set locally? if(NOT "$ENV{APACHE_FOP}" STREQUAL "") set(APACHE_FOP "$ENV{APACHE_FOP}") endif(NOT "$ENV{APACHE_FOP}" STREQUAL "") if(NOT APACHE_FOP) find_program(APACHE_FOP fop DOC "path to the exec script for Apache FOP") endif(NOT APACHE_FOP) mark_as_advanced(APACHE_FOP) # We care about the FOP version, unfortunately - find out what we have. if(APACHE_FOP) execute_process(COMMAND ${APACHE_FOP} -v OUTPUT_VARIABLE APACHE_FOP_INFO ERROR_QUIET) string(REGEX REPLACE "FOP Version ([0-9\\.]*)" "\\1" APACHE_FOP_VERSION_REGEX "${APACHE_FOP_INFO}") if(APACHE_FOP_VERSION_REGEX) string(STRIP ${APACHE_FOP_VERSION_REGEX} APACHE_FOP_VERSION_REGEX) endif(APACHE_FOP_VERSION_REGEX) if(NOT "${APACHE_FOP_VERSION}" STREQUAL "${APACHE_FOP_VERSION_REGEX}") message("-- Found Apache FOP: version ${APACHE_FOP_VERSION_REGEX}") set(APACHE_FOP_VERSION ${APACHE_FOP_VERSION_REGEX} CACHE STRING "Apache FOP version" FORCE) mark_as_advanced(APACHE_FOP_VERSION) endif(NOT "${APACHE_FOP_VERSION}" STREQUAL "${APACHE_FOP_VERSION_REGEX}") endif(APACHE_FOP) # Toplevel variable that controls all DocBook based documentation. Key it off # of what target level is enabled. if(NOT BRLCAD_ENABLE_TARGETS OR "${BRLCAD_ENABLE_TARGETS}" GREATER 2) set(EXTRADOCS_DEFAULT "ON") else(NOT BRLCAD_ENABLE_TARGETS OR "${BRLCAD_ENABLE_TARGETS}" GREATER 2) set(EXTRADOCS_DEFAULT "OFF") endif(NOT BRLCAD_ENABLE_TARGETS OR "${BRLCAD_ENABLE_TARGETS}" GREATER 2) set(BRLCAD_EXTRADOCS_ALIASES ENABLE_DOCS ENABLE_EXTRA_DOCS ENABLE_DOCBOOK ) set(BRLCAD_EXTRADOCS_DESCRIPTION " The core option that enables and disables building of BRL-CAD's DocBook based documentation (includes manuals and man pages for commands, among other things.) Defaults to ON, but only HTML and MAN formats are enabled by default - PDF must be enabled separately by use of this option or one of its aliases. Note that you may set environment variable APACHE_FOP to point to your locally installed fop executable file (which on Linux is usually a shell script with 0755 permissions). ") BRLCAD_OPTION(${EXTRADOCS_DEFAULT} BRLCAD_EXTRADOCS BRLCAD_EXTRADOCS_ALIASES BRLCAD_EXTRADOCS_DESCRIPTION) include(CMakeDependentOption) # The HTML output is used in the graphical help browsers in MGED and Archer, # as well as being the most likely candidate for external viewers. Turn this # on unless explicitly instructed otherwise by the user or all extra # documentation is disabled. CMAKE_DEPENDENT_OPTION(BRLCAD_EXTRADOCS_HTML "Build MAN page output from DocBook documentation" ON "BRLCAD_EXTRADOCS" OFF) mark_as_advanced(BRLCAD_EXTRADOCS_HTML) # Normally, we'll turn on man page output by default, but there is # no point in doing man page output for a Visual Studio build - the # files aren't useful and it *seriously* increases the target build # count/build time. Conditionalize on the CMake MSVC variable NOT # being set. CMAKE_DEPENDENT_OPTION(BRLCAD_EXTRADOCS_MAN "Build MAN page output from DocBook documentation" ON "BRLCAD_EXTRADOCS;NOT MSVC" OFF) mark_as_advanced(BRLCAD_EXTRADOCS_MAN) # Don't do PDF by default, and hide the option unless the tools to do it are # present. Provide an option to disable the PDF output for man pages without # disabling the rest of the PDF output - PDF generation for hundreds of man # pages can be expensive in time. set(BRLCAD_EXTRADOCS_PDF_DESCRIPTION " Option that enables building of BRL-CAD's DocBook PDF-based documentation (includes manuals and man pages for commands, among other things.) Defaults to OFF. Note that you may set environment variable APACHE_FOP to point to your locally installed fop executable file (which on Linux is usually a shell script with 0755 permissions). ") set(BRLCAD_EXTRADOCS_PDF_MAN_DESCRIPTION " Option that enables building of BRL-CAD's DocBook PDF-based documentation for man pages only. Defaults to OFF. ") CMAKE_DEPENDENT_OPTION(BRLCAD_EXTRADOCS_PDF "Build PDF output from DocBook documentation" OFF "BRLCAD_EXTRADOCS;APACHE_FOP" OFF) CMAKE_DEPENDENT_OPTION(BRLCAD_EXTRADOCS_PDF_MAN "Build PDF output from DocBook documentation for man pages" ON "BRLCAD_EXTRADOCS_PDF" OFF) # Provide an option to enable/disable XML validation as part # of the DocBook build - sort of a "strict flags" mode for DocBook. # By default, this will be enabled when extra docs are built and # the toplevel BRLCAD_ENABLE_STRICT setting is enabled. # Unfortunately, Visual Studio 2010 seems to have issues when we # enable validation on top of everything else... not clear why, # unless build target counts >1800 are beyond MSVC's practical # limit. Until we either find a resolution or a way to reduce # the target count on MSVC, disable validation there. CMAKE_DEPENDENT_OPTION(BRLCAD_EXTRADOCS_VALIDATE "Perform validation for DocBook documentation" ON "BRLCAD_EXTRADOCS;BRLCAD_ENABLE_STRICT" OFF) mark_as_advanced(BRLCAD_EXTRADOCS_VALIDATE) # ******************************************************************* # *** Check for Programs - Stage 2 of 9 *** # ******************************************************************* # A variety of tools, such as the benchmark utilities, need # a Bourne shell and other commands - check for them. include(${BRLCAD_CMAKE_DIR}/FindShellDeps.cmake) # CMake can detect flex and bison, but apparently not generic lex/yacc. # Solution is to make our own generic lex/yacc Find routines that look # first for flex/bison, but will take whatever's available. Since the # BRL-CAD project isn't supposed to rely on flex/bison specific features # anyway, there shouldn't be a problem. include(${BRLCAD_CMAKE_DIR}/FindLEX.cmake) include(${BRLCAD_CMAKE_DIR}/FindYACC.cmake) # If using dtrace, we will need to find it if(BRLCAD_ENABLE_DTRACE) find_program(DTRACE_EXEC NAMES dtrace DOC "path to dtrace executable") endif(BRLCAD_ENABLE_DTRACE) # Load various wrapper macros for checking libraries, headers and # functions include(${BRLCAD_CMAKE_DIR}/BRLCAD_CheckFunctions.cmake) # ******************************************************************* # *** Check for Compiler Characteristics - Stage 3 of 9 *** # ******************************************************************* # at this stage only the gcc compiler is supported if(NOT MSVC) include(${BRLCAD_CMAKE_DIR}/CompilerFlags.cmake) endif(NOT MSVC) # The src/other subdirectory does not share (at least, not universally) # certain definitions common to all other directories in BRL-CAD. Also, # we don't want flags that are otherwise global to BRL-CAD to be passed # to the src/other directory (particularly things like strict compiler # flags) so add src/other before any of that setup occurs. add_subdirectory(src/other) # Most of the src/other projects have their own logic for handling # the C inline issue - BRL-CAD needs a fine-grained approach. Mixed # C and C++ sources require different treatment for the same build # target, since C++11 doesn't allow inline to be re-defined. See # misc/CMake/BRLCAD_Targets.cmake for handling of C_INLINE. include(${BRLCAD_CMAKE_DIR}/CheckCInline.cmake) CHECK_C_INLINE(C_INLINE) # Requires that CompilerFlags.cmake already be loaded if(NOT MSVC) include(${BRLCAD_CMAKE_DIR}/BRLCAD_CompilerFlags.cmake) endif(NOT MSVC) # If doing an optimized build, set _FORTIFY_SOURCE to 2. Provides # compile-time best-practice error checking on certain libc functions # (e.g., memcpy), and provides run-time checks on buffer lengths and # memory regions. Unfortunately, glibc-1.6 made _FORTIFY_SOURCE spew # an unquellable warning if optimization is disabled so we can't tie # the flag to debug builds. if(${BRLCAD_OPTIMIZED_BUILD} MATCHES "ON") CONFIG_H_APPEND(BRLCAD "#define _FORTIFY_SOURCE 2\n") endif(${BRLCAD_OPTIMIZED_BUILD} MATCHES "ON") #CHECK_C_COMPILER_FLAG("Wl,--no-undefined" NO_UNDEFINED_LINKER_FLAG) # ******************************************************************* # *** Check for Libraries - Stage 4 of 9 *** # ******************************************************************* # While the primary purpose of this section is to identify libraries, # some of the headers we are looking for are associated with the # libraries checked here. In those cases, we will handle the header # logic here as opposed to separating the header logic from the # find_package call. # TODO - need to make LINKOPT vars for anything here that will # be referenced in a pkgconfig file # Look for threads (doesn't check for headers) # The variable CMAKE_THREAD_LIBS_INIT is the one of interest # when writing target_link_libraries lists. find_package(Threads) # Check for the C++ STL library - need to link it explicitly in # some compilation situations find_package(STL) # Check for the daemon function in -lbsd and/or -lc for adrt BRLCAD_CHECK_LIBRARY(BSD bsd daemon) BRLCAD_CHECK_LIBRARY(BSD c daemon) # Check for CoreFoundation, Carbon and Cocoa on Apple if(APPLE) include(CMakeFindFrameworks) CMAKE_FIND_FRAMEWORKS(CoreFoundation) if(CoreFoundation_FRAMEWORKS) set(CoreFoundation_LIBRARIES "-framework CoreFoundation" CACHE FILEPATH "CoreFoundation framework" FORCE) endif(CoreFoundation_FRAMEWORKS) CMAKE_FIND_FRAMEWORKS(Carbon) if(Carbon_FRAMEWORKS) set(Carbon_LIBRARIES "-framework Carbon" CACHE FILEPATH "Carbon framework" FORCE) endif(Carbon_FRAMEWORKS) BRLCAD_INCLUDE_FILE(Carbon/Carbon.h HAVE_CARBON_CARBON_H) CMAKE_FIND_FRAMEWORKS(Cocoa) if(Cocoa_FRAMEWORKS) set(Cocoa_LIBRARIES "-framework Cocoa" CACHE FILEPATH "Cocoa framework" FORCE) endif(Cocoa_FRAMEWORKS) mark_as_advanced(CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT) mark_as_advanced(CoreFoundation_LIBRARIES Carbon_LIBRARIES Cocoa_LIBRARIES) endif(APPLE) # Do some extra Java related checks. if(JNI_FOUND AND JAVA_FOUND) BRLCAD_INCLUDE_FILE(JavaVM/jni.h HAVE_JAVAVM_JNI_H) BRLCAD_INCLUDE_FILE(jni.h HAVE_JNI_H "${JNI_INCLUDE_DIRS}") if(NOT HAVE_JNI_H AND NOT HAVE_JAVAVM_JNI_H AND BRLCAD_ENABLE_RTSERVER) set(BRLCAD_ENABLE_RTSERVER OFF CACHE BOOL "RT server disabled due to unsatisfied Java requirements" FORCE) message("librtserver build requested, but JNI header not found - disabling") endif(NOT HAVE_JNI_H AND NOT HAVE_JAVAVM_JNI_H AND BRLCAD_ENABLE_RTSERVER) else(JNI_FOUND AND JAVA_FOUND) if(BRLCAD_ENABLE_RTSERVER) set(BRLCAD_ENABLE_RTSERVER OFF CACHE BOOL "RT server disabled due to unsatisfied Java requirements" FORCE) message("librtserver build requested, but Java+JNI not found - disabling") endif(BRLCAD_ENABLE_RTSERVER) endif(JNI_FOUND AND JAVA_FOUND) mark_as_advanced(BRLCAD_ENABLE_RTSERVER) # Mark X11 as available if it is enabled and we find Xlib.h if(BRLCAD_ENABLE_X11) if(X11_Xlib_INCLUDE_PATH AND CONFIG_H_FILE) set(HAVE_X11_XLIB_H 1) CONFIG_H_APPEND(BRLCAD "#cmakedefine HAVE_X11_XLIB_H 1\n") endif(X11_Xlib_INCLUDE_PATH AND CONFIG_H_FILE) endif(BRLCAD_ENABLE_X11) # math library BRLCAD_CHECK_LIBRARY(M m cos) # network socket library (linux, bsd) BRLCAD_CHECK_LIBRARY(SOCKET socket socket) # network socket library (solaris) BRLCAD_CHECK_LIBRARY(NSL nsl gethostbyaddr) # network socket library (haiku, beos) BRLCAD_CHECK_LIBRARY(NETWORK network socket) # malloc library BRLCAD_CHECK_LIBRARY(MALLOC c mallopt) BRLCAD_CHECK_LIBRARY(MALLOC malloc mallopt) # dynamic link library BRLCAD_CHECK_LIBRARY(DL dl dlopen) # Solaris lexer library BRLCAD_CHECK_LIBRARY(SOLARIS_LEXER l yyless) # timeSetEvent in Windows memory management BRLCAD_CHECK_LIBRARY(WINMM winmm timeSetEvent) # ******************************************************************* # *** Check for Headers - Stage 5 of 9 *** # ******************************************************************* # C89 headers: assert.h, ctype.h, errno.h, float.h, limits.h, locale.h, # math.h, setjmp.h, signal.h, stdarg.h, stddef.h, stdio.h, stdlib.h, # string.h, time.h # C95 headers: wchar.h, wctype.h, iso646.h # C99 headers: complex.h, fenv.h, inttypes.h, stdbool.h, stdint.h, # tgmath.h # POSIX.1 headers includes C89, C95, and C99 plus the following: # aio.h, arpa/inet.h, cpio.h, dirent.h, dlfcn.h, fcntl.h, fmtmsg.h, # fnmatch.h, ftw.h, glob.h, grp.h, iconv.h, langinfo.h, libgen.h, # monetary.h, mqueue.h, ndbm.h, net/if.h, netdb.h, netinet/in.h, # netinet/tcp.h, nl_types.h, poll.h, pthread.h, pwd.h, regex.h, # sched.h, search.h, semaphore.h, spawn.h, strings.h, stropts.h, # sys/ipc.h, sys/mman.h, sys/msg.h, sys/resource.h, sys/select.h, # sys/stat.h, sys/statvfs.h, sys/time.h, sys/timeb.h, sys/times.h, # sys/types.h, sys/uio.h, sys/un.h, sys/utsname.h, sys/wait.h, # syslog.h, tar.h, termios.h, trace.h, ucontext.h, ulimit.h, unistd.h, # utime.h, utmpx.h, wordexp.h # Because libtclcad, bwish and mged include Tcl headers, we need to define # STDC_HEADERS here - the Tcl headers do need the definition. Just # define it - we require C89, so the test itself is not needed. CONFIG_H_APPEND(BRLCAD "#define STDC_HEADERS 1\n") # AC_HEADER_SYS_WAIT BRLCAD_HEADER_SYS_WAIT() # dirent.h is POSIX.1, but not present on Windows (grr) # so we need to check for it BRLCAD_INCLUDE_FILE(dirent.h HAVE_DIRENT_H) # Need to compare this with the configure.ac list BRLCAD_INCLUDE_FILE(arpa/inet.h HAVE_ARPA_INET_H) BRLCAD_INCLUDE_FILE(curses.h HAVE_CURSES_H) BRLCAD_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H) BRLCAD_INCLUDE_FILE(dslib.h HAVE_DSLIB_H) BRLCAD_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H) BRLCAD_INCLUDE_FILE(getopt.h HAVE_GETOPT_H) BRLCAD_INCLUDE_FILE(gl/device.h HAVE_GL_DEVICE_H) BRLCAD_INCLUDE_FILE(gl/glext.h HAVE_GL_GLEXT_H) BRLCAD_INCLUDE_FILE(gl/wglext.h HAVE_GL_WGLEXT_H) BRLCAD_INCLUDE_FILE(grp.h HAVE_GRP_H) BRLCAD_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H) BRLCAD_INCLUDE_FILE(io.h HAVE_IO_H) BRLCAD_INCLUDE_FILE(libgen.h HAVE_LIBGEN_H) BRLCAD_INCLUDE_FILE(mach/thread_policy.h HAVE_MACH_THREAD_POLICY_H) BRLCAD_INCLUDE_FILE(memory.h HAVE_MEMORY_H) BRLCAD_INCLUDE_FILE(ncurses.h HAVE_NCURSES_H) BRLCAD_INCLUDE_FILE(netdb.h HAVE_NETDB_H) BRLCAD_INCLUDE_FILE(netinet/in.h HAVE_NETINET_IN_H) BRLCAD_INCLUDE_FILE(poll.h HAVE_POLL_H) BRLCAD_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H) BRLCAD_INCLUDE_FILE(pthread_np.h HAVE_PTHREAD_NP_H) BRLCAD_INCLUDE_FILE(pwd.h HAVE_PWD_H) BRLCAD_INCLUDE_FILE(rle.h HAVE_RLE_H) BRLCAD_INCLUDE_FILE(sched.h HAVE_SCHED_H) BRLCAD_INCLUDE_FILE(sgtty.h HAVE_SGTTY_H) BRLCAD_INCLUDE_FILE(stdint.h HAVE_STDINT_H) BRLCAD_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H) BRLCAD_INCLUDE_FILE(string.h HAVE_STRING_H) BRLCAD_INCLUDE_FILE(strings.h HAVE_STRINGS_H) BRLCAD_INCLUDE_FILE(sys/_ioctl.h HAVE_SYS__IOCTL_H) BRLCAD_INCLUDE_FILE(sys/cpuset.h HAVE_SYS_CPUSET_H) BRLCAD_INCLUDE_FILE(sys/file.h HAVE_SYS_FILE_H) BRLCAD_INCLUDE_FILE(sys/ioctl.h HAVE_SYS_IOCTL_H) BRLCAD_INCLUDE_FILE(sys/ioctl_compat.h HAVE_SYS_IOCTL_COMPAT_H) BRLCAD_INCLUDE_FILE(sys/machd.h HAVE_SYS_MACHD_H) BRLCAD_INCLUDE_FILE(sys/mman.h HAVE_SYS_MMAN_H) BRLCAD_INCLUDE_FILE(sys/mount.h HAVE_SYS_MOUNT_H) BRLCAD_INCLUDE_FILE(sys/param.h HAVE_SYS_PARAM_H) BRLCAD_INCLUDE_FILE(sys/prctl.h HAVE_SYS_PRCTL_H) BRLCAD_INCLUDE_FILE(sys/resource.h HAVE_SYS_RESOURCE_H) BRLCAD_INCLUDE_FILE(sys/sched.h HAVE_SYS_SCHED_H) BRLCAD_INCLUDE_FILE(sys/select.h HAVE_SYS_SELECT_H) BRLCAD_INCLUDE_FILE(sys/socket.h HAVE_SYS_SOCKET_H) BRLCAD_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H) BRLCAD_INCLUDE_FILE(sys/sysctl.h HAVE_SYS_SYSCTL_H) BRLCAD_INCLUDE_FILE(sys/sysinfo.h HAVE_SYS_SYSINFO_H) BRLCAD_INCLUDE_FILE(sys/sysmp.h HAVE_SYS_SYSMP_H) BRLCAD_INCLUDE_FILE(sys/time.h HAVE_SYS_TIME_H) BRLCAD_INCLUDE_FILE(sys/times.h HAVE_SYS_TIMES_H) BRLCAD_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H) BRLCAD_INCLUDE_FILE(sys/un.h HAVE_SYS_UN_H) BRLCAD_INCLUDE_FILE(sys/wait.h HAVE_SYS_WAIT_H) BRLCAD_INCLUDE_FILE(syslog.h HAVE_SYSLOG_H) BRLCAD_INCLUDE_FILE(term.h HAVE_TERM_H) BRLCAD_INCLUDE_FILE(termcap.h HAVE_TERMCAP_H) BRLCAD_INCLUDE_FILE(terminfo.h HAVE_TERMINFO_H) BRLCAD_INCLUDE_FILE(termio.h HAVE_TERMIO_H) BRLCAD_INCLUDE_FILE(termios.h HAVE_TERMIOS_H) BRLCAD_INCLUDE_FILE(termlib.h HAVE_TERMLIB_H) BRLCAD_INCLUDE_FILE(tinfo.h HAVE_TINFO_H) BRLCAD_INCLUDE_FILE(ulocks.h HAVE_ULOCKS_H) BRLCAD_INCLUDE_FILE(unistd.h HAVE_UNISTD_H) BRLCAD_INCLUDE_FILE(windows.h HAVE_WINDOWS_H) # for QueryPerformanceCounter() on Windows BRLCAD_INCLUDE_FILE(winsock.h HAVE_WINSOCK_H) # C++ BRLCAD_INCLUDE_FILE_CXX(istream HAVE_ISTREAM) BRLCAD_INCLUDE_FILE_CXX(limits HAVE_LIMITS) # Other special-case tests that need custom macros BRLCAD_CHECK_BASENAME() BRLCAD_CHECK_DIRNAME() # OpenGL headers if(BRLCAD_ENABLE_OPENGL) if(OPENGL_INCLUDE_DIR_GL) CONFIG_H_APPEND(BRLCAD "#define HAVE_GL_GL_H 1\n") endif(OPENGL_INCLUDE_DIR_GL) if(OPENGL_INCLUDE_DIR_GLX) CONFIG_H_APPEND(BRLCAD "#define HAVE_GL_GLX_H 1\n") endif(OPENGL_INCLUDE_DIR_GLX) endif(BRLCAD_ENABLE_OPENGL) # may have the header, but ensure it works in pedantic mode (gcc bug) if(HAVE_EMMINTRIN_H) check_cxx_source_compiles("#include \nint main() { return 0; }" HAVE_EMMINTRIN) if(HAVE_EMMINTRIN) CONFIG_H_APPEND(BRLCAD "#define HAVE_EMMINTRIN 1\n") endif(HAVE_EMMINTRIN) endif(HAVE_EMMINTRIN_H) # ******************************************************************* # *** Check for Types/Structures - Stage 6 of 9 *** # ******************************************************************* BRLCAD_STRUCT_MEMBER("struct stat" st_blksize sys/stat.h STRUCT_STAT_ST_BLKSIZE) BRLCAD_STRUCT_MEMBER("struct stat" st_blocks sys/stat.h STRUCT_STAT_ST_BLOCKS) BRLCAD_STRUCT_MEMBER("struct stat" st_rdev sys/stat.h STRUCT_STAT_ST_RDEV) # socklen_t BRLCAD_TYPE_SIZE("socklen_t" "sys/types.h") if(NOT HAVE_SOCKLEN_T) BRLCAD_TYPE_SIZE("socklen_t" "sys/socket.h") endif(NOT HAVE_SOCKLEN_T) BRLCAD_TYPE_SIZE("cpu_set_t" "sched.h") BRLCAD_TYPE_SIZE("int" "") BRLCAD_TYPE_SIZE("long" "") BRLCAD_TYPE_SIZE("long long" "") BRLCAD_TYPE_SIZE("size_t" "") BRLCAD_TYPE_SIZE("ssize_t" "") BRLCAD_TYPE_SIZE("uint64_t" "") BRLCAD_TYPE_SIZE("uintptr_t" "") BRLCAD_TYPE_SIZE("sig_t" "signal.h") # see if we have a TLS intrinsic, first check C++11 compliance check_cxx_source_compiles("static thread_local int i = 0; int main() { return i; }" HAVE_THREAD_LOCAL) if (HAVE_THREAD_LOCAL) CONFIG_H_APPEND(BRLCAD "#define HAVE_THREAD_LOCAL 1\n") else (HAVE_THREAD_LOCAL) # try GCC except Mac OS X include(CheckCXXSourceRuns) check_cxx_source_runs("static __thread int i = 0; int main() { return i; }" HAVE___THREAD) if (HAVE___THREAD) CONFIG_H_APPEND(BRLCAD "#define HAVE___THREAD 1\n") else (HAVE___THREAD) # try Windows check_cxx_source_compiles("static __declspec(thread) int i = 0; int main() { return i; }" HAVE___DECLSPEC_THREAD) if (HAVE___DECLSPEC_THREAD) CONFIG_H_APPEND(BRLCAD "#define HAVE___DECLSPEC_THREAD 1\n") endif (HAVE___DECLSPEC_THREAD) endif (HAVE___THREAD) endif (HAVE_THREAD_LOCAL) # see if the compiler supports %z as a size_t print width specifier BRLCAD_CHECK_C99_FORMAT_SPECIFIERS() # ******************************************************************* # *** Check for Functions - Stage 7 of 9 *** # ******************************************************************* # ALLOCA test - based on AC_FUNC_ALLOCA BRLCAD_ALLOCA() BRLCAD_FUNCTION_EXISTS(XQueryExtension HAVE_XQUERYEXTENSION) BRLCAD_FUNCTION_EXISTS(alarm HAVE_ALARM) BRLCAD_FUNCTION_EXISTS(dlopen HAVE_DLOPEN) BRLCAD_FUNCTION_EXISTS(drand48 HAVE_DRAND48) BRLCAD_FUNCTION_EXISTS(fchmod HAVE_FCHMOD) BRLCAD_FUNCTION_EXISTS(fileno HAVE_FILENO) BRLCAD_FUNCTION_EXISTS(fsync HAVE_FSYNC) BRLCAD_FUNCTION_EXISTS(getcwd HAVE_GETCWD) BRLCAD_FUNCTION_EXISTS(getegid HAVE_GETEGID) BRLCAD_FUNCTION_EXISTS(geteuid HAVE_GETEUID) BRLCAD_FUNCTION_EXISTS(gethostname HAVE_GETHOSTNAME) BRLCAD_FUNCTION_EXISTS(getloadavg HAVE_GETLOADAVG) BRLCAD_FUNCTION_EXISTS(getopt_long HAVE_GETOPT_LONG) BRLCAD_FUNCTION_EXISTS(getprogname HAVE_GETPROGNAME) BRLCAD_FUNCTION_EXISTS(kill HAVE_KILL) BRLCAD_FUNCTION_EXISTS(lrand48 HAVE_LRAND48) BRLCAD_FUNCTION_EXISTS(memset HAVE_MEMSET) BRLCAD_FUNCTION_EXISTS(mkstemp HAVE_MKSTEMP) BRLCAD_FUNCTION_EXISTS(pipe HAVE_PIPE) BRLCAD_FUNCTION_EXISTS(popen HAVE_POPEN) BRLCAD_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN) # IEEE Std 1003.1-2001 BRLCAD_FUNCTION_EXISTS(random HAVE_RANDOM) BRLCAD_FUNCTION_EXISTS(realpath HAVE_REALPATH) BRLCAD_FUNCTION_EXISTS(setenv HAVE_SETENV) BRLCAD_FUNCTION_EXISTS(setpgid HAVE_SETPGID) BRLCAD_FUNCTION_EXISTS(setpriority HAVE_SETPRIORITY) BRLCAD_FUNCTION_EXISTS(setprogname HAVE_SETPROGNAME) BRLCAD_FUNCTION_EXISTS(srand48 HAVE_SRAND48) BRLCAD_FUNCTION_EXISTS(strchr HAVE_STRCHR) BRLCAD_FUNCTION_EXISTS(strdup HAVE_STRDUP) BRLCAD_FUNCTION_EXISTS(strlcat HAVE_STRLCAT) BRLCAD_FUNCTION_EXISTS(strlcpy HAVE_STRLCPY) BRLCAD_FUNCTION_EXISTS(strsep HAVE_STRSEP) BRLCAD_FUNCTION_EXISTS(strtok HAVE_STRTOK) BRLCAD_FUNCTION_EXISTS(sync HAVE_SYNC) BRLCAD_FUNCTION_EXISTS(sysctl HAVE_SYSCTL) BRLCAD_FUNCTION_EXISTS(sysmp HAVE_SYSMP) BRLCAD_FUNCTION_EXISTS(vfork HAVE_VFORK) BRLCAD_FUNCTION_EXISTS(vsscanf HAVE_VSSCANF) BRLCAD_FUNCTION_EXISTS(writev HAVE_WRITEV) # we may compile in strict pedantic mode, but still want access to # some POSIX functions. test whether some symbols (below) are # declared in addition to whether they resolve (above). # # we do this manually for now because CHECK_SYMBOL_EXISTS and # CHECK_PROTOTYPE_EXISTS are both terribly broken. # # FIXME: wrap these into a BRLCAD_CHECK_SYMBOL() macro or similar. # test for kill() if("${HAVE_DECL_KILL}" MATCHES "^${HAVE_DECL_KILL}$") check_c_source_compiles("#include \n#include \nint main() { (void)kill; return 0; }" HAVE_DECL_KILL) if(HAVE_DECL_KILL) CONFIG_H_APPEND(BRLCAD "#cmakedefine HAVE_DECL_KILL 1\n") endif(HAVE_DECL_KILL) endif("${HAVE_DECL_KILL}" MATCHES "^${HAVE_DECL_KILL}$") # test for fileno() if("${HAVE_DECL_FILENO}" MATCHES "^${HAVE_DECL_FILENO}$") check_c_source_compiles("#include \nint main() { (void)fileno; return 0; }" HAVE_DECL_FILENO) if(HAVE_DECL_FILENO) CONFIG_H_APPEND(BRLCAD "#cmakedefine HAVE_DECL_FILENO 1\n") endif(HAVE_DECL_FILENO) endif("${HAVE_DECL_FILENO}" MATCHES "^${HAVE_DECL_FILENO}$") # On Windows, we need to check for hypot etc.. This test pertains # to the windows specific config file, not CONFIG_H_FILE - hence, # just run the test and it will be handled by configure_file later. include(CheckSymbolExists) if(WIN32) # consider all warnings as errors (MSVC) set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} /WX) CHECK_SYMBOL_EXISTS(hypot "math.h" HAVE_HYPOT) #If we don't have it, need to define it as _hypot in config_win if(NOT HAVE_HYPOT) set(hypot 1) endif(NOT HAVE_HYPOT) CHECK_SYMBOL_EXISTS(asinh "math.h" HAVE_ASINH) #If we don't have it, need to define it in config_win if(NOT HAVE_ASINH) set(asinh 1) endif(NOT HAVE_ASINH) BRLCAD_FUNCTION_EXISTS(_fseeki64 HAVE__FSEEKI64) BRLCAD_FUNCTION_EXISTS(_ftelli64 HAVE__FTELLI64) endif(WIN32) # Check whether we need to add import/export lines to libraries if(MSVC) set(CPP_DLL_DEFINES 1) endif(MSVC) # ******************************************************************* # *** Check for System Services - Stage 8 of 9 *** # ******************************************************************* # For Windows, we need some dlls to be redistributed with the # installer if(MSVC) # By default, do not warn when built on machines using only VS Express # From: http://www.cmake.org/pipermail/cmake/2011-May/044166.html if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) endif() include(InstallRequiredSystemLibraries) endif(MSVC) # Before we finalize, set some specific global linker flags if(MSVC) set(CMAKE_EXE_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT} /NOLOGO) set(CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT} /NOLOGO) set(CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT} /NOLOGO) endif(MSVC) # Enable CTest Testing support - this is done after src/other is # added to avoid incorporating src/other CTests into BRL-CAD's own # testing. TODO - probably should control this with an option. ENABLE_TESTING() # We've done the toplevel configure steps, now add the subdirectories add_subdirectory(src) add_subdirectory(include) add_subdirectory(sh) add_subdirectory(misc) if(NOT BRLCAD_ENABLE_TARGETS OR "${BRLCAD_ENABLE_TARGETS}" GREATER 2) add_subdirectory(doc) add_subdirectory(db) add_subdirectory(bench) add_subdirectory(regress) else(NOT BRLCAD_ENABLE_TARGETS OR "${BRLCAD_ENABLE_TARGETS}" GREATER 2) CMAKEFILES(doc bench regress db) endif(NOT BRLCAD_ENABLE_TARGETS OR "${BRLCAD_ENABLE_TARGETS}" GREATER 2) # If we're building on Windows, use config_win.h file if(WIN32) CONFIG_H_APPEND(BRLCAD "#include \"config_win_cmake.h\"\n") endif(WIN32) # Now that all the tests are done, configure the brlcad_config.h file: CONFIG_H_APPEND(BRLCAD "#endif /* __CONFIG_H__ */\n") get_property(CONFIG_H_FILE_CONTENTS GLOBAL PROPERTY ${CMAKE_PROJECT_NAME}_CONFIG_H_CONTENTS) file(WRITE ${CONFIG_H_FILE} "${CONFIG_H_FILE_CONTENTS}") configure_file(${CONFIG_H_FILE} ${BRLCAD_BINARY_DIR}/include/brlcad_config.h) # Rules for the toplevel documentation files set(toplevel_DOCFILES AUTHORS CHANGES COPYING HACKING INSTALL NEWS README ) BRLCAD_ADDDATA(toplevel_DOCFILES ".") # Generate the windows specific file, if needed if(WIN32) configure_file(${BRLCAD_SOURCE_DIR}/include/config_win_cmake.h.in ${BRLCAD_BINARY_DIR}/include/config_win_cmake.h) endif(WIN32) # ******************************************************************* # *** Summarize Results - Stage 9 of 9 *** # ******************************************************************* # Now that everything is configured, print a summary of the build # settings. if(NOT BRLCAD_DISABLE_SUMMARY) include(${BRLCAD_CMAKE_DIR}/BRLCAD_Summary.cmake) endif(NOT BRLCAD_DISABLE_SUMMARY) # ******************************************************************* # *** Timestamp Rules *** # ******************************************************************* if(NOT BRLCAD_IS_SUBBUILD) # Set up rules to print a timestamp string during build set(BUILD_DELTA_FILE "${CMAKE_BINARY_DIR}/CMakeTmp/BUILD_DELTA_FILE") set(BUILD_DELTA_START "${CMAKE_BINARY_DIR}/CMakeTmp/BUILD_DELTA_START") set(BUILD_DELTA_END "${CMAKE_BINARY_DIR}/CMakeTmp/BUILD_DELTA_END") configure_file(${BRLCAD_CMAKE_DIR}/test_srcs/builddelta_start.c.in ${CMAKE_BINARY_DIR}/CMakeTmp/builddelta_start.c) # The install instructions at the end of the message are tool specific - key # off of generators or build tools. if("${CMAKE_GENERATOR}" MATCHES "Make") set(INSTALL_LINE "Run 'make install' to begin installation into ${CMAKE_INSTALL_PREFIX}") set(BENCHMARK_LINE "Run 'make benchmark' to run the BRL-CAD Benchmark Suite") endif("${CMAKE_GENERATOR}" MATCHES "Make") if("${CMAKE_GENERATOR}" MATCHES "Ninja") set(INSTALL_LINE "Run 'ninja install' to begin installation into ${CMAKE_INSTALL_PREFIX}") set(BENCHMARK_LINE "Run 'ninja benchmark' to run the BRL-CAD Benchmark Suite") endif("${CMAKE_GENERATOR}" MATCHES "Ninja") if("${CMAKE_GENERATOR}" MATCHES "Xcode") set(INSTALL_LINE "Run 'xcodebuild -target install' to begin installation into ${CMAKE_INSTALL_PREFIX}") set(BENCHMARK_LINE "Run 'xcodebuild -target benchmark' to run the BRL-CAD Benchmark Suite") endif("${CMAKE_GENERATOR}" MATCHES "Xcode") if(MSVC) # slightly misuse the lines for MSVC, since we don't usually do the # install/benchmark routine there. (Benchmarks aren't currently supported # in MSVC anyway.) set(INSTALL_LINE "To build, launch Visual Studio and open ${CMAKE_BINARY_DIR}/BRLCAD.sln") set(BENCHMARK_LINE "Build the ALL_BUILD target. To create an NSIS installer, build the PACKAGE target") endif(MSVC) configure_file(${BRLCAD_CMAKE_DIR}/test_srcs/builddelta_end.c.in ${CMAKE_BINARY_DIR}/CMakeTmp/builddelta_end.c) add_executable(printtimestamp misc/CMake/test_srcs/print_timestamp.c) add_executable(buildtimestart ${CMAKE_BINARY_DIR}/CMakeTmp/builddelta_start.c) add_executable(buildtimeend ${CMAKE_BINARY_DIR}/CMakeTmp/builddelta_end.c) add_custom_command( OUTPUT ${BUILD_DELTA_FILE} COMMAND buildtimestart COMMENT "" DEPENDS buildtimestart ) add_custom_target(timestamp ALL COMMAND printtimestamp COMMAND ${CMAKE_COMMAND} -E rename ${BUILD_DELTA_FILE} ${BUILD_DELTA_START} DEPENDS ${BUILD_DELTA_FILE} printtimestamp ) add_custom_target(buildtimedelta ALL COMMAND buildtimeend COMMAND ${CMAKE_COMMAND} -E remove ${BUILD_DELTA_START} DEPENDS buildtimeend ) endif(NOT BRLCAD_IS_SUBBUILD) # We want the timestamp to come first, so make ALL library, # exec and external targets depend on timestamp (except for # the exec target printtimestamp, which is needed by timestamp) # Similarly, buildtimedelta needs to depend on every target. if(NOT BRLCAD_IS_SUBBUILD) get_property(CMAKE_LIBRARY_TARGET_LIST GLOBAL PROPERTY CMAKE_LIBRARY_TARGET_LIST) get_property(CMAKE_EXEC_TARGET_LIST GLOBAL PROPERTY CMAKE_EXEC_TARGET_LIST) get_property(CMAKE_CUSTOM_TARGET_LIST GLOBAL PROPERTY CMAKE_CUSTOM_TARGET_LIST) get_property(CMAKE_EXTERNAL_TARGET_LIST GLOBAL PROPERTY CMAKE_EXTERNAL_TARGET_LIST) mark_as_advanced(CMAKE_LIBRARY_TARGET_LIST) mark_as_advanced(CMAKE_EXEC_TARGET_LIST) mark_as_advanced(CMAKE_CUSTOM_TARGET_LIST) mark_as_advanced(CMAKE_EXTERNAL_TARGET_LIST) list(REMOVE_DUPLICATES CMAKE_LIBRARY_TARGET_LIST) list(REMOVE_DUPLICATES CMAKE_EXEC_TARGET_LIST) list(REMOVE_DUPLICATES CMAKE_CUSTOM_TARGET_LIST) if(CMAKE_EXTERNAL_TARGET_LIST) list(REMOVE_DUPLICATES CMAKE_EXTERNAL_TARGET_LIST) endif(CMAKE_EXTERNAL_TARGET_LIST) foreach(libtarget ${CMAKE_LIBRARY_TARGET_LIST}) #TODO - can this locate test be replaced with if(TARGET ${libtarget}) ? if(NOT CMAKE_BUILD_TYPE) get_target_property(target_location ${libtarget} LOCATION) else(NOT CMAKE_BUILD_TYPE) get_target_property(target_location ${libtarget} LOCATION_${CMAKE_BUILD_TYPE}) endif(NOT CMAKE_BUILD_TYPE) if(target_location) add_dependencies(${libtarget} timestamp) add_dependencies(buildtimedelta ${libtarget}) endif(target_location) endforeach(libtarget ${CMAKE_LIBRARY_TARGET_LIST}) foreach(exectarget ${CMAKE_EXEC_TARGET_LIST}) if(NOT CMAKE_BUILD_TYPE) get_target_property(target_location ${exectarget} LOCATION) else(NOT CMAKE_BUILD_TYPE) get_target_property(target_location ${exectarget} LOCATION_${CMAKE_BUILD_TYPE}) endif(NOT CMAKE_BUILD_TYPE) if(target_location) if(NOT ${exectarget} MATCHES "printtimestamp" AND NOT ${exectarget} MATCHES "buildtimestart") add_dependencies(${exectarget} timestamp) endif() add_dependencies(buildtimedelta ${exectarget}) endif(target_location) endforeach(exectarget ${CMAKE_EXEC_TARGET_LIST}) foreach(custtarget ${CMAKE_CUSTOM_TARGET_LIST}) if(NOT ${custtarget} MATCHES "timestamp") add_dependencies(${custtarget} timestamp) endif() if(NOT ${custtarget} MATCHES "buildtimedelta") get_target_property(not_in_all ${custtarget} EXCLUDE_FROM_ALL) if(NOT not_in_all) add_dependencies(buildtimedelta ${custtarget}) endif(NOT not_in_all) endif(NOT ${custtarget} MATCHES "buildtimedelta") endforeach(custtarget ${CMAKE_CUSTOM_TARGET_LIST}) foreach(externaltarget ${CMAKE_EXTERNAL_TARGET_LIST}) get_target_property(target_confcmd ${externaltarget} _EP_CONFIGURE_COMMAND) if(target_confcmd) add_dependencies(${externaltarget} timestamp) add_dependencies(buildtimedelta ${externaltarget}) endif(target_confcmd) endforeach(externaltarget ${CMAKE_EXTERNAL_TARGET_LIST}) endif(NOT BRLCAD_IS_SUBBUILD) # Generate the include/conf files # HOST configure_file(${BRLCAD_CMAKE_DIR}/test_srcs/report_hostname.c.in ${CMAKE_BINARY_DIR}/CMakeTmp/report_hostname.c) if(NOT MSVC) TRY_RUN(TIME_RESULT TIME_COMPILED ${CMAKE_BINARY_DIR}/CMakeTmp ${CMAKE_BINARY_DIR}/CMakeTmp/report_hostname.c OUTPUT_VARIABLE COMPILEMESSAGES) else(NOT MSVC) set(CMAKE_REQUIRED_LIBRARIES ws2_32.lib) TRY_RUN(TIME_RESULT TIME_COMPILED ${CMAKE_BINARY_DIR}/CMakeTmp ${CMAKE_BINARY_DIR}/CMakeTmp/report_hostname.c OUTPUT_VARIABLE COMPILEMESSAGES CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=ws2_32.lib") endif(NOT MSVC) # Let CMake give us the proper newline character(s) for the current platform file(APPEND ${BRLCAD_BINARY_DIR}/include/conf/HOST.tmp "\n") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${BRLCAD_BINARY_DIR}/include/conf/HOST.tmp ${BRLCAD_BINARY_DIR}/include/conf/HOST) execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${BRLCAD_BINARY_DIR}/include/conf/HOST.tmp) DISTCLEAN(${BRLCAD_BINARY_DIR}/include/conf/HOST) # USER configure_file(${BRLCAD_CMAKE_DIR}/test_srcs/report_username.c.in ${CMAKE_BINARY_DIR}/CMakeTmp/report_username.c) TRY_RUN(TIME_RESULT TIME_COMPILED ${CMAKE_BINARY_DIR}/CMakeTmp ${CMAKE_BINARY_DIR}/CMakeTmp/report_username.c OUTPUT_VARIABLE COMPILEMESSAGES) # Let CMake give us the proper newline character(s) for the current platform file(APPEND ${BRLCAD_BINARY_DIR}/include/conf/USER.tmp "\n") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${BRLCAD_BINARY_DIR}/include/conf/USER.tmp ${BRLCAD_BINARY_DIR}/include/conf/USER) execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${BRLCAD_BINARY_DIR}/include/conf/USER.tmp) DISTCLEAN(${BRLCAD_BINARY_DIR}/include/conf/USER) # PATH if(CMAKE_CONFIGURATION_TYPES) # if we have stale cmake_install.cmake.orig files around, clear them now. file(GLOB_RECURSE ALL_CMAKE_INSTALL_FILES_ORIG "*cmake_install.cmake.orig") if(ALL_CMAKE_INSTALL_FILES_ORIG) file(REMOVE ${ALL_CMAKE_INSTALL_FILES_ORIG}) endif(ALL_CMAKE_INSTALL_FILES_ORIG) # need a build target for this one - install directory may be dependent on configuration, but that won't # do for BRL-CAD reporting purposes - must get the fully qualified path at build time. string(REPLACE "\${BUILD_TYPE}" "----BUILD_TYPE----" CMAKE_INSTALL_PREFIX_CFG "${CMAKE_INSTALL_PREFIX}") configure_file(${BRLCAD_CMAKE_DIR}/multiconfig_path_clean.cmake.in ${CMAKE_BINARY_DIR}/CMakeTmp/multiconfig_path_clean.cmake @ONLY) configure_file(${BRLCAD_CMAKE_DIR}/multiconfig_path_read.cmake.in ${CMAKE_BINARY_DIR}/CMakeTmp/multiconfig_path_read.cmake @ONLY) if(EXISTS ${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH) file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH) endif(EXISTS ${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH) add_custom_command( OUTPUT "${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH/${CMAKE_CFG_INTDIR}.done" COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/CMakeTmp/multiconfig_path_clean.cmake" COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH/${CMAKE_CFG_INTDIR}" COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/CMakeTmp/multiconfig_path_read.cmake" COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH/PATH.tmp" "${CMAKE_BINARY_DIR}/include/conf/PATH" COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH/${CMAKE_CFG_INTDIR}.done" ) add_custom_target(multiconfig_path DEPENDS "${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH/${CMAKE_CFG_INTDIR}.done") # To make sure this command runs in time for the source code builds it might impact, we will need to add the output file as a dependency # to the first target to run - the timestamp printing. add_dependencies(timestamp multiconfig_path) else(CMAKE_CONFIGURATION_TYPES) file(WRITE ${BRLCAD_BINARY_DIR}/include/conf/PATH.tmp "\"${CMAKE_INSTALL_PREFIX}\"\n") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${BRLCAD_BINARY_DIR}/include/conf/PATH.tmp ${BRLCAD_BINARY_DIR}/include/conf/PATH) execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${BRLCAD_BINARY_DIR}/include/conf/PATH.tmp) endif(CMAKE_CONFIGURATION_TYPES) DISTCLEAN(${BRLCAD_BINARY_DIR}/include/conf/PATH) # COUNT - Count how many times the configuration has changed. Currently # we are detecting a configuration change by looking at the previous version # of the CMakeCache.txt file and looking for changes between values stored # there and settings in the current environment. This has the disadvantage # of not spotting completely new variables in the current environment, but # the internal CMake variable list is too noisy so at the moment this looks # like the best alternative we have. if(EXISTS ${BRLCAD_BINARY_DIR}/include/conf/COUNT) include(${BRLCAD_CMAKE_DIR}/DiffCache.cmake) DIFF_CACHE_file() if(INCREMENT_COUNT_FILE) file(READ ${BRLCAD_BINARY_DIR}/include/conf/COUNT buildCounter_raw) string(STRIP ${buildCounter_raw} buildCounter) math(EXPR buildCounter "${buildCounter} + 1") file(WRITE ${BRLCAD_BINARY_DIR}/include/conf/COUNT "${buildCounter}\n") endif(INCREMENT_COUNT_FILE) else(EXISTS ${BRLCAD_BINARY_DIR}/include/conf/COUNT) set(buildCounter 0) file(WRITE ${BRLCAD_BINARY_DIR}/include/conf/COUNT "${buildCounter}\n") endif(EXISTS ${BRLCAD_BINARY_DIR}/include/conf/COUNT) DISTCLEAN(${BRLCAD_BINARY_DIR}/include/conf/COUNT) # DATE - Increment this when we increment the COUNT, to avoid triggering # excessive relinking (an RFC2822 timestamp changes every second). file(READ ${CONFIG_TIMESTAMP_FILE} DATESTAMP) string(STRIP ${DATESTAMP} DATESTAMP) if(INCREMENT_COUNT_FILE OR NOT EXISTS ${BRLCAD_BINARY_DIR}/include/conf/DATE) file(WRITE ${BRLCAD_BINARY_DIR}/include/conf/DATE.tmp "\"${DATESTAMP}\"\n") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${BRLCAD_BINARY_DIR}/include/conf/DATE.tmp ${BRLCAD_BINARY_DIR}/include/conf/DATE) execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${BRLCAD_BINARY_DIR}/include/conf/DATE.tmp) endif(INCREMENT_COUNT_FILE OR NOT EXISTS ${BRLCAD_BINARY_DIR}/include/conf/DATE) DISTCLEAN(${BRLCAD_BINARY_DIR}/include/conf/DATE) # CPack is used to produce tgz files, RPMS, etc. If SUBBUILD is enabled this # becomes the responsibility of the parent project. if(NOT BRLCAD_IS_SUBBUILD) option(BRLCAD_VERSIONED_RPM_NAME "Incorporate BRL-CAD version into RPM package name" OFF) mark_as_advanced(BRLCAD_VERSIONED_RPM_NAME) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "BRL-CAD - a powerful cross-platform open source solid modeling system") set(CPACK_PACKAGE_VENDOR "BRL-CAD Development Team") set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_SOURCE_DIR}/README) set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING) set(CPACK_PACKAGE_VERSION_MAJOR ${BRLCAD_MAJOR_VERSION}) set(CPACK_PACKAGE_VERSION_MINOR ${BRLCAD_MINOR_VERSION}) set(CPACK_PACKAGE_VERSION_PATCH ${BRLCAD_PATCH_VERSION}) if(BRLCAD_VERSIONED_RPM_NAME) set(CPACK_RPM_PACKAGE_NAME "BRL-CAD_${BRLCAD_VERSION}") endif(BRLCAD_VERSIONED_RPM_NAME) if(UNIX) set(CPACK_STRIP_FILES TRUE) endif(UNIX) if(UNIX) set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) endif(UNIX) if(UNIX AND NOT APPLE) set(CPACK_GENERATOR TGZ TBZ2) find_program(RPMBUILD_EXEC rpmbuild) mark_as_advanced(RPMBUILD_EXEC) if(RPMBUILD_EXEC) # Since RPM packages present a particular problem with bad umask # settings and RPM package building is enabled, raise the issue again # with a longer wait time. if (NOT UMASK_OK) message(" ") message(WARNING "umask is set to ${umask_curr} and RPM package building is enabled - this is not a 'standard' umask setting for BRL-CAD RPM packages. Double check that these umask permissions will have the desired results when installed - RPM packages can impact permissions on system directories such as /usr\nIf the umask settings need to be changed, it is recommended that the build directory be cleared and cmake re-run after the umask setting has been changed.") if(SLEEP_EXEC) execute_process(COMMAND ${SLEEP_EXEC} 5) endif(SLEEP_EXEC) endif (NOT UMASK_OK) set(CPACK_GENERATOR ${CPACK_GENERATOR} RPM) set(CPACK_RPM_PACKAGE_LICENSE "LGPL 2.1") set(CPACK_RPM_PACKAGE_GROUP "Applications/Engineering") #set(CPACK_RPM_PACKAGE_NAME "brlcad_${BRLCAD_MAJOR_VERSION}_${BRLCAD_MINOR_VERSION}_${BRLCAD_PATCH_VERSION}") #if(EXISTS /etc/redhat-release) # file(READ /etc/redhat-release REDHAT_RELEASE) # string(REGEX MATCH "[0-9]+" REDHAT_VERSION ${REDHAT_RELEASE}) # string(REGEX MATCH "Enterprise Linux" LINUX_DIST_TYPE ${REDHAT_RELEASE}) # if(LINUX_DIST_TYPE) # set(LINUX_DIST_TYPE "el") # else(LINUX_DIST_TYPE) # set(LINUX_DIST_TYPE "rh") # endif(LINUX_DIST_TYPE) # set(CPACK_RPM_PACKAGE_RELEASE 1.${LINUX_DIST_TYPE}${REDHAT_VERSION}) #else(EXISTS /etc/redhat-release) # #set(CPACK_RPM_PACKAGE_RELEASE 2) #endif(EXISTS /etc/redhat-release) endif(RPMBUILD_EXEC) set(CPACK_RPM_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}") if(NOT CPACK_RPM_PACKAGE_RELEASE) set(CPACK_RPM_PACKAGE_RELEASE 1) endif(NOT CPACK_RPM_PACKAGE_RELEASE) if(${CMAKE_WORD_SIZE} MATCHES "32BIT" AND ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") set(CPACK_PACKAGE_FILE_NAME "BRL-CAD_${BRLCAD_VERSION}_x86_${CMAKE_SYSTEM_NAME}_${CPACK_RPM_PACKAGE_RELEASE}") else(${CMAKE_WORD_SIZE} MATCHES "32BIT" AND ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") set(CPACK_PACKAGE_FILE_NAME "BRL-CAD_${BRLCAD_VERSION}_${CMAKE_SYSTEM_PROCESSOR}_${CMAKE_SYSTEM_NAME}_${CPACK_RPM_PACKAGE_RELEASE}") endif(${CMAKE_WORD_SIZE} MATCHES "32BIT" AND ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") else(UNIX AND NOT APPLE) set(CPACK_PACKAGE_FILE_NAME "BRL-CAD_${BRLCAD_VERSION}_${CMAKE_SYSTEM_PROCESSOR}") endif(UNIX AND NOT APPLE) if(WIN32) set(CPACK_GENERATOR NSIS) set(CPACK_NSIS_PACKAGE_NAME "BRL-CAD") set(CPACK_SOURCE_DIR ${CMAKE_SOURCE_DIR}) set(CPACK_DATA_DIR "${DATA_DIR}") # There is a bug in NSI that does not handle full unix paths properly. Make # sure there is at least one set of four (4) backslashes. set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/misc/nsis\\\\brlcad.ico") set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/misc/nsis\\\\uninstall.ico") set(CPACK_NSIS_DISPLAY_NAME "BRL-CAD") set(CPACK_NSIS_MODIFY_PATH ON) endif(WIN32) if(CMAKE_CL_64) set(CPACK_PACKAGE_FILE_NAME "BRL-CAD_${BRLCAD_VERSION}_x64") endif(CMAKE_CL_64) set(CPACK_SOURCE_GENERATOR TGZ TBZ2 ZIP) set(CPACK_SOURCE_PACKAGE_FILE_NAME "brlcad-${BRLCAD_VERSION}") set(CPACK_SOURCE_IGNORE_FILES "\\\\.svn/") configure_file("${BRLCAD_CMAKE_DIR}/BRLCAD_CPackOptions.cmake.in" "${CMAKE_BINARY_DIR}/BRLCAD_CPackOptions.cmake" @ONLY) set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_BINARY_DIR}/BRLCAD_CPackOptions.cmake") include(CPack) # Some files to ignore for distcheck. For this case # only, we add CMakeLists.txt (others are handled # by add_subdirectory wrapper set(toplevel_ignore_files BUGS ChangeLog TODO configure CMakeLists.txt ) CMAKEFILES(${toplevel_ignore_files}) # Handle some toplevel distclean listings DISTCLEAN(${CMAKE_BINARY_DIR}/cmakefiles.cmake) DISTCLEAN(${CMAKE_BINARY_DIR}/cmakedirs.cmake) DISTCLEAN(${CMAKE_BINARY_DIR}/cmake_install.cmake) DISTCLEAN(${CMAKE_BINARY_DIR}/install_manifest.txt) DISTCLEAN(${CMAKE_BINARY_DIR}/OPTIONS) DISTCLEAN(${CMAKE_BINARY_DIR}/CMakeFiles) DISTCLEAN(${CMAKE_BINARY_DIR}/CMakeTmp) DISTCLEAN(${CMAKE_BINARY_DIR}/configure.new) DISTCLEAN(${CMAKE_BINARY_DIR}/INSTALL.new) DISTCLEAN(${CMAKE_BINARY_DIR}/include/brlcad_config.h.in) foreach(clearpattern ${DISTCLEAN_OUTFILES}) DISTCLEAN(${CMAKE_BINARY_DIR}/${clearpattern}) endforeach(clearpattern ${DISTCLEAN_OUTFILES}) if("${CMAKE_GENERATOR}" MATCHES "Ninja") DISTCLEAN(${CMAKE_BINARY_DIR}/.ninja_log) endif("${CMAKE_GENERATOR}" MATCHES "Ninja") # ---------------------------------------------------------------------------- # Define a distcheck target. This performs a variety of tests to determine # whether BRL-CAD is in a distribution ready state. Default to the standard # set of tests - Debug and Release build configurations include(${BRLCAD_CMAKE_DIR}/Distcheck.cmake) # Define some custom distcheck targets for distcheck-full (not run by default) # # CREATE_DISTCHECK(TARGET_SUFFIX CMAKE_OPTS source_dir build_dir install_dir [custom_template]) CREATE_DISTCHECK(default_build_type "-DBRLCAD_BUNDLED_LIBS=AUTO" "${CPACK_SOURCE_PACKAGE_FILE_NAME}" "build" "install") CREATE_DISTCHECK(no_tk "-DCMAKE_BUILD_TYPE=Debug -DBRLCAD_BUNDLED_LIBS=BUNDLED -DBRLCAD_ENABLE_TK=OFF" "${CPACK_SOURCE_PACKAGE_FILE_NAME}" "build" "install") CREATE_DISTCHECK(autodetect_debug "-DCMAKE_BUILD_TYPE=Debug -DBRLCAD_BUNDLED_LIBS=AUTO" "${CPACK_SOURCE_PACKAGE_FILE_NAME}" "build" "install") CREATE_DISTCHECK(autodetect_release "-DCMAKE_BUILD_TYPE=Release -DBRLCAD_BUNDLED_LIBS=AUTO" "${CPACK_SOURCE_PACKAGE_FILE_NAME}" "build" "install") CREATE_DISTCHECK(odd_pathnames "-DCMAKE_BUILD_TYPE=Debug -DBRLCAD_BUNDLED_LIBS=BUNDLED" "1 Odd_ source dir ++" "1 Odd_ build dir ++" "1 Odd_ install dir ++") CREATE_DISTCHECK(in_src_dir "-DCMAKE_BUILD_TYPE=Debug -DBRLCAD_BUNDLED_LIBS=BUNDLED" "${CPACK_SOURCE_PACKAGE_FILE_NAME}" "${CPACK_SOURCE_PACKAGE_FILE_NAME}" "install" distcheck_in_src_dir.cmake.in) # Now that we're set up and have added the extra targets we want for distcheck-full, define the build targets DEFINE_DISTCHECK_TARGET(STD) endif(NOT BRLCAD_IS_SUBBUILD) # ---------------------------------------------------------------------------- # Mark various miscellaneous things as advanced that we don't want in our # default view mark_as_advanced(CMAKE_BACKWARDS_COMPATIBILITY) mark_as_advanced(EXECUTABLE_OUTPUT_PATH) mark_as_advanced(LIBRARY_OUTPUT_PATH) mark_as_advanced(CMAKE_CXX_COMPILER) mark_as_advanced(CMAKE_C_COMPILER) # ---------------------------------------------------------------------------- # If options have been defined that we are going to document, by now they've # been documented. Make an updated copy of the "INSTALL" file and see whether # anything has changed. # # Although the general principle of this build is to leave the src dir # pristine after configuration and compilation, the INSTALL and configure files # represent one of two cases where the default behavior is to alter the files # if changes have occurred. (The other is cached generated outputs from tools # such as re2c and lemon.) For the purposes of this project, a given # option's documentation is defined in the CMakeLists.txt source file with # the option definition logic - the text in INSTALL is simply an output from # that, and is never the correct place for manual changes. # # As with generated outputs, this auto-updating behavior can be overridden # by setting the CMake variable LOCKED_SOURCE_DIR to ON - in that case, a # warning about out-of-sync files is printed but no automatic updating takes # place in the source tree. file(READ ${BRLCAD_SOURCE_DIR}/INSTALL SRC_INSTALL_STR) string(REGEX REPLACE "${CONFIG_OPT_STRING}.*" "" INSTALL_PREFIX "${SRC_INSTALL_STR}") file(WRITE ${BRLCAD_BINARY_DIR}/INSTALL.new "${INSTALL_PREFIX}") file(READ ${BRLCAD_BINARY_DIR}/OPTIONS INSTALL_OPTS) file(APPEND ${BRLCAD_BINARY_DIR}/INSTALL.new "${INSTALL_OPTS}") file(APPEND ${BRLCAD_BINARY_DIR}/INSTALL.new "\n\n*** Note - Do not add or edit configuration option descriptions and alias lists in this file - those entries are auto-generated from information in the toplevel CMakeLists.txt file and src/other/CMakeLists.txt - any changes should be made in those files. The CMake configuration process will automatically re-generate INSTALL with the new descriptions and alias information.\n") execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files ${BRLCAD_SOURCE_DIR}/INSTALL ${BRLCAD_BINARY_DIR}/INSTALL.new RESULT_VARIABLE IS_DIFFERENT OUTPUT_VARIABLE DIFF_OUTPUT ERROR_VARIABLE DIFF_ERROR) if(IS_DIFFERENT) if(LOCKED_SOURCE_DIR) message(WARNING "\n${BRLCAD_SOURCE_DIR}/INSTALL is out of date. An updated version has been generated at ${BRLCAD_BINARY_DIR}/INSTALL.new\nTo clear this warning, replace ${BRLCAD_SOURCE_DIR}/INSTALL with ${BRLCAD_BINARY_DIR}/INSTALL.new\n") else(LOCKED_SOURCE_DIR) set_source_files_properties(${BRLCAD_BINARY_DIR}/INSTALL.new PROPERTIES GENERATED TRUE) configure_file(${BRLCAD_BINARY_DIR}/INSTALL.new ${BRLCAD_SOURCE_DIR}/INSTALL COPYONLY) endif(LOCKED_SOURCE_DIR) endif(IS_DIFFERENT) # Do the same thing for the configure shell script - finish it and check # for differences. file(READ ${BRLCAD_CMAKE_DIR}/configure_suffix.sh CONFIG_SUFFIX) file(APPEND ${CMAKE_BINARY_DIR}/configure.new "${CONFIG_SUFFIX}") # Compare execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files ${BRLCAD_SOURCE_DIR}/configure ${BRLCAD_BINARY_DIR}/configure.new RESULT_VARIABLE IS_CONFIG_SH_DIFFERENT OUTPUT_VARIABLE DIFF_OUTPUT ERROR_VARIABLE DIFF_ERROR) if(IS_CONFIG_SH_DIFFERENT) if(LOCKED_SOURCE_DIR) message(WARNING "\n${BRLCAD_SOURCE_DIR}/configure is out of date. An updated version has been generated at ${BRLCAD_BINARY_DIR}/configure.new\nTo clear this warning, replace ${BRLCAD_SOURCE_DIR}/configure with ${BRLCAD_BINARY_DIR}/configure.new\n") else(LOCKED_SOURCE_DIR) set_source_files_properties(${BRLCAD_BINARY_DIR}/configure.new PROPERTIES GENERATED TRUE) configure_file(${BRLCAD_BINARY_DIR}/configure.new ${BRLCAD_SOURCE_DIR}/configure COPYONLY) endif(LOCKED_SOURCE_DIR) endif(IS_CONFIG_SH_DIFFERENT) # Because the build-time-delta needs a configure-file but comes at the # end of the CMake configure, the preparation of the final distclean # list must account for it. Also, the distclean script itself must # be added to the list, as it is generated by CMake DISTCLEAN(${CMAKE_BINARY_DIR}/CMakeTmp/timedelta_end.c) get_property(CMAKE_DISTCLEAN_TARGET_LIST GLOBAL PROPERTY CMAKE_DISTCLEAN_TARGET_LIST) list(REMOVE_DUPLICATES CMAKE_DISTCLEAN_TARGET_LIST) configure_file(${BRLCAD_CMAKE_DIR}/distclean.cmake.in ${BRLCAD_BINARY_DIR}/distclean.cmake @ONLY) if("${CMAKE_GENERATOR}" MATCHES "Make") add_custom_target(distclean COMMAND ${CMAKE_COMMAND} -E echo "Running make clean..." COMMAND ${CMAKE_COMMAND} -E chdir ${BRLCAD_BINARY_DIR} $(MAKE) clean COMMAND ${CMAKE_COMMAND} -E echo "Running make clean... done." COMMAND ${CMAKE_COMMAND} -P ${BRLCAD_BINARY_DIR}/distclean.cmake ) elseif("${CMAKE_GENERATOR}" MATCHES "Ninja") add_custom_target(distclean COMMAND ${CMAKE_COMMAND} -E echo "Running make clean..." COMMAND ${CMAKE_COMMAND} -E chdir ${BRLCAD_BINARY_DIR} ninja -t clean COMMAND ${CMAKE_COMMAND} -E echo "Running make clean... done." COMMAND ${CMAKE_COMMAND} -P ${BRLCAD_BINARY_DIR}/distclean.cmake ) else("${CMAKE_GENERATOR}" MATCHES "Make") add_custom_target(distclean COMMAND ${CMAKE_COMMAND} -E echo "Not implemented for generator ${CMAKE_GENERATOR}" ) endif("${CMAKE_GENERATOR}" MATCHES "Make") #Done with all really time-consuming steps - do the configure time delta if(NOT BRLCAD_IS_SUBBUILD) set(DELTA_END "${CMAKE_BINARY_DIR}/CMakeTmp/DELTA_END") configure_file(${BRLCAD_CMAKE_DIR}/test_srcs/timedelta_end.c.in ${CMAKE_BINARY_DIR}/CMakeTmp/timedelta_end.c) TRY_RUN(TIME_RESULT TIME_COMPILED ${CMAKE_BINARY_DIR}/CMakeTmp ${CMAKE_BINARY_DIR}/CMakeTmp/timedelta_end.c OUTPUT_VARIABLE COMPILEMESSAGES) file(READ ${DELTA_END} CONFIG_TIME_MSG) string(STRIP "${CONFIG_TIME_MSG}" CONFIG_TIME_MSG) set(CONFIG_TIME_MSG_LABEL "Elapsed configuration time") string(LENGTH "${CONFIG_TIME_MSG_LABEL}" CURRENTLENGTH) while(${SETTINGLABELLENGTH} GREATER ${CURRENTLENGTH}) set(CONFIG_TIME_MSG_LABEL "${CONFIG_TIME_MSG_LABEL}.") string(LENGTH "${CONFIG_TIME_MSG_LABEL}" CURRENTLENGTH) endwhile(${SETTINGLABELLENGTH} GREATER ${CURRENTLENGTH}) message("${CONFIG_TIME_MSG_LABEL}..: ${CONFIG_TIME_MSG}") endif(NOT BRLCAD_IS_SUBBUILD) # Have touched every file and directory that we are going to touch with the # build system - time to write out our lists for future processing. get_property(CMAKE_IGNORE_FILES GLOBAL PROPERTY CMAKE_IGNORE_FILES) get_property(CMAKE_IGNORE_DIRS GLOBAL PROPERTY CMAKE_IGNORE_DIRS) string(REPLACE ";" "\n" CMAKE_IGNORE_FILES "${CMAKE_IGNORE_FILES}") string(REPLACE ";" "\n" CMAKE_IGNORE_DIRS "${CMAKE_IGNORE_DIRS}") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cmakefiles.cmake "${CMAKE_IGNORE_FILES}") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cmakedirs.cmake "${CMAKE_IGNORE_DIRS}") # Local Variables: # tab-width: 8 # mode: cmake # indent-tabs-mode: t # End: # ex: shiftwidth=2 tabstop=8