diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index c3c25f560..a27d00004 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -11,113 +11,114 @@ #============================================================================= # If the cmake version includes cpack, use it -IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") - IF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake") - OPTION(CMAKE_INSTALL_DEBUG_LIBRARIES +if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") + if(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake") + option(CMAKE_INSTALL_DEBUG_LIBRARIES "Install Microsoft runtime debug libraries with CMake." FALSE) - MARK_AS_ADVANCED(CMAKE_INSTALL_DEBUG_LIBRARIES) + mark_as_advanced(CMAKE_INSTALL_DEBUG_LIBRARIES) # By default, do not warn when built on machines using only VS Express: - IF(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) - SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) - ENDIF() + if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) + set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) + endif() - INCLUDE(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake) - ENDIF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake") + include(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake) + endif() - SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool") - SET(CPACK_PACKAGE_VENDOR "Kitware") - SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") - SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") - SET(CPACK_PACKAGE_VERSION "${CMake_VERSION}") - SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") - SET(CPACK_SOURCE_PACKAGE_FILE_NAME "cmake-${CMake_VERSION}") + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool") + set(CPACK_PACKAGE_VENDOR "Kitware") + set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") + set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") + set(CPACK_PACKAGE_VERSION "${CMake_VERSION}") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") + set(CPACK_SOURCE_PACKAGE_FILE_NAME "cmake-${CMake_VERSION}") # Make this explicit here, rather than accepting the CPack default value, # so we can refer to it: - SET(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}") + set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}") # Installers for 32- vs. 64-bit CMake: # - Root install directory (displayed to end user at installer-run time) # - "NSIS package/display name" (text used in the installer GUI) # - Registry key used to store info about the installation - IF(CMAKE_CL_64) - SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") - SET(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} (Win64)") - SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION} (Win64)") - ELSE() - SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") - SET(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}") - SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}") - ENDIF() + if(CMAKE_CL_64) + set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") + set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} (Win64)") + set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION} (Win64)") + else() + set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") + set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}") + set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}") + endif() - IF(NOT DEFINED CPACK_SYSTEM_NAME) + if(NOT DEFINED CPACK_SYSTEM_NAME) # make sure package is not Cygwin-unknown, for Cygwin just # cygwin is good for the system name - IF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN") - SET(CPACK_SYSTEM_NAME Cygwin) - ELSE("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN") - SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}) - ENDIF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN") - ENDIF(NOT DEFINED CPACK_SYSTEM_NAME) - IF(${CPACK_SYSTEM_NAME} MATCHES Windows) - IF(CMAKE_CL_64) - SET(CPACK_SYSTEM_NAME win64-x64) - ELSE(CMAKE_CL_64) - SET(CPACK_SYSTEM_NAME win32-x86) - ENDIF(CMAKE_CL_64) - ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows) + if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN") + set(CPACK_SYSTEM_NAME Cygwin) + else() + set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}) + endif() + endif() + if(${CPACK_SYSTEM_NAME} MATCHES Windows) + if(CMAKE_CL_64) + set(CPACK_SYSTEM_NAME win64-x64) + else() + set(CPACK_SYSTEM_NAME win32-x86) + endif() + endif() - IF(NOT DEFINED CPACK_PACKAGE_FILE_NAME) + if(NOT DEFINED CPACK_PACKAGE_FILE_NAME) # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache - # default to source package - system, on cygwin system is not + # default to source package - system, on cygwin system is not # needed - IF(CYGWIN) - SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}") - ELSE(CYGWIN) - SET(CPACK_PACKAGE_FILE_NAME + if(CYGWIN) + set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}") + else() + set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}") - ENDIF(CYGWIN) - ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME) + endif() + endif() - SET(CPACK_PACKAGE_CONTACT "cmake@cmake.org") + set(CPACK_PACKAGE_CONTACT "cmake@cmake.org") - IF(UNIX) - SET(CPACK_STRIP_FILES "bin/ccmake;bin/cmake;bin/cpack;bin/ctest") - SET(CPACK_SOURCE_STRIP_FILES "") - SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake") - ENDIF(UNIX) + if(UNIX) + set(CPACK_STRIP_FILES "bin/ccmake;bin/cmake;bin/cpack;bin/ctest") + set(CPACK_SOURCE_STRIP_FILES "") + set(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake") + endif() # cygwin specific packaging stuff - IF(CYGWIN) + if(CYGWIN) # setup the cygwin package name - SET(CPACK_PACKAGE_NAME cmake) + set(CPACK_PACKAGE_NAME cmake) # setup the name of the package for cygwin cmake-2.4.3 - SET(CPACK_PACKAGE_FILE_NAME + set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CMake_VERSION}") # the source has the same name as the binary - SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) + set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) # Create a cygwin version number in case there are changes for cygwin # that are not reflected upstream in CMake - SET(CPACK_CYGWIN_PATCH_NUMBER 1) + set(CPACK_CYGWIN_PATCH_NUMBER 1 CACHE STRING "patch number for CMake cygwin packages") + mark_as_advanced(CPACK_CYGWIN_PATCH_NUMBER) # These files are required by the cmCPackCygwinSourceGenerator and the files # put into the release tar files. - SET(CPACK_CYGWIN_BUILD_SCRIPT - "${CMake_BINARY_DIR}/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.sh") - SET(CPACK_CYGWIN_PATCH_FILE - "${CMake_BINARY_DIR}/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.patch") + set(CPACK_CYGWIN_BUILD_SCRIPT + "${CMake_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}-${CPACK_CYGWIN_PATCH_NUMBER}.sh") + set(CPACK_CYGWIN_PATCH_FILE + "${CMake_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}-${CPACK_CYGWIN_PATCH_NUMBER}.patch") # include the sub directory cmake file for cygwin that # configures some files and adds some install targets # this file uses some of the package file name variables - INCLUDE(Utilities/Release/Cygwin/CMakeLists.txt) - ENDIF(CYGWIN) + include(Utilities/Release/Cygwin/CMakeLists.txt) + endif() # Set the options file that needs to be included inside CMakeCPackOptions.cmake - SET(QT_DIALOG_CPACK_OPTIONS_FILE ${CMake_BINARY_DIR}/Source/QtDialog/QtDialogCPack.cmake) - CONFIGURE_FILE("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in" + set(QT_DIALOG_CPACK_OPTIONS_FILE ${CMake_BINARY_DIR}/Source/QtDialog/QtDialogCPack.cmake) + configure_file("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in" "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY) - SET(CPACK_PROJECT_CONFIG_FILE "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake") + set(CPACK_PROJECT_CONFIG_FILE "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake") # include CPack model once all variables are set - INCLUDE(CPack) -ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") + include(CPack) +endif() diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 69a150851..47dad49c2 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -1,18 +1,18 @@ # This file is configured at cmake time, and loaded at cpack time. # To pass variables to cpack from cmake, they must be configured -# in this file. +# in this file. if(CPACK_GENERATOR MATCHES "NSIS") - SET(CPACK_NSIS_INSTALL_ROOT "@CPACK_NSIS_INSTALL_ROOT@") + set(CPACK_NSIS_INSTALL_ROOT "@CPACK_NSIS_INSTALL_ROOT@") # set the install/unistall icon used for the installer itself # There is a bug in NSI that does not handle full unix paths properly. - SET(CPACK_NSIS_MUI_ICON "@CMake_SOURCE_DIR@/Utilities/Release\\CMakeLogo.ico") - SET(CPACK_NSIS_MUI_UNIICON "@CMake_SOURCE_DIR@/Utilities/Release\\CMakeLogo.ico") + set(CPACK_NSIS_MUI_ICON "@CMake_SOURCE_DIR@/Utilities/Release\\CMakeLogo.ico") + set(CPACK_NSIS_MUI_UNIICON "@CMake_SOURCE_DIR@/Utilities/Release\\CMakeLogo.ico") # set the package header icon for MUI - SET(CPACK_PACKAGE_ICON "@CMake_SOURCE_DIR@/Utilities/Release\\CMakeInstall.bmp") + set(CPACK_PACKAGE_ICON "@CMake_SOURCE_DIR@/Utilities/Release\\CMakeInstall.bmp") # tell cpack to create links to the doc files - SET(CPACK_NSIS_MENU_LINKS + set(CPACK_NSIS_MENU_LINKS "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake-gui.html" "cmake-gui Help" "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake.html" "CMake Help" "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake-properties.html" @@ -24,30 +24,54 @@ if(CPACK_GENERATOR MATCHES "NSIS") "http://www.cmake.org" "CMake Web Site" ) # Use the icon from cmake-gui for add-remove programs - SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\cmake-gui.exe") + set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\cmake-gui.exe") - SET(CPACK_NSIS_PACKAGE_NAME "@CPACK_NSIS_PACKAGE_NAME@") - SET(CPACK_NSIS_DISPLAY_NAME "@CPACK_NSIS_PACKAGE_NAME@, a cross-platform, open-source build system") - SET(CPACK_NSIS_HELP_LINK "http://www.cmake.org") - SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.kitware.com") - SET(CPACK_NSIS_CONTACT @CPACK_PACKAGE_CONTACT@) - SET(CPACK_NSIS_MODIFY_PATH ON) -endif(CPACK_GENERATOR MATCHES "NSIS") + set(CPACK_NSIS_PACKAGE_NAME "@CPACK_NSIS_PACKAGE_NAME@") + set(CPACK_NSIS_DISPLAY_NAME "@CPACK_NSIS_PACKAGE_NAME@, a cross-platform, open-source build system") + set(CPACK_NSIS_HELP_LINK "http://www.cmake.org") + set(CPACK_NSIS_URL_INFO_ABOUT "http://www.kitware.com") + set(CPACK_NSIS_CONTACT @CPACK_PACKAGE_CONTACT@) + set(CPACK_NSIS_MODIFY_PATH ON) +endif() # include the cpack options for qt dialog if they exisit # they might not if qt was not enabled for the build -INCLUDE("@QT_DIALOG_CPACK_OPTIONS_FILE@" OPTIONAL) +include("@QT_DIALOG_CPACK_OPTIONS_FILE@" OPTIONAL) if(CPACK_GENERATOR MATCHES "CygwinSource") # when packaging source make sure the .build directory is not included - SET(CPACK_SOURCE_IGNORE_FILES + set(CPACK_SOURCE_IGNORE_FILES "/CVS/" "/\\.build/" "/\\.svn/" "\\.swp$" "\\.#" "/#" "~$") -endif(CPACK_GENERATOR MATCHES "CygwinSource") +endif() if("${CPACK_GENERATOR}" STREQUAL "PackageMaker") - if(CMAKE_PACKAGE_QTGUI) + if(CMAKE_PACKAGE_QTGUI) set(CPACK_PACKAGE_DEFAULT_LOCATION "/Applications") - else(CMAKE_PACKAGE_QTGUI) + else() set(CPACK_PACKAGE_DEFAULT_LOCATION "/usr") - endif(CMAKE_PACKAGE_QTGUI) -endif("${CPACK_GENERATOR}" STREQUAL "PackageMaker") + endif() +endif() + +if("${CPACK_GENERATOR}" STREQUAL "WIX") + # Reset CPACK_PACKAGE_VERSION to deal with WiX restriction. + # But the file names still use the full CMake_VERSION value: + set(CPACK_PACKAGE_FILE_NAME + "${CPACK_PACKAGE_NAME}-@CMake_VERSION@-${CPACK_SYSTEM_NAME}") + set(CPACK_SOURCE_PACKAGE_FILE_NAME + "${CPACK_PACKAGE_NAME}-@CMake_VERSION@-Source") + + if(NOT CPACK_WIX_SIZEOF_VOID_P) + set(CPACK_WIX_SIZEOF_VOID_P "@CMAKE_SIZEOF_VOID_P@") + endif() + + set(CPACK_PACKAGE_VERSION + "@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@.@CMake_VERSION_PATCH@") + # WIX installers require at most a 4 component version number, where + # each component is an integer between 0 and 65534 inclusive + set(tweak "@CMake_VERSION_TWEAK@") + if(tweak MATCHES "^[0-9]+$") + if(tweak GREATER 0 AND tweak LESS 65535) + set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.${tweak}") + endif() + endif() +endif() diff --git a/CMakeGraphVizOptions.cmake b/CMakeGraphVizOptions.cmake index 038f17e9b..1add78c55 100644 --- a/CMakeGraphVizOptions.cmake +++ b/CMakeGraphVizOptions.cmake @@ -1 +1 @@ -SET(GRAPHVIZ_IGNORE_TARGETS "tartest;testSystemTools;testRegistry;testProcess;testIOS;testHashSTL;testFail;testCommandLineArguments;xrtest;LIBCURL;foo") +set(GRAPHVIZ_IGNORE_TARGETS "tartest;testSystemTools;testRegistry;testProcess;testIOS;testHashSTL;testFail;testCommandLineArguments;xrtest;LIBCURL;foo") diff --git a/CMakeLists.txt b/CMakeLists.txt index 8522cad28..75d372d03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,71 +9,71 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.2 FATAL_ERROR) -SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required -PROJECT(CMake) +cmake_minimum_required(VERSION 2.8.2 FATAL_ERROR) +set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required +project(CMake) -IF(CMAKE_BOOTSTRAP) +if(CMAKE_BOOTSTRAP) # Running from bootstrap script. Set local variable and remove from cache. - SET(CMAKE_BOOTSTRAP 1) - UNSET(CMAKE_BOOTSTRAP CACHE) -ENDIF() + set(CMAKE_BOOTSTRAP 1) + unset(CMAKE_BOOTSTRAP CACHE) +endif() -SET(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin) +set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin) -IF("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") +if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") # Disallow architecture-specific try_run. It may not run on the host. - MACRO(TRY_RUN) - IF(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) - MESSAGE(FATAL_ERROR "TRY_RUN not allowed with CMAKE_TRY_COMPILE_OSX_ARCHITECTURES=[${CMAKE_TRY_COMPILE_OSX_ARCHITECTURES}]") - ELSE() + macro(TRY_RUN) + if(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) + message(FATAL_ERROR "TRY_RUN not allowed with CMAKE_TRY_COMPILE_OSX_ARCHITECTURES=[${CMAKE_TRY_COMPILE_OSX_ARCHITECTURES}]") + else() _TRY_RUN(${ARGV}) - ENDIF() - ENDMACRO() -ENDIF() + endif() + endmacro() +endif() #----------------------------------------------------------------------- # a macro to deal with system libraries, implemented as a macro # simply to improve readability of the main script #----------------------------------------------------------------------- -MACRO(CMAKE_HANDLE_SYSTEM_LIBRARIES) +macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) # Options have dependencies. - INCLUDE(CMakeDependentOption) + include(CMakeDependentOption) # Optionally use system xmlrpc. We no longer build or use it by default. - OPTION(CTEST_USE_XMLRPC "Enable xmlrpc submission method in CTest." OFF) - MARK_AS_ADVANCED(CTEST_USE_XMLRPC) + option(CTEST_USE_XMLRPC "Enable xmlrpc submission method in CTest." OFF) + mark_as_advanced(CTEST_USE_XMLRPC) # Allow the user to enable/disable all system utility library options by # defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}. - SET(UTILITIES BZIP2 CURL EXPAT LIBARCHIVE ZLIB) - FOREACH(util ${UTILITIES}) - IF(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util} + set(UTILITIES BZIP2 CURL EXPAT LIBARCHIVE ZLIB) + foreach(util ${UTILITIES}) + if(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util} AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES) - SET(CMAKE_USE_SYSTEM_LIBRARY_${util} "${CMAKE_USE_SYSTEM_LIBRARIES}") - ENDIF() - IF(DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util}) - IF(CMAKE_USE_SYSTEM_LIBRARY_${util}) - SET(CMAKE_USE_SYSTEM_LIBRARY_${util} ON) - ELSE() - SET(CMAKE_USE_SYSTEM_LIBRARY_${util} OFF) - ENDIF() - IF(CMAKE_BOOTSTRAP) - UNSET(CMAKE_USE_SYSTEM_LIBRARY_${util} CACHE) - ENDIF() - STRING(TOLOWER "${util}" lutil) - SET(CMAKE_USE_SYSTEM_${util} "${CMAKE_USE_SYSTEM_LIBRARY_${util}}" + set(CMAKE_USE_SYSTEM_LIBRARY_${util} "${CMAKE_USE_SYSTEM_LIBRARIES}") + endif() + if(DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util}) + if(CMAKE_USE_SYSTEM_LIBRARY_${util}) + set(CMAKE_USE_SYSTEM_LIBRARY_${util} ON) + else() + set(CMAKE_USE_SYSTEM_LIBRARY_${util} OFF) + endif() + if(CMAKE_BOOTSTRAP) + unset(CMAKE_USE_SYSTEM_LIBRARY_${util} CACHE) + endif() + string(TOLOWER "${util}" lutil) + set(CMAKE_USE_SYSTEM_${util} "${CMAKE_USE_SYSTEM_LIBRARY_${util}}" CACHE BOOL "Use system-installed ${lutil}" FORCE) - ELSE() - SET(CMAKE_USE_SYSTEM_LIBRARY_${util} OFF) - ENDIF() - ENDFOREACH(util) - IF(CMAKE_BOOTSTRAP) - UNSET(CMAKE_USE_SYSTEM_LIBRARIES CACHE) - ENDIF() + else() + set(CMAKE_USE_SYSTEM_LIBRARY_${util} OFF) + endif() + endforeach() + if(CMAKE_BOOTSTRAP) + unset(CMAKE_USE_SYSTEM_LIBRARIES CACHE) + endif() # Optionally use system utility libraries. - OPTION(CMAKE_USE_SYSTEM_LIBARCHIVE "Use system-installed libarchive" "${CMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE}") + option(CMAKE_USE_SYSTEM_LIBARCHIVE "Use system-installed libarchive" "${CMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE}") CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_CURL "Use system-installed curl" "${CMAKE_USE_SYSTEM_LIBRARY_CURL}" "NOT CTEST_USE_XMLRPC" ON) CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat" @@ -84,159 +84,158 @@ MACRO(CMAKE_HANDLE_SYSTEM_LIBRARIES) "${CMAKE_USE_SYSTEM_LIBRARY_BZIP2}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) # Mention to the user what system libraries are being used. - FOREACH(util ${UTILITIES}) - IF(CMAKE_USE_SYSTEM_${util}) - MESSAGE(STATUS "Using system-installed ${util}") - ENDIF(CMAKE_USE_SYSTEM_${util}) - ENDFOREACH(util) + foreach(util ${UTILITIES}) + if(CMAKE_USE_SYSTEM_${util}) + message(STATUS "Using system-installed ${util}") + endif() + endforeach() # Inform utility library header wrappers whether to use system versions. - CONFIGURE_FILE(${CMake_SOURCE_DIR}/Utilities/cmThirdParty.h.in + configure_file(${CMake_SOURCE_DIR}/Utilities/cmThirdParty.h.in ${CMake_BINARY_DIR}/Utilities/cmThirdParty.h @ONLY) -ENDMACRO(CMAKE_HANDLE_SYSTEM_LIBRARIES) +endmacro() -SET(CMAKE_BUILD_ON_VISUAL_STUDIO 0) -IF(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW ) - SET(CMAKE_BUILD_ON_VISUAL_STUDIO 1) -ENDIF(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW ) +set(CMAKE_BUILD_ON_VISUAL_STUDIO 0) +if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW ) + set(CMAKE_BUILD_ON_VISUAL_STUDIO 1) +endif() #----------------------------------------------------------------------- # a macro to determine the generator and ctest executable to use # for testing. Simply to improve readability of the main script. #----------------------------------------------------------------------- -MACRO(CMAKE_SETUP_TESTING) - IF (NOT DART_ROOT) - SET(MAKEPROGRAM ${CMAKE_MAKE_PROGRAM}) - ENDIF (NOT DART_ROOT) - - IF(BUILD_TESTING) - SET(CMAKE_TEST_GENERATOR "" CACHE STRING +macro(CMAKE_SETUP_TESTING) + if (NOT DART_ROOT) + set(MAKEPROGRAM ${CMAKE_MAKE_PROGRAM}) + endif () + + if(BUILD_TESTING) + set(CMAKE_TEST_GENERATOR "" CACHE STRING "Generator used when running tests") - SET(CMAKE_TEST_MAKEPROGRAM "" CACHE FILEPATH + set(CMAKE_TEST_MAKEPROGRAM "" CACHE FILEPATH "Generator used when running tests") - IF(NOT CMAKE_TEST_GENERATOR) - SET(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}") - SET(CMAKE_TEST_MAKEPROGRAM "${MAKEPROGRAM}") - ELSE(NOT CMAKE_TEST_GENERATOR) - SET(CMAKE_TEST_DIFFERENT_GENERATOR TRUE) - ENDIF(NOT CMAKE_TEST_GENERATOR) - + if(NOT CMAKE_TEST_GENERATOR) + set(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}") + set(CMAKE_TEST_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}") + set(CMAKE_TEST_MAKEPROGRAM "${MAKEPROGRAM}") + else() + set(CMAKE_TEST_DIFFERENT_GENERATOR TRUE) + set(CMAKE_TEST_GENERATOR_TOOLSET "") + endif() + # Are we testing with the MSVC compiler? - SET(CMAKE_TEST_MSVC 0) - IF(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR) - SET(CMAKE_TEST_MSVC 1) - ELSE(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR) - IF("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR + set(CMAKE_TEST_MSVC 0) + if(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR) + set(CMAKE_TEST_MSVC 1) + else() + if("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio") - SET(CMAKE_TEST_MSVC 1) - ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR - "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio") - ENDIF(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR) - - SET(CMAKE_TEST_SYSTEM_LIBRARIES 0) - FOREACH(util CURL EXPAT XMLRPC ZLIB) - IF(CMAKE_USE_SYSTEM_${util}) - SET(CMAKE_TEST_SYSTEM_LIBRARIES 1) - ENDIF(CMAKE_USE_SYSTEM_${util}) - ENDFOREACH(util) - + set(CMAKE_TEST_MSVC 1) + endif() + endif() + + set(CMAKE_TEST_SYSTEM_LIBRARIES 0) + foreach(util CURL EXPAT XMLRPC ZLIB) + if(CMAKE_USE_SYSTEM_${util}) + set(CMAKE_TEST_SYSTEM_LIBRARIES 1) + endif() + endforeach() + # This variable is set by cmake, however to # test cmake we want to make sure that # the ctest from this cmake is used for testing # and not the ctest from the cmake building and testing # cmake. - SET(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest") - SET(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake") - SET(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack") - ENDIF(BUILD_TESTING) + set(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest") + set(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake") + set(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack") + endif() # configure some files for testing - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in" + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/CTestScript.cmake" @ONLY) - CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage + configure_file(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage ${CMake_BINARY_DIR}/Tests/.NoDartCoverage) - CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage + configure_file(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage ${CMake_BINARY_DIR}/Modules/.NoDartCoverage) - CONFIGURE_FILE(${CMake_SOURCE_DIR}/CTestCustom.cmake.in + configure_file(${CMake_SOURCE_DIR}/CTestCustom.cmake.in ${CMake_BINARY_DIR}/CTestCustom.cmake @ONLY) - CONFIGURE_FILE(${CMake_SOURCE_DIR}/CTestCustom.ctest.in + configure_file(${CMake_SOURCE_DIR}/CTestCustom.ctest.in ${CMake_BINARY_DIR}/CTestCustom.ctest @ONLY) - IF(BUILD_TESTING AND DART_ROOT) - CONFIGURE_FILE(${CMake_SOURCE_DIR}/CMakeLogo.gif + if(BUILD_TESTING AND DART_ROOT) + configure_file(${CMake_SOURCE_DIR}/CMakeLogo.gif ${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY) - ENDIF(BUILD_TESTING AND DART_ROOT) - MARK_AS_ADVANCED(DART_ROOT) - MARK_AS_ADVANCED(CURL_TESTING) -ENDMACRO(CMAKE_SETUP_TESTING) + endif() + mark_as_advanced(DART_ROOT) + mark_as_advanced(CURL_TESTING) +endmacro() # Provide a way for Visual Studio Express users to turn OFF the new FOLDER # organization feature. Default to ON for non-Express users. Express users must # explicitly turn off this option to build CMake in the Express IDE... # -OPTION(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON) -MARK_AS_ADVANCED(CMAKE_USE_FOLDERS) +option(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON) +mark_as_advanced(CMAKE_USE_FOLDERS) #----------------------------------------------------------------------- # a macro that only sets the FOLDER target property if it's # "appropriate" #----------------------------------------------------------------------- -MACRO(CMAKE_SET_TARGET_FOLDER tgt folder) - IF(CMAKE_USE_FOLDERS) - SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) +macro(CMAKE_SET_TARGET_FOLDER tgt folder) + if(CMAKE_USE_FOLDERS) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Really, I just want this to be an "if(TARGET ${tgt})" ... # but I'm not sure that our min req'd., CMake 2.4.5 can handle # that... so I'm just activating this for now, with a version # compare, and only for MSVC builds. - IF(MSVC) - IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8) - SET_PROPERTY(TARGET "${tgt}" PROPERTY FOLDER "${folder}") - ENDIF() - ENDIF() - ELSE() - SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS OFF) - ENDIF() -ENDMACRO(CMAKE_SET_TARGET_FOLDER) + if(MSVC) + if(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8) + set_property(TARGET "${tgt}" PROPERTY FOLDER "${folder}") + endif() + endif() + else() + set_property(GLOBAL PROPERTY USE_FOLDERS OFF) + endif() +endmacro() #----------------------------------------------------------------------- # a macro to build the utilities used by CMake # Simply to improve readability of the main script. #----------------------------------------------------------------------- -MACRO (CMAKE_BUILD_UTILITIES) +macro (CMAKE_BUILD_UTILITIES) #--------------------------------------------------------------------- # Create the KWIML library for CMake. - SET(KWIML cmIML) - SET(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities) - ADD_SUBDIRECTORY(Utilities/KWIML) + set(KWIML cmIML) + set(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities) + add_subdirectory(Utilities/KWIML) #--------------------------------------------------------------------- # Create the kwsys library for CMake. - SET(KWSYS_NAMESPACE cmsys) - SET(KWSYS_USE_SystemTools 1) - SET(KWSYS_USE_Directory 1) - SET(KWSYS_USE_RegularExpression 1) - SET(KWSYS_USE_Base64 1) - SET(KWSYS_USE_MD5 1) - SET(KWSYS_USE_Process 1) - SET(KWSYS_USE_CommandLineArguments 1) - SET(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source) - SET(KWSYS_INSTALL_DOC_DIR "${CMake_DOC_DEST}") - ADD_SUBDIRECTORY(Source/kwsys) - SET(kwsys_folder "Utilities/KWSys") + set(KWSYS_NAMESPACE cmsys) + set(KWSYS_USE_SystemTools 1) + set(KWSYS_USE_Directory 1) + set(KWSYS_USE_RegularExpression 1) + set(KWSYS_USE_Base64 1) + set(KWSYS_USE_MD5 1) + set(KWSYS_USE_Process 1) + set(KWSYS_USE_CommandLineArguments 1) + set(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source) + set(KWSYS_INSTALL_DOC_DIR "${CMake_DOC_DEST}") + add_subdirectory(Source/kwsys) + set(kwsys_folder "Utilities/KWSys") CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE} "${kwsys_folder}") CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}_c "${kwsys_folder}") - CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}EncodeExecutable "${kwsys_folder}") - CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}ProcessFwd9x "${kwsys_folder}") if(BUILD_TESTING) CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestDynload "${kwsys_folder}") CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestProcess "${kwsys_folder}") @@ -249,248 +248,248 @@ MACRO (CMAKE_BUILD_UTILITIES) # Setup third-party libraries. # Everything in the tree should be able to include files from the # Utilities directory. - INCLUDE_DIRECTORIES( + include_directories( ${CMake_BINARY_DIR}/Utilities ${CMake_SOURCE_DIR}/Utilities ) - + # check for the use of system libraries versus builtin ones # (a macro defined in this file) CMAKE_HANDLE_SYSTEM_LIBRARIES() - + #--------------------------------------------------------------------- # Build zlib library for Curl, CMake, and CTest. - SET(CMAKE_ZLIB_HEADER "cm_zlib.h") - IF(CMAKE_USE_SYSTEM_ZLIB) - FIND_PACKAGE(ZLIB) - IF(NOT ZLIB_FOUND) - MESSAGE(FATAL_ERROR + set(CMAKE_ZLIB_HEADER "cm_zlib.h") + if(CMAKE_USE_SYSTEM_ZLIB) + find_package(ZLIB) + if(NOT ZLIB_FOUND) + message(FATAL_ERROR "CMAKE_USE_SYSTEM_ZLIB is ON but a zlib is not found!") - ENDIF(NOT ZLIB_FOUND) - SET(CMAKE_ZLIB_INCLUDES ${ZLIB_INCLUDE_DIR}) - SET(CMAKE_ZLIB_LIBRARIES ${ZLIB_LIBRARIES}) - ELSE(CMAKE_USE_SYSTEM_ZLIB) - SET(CMAKE_ZLIB_INCLUDES ${CMake_SOURCE_DIR}/Utilities) - SET(CMAKE_ZLIB_LIBRARIES cmzlib) - ADD_SUBDIRECTORY(Utilities/cmzlib) + endif() + set(CMAKE_ZLIB_INCLUDES ${ZLIB_INCLUDE_DIR}) + set(CMAKE_ZLIB_LIBRARIES ${ZLIB_LIBRARIES}) + else() + set(CMAKE_ZLIB_INCLUDES ${CMake_SOURCE_DIR}/Utilities) + set(CMAKE_ZLIB_LIBRARIES cmzlib) + add_subdirectory(Utilities/cmzlib) CMAKE_SET_TARGET_FOLDER(cmzlib "Utilities/3rdParty") - ENDIF(CMAKE_USE_SYSTEM_ZLIB) - + endif() + #--------------------------------------------------------------------- # Build Curl library for CTest. - IF(CMAKE_USE_SYSTEM_CURL) - FIND_PACKAGE(CURL) - IF(NOT CURL_FOUND) - MESSAGE(FATAL_ERROR + if(CMAKE_USE_SYSTEM_CURL) + find_package(CURL) + if(NOT CURL_FOUND) + message(FATAL_ERROR "CMAKE_USE_SYSTEM_CURL is ON but a curl is not found!") - ENDIF(NOT CURL_FOUND) - SET(CMAKE_CURL_INCLUDES ${CURL_INCLUDE_DIRS}) - SET(CMAKE_CURL_LIBRARIES ${CURL_LIBRARIES}) - ELSE(CMAKE_USE_SYSTEM_CURL) - SET(CURL_SPECIAL_ZLIB_H ${CMAKE_ZLIB_HEADER}) - SET(CURL_SPECIAL_LIBZ_INCLUDES ${CMAKE_ZLIB_INCLUDES}) - SET(CURL_SPECIAL_LIBZ ${CMAKE_ZLIB_LIBRARIES}) - OPTION(CMAKE_BUILD_CURL_SHARED "Should curl be built shared" FALSE) - IF(NOT CMAKE_BUILD_CURL_SHARED) - ADD_DEFINITIONS(-DCURL_STATICLIB) - ENDIF(NOT CMAKE_BUILD_CURL_SHARED) - SET(CMAKE_CURL_INCLUDES) - SET(CMAKE_CURL_LIBRARIES cmcurl) - IF(CMAKE_TESTS_CDASH_SERVER) - SET(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php") - ENDIF(CMAKE_TESTS_CDASH_SERVER) - ADD_SUBDIRECTORY(Utilities/cmcurl) + endif() + set(CMAKE_CURL_INCLUDES ${CURL_INCLUDE_DIRS}) + set(CMAKE_CURL_LIBRARIES ${CURL_LIBRARIES}) + else() + set(CURL_SPECIAL_ZLIB_H ${CMAKE_ZLIB_HEADER}) + set(CURL_SPECIAL_LIBZ_INCLUDES ${CMAKE_ZLIB_INCLUDES}) + set(CURL_SPECIAL_LIBZ ${CMAKE_ZLIB_LIBRARIES}) + option(CMAKE_BUILD_CURL_SHARED "Should curl be built shared" FALSE) + if(NOT CMAKE_BUILD_CURL_SHARED) + add_definitions(-DCURL_STATICLIB) + endif() + set(CMAKE_CURL_INCLUDES) + set(CMAKE_CURL_LIBRARIES cmcurl) + if(CMAKE_TESTS_CDASH_SERVER) + set(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php") + endif() + add_subdirectory(Utilities/cmcurl) CMAKE_SET_TARGET_FOLDER(cmcurl "Utilities/3rdParty") CMAKE_SET_TARGET_FOLDER(LIBCURL "Utilities/3rdParty") - ENDIF(CMAKE_USE_SYSTEM_CURL) + endif() #--------------------------------------------------------------------- # Build Compress library for CTest. - SET(CMAKE_COMPRESS_INCLUDES + set(CMAKE_COMPRESS_INCLUDES "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress") - SET(CMAKE_COMPRESS_LIBRARIES "cmcompress") - ADD_SUBDIRECTORY(Utilities/cmcompress) + set(CMAKE_COMPRESS_LIBRARIES "cmcompress") + add_subdirectory(Utilities/cmcompress) CMAKE_SET_TARGET_FOLDER(cmcompress "Utilities/3rdParty") - IF(CMAKE_USE_SYSTEM_BZIP2) - FIND_PACKAGE(BZip2) - ELSE() - SET(BZIP2_INCLUDE_DIR + if(CMAKE_USE_SYSTEM_BZIP2) + find_package(BZip2) + else() + set(BZIP2_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmbzip2") - SET(BZIP2_LIBRARIES cmbzip2) - ADD_SUBDIRECTORY(Utilities/cmbzip2) + set(BZIP2_LIBRARIES cmbzip2) + add_subdirectory(Utilities/cmbzip2) CMAKE_SET_TARGET_FOLDER(cmbzip2 "Utilities/3rdParty") - ENDIF() + endif() #--------------------------------------------------------------------- # Build or use system libarchive for CMake and CTest. - IF(CMAKE_USE_SYSTEM_LIBARCHIVE) - IF(EXISTS ${CMAKE_ROOT}/Modules/FindLibArchive.cmake) # added in 2.8.3 - FIND_PACKAGE(LibArchive) - ELSE() - INCLUDE(${CMake_SOURCE_DIR}/Modules/FindLibArchive.cmake) - ENDIF() - IF(NOT LibArchive_FOUND) - MESSAGE(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!") - ENDIF() - SET(CMAKE_TAR_INCLUDES ${LibArchive_INCLUDE_DIRS}) - SET(CMAKE_TAR_LIBRARIES ${LibArchive_LIBRARIES}) - ELSE(CMAKE_USE_SYSTEM_LIBARCHIVE) - SET(ZLIB_INCLUDE_DIR ${CMAKE_ZLIB_INCLUDES}) - SET(ZLIB_LIBRARY ${CMAKE_ZLIB_LIBRARIES}) - ADD_DEFINITIONS(-DLIBARCHIVE_STATIC) - SET(ENABLE_NETTLE OFF CACHE INTERNAL "Enable use of Nettle") - SET(ENABLE_OPENSSL ${CMAKE_USE_OPENSSL} CACHE INTERNAL "Enable use of OpenSSL") - SET(ENABLE_XATTR OFF CACHE INTERNAL "Enable extended attribute support") - SET(ENABLE_ACL OFF CACHE INTERNAL "Enable ACL support") - SET(ENABLE_ICONV OFF CACHE INTERNAL "Enable iconv support") - ADD_SUBDIRECTORY(Utilities/cmlibarchive) + if(CMAKE_USE_SYSTEM_LIBARCHIVE) + if(EXISTS ${CMAKE_ROOT}/Modules/FindLibArchive.cmake) # added in 2.8.3 + find_package(LibArchive) + else() + include(${CMake_SOURCE_DIR}/Modules/FindLibArchive.cmake) + endif() + if(NOT LibArchive_FOUND) + message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!") + endif() + set(CMAKE_TAR_INCLUDES ${LibArchive_INCLUDE_DIRS}) + set(CMAKE_TAR_LIBRARIES ${LibArchive_LIBRARIES}) + else() + set(ZLIB_INCLUDE_DIR ${CMAKE_ZLIB_INCLUDES}) + set(ZLIB_LIBRARY ${CMAKE_ZLIB_LIBRARIES}) + add_definitions(-DLIBARCHIVE_STATIC) + set(ENABLE_NETTLE OFF CACHE INTERNAL "Enable use of Nettle") + set(ENABLE_OPENSSL ${CMAKE_USE_OPENSSL} CACHE INTERNAL "Enable use of OpenSSL") + set(ENABLE_XATTR OFF CACHE INTERNAL "Enable extended attribute support") + set(ENABLE_ACL OFF CACHE INTERNAL "Enable ACL support") + set(ENABLE_ICONV OFF CACHE INTERNAL "Enable iconv support") + add_subdirectory(Utilities/cmlibarchive) CMAKE_SET_TARGET_FOLDER(cmlibarchive "Utilities/3rdParty") - SET(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES}) - ENDIF(CMAKE_USE_SYSTEM_LIBARCHIVE) + set(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES}) + endif() #--------------------------------------------------------------------- # Build expat library for CMake and CTest. - IF(CMAKE_USE_SYSTEM_EXPAT) - FIND_PACKAGE(EXPAT) - IF(NOT EXPAT_FOUND) - MESSAGE(FATAL_ERROR + if(CMAKE_USE_SYSTEM_EXPAT) + find_package(EXPAT) + if(NOT EXPAT_FOUND) + message(FATAL_ERROR "CMAKE_USE_SYSTEM_EXPAT is ON but a expat is not found!") - ENDIF(NOT EXPAT_FOUND) - SET(CMAKE_EXPAT_INCLUDES ${EXPAT_INCLUDE_DIRS}) - SET(CMAKE_EXPAT_LIBRARIES ${EXPAT_LIBRARIES}) - ELSE(CMAKE_USE_SYSTEM_EXPAT) - SET(CMAKE_EXPAT_INCLUDES) - SET(CMAKE_EXPAT_LIBRARIES cmexpat) - ADD_SUBDIRECTORY(Utilities/cmexpat) + endif() + set(CMAKE_EXPAT_INCLUDES ${EXPAT_INCLUDE_DIRS}) + set(CMAKE_EXPAT_LIBRARIES ${EXPAT_LIBRARIES}) + else() + set(CMAKE_EXPAT_INCLUDES) + set(CMAKE_EXPAT_LIBRARIES cmexpat) + add_subdirectory(Utilities/cmexpat) CMAKE_SET_TARGET_FOLDER(cmexpat "Utilities/3rdParty") - ENDIF(CMAKE_USE_SYSTEM_EXPAT) - + endif() + #--------------------------------------------------------------------- # Build XMLRPC library for CMake and CTest. - IF(CTEST_USE_XMLRPC) - FIND_PACKAGE(XMLRPC QUIET REQUIRED libwww-client) - IF(NOT XMLRPC_FOUND) - MESSAGE(FATAL_ERROR + if(CTEST_USE_XMLRPC) + find_package(XMLRPC QUIET REQUIRED libwww-client) + if(NOT XMLRPC_FOUND) + message(FATAL_ERROR "CTEST_USE_XMLRPC is ON but xmlrpc is not found!") - ENDIF(NOT XMLRPC_FOUND) - SET(CMAKE_XMLRPC_INCLUDES ${XMLRPC_INCLUDE_DIRS}) - SET(CMAKE_XMLRPC_LIBRARIES ${XMLRPC_LIBRARIES}) - ENDIF(CTEST_USE_XMLRPC) - + endif() + set(CMAKE_XMLRPC_INCLUDES ${XMLRPC_INCLUDE_DIRS}) + set(CMAKE_XMLRPC_LIBRARIES ${XMLRPC_LIBRARIES}) + endif() + #--------------------------------------------------------------------- # Use curses? - IF (UNIX) + if (UNIX) # there is a bug in the Syllable libraries which makes linking ccmake fail, Alex - IF(NOT "${CMAKE_SYSTEM_NAME}" MATCHES syllable) - SET(CURSES_NEED_NCURSES TRUE) - FIND_PACKAGE(Curses QUIET) - IF (CURSES_LIBRARY) - OPTION(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" ON) - ELSE (CURSES_LIBRARY) - MESSAGE("Curses libraries were not found. Curses GUI for CMake will not be built.") - SET(BUILD_CursesDialog 0) - ENDIF (CURSES_LIBRARY) - ELSE(NOT "${CMAKE_SYSTEM_NAME}" MATCHES syllable) - SET(BUILD_CursesDialog 0) - ENDIF(NOT "${CMAKE_SYSTEM_NAME}" MATCHES syllable) - ELSE (UNIX) - SET(BUILD_CursesDialog 0) - ENDIF (UNIX) - IF(BUILD_CursesDialog) - ADD_SUBDIRECTORY(Source/CursesDialog/form) - ENDIF(BUILD_CursesDialog) -ENDMACRO (CMAKE_BUILD_UTILITIES) + if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES syllable) + set(CURSES_NEED_NCURSES TRUE) + find_package(Curses QUIET) + if (CURSES_LIBRARY) + option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" ON) + else () + message("Curses libraries were not found. Curses GUI for CMake will not be built.") + set(BUILD_CursesDialog 0) + endif () + else() + set(BUILD_CursesDialog 0) + endif() + else () + set(BUILD_CursesDialog 0) + endif () + if(BUILD_CursesDialog) + add_subdirectory(Source/CursesDialog/form) + endif() +endmacro () #----------------------------------------------------------------------- -IF(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") - EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} +if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") + execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -dumpversion OUTPUT_VARIABLE _GXX_VERSION ) - STRING(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" + string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" _GXX_VERSION_SHORT ${_GXX_VERSION}) - IF(_GXX_VERSION_SHORT EQUAL 33) - MESSAGE(FATAL_ERROR + if(_GXX_VERSION_SHORT EQUAL 33) + message(FATAL_ERROR "GXX 3.3 on OpenBSD is known to cause CPack to Crash.\n" "Please use GXX 4.2 or greater to build CMake on OpenBSD\n" "${CMAKE_CXX_COMPILER} version is: ${_GXX_VERSION}") - ENDIF() -ENDIF() + endif() +endif() #----------------------------------------------------------------------- # The main section of the CMakeLists file # #----------------------------------------------------------------------- -INCLUDE(Source/CMakeVersion.cmake) +include(Source/CMakeVersion.cmake) # Releases define a small tweak level. -IF("${CMake_VERSION_TWEAK}" VERSION_LESS 20000000) - SET(CMake_VERSION_IS_RELEASE 1) - SET(CMake_VERSION_SOURCE "") -ELSE() - SET(CMake_VERSION_IS_RELEASE 0) - INCLUDE(${CMake_SOURCE_DIR}/Source/CMakeVersionSource.cmake) -ENDIF() +if("${CMake_VERSION_TWEAK}" VERSION_LESS 20000000) + set(CMake_VERSION_IS_RELEASE 1) + set(CMake_VERSION_SOURCE "") +else() + set(CMake_VERSION_IS_RELEASE 0) + include(${CMake_SOURCE_DIR}/Source/CMakeVersionSource.cmake) +endif() # Compute the full version string. -SET(CMake_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}) -IF(${CMake_VERSION_TWEAK} GREATER 0) - SET(CMake_VERSION ${CMake_VERSION}.${CMake_VERSION_TWEAK}) -ENDIF() -IF(CMake_VERSION_RC) - SET(CMake_VERSION ${CMake_VERSION}-rc${CMake_VERSION_RC}) -ENDIF() -IF(CMake_VERSION_SOURCE) - SET(CMake_VERSION ${CMake_VERSION}-${CMake_VERSION_SOURCE}) -ENDIF() +set(CMake_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}) +if(${CMake_VERSION_TWEAK} GREATER 0) + set(CMake_VERSION ${CMake_VERSION}.${CMake_VERSION_TWEAK}) +endif() +if(CMake_VERSION_RC) + set(CMake_VERSION ${CMake_VERSION}-rc${CMake_VERSION_RC}) +endif() +if(CMake_VERSION_SOURCE) + set(CMake_VERSION ${CMake_VERSION}-${CMake_VERSION_SOURCE}) +endif() # Include the standard Dart testing module -ENABLE_TESTING() -INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake) +enable_testing() +include (${CMAKE_ROOT}/Modules/Dart.cmake) # Set up test-time configuration. -SET_DIRECTORY_PROPERTIES(PROPERTIES +set_directory_properties(PROPERTIES TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake") # where to write the resulting executables and libraries -SET(BUILD_SHARED_LIBS OFF) -SET(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.") -SET(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL +set(BUILD_SHARED_LIBS OFF) +set(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.") +set(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL "Where to put the libraries for CMake") # The CMake executables usually do not need any rpath to run in the build or # install tree. -SET(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.") +set(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.") -SET(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" CACHE STRING +set(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" CACHE STRING "Install location for data (relative to prefix).") -SET(CMAKE_DOC_DIR "/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" CACHE STRING +set(CMAKE_DOC_DIR "/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" CACHE STRING "Install location for documentation (relative to prefix).") -SET(CMAKE_MAN_DIR "/man" CACHE STRING +set(CMAKE_MAN_DIR "/man" CACHE STRING "Install location for man pages (relative to prefix).") -MARK_AS_ADVANCED(CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR) -IF(CYGWIN AND EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") +mark_as_advanced(CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR) +if(CYGWIN AND EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") # Force doc, data and man dirs to conform to cygwin layout. - SET(CMAKE_DOC_DIR "/share/doc/cmake-${CMake_VERSION}") - SET(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION}") - SET(CMAKE_MAN_DIR "/share/man") + set(CMAKE_DOC_DIR "/share/doc/cmake-${CMake_VERSION}") + set(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION}") + set(CMAKE_MAN_DIR "/share/man") # let the user know we just forced these values - MESSAGE(STATUS "Setup for Cygwin packaging") - MESSAGE(STATUS "Override cache CMAKE_DOC_DIR = ${CMAKE_DOC_DIR}") - MESSAGE(STATUS "Override cache CMAKE_DATA_DIR = ${CMAKE_DATA_DIR}") - MESSAGE(STATUS "Override cache CMAKE_MAN_DIR = ${CMAKE_MAN_DIR}") -ENDIF() -STRING(REGEX REPLACE "^/" "" CMake_DATA_DEST "${CMAKE_DATA_DIR}") -STRING(REGEX REPLACE "^/" "" CMake_DOC_DEST "${CMAKE_DOC_DIR}") - -IF(BUILD_TESTING) - INCLUDE(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake) -ENDIF() + message(STATUS "Setup for Cygwin packaging") + message(STATUS "Override cache CMAKE_DOC_DIR = ${CMAKE_DOC_DIR}") + message(STATUS "Override cache CMAKE_DATA_DIR = ${CMAKE_DATA_DIR}") + message(STATUS "Override cache CMAKE_MAN_DIR = ${CMAKE_MAN_DIR}") +endif() +string(REGEX REPLACE "^/" "" CMake_DATA_DEST "${CMAKE_DATA_DIR}") +string(REGEX REPLACE "^/" "" CMake_DOC_DEST "${CMAKE_DOC_DIR}") + +if(BUILD_TESTING) + include(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake) +endif() # include special compile flags for some compilers -INCLUDE(CompileFlags.cmake) +include(CompileFlags.cmake) # no clue why we are testing for this here -INCLUDE(CheckSymbolExists) +include(CheckSymbolExists) CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV) CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE) @@ -507,91 +506,113 @@ CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE) # to a cdash4simpletest database. In these cases, the CDash dashboards # should be run first. # -IF("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") - SET(CMAKE_TESTS_CDASH_SERVER "http://www.cdash.org/CDash") -ENDIF("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") +if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") + set(CMAKE_TESTS_CDASH_SERVER "http://www.cdash.org/CDash") +endif() -# build the utilities (a macro defined in this file) +# build the utilities (a macro defined in this file) CMAKE_BUILD_UTILITIES() # On NetBSD ncurses is required, since curses doesn't have the wsyncup() # function. ncurses is installed via pkgsrc, so the library is in /usr/pkg/lib, -# which isn't in the default linker search path. So without RPATH ccmake +# which isn't in the default linker search path. So without RPATH ccmake # doesn't run and the build doesn't succeed since ccmake is executed for # generating the documentation. -IF(BUILD_CursesDialog) - GET_FILENAME_COMPONENT(_CURSES_DIR "${CURSES_LIBRARY}" PATH) - SET(CURSES_NEED_RPATH FALSE) - IF(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64") - SET(CURSES_NEED_RPATH TRUE) - ENDIF(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64") -ENDIF(BUILD_CursesDialog) - -IF(BUILD_QtDialog) - IF(APPLE) - SET(CMAKE_BUNDLE_NAME +if(BUILD_CursesDialog) + get_filename_component(_CURSES_DIR "${CURSES_LIBRARY}" PATH) + set(CURSES_NEED_RPATH FALSE) + if(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64") + set(CURSES_NEED_RPATH TRUE) + endif() +endif() + +if(BUILD_QtDialog) + if(APPLE) + set(CMAKE_BUNDLE_NAME "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}-${CMake_VERSION_PATCH}") - SET(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}") + set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}") # make sure CMAKE_INSTALL_PREFIX ends in / - STRING(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN) - MATH(EXPR LEN "${LEN} -1" ) - STRING(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH) - IF(NOT "${ENDCH}" STREQUAL "/") - SET(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/") - ENDIF(NOT "${ENDCH}" STREQUAL "/") - SET(CMAKE_INSTALL_PREFIX + string(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN) + math(EXPR LEN "${LEN} -1" ) + string(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH) + if(NOT "${ENDCH}" STREQUAL "/") + set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/") + endif() + set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}${CMAKE_BUNDLE_NAME}.app/Contents") - ENDIF(APPLE) - - SET(QT_NEED_RPATH FALSE) - IF(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64") - SET(QT_NEED_RPATH TRUE) - ENDIF(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64") -ENDIF(BUILD_QtDialog) + endif() + + set(QT_NEED_RPATH FALSE) + if(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64") + set(QT_NEED_RPATH TRUE) + endif() +endif() # The same might be true on other systems for other libraries. -# Then only enable RPATH if we have are building at least with cmake 2.4, +# Then only enable RPATH if we have are building at least with cmake 2.4, # since this one has much better RPATH features than cmake 2.2. # The executables are then built with the RPATH for the libraries outside # the build tree, which is both the build and the install RPATH. -IF (UNIX) - IF( CMAKE_USE_SYSTEM_CURL OR CMAKE_USE_SYSTEM_ZLIB - OR CMAKE_USE_SYSTEM_EXPAT OR CTEST_USE_XMLRPC OR CURSES_NEED_RPATH OR QT_NEED_RPATH) - SET(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.") - SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) - ENDIF(CMAKE_USE_SYSTEM_CURL OR CMAKE_USE_SYSTEM_ZLIB +if (UNIX) + if( CMAKE_USE_SYSTEM_CURL OR CMAKE_USE_SYSTEM_ZLIB OR CMAKE_USE_SYSTEM_EXPAT OR CTEST_USE_XMLRPC OR CURSES_NEED_RPATH OR QT_NEED_RPATH) -ENDIF (UNIX) + set(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.") + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + endif() +endif () # add the uninstall support -CONFIGURE_FILE( +configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" @ONLY) -ADD_CUSTOM_TARGET(uninstall +add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") -INCLUDE (CMakeCPack.cmake) +include (CMakeCPack.cmake) # setup some Testing support (a macro defined in this file) CMAKE_SETUP_TESTING() -CONFIGURE_FILE( +configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/DartLocal.conf.in" "${CMAKE_CURRENT_BINARY_DIR}/DartLocal.conf" COPYONLY) -OPTION(CMAKE_STRICT +option(CMAKE_STRICT "Perform strict testing to record property and variable access. Can be used to report any undefined properties or variables" OFF) -MARK_AS_ADVANCED(CMAKE_STRICT) +mark_as_advanced(CMAKE_STRICT) + +if(NOT CMake_VERSION_IS_RELEASE) + if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND + NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2) + set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts + -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security + -Wmissing-format-attribute -fno-common -Wundef + ) + set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W + -Wshadow -Wpointer-arith -Wformat-security -Wundef + ) + foreach(FLAG_LANG C CXX) + foreach(FLAG ${${FLAG_LANG}_FLAGS_LIST}) + if(NOT " ${CMAKE_${FLAG_LANG}_FLAGS} " MATCHES " ${FLAG} ") + set(CMAKE_${FLAG_LANG}_FLAGS "${CMAKE_${FLAG_LANG}_FLAGS} ${FLAG}") + endif() + endforeach() + endforeach() + + unset(C_FLAGS_LIST) + unset(CXX_FLAGS_LIST) + endif() +endif() # build the remaining subdirectories -ADD_SUBDIRECTORY(Source) -ADD_SUBDIRECTORY(Utilities) -ADD_SUBDIRECTORY(Tests) +add_subdirectory(Source) +add_subdirectory(Utilities) +add_subdirectory(Tests) if(BUILD_TESTING) CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests") @@ -600,14 +621,14 @@ CMAKE_SET_TARGET_FOLDER(cmw9xcom "Utilities/Win9xCompat") CMAKE_SET_TARGET_FOLDER(documentation "Documentation") # add a test -ADD_TEST(SystemInformationNew "${CMAKE_CMAKE_COMMAND}" +add_test(SystemInformationNew "${CMAKE_CMAKE_COMMAND}" --system-information -G "${CMAKE_TEST_GENERATOR}" ) # Install license file as it requires. -INSTALL(FILES Copyright.txt DESTINATION ${CMake_DOC_DEST}) +install(FILES Copyright.txt DESTINATION ${CMake_DOC_DEST}) # Install script directories. -INSTALL( +install( DIRECTORY Modules Templates DESTINATION "${CMake_DATA_DEST}" FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ @@ -620,7 +641,7 @@ INSTALL( ) # process docs related install -ADD_SUBDIRECTORY(Docs) +add_subdirectory(Docs) #----------------------------------------------------------------------- # End of the main section of the CMakeLists file @@ -631,4 +652,4 @@ ADD_SUBDIRECTORY(Docs) # to compute the location of the "cmake" executable. We set it here # so that those CMake versions can find it. We wait until after all # the add_subdirectory() calls to avoid affecting the subdirectories. -SET(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR}) +set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR}) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 39032220e..92eacd8e3 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -19,7 +19,7 @@ set(CTEST_DROP_SITE_CDASH TRUE) set(CTEST_CDASH_VERSION "1.6") set(CTEST_CDASH_QUERY_VERSION TRUE) -# use old trigger stuff so that cmake 2.4 and below will not +# use old trigger stuff so that cmake 2.4 and below will not # get errors on trigger -SET (TRIGGER_SITE +set (TRIGGER_SITE "http://public.kitware.com/cgi-bin/Submit-CMake-TestingResults.cgi") diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 982919198..495d156cc 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -1,8 +1,8 @@ -SET(CTEST_CUSTOM_ERROR_MATCH +set(CTEST_CUSTOM_ERROR_MATCH ${CTEST_CUSTOM_ERROR_MATCH} "ERROR:") -SET(CTEST_CUSTOM_WARNING_EXCEPTION +set(CTEST_CUSTOM_WARNING_EXCEPTION ${CTEST_CUSTOM_WARNING_EXCEPTION} "xtree.[0-9]+. : warning C4702: unreachable code" "warning LNK4221" @@ -31,6 +31,7 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION "remark: .*LOOP WAS VECTORIZED" "warning .980: wrong number of actual arguments to intrinsic function .std::basic_" "LINK : warning LNK4089: all references to.*ADVAPI32.dll.*discarded by /OPT:REF" + "LINK : warning LNK4089: all references to.*PSAPI.DLL.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF" "Warning: library was too large for page size.*" "Warning: public.*_archive_.*in module.*archive_*clashes with prior module.*archive_.*" @@ -56,21 +57,21 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION "[0-9,]+ warnings? generated." ) -IF(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode") - SET(CTEST_CUSTOM_COVERAGE_EXCLUDE +if(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode") + set(CTEST_CUSTOM_COVERAGE_EXCLUDE ${CTEST_CUSTOM_COVERAGE_EXCLUDE} "XCode" ) -ENDIF (NOT "@CMAKE_GENERATOR@" MATCHES "Xcode") +endif () -IF(NOT "@CMAKE_GENERATOR@" MATCHES "KDevelop") - SET(CTEST_CUSTOM_COVERAGE_EXCLUDE +if(NOT "@CMAKE_GENERATOR@" MATCHES "KDevelop") + set(CTEST_CUSTOM_COVERAGE_EXCLUDE ${CTEST_CUSTOM_COVERAGE_EXCLUDE} "Kdevelop" ) -ENDIF (NOT "@CMAKE_GENERATOR@" MATCHES "KDevelop") +endif () -SET(CTEST_CUSTOM_COVERAGE_EXCLUDE +set(CTEST_CUSTOM_COVERAGE_EXCLUDE ${CTEST_CUSTOM_COVERAGE_EXCLUDE} # Exclude kwsys files from coverage results. They are reported diff --git a/ChangeLog.manual b/ChangeLog.manual index cdab4422d..493686d49 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,1032 @@ +Changes in CMake 2.8.11-rc1 (since 2.8.10.2) +---------------------------------------------- +Alan Witkowski (1): + FindBullet: Search in per-config dirs on Windows (#13738) + +Aleksey Avdeev (1): + Add module FindIcotool + +Alex Neundorf (30): + Eclipse: add switch to disable linked resources (#13189) + Eclipse: set source path once to fix Eclipse indexer (#13596) + cmDependsC: remove unused member variable + cmDependsC: remove code duplication + cmDependsC: fix indentation + cmDepends: allow multiple dependees per depender + AddCustomCommand: Handle multiple IMPLICIT_DEPENDS files (#10048) + Add support for Texas Instruments DSP compiler (#12405) + Squish: detect version + Squish: use FPHSA + Squish: find executables also under Windows + Squish: rename squish_add_test() to squish_v3_add_test() and fix docs a bit + Squish: use ${CMAKE_CURRENT_LIST_DIR} + Squish: add support for squish 4 (#9734) + Squish: fix new squish_v4_add_test() macro + Automoc: "inherit" FOLDER target property from target (#13688) + FPHSA: don't succeed if only checking for XX_FOUND (#13755) + CONFIGURE_PACKAGE_CONFIG_FILE(): improve generated comments + Automoc: get include dirs without stripping implicit include dirs off + configure_package_config_file: force absolute paths for usr-move + configure_package_config_file(): fix indentation + configure_package_config_file(): extend documentation + documentation: handling of relative paths by include- and link_directories() + automoc: use a std::vector<> instead a std::list + automoc: use the header extensions from cmMakefile + Eclipse: also detect include dirs and macro for clang (#13823) + cmLocalGenerator: remove "virtual" where not used + export files: rewrite the code for checking required targets + FPHSA: Add FOUND_VAR option to specify _FOUND variable name + FPHSA: improve documentation + +Alexander Chehovsky (2): + Xcode: Fix nested source group handling (#12943) + Xcode: Sort source files + +Amine Chadly (2): + file: remove dead code + Add test to secure the file(GLOB empty) behavior. + +Amit Kulkarni (6): + OpenBSD: Install shared libraries without executable permission + OpenBSD: Add paths for Java 1.6.0/1.7.0 JRE/JDK + OpenBSD: Add path for Freetype under X.org + OpenBSD: Add paths for Tcl/Tk 8.4/8.5 + OpenBSD: Add path for Lua 5.1 + OpenBSD: Add paths for Qt3/Qt4 + +Andreas Mohr (4): + Documentation: Correct typos and grammar + Documentation: Clarify some command descriptions + Correct string literal typo (have "(NULL)" like all other cases). + Remove seemingly bogus duplicate CPACK_PACKAGE_FILE_NAME call. + +Anton Helwart (1): + VS: Avoid empty source groups in some cases (#3474) + +Benjamin Eikel (2): + Swap linking order of SDLmain and SDL (#0013769) + FindSDL_...: Restore dropped search paths (#13819) + +Brad King (109): + find_library: Refactor internal name iteration + find_library: Simplify framework search logic + find_library: Generalize helper macro in test case + find_library: Optionally consider all names in each directory + FindBoost: Remove extra indentation level + FindBoost: Mark Boost_DIR cache entry as advanced + FindBoost: Use PATH_SUFFIXES to look in "Program Files" + FindBoost: Overhaul caching and search repeat behavior + FindBoost: Construct a clean Boost_LIBRARIES value + FindBoost: Refactor Boost_FOUND computation and version check + FindBoost: Rewrite documentation + BSD: Do not require dlfcn.h to build shared libs (#13573) + Xcode: Fix ReRunCMake.make path to cmake.check_cache (#13603) + VS10: Refactor link options collection + VS10: Honor /DELAYSIGN and /KEYFILE flags (#13601) + Document external language support policy + CTest: Allow SUBMIT_INDEX with CDash + KWSys: Submit dashboard builds to PublicDashboard + pre-commit: Update KWSys rejection message for new workflow + CTestCustom: Suppress LNK4089 warning about PSAPI + load_command: Deprecate and document pending removal + Documentation: Clarify configure_file behavior + OS X: Warn about known SDK breakage by Xcode 3.2.6 + Optionally skip link dependencies on shared library files + Teach BuildDepends test to cover LINK_DEPENDS_NO_SHARED + Serialize tests for EXCLUDE_FROM_DEFAULT_BUILD + MSVC: Drop default use of /Zm1000 for VS >= 7.1 + Teach find_(path|file) about Linux multiarch (#13742) + Test find_path multiarch support (#13742) + Add policy CMP0019 to skip include/link variable re-expansion + Xcode: Add frameworks search paths from link dependeny closure (#13397) + Makefile: Use modern link information for framework search paths + Documentation: Clarify handling of implicit link directories + Remove references to KWSys Process Win9x support + add_library: Document object library portability suggestion + OS X: Link with all framework search paths, not just the last + OS X: Detect implicit link directories on modern toolchains + OS X: Detect implicit linker framework search paths + Revert "load_command: Deprecate and document pending removal" + VS11: Simplify external object file handling (#13831) + KWIML: Teach ABI about 'long long' on older GNU + CMake: Skip empty link.txt lines (#13845) + ExternalProject: Allow DEPENDS on normal targets (#13849) + VS11: Fix VSExternalInclude test + target_link_libraries: Document that new sigs privatize old (#13876) + Tests: Avoid CTestLimitDashJ crash on Borland 5.8 builds + Fix use of cmTypeMacro in new command classes + Fix cmSystemTools::RenameFile race on Windows + VS 6: Create .rule file directory before file + Add ExternalData module + ExternalData: Remove compatibility with CMake < 2.8.5 + ExternalData: Do not match directory names when resolving DATA{} + ExternalData: Cleanup stray TODO and typo in comments + ExternalData: Remove unused private interface + ExternalData: Improve series matching using an explicit syntax + ExternalData: Add tests covering interfaces and errors + ExternalData: Allow ()-groups in series match regex + ExternalData: Allow DATA{} syntax to reference directories + ExternalData: Generalize hash algo/ext handling + ExternalData: Add support for SHA 1 and 2 hash algorithms + ExternalData: Collapse ../ components in DATA{} paths + Fix Module.ExternalData test on Cygwin + Fix Module.ExternalData test on VS 6 + ExternalData: Attach download rules to content links in IDEs + find_package: Reword _NO_INTERFACES documentation + Normalize full paths in implicit link library list + Fail early if no current working directory exists + MSVC: Fix CMAKE_CL_64 in CXX-only projects (#13896) + ExternalProject: Simplify CMake command line generation + Tests: Run ctest custom commands with VERBATIM + CMake: Add -T option to choose a generator toolset + VS: Implement generator toolset selection (#10722, #13774) + Xcode: Implement generator toolset selection (#9831, #13802) + CTest: Add options to set generator toolset + ExternalProject: Propagate the generator toolset + Tests: Consolidate ctest --build-and-test generator options + Tests: Add generator toolset support + Fix crash on empty CMAKE__COMPILER value (#13901) + file: Do not remove symlinked directories recursively (#10538) + Embarcadero: Fix default link stack/heap flags (#13912) + Avoid duplicate RPATH entries + AIX-GNU: Put implicit link directories in runtime libpath (#13909) + VS: Replace generation timestamp file atomically + VS,Xcode: Remove unused CMAKE_GENERATOR_* variables + Delete entire CMakeFiles directory when deleting CMakeCache.txt (#13756) + Tests/RunCMake: Allow tests to control build tree behavior + Test Unix Makefiles generator support for changing compilers + Xcode: Drop check for circular target dependencies + Xcode: Each target dependency edge needs a unique object (#13935) + Tests: Replace exec_program with execute_process + Tests: Generalize decision for 'make' tool supporting spaces + ExternalData: Test content link with a space in its name + FPHSA: Convert FOUND_VAR failure test to RunCMake + VS: Restore CMAKE_GENERATOR_FC variable + Xcode: Generate recommended artwork setting (#13954) + CTest: Fix ctest_update with 'HEAD' file in source tree + VS 10: Fix CMAKE__STACK_SIZE implementation (#13968) + install(EXPORT): Force absolute paths for usr-move + AIX: Do not use -brtl to create shared libraries (#13997) + add_subdirectory: Compute output dir with consistent slashes (#10072) + ExternalData: Preserve escaped semicolons during argument expansion + Avoid crash when checking property link dependencies without link info + Avoid crash when checking property compatibility without link info + Refactor RunCMake.build_command test to allow more cases + build_command: Fail early without CMAKE_MAKE_PROGRAM (#14005) + CTest: Fail early without PROJECT_BINARY_DIR (#14005) + FindQt4: Fix QT_QMAKE{_QMAKE => }_EXECUTABLE typo + XL: Use -qpic for position independent code (#14010) + Configure Tests/CMakeTests only with BUILD_TESTING ON + +Casey Goodlett (1): + CTest: Prevent creation of unbounded number of tests in ctest (#12904) + +Clemens Heppner (1): + CMake: source_group needs to check its own regex after its children (#13611) + +Clinton Stimpson (5): + Fix for possible Rez errors when creating dmg. + PackageMaker: Enable postflight script in component mode (#12375) + CPack: Fix RPM/Deb package names to not include "ALL_COMPONENTS_IN_ONE" + Qt4: Add SYSTEM option to include_directories. + FindQt4: set QT_VERSION_* variables sooner. + +David Cole (19): + Begin post-2.8.10 development + CPack: Add automatic detection of the Unicode makensis (#9629) + BundleUtilities: Use a more inclusive REGEX for frameworks (#13600) + VS: Avoid empty, unreferenced solution folders... (#13571) + NMake: Add a test to demonstrate EmptyDepends issue (#13392) + NMake: Fix problem with empty DEPENDS args (#13392) + CMake: Remove "/STACK:10000000" from default linker flags (#12437) + Watcom: Avoid prompt from wmake about dll with no exports... + Tests: Use the right path to CPack value for running CPack tests + VS11: Allow using folders with the VS11 Express Edition (#13770) + CPack: Fix dashboard errors (#11575) + CPack: Fix dashboard warnings (#11575) + CPack: Fix dashboard errors and warnings (#11575) + CMake: Stylistic changes and documentation tweaks + CMake: Fix dashboard warnings + CMake: Fix dashboard test failure + CMake: Fix dashboard build errors and warnings + CTest: Coverage handler: expect certain output lines from gcov 4.7 (#13657) + Add CTestLimitDashJ test (#12904) + +David Golub (2): + CPack/NSIS: Fix compatibility issues with prerelease NSIS (#13202) + CPack/NSIS: Add support for 64-bit NSIS (#13203) + +Eric LaFranchi (1): + CPack: WIX Product Icon, UI Banner, UI Dialog support (#13789) + +Eric NOULARD (1): + CPackRPM fix #13898 uses IF(DEFINED var) to avoid wrong var value logic + +Gerald Hofmann (1): + CPack: Fix NSIS version check without release version (#9721) + +James Bigler (4): + Use PRE_LINK instead of PRE_BUILD when testing PRE_LINK. + FindCUDA: Remove linkage against CUDA driver library (#13084) + FindCUDA: Add support for separable compilation + FindCUDA: Added cupti library. + +Janne Rönkkö (1): + FindQt4: Do not use qmake from Qt5 + +Jean-Christophe Fillion-Robin (1): + Add $ generator expression. + +Marcus D. Hanwell (1): + Removed GenerateExportHeader warnings about old compilers + +Mark Salisbury (2): + VS: Specify WinCE subsystem also for DLLs + VS: Specify WinCE subsystems correctly in VS 9 2008 + +Mathias Gaunard (2): + enable CTEST_USE_LAUNCHERS with Ninja too + Ninja: fix usage of cldeps with ctest launchers + +Matt McCormick (7): + ExternalProject: Only run 'git fetch' when required. + ExternalProject: Do smoke tests for Git Tutorial builds. + ExternalProject: Add tests for UPDATE_COMMAND. + ExternalProject: Always do a git fetch for a remote ref. + ExternalProject: Make sure the ExternalProjectUpdate setup is available. + ExternalProject: Verify when a fetch occurs during update test. + ExternalProjectUpdateTest: Only support Git 1.6.5 and greater. + +Matthew Woehlke (1): + ccmake: Allow DEL key in first column + +Michael Tänzer (4): + GetPrerequisites: Move tool search paths up + GetPrerequisites: Add support for objdump + GetPrerequisites: Enable test for BundleUtilities on MinGW + GetPrerequisites: Add documentation for objdump + +Michael Wild (1): + cmDepends: No dependency-vector erasure in CheckDependencies + +Morné Chamberlain (15): + Added a generator for Sublime Text 2 project files. + Added some support for sublimeclang_options in the generated project file. + Changed SublimeClang include path generation to expand to absolute paths. + Cleaned up the Sublime Text 2 Generator code a bit. + Fixed support for the Ninja build system. + Added and cleaned up some comments. + The generator no longer generates an explicit list of source files. + The generator no longer generates absolute paths to the ninja.build/Makefiles. + Added a CMAKE_SUBLIMECLANG_DISABLED variable that disables SublimeClang. + Fixed Sublime Text project generation for in-source builds + Define flags in CMAKE_C(XX)_FLAGS are now included in SublimeClang settings. + SublimeText2 Gen: Improved use of define, include flags from CMAKE_C(XX)_FLAGS + SublimeText2 Gen: Fixed the issue where include directory flags used -D + Sublime Text 2 Gen: Per-source Compile flags are now saved in a separate file. + SublimeText 2 Gen: Set the sublimeclang_options_script property. + +Neil Carlson (1): + NAG: Use -PIC for Fortran position-independent code (#13932) + +Nils Gladitz (2): + CPack: Add a WiX Generator (#11575) + CMake: Add TIMESTAMP subcommand to string and file commands + +Patrick Gansterer (28): + Introduce the abstract class cmGlobalGeneratorFactory + Add cmGlobalGeneratorFactory::GetGenerators() + Search generator in cmake::ExtraGenerators before in cmake::Generators + Allow a GeneratorFactory handling of more than one generator + Make cmGlobalGenerator::GetDocumentation() a static function + VS: Remove AddPlatformDefinitions from platform-specific generators + VS: Fix ArchitectureId of Visual Studio 10 IA64 generator + VS: Remove GetPlatformName from platform-specific generators + VS: Remove EnableLanguage from platform-specific generators + VS: Remove platform specific generator files + FindBISON: Add support for the Win flex-bison distribution + FindFLEX: Add support for the Win flex-bison distribution + VS: Remove TargetMachine for linker when checking compiler id + VS: Add CMAKE_VS_PLATFORM_NAME definition to cmMakefile + VS: Add static method to get the base of the registry + VS: Change variable type of ArchitectureId from const char* to string + VS: Change variable type of Name from const char* to string + VS: Support setting correct subsystem and entry point for WinCE + VS: Add parser for WCE.VCPlatform.config to read WinCE platforms + VS: Allow setting the name of the target platform + VS: Make DetermineCompilerId working with WinCE too + VS: Added "Deploy" at project configuration for WindowsCE targets + Add command to generate environment for a Windows CE SDK + VS: Set the correct SubSystem when determinating the CompilerId + VS: Add the entry point when compiling for WindowsCE + VS: Ignore LIBC.lib when linking the CompilerId executables + Set WINCE to 1 when building for WindowsCE + Ninja: Avoid LNK1170 linker error + +Peter Kümmel (6): + Ninja: encode LINK_FLAGS to handle bash variables + Ninja: fix building from Codeblocks GUI + Ninja: remove implicit dependency on custom command outputs + Ninja: use MinGW generator code in EnableLanguage() + Ninja: the Ninja generator does not support Fortran yet. + Ninja: escape line breaks in literals + +Petr Kmoch (11): + Add tests for list() argument count + Add tests for list() invalid arguments + Consolidate list() argument count testing + Add several get_property() tests + Add tests for EXCLUDE_FROM_DEFAULT_BUILD + Add property EXCLUDE_FROM_DEFAULT_BUILD_ + Define property EXCLUDE_FROM_DEFAULT_BUILD + Add tests for VS_SOLUTION_GLOBAL_SECTIONS + Implement properties VS_GLOBAL_SECTION_* + Define properties VS_GLOBAL_SECTION_* + Documentation: Clarify a few subtleties + +Riku Voipio (1): + KWIML: Teach ABI.h about Aarch64 + +Robert Maynard (4): + XCode generator won't infinitely parse compiler flags (bug #13354). + Correct missing parameter to CMP0018Flags call. + Remove ability to generate sublime clang files. + Update generator to use new cmGeneratorTarget api. + +Rodolfo Schulz de Lima (1): + FindGTK2: Fix GTK2_LIBRARIES order for static gtk libraries + +Rolf Eike Beer (21): + FindQt: improve version selection + FindQt: add some more places to look for Qt3 + Tests: add MajorVersionSelection tests + Linux/PA-RISC: Link with --unique=.text.* to help binutils + FindQt: add to MajorVersionSelection test + CMakeTests: allow to call the check_cmake_test macro with a given file + list: add tests for CMP0007 behavior + GetProperty test: move doc property tests into main process + Find* (and some other): use ${CMAKE_CURRENT_LIST_DIR} in include() + bootstrap: use better defaults for Haiku + Haiku no longer defines __BEOS__ + check for Haiku only with __HAIKU__ + FindLua51: do not try to link libm on BeOS + FindGLUT: BeOS does not have libXi and libXmu + FindOpenGL: add Haiku paths + doc: fix linebreaks in generator expression documentation + ProcessorCount test: fix path to cmsysTestsCxx executable + ProcessorCount test: require SystemInformation process to work + FindOpenMP: improve documentation (#13895) + properly detect processor architecture on Windows + fix Windows processor detection + +Sean McBride (1): + libarchive: fixed undefined left shift with signed ints + +Slava Sysoltsev (1): + FindImageMagick: Search quantum depth suffixes (#13859) + +Stephen Kelly (158): + GenEx: Test early determination of AND and OR + Enable some compiler warnings when building CMake. + Resolve warnings about unused variables. + Resolve warnings about used enum values in switch blocks. + Resolve warnings about shadowing parameters and local variables. + Resolve ambiguity warning regarding use of && and ||. + Remove references to ancient and removed parts of the code. + Always use the auto_ptr from cmsys. + Port cmGeneratorExpression to cmTarget from cmGeneratorTarget. + Split link information processing into two steps. + Revert "Move GetLinkInformation to cmGeneratorTarget" + Genex: Extract a method to parse parameters. + Genex: Ensure that $<0:...> has a parameter. + Genex: Don't segfault on $ + Generate an early-return guard in target Export files. + Fix some warnings from -Wundef + Make targets depend on the link interface of their dependees. + Use cmsys::auto_ptr to manage cmCompiledGeneratorExpressions + Keep track of INCLUDE_DIRECTORIES as a vector of structs. + Add a way to print the origins of used include directories. + Tests: Fix warning about unused variable + Qt4: Add module dependencies to the IMPORTED targets + Don't crash when a target is expected but is not available. + Add test for custom command with a genex referring to a target. + GenEx: Add expressions to specify build- or install-only values + Allow generator expressions to require literals. + Add the TARGET_NAME generator expression. + Add API to extract target names from a genex string. + Add API to populate INTERFACE properties in exported targets. + Make all relevant targets available in the genex context. + Use mapped config properties to evaluate $ + Make cycles in target properties ignored, not an error. + Populate the ExportedTargets member early in GenerateMainFile + Handle INTERFACE properties transitively for includes and defines. + Add CMAKE_BUILD_INTERFACE_INCLUDES build-variable. + Make linking APIs aware of 'head' target + Add LINK_LIBRARIES property for direct target link dependencies + Allow target_link_libraries with IMPORTED targets. + Add the -Wundef flag when compiling CMake. + FindQt4: Add INTERFACE includes and defines to Qt4 targets + Add the target_include_directories command. + Add the target_compile_definitions command. + Keep track of properties used to determine linker libraries. + Add API to calculate link-interface-dependent bool properties or error. + Process the INTERFACE_PIC property from linked dependencies + Fix linking to imported libraries test. + Add cmGeneratorExpression::Split() API. + Don't pass a position when determining if a target name is a literal. + Extract the AddTargetNamespace method. + Split the generator expression before extracting targets. + Split LINK_INTERFACE_LIBRARIES export handling into dedicated method. + Allow generator expressions in LINK_INTERFACE_LIBRARIES. + Add a way to check INTERFACE user property compatibility. + Don't include generator expressions in old-style link handling. + Document the use of generator expressions in new commands. + Add the TARGET_DEFINED generator expression + Strip consecutive semicolons when preprocessing genex strings. + Don't write a comment in the export file without the code. + Only generate one check per missing target. + Move the exported check for dependencies of targets + Move the exported check for file existence. + Add a test for the interfaces in targets exported from the build tree. + Make the BUILD_INTERFACE of export()ed targets work. + Export the INTERFACE_PIC property. + Test evaluation target via export for generator expressions + Make sure generator expressions can be used with target_include_directories. + Populate the link information cache before checking dependent properties. + Exit early if we find an inconsistent property. + Make INTERFACE determined properties readable in generator expressions. + Clear the link information in ClearLinkMaps. + Export the COMPATIBLE_INTERFACE_BOOL content properties + Add the $ expression + Automatically link to the qtmain library when linking to QtCore. + Don't wrap all targets in LINK_LIBRARIES in a TARGET_NAME genex. + Generate new-style cmake code during export. + Store includes from the same include_directories call together. + Only output includes once after the start of 'generate-time' when debugging. + Specify the target whose includes are being listed. + Output include directories as LOG messages, not warnings. + Revert "Allow target_link_libraries with IMPORTED targets." + Disallow porcelain to populate includes and defines of IMPORTED targets. + Exclude the LINK_LIBRARIES related properties from INTERFACE evaluation. + Make calculation of link-interface-dependent properties type-sensitive. + Add the COMPATIBLE_INTERFACE_STRING property. + Move GetCompileDefinitions to cmTarget. + Process COMPILE_DEFINITIONS as generator expressions in QtAutomoc. + Generate the _IMPORT_PREFIX in the non-config export file. + Add the INSTALL_PREFIX genex. + Fix TARGET_PROPERTY target extractions. + Make the Property name protected so that subclasses can use it. + Don't allow targets args in the new target commands. + Make subclasses responsible for joining content. + Use the result of converting to a unix path. + Handle reading empty properties defined by the link interface. + Advance more when preprocessing exported strings. + Make it an error for INSTALL_PREFIX to be evaluated. + Export targets to a targets file, not a Config file. + Add a way to exclude INTERFACE properties from exported targets. + Add API to check if we're reading a includes or defines property. + Add the $ generator expression. + Add includes and compile definitions with target_link_libraries. + Test workaround of bad interface include directories from depends. + Optimize genex evaluation for includes and defines. + Cache context-independent includes on evaluation. + Style: Use this-> when invoking member functions. + Process generator expressions for 'system' include directories. + Deduplicate the isGeneratorExpression method. + De-duplicate validation of genex target names. + Test printing origin of include dirs from tll(). + The COMPATIBLE_INTERFACE does not affect the target it is set on. + Ensure type specific compatible interface properties do not intersect. + Fix generation of COMPILE_DEFINITIONS in DependInfo.cmake. + Fix determination of evaluating link libraries. + Only use early evaluation termination for transitive properties. + Move a special case for PIC from the genex to the cmTarget code. + Don't keep track of content determined by target property values. + Only append build interface include dirs to particular targets. + Ensure that the build interface includes have been added. + Whitelist target types in target_{include_directories,compile_definitions} + Make sure INTERFACE properties work with OBJECT libraries. + Don't allow utility or global targets in the LINKED expression. + Generate config-specific interface link libraries propeties. + Fix determination of when we're evaluating compile definitions. + Rename the IncludeDirectoriesEntry to be more generic. + Don't use LINKED where not needed. + Use the link information as a source of compile definitions and includes. + Revert "Don't allow utility or global targets in the LINKED expression." + Don't populate INTERFACE includes and defines properties in tll. + Revert "Add the $ generator expression." + Revert "find_package: Reword _NO_INTERFACES documentation" + Revert "Add a way to exclude INTERFACE properties from exported targets." + Don't add target-specific interface includes and defines to Qt 4 targets. + Fix GenerateExportHeader documentation #13936 + automoc: Add source file to target early to set the linker language + Keep track of all targets seen while evaluating a genex. + Add a new Export generator for IMPORTED targets. + Handle targets in the LINK_LIBRARIES of try_compile. + Strip stray semicolons when evaluating generator expressions. + Workaround broken code where a target has itself in its link iface. + Fix DAG checker finding cycling dependencies. + Expand includes and defines transitively in 'external' genexes. + Fix constness of accessors. + Fix the tests for evaluating includes and defines. + Memoize includes and defines from interface libraries. + Remove use of TARGET_DEFINED from target_include_directories test. + Remove use of TARGET_DEFINED from the ExportImport test. + Remove use of TARGET_DEFINED from the target_link_libraries test. + Revert "Add the TARGET_DEFINED generator expression" + Only add existing targets to the Qt4 target depends properties. + Fix the cmGeneratorExpression::Split when leading chars are present. + Fix RPATH information when only a genex is used as a link library. + Mention that IMPORTED targets may be created by a find_package call. + Remove unused parameters from target_link_libraries tests. + Only process transitive interface properties for valid target names. + Restore support for target names with '+' (#13986) + Automoc: Don't create automoc targets if Qt is not used (#13999) + cmake-gui: Use -fPIE if required by Qt. + cmake-gui: Workaround bug in Qt 5.0.0 to 5.0.3 QStandardItemModel + +Thomas Klausner (1): + KWIML: Teach ABI.h that VAX is big endian + +Yury G. Kudryashov (3): + Automoc: Fix automoc for OBJECT libraries. + Automoc: add OBJECT library to QtAutomoc test + spell: fix a few typos in comments + +Changes in CMake 2.8.10.2 (since 2.8.10.1) +---------------------------------------------- +Alex Neundorf (1): + Automoc: fix regression #13667, broken build in phonon + +Brad King (1): + Initialize IMPORTED GLOBAL targets on reconfigure (#13702) + +David Cole (1): + CMake: Fix infinite loop untarring corrupt tar file + +Rolf Eike Beer (1): + FindGettext: fix overwriting result with empty variable (#13691) + +Changes in CMake 2.8.10.1 (since 2.8.10) +---------------------------------------------- +Brad King (5): + Fix default PDB output directory (#13644) + Fix PathScale compiler id for Clang-based upstream + Update programmatically-reported copyright year (#13638) + FindSDL: Restore accidentally dropped search paths (#13651) + OS X: Fix default CMAKE_OSX_SYSROOT with deployment target + +Rolf Eike Beer (2): + FindOpenSSL: fix library selection on Windows (#13645) + FindOpenSSL: also find the non-MD debug libraries for MSVC + +Stephen Kelly (1): + GenEx: Use case insensitive comparison for $ + +Changes in CMake 2.8.10 (since 2.8.10-rc3) +---------------------------------------------- +None + +Changes in CMake 2.8.10-rc3 (since 2.8.10-rc2) +---------------------------------------------- +Rolf Eike Beer (2): + SelectLibraryConfigurations: add testcase + SelectLibraryConfigurations: fix for release and debug libs being the same + +Stephen Kelly (5): + BasicConfigVersion: Make docs refer to the macro, not the module name + Document LOCATION undefined behavior with use of LINKER_LANGUAGE. + GenEx: Add an accessor for imported targets in a makefile. + GenEx: Create cmGeneratorTargets for imported targets. + GexEx: Validate Target names and property names differently. + +Thomas Arcila (1): + SelectLibraryConfigurations: Fix foreach(x IN LISTS ...) syntax + +Changes in CMake 2.8.10-rc2 (since 2.8.10-rc1) +---------------------------------------------- +Alex Neundorf (2): + Document CMAKE_FIND_PACKAGE_NAME + Automoc: fix #13572: issue with symbolic links + +Brad King (4): + cmCTestSVN: Fix compilation with Sun CC 5.1 + if: Document that plain 'NOTFOUND' is a false constant + string: Clarify regex documentation of '-' behavior + FortranCInterface: Pass all flags to VERIFY project (#13579) + +David Cole (1): + NSIS: Fix incorrect uninstall registry key name (#13578) + +Eric NOULARD (3): + CPACK_XX_ON_ABSOLUTE_INSTALL_DESTINATION is now properly checked for ON/OFF + Document CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY and fix some typo. + Make CPACK_SET_DESTDIR work with archive generator + component-based packaging + +Jean-Christophe Fillion-Robin (1): + CTest: Ensure CTEST_USE_LAUNCHERS behaves nicely in Superbuild setup + +Pere Nubiola i Radigales (1): + Find PostgreSQL headers on Debian + +Peter Kümmel (4): + Ninja: also set OBJECT_DIR when compiling + Ninja: don't pollute current dir when using gui (#13495) + Ninja: implicit dependency for custom command files + Fix regression: write compile definitions if any + +Philip Lowman (4): + FindGTK2: Rollback lib64 changes which broke header file finding + FindGTK2: #12049 fix detection of header files on multiarch systems + FindGTK2: #12596 Missing paths for FindGTK2 on NetBSD + FindGTK2: Update local changelog + +Rolf Eike Beer (6): + CTest: fix usage of memory checker with spaces in path + CTest: fix pre and post test commands with spaces + CTest: add tests that simulate memcheck runs + CTest: improve memory checker type detection + CTest: add a test for CTEST_CUSTOM_MEMCHECK_IGNORE + CTest: add a check with a quoted memory checker + +Stephen Kelly (18): + GenEx: It is not an error to specify an empty parameter + GenEx: Return after error reported. + GenEx: Report actual target name not found, not "0" each time. + GenEx: Parse comma after colon tokens specially + GenEx: Validate target and property names. + GenEx: Ensure that the empty CONFIGURATION can be used conditionally. + GenEx: Add test for $ with empty parameter. + GenEx: Add tests for "0" and "1" expressions with literal commas. + GenEx: Don't use std::vector::at(int). + Attempt to fix the compile of cmake on Sun CC. + GenEx: Parse colon after arguments separator colon specially. + GenEx: Test the use of generator expressions to generate lists. + GenEx: Fix termination bugs in generator expression parser. + GenEx: Break if there are no more commas in the container + GenEx: Add some more asserts to verify code-sanity. + GenEx: Replace some failing tests with Borland and NMake makefiles. + GenEx: Fix reporting about not-found include directories and libraries. + Fix config-specific INCLUDE_DIRECTORIES in multi-config generators + +Changes in CMake 2.8.10-rc1 (since 2.8.9) +----------------------------------------- +Scripted Changes (3): + Remove trailing whitespace from most CMake and C/C++ code + Convert CMake-language commands to lower case + Remove CMake-language block-end command arguments + +Alex Neundorf (27): + Eclipse: add support for the 4.2 Juno release (#13367) + Eclipse: improve (fix ?) version detection on OSX + Eclipse: fix #13358: don't create bad linked resources + Eclipse: fix #13358: don't create bad linked resources + remove non-working KDE4 test + Eclipse on OSX: fix handling of framework include dirs (#13464) + Eclipse on OSX: improve handling of framework include dirs (#13367) + -fix line length + fix #13474: also rescan dependencies if the depender does not exist + -fix line length + -fix Java dependency scanning, broken in previous commit + error out if CTEST_USE_LAUNCHERS is TRUE but RULE_LAUNCH_* are not set + fix #13494: rerun automoc also if include dirs or moc options change + CMakeDetermineFortranCompiler: add support for cross-compiling (#13379) + Automoc: fix #13493, use target properties for include dirs + Automoc: do not use DEFINITIONS, but only COMPILE_DEFINITIONS + Automoc: also the makefile-COMPILE_DEFINITIONS + cmGlobalGenerator.h: some minor coding style fixes + Modules/readme.txt: fix typo + find_package: add support for a _NOT_FOUND_MESSAGE variable + exports: store pointers to all installations of each export set + exports: accept a missing target if it is exported exactly once + exports: first try at error handling if a target is missing + exports: fix build with MSVC6 + exports: move the handling of missing targets into subclasses + exports: define a CMAKE_FIND_PACKAGE_NAME var set by find_package() + exports: add a test for exporting dependent targets + +Andreas Mohr (1): + FindCURL: Find older MSVC prebuilts + +Andy Piper (1): + Do not include directories which are part of the package install prefix. + +Benjamin Eikel (21): + Initial version of find module + FindSDL: Add version support for FindSDL_net + FindSDL: Version support for FindSDL_image + FindSDL: Use prefix SDL_NET, because it matches the file name. + FindSDL: Use SDL_IMAGE prefix for varibales + FindSDL: Add "cmake_minimum_required" to "try_compile" project + FindSDL: Format the documentation + FindSDL: Version support for FindSDL_sound + FindSDL: Use same capitalization for FPHSA as file name + FindSDL: Pass SDL_SOUND_LIBRARY to FIND_PACKAGE_HANDLE_STANDARD_ARGS + FindSDL: Use SDL_MIXER prefix for variables + FindSDL: Add version support for FindSDL_mixer + FindSDL: Update documentation + FindSDL: Use SDL_TTF prefix for variables + FindSDL: Add version support for FindSDL_ttf + FindSDL: Update documentation + FindSDL: Format documentation + FindSDL: Add version support + FindSDL: Add my copyright tag to all FindSDL_* modules + FindSDL: Remove from find_... calls PATHS that are set by default + FindSDL: Stay compatible with old input variables + +Bill Hoffman (8): + Use OUTPUT_NORMAL instead of OUTPUT_MERGE for cmake -E chdir. + curl: Use find_package(OpenSSL) + curl: Make OpenSSL DLLs available to CMake on Windows + file(DOWNLOAD): Generalize EXPECTED_MD5 to EXPECTED_HASH + file(DOWNLOAD): Add options for SSL + Utilities/Release: Enable CMAKE_USE_OPENSSL in nightly binaries + Add SSL_VERIFYPEER and CAINFO file options to ExternalProject_Add. + Revert "Ninja: don't expand any rsp files" + +Brad King (83): + find_library: Add test covering lib->lib64 cases + find_library: Refactor lib->lib64 conversion + find_library: Simplify lib->lib expansion + find_library: Fix mixed lib->lib64 (non-)conversion cases (#13419) + CMakeDetermine(C|CXX)Compiler: Consider Clang compilers + Factor common code out of CMakeDetermine(ASM|C|CXX|Fortran)Compiler + Prefer generic system compilers by default for C, C++, and Fortran + Xcode: Fix object library references in multi-project trees (#13452) + Xcode: Run xcode-select to find Xcode version file (#13463) + Watcom: Simplify compiler version detection (#11866) + Remove trailing TAB from NSIS.template.in + Fix WarnUnusedUnusedViaUnset test pass/fail regex + CMakeVersion.bash: Update sed expression for lower-case 'set' + GetPrerequisites: Mark file_cmd as advanced cache entry + Add boolean generator expressions + Add $ boolean query generator expression + Recognize Clang ASM support (#13473) + Xcode: Set ASM source language in project file (#13472) + Tests/Assembler: Do not use assembler in universal binaries + Add FindHg module to find Mercurial + ExternalProject: Add Mercurial (hg) repository support + Qt4Macros: Fix recently broken resource file parsing + Tests/ObjectLibrary: Do not enable CXX in subdirectories + VS11: Rename 'Immersive' to 'WindowsAppContainer' (#12930) + VS: Disable precompiled headers unless enabled by project (#12930) + VS11: Generate flag tables from MSBuild V110 tool files + Detect Compaq compiler version with its id + Detect PathScale compiler version with its id + Detect TI compiler version with its id + Detect Comeau compiler version with its id + Detect SDCC compiler version with its id + Detect Cray compiler version with its id + Detect Analog VisualDSP++ compiler version with its id + Re-order C/C++/Fortran compiler determination logic + CMakeDetermineCompilerId: Prepare to detect IDE compiler id + Xcode: Detect the compiler id and tool location + VS10: Define CMAKE_VS_PLATFORM_TOOLSET variable + VS: Detect the compiler id and tool location + Cleanly enable a language in multiple subdirectories + Test variables CMAKE_(C|CXX|Fortran)_COMPILER(|_ID|_VERSION) + Document CMAKE__COMPILER_(ID|VERSION) values + Make platform information files specific to the CMake version + Move CMAKE__COMPILER_WORKS to compiler information files + Store ABI detection results in compiler information files + VS: Remove support for "free" version 2003 tools + VS: Simplify MSVC version reporting + Modernize MSVC compiler information files + VS: Fix MSVC_IDE definition recently broken by refactoring + add_library: Document POSITION_INDEPENDENT_CODE default (#13479) + magrathea: Tell cmELF about DT_RUNPATH (#13497) + Utilities/Release: Link AIX binary with large maxdata + Utilities/xml: Add .gitattributes to disable whitespace checks + Utilities/xml: Add docbook-4.5 DTD (#13508) + docbook: Fix formatter naming convention to avoid shadow + docbook: Fix Sun CC warning on ptr_fun(isalnum) + curl: Honor OPENSSL_NO_SSL2 + if: Compare up to 8 components in VERSION tests + ExternalProject: Generalize URL_MD5 option to URL_HASH + Rename SSL terminology to TLS + file(DOWNLOAD): Make TLS options behave as documented + OS X: Add platform-specific Clang compiler info files (#13536) + VS11: Detect VS 2012 Express for default generator (#13348) + VS11: Add VS 2012 Express support (#13348) + file(DOWNLOAD): Add HTTP User-Agent string + ExternalProject: Add DOWNLOAD_NAME option + file(DOWNLOAD): Change EXPECTED_HASH to take ALGO=value + VS8: Remove '.NET' from generator description (#10158) + Clang: Split Compiler/Clang* modules out from GNU (#13550) + Clang: All versions know about -fPIE (#13550) + Xcode: Remove unused code reading CMAKE_OSX_SYSROOT_DEFAULT + OS X: Always generate -isysroot if any SDK is in use + OS X: Improve default CMAKE_OSX_SYSROOT selection + bootstrap: Suppress CMAKE_OSX_SYSROOT if CFLAGS have -isysroot + Tests/Assembler: Use CMAKE_OSX_SYSROOT to generate .s file + OS X: Allow CMAKE_OSX_SYSROOT to be a logical SDK name + OS X: Simplify selection of CMAKE_OSX_ARCHITECTURES + OS X: If CMAKE_OSX_SYSROOT is already set do not compute default + OS X: Further improve default CMAKE_OSX_SYSROOT selection + OS X: Teach deployment target sanity check about SDK names + OS X: Ignore MACOSX_DEPLOYMENT_TARGET during Xcode compiler id + Verify that PDB_(NAME|OUTPUT_DIRECTORY) are honored in test + Document that PDB_(NAME|OUTPUT_DIRECTORY) are ignored for VS 6 + Run PDBDirectoryAndName test on MSVC and Intel + +Clinton Stimpson (8): + fphsa: clarify message about minimum required version found. + DeployQt4: Include DESTDIR for some cpack generators. + Add -DNDEBUG to RelWithDebInfo flags where where Release flags had it. + Fix regex for qt minor version. + FindQt4: Give precedence to QTDIR environment variable, if set. + FindQt4: Give precedence to QTDIR environment variable, if set. + Fix errors detecting Qt4 on Windows 8. + cmake-gui: Fix error status when interrupted. + +Daniel Pfeifer (8): + Simplify CMake.HTML documentation test command line + docbook: Remove table of contents + docbook: Factor out code to write valid DocBook IDs + docbook: Fix the DocBook section output + docbook: Cleanup formatter and generated DocBook + docbook: Add support for at section level 1 + docbook: Add CMake.DocBook test to validate xml (#13508) + docbook: Remove redundant docs that cause invalid DocBook + +David Cole (9): + Begin post-2.8.9 development + Release: Temporarily exclude ExternalProject test on cygwin + Add ability to run as a ctest -S script also + CMake: Clarify the documentation for if(f1 IS_NEWER_THAN f2) + Convert the CPACK_CYGWIN_PATCH_NUMBER variable to a cache variable + InstallRequiredSystemLibraries: Use correct file names (#13315) + ProcessorCount: Mark find_program vars as advanced (#13236) + FindQt4: Avoid "finding" non-existent library in a .framework + FindMPI: Set correct variables for calls to FPHSA + +Eric NOULARD (2): + Enhance DESTDIR documentation. Fixes #0012374. + Handles %attr(nnn,-,-) /path/to/file in CPACK_RPM_USER_FILELIST properly. + +James Bigler (3): + Replace -g3 with -g for CUDA 4.1 and 4.2 in addition to CUDA < 3.0. + Added CUDA_SOURCE_PROPERTY_FORMAT. Allows setting per file format (OBJ or PTX) + FindCUDA: Added CUDA_HOST_COMPILER variable. + +Marcin Wojdyr (1): + Remove CMake multiline block-end command arguments + +Nils Gladitz (1): + ctest_update: Tell svn not to prompt interactively (#13024) + +Patrick Gansterer (4): + VS: Cleanup AddPlatformDefinitions() of Visual Studio generators + Add additional architectures to CMakePlatformId.h.in + Add WindowsCE platform information files + VS: Remove duplicated implementations of CreateLocalGenerator() + +Peter Kuemmel (1): + Ninja: don't expand any rsp files + +Peter Kümmel (15): + Ninja: cmcldeps needs a compiler + Ninja: don't crash on returned 0 pointer + Ninja: prepare msvc pdb cleanup + Ninja:split out setting of msvc TARGET_PDB + Ninja: remove GetTargetPDB because it is used only once + Ninja: also detect /showInclude prefix for icl + Find mingw's windres also when Unix Makefiles are used + Ninja: don't suppress warning about compiler options + Ninja: suppress cmcldeps only for source file signature try_compiles + Ninja: filter target specific compile flags with language specific regex + Ninja: OBJECT_DEPENDS should set an implicit dependency + Ninja: don't confuse ninja's rsp files with nmake's + Ninja: move -LIBPATH behind -link option + Ninja: move in front of the first linker option + Ninja: add option to enforce usage of response files + +Philip Lowman (3): + FindOpenSceneGraph: CMake variable OSG_DIR influences detection now too + FindGTK2: Add GTK2_CAIROMMCONFIG_INCLUDE_DIR for cairommconfig.h + CMakeDetermineVSServicePack: Visual Studio 2012 added + +Rolf Eike Beer (25): + remove lib64 Unix paths if the respective lib path is also given + FindOpenSSL: find cross-compiled OpenSSL from MinGW (#13431) + FindOpenSSL: use SelectLibraryConfigurations + FindOpenSSL: let CMake handle environment variable HINTS + FindOpenSSL: cleanup path hints + FindOpenSSL: remove leftover comment + SelectLibraryConfiguration: generate correct output when input vars are lists + Fix typo direcotry -> directory (and similar) [#13444] + FindSelfPackers: fix typo (#13456) + CheckTypeSize: show in documentation how to get struct member size (#10579) + CheckTypeSize: add a test for size of struct members + FindX11: remove duplicates from X11 include path list (#13316) + FindX11: avoid calling list(REMOVE_DUPLICATES) on an empty list + list command: error on too many arguments + CMake.List test: explicitely test with lists containing only an empty string + use the find_* functions ENV parameter + use PATH_SUFFIXES to simplify find_* calls + do not escape spaces in regular expressions + read less from version headers into variables + FindFLEX: fix version extraction on Apple + FindGettext: remove code duplicating FPHSA checks + include FPHSA from current directory in all modules + FindOpenSceneGraph: simplify by using more features of FPHSA + FindSDL: add SDLMAIN_LIBRARY only once (#13262) + add documentation for all MSVCxxx version variables (#12567) + +Sergei Nikulov (1): + fix for discovering ft2build.h using FREETYPE_DIR environment var (#13502) + +Stephen Kelly (60): + Add new qt4_use_modules function. + Add missing whitespace to docs. + Fix some typos in the docs. + Remove incorrect doc string for link type enum + Remove duplicate 'of' from docs. + Fix unfortunate documentation error for PIC feature. + Don't duplicate -D defines sent to the compiler. + Fix CompileDefinitions test on Visual Studio. + Fix the test setting COMPILE_DEFINITIONS target property + Rename files from main.cpp to more meaningful names. + Fix casing of 'Qt' in docs, comments and user-visible strings. + Read entire Qt4 qrc file when parsing for depends info. + Add a return-after-error if an old Qt is found. + Use CMake platform variables instead of Qt ones. + Move variable setting down to where it relates to. + Remove an if which is always true. + Use add_subdirectory instead of the obsolete subdirs. + Replace two include_directories with a setting. + Compile with both Qt4 and Qt5. + Build with Qt5 if it is found. + cmGeneratorExpression: Re-write for multi-stage evaluation + cmGeneratorExpression: Port users to two-stage processing + Fix the regular expression validator for target names. + Handle colons as a special case in the generator expression parser. + Enable deprecated API when using Qt 5. + Add more forwarding API to cmGeneratorTarget. + Store cmGeneratorTargets with the makefile. + Move GenerateTargetManifest to cmGeneratorTarget. + Move GetLinkInformation to cmGeneratorTarget + Make cmLocalGenerator::AddArchitectureFlags take a cmGeneratorTarget. + Move GetCreateRuleVariable to cmGeneratorTarget. + Port cmLocalGenerator::GetTargetFlags to cmGeneratorTarget. + Move GetIncludeDirectories to cmGeneratorTarget. + Append the COMPILE_DEFINITIONS from the Makefile to all targets. + Add a wrapper for accessing config-specific compile-definitions. + Add convenience for getting a cmGeneratorTarget to use. + Fix compiler warning with initialization order. + Revert "Move GenerateTargetManifest to cmGeneratorTarget." + Use the cmGeneratorTarget for the include directories API. + Fix indentation in the code blocks generator. + Port remaining code to GetCompileDefinitions(). + Add include guard for cmGeneratorExpression. + Don't prepend a path before generator expressions in include_directories. + Convert paths in INCLUDE_DIRECTORIES property to Unix slashes. + Add an AppendDefines std::string overload. + Return a std::string from GetCompileDefinitions. + Refactor GetCompileDefinitions a bit. + Extend the generator expression language with more logic. + Add a generator expression for target properties. + Add API to check that dependent target properties form a DAG. + Add a self-reference check for target properties. + Early return if there is no target. + Process generator expressions in the INCLUDE_DIRECTORIES property. + Process generator expressions in the COMPILE_DEFINITIONS target property. + Fix the layout of the generator expression documentation. + Fix punctuation in some variables documentation. + Document that generator expressions can be used in target properties. + Remove unused parameter marker and the unused parameter. + Fix minor typos. + Remove period at the end of the check message. + +Tom Schutter (2): + cmake-mode.el: Use more readable regex and case-fold-search + cmake-mode.el: add local keybindings + +Xavier Besseron (7): + cmCTestSVN: Add the new SVNInfo structure + cmCTestSVN: Extend Revision struct with SVN repo information + cmCTestSVN: Add the Repositories list and the RootInfo pointer + cmCTestSVN: Create the SVNInfo for the root repository + cmCTestSVN: Use the SVNInfo structure + cmCTestSVN: Add a LoadExternal() function and an ExternalParser class + cmCTestSVN: Load and process information from externals + +Yuchen Deng (1): + Add PDB_OUTPUT_DIRECTORY and PDB_NAME target properties (#10830) + +Yury G. Kudryashov (7): + exports: Move cmTargetExport to a dedicated header file + exports: Remove cmTargetExport constructor + exports: Rename cmGlobalGenerator::AddTargetToExport{s,} + exports: Create class cmExportSet + exports: Add cmExportSetMap class + exports: Hold an ExportSet pointer in cm*Export*Generator + exports: cmGlobalGenerator::ExportSets destructor will clear it + +Zack Galbreath (2): + Clean up documentation formatting so that it is rendered properly in HTML. + cmparseMSBuildXML: Include DisplayName in the output + Changes in CMake 2.8.9 (since 2.8.9-rc3) ---------------------------------------- None diff --git a/CompileFlags.cmake b/CompileFlags.cmake index 3b455b96f..20f5decf1 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -13,52 +13,58 @@ #----------------------------------------------------------------------------- # set some special flags for different compilers # -IF(CMAKE_GENERATOR MATCHES "Visual Studio 7") - SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1) -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7") -IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") - SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1) -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") -INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake) +if(CMAKE_GENERATOR MATCHES "Visual Studio 7") + set(CMAKE_SKIP_COMPATIBILITY_TESTS 1) +endif() +if(CMAKE_GENERATOR MATCHES "Visual Studio 6") + set(CMAKE_SKIP_COMPATIBILITY_TESTS 1) +endif() +include (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake) -IF(WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") - SET(_INTEL_WINDOWS 1) -ENDIF() +if(WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") + set(_INTEL_WINDOWS 1) +endif() # Disable deprecation warnings for standard C functions. # really only needed for newer versions of VS, but should -# not hurt other versions, and this will work into the +# not hurt other versions, and this will work into the # future -IF(MSVC OR _INTEL_WINDOWS) - ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) -ELSE() -ENDIF() +if(MSVC OR _INTEL_WINDOWS) + add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) +else() +endif() #silence duplicate symbol warnings on AIX -IF(CMAKE_SYSTEM MATCHES "AIX.*") - IF(NOT CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -bhalt:5 ") - ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) -ENDIF(CMAKE_SYSTEM MATCHES "AIX.*") +if(CMAKE_SYSTEM MATCHES "AIX.*") + if(NOT CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -bhalt:5 ") + endif() +endif() -IF(CMAKE_SYSTEM MATCHES "IRIX.*") - IF(NOT CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include") - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15") - ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) -ENDIF(CMAKE_SYSTEM MATCHES "IRIX.*") +if(CMAKE_SYSTEM MATCHES "IRIX.*") + if(NOT CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15") + endif() +endif() -IF(CMAKE_SYSTEM MATCHES "OSF1-V.*") - IF(NOT CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ") - ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) -ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*") +if(CMAKE_SYSTEM MATCHES "OSF1-V.*") + if(NOT CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ") + endif() +endif() # use the ansi CXX compile flag for building cmake -IF (CMAKE_ANSI_CXXFLAGS) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}") -ENDIF (CMAKE_ANSI_CXXFLAGS) +if (CMAKE_ANSI_CXXFLAGS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}") +endif () -IF (CMAKE_ANSI_CFLAGS) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") -ENDIF (CMAKE_ANSI_CFLAGS) +if (CMAKE_ANSI_CFLAGS) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") +endif () + +# avoid binutils problem with large binaries, e.g. when building CMake in debug mode +# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230 +if (CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_SYSTEM_PROCESSOR STREQUAL parisc) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--unique=.text.*") +endif () diff --git a/Docs/CMakeLists.txt b/Docs/CMakeLists.txt index b04b32d5e..a5e91c9d1 100644 --- a/Docs/CMakeLists.txt +++ b/Docs/CMakeLists.txt @@ -1,4 +1,4 @@ string(REGEX REPLACE "^/(.*)" "\\1" REL_CMAKE_DATA_DIR "${CMAKE_DATA_DIR}") install(FILES cmake-help.vim cmake-indent.vim cmake-syntax.vim DESTINATION ${REL_CMAKE_DATA_DIR}/editors/vim) install(FILES cmake-mode.el DESTINATION ${REL_CMAKE_DATA_DIR}/editors/emacs) -ADD_SUBDIRECTORY (bash-completion) +add_subdirectory (bash-completion) diff --git a/Docs/bash-completion/cpack b/Docs/bash-completion/cpack index 84dcfd534..a0c1f8375 100644 --- a/Docs/bash-completion/cpack +++ b/Docs/bash-completion/cpack @@ -8,7 +8,7 @@ _cpack() case "$prev" in -G) COMPREPLY=( $( compgen -W '$( cpack --help 2>/dev/null | - grep "^ .*=\ .*" 2> /dev/null | grep -v "^ -" 2>/dev/null | + grep "^ .*= .*" 2> /dev/null | grep -v "^ -" 2>/dev/null | cut -d" " -f 3 )' -- "$cur" ) ) return ;; diff --git a/Docs/cmake-indent.vim b/Docs/cmake-indent.vim index f149873ed..a26dd06a2 100644 --- a/Docs/cmake-indent.vim +++ b/Docs/cmake-indent.vim @@ -1,11 +1,11 @@ " ============================================================================= -" +" " Program: CMake - Cross-Platform Makefile Generator " Module: $RCSfile$ " Language: VIM " Date: $Date$ " Version: $Revision$ -" +" " ============================================================================= " Vim indent file diff --git a/Docs/cmake-mode.el b/Docs/cmake-mode.el index 951745515..6feed94c5 100644 --- a/Docs/cmake-mode.el +++ b/Docs/cmake-mode.el @@ -34,7 +34,7 @@ ;; cmake executable variable used to run cmake --help-command ;; on commands in cmake-mode ;; -;; cmake-command-help Written by James Bigler +;; cmake-command-help Written by James Bigler ;; (defcustom cmake-mode-cmake-executable "cmake" @@ -68,9 +68,9 @@ set the path with these commands: "\\|" "[ \t\r\n]" "\\)*")) (defconst cmake-regex-block-open - "^\\([iI][fF]\\|[mM][aA][cC][rR][oO]\\|[fF][oO][rR][eE][aA][cC][hH]\\|[eE][lL][sS][eE]\\|[eE][lL][sS][eE][iI][fF]\\|[wW][hH][iI][lL][eE]\\|[fF][uU][nN][cC][tT][iI][oO][nN]\\)$") + "^\\(if\\|macro\\|foreach\\|else\\|elseif\\|while\\|function\\)$") (defconst cmake-regex-block-close - "^[ \t]*\\([eE][nN][dD][iI][fF]\\|[eE][nN][dD][fF][oO][rR][eE][aA][cC][hH]\\|[eE][nN][dD][mM][aA][cC][rR][oO]\\|[eE][lL][sS][eE]\\|[eE][lL][sS][eE][iI][fF]\\|[eE][nN][dD][wW][hH][iI][lL][eE]\\|[eE][nN][dD][fF][uU][nN][cC][tT][iI][oO][nN]\\)[ \t]*(") + "^[ \t]*\\(endif\\|endforeach\\|endmacro\\|else\\|elseif\\|endwhile\\|endfunction\\)[ \t]*(") ;------------------------------------------------------------------------------ @@ -126,6 +126,7 @@ set the path with these commands: (beginning-of-line) (let ((point-start (point)) + (case-fold-search t) ;; case-insensitive token) ; Search back for the last indented line. @@ -191,11 +192,11 @@ the indentation. Otherwise it retains the same position on the line" (setq save-point (point)) (goto-char (point-min)) (while (re-search-forward "^\\([ \t]*\\)\\(\\w+\\)\\([ \t]*(\\)" nil t) - (replace-match - (concat - (match-string 1) - (downcase (match-string 2)) - (match-string 3)) + (replace-match + (concat + (match-string 1) + (downcase (match-string 2)) + (match-string 3)) t)) (goto-char save-point) ) @@ -229,13 +230,26 @@ the indentation. Otherwise it retains the same position on the line" ;; (defvar cmake-tab-width 2) +;; +;; Keymap. +;; +(defvar cmake-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\C-ch" 'cmake-help-command) + (define-key map "\C-cl" 'cmake-help-list-commands) + (define-key map "\C-cu" 'unscreamify-cmake-buffer) + map) + "Keymap used in cmake-mode buffers.") + ;------------------------------------------------------------------------------ ;; ;; CMake mode startup function. ;; (defun cmake-mode () - "Major mode for editing CMake listfiles." + "Major mode for editing CMake listfiles. + +\\{cmake-mode-map}" (interactive) (kill-all-local-variables) (setq major-mode 'cmake-mode) @@ -262,6 +276,9 @@ the indentation. Otherwise it retains the same position on the line" (make-local-variable 'comment-start) (setq comment-start "#") + ; Setup keymap. + (use-local-map cmake-mode-map) + ; Run user hooks. (run-hooks 'cmake-mode-hook)) diff --git a/Docs/cmake-syntax.vim b/Docs/cmake-syntax.vim index 80b348eef..80395ab1a 100644 --- a/Docs/cmake-syntax.vim +++ b/Docs/cmake-syntax.vim @@ -36,9 +36,9 @@ syn region cmakeVariableValue start=/\${/ end=/}/ \ contained oneline contains=CONTAINED,cmakeTodo syn region cmakeEnvironment start=/\$ENV{/ end=/}/ \ contained oneline contains=CONTAINED,cmakeTodo -syn region cmakeString start=/"/ end=/"/ +syn region cmakeString start=/"/ end=/"/ \ contains=CONTAINED,cmakeTodo,cmakeOperators -syn region cmakeArguments start=/(/ end=/)/ +syn region cmakeArguments start=/(/ end=/)/ \ contains=ALLBUT,cmakeArguments,cmakeTodo syn keyword cmakeSystemVariables \ WIN32 UNIX APPLE CYGWIN BORLAND MINGW MSVC MSVC_IDE MSVC60 MSVC70 MSVC71 MSVC80 MSVC90 @@ -49,11 +49,11 @@ syn keyword cmakeDeprecated ABSTRACT_FILES BUILD_NAME SOURCE_FILES SOURCE_FILES_ \ nextgroup=cmakeArguments " The keywords are generated as: cmake --help-command-list | tr "\n" " " -syn keyword cmakeStatement +syn keyword cmakeStatement \ ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BUILD_COMMAND BUILD_NAME CMAKE_MINIMUM_REQUIRED CONFIGURE_FILE CREATE_TEST_SOURCELIST ELSE ELSEIF ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDFUNCTION ENDIF ENDMACRO ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH FUNCTION GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_LINK_LIBRARIES TRY_COMPILE TRY_RUN UNSET USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WHILE WRITE_FILE \ nextgroup=cmakeArguments -syn keyword cmakeTodo - \ TODO FIXME XXX +syn keyword cmakeTodo + \ TODO FIXME XXX \ contained " Define the default highlighting. diff --git a/Example/Demo/demo.cxx b/Example/Demo/demo.cxx index 31de0386c..815c8149e 100644 --- a/Example/Demo/demo.cxx +++ b/Example/Demo/demo.cxx @@ -5,6 +5,6 @@ extern Hello hello; int main() { hello.Print(); - + return 0; } diff --git a/Modules/AddFileDependencies.cmake b/Modules/AddFileDependencies.cmake index f971e37f5..e88025c14 100644 --- a/Modules/AddFileDependencies.cmake +++ b/Modules/AddFileDependencies.cmake @@ -15,15 +15,15 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -MACRO(ADD_FILE_DEPENDENCIES _file) +macro(ADD_FILE_DEPENDENCIES _file) - GET_SOURCE_FILE_PROPERTY(_deps ${_file} OBJECT_DEPENDS) - IF (_deps) - SET(_deps ${_deps} ${ARGN}) - ELSE (_deps) - SET(_deps ${ARGN}) - ENDIF (_deps) + get_source_file_property(_deps ${_file} OBJECT_DEPENDS) + if (_deps) + set(_deps ${_deps} ${ARGN}) + else () + set(_deps ${ARGN}) + endif () - SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}") + set_source_files_properties(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}") -ENDMACRO(ADD_FILE_DEPENDENCIES) +endmacro() diff --git a/Modules/AutomocInfo.cmake.in b/Modules/AutomocInfo.cmake.in index 13f21617b..640bf70a0 100644 --- a/Modules/AutomocInfo.cmake.in +++ b/Modules/AutomocInfo.cmake.in @@ -1,7 +1,6 @@ set(AM_SOURCES @_moc_files@ ) set(AM_HEADERS @_moc_headers@ ) set(AM_MOC_COMPILE_DEFINITIONS @_moc_compile_defs@) -set(AM_MOC_DEFINITIONS @_moc_defs@) set(AM_MOC_INCLUDES @_moc_incs@) set(AM_MOC_OPTIONS @_moc_options@) set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@") diff --git a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in index 9f7f03e27..b1c4fdf81 100644 --- a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in +++ b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in @@ -1,5 +1,5 @@ # This is a basic version file for the Config-mode of find_package(). -# It is used by WriteBasicConfigVersionFile.cmake as input file for configure_file() +# It is used by write_basic_package_version_file() as input file for configure_file() # to create a version-file which can be installed along a config.cmake file. # # The created file sets PACKAGE_VERSION_EXACT if the current version string and diff --git a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in index 7bcea88a5..4acd9bb5e 100644 --- a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in +++ b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in @@ -1,5 +1,5 @@ # This is a basic version file for the Config-mode of find_package(). -# It is used by WriteBasicConfigVersionFile.cmake as input file for configure_file() +# It is used by write_basic_package_version_file() as input file for configure_file() # to create a version-file which can be installed along a config.cmake file. # # The created file sets PACKAGE_VERSION_EXACT if the current version string and diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 0143d593d..0f6cd059e 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -184,17 +184,17 @@ function(get_bundle_main_executable bundle result_var) if(line_is_main_executable) string(REGEX REPLACE "^.*(.*).*$" "\\1" bundle_executable "${line}") break() - endif(line_is_main_executable) + endif() if(line MATCHES "^.*CFBundleExecutable.*$") set(line_is_main_executable 1) - endif(line MATCHES "^.*CFBundleExecutable.*$") - endforeach(line) + endif() + endforeach() if(NOT "${bundle_executable}" STREQUAL "") if(EXISTS "${bundle}/Contents/MacOS/${bundle_executable}") set(result "${bundle}/Contents/MacOS/${bundle_executable}") - else(EXISTS "${bundle}/Contents/MacOS/${bundle_executable}") + else() # Ultimate goal: # If not in "Contents/MacOS" then scan the bundle for matching files. If @@ -207,9 +207,9 @@ function(get_bundle_main_executable bundle result_var) # for the bundle to be in Contents/MacOS, it's an error if it's not: # set(result "error: '${bundle}/Contents/MacOS/${bundle_executable}' does not exist") - endif(EXISTS "${bundle}/Contents/MacOS/${bundle_executable}") - endif(NOT "${bundle_executable}" STREQUAL "") - else(EXISTS "${bundle}/Contents/Info.plist") + endif() + endif() + else() # # More inclusive technique... (This one would work on Windows and Linux # too, if a developer followed the typical Mac bundle naming convention...) @@ -217,10 +217,10 @@ function(get_bundle_main_executable bundle result_var) # If there is no Info.plist file, try to find an executable with the same # base name as the .app directory: # - endif(EXISTS "${bundle}/Contents/Info.plist") + endif() set(${result_var} "${result}" PARENT_SCOPE) -endfunction(get_bundle_main_executable) +endfunction() function(get_dotapp_dir exe dotapp_dir_var) @@ -240,9 +240,9 @@ function(get_dotapp_dir exe dotapp_dir_var) if(sname MATCHES "\\.app$") set(done 1) set(dotapp_dir "${sdir}/${sname}") - endif(sname MATCHES "\\.app$") - endwhile(NOT ${done}) - else(s MATCHES "^.*/.*\\.app/.*$") + endif() + endwhile() + else() # Otherwise use a directory containing the exe # (typical of a non-bundle executable on Mac, Windows or Linux) # @@ -250,14 +250,14 @@ function(get_dotapp_dir exe dotapp_dir_var) if(is_executable) get_filename_component(sdir "${s}" PATH) set(dotapp_dir "${sdir}") - else(is_executable) + else() set(dotapp_dir "${s}") - endif(is_executable) - endif(s MATCHES "^.*/.*\\.app/.*$") + endif() + endif() set(${dotapp_dir_var} "${dotapp_dir}" PARENT_SCOPE) -endfunction(get_dotapp_dir) +endfunction() function(get_bundle_and_executable app bundle_var executable_var valid_var) @@ -273,13 +273,13 @@ function(get_bundle_and_executable app bundle_var executable_var valid_var) set(${executable_var} "${executable}" PARENT_SCOPE) set(valid 1) #message(STATUS "info: handled .app directory case...") - else(EXISTS "${app}" AND EXISTS "${executable}") + else() message(STATUS "warning: *NOT* handled - .app directory case...") - endif(EXISTS "${app}" AND EXISTS "${executable}") - else(app MATCHES "\\.app$") + endif() + else() message(STATUS "warning: *NOT* handled - directory but not .app case...") - endif(app MATCHES "\\.app$") - else(IS_DIRECTORY "${app}") + endif() + else() # Is it an executable file? is_file_executable("${app}" is_executable) if(is_executable) @@ -296,21 +296,21 @@ function(get_bundle_and_executable app bundle_var executable_var valid_var) set(valid 1) #message(STATUS "info: handled executable file in any dir case...") endif() - else(is_executable) + else() message(STATUS "warning: *NOT* handled - not .app dir, not executable file...") - endif(is_executable) - endif(IS_DIRECTORY "${app}") - else(EXISTS "${app}") + endif() + endif() + else() message(STATUS "warning: *NOT* handled - directory/file does not exist...") - endif(EXISTS "${app}") + endif() if(NOT valid) set(${bundle_var} "error: not a bundle" PARENT_SCOPE) set(${executable_var} "error: not a bundle" PARENT_SCOPE) - endif(NOT valid) + endif() set(${valid_var} ${valid} PARENT_SCOPE) -endfunction(get_bundle_and_executable) +endfunction() function(get_bundle_all_executables bundle exes_var) @@ -321,11 +321,11 @@ function(get_bundle_all_executables bundle exes_var) is_file_executable("${f}" is_executable) if(is_executable) set(exes ${exes} "${f}") - endif(is_executable) - endforeach(f) + endif() + endforeach() set(${exes_var} "${exes}" PARENT_SCOPE) -endfunction(get_bundle_all_executables) +endfunction() function(get_item_key item key_var) @@ -335,7 +335,7 @@ function(get_item_key item key_var) endif() string(REGEX REPLACE "\\." "_" ${key_var} "${item_name}") set(${key_var} ${${key_var}} PARENT_SCOPE) -endfunction(get_item_key) +endfunction() function(clear_bundle_keys keys_var) @@ -346,9 +346,9 @@ function(clear_bundle_keys keys_var) set(${key}_EMBEDDED_ITEM PARENT_SCOPE) set(${key}_RESOLVED_EMBEDDED_ITEM PARENT_SCOPE) set(${key}_COPYFLAG PARENT_SCOPE) - endforeach(key) + endforeach() set(${keys_var} PARENT_SCOPE) -endfunction(clear_bundle_keys) +endfunction() function(set_bundle_key_values keys_var context item exepath dirs copyflag) @@ -369,13 +369,13 @@ function(set_bundle_key_values keys_var context item exepath dirs copyflag) # For frameworks, construct the name under the embedded path from the # opening "${item_name}.framework/" to the closing "/${item_name}": # - string(REGEX REPLACE "^.*(${item_name}.framework/.*/${item_name}).*$" "${default_embedded_path}/\\1" embedded_item "${item}") - else(item MATCHES "[^/]+\\.framework/") + string(REGEX REPLACE "^.*(${item_name}.framework/.*/?${item_name}).*$" "${default_embedded_path}/\\1" embedded_item "${item}") + else() # For other items, just use the same name as the original, but in the # embedded path: # set(embedded_item "${default_embedded_path}/${item_name}") - endif(item MATCHES "[^/]+\\.framework/") + endif() # Replace @executable_path and resolve ".." references: # @@ -391,7 +391,7 @@ function(set_bundle_key_values keys_var context item exepath dirs copyflag) # if(NOT copyflag) set(resolved_embedded_item "${resolved_item}") - endif(NOT copyflag) + endif() set(${keys_var} ${${keys_var}} PARENT_SCOPE) set(${key}_ITEM "${item}" PARENT_SCOPE) @@ -400,10 +400,10 @@ function(set_bundle_key_values keys_var context item exepath dirs copyflag) set(${key}_EMBEDDED_ITEM "${embedded_item}" PARENT_SCOPE) set(${key}_RESOLVED_EMBEDDED_ITEM "${resolved_embedded_item}" PARENT_SCOPE) set(${key}_COPYFLAG "${copyflag}" PARENT_SCOPE) - else(NOT length_before EQUAL length_after) + else() #message("warning: item key '${key}' already in the list, subsequent references assumed identical to first") - endif(NOT length_before EQUAL length_after) -endfunction(set_bundle_key_values) + endif() +endfunction() function(get_bundle_keys app libs dirs keys_var) @@ -432,8 +432,8 @@ function(get_bundle_keys app libs dirs keys_var) get_prerequisites("${lib}" prereqs 1 1 "${exepath}" "${dirs}") foreach(pr ${prereqs}) set_bundle_key_values(${keys_var} "${lib}" "${pr}" "${exepath}" "${dirs}" 1) - endforeach(pr) - endforeach(lib) + endforeach() + endforeach() # For each executable found in the bundle, accumulate keys as we go. # The list of keys should be complete when all prerequisites of all @@ -450,8 +450,8 @@ function(get_bundle_keys app libs dirs keys_var) get_prerequisites("${exe}" prereqs 1 1 "${exepath}" "${dirs}") foreach(pr ${prereqs}) set_bundle_key_values(${keys_var} "${exe}" "${pr}" "${exepath}" "${dirs}" 1) - endforeach(pr) - endforeach(exe) + endforeach() + endforeach() # Propagate values to caller's scope: # @@ -463,9 +463,9 @@ function(get_bundle_keys app libs dirs keys_var) set(${key}_EMBEDDED_ITEM "${${key}_EMBEDDED_ITEM}" PARENT_SCOPE) set(${key}_RESOLVED_EMBEDDED_ITEM "${${key}_RESOLVED_EMBEDDED_ITEM}" PARENT_SCOPE) set(${key}_COPYFLAG "${${key}_COPYFLAG}" PARENT_SCOPE) - endforeach(key) - endif(valid) -endfunction(get_bundle_keys) + endforeach() + endif() +endfunction() function(copy_resolved_item_into_bundle resolved_item resolved_embedded_item) @@ -485,10 +485,10 @@ function(copy_resolved_item_into_bundle resolved_item resolved_embedded_item) execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${resolved_item}" "${resolved_embedded_item}") if(UNIX AND NOT APPLE) file(RPATH_REMOVE FILE "${resolved_embedded_item}") - endif(UNIX AND NOT APPLE) + endif() endif() -endfunction(copy_resolved_item_into_bundle) +endfunction() function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_item) @@ -527,10 +527,10 @@ function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_ite endif() if(UNIX AND NOT APPLE) file(RPATH_REMOVE FILE "${resolved_embedded_item}") - endif(UNIX AND NOT APPLE) + endif() endif() -endfunction(copy_resolved_framework_into_bundle) +endfunction() function(fixup_bundle_item resolved_embedded_item exepath dirs) @@ -580,10 +580,10 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs) if(NOT "${${rkey}_EMBEDDED_ITEM}" STREQUAL "") set(changes ${changes} "-change" "${pr}" "${${rkey}_EMBEDDED_ITEM}") - else(NOT "${${rkey}_EMBEDDED_ITEM}" STREQUAL "") + else() message("warning: unexpected reference to '${pr}'") - endif(NOT "${${rkey}_EMBEDDED_ITEM}" STREQUAL "") - endforeach(pr) + endif() + endforeach() if(BU_CHMOD_BUNDLE_ITEMS) execute_process(COMMAND chmod u+w "${resolved_embedded_item}") @@ -595,7 +595,7 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs) execute_process(COMMAND install_name_tool ${changes} -id "${${ikey}_EMBEDDED_ITEM}" "${resolved_embedded_item}" ) -endfunction(fixup_bundle_item) +endfunction() function(fixup_bundle app libs dirs) @@ -620,9 +620,9 @@ function(fixup_bundle app libs dirs) math(EXPR i ${i}+1) if(${${key}_COPYFLAG}) message(STATUS "${i}/${n}: copying '${${key}_RESOLVED_ITEM}'") - else(${${key}_COPYFLAG}) + else() message(STATUS "${i}/${n}: *NOT* copying '${${key}_RESOLVED_ITEM}'") - endif(${${key}_COPYFLAG}) + endif() set(show_status 0) if(show_status) @@ -634,7 +634,7 @@ function(fixup_bundle app libs dirs) message(STATUS "resolved_embedded_item='${${key}_RESOLVED_EMBEDDED_ITEM}'") message(STATUS "copyflag='${${key}_COPYFLAG}'") message(STATUS "") - endif(show_status) + endif() if(${${key}_COPYFLAG}) set(item "${${key}_ITEM}") @@ -645,8 +645,8 @@ function(fixup_bundle app libs dirs) copy_resolved_item_into_bundle("${${key}_RESOLVED_ITEM}" "${${key}_RESOLVED_EMBEDDED_ITEM}") endif() - endif(${${key}_COPYFLAG}) - endforeach(key) + endif() + endforeach() message(STATUS "fixup_bundle: fixing...") foreach(key ${keys}) @@ -654,28 +654,28 @@ function(fixup_bundle app libs dirs) if(APPLE) message(STATUS "${i}/${n}: fixing up '${${key}_RESOLVED_EMBEDDED_ITEM}'") fixup_bundle_item("${${key}_RESOLVED_EMBEDDED_ITEM}" "${exepath}" "${dirs}") - else(APPLE) + else() message(STATUS "${i}/${n}: fix-up not required on this platform '${${key}_RESOLVED_EMBEDDED_ITEM}'") - endif(APPLE) - endforeach(key) + endif() + endforeach() message(STATUS "fixup_bundle: cleaning up...") clear_bundle_keys(keys) message(STATUS "fixup_bundle: verifying...") verify_app("${app}") - else(valid) + else() message(SEND_ERROR "error: fixup_bundle: not a valid bundle") - endif(valid) + endif() message(STATUS "fixup_bundle: done") -endfunction(fixup_bundle) +endfunction() function(copy_and_fixup_bundle src dst libs dirs) execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${src}" "${dst}") fixup_bundle("${dst}" "${libs}" "${dirs}") -endfunction(copy_and_fixup_bundle) +endfunction() function(verify_bundle_prerequisites bundle result_var info_var) @@ -720,23 +720,23 @@ function(verify_bundle_prerequisites bundle result_var info_var) set(external_prereqs ${external_prereqs} "${p}") endif() endif() - endforeach(p) + endforeach() if(external_prereqs) # Found non-system/somehow-unacceptable prerequisites: set(result 0) set(info ${info} "external prerequisites found:\nf='${f}'\nexternal_prereqs='${external_prereqs}'\n") - endif(external_prereqs) - endif(is_executable) - endforeach(f) + endif() + endif() + endforeach() if(result) set(info "Verified ${count} executable files in '${bundle}'") - endif(result) + endif() set(${result_var} "${result}" PARENT_SCOPE) set(${info_var} "${info}" PARENT_SCOPE) -endfunction(verify_bundle_prerequisites) +endfunction() function(verify_bundle_symlinks bundle result_var info_var) @@ -749,7 +749,7 @@ function(verify_bundle_symlinks bundle result_var info_var) set(${result_var} "${result}" PARENT_SCOPE) set(${info_var} "${info}" PARENT_SCOPE) -endfunction(verify_bundle_symlinks) +endfunction() function(verify_app app) @@ -778,9 +778,9 @@ function(verify_app app) message(STATUS "verified='${verified}'") message(STATUS "info='${info}'") message(STATUS "") - endif(verified) + endif() if(NOT verified) message(FATAL_ERROR "error: verify_app failed") - endif(NOT verified) -endfunction(verify_app) + endif() +endfunction() diff --git a/Modules/CMakeASM-ATTInformation.cmake b/Modules/CMakeASM-ATTInformation.cmake index cb1f5d69c..675c13bb3 100644 --- a/Modules/CMakeASM-ATTInformation.cmake +++ b/Modules/CMakeASM-ATTInformation.cmake @@ -14,12 +14,12 @@ # support for AT&T syntax assemblers, e.g. GNU as -SET(ASM_DIALECT "-ATT") +set(ASM_DIALECT "-ATT") # *.S files are supposed to be preprocessed, so they should not be passed to # assembler but should be processed by gcc -SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;asm) +set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;asm) -SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o ") +set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o ") -INCLUDE(CMakeASMInformation) -SET(ASM_DIALECT) +include(CMakeASMInformation) +set(ASM_DIALECT) diff --git a/Modules/CMakeASMCompiler.cmake.in b/Modules/CMakeASMCompiler.cmake.in index 2dc24b06d..8e58307e9 100644 --- a/Modules/CMakeASMCompiler.cmake.in +++ b/Modules/CMakeASMCompiler.cmake.in @@ -1,12 +1,12 @@ -SET(CMAKE_ASM@ASM_DIALECT@_COMPILER "@_CMAKE_ASM_COMPILER@") -SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_ARG1 "@_CMAKE_ASM_COMPILER_ARG1@") -SET(CMAKE_AR "@CMAKE_AR@") -SET(CMAKE_RANLIB "@CMAKE_RANLIB@") -SET(CMAKE_LINKER "@CMAKE_LINKER@") -SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1) -SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_ID "@_CMAKE_ASM_COMPILER_ID@") -SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_ENV_VAR "@_CMAKE_ASM_COMPILER_ENV_VAR@") +set(CMAKE_ASM@ASM_DIALECT@_COMPILER "@_CMAKE_ASM_COMPILER@") +set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ARG1 "@_CMAKE_ASM_COMPILER_ARG1@") +set(CMAKE_AR "@CMAKE_AR@") +set(CMAKE_RANLIB "@CMAKE_RANLIB@") +set(CMAKE_LINKER "@CMAKE_LINKER@") +set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1) +set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ID "@_CMAKE_ASM_COMPILER_ID@") +set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ENV_VAR "@_CMAKE_ASM_COMPILER_ENV_VAR@") -SET(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) -SET(CMAKE_ASM@ASM_DIALECT@_LINKER_PREFERENCE 0) +set(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_ASM@ASM_DIALECT@_LINKER_PREFERENCE 0) diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake index b5f242033..dce162496 100644 --- a/Modules/CMakeASMInformation.cmake +++ b/Modules/CMakeASMInformation.cmake @@ -12,76 +12,76 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF(UNIX) - SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o) -ELSE(UNIX) - SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .obj) -ENDIF(UNIX) +if(UNIX) + set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o) +else() + set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .obj) +endif() -SET(CMAKE_INCLUDE_FLAG_ASM${ASM_DIALECT} "-I") # -I -SET(CMAKE_BASE_NAME) -GET_FILENAME_COMPONENT(CMAKE_BASE_NAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME_WE) +set(CMAKE_INCLUDE_FLAG_ASM${ASM_DIALECT} "-I") # -I +set(CMAKE_BASE_NAME) +get_filename_component(CMAKE_BASE_NAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME_WE) -IF("${CMAKE_BASE_NAME}" STREQUAL "as") - SET(CMAKE_BASE_NAME gas) -ENDIF("${CMAKE_BASE_NAME}" STREQUAL "as") +if("${CMAKE_BASE_NAME}" STREQUAL "as") + set(CMAKE_BASE_NAME gas) +endif() # Load compiler-specific information. -SET(_INCLUDED_FILE "") -IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) - INCLUDE(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) -ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) -IF(NOT _INCLUDED_FILE) - IF("ASM${ASM_DIALECT}" STREQUAL "ASM") - MESSAGE(STATUS "Warning: Did not find file Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}") - ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM") - INCLUDE(Platform/${CMAKE_BASE_NAME} OPTIONAL) -ENDIF(NOT _INCLUDED_FILE) - -IF(CMAKE_SYSTEM_PROCESSOR) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) - IF(NOT _INCLUDED_FILE) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL) - ENDIF(NOT _INCLUDED_FILE) -ENDIF(CMAKE_SYSTEM_PROCESSOR) - -INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) -IF(NOT _INCLUDED_FILE) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) -ENDIF(NOT _INCLUDED_FILE) +set(_INCLUDED_FILE "") +if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + include(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() +if(NOT _INCLUDED_FILE) + if("ASM${ASM_DIALECT}" STREQUAL "ASM") + message(STATUS "Warning: Did not find file Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}") + endif() + include(Platform/${CMAKE_BASE_NAME} OPTIONAL) +endif() + +if(CMAKE_SYSTEM_PROCESSOR) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) + if(NOT _INCLUDED_FILE) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL) + endif() +endif() + +include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +if(NOT _INCLUDED_FILE) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) +endif() # Set default assembler file extensions: -IF(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS) - SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm) -ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS) +if(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS) + set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm) +endif() # Support for CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT and friends: -SET(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}") +set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}") # avoid just having a space as the initial value for the cache -IF(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ") - SET(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT) -ENDIF(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ") -SET (CMAKE_ASM${ASM_DIALECT}_FLAGS "${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}" CACHE STRING +if(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ") + set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT) +endif() +set (CMAKE_ASM${ASM_DIALECT}_FLAGS "${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}" CACHE STRING "Flags used by the assembler during all build types.") -IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) +if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) # default build type is none - IF(NOT CMAKE_NO_BUILD_TYPE) - SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING + if(NOT CMAKE_NO_BUILD_TYPE) + set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING "Choose the type of build, options are: None, Debug Release RelWithDebInfo MinSizeRel.") - ENDIF(NOT CMAKE_NO_BUILD_TYPE) - SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG "${CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG_INIT}" CACHE STRING + endif() + set (CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG "${CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG_INIT}" CACHE STRING "Flags used by the assembler during debug builds.") - SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL "${CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL_INIT}" CACHE STRING + set (CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL "${CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL_INIT}" CACHE STRING "Flags used by the assembler during release minsize builds.") - SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE_INIT}" CACHE STRING + set (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE_INIT}" CACHE STRING "Flags used by the assembler during release builds.") - SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING + set (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING "Flags used by the assembler during Release with Debug Info builds.") -ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) +endif() -MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_FLAGS +mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_FLAGS CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE @@ -89,42 +89,42 @@ MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_FLAGS ) -IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o -c ") -ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT) +if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT) + set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o -c ") +endif() -IF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY) - SET(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY +if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY) + set(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY " cr " " ") -ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY) +endif() -IF(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE) - SET(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE +if(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE) + set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE " -o ") -ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE) +endif() -IF(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG) - SET(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG}) -ENDIF() +if(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG) + set(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG}) +endif() -IF(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP) - SET(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP}) -ENDIF() +if(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP) + set(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP}) +endif() -IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG) - SET(CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_ASM${ASM_DIALECT}_FLAG}) -ENDIF() +if(NOT CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG) + set(CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_ASM${ASM_DIALECT}_FLAG}) +endif() # to be done -IF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY) - SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY) -ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY) +if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY) + set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY) +endif() -IF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE) - SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE) -ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE) +if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE) + set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE) +endif() -SET(CMAKE_ASM${ASM_DIALECT}_INFOMATION_LOADED 1) +set(CMAKE_ASM${ASM_DIALECT}_INFOMATION_LOADED 1) diff --git a/Modules/CMakeASM_MASMInformation.cmake b/Modules/CMakeASM_MASMInformation.cmake index 4e1386fab..eb105ab10 100644 --- a/Modules/CMakeASM_MASMInformation.cmake +++ b/Modules/CMakeASM_MASMInformation.cmake @@ -14,11 +14,11 @@ # support for the MS assembler, masm and masm64 -SET(ASM_DIALECT "_MASM") +set(ASM_DIALECT "_MASM") -SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm) +set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm) -SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " /c /Fo ") +set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " /c /Fo ") -INCLUDE(CMakeASMInformation) -SET(ASM_DIALECT) +include(CMakeASMInformation) +set(ASM_DIALECT) diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake index 9da7d306c..7058fc7ae 100644 --- a/Modules/CMakeASM_NASMInformation.cmake +++ b/Modules/CMakeASM_NASMInformation.cmake @@ -19,21 +19,21 @@ set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS nasm asm) if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT) if(WIN32) if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) - SET(CMAKE_ASM_NASM_OBJECT_FORMAT win64) + set(CMAKE_ASM_NASM_OBJECT_FORMAT win64) else() - SET(CMAKE_ASM_NASM_OBJECT_FORMAT win32) + set(CMAKE_ASM_NASM_OBJECT_FORMAT win32) endif() elseif(APPLE) if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) - SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho64) + set(CMAKE_ASM_NASM_OBJECT_FORMAT macho64) else() - SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho) + set(CMAKE_ASM_NASM_OBJECT_FORMAT macho) endif() else() if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) - SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) + set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) else() - SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf) + set(CMAKE_ASM_NASM_OBJECT_FORMAT elf) endif() endif() endif() diff --git a/Modules/CMakeAddNewLanguage.txt b/Modules/CMakeAddNewLanguage.txt index 203c39dfe..612e1a3a5 100644 --- a/Modules/CMakeAddNewLanguage.txt +++ b/Modules/CMakeAddNewLanguage.txt @@ -1,7 +1,23 @@ +This file provides a few notes to CMake developers about how to add +support for a new language to CMake. It is also possible to place +these files in CMAKE_MODULE_PATH within an outside project to add +languages not supported by upstream CMake. However, this is not +a fully supported use case. + +The implementation behind the scenes of project/enable_language, +including the compiler/platform modules, is an *internal* API that +does not make any compatibility guarantees. It is not covered in the +official reference documentation that is versioned with the source code. +Maintainers of external language support are responsible for porting +it to each version of CMake as upstream changes are made. Since +the API is internal we will not necessarily include notice of any +changes in release notes. + + CMakeDetermine(LANG)Compiler.cmake -> this should find the compiler for LANG and configure CMake(LANG)Compiler.cmake.in CMake(LANG)Compiler.cmake.in -> used by CMakeDetermine(LANG)Compiler.cmake - This file is used to store compiler information and is copied down into try + This file is used to store compiler information and is copied down into try compile directories so that try compiles do not need to re-determine and test the LANG CMakeTest(LANG)Compiler.cmake -> test the compiler and set: diff --git a/Modules/CMakeBackwardCompatibilityC.cmake b/Modules/CMakeBackwardCompatibilityC.cmake index 00e568830..e3b6c823e 100644 --- a/Modules/CMakeBackwardCompatibilityC.cmake +++ b/Modules/CMakeBackwardCompatibilityC.cmake @@ -13,28 +13,28 @@ # License text for the above reference.) # Nothing here yet -IF(CMAKE_GENERATOR MATCHES "Visual Studio 7") - INCLUDE(CMakeVS7BackwardCompatibility) - SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1) -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7") -IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") - INCLUDE(CMakeVS6BackwardCompatibility) - SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1) -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") - -IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) +if(CMAKE_GENERATOR MATCHES "Visual Studio 7") + include(CMakeVS7BackwardCompatibility) + set(CMAKE_SKIP_COMPATIBILITY_TESTS 1) +endif() +if(CMAKE_GENERATOR MATCHES "Visual Studio 6") + include(CMakeVS6BackwardCompatibility) + set(CMAKE_SKIP_COMPATIBILITY_TESTS 1) +endif() + +if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) # Old CMake versions did not support OS X universal binaries anyway, # so just get through this with at least some size for the types. - LIST(LENGTH CMAKE_OSX_ARCHITECTURES NUM_ARCHS) - IF(${NUM_ARCHS} GREATER 1) - IF(NOT DEFINED CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) - MESSAGE(WARNING "This module does not work with OS X universal binaries.") - SET(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES 1) - LIST(GET CMAKE_OSX_ARCHITECTURES 0 CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) - ENDIF() - ENDIF() - - INCLUDE (CheckTypeSize) + list(LENGTH CMAKE_OSX_ARCHITECTURES NUM_ARCHS) + if(${NUM_ARCHS} GREATER 1) + if(NOT DEFINED CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) + message(WARNING "This module does not work with OS X universal binaries.") + set(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES 1) + list(GET CMAKE_OSX_ARCHITECTURES 0 CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) + endif() + endif() + + include (CheckTypeSize) CHECK_TYPE_SIZE(int CMAKE_SIZEOF_INT) CHECK_TYPE_SIZE(long CMAKE_SIZEOF_LONG) CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P) @@ -43,52 +43,52 @@ IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) CHECK_TYPE_SIZE(float CMAKE_SIZEOF_FLOAT) CHECK_TYPE_SIZE(double CMAKE_SIZEOF_DOUBLE) - INCLUDE (CheckIncludeFile) + include (CheckIncludeFile) CHECK_INCLUDE_FILE("limits.h" CMAKE_HAVE_LIMITS_H) CHECK_INCLUDE_FILE("unistd.h" CMAKE_HAVE_UNISTD_H) CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H) - INCLUDE (CheckIncludeFiles) + include (CheckIncludeFiles) CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SYS_PRCTL_H) - INCLUDE (TestBigEndian) + include (TestBigEndian) TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN) - INCLUDE (FindX11) + include (FindX11) - IF("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$") - SET (CMAKE_X_CFLAGS "" CACHE STRING "X11 extra flags.") - ELSE("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$") - SET (CMAKE_X_CFLAGS "-I${X11_X11_INCLUDE_PATH}" CACHE STRING + if("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$") + set (CMAKE_X_CFLAGS "" CACHE STRING "X11 extra flags.") + else() + set (CMAKE_X_CFLAGS "-I${X11_X11_INCLUDE_PATH}" CACHE STRING "X11 extra flags.") - ENDIF("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$") - SET (CMAKE_X_LIBS "${X11_LIBRARIES}" CACHE STRING + endif() + set (CMAKE_X_LIBS "${X11_LIBRARIES}" CACHE STRING "Libraries and options used in X11 programs.") - SET (CMAKE_HAS_X "${X11_FOUND}" CACHE INTERNAL "Is X11 around.") + set (CMAKE_HAS_X "${X11_FOUND}" CACHE INTERNAL "Is X11 around.") - INCLUDE (FindThreads) + include (FindThreads) - SET (CMAKE_THREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING + set (CMAKE_THREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING "Thread library used.") - SET (CMAKE_USE_PTHREADS "${CMAKE_USE_PTHREADS_INIT}" CACHE BOOL + set (CMAKE_USE_PTHREADS "${CMAKE_USE_PTHREADS_INIT}" CACHE BOOL "Use the pthreads library.") - SET (CMAKE_USE_WIN32_THREADS "${CMAKE_USE_WIN32_THREADS_INIT}" CACHE BOOL + set (CMAKE_USE_WIN32_THREADS "${CMAKE_USE_WIN32_THREADS_INIT}" CACHE BOOL "Use the win32 thread library.") - SET (CMAKE_HP_PTHREADS ${CMAKE_HP_PTHREADS_INIT} CACHE BOOL + set (CMAKE_HP_PTHREADS ${CMAKE_HP_PTHREADS_INIT} CACHE BOOL "Use HP pthreads.") - SET (CMAKE_USE_SPROC ${CMAKE_USE_SPROC_INIT} CACHE BOOL + set (CMAKE_USE_SPROC ${CMAKE_USE_SPROC_INIT} CACHE BOOL "Use sproc libs.") - IF(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) - SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) - SET(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) - ENDIF() -ENDIF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) + if(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) + set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) + set(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) + endif() +endif() -MARK_AS_ADVANCED( +mark_as_advanced( CMAKE_HP_PTHREADS CMAKE_THREAD_LIBS CMAKE_USE_PTHREADS diff --git a/Modules/CMakeBackwardCompatibilityCXX.cmake b/Modules/CMakeBackwardCompatibilityCXX.cmake index 707bbde50..cfc1d91f9 100644 --- a/Modules/CMakeBackwardCompatibilityCXX.cmake +++ b/Modules/CMakeBackwardCompatibilityCXX.cmake @@ -1,10 +1,10 @@ # - define a bunch of backwards compatibility variables -# CMAKE_ANSI_CXXFLAGS - flag for ansi c++ +# CMAKE_ANSI_CXXFLAGS - flag for ansi c++ # CMAKE_HAS_ANSI_STRING_STREAM - has -# INCLUDE(TestForANSIStreamHeaders) -# INCLUDE(CheckIncludeFileCXX) -# INCLUDE(TestForSTDNamespace) -# INCLUDE(TestForANSIForScope) +# include(TestForANSIStreamHeaders) +# include(CheckIncludeFileCXX) +# include(TestForSTDNamespace) +# include(TestForANSIForScope) #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -19,36 +19,36 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) +if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) # check for some ANSI flags in the CXX compiler if it is not gnu - IF(NOT CMAKE_COMPILER_IS_GNUCXX) - INCLUDE(TestCXXAcceptsFlag) - SET(CMAKE_TRY_ANSI_CXX_FLAGS "") - IF(CMAKE_SYSTEM MATCHES "IRIX.*") - SET(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std") - ENDIF(CMAKE_SYSTEM MATCHES "IRIX.*") - IF(CMAKE_SYSTEM MATCHES "OSF.*") - SET(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname") - ENDIF(CMAKE_SYSTEM MATCHES "OSF.*") + if(NOT CMAKE_COMPILER_IS_GNUCXX) + include(TestCXXAcceptsFlag) + set(CMAKE_TRY_ANSI_CXX_FLAGS "") + if(CMAKE_SYSTEM MATCHES "IRIX.*") + set(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std") + endif() + if(CMAKE_SYSTEM MATCHES "OSF.*") + set(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname") + endif() # if CMAKE_TRY_ANSI_CXX_FLAGS has something in it, see # if the compiler accepts it - IF( CMAKE_TRY_ANSI_CXX_FLAGS MATCHES ".+") + if( CMAKE_TRY_ANSI_CXX_FLAGS MATCHES ".+") CHECK_CXX_ACCEPTS_FLAG(${CMAKE_TRY_ANSI_CXX_FLAGS} CMAKE_CXX_ACCEPTS_FLAGS) # if the compiler liked the flag then set CMAKE_ANSI_CXXFLAGS # to the flag - IF(CMAKE_CXX_ACCEPTS_FLAGS) - SET(CMAKE_ANSI_CXXFLAGS ${CMAKE_TRY_ANSI_CXX_FLAGS} CACHE INTERNAL + if(CMAKE_CXX_ACCEPTS_FLAGS) + set(CMAKE_ANSI_CXXFLAGS ${CMAKE_TRY_ANSI_CXX_FLAGS} CACHE INTERNAL "What flags are required by the c++ compiler to make it ansi." ) - ENDIF(CMAKE_CXX_ACCEPTS_FLAGS) - ENDIF( CMAKE_TRY_ANSI_CXX_FLAGS MATCHES ".+") - ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS}) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}") - INCLUDE(TestForANSIStreamHeaders) - INCLUDE(CheckIncludeFileCXX) - INCLUDE(TestForSTDNamespace) - INCLUDE(TestForANSIForScope) - INCLUDE(TestForSSTREAM) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_SAVE}") -ENDIF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) + endif() + endif() + endif() + set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}") + include(TestForANSIStreamHeaders) + include(CheckIncludeFileCXX) + include(TestForSTDNamespace) + include(TestForANSIForScope) + include(TestForSSTREAM) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_SAVE}") +endif() diff --git a/Modules/CMakeBorlandFindMake.cmake b/Modules/CMakeBorlandFindMake.cmake index 1ef28df83..43b31c695 100644 --- a/Modules/CMakeBorlandFindMake.cmake +++ b/Modules/CMakeBorlandFindMake.cmake @@ -12,6 +12,6 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET (CMAKE_MAKE_PROGRAM "make" CACHE STRING +set (CMAKE_MAKE_PROGRAM "make" CACHE STRING "Program used to build from makefiles.") -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) +mark_as_advanced(CMAKE_MAKE_PROGRAM) diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index ded8cf6ab..c41adc956 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -1,53 +1,56 @@ -SET(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@") -SET(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@") -SET(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@") -SET(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@") -SET(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@") +set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@") +set(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@") +set(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@") +set(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@") +set(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@") @SET_MSVC_C_ARCHITECTURE_ID@ -SET(CMAKE_AR "@CMAKE_AR@") -SET(CMAKE_RANLIB "@CMAKE_RANLIB@") -SET(CMAKE_LINKER "@CMAKE_LINKER@") -SET(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@) -SET(CMAKE_C_COMPILER_LOADED 1) -SET(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) -SET(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@) -IF(CMAKE_COMPILER_IS_CYGWIN) - SET(CYGWIN 1) - SET(UNIX 1) -ENDIF(CMAKE_COMPILER_IS_CYGWIN) - -SET(CMAKE_C_COMPILER_ENV_VAR "CC") - -IF(CMAKE_COMPILER_IS_MINGW) - SET(MINGW 1) -ENDIF(CMAKE_COMPILER_IS_MINGW) -SET(CMAKE_C_COMPILER_ID_RUN 1) -SET(CMAKE_C_SOURCE_FILE_EXTENSIONS c) -SET(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) -SET(CMAKE_C_LINKER_PREFERENCE 10) +set(CMAKE_AR "@CMAKE_AR@") +set(CMAKE_RANLIB "@CMAKE_RANLIB@") +set(CMAKE_LINKER "@CMAKE_LINKER@") +set(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS @CMAKE_C_COMPILER_WORKS@) +set(CMAKE_C_ABI_COMPILED @CMAKE_C_ABI_COMPILED@) +set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) +set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) # Save compiler ABI information. -SET(CMAKE_C_SIZEOF_DATA_PTR "@CMAKE_C_SIZEOF_DATA_PTR@") -SET(CMAKE_C_COMPILER_ABI "@CMAKE_C_COMPILER_ABI@") -SET(CMAKE_C_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@") +set(CMAKE_C_SIZEOF_DATA_PTR "@CMAKE_C_SIZEOF_DATA_PTR@") +set(CMAKE_C_COMPILER_ABI "@CMAKE_C_COMPILER_ABI@") +set(CMAKE_C_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@") -IF(CMAKE_C_SIZEOF_DATA_PTR) - SET(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") -ENDIF(CMAKE_C_SIZEOF_DATA_PTR) +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() -IF(CMAKE_C_COMPILER_ABI) - SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") -ENDIF(CMAKE_C_COMPILER_ABI) +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() -IF(CMAKE_C_LIBRARY_ARCHITECTURE) - SET(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@") -ENDIF() +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@") +endif() -SET(CMAKE_C_HAS_ISYSROOT "@CMAKE_C_HAS_ISYSROOT@") +@CMAKE_C_SYSROOT_FLAG_CODE@ @CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ -SET(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@") -SET(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_DIRECTORIES@") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_DIRECTORIES@") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@") @SET_CMAKE_CMCLDEPS_EXECUTABLE@ @SET_CMAKE_CL_SHOWINCLUDE_PREFIX@ diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 06aa9bf06..2d76c7a34 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -20,6 +20,14 @@ # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) # endif +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + #elif defined(__clang__) # define COMPILER_ID "Clang" # define COMPILER_VERSION_MAJOR DEC(__clang_major__) @@ -67,6 +75,10 @@ #elif defined(__DECC) # define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) #elif defined(__IBMC__) # if defined(__COMPILER_VER__) @@ -91,14 +103,17 @@ # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) # endif -#elif defined(__PATHSCALE__) -# define COMPILER_ID "PathScale" - #elif defined(_CRAYC) # define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) #elif defined(__TI_COMPILER_VERSION__) # define COMPILER_ID "TI_DSP" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) #elif defined(__TINYC__) # define COMPILER_ID "TinyCC" @@ -132,9 +147,16 @@ # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) # endif +/* Analog VisualDSP++ >= 4.5.6 */ +#elif defined(__VISUALDSPVERSION__) +# define COMPILER_ID "ADSP" + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) + +/* Analog VisualDSP++ < 4.5.6 */ #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) -/* Analog Devices C++ compiler for Blackfin, TigerSHARC and - SHARC (21000) DSPs */ # define COMPILER_ID "ADSP" /* IAR Systems compiler for embedded systems. @@ -147,6 +169,10 @@ http://sdcc.sourceforge.net */ #elif defined(SDCC) # define COMPILER_ID "SDCC" + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) # define COMPILER_ID "MIPSpro" diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index afac7a452..ce5ce4409 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -20,119 +20,119 @@ # some compilers use different extensions (e.g. sdcc uses .rel) # so set the extension here first so it can be overridden by the compiler specific file -IF(UNIX) - SET(CMAKE_C_OUTPUT_EXTENSION .o) -ELSE(UNIX) - SET(CMAKE_C_OUTPUT_EXTENSION .obj) -ENDIF(UNIX) +if(UNIX) + set(CMAKE_C_OUTPUT_EXTENSION .o) +else() + set(CMAKE_C_OUTPUT_EXTENSION .obj) +endif() -SET(_INCLUDED_FILE 0) +set(_INCLUDED_FILE 0) # Load compiler-specific information. -IF(CMAKE_C_COMPILER_ID) - INCLUDE(Compiler/${CMAKE_C_COMPILER_ID}-C OPTIONAL) -ENDIF(CMAKE_C_COMPILER_ID) +if(CMAKE_C_COMPILER_ID) + include(Compiler/${CMAKE_C_COMPILER_ID}-C OPTIONAL) +endif() -SET(CMAKE_BASE_NAME) -GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_C_COMPILER} NAME_WE) -IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_BASE_NAME gcc) -ENDIF(CMAKE_COMPILER_IS_GNUCC) +set(CMAKE_BASE_NAME) +get_filename_component(CMAKE_BASE_NAME ${CMAKE_C_COMPILER} NAME_WE) +if(CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_BASE_NAME gcc) +endif() # load a hardware specific file, mostly useful for embedded compilers -IF(CMAKE_SYSTEM_PROCESSOR) - IF(CMAKE_C_COMPILER_ID) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-C-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) - ENDIF(CMAKE_C_COMPILER_ID) - IF (NOT _INCLUDED_FILE) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL) - ENDIF (NOT _INCLUDED_FILE) -ENDIF(CMAKE_SYSTEM_PROCESSOR) +if(CMAKE_SYSTEM_PROCESSOR) + if(CMAKE_C_COMPILER_ID) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-C-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) + endif() + if (NOT _INCLUDED_FILE) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL) + endif () +endif() # load the system- and compiler specific files -IF(CMAKE_C_COMPILER_ID) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-C +if(CMAKE_C_COMPILER_ID) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-C OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) -ENDIF(CMAKE_C_COMPILER_ID) -IF (NOT _INCLUDED_FILE) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} +endif() +if (NOT _INCLUDED_FILE) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) -ENDIF (NOT _INCLUDED_FILE) +endif () # We specify the compiler information in the system file for some # platforms, but this language may not have been enabled when the file # was first included. Include it again to get the language info. # Remove this when all compiler info is removed from system files. -IF (NOT _INCLUDED_FILE) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL) -ENDIF (NOT _INCLUDED_FILE) +if (NOT _INCLUDED_FILE) + include(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL) +endif () -IF(CMAKE_C_SIZEOF_DATA_PTR) - FOREACH(f ${CMAKE_C_ABI_FILES}) - INCLUDE(${f}) - ENDFOREACH() - UNSET(CMAKE_C_ABI_FILES) -ENDIF() +if(CMAKE_C_SIZEOF_DATA_PTR) + foreach(f ${CMAKE_C_ABI_FILES}) + include(${f}) + endforeach() + unset(CMAKE_C_ABI_FILES) +endif() # This should be included before the _INIT variables are -# used to initialize the cache. Since the rule variables +# used to initialize the cache. Since the rule variables # have if blocks on them, users can still define them here. # But, it should still be after the platform file so changes can # be made to those values. -IF(CMAKE_USER_MAKE_RULES_OVERRIDE) +if(CMAKE_USER_MAKE_RULES_OVERRIDE) # Save the full path of the file so try_compile can use it. - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override) - SET(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}") -ENDIF() + include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override) + set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}") +endif() -IF(CMAKE_USER_MAKE_RULES_OVERRIDE_C) +if(CMAKE_USER_MAKE_RULES_OVERRIDE_C) # Save the full path of the file so try_compile can use it. - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_C} RESULT_VARIABLE _override) - SET(CMAKE_USER_MAKE_RULES_OVERRIDE_C "${_override}") -ENDIF() + include(${CMAKE_USER_MAKE_RULES_OVERRIDE_C} RESULT_VARIABLE _override) + set(CMAKE_USER_MAKE_RULES_OVERRIDE_C "${_override}") +endif() # for most systems a module is the same as a shared library # so unless the variable CMAKE_MODULE_EXISTS is set just # copy the values from the LIBRARY variables -IF(NOT CMAKE_MODULE_EXISTS) - SET(CMAKE_SHARED_MODULE_C_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) - SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_MODULE_EXISTS) - -SET(CMAKE_C_FLAGS_INIT "$ENV{CFLAGS} ${CMAKE_C_FLAGS_INIT}") -# avoid just having a space as the initial value for the cache -IF(CMAKE_C_FLAGS_INIT STREQUAL " ") - SET(CMAKE_C_FLAGS_INIT) -ENDIF(CMAKE_C_FLAGS_INIT STREQUAL " ") -SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_INIT}" CACHE STRING +if(NOT CMAKE_MODULE_EXISTS) + set(CMAKE_SHARED_MODULE_C_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) + set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) +endif() + +set(CMAKE_C_FLAGS_INIT "$ENV{CFLAGS} ${CMAKE_C_FLAGS_INIT}") +# avoid just having a space as the initial value for the cache +if(CMAKE_C_FLAGS_INIT STREQUAL " ") + set(CMAKE_C_FLAGS_INIT) +endif() +set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_INIT}" CACHE STRING "Flags used by the compiler during all build types.") -IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) +if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) # default build type is none - IF(NOT CMAKE_NO_BUILD_TYPE) - SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING + if(NOT CMAKE_NO_BUILD_TYPE) + set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") - ENDIF(NOT CMAKE_NO_BUILD_TYPE) - SET (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG_INIT}" CACHE STRING + endif() + set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG_INIT}" CACHE STRING "Flags used by the compiler during debug builds.") - SET (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL_INIT}" CACHE STRING + set (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL_INIT}" CACHE STRING "Flags used by the compiler during release minsize builds.") - SET (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE_INIT}" CACHE STRING + set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE_INIT}" CACHE STRING "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).") - SET (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING + set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING "Flags used by the compiler during Release with Debug Info builds.") -ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) +endif() -IF(CMAKE_C_STANDARD_LIBRARIES_INIT) - SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES_INIT}" +if(CMAKE_C_STANDARD_LIBRARIES_INIT) + set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES_INIT}" CACHE STRING "Libraries linked by defalut with all C applications.") - MARK_AS_ADVANCED(CMAKE_C_STANDARD_LIBRARIES) -ENDIF(CMAKE_C_STANDARD_LIBRARIES_INIT) + mark_as_advanced(CMAKE_C_STANDARD_LIBRARIES) +endif() -INCLUDE(CMakeCommonLanguageInclude) +include(CMakeCommonLanguageInclude) # now define the following rule variables @@ -151,69 +151,69 @@ INCLUDE(CMakeCommonLanguageInclude) # # C compiler information -# +# # # # # Static library tools -# +# # # create a C shared library -IF(NOT CMAKE_C_CREATE_SHARED_LIBRARY) - SET(CMAKE_C_CREATE_SHARED_LIBRARY +if(NOT CMAKE_C_CREATE_SHARED_LIBRARY) + set(CMAKE_C_CREATE_SHARED_LIBRARY " -o ") -ENDIF(NOT CMAKE_C_CREATE_SHARED_LIBRARY) +endif() # create a C shared module just copy the shared library rule -IF(NOT CMAKE_C_CREATE_SHARED_MODULE) - SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_LIBRARY}) -ENDIF(NOT CMAKE_C_CREATE_SHARED_MODULE) +if(NOT CMAKE_C_CREATE_SHARED_MODULE) + set(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_LIBRARY}) +endif() # Create a static archive incrementally for large object file counts. # If CMAKE_C_CREATE_STATIC_LIBRARY is set it will override these. -IF(NOT DEFINED CMAKE_C_ARCHIVE_CREATE) - SET(CMAKE_C_ARCHIVE_CREATE " cr ") -ENDIF() -IF(NOT DEFINED CMAKE_C_ARCHIVE_APPEND) - SET(CMAKE_C_ARCHIVE_APPEND " r ") -ENDIF() -IF(NOT DEFINED CMAKE_C_ARCHIVE_FINISH) - SET(CMAKE_C_ARCHIVE_FINISH " ") -ENDIF() +if(NOT DEFINED CMAKE_C_ARCHIVE_CREATE) + set(CMAKE_C_ARCHIVE_CREATE " cr ") +endif() +if(NOT DEFINED CMAKE_C_ARCHIVE_APPEND) + set(CMAKE_C_ARCHIVE_APPEND " r ") +endif() +if(NOT DEFINED CMAKE_C_ARCHIVE_FINISH) + set(CMAKE_C_ARCHIVE_FINISH " ") +endif() # compile a C file into an object file -IF(NOT CMAKE_C_COMPILE_OBJECT) - SET(CMAKE_C_COMPILE_OBJECT +if(NOT CMAKE_C_COMPILE_OBJECT) + set(CMAKE_C_COMPILE_OBJECT " -o -c ") -ENDIF(NOT CMAKE_C_COMPILE_OBJECT) +endif() -IF(NOT CMAKE_C_LINK_EXECUTABLE) - SET(CMAKE_C_LINK_EXECUTABLE +if(NOT CMAKE_C_LINK_EXECUTABLE) + set(CMAKE_C_LINK_EXECUTABLE " -o ") -ENDIF(NOT CMAKE_C_LINK_EXECUTABLE) +endif() -IF(NOT CMAKE_EXECUTABLE_RUNTIME_C_FLAG) - SET(CMAKE_EXECUTABLE_RUNTIME_C_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_C_FLAG) +if(NOT CMAKE_EXECUTABLE_RUNTIME_C_FLAG) + set(CMAKE_EXECUTABLE_RUNTIME_C_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) +endif() -IF(NOT CMAKE_EXECUTABLE_RUNTIME_C_FLAG_SEP) - SET(CMAKE_EXECUTABLE_RUNTIME_C_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_C_FLAG_SEP) +if(NOT CMAKE_EXECUTABLE_RUNTIME_C_FLAG_SEP) + set(CMAKE_EXECUTABLE_RUNTIME_C_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) +endif() -IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_C_FLAG) - SET(CMAKE_EXECUTABLE_RPATH_LINK_C_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RPATH_LINK_C_FLAG) +if(NOT CMAKE_EXECUTABLE_RPATH_LINK_C_FLAG) + set(CMAKE_EXECUTABLE_RPATH_LINK_C_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) +endif() -MARK_AS_ADVANCED( +mark_as_advanced( CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO ) -SET(CMAKE_C_INFORMATION_LOADED 1) +set(CMAKE_C_INFORMATION_LOADED 1) diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 5b6376a32..9287b8194 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -1,54 +1,57 @@ -SET(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@") -SET(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@") -SET(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@") -SET(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@") -SET(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@") +set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@") +set(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@") +set(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@") +set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@") +set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@") @SET_MSVC_CXX_ARCHITECTURE_ID@ -SET(CMAKE_AR "@CMAKE_AR@") -SET(CMAKE_RANLIB "@CMAKE_RANLIB@") -SET(CMAKE_LINKER "@CMAKE_LINKER@") -SET(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@) -SET(CMAKE_CXX_COMPILER_LOADED 1) -SET(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) -SET(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@) -IF(CMAKE_COMPILER_IS_CYGWIN) - SET(CYGWIN 1) - SET(UNIX 1) -ENDIF(CMAKE_COMPILER_IS_CYGWIN) - -SET(CMAKE_CXX_COMPILER_ENV_VAR "CXX") - -IF(CMAKE_COMPILER_IS_MINGW) - SET(MINGW 1) -ENDIF(CMAKE_COMPILER_IS_MINGW) -SET(CMAKE_CXX_COMPILER_ID_RUN 1) -SET(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) -SET(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP) -SET(CMAKE_CXX_LINKER_PREFERENCE 30) -SET(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) +set(CMAKE_AR "@CMAKE_AR@") +set(CMAKE_RANLIB "@CMAKE_RANLIB@") +set(CMAKE_LINKER "@CMAKE_LINKER@") +set(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS @CMAKE_CXX_COMPILER_WORKS@) +set(CMAKE_CXX_ABI_COMPILED @CMAKE_CXX_ABI_COMPILED@) +set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) +set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP) +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) # Save compiler ABI information. -SET(CMAKE_CXX_SIZEOF_DATA_PTR "@CMAKE_CXX_SIZEOF_DATA_PTR@") -SET(CMAKE_CXX_COMPILER_ABI "@CMAKE_CXX_COMPILER_ABI@") -SET(CMAKE_CXX_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@") +set(CMAKE_CXX_SIZEOF_DATA_PTR "@CMAKE_CXX_SIZEOF_DATA_PTR@") +set(CMAKE_CXX_COMPILER_ABI "@CMAKE_CXX_COMPILER_ABI@") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@") -IF(CMAKE_CXX_SIZEOF_DATA_PTR) - SET(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") -ENDIF(CMAKE_CXX_SIZEOF_DATA_PTR) +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() -IF(CMAKE_CXX_COMPILER_ABI) - SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") -ENDIF(CMAKE_CXX_COMPILER_ABI) +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() -IF(CMAKE_CXX_LIBRARY_ARCHITECTURE) - SET(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@") -ENDIF() +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@") +endif() -SET(CMAKE_CXX_HAS_ISYSROOT "@CMAKE_CXX_HAS_ISYSROOT@") +@CMAKE_CXX_SYSROOT_FLAG_CODE@ @CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ -SET(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@") -SET(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@") @SET_CMAKE_CMCLDEPS_EXECUTABLE@ @SET_CMAKE_CL_SHOWINCLUDE_PREFIX@ diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 95fc852d6..5e70a4196 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -10,6 +10,9 @@ #if defined(__COMO__) # define COMPILER_ID "Comeau" + /* __COMO_VERSION__ = VRR */ +# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) +# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) #elif defined(__INTEL_COMPILER) || defined(__ICC) # define COMPILER_ID "Intel" @@ -22,6 +25,14 @@ # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) # endif +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + #elif defined(__clang__) # define COMPILER_ID "Clang" # define COMPILER_VERSION_MAJOR DEC(__clang_major__) @@ -69,6 +80,10 @@ #elif defined(__DECCXX) # define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) #elif defined(__IBMCPP__) # if defined(__COMPILER_VER__) @@ -93,14 +108,17 @@ # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) # endif -#elif defined(__PATHSCALE__) -# define COMPILER_ID "PathScale" - #elif defined(_CRAYC) # define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) #elif defined(__TI_COMPILER_VERSION__) # define COMPILER_ID "TI_DSP" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) #elif defined(__SCO_VERSION__) # define COMPILER_ID "SCO" @@ -131,9 +149,16 @@ # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) # endif +/* Analog VisualDSP++ >= 4.5.6 */ +#elif defined(__VISUALDSPVERSION__) +# define COMPILER_ID "ADSP" + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) + +/* Analog VisualDSP++ < 4.5.6 */ #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) -/* Analog Devices C++ compiler for Blackfin, TigerSHARC and - SHARC (21000) DSPs */ # define COMPILER_ID "ADSP" #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 9dc9cbd30..933c15a82 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -20,210 +20,210 @@ # some compilers use different extensions (e.g. sdcc uses .rel) # so set the extension here first so it can be overridden by the compiler specific file -IF(UNIX) - SET(CMAKE_CXX_OUTPUT_EXTENSION .o) -ELSE(UNIX) - SET(CMAKE_CXX_OUTPUT_EXTENSION .obj) -ENDIF(UNIX) +if(UNIX) + set(CMAKE_CXX_OUTPUT_EXTENSION .o) +else() + set(CMAKE_CXX_OUTPUT_EXTENSION .obj) +endif() -SET(_INCLUDED_FILE 0) +set(_INCLUDED_FILE 0) # Load compiler-specific information. -IF(CMAKE_CXX_COMPILER_ID) - INCLUDE(Compiler/${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL) -ENDIF(CMAKE_CXX_COMPILER_ID) +if(CMAKE_CXX_COMPILER_ID) + include(Compiler/${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL) +endif() -SET(CMAKE_BASE_NAME) -GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER} NAME_WE) +set(CMAKE_BASE_NAME) +get_filename_component(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER} NAME_WE) # since the gnu compiler has several names force g++ -IF(CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_BASE_NAME g++) -ENDIF(CMAKE_COMPILER_IS_GNUCXX) +if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_BASE_NAME g++) +endif() # load a hardware specific file, mostly useful for embedded compilers -IF(CMAKE_SYSTEM_PROCESSOR) - IF(CMAKE_CXX_COMPILER_ID) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-CXX-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) - ENDIF(CMAKE_CXX_COMPILER_ID) - IF (NOT _INCLUDED_FILE) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL) - ENDIF (NOT _INCLUDED_FILE) -ENDIF(CMAKE_SYSTEM_PROCESSOR) +if(CMAKE_SYSTEM_PROCESSOR) + if(CMAKE_CXX_COMPILER_ID) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-CXX-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) + endif() + if (NOT _INCLUDED_FILE) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL) + endif () +endif() # load the system- and compiler specific files -IF(CMAKE_CXX_COMPILER_ID) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) -ENDIF(CMAKE_CXX_COMPILER_ID) -IF (NOT _INCLUDED_FILE) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL +if(CMAKE_CXX_COMPILER_ID) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() +if (NOT _INCLUDED_FILE) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) -ENDIF (NOT _INCLUDED_FILE) +endif () # We specify the compiler information in the system file for some # platforms, but this language may not have been enabled when the file # was first included. Include it again to get the language info. # Remove this when all compiler info is removed from system files. -IF (NOT _INCLUDED_FILE) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL) -ENDIF (NOT _INCLUDED_FILE) +if (NOT _INCLUDED_FILE) + include(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL) +endif () -IF(CMAKE_CXX_SIZEOF_DATA_PTR) - FOREACH(f ${CMAKE_CXX_ABI_FILES}) - INCLUDE(${f}) - ENDFOREACH() - UNSET(CMAKE_CXX_ABI_FILES) -ENDIF() +if(CMAKE_CXX_SIZEOF_DATA_PTR) + foreach(f ${CMAKE_CXX_ABI_FILES}) + include(${f}) + endforeach() + unset(CMAKE_CXX_ABI_FILES) +endif() # This should be included before the _INIT variables are -# used to initialize the cache. Since the rule variables +# used to initialize the cache. Since the rule variables # have if blocks on them, users can still define them here. # But, it should still be after the platform file so changes can # be made to those values. -IF(CMAKE_USER_MAKE_RULES_OVERRIDE) +if(CMAKE_USER_MAKE_RULES_OVERRIDE) # Save the full path of the file so try_compile can use it. - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override) - SET(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}") -ENDIF() + include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override) + set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}") +endif() -IF(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX) +if(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX) # Save the full path of the file so try_compile can use it. - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX} RESULT_VARIABLE _override) - SET(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX "${_override}") -ENDIF() + include(${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX} RESULT_VARIABLE _override) + set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX "${_override}") +endif() # Create a set of shared library variable specific to C++ # For 90% of the systems, these are the same flags as the C versions # so if these are not set just copy the flags from the c version -IF(NOT CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS) - SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS) +if(NOT CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS) + set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) +endif() -IF(NOT CMAKE_CXX_COMPILE_OPTIONS_PIC) - SET(CMAKE_CXX_COMPILE_OPTIONS_PIC ${CMAKE_C_COMPILE_OPTIONS_PIC}) -ENDIF(NOT CMAKE_CXX_COMPILE_OPTIONS_PIC) +if(NOT CMAKE_CXX_COMPILE_OPTIONS_PIC) + set(CMAKE_CXX_COMPILE_OPTIONS_PIC ${CMAKE_C_COMPILE_OPTIONS_PIC}) +endif() -IF(NOT CMAKE_CXX_COMPILE_OPTIONS_PIE) - SET(CMAKE_CXX_COMPILE_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE}) -ENDIF(NOT CMAKE_CXX_COMPILE_OPTIONS_PIE) +if(NOT CMAKE_CXX_COMPILE_OPTIONS_PIE) + set(CMAKE_CXX_COMPILE_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE}) +endif() -IF(NOT CMAKE_CXX_COMPILE_OPTIONS_DLL) - SET(CMAKE_CXX_COMPILE_OPTIONS_DLL ${CMAKE_C_COMPILE_OPTIONS_DLL}) -ENDIF(NOT CMAKE_CXX_COMPILE_OPTIONS_DLL) +if(NOT CMAKE_CXX_COMPILE_OPTIONS_DLL) + set(CMAKE_CXX_COMPILE_OPTIONS_DLL ${CMAKE_C_COMPILE_OPTIONS_DLL}) +endif() -IF(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS) - SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS) +if(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS) + set(CMAKE_SHARED_LIBRARY_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) +endif() -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) - SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) -ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) +if(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) + set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) +endif() -IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG) +if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG) + set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) +endif() -IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP) +if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP) + set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) +endif() -IF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG) - SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG) +if(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG) + set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) +endif() -IF(NOT DEFINED CMAKE_EXE_EXPORTS_CXX_FLAG) - SET(CMAKE_EXE_EXPORTS_CXX_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG}) -ENDIF() +if(NOT DEFINED CMAKE_EXE_EXPORTS_CXX_FLAG) + set(CMAKE_EXE_EXPORTS_CXX_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG}) +endif() -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG) - SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG}) -ENDIF() +if(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG) + set(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG}) +endif() -IF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG) - SET(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG) +if(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG) + set(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}) +endif() -IF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG_SEP) - SET(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG_SEP) +if(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG_SEP) + set(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP}) +endif() -IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG) - SET(CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG) +if(NOT CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG) + set(CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG}) +endif() -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_WITH_RUNTIME_PATH) - SET(CMAKE_SHARED_LIBRARY_LINK_CXX_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH}) -ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_WITH_RUNTIME_PATH) +if(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_WITH_RUNTIME_PATH) + set(CMAKE_SHARED_LIBRARY_LINK_CXX_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH}) +endif() -IF(NOT CMAKE_INCLUDE_FLAG_CXX) - SET(CMAKE_INCLUDE_FLAG_CXX ${CMAKE_INCLUDE_FLAG_C}) -ENDIF(NOT CMAKE_INCLUDE_FLAG_CXX) +if(NOT CMAKE_INCLUDE_FLAG_CXX) + set(CMAKE_INCLUDE_FLAG_CXX ${CMAKE_INCLUDE_FLAG_C}) +endif() -IF(NOT CMAKE_INCLUDE_FLAG_SEP_CXX) - SET(CMAKE_INCLUDE_FLAG_SEP_CXX ${CMAKE_INCLUDE_FLAG_SEP_C}) -ENDIF(NOT CMAKE_INCLUDE_FLAG_SEP_CXX) +if(NOT CMAKE_INCLUDE_FLAG_SEP_CXX) + set(CMAKE_INCLUDE_FLAG_SEP_CXX ${CMAKE_INCLUDE_FLAG_SEP_C}) +endif() # for most systems a module is the same as a shared library # so unless the variable CMAKE_MODULE_EXISTS is set just # copy the values from the LIBRARY variables -IF(NOT CMAKE_MODULE_EXISTS) - SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) - SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS}) -ENDIF(NOT CMAKE_MODULE_EXISTS) +if(NOT CMAKE_MODULE_EXISTS) + set(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) + set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS}) +endif() # repeat for modules -IF(NOT CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS) - SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS) +if(NOT CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS) + set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) +endif() -IF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS) - SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS) +if(NOT CMAKE_SHARED_MODULE_CXX_FLAGS) + set(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) +endif() # Initialize CXX link type selection flags from C versions. -FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - IF(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS) - SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + if(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS) + set(CMAKE_${type}_LINK_STATIC_CXX_FLAGS ${CMAKE_${type}_LINK_STATIC_C_FLAGS}) - ENDIF(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS) - IF(NOT CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS) - SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS + endif() + if(NOT CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS) + set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS ${CMAKE_${type}_LINK_DYNAMIC_C_FLAGS}) - ENDIF(NOT CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS) -ENDFOREACH(type) + endif() +endforeach() # add the flags to the cache based # on the initial values computed in the platform/*.cmake files # use _INIT variables so that this only happens the first time # and you can set these flags in the cmake cache -SET(CMAKE_CXX_FLAGS_INIT "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}") -# avoid just having a space as the initial value for the cache -IF(CMAKE_CXX_FLAGS_INIT STREQUAL " ") - SET(CMAKE_CXX_FLAGS_INIT) -ENDIF(CMAKE_CXX_FLAGS_INIT STREQUAL " ") -SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT}" CACHE STRING +set(CMAKE_CXX_FLAGS_INIT "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}") +# avoid just having a space as the initial value for the cache +if(CMAKE_CXX_FLAGS_INIT STREQUAL " ") + set(CMAKE_CXX_FLAGS_INIT) +endif() +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT}" CACHE STRING "Flags used by the compiler during all build types.") -IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) - SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT}" CACHE STRING +if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) + set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT}" CACHE STRING "Flags used by the compiler during debug builds.") - SET (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT}" CACHE STRING + set (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT}" CACHE STRING "Flags used by the compiler during release minsize builds.") - SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_INIT}" CACHE STRING + set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_INIT}" CACHE STRING "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING + set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING "Flags used by the compiler during Release with Debug Info builds.") -ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) +endif() -IF(CMAKE_CXX_STANDARD_LIBRARIES_INIT) - SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES_INIT}" +if(CMAKE_CXX_STANDARD_LIBRARIES_INIT) + set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES_INIT}" CACHE STRING "Libraries linked by defalut with all C++ applications.") - MARK_AS_ADVANCED(CMAKE_CXX_STANDARD_LIBRARIES) -ENDIF(CMAKE_CXX_STANDARD_LIBRARIES_INIT) + mark_as_advanced(CMAKE_CXX_STANDARD_LIBRARIES) +endif() -INCLUDE(CMakeCommonLanguageInclude) +include(CMakeCommonLanguageInclude) # now define the following rules: # CMAKE_CXX_CREATE_SHARED_LIBRARY @@ -241,59 +241,59 @@ INCLUDE(CMakeCommonLanguageInclude) # # CXX compiler information -# +# # # # # Static library tools -# +# # # create a shared C++ library -IF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY) - SET(CMAKE_CXX_CREATE_SHARED_LIBRARY +if(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY) + set(CMAKE_CXX_CREATE_SHARED_LIBRARY " -o ") -ENDIF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY) +endif() # create a c++ shared module copy the shared library rule by default -IF(NOT CMAKE_CXX_CREATE_SHARED_MODULE) - SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) -ENDIF(NOT CMAKE_CXX_CREATE_SHARED_MODULE) +if(NOT CMAKE_CXX_CREATE_SHARED_MODULE) + set(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) +endif() # Create a static archive incrementally for large object file counts. # If CMAKE_CXX_CREATE_STATIC_LIBRARY is set it will override these. -IF(NOT DEFINED CMAKE_CXX_ARCHIVE_CREATE) - SET(CMAKE_CXX_ARCHIVE_CREATE " cr ") -ENDIF() -IF(NOT DEFINED CMAKE_CXX_ARCHIVE_APPEND) - SET(CMAKE_CXX_ARCHIVE_APPEND " r ") -ENDIF() -IF(NOT DEFINED CMAKE_CXX_ARCHIVE_FINISH) - SET(CMAKE_CXX_ARCHIVE_FINISH " ") -ENDIF() +if(NOT DEFINED CMAKE_CXX_ARCHIVE_CREATE) + set(CMAKE_CXX_ARCHIVE_CREATE " cr ") +endif() +if(NOT DEFINED CMAKE_CXX_ARCHIVE_APPEND) + set(CMAKE_CXX_ARCHIVE_APPEND " r ") +endif() +if(NOT DEFINED CMAKE_CXX_ARCHIVE_FINISH) + set(CMAKE_CXX_ARCHIVE_FINISH " ") +endif() # compile a C++ file into an object file -IF(NOT CMAKE_CXX_COMPILE_OBJECT) - SET(CMAKE_CXX_COMPILE_OBJECT +if(NOT CMAKE_CXX_COMPILE_OBJECT) + set(CMAKE_CXX_COMPILE_OBJECT " -o -c ") -ENDIF(NOT CMAKE_CXX_COMPILE_OBJECT) +endif() -IF(NOT CMAKE_CXX_LINK_EXECUTABLE) - SET(CMAKE_CXX_LINK_EXECUTABLE +if(NOT CMAKE_CXX_LINK_EXECUTABLE) + set(CMAKE_CXX_LINK_EXECUTABLE " -o ") -ENDIF(NOT CMAKE_CXX_LINK_EXECUTABLE) +endif() -MARK_AS_ADVANCED( +mark_as_advanced( CMAKE_BUILD_TOOL -CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_DEBUG) -SET(CMAKE_CXX_INFORMATION_LOADED 1) +set(CMAKE_CXX_INFORMATION_LOADED 1) diff --git a/Modules/CMakeClDeps.cmake b/Modules/CMakeClDeps.cmake index 6815e2b75..0214ead2b 100644 --- a/Modules/CMakeClDeps.cmake +++ b/Modules/CMakeClDeps.cmake @@ -20,18 +20,15 @@ # in front of each include path, so it can remove it. # -IF(MSVC_C_ARCHITECTURE_ID AND CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_C_COMPILER AND CMAKE_COMMAND) - STRING(REPLACE "cmake.exe" "cmcldeps.exe" CMAKE_CMCLDEPS_EXECUTABLE ${CMAKE_COMMAND}) - SET(showdir ${CMAKE_BINARY_DIR}/CMakeFiles/ShowIncludes) - FILE(WRITE ${showdir}/foo.h "\n") - FILE(WRITE ${showdir}/main.c "#include \"foo.h\" \nint main(){}\n") - EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} /nologo /showIncludes ${showdir}/main.c - WORKING_DIRECTORY ${showdir} OUTPUT_VARIABLE showOut) - STRING(REPLACE main.c "" showOut1 ${showOut}) - STRING(REPLACE "/" "\\" header1 ${showdir}/foo.h) - STRING(TOLOWER ${header1} header2) - STRING(REPLACE ${header2} "" showOut2 ${showOut1}) - STRING(REPLACE "\n" "" showOut3 ${showOut2}) - SET(SET_CMAKE_CMCLDEPS_EXECUTABLE "SET(CMAKE_CMCLDEPS_EXECUTABLE \"${CMAKE_CMCLDEPS_EXECUTABLE}\")") - SET(SET_CMAKE_CL_SHOWINCLUDE_PREFIX "SET(CMAKE_CL_SHOWINCLUDE_PREFIX \"${showOut3}\")") -ENDIF() +if(MSVC_C_ARCHITECTURE_ID AND CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_C_COMPILER AND CMAKE_COMMAND) + string(REPLACE "cmake.exe" "cmcldeps.exe" CMAKE_CMCLDEPS_EXECUTABLE ${CMAKE_COMMAND}) + set(showdir ${CMAKE_BINARY_DIR}/CMakeFiles/ShowIncludes) + file(WRITE ${showdir}/foo.h "\n") + file(WRITE ${showdir}/main.c "#include \"foo.h\" \nint main(){}\n") + execute_process(COMMAND ${CMAKE_C_COMPILER} /nologo /showIncludes ${showdir}/main.c + WORKING_DIRECTORY ${showdir} OUTPUT_VARIABLE outLine) + string(REGEX MATCH "\n([^:]*:[^:]*:[ \t]*)" tmp "${outLine}") + set(localizedPrefix "${CMAKE_MATCH_1}") + set(SET_CMAKE_CMCLDEPS_EXECUTABLE "set(CMAKE_CMCLDEPS_EXECUTABLE \"${CMAKE_CMCLDEPS_EXECUTABLE}\")") + set(SET_CMAKE_CL_SHOWINCLUDE_PREFIX "set(CMAKE_CL_SHOWINCLUDE_PREFIX \"${localizedPrefix}\")") +endif() diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake index a2929f1ea..bf94f9ff6 100644 --- a/Modules/CMakeCommonLanguageInclude.cmake +++ b/Modules/CMakeCommonLanguageInclude.cmake @@ -16,74 +16,74 @@ # cache values that can be initialized in the platform-compiler.cmake file # it may be included by more than one language. -SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" +set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" CACHE STRING "Flags used by the linker.") -IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) +if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) # default build type is none - IF(NOT CMAKE_NO_BUILD_TYPE) - SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING + if(NOT CMAKE_NO_BUILD_TYPE) + set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") - ENDIF(NOT CMAKE_NO_BUILD_TYPE) - - SET (CMAKE_EXE_LINKER_FLAGS_DEBUG ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT} CACHE STRING + endif() + + set (CMAKE_EXE_LINKER_FLAGS_DEBUG ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT} CACHE STRING "Flags used by the linker during debug builds.") - SET (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT} CACHE STRING + set (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT} CACHE STRING "Flags used by the linker during release minsize builds.") - SET (CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT} CACHE STRING + set (CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT} CACHE STRING "Flags used by the linker during release builds.") - SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO + set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING "Flags used by the linker during Release with Debug Info builds.") - - SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT} CACHE STRING + + set (CMAKE_SHARED_LINKER_FLAGS_DEBUG ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT} CACHE STRING "Flags used by the linker during debug builds.") - SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL ${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT} + set (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL ${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT} CACHE STRING "Flags used by the linker during release minsize builds.") - SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT} CACHE STRING + set (CMAKE_SHARED_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT} CACHE STRING "Flags used by the linker during release builds.") - SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO + set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING "Flags used by the linker during Release with Debug Info builds.") - SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG ${CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT} CACHE STRING + set (CMAKE_MODULE_LINKER_FLAGS_DEBUG ${CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT} CACHE STRING "Flags used by the linker during debug builds.") - SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL ${CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT} + set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL ${CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT} CACHE STRING "Flags used by the linker during release minsize builds.") - SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE ${CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT} CACHE STRING + set (CMAKE_MODULE_LINKER_FLAGS_RELEASE ${CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT} CACHE STRING "Flags used by the linker during release builds.") - SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO + set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING "Flags used by the linker during Release with Debug Info builds.") -ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) +endif() # shared linker flags -SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" +set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" CACHE STRING "Flags used by the linker during the creation of dll's.") # module linker flags -SET (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" +set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" CACHE STRING "Flags used by the linker during the creation of modules.") -SET(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM} CACHE INTERNAL +set(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM} CACHE INTERNAL "What is the target build tool cmake is generating for.") -MARK_AS_ADVANCED( +mark_as_advanced( CMAKE_BUILD_TOOL -CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE CMAKE_EXE_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS_DEBUG diff --git a/Modules/CMakeDependentOption.cmake b/Modules/CMakeDependentOption.cmake index 8b8dc07fb..990728f9f 100644 --- a/Modules/CMakeDependentOption.cmake +++ b/Modules/CMakeDependentOption.cmake @@ -25,27 +25,27 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -MACRO(CMAKE_DEPENDENT_OPTION option doc default depends force) - IF(${option}_ISSET MATCHES "^${option}_ISSET$") - SET(${option}_AVAILABLE 1) - FOREACH(d ${depends}) - STRING(REGEX REPLACE " +" ";" CMAKE_DEPENDENT_OPTION_DEP "${d}") - IF(${CMAKE_DEPENDENT_OPTION_DEP}) - ELSE(${CMAKE_DEPENDENT_OPTION_DEP}) - SET(${option}_AVAILABLE 0) - ENDIF(${CMAKE_DEPENDENT_OPTION_DEP}) - ENDFOREACH(d) - IF(${option}_AVAILABLE) - OPTION(${option} "${doc}" "${default}") - SET(${option} "${${option}}" CACHE BOOL "${doc}" FORCE) - ELSE(${option}_AVAILABLE) - IF(${option} MATCHES "^${option}$") - ELSE(${option} MATCHES "^${option}$") - SET(${option} "${${option}}" CACHE INTERNAL "${doc}") - ENDIF(${option} MATCHES "^${option}$") - SET(${option} ${force}) - ENDIF(${option}_AVAILABLE) - ELSE(${option}_ISSET MATCHES "^${option}_ISSET$") - SET(${option} "${${option}_ISSET}") - ENDIF(${option}_ISSET MATCHES "^${option}_ISSET$") -ENDMACRO(CMAKE_DEPENDENT_OPTION) +macro(CMAKE_DEPENDENT_OPTION option doc default depends force) + if(${option}_ISSET MATCHES "^${option}_ISSET$") + set(${option}_AVAILABLE 1) + foreach(d ${depends}) + string(REGEX REPLACE " +" ";" CMAKE_DEPENDENT_OPTION_DEP "${d}") + if(${CMAKE_DEPENDENT_OPTION_DEP}) + else() + set(${option}_AVAILABLE 0) + endif() + endforeach() + if(${option}_AVAILABLE) + option(${option} "${doc}" "${default}") + set(${option} "${${option}}" CACHE BOOL "${doc}" FORCE) + else() + if(${option} MATCHES "^${option}$") + else() + set(${option} "${${option}}" CACHE INTERNAL "${doc}") + endif() + set(${option} ${force}) + endif() + else() + set(${option} "${${option}_ISSET}") + endif() +endmacro() diff --git a/Modules/CMakeDetermineASM-ATTCompiler.cmake b/Modules/CMakeDetermineASM-ATTCompiler.cmake index 9dd2f11de..cec09e985 100644 --- a/Modules/CMakeDetermineASM-ATTCompiler.cmake +++ b/Modules/CMakeDetermineASM-ATTCompiler.cmake @@ -14,7 +14,7 @@ # determine the compiler to use for ASM using AT&T syntax, e.g. GNU as -SET(ASM_DIALECT "-ATT") -SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}gas ${_CMAKE_TOOLCHAIN_PREFIX}as) -INCLUDE(CMakeDetermineASMCompiler) -SET(ASM_DIALECT) +set(ASM_DIALECT "-ATT") +set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}gas ${_CMAKE_TOOLCHAIN_PREFIX}as) +include(CMakeDetermineASMCompiler) +set(ASM_DIALECT) diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index 0a70d0a82..9f0b30ab4 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -14,52 +14,40 @@ # determine the compiler to use for ASM programs -IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER) +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) + +if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER) # prefer the environment variable ASM - IF($ENV{ASM${ASM_DIALECT}} MATCHES ".+") - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT "$ENV{ASM${ASM_DIALECT}}") - ENDIF($ENV{ASM${ASM_DIALECT}} MATCHES ".+") + if($ENV{ASM${ASM_DIALECT}} MATCHES ".+") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT "$ENV{ASM${ASM_DIALECT}}") + endif() # finally list compilers to try - IF("ASM${ASM_DIALECT}" STREQUAL "ASM") # the generic assembler support - - IF(CMAKE_ASM_COMPILER_INIT) - SET(CMAKE_ASM_COMPILER_LIST ${CMAKE_ASM_COMPILER_INIT}) - ELSE(CMAKE_ASM_COMPILER_INIT) - - IF(CMAKE_C_COMPILER) - SET(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "The ASM compiler") - SET(CMAKE_ASM_COMPILER_ID "${CMAKE_C_COMPILER_ID}") - ELSEIF(CMAKE_CXX_COMPILER) - SET(CMAKE_ASM_COMPILER "${CMAKE_CXX_COMPILER}" CACHE FILEPATH "The ASM compiler") - SET(CMAKE_ASM_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}") - ELSE(CMAKE_CXX_COMPILER) + if("ASM${ASM_DIALECT}" STREQUAL "ASM") # the generic assembler support + if(NOT CMAKE_ASM_COMPILER_INIT) + if(CMAKE_C_COMPILER) + set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "The ASM compiler") + set(CMAKE_ASM_COMPILER_ID "${CMAKE_C_COMPILER_ID}") + elseif(CMAKE_CXX_COMPILER) + set(CMAKE_ASM_COMPILER "${CMAKE_CXX_COMPILER}" CACHE FILEPATH "The ASM compiler") + set(CMAKE_ASM_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}") + else() # List all default C and CXX compilers - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc - ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ CC aCC cl bcc xlC) - ENDIF(CMAKE_C_COMPILER) - - ENDIF(CMAKE_ASM_COMPILER_INIT) - - - ELSE("ASM${ASM_DIALECT}" STREQUAL "ASM") # some specific assembler "dialect" - - IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT}) - ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) - MESSAGE(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT must be preset !") - ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) - - ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM") - + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST + ${_CMAKE_TOOLCHAIN_PREFIX}cc ${_CMAKE_TOOLCHAIN_PREFIX}gcc cl bcc xlc + CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC) + endif() + endif() + else() # some specific assembler "dialect" + if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) + message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT must be preset !") + endif() + endif() # Find the compiler. - IF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH) - FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} PATHS ${_CMAKE_USER_C_COMPILER_PATH} ${_CMAKE_USER_CXX_COMPILER_PATH} DOC "Assembler" NO_DEFAULT_PATH) - ENDIF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH) - FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} PATHS ${_CMAKE_TOOLCHAIN_LOCATION} DOC "Assembler") + _cmake_find_compiler(ASM${ASM_DIALECT}) -ELSE(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER) +else() # we only get here if CMAKE_ASM${ASM_DIALECT}_COMPILER was specified using -D or a pre-made CMakeCache.txt # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE @@ -68,63 +56,63 @@ ELSE(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER) # now try to find it with the full path # if it is found, force it into the cache, # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" - GET_FILENAME_COMPONENT(_CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH) - IF(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH) - FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER}) - MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH) - IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER ${CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH} CACHE FILEPATH "Assembler" FORCE) - ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH) - ENDIF(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH) -ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER) -MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_COMPILER) + get_filename_component(_CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH) + if(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH) + find_program(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER}) + mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH) + if(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER ${CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH} CACHE FILEPATH "Assembler" FORCE) + endif() + endif() +endif() +mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_COMPILER) -IF (NOT _CMAKE_TOOLCHAIN_LOCATION) - GET_FILENAME_COMPONENT(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH) -ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION) +if (NOT _CMAKE_TOOLCHAIN_LOCATION) + get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH) +endif () -IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) +if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) # Table of per-vendor compiler id flags with expected output. - LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU ) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version") - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "(GNU assembler)|(GCC)|(Free Software Foundation)") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU ) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "(GNU assembler)|(GCC)|(Free Software Foundation)") - LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS HP ) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_HP "-V") - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_HP "HP C") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS HP ) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_HP "-V") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_HP "HP C") - LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Intel ) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Intel "--version") - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Intel "(ICC)") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Intel ) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Intel "--version") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Intel "(ICC)") - LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS SunPro ) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_SunPro "-V") - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_SunPro "Sun C") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS SunPro ) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_SunPro "-V") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_SunPro "Sun C") - LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS XL ) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_XL "-qversion") - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_XL "XL C") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS XL ) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_XL "-qversion") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_XL "XL C") - LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS MSVC ) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_MSVC "/?") - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_MSVC "Microsoft") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS MSVC ) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_MSVC "/?") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_MSVC "Microsoft") - LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI_DSP ) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI_DSP "-h") - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI_DSP "Texas Instruments") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI_DSP ) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI_DSP "-h") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI_DSP "Texas Instruments") - INCLUDE(CMakeDetermineCompilerId) + include(CMakeDetermineCompilerId) CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT}) -ENDIF() +endif() -IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) - MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}") -ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) - MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown") -ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) +if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + message(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}") +else() + message(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown") +endif() @@ -135,48 +123,48 @@ ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) # NAME_WE cannot be used since then this test will fail for names lile # "arm-unknown-nto-qnx6.3.0-gas.exe", where BASENAME would be # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" -IF (NOT _CMAKE_TOOLCHAIN_PREFIX) - GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME) - IF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") - SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) - ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") -ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX) +if (NOT _CMAKE_TOOLCHAIN_PREFIX) + get_filename_component(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME) + if (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + endif () +endif () # Now try the C compiler regexp: -IF (NOT _CMAKE_TOOLCHAIN_PREFIX) - IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") - SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) - ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") -ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX) +if (NOT _CMAKE_TOOLCHAIN_PREFIX) + if (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + endif () +endif () # Finally try the CXX compiler regexp: -IF (NOT _CMAKE_TOOLCHAIN_PREFIX) - IF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") - SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) - ENDIF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") -ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX) +if (NOT _CMAKE_TOOLCHAIN_PREFIX) + if (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + endif () +endif () -INCLUDE(CMakeFindBinUtils) +include(CMakeFindBinUtils) -SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR "ASM${ASM_DIALECT}") +set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR "ASM${ASM_DIALECT}") -IF(CMAKE_ASM${ASM_DIALECT}_COMPILER) - MESSAGE(STATUS "Found assembler: ${CMAKE_ASM${ASM_DIALECT}_COMPILER}") -ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER) - MESSAGE(STATUS "Didn't find assembler") -ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER) +if(CMAKE_ASM${ASM_DIALECT}_COMPILER) + message(STATUS "Found assembler: ${CMAKE_ASM${ASM_DIALECT}_COMPILER}") +else() + message(STATUS "Didn't find assembler") +endif() -SET(_CMAKE_ASM_COMPILER "${CMAKE_ASM${ASM_DIALECT}_COMPILER}") -SET(_CMAKE_ASM_COMPILER_ID "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}") -SET(_CMAKE_ASM_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1}") -SET(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}") +set(_CMAKE_ASM_COMPILER "${CMAKE_ASM${ASM_DIALECT}_COMPILER}") +set(_CMAKE_ASM_COMPILER_ID "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}") +set(_CMAKE_ASM_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1}") +set(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}") # configure variables set in this file for fast reload later on -CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeASMCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeASM${ASM_DIALECT}Compiler.cmake IMMEDIATE @ONLY) +configure_file(${CMAKE_ROOT}/Modules/CMakeASMCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeASM${ASM_DIALECT}Compiler.cmake IMMEDIATE @ONLY) -SET(_CMAKE_ASM_COMPILER) -SET(_CMAKE_ASM_COMPILER_ARG1) -SET(_CMAKE_ASM_COMPILER_ENV_VAR) +set(_CMAKE_ASM_COMPILER) +set(_CMAKE_ASM_COMPILER_ARG1) +set(_CMAKE_ASM_COMPILER_ENV_VAR) diff --git a/Modules/CMakeDetermineASM_MASMCompiler.cmake b/Modules/CMakeDetermineASM_MASMCompiler.cmake index e23f7db4c..665a65cc5 100644 --- a/Modules/CMakeDetermineASM_MASMCompiler.cmake +++ b/Modules/CMakeDetermineASM_MASMCompiler.cmake @@ -14,14 +14,14 @@ # Find the MS assembler (masm or masm64) -SET(ASM_DIALECT "_MASM") +set(ASM_DIALECT "_MASM") # if we are using the 64bit cl compiler, assume we also want the 64bit assembler -IF(CMAKE_CL_64) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml64) -ELSE(CMAKE_CL_64) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml) -ENDIF(CMAKE_CL_64) +if(CMAKE_CL_64) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml64) +else() + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml) +endif() -INCLUDE(CMakeDetermineASMCompiler) -SET(ASM_DIALECT) +include(CMakeDetermineASMCompiler) +set(ASM_DIALECT) diff --git a/Modules/CMakeDetermineASM_NASMCompiler.cmake b/Modules/CMakeDetermineASM_NASMCompiler.cmake index d184c0a81..50f71dd8c 100644 --- a/Modules/CMakeDetermineASM_NASMCompiler.cmake +++ b/Modules/CMakeDetermineASM_NASMCompiler.cmake @@ -14,14 +14,14 @@ # Find the nasm assembler. yasm (http://www.tortall.net/projects/yasm/) is nasm compatible -SET(CMAKE_ASM_NASM_COMPILER_INIT nasm yasm) +set(CMAKE_ASM_NASM_COMPILER_INIT nasm yasm) -IF(NOT CMAKE_ASM_NASM_COMPILER) - FIND_PROGRAM(CMAKE_ASM_NASM_COMPILER nasm +if(NOT CMAKE_ASM_NASM_COMPILER) + find_program(CMAKE_ASM_NASM_COMPILER nasm "$ENV{ProgramFiles}/NASM") -ENDIF(NOT CMAKE_ASM_NASM_COMPILER) +endif() # Load the generic DetermineASM compiler file with the DIALECT set properly: -SET(ASM_DIALECT "_NASM") -INCLUDE(CMakeDetermineASMCompiler) -SET(ASM_DIALECT) +set(ASM_DIALECT "_NASM") +include(CMakeDetermineASMCompiler) +set(ASM_DIALECT) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 9028e8e06..275fc4758 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -31,114 +31,112 @@ # If not already set before, it also sets # _CMAKE_TOOLCHAIN_PREFIX -IF(NOT CMAKE_C_COMPILER) - SET(CMAKE_C_COMPILER_INIT NOTFOUND) - - # prefer the environment variable CC - IF($ENV{CC} MATCHES ".+") - GET_FILENAME_COMPONENT(CMAKE_C_COMPILER_INIT $ENV{CC} PROGRAM PROGRAM_ARGS CMAKE_C_FLAGS_ENV_INIT) - IF(CMAKE_C_FLAGS_ENV_INIT) - SET(CMAKE_C_COMPILER_ARG1 "${CMAKE_C_FLAGS_ENV_INIT}" CACHE STRING "First argument to C compiler") - ENDIF(CMAKE_C_FLAGS_ENV_INIT) - IF(NOT EXISTS ${CMAKE_C_COMPILER_INIT}) - MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable CC:\n$ENV{CC}.") - ENDIF(NOT EXISTS ${CMAKE_C_COMPILER_INIT}) - ENDIF($ENV{CC} MATCHES ".+") - - # next try prefer the compiler specified by the generator - IF(CMAKE_GENERATOR_CC) - IF(NOT CMAKE_C_COMPILER_INIT) - SET(CMAKE_C_COMPILER_INIT ${CMAKE_GENERATOR_CC}) - ENDIF(NOT CMAKE_C_COMPILER_INIT) - ENDIF(CMAKE_GENERATOR_CC) - - # finally list compilers to try - IF(CMAKE_C_COMPILER_INIT) - SET(CMAKE_C_COMPILER_LIST ${CMAKE_C_COMPILER_INIT}) - ELSE(CMAKE_C_COMPILER_INIT) - SET(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc) - ENDIF(CMAKE_C_COMPILER_INIT) - - # Find the compiler. - IF (_CMAKE_USER_CXX_COMPILER_PATH) - FIND_PROGRAM(CMAKE_C_COMPILER NAMES ${CMAKE_C_COMPILER_LIST} PATHS ${_CMAKE_USER_CXX_COMPILER_PATH} DOC "C compiler" NO_DEFAULT_PATH) - ENDIF (_CMAKE_USER_CXX_COMPILER_PATH) - FIND_PROGRAM(CMAKE_C_COMPILER NAMES ${CMAKE_C_COMPILER_LIST} DOC "C compiler") - - IF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER) - SET(CMAKE_C_COMPILER "${CMAKE_C_COMPILER_INIT}" CACHE FILEPATH "C compiler" FORCE) - ENDIF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER) -ELSE(NOT CMAKE_C_COMPILER) - - # we only get here if CMAKE_C_COMPILER was specified using -D or a pre-made CMakeCache.txt - # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE - # if CMAKE_C_COMPILER is a list of length 2, use the first item as - # CMAKE_C_COMPILER and the 2nd one as CMAKE_C_COMPILER_ARG1 - - LIST(LENGTH CMAKE_C_COMPILER _CMAKE_C_COMPILER_LIST_LENGTH) - IF("${_CMAKE_C_COMPILER_LIST_LENGTH}" EQUAL 2) - LIST(GET CMAKE_C_COMPILER 1 CMAKE_C_COMPILER_ARG1) - LIST(GET CMAKE_C_COMPILER 0 CMAKE_C_COMPILER) - ENDIF("${_CMAKE_C_COMPILER_LIST_LENGTH}" EQUAL 2) - - # if a compiler was specified by the user but without path, - # now try to find it with the full path - # if it is found, force it into the cache, - # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" - # if the C compiler already had a path, reuse it for searching the CXX compiler - GET_FILENAME_COMPONENT(_CMAKE_USER_C_COMPILER_PATH "${CMAKE_C_COMPILER}" PATH) - IF(NOT _CMAKE_USER_C_COMPILER_PATH) - FIND_PROGRAM(CMAKE_C_COMPILER_WITH_PATH NAMES ${CMAKE_C_COMPILER}) - MARK_AS_ADVANCED(CMAKE_C_COMPILER_WITH_PATH) - IF(CMAKE_C_COMPILER_WITH_PATH) - SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_WITH_PATH} CACHE STRING "C compiler" FORCE) - ENDIF(CMAKE_C_COMPILER_WITH_PATH) - ENDIF(NOT _CMAKE_USER_C_COMPILER_PATH) -ENDIF(NOT CMAKE_C_COMPILER) -MARK_AS_ADVANCED(CMAKE_C_COMPILER) - -IF (NOT _CMAKE_TOOLCHAIN_LOCATION) - GET_FILENAME_COMPONENT(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH) -ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION) - -# Build a small source file to identify the compiler. -IF(${CMAKE_GENERATOR} MATCHES "Visual Studio") - SET(CMAKE_C_COMPILER_ID_RUN 1) - SET(CMAKE_C_PLATFORM_ID "Windows") - SET(CMAKE_C_COMPILER_ID "MSVC") -ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio") - -IF(NOT CMAKE_C_COMPILER_ID_RUN) - SET(CMAKE_C_COMPILER_ID_RUN 1) +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) + +# Load system-specific compiler preferences for this language. +include(Platform/${CMAKE_SYSTEM_NAME}-C OPTIONAL) +if(NOT CMAKE_C_COMPILER_NAMES) + set(CMAKE_C_COMPILER_NAMES cc) +endif() + +if(${CMAKE_GENERATOR} MATCHES "Visual Studio") +elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") + set(CMAKE_C_COMPILER_XCODE_TYPE sourcecode.c.c) +else() + if(NOT CMAKE_C_COMPILER) + set(CMAKE_C_COMPILER_INIT NOTFOUND) + + # prefer the environment variable CC + if($ENV{CC} MATCHES ".+") + get_filename_component(CMAKE_C_COMPILER_INIT $ENV{CC} PROGRAM PROGRAM_ARGS CMAKE_C_FLAGS_ENV_INIT) + if(CMAKE_C_FLAGS_ENV_INIT) + set(CMAKE_C_COMPILER_ARG1 "${CMAKE_C_FLAGS_ENV_INIT}" CACHE STRING "First argument to C compiler") + endif() + if(NOT EXISTS ${CMAKE_C_COMPILER_INIT}) + message(FATAL_ERROR "Could not find compiler set in environment variable CC:\n$ENV{CC}.") + endif() + endif() + + # next try prefer the compiler specified by the generator + if(CMAKE_GENERATOR_CC) + if(NOT CMAKE_C_COMPILER_INIT) + set(CMAKE_C_COMPILER_INIT ${CMAKE_GENERATOR_CC}) + endif() + endif() + + # finally list compilers to try + if(NOT CMAKE_C_COMPILER_INIT) + set(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}cc ${_CMAKE_TOOLCHAIN_PREFIX}gcc cl bcc xlc clang) + endif() + + _cmake_find_compiler(C) + + else() + + # we only get here if CMAKE_C_COMPILER was specified using -D or a pre-made CMakeCache.txt + # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE + # if CMAKE_C_COMPILER is a list of length 2, use the first item as + # CMAKE_C_COMPILER and the 2nd one as CMAKE_C_COMPILER_ARG1 + + list(LENGTH CMAKE_C_COMPILER _CMAKE_C_COMPILER_LIST_LENGTH) + if("${_CMAKE_C_COMPILER_LIST_LENGTH}" EQUAL 2) + list(GET CMAKE_C_COMPILER 1 CMAKE_C_COMPILER_ARG1) + list(GET CMAKE_C_COMPILER 0 CMAKE_C_COMPILER) + endif() + + # if a compiler was specified by the user but without path, + # now try to find it with the full path + # if it is found, force it into the cache, + # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" + # if the C compiler already had a path, reuse it for searching the CXX compiler + get_filename_component(_CMAKE_USER_C_COMPILER_PATH "${CMAKE_C_COMPILER}" PATH) + if(NOT _CMAKE_USER_C_COMPILER_PATH) + find_program(CMAKE_C_COMPILER_WITH_PATH NAMES ${CMAKE_C_COMPILER}) + mark_as_advanced(CMAKE_C_COMPILER_WITH_PATH) + if(CMAKE_C_COMPILER_WITH_PATH) + set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_WITH_PATH} CACHE STRING "C compiler" FORCE) + endif() + endif() + endif() + mark_as_advanced(CMAKE_C_COMPILER) # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce # a valid identification file. - SET(CMAKE_C_COMPILER_ID_TEST_FLAGS + set(CMAKE_C_COMPILER_ID_TEST_FLAGS # Try compiling to an object file only. "-c" # Try enabling ANSI mode on HP. "-Aa" ) +endif() + +# Build a small source file to identify the compiler. +if(NOT CMAKE_C_COMPILER_ID_RUN) + set(CMAKE_C_COMPILER_ID_RUN 1) # Try to identify the compiler. - SET(CMAKE_C_COMPILER_ID) - FILE(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in + set(CMAKE_C_COMPILER_ID) + file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in CMAKE_C_COMPILER_ID_PLATFORM_CONTENT) - INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) CMAKE_DETERMINE_COMPILER_ID(C CFLAGS CMakeCCompilerId.c) # Set old compiler and platform id variables. - IF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") - SET(CMAKE_COMPILER_IS_GNUCC 1) - ENDIF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") - IF("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW") - SET(CMAKE_COMPILER_IS_MINGW 1) - ELSEIF("${CMAKE_C_PLATFORM_ID}" MATCHES "Cygwin") - SET(CMAKE_COMPILER_IS_CYGWIN 1) - ENDIF("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW") -ENDIF(NOT CMAKE_C_COMPILER_ID_RUN) + if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") + set(CMAKE_COMPILER_IS_GNUCC 1) + endif() + if("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW") + set(CMAKE_COMPILER_IS_MINGW 1) + elseif("${CMAKE_C_PLATFORM_ID}" MATCHES "Cygwin") + set(CMAKE_COMPILER_IS_CYGWIN 1) + endif() +endif() + +if (NOT _CMAKE_TOOLCHAIN_LOCATION) + get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH) +endif () # If we have a gcc cross compiler, they have usually some prefix, like # e.g. powerpc-linux-gcc, arm-elf-gcc or i586-mingw32msvc-gcc, optionally @@ -147,33 +145,31 @@ ENDIF(NOT CMAKE_C_COMPILER_ID_RUN) # NAME_WE cannot be used since then this test will fail for names lile # "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" -IF (CMAKE_CROSSCOMPILING +if (CMAKE_CROSSCOMPILING AND "${CMAKE_C_COMPILER_ID}" MATCHES "GNU" AND NOT _CMAKE_TOOLCHAIN_PREFIX) - GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME) - IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") - SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) - ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME) + if (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + endif () # if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils # but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.) - IF ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") - SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) - ENDIF ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") - -ENDIF (CMAKE_CROSSCOMPILING - AND "${CMAKE_C_COMPILER_ID}" MATCHES "GNU" - AND NOT _CMAKE_TOOLCHAIN_PREFIX) - -INCLUDE(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake) -INCLUDE(CMakeFindBinUtils) -IF(MSVC_C_ARCHITECTURE_ID) - SET(SET_MSVC_C_ARCHITECTURE_ID - "SET(MSVC_C_ARCHITECTURE_ID ${MSVC_C_ARCHITECTURE_ID})") -ENDIF(MSVC_C_ARCHITECTURE_ID) + if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + endif () + +endif () + +include(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake) +include(CMakeFindBinUtils) +if(MSVC_C_ARCHITECTURE_ID) + set(SET_MSVC_C_ARCHITECTURE_ID + "set(MSVC_C_ARCHITECTURE_ID ${MSVC_C_ARCHITECTURE_ID})") +endif() # configure variables set in this file for fast reload later on -CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in - "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCCompiler.cmake" +configure_file(${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) -SET(CMAKE_C_COMPILER_ENV_VAR "CC") +set(CMAKE_C_COMPILER_ENV_VAR "CC") diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 7f8f3ec8b..59da3e60d 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -30,123 +30,109 @@ # If not already set before, it also sets # _CMAKE_TOOLCHAIN_PREFIX -IF(NOT CMAKE_CXX_COMPILER) - SET(CMAKE_CXX_COMPILER_INIT NOTFOUND) - - # prefer the environment variable CXX - IF($ENV{CXX} MATCHES ".+") - GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER_INIT $ENV{CXX} PROGRAM PROGRAM_ARGS CMAKE_CXX_FLAGS_ENV_INIT) - IF(CMAKE_CXX_FLAGS_ENV_INIT) - SET(CMAKE_CXX_COMPILER_ARG1 "${CMAKE_CXX_FLAGS_ENV_INIT}" CACHE STRING "First argument to CXX compiler") - ENDIF(CMAKE_CXX_FLAGS_ENV_INIT) - IF(NOT EXISTS ${CMAKE_CXX_COMPILER_INIT}) - MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}.\n${CMAKE_CXX_COMPILER_INIT}") - ENDIF(NOT EXISTS ${CMAKE_CXX_COMPILER_INIT}) - ENDIF($ENV{CXX} MATCHES ".+") - - # next prefer the generator specified compiler - IF(CMAKE_GENERATOR_CXX) - IF(NOT CMAKE_CXX_COMPILER_INIT) - SET(CMAKE_CXX_COMPILER_INIT ${CMAKE_GENERATOR_CXX}) - ENDIF(NOT CMAKE_CXX_COMPILER_INIT) - ENDIF(CMAKE_GENERATOR_CXX) - - # finally list compilers to try - IF(CMAKE_CXX_COMPILER_INIT) - SET(CMAKE_CXX_COMPILER_LIST ${CMAKE_CXX_COMPILER_INIT}) - ELSE(CMAKE_CXX_COMPILER_INIT) - SET(CMAKE_CXX_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ CC aCC cl bcc xlC) - ENDIF(CMAKE_CXX_COMPILER_INIT) - - # Find the compiler. - IF (_CMAKE_USER_C_COMPILER_PATH) - FIND_PROGRAM(CMAKE_CXX_COMPILER NAMES ${CMAKE_CXX_COMPILER_LIST} PATHS ${_CMAKE_USER_C_COMPILER_PATH} DOC "C++ compiler" NO_DEFAULT_PATH) - ENDIF (_CMAKE_USER_C_COMPILER_PATH) - FIND_PROGRAM(CMAKE_CXX_COMPILER NAMES ${CMAKE_CXX_COMPILER_LIST} DOC "C++ compiler") - - IF(CMAKE_CXX_COMPILER_INIT AND NOT CMAKE_CXX_COMPILER) - SET(CMAKE_CXX_COMPILER "${CMAKE_CXX_COMPILER_INIT}" CACHE FILEPATH "C++ compiler" FORCE) - ENDIF(CMAKE_CXX_COMPILER_INIT AND NOT CMAKE_CXX_COMPILER) -ELSE(NOT CMAKE_CXX_COMPILER) - -# we only get here if CMAKE_CXX_COMPILER was specified using -D or a pre-made CMakeCache.txt -# (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE -# -# if CMAKE_CXX_COMPILER is a list of length 2, use the first item as -# CMAKE_CXX_COMPILER and the 2nd one as CMAKE_CXX_COMPILER_ARG1 - - LIST(LENGTH CMAKE_CXX_COMPILER _CMAKE_CXX_COMPILER_LIST_LENGTH) - IF("${_CMAKE_CXX_COMPILER_LIST_LENGTH}" EQUAL 2) - LIST(GET CMAKE_CXX_COMPILER 1 CMAKE_CXX_COMPILER_ARG1) - LIST(GET CMAKE_CXX_COMPILER 0 CMAKE_CXX_COMPILER) - ENDIF("${_CMAKE_CXX_COMPILER_LIST_LENGTH}" EQUAL 2) - -# if a compiler was specified by the user but without path, -# now try to find it with the full path -# if it is found, force it into the cache, -# if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" -# if the CXX compiler already had a path, reuse it for searching the C compiler - GET_FILENAME_COMPONENT(_CMAKE_USER_CXX_COMPILER_PATH "${CMAKE_CXX_COMPILER}" PATH) - IF(NOT _CMAKE_USER_CXX_COMPILER_PATH) - FIND_PROGRAM(CMAKE_CXX_COMPILER_WITH_PATH NAMES ${CMAKE_CXX_COMPILER}) - MARK_AS_ADVANCED(CMAKE_CXX_COMPILER_WITH_PATH) - IF(CMAKE_CXX_COMPILER_WITH_PATH) - SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_WITH_PATH} CACHE STRING "CXX compiler" FORCE) - ENDIF(CMAKE_CXX_COMPILER_WITH_PATH) - ENDIF(NOT _CMAKE_USER_CXX_COMPILER_PATH) -ENDIF(NOT CMAKE_CXX_COMPILER) -MARK_AS_ADVANCED(CMAKE_CXX_COMPILER) - -IF (NOT _CMAKE_TOOLCHAIN_LOCATION) - GET_FILENAME_COMPONENT(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH) -ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION) - -# This block was used before the compiler was identified by building a -# source file. Unless g++ crashes when building a small C++ -# executable this should no longer be needed. -# -# The g++ that comes with BeOS 5 segfaults if you run "g++ -E" -# ("gcc -E" is fine), which throws up a system dialog box that hangs cmake -# until the user clicks "OK"...so for now, we just assume it's g++. -# IF(BEOS) -# SET(CMAKE_COMPILER_IS_GNUCXX 1) -# SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1) -# ENDIF(BEOS) - -# Build a small source file to identify the compiler. -IF(${CMAKE_GENERATOR} MATCHES "Visual Studio") - SET(CMAKE_CXX_COMPILER_ID_RUN 1) - SET(CMAKE_CXX_PLATFORM_ID "Windows") - SET(CMAKE_CXX_COMPILER_ID "MSVC") -ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio") -IF(NOT CMAKE_CXX_COMPILER_ID_RUN) - SET(CMAKE_CXX_COMPILER_ID_RUN 1) +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) + +# Load system-specific compiler preferences for this language. +include(Platform/${CMAKE_SYSTEM_NAME}-CXX OPTIONAL) +if(NOT CMAKE_CXX_COMPILER_NAMES) + set(CMAKE_CXX_COMPILER_NAMES CC) +endif() + +if(${CMAKE_GENERATOR} MATCHES "Visual Studio") +elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") + set(CMAKE_CXX_COMPILER_XCODE_TYPE sourcecode.cpp.cpp) +else() + if(NOT CMAKE_CXX_COMPILER) + set(CMAKE_CXX_COMPILER_INIT NOTFOUND) + + # prefer the environment variable CXX + if($ENV{CXX} MATCHES ".+") + get_filename_component(CMAKE_CXX_COMPILER_INIT $ENV{CXX} PROGRAM PROGRAM_ARGS CMAKE_CXX_FLAGS_ENV_INIT) + if(CMAKE_CXX_FLAGS_ENV_INIT) + set(CMAKE_CXX_COMPILER_ARG1 "${CMAKE_CXX_FLAGS_ENV_INIT}" CACHE STRING "First argument to CXX compiler") + endif() + if(NOT EXISTS ${CMAKE_CXX_COMPILER_INIT}) + message(FATAL_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}.\n${CMAKE_CXX_COMPILER_INIT}") + endif() + endif() + + # next prefer the generator specified compiler + if(CMAKE_GENERATOR_CXX) + if(NOT CMAKE_CXX_COMPILER_INIT) + set(CMAKE_CXX_COMPILER_INIT ${CMAKE_GENERATOR_CXX}) + endif() + endif() + + # finally list compilers to try + if(NOT CMAKE_CXX_COMPILER_INIT) + set(CMAKE_CXX_COMPILER_LIST CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC clang++) + endif() + + _cmake_find_compiler(CXX) + else() + + # we only get here if CMAKE_CXX_COMPILER was specified using -D or a pre-made CMakeCache.txt + # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE + # + # if CMAKE_CXX_COMPILER is a list of length 2, use the first item as + # CMAKE_CXX_COMPILER and the 2nd one as CMAKE_CXX_COMPILER_ARG1 + + list(LENGTH CMAKE_CXX_COMPILER _CMAKE_CXX_COMPILER_LIST_LENGTH) + if("${_CMAKE_CXX_COMPILER_LIST_LENGTH}" EQUAL 2) + list(GET CMAKE_CXX_COMPILER 1 CMAKE_CXX_COMPILER_ARG1) + list(GET CMAKE_CXX_COMPILER 0 CMAKE_CXX_COMPILER) + endif() + + # if a compiler was specified by the user but without path, + # now try to find it with the full path + # if it is found, force it into the cache, + # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" + # if the CXX compiler already had a path, reuse it for searching the C compiler + get_filename_component(_CMAKE_USER_CXX_COMPILER_PATH "${CMAKE_CXX_COMPILER}" PATH) + if(NOT _CMAKE_USER_CXX_COMPILER_PATH) + find_program(CMAKE_CXX_COMPILER_WITH_PATH NAMES ${CMAKE_CXX_COMPILER}) + mark_as_advanced(CMAKE_CXX_COMPILER_WITH_PATH) + if(CMAKE_CXX_COMPILER_WITH_PATH) + set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_WITH_PATH} CACHE STRING "CXX compiler" FORCE) + endif() + endif() + endif() + mark_as_advanced(CMAKE_CXX_COMPILER) # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce # a valid identification file. - SET(CMAKE_CXX_COMPILER_ID_TEST_FLAGS + set(CMAKE_CXX_COMPILER_ID_TEST_FLAGS # Try compiling to an object file only. "-c" ) +endif() + +# Build a small source file to identify the compiler. +if(NOT CMAKE_CXX_COMPILER_ID_RUN) + set(CMAKE_CXX_COMPILER_ID_RUN 1) # Try to identify the compiler. - SET(CMAKE_CXX_COMPILER_ID) - FILE(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in + set(CMAKE_CXX_COMPILER_ID) + file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT) - INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) CMAKE_DETERMINE_COMPILER_ID(CXX CXXFLAGS CMakeCXXCompilerId.cpp) # Set old compiler and platform id variables. - IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") - SET(CMAKE_COMPILER_IS_GNUCXX 1) - ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") - IF("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW") - SET(CMAKE_COMPILER_IS_MINGW 1) - ELSEIF("${CMAKE_CXX_PLATFORM_ID}" MATCHES "Cygwin") - SET(CMAKE_COMPILER_IS_CYGWIN 1) - ENDIF("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW") -ENDIF(NOT CMAKE_CXX_COMPILER_ID_RUN) + if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") + set(CMAKE_COMPILER_IS_GNUCXX 1) + endif() + if("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW") + set(CMAKE_COMPILER_IS_MINGW 1) + elseif("${CMAKE_CXX_PLATFORM_ID}" MATCHES "Cygwin") + set(CMAKE_COMPILER_IS_CYGWIN 1) + endif() +endif() + +if (NOT _CMAKE_TOOLCHAIN_LOCATION) + get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH) +endif () # if we have a g++ cross compiler, they have usually some prefix, like # e.g. powerpc-linux-g++, arm-elf-g++ or i586-mingw32msvc-g++ , optionally @@ -155,34 +141,32 @@ ENDIF(NOT CMAKE_CXX_COMPILER_ID_RUN) # NAME_WE cannot be used since then this test will fail for names lile # "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" -IF (CMAKE_CROSSCOMPILING +if (CMAKE_CROSSCOMPILING AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT _CMAKE_TOOLCHAIN_PREFIX) - GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME) - IF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") - SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) - ENDIF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME) + if (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + endif () # if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils # but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.) - IF ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") - SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) - ENDIF ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") - -ENDIF (CMAKE_CROSSCOMPILING - AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" - AND NOT _CMAKE_TOOLCHAIN_PREFIX) - -INCLUDE(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake) -INCLUDE(CMakeFindBinUtils) -IF(MSVC_CXX_ARCHITECTURE_ID) - SET(SET_MSVC_CXX_ARCHITECTURE_ID - "SET(MSVC_CXX_ARCHITECTURE_ID ${MSVC_CXX_ARCHITECTURE_ID})") -ENDIF(MSVC_CXX_ARCHITECTURE_ID) + if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + endif () + +endif () + +include(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake) +include(CMakeFindBinUtils) +if(MSVC_CXX_ARCHITECTURE_ID) + set(SET_MSVC_CXX_ARCHITECTURE_ID + "set(MSVC_CXX_ARCHITECTURE_ID ${MSVC_CXX_ARCHITECTURE_ID})") +endif() # configure all variables set in this file -CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake +configure_file(${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) -SET(CMAKE_CXX_COMPILER_ENV_VAR "CXX") +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake new file mode 100644 index 000000000..2d12c0757 --- /dev/null +++ b/Modules/CMakeDetermineCompiler.cmake @@ -0,0 +1,72 @@ + +#============================================================================= +# Copyright 2004-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +macro(_cmake_find_compiler lang) + # Use already-enabled languages for reference. + get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES) + list(REMOVE_ITEM _languages "${lang}") + + if(CMAKE_${lang}_COMPILER_INIT) + # Search only for the specified compiler. + set(CMAKE_${lang}_COMPILER_LIST "${CMAKE_${lang}_COMPILER_INIT}") + else() + # Re-order the compiler list with preferred vendors first. + set(_${lang}_COMPILER_LIST "${CMAKE_${lang}_COMPILER_LIST}") + set(CMAKE_${lang}_COMPILER_LIST "") + # Prefer vendors of compilers from reference languages. + foreach(l ${_languages}) + list(APPEND CMAKE_${lang}_COMPILER_LIST + ${_${lang}_COMPILER_NAMES_${CMAKE_${l}_COMPILER_ID}}) + endforeach() + # Prefer vendors based on the platform. + list(APPEND CMAKE_${lang}_COMPILER_LIST ${CMAKE_${lang}_COMPILER_NAMES}) + # Append the rest of the list and remove duplicates. + list(APPEND CMAKE_${lang}_COMPILER_LIST ${_${lang}_COMPILER_LIST}) + unset(_${lang}_COMPILER_LIST) + list(REMOVE_DUPLICATES CMAKE_${lang}_COMPILER_LIST) + if(CMAKE_${lang}_COMPILER_EXCLUDE) + list(REMOVE_ITEM CMAKE_${lang}_COMPILER_LIST + ${CMAKE_${lang}_COMPILER_EXCLUDE}) + endif() + endif() + + # Look for directories containing compilers of reference languages. + set(_${lang}_COMPILER_HINTS) + foreach(l ${_languages}) + if(CMAKE_${l}_COMPILER AND IS_ABSOLUTE "${CMAKE_${l}_COMPILER}") + get_filename_component(_hint "${CMAKE_${l}_COMPILER}" PATH) + if(IS_DIRECTORY "${_hint}") + list(APPEND _${lang}_COMPILER_HINTS "${_hint}") + endif() + unset(_hint) + endif() + endforeach() + + # Find the compiler. + if(_${lang}_COMPILER_HINTS) + # Prefer directories containing compilers of reference languages. + list(REMOVE_DUPLICATES _${lang}_COMPILER_HINTS) + find_program(CMAKE_${lang}_COMPILER + NAMES ${CMAKE_${lang}_COMPILER_LIST} + PATHS ${_${lang}_COMPILER_HINTS} + NO_DEFAULT_PATH + DOC "${lang} compiler") + endif() + find_program(CMAKE_${lang}_COMPILER NAMES ${CMAKE_${lang}_COMPILER_LIST} DOC "${lang} compiler") + if(CMAKE_${lang}_COMPILER_INIT AND NOT CMAKE_${lang}_COMPILER) + set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_INIT}" CACHE FILEPATH "${lang} compiler" FORCE) + endif() + unset(_${lang}_COMPILER_HINTS) + unset(_languages) +endmacro() diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index 1c9899e64..25d6bbea7 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -16,19 +16,19 @@ # This is used internally by CMake and should not be included by user # code. -INCLUDE(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake) +include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake) -FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src) - IF(NOT DEFINED CMAKE_DETERMINE_${lang}_ABI_COMPILED) - MESSAGE(STATUS "Detecting ${lang} compiler ABI info") +function(CMAKE_DETERMINE_COMPILER_ABI lang src) + if(NOT DEFINED CMAKE_${lang}_ABI_COMPILED) + message(STATUS "Detecting ${lang} compiler ABI info") # Compile the ABI identification source. - SET(BIN "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDetermineCompilerABI_${lang}.bin") - SET(CMAKE_FLAGS ) - IF(DEFINED CMAKE_${lang}_VERBOSE_FLAG) - SET(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}") - ENDIF() - TRY_COMPILE(CMAKE_DETERMINE_${lang}_ABI_COMPILED + set(BIN "${CMAKE_PLATFORM_INFO_DIR}/CMakeDetermineCompilerABI_${lang}.bin") + set(CMAKE_FLAGS ) + if(DEFINED CMAKE_${lang}_VERBOSE_FLAG) + set(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}") + endif() + try_compile(CMAKE_${lang}_ABI_COMPILED ${CMAKE_BINARY_DIR} ${src} CMAKE_FLAGS "${CMAKE_FLAGS}" "-DCMAKE_${lang}_STANDARD_LIBRARIES=" @@ -39,93 +39,96 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src) OUTPUT_VARIABLE OUTPUT COPY_FILE "${BIN}" ) + # Move result from cache to normal variable. + set(CMAKE_${lang}_ABI_COMPILED ${CMAKE_${lang}_ABI_COMPILED}) + unset(CMAKE_${lang}_ABI_COMPILED CACHE) + set(CMAKE_${lang}_ABI_COMPILED ${CMAKE_${lang}_ABI_COMPILED} PARENT_SCOPE) # Load the resulting information strings. - IF(CMAKE_DETERMINE_${lang}_ABI_COMPILED) - MESSAGE(STATUS "Detecting ${lang} compiler ABI info - done") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if(CMAKE_${lang}_ABI_COMPILED) + message(STATUS "Detecting ${lang} compiler ABI info - done") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Detecting ${lang} compiler ABI info compiled with the following output:\n${OUTPUT}\n\n") - FILE(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[^[]*\\[") - FOREACH(info ${ABI_STRINGS}) - IF("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*") - STRING(REGEX REPLACE ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*" "\\1" ABI_SIZEOF_DPTR "${info}") - ENDIF("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*") - IF("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*") - STRING(REGEX REPLACE ".*INFO:abi\\[([^]]*)\\].*" "\\1" ABI_NAME "${info}") - ENDIF("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*") - ENDFOREACH(info) + file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[^[]*\\[") + foreach(info ${ABI_STRINGS}) + if("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*") + string(REGEX REPLACE ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*" "\\1" ABI_SIZEOF_DPTR "${info}") + endif() + if("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*") + string(REGEX REPLACE ".*INFO:abi\\[([^]]*)\\].*" "\\1" ABI_NAME "${info}") + endif() + endforeach() - IF(ABI_SIZEOF_DPTR) - SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${ABI_SIZEOF_DPTR}" PARENT_SCOPE) - ELSEIF(CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT) - SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT}" PARENT_SCOPE) - ENDIF(ABI_SIZEOF_DPTR) + if(ABI_SIZEOF_DPTR) + set(CMAKE_${lang}_SIZEOF_DATA_PTR "${ABI_SIZEOF_DPTR}" PARENT_SCOPE) + elseif(CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT) + set(CMAKE_${lang}_SIZEOF_DATA_PTR "${CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT}" PARENT_SCOPE) + endif() - IF(ABI_NAME) - SET(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE) - ENDIF(ABI_NAME) + if(ABI_NAME) + set(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE) + endif() # Parse implicit linker information for this language, if available. - SET(implicit_dirs "") - SET(implicit_libs "") - SET(MULTI_ARCH FALSE) - IF(DEFINED CMAKE_OSX_ARCHITECTURES) - IF( "${CMAKE_OSX_ARCHITECTURES}" MATCHES ";" ) - SET(MULTI_ARCH TRUE) - ENDIF() - ENDIF() - IF(CMAKE_${lang}_VERBOSE_FLAG - # Implicit link information cannot be used explicitly for - # multiple OS X architectures, so we skip it. - AND NOT MULTI_ARCH - # Skip this with Xcode for now. - AND NOT "${CMAKE_GENERATOR}" MATCHES Xcode) - CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs log + set(implicit_dirs "") + set(implicit_libs "") + set(implicit_fwks "") + if(CMAKE_${lang}_VERBOSE_FLAG) + CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs implicit_fwks log "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Parsed ${lang} implicit link information from above output:\n${log}\n\n") - ENDIF() + endif() # for VS IDE Intel Fortran we have to figure out the # implicit link path for the fortran run time using # a try-compile - IF("${lang}" MATCHES "Fortran" + if("${lang}" MATCHES "Fortran" AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio") - SET(_desc "Determine Intel Fortran Compiler Implicit Link Path") - MESSAGE(STATUS "${_desc}") + set(_desc "Determine Intel Fortran Compiler Implicit Link Path") + message(STATUS "${_desc}") # Build a sample project which reports symbols. - TRY_COMPILE(IFORT_LIB_PATH_COMPILED + try_compile(IFORT_LIB_PATH_COMPILED ${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath ${CMAKE_ROOT}/Modules/IntelVSImplicitPath IntelFortranImplicit CMAKE_FLAGS "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}" OUTPUT_VARIABLE _output) - FILE(WRITE + file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.txt" "${_output}") - INCLUDE(${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.cmake OPTIONAL) - SET(_desc "Determine Intel Fortran Compiler Implicit Link Path -- done") - MESSAGE(STATUS "${_desc}") - ENDIF() + include(${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.cmake OPTIONAL) + set(_desc "Determine Intel Fortran Compiler Implicit Link Path -- done") + message(STATUS "${_desc}") + endif() - SET(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE) - SET(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE) + # Implicit link libraries cannot be used explicitly for multiple + # OS X architectures, so we skip it. + if(DEFINED CMAKE_OSX_ARCHITECTURES) + if("${CMAKE_OSX_ARCHITECTURES}" MATCHES ";") + set(implicit_libs "") + endif() + endif() + + set(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE) + set(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE) + set(CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${implicit_fwks}" PARENT_SCOPE) # Detect library architecture directory name. - IF(CMAKE_LIBRARY_ARCHITECTURE_REGEX) - FOREACH(dir ${implicit_dirs}) - IF("${dir}" MATCHES "/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$") - GET_FILENAME_COMPONENT(arch "${dir}" NAME) - SET(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${arch}" PARENT_SCOPE) - BREAK() - ENDIF() - ENDFOREACH() - ENDIF() + if(CMAKE_LIBRARY_ARCHITECTURE_REGEX) + foreach(dir ${implicit_dirs}) + if("${dir}" MATCHES "/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$") + get_filename_component(arch "${dir}" NAME) + set(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${arch}" PARENT_SCOPE) + break() + endif() + endforeach() + endif() - ELSE(CMAKE_DETERMINE_${lang}_ABI_COMPILED) - MESSAGE(STATUS "Detecting ${lang} compiler ABI info - failed") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + else() + message(STATUS "Detecting ${lang} compiler ABI info - failed") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Detecting ${lang} compiler ABI info failed to compile with the following output:\n${OUTPUT}\n\n") - ENDIF(CMAKE_DETERMINE_${lang}_ABI_COMPILED) - ENDIF(NOT DEFINED CMAKE_DETERMINE_${lang}_ABI_COMPILED) -ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ABI) + endif() + endif() +endfunction() diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 67f5a5906..b9180921d 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -16,116 +16,240 @@ # used internally by CMake and should not be included by user code. # If successful, sets CMAKE__COMPILER_ID and CMAKE__PLATFORM_ID -FUNCTION(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) +function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) # Make sure the compiler arguments are clean. - STRING(STRIP "${CMAKE_${lang}_COMPILER_ARG1}" CMAKE_${lang}_COMPILER_ID_ARG1) - STRING(REGEX REPLACE " +" ";" CMAKE_${lang}_COMPILER_ID_ARG1 "${CMAKE_${lang}_COMPILER_ID_ARG1}") + string(STRIP "${CMAKE_${lang}_COMPILER_ARG1}" CMAKE_${lang}_COMPILER_ID_ARG1) + string(REGEX REPLACE " +" ";" CMAKE_${lang}_COMPILER_ID_ARG1 "${CMAKE_${lang}_COMPILER_ID_ARG1}") # Make sure user-specified compiler flags are used. - IF(CMAKE_${lang}_FLAGS) - SET(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS}) - ELSE(CMAKE_${lang}_FLAGS) - SET(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${flagvar}}) - ENDIF(CMAKE_${lang}_FLAGS) - STRING(REGEX REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}") + if(CMAKE_${lang}_FLAGS) + set(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS}) + else() + set(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${flagvar}}) + endif() + string(REGEX REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}") # Compute the directory in which to run the test. - SET(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang}) + set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang}) # Try building with no extra flags and then try each set # of helper flags. Stop when the compiler is identified. - FOREACH(flags "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS}) - IF(NOT CMAKE_${lang}_COMPILER_ID) + foreach(flags "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS}) + if(NOT CMAKE_${lang}_COMPILER_ID) CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}") - FOREACH(file ${COMPILER_${lang}_PRODUCED_FILES}) + foreach(file ${COMPILER_${lang}_PRODUCED_FILES}) CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}") - ENDFOREACH(file) - ENDIF(NOT CMAKE_${lang}_COMPILER_ID) - ENDFOREACH(flags) + endforeach() + endif() + endforeach() # If the compiler is still unknown, try to query its vendor. - IF(NOT CMAKE_${lang}_COMPILER_ID) + if(NOT CMAKE_${lang}_COMPILER_ID) CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang}) - ENDIF() + endif() # if the format is unknown after all files have been checked, put "Unknown" in the cache - IF(NOT CMAKE_EXECUTABLE_FORMAT) - SET(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format") - ENDIF(NOT CMAKE_EXECUTABLE_FORMAT) + if(NOT CMAKE_EXECUTABLE_FORMAT) + set(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format") + endif() # Display the final identification result. - IF(CMAKE_${lang}_COMPILER_ID) - IF(CMAKE_${lang}_COMPILER_VERSION) - SET(_version " ${CMAKE_${lang}_COMPILER_VERSION}") - ELSE() - SET(_version "") - ENDIF() - MESSAGE(STATUS "The ${lang} compiler identification is " + if(CMAKE_${lang}_COMPILER_ID) + if(CMAKE_${lang}_COMPILER_VERSION) + set(_version " ${CMAKE_${lang}_COMPILER_VERSION}") + else() + set(_version "") + endif() + message(STATUS "The ${lang} compiler identification is " "${CMAKE_${lang}_COMPILER_ID}${_version}") - ELSE(CMAKE_${lang}_COMPILER_ID) - MESSAGE(STATUS "The ${lang} compiler identification is unknown") - ENDIF(CMAKE_${lang}_COMPILER_ID) - - SET(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) - SET(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) - SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" + else() + message(STATUS "The ${lang} compiler identification is unknown") + endif() + + # Check if compiler id detection gave us the compiler tool. + if(NOT CMAKE_${lang}_COMPILER) + if(CMAKE_${lang}_COMPILER_ID_TOOL) + set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_ID_TOOL}" PARENT_SCOPE) + else() + set(CMAKE_${lang}_COMPILER "CMAKE_${lang}_COMPILER-NOTFOUND" PARENT_SCOPE) + endif() + endif() + + set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) + set(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) + set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" PARENT_SCOPE) - SET(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) -ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID) + set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) +endfunction() #----------------------------------------------------------------------------- # Function to write the compiler id source file. -FUNCTION(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src) - FILE(READ ${CMAKE_ROOT}/Modules/${src}.in ID_CONTENT_IN) - STRING(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY) - FILE(WRITE ${CMAKE_${lang}_COMPILER_ID_DIR}/${src} "${ID_CONTENT_OUT}") -ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_WRITE) +function(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src) + file(READ ${CMAKE_ROOT}/Modules/${src}.in ID_CONTENT_IN) + string(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY) + file(WRITE ${CMAKE_${lang}_COMPILER_ID_DIR}/${src} "${ID_CONTENT_OUT}") +endfunction() #----------------------------------------------------------------------------- # Function to build the compiler id source file and look for output # files. -FUNCTION(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src) +function(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src) # Create a clean working directory. - FILE(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR}) - FILE(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}) + file(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR}) + file(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}) CMAKE_DETERMINE_COMPILER_ID_WRITE("${lang}" "${src}") # Construct a description of this test case. - SET(COMPILER_DESCRIPTION + set(COMPILER_DESCRIPTION "Compiler: ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_ARG1} Build flags: ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} Id flags: ${testflags} ") # Compile the compiler identification source. - IF(COMMAND EXECUTE_PROCESS) - EXECUTE_PROCESS( - COMMAND ${CMAKE_${lang}_COMPILER} - ${CMAKE_${lang}_COMPILER_ID_ARG1} - ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} - ${testflags} - "${src}" + if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)") + set(vs_version ${CMAKE_MATCH_1}) + set(id_arch ${CMAKE_VS_PLATFORM_NAME}) + set(id_lang "${lang}") + set(id_cl cl.exe) + if(NOT id_arch) + set(id_arch Win32) + endif() + if(NOT "${vs_version}" VERSION_LESS 10) + set(v 10) + set(ext vcxproj) + elseif(NOT "${vs_version}" VERSION_LESS 7) + set(id_version ${vs_version}.00) + set(v 7) + set(ext vcproj) + else() + set(v 6) + set(ext dsp) + endif() + if("${id_arch}" STREQUAL "x64") + set(id_machine_10 MachineX64) + elseif("${id_arch}" STREQUAL "Itanium") + set(id_machine_10 MachineIA64) + set(id_arch ia64) + else() + set(id_machine_6 x86) + set(id_machine_10 MachineX86) + endif() + if(CMAKE_VS_PLATFORM_TOOLSET) + set(id_toolset "${CMAKE_VS_PLATFORM_TOOLSET}") + else() + set(id_toolset "") + endif() + if(CMAKE_VS_WINCE_VERSION) + set(id_entrypoint "mainACRTStartup") + set(id_subsystem 9) + else() + set(id_subsystem 1) + endif() + if("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Bb][Uu][Ii][Ll][Dd]") + set(build /p:Configuration=Debug /p:Platform=@id_arch@ /p:VisualStudioVersion=${vs_version}.0) + elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Dd][Ee][Vv]") + set(build /make) + else() + set(build /build Debug) + endif() + set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR}) + get_filename_component(id_src "${src}" NAME) + configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in + ${id_dir}/CompilerId${lang}.${ext} @ONLY IMMEDIATE) + execute_process( + COMMAND ${CMAKE_MAKE_PROGRAM} CompilerId${lang}.${ext} ${build} WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT ) - ELSE(COMMAND EXECUTE_PROCESS) - EXEC_PROGRAM( - ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_DIR} - ARGS ${CMAKE_${lang}_COMPILER_ID_ARG1} - ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} - ${testflags} - \"${src}\" + # Match the compiler location line printed out. + if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CMAKE_${lang}_COMPILER=([^%\r\n]+)[\r\n]") + set(_comp "${CMAKE_MATCH_1}") + if(EXISTS "${_comp}") + file(TO_CMAKE_PATH "${_comp}" _comp) + set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) + endif() + endif() + elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") + set(id_lang "${lang}") + set(id_type ${CMAKE_${lang}_COMPILER_XCODE_TYPE}) + set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR}) + get_filename_component(id_src "${src}" NAME) + if(CMAKE_XCODE_PLATFORM_TOOLSET) + set(id_toolset "GCC_VERSION = ${CMAKE_XCODE_PLATFORM_TOOLSET};") + else() + set(id_toolset "") + endif() + if(NOT ${XCODE_VERSION} VERSION_LESS 3) + set(v 3) + set(ext xcodeproj) + elseif(NOT ${XCODE_VERSION} VERSION_LESS 2) + set(v 2) + set(ext xcodeproj) + else() + set(v 1) + set(ext xcode) + endif() + configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-${v}.pbxproj.in + ${id_dir}/CompilerId${lang}.${ext}/project.pbxproj @ONLY IMMEDIATE) + unset(_ENV_MACOSX_DEPLOYMENT_TARGET) + if(DEFINED ENV{MACOSX_DEPLOYMENT_TARGET}) + set(_ENV_MACOSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}") + set(ENV{MACOSX_DEPLOYMENT_TARGET} "") + endif() + execute_process(COMMAND xcodebuild + WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT - RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT + ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT ) - ENDIF(COMMAND EXECUTE_PROCESS) + if(DEFINED _ENV_MACOSX_DEPLOYMENT_TARGET) + set(ENV{MACOSX_DEPLOYMENT_TARGET} "${_ENV_MACOSX_DEPLOYMENT_TARGET}") + endif() + + # Match the link line from xcodebuild output of the form + # Ld ... + # ... + # /path/to/cc ...CompilerId${lang}/... + # to extract the compiler front-end for the language. + if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/\\./CompilerId${lang}[ \t\n\\\"]") + set(_comp "${CMAKE_MATCH_2}") + if(EXISTS "${_comp}") + set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) + endif() + endif() + else() + if(COMMAND EXECUTE_PROCESS) + execute_process( + COMMAND ${CMAKE_${lang}_COMPILER} + ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + ${testflags} + "${src}" + WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} + OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT + ) + else() + exec_program( + ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_DIR} + ARGS ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + ${testflags} + \"${src}\" + OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT + ) + endif() + endif() # Check the result of compilation. - IF(CMAKE_${lang}_COMPILER_ID_RESULT) + if(CMAKE_${lang}_COMPILER_ID_RESULT) # Compilation failed. - SET(MSG + set(MSG "Compiling the ${lang} compiler identification source file \"${src}\" failed. ${COMPILER_DESCRIPTION} The output was: @@ -133,16 +257,16 @@ ${CMAKE_${lang}_COMPILER_ID_RESULT} ${CMAKE_${lang}_COMPILER_ID_OUTPUT} ") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "${MSG}") - #IF(NOT CMAKE_${lang}_COMPILER_ID_ALLOW_FAIL) - # MESSAGE(FATAL_ERROR "${MSG}") - #ENDIF(NOT CMAKE_${lang}_COMPILER_ID_ALLOW_FAIL) + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "${MSG}") + #if(NOT CMAKE_${lang}_COMPILER_ID_ALLOW_FAIL) + # message(FATAL_ERROR "${MSG}") + #endif() # No output files should be inspected. - SET(COMPILER_${lang}_PRODUCED_FILES) - ELSE(CMAKE_${lang}_COMPILER_ID_RESULT) + set(COMPILER_${lang}_PRODUCED_FILES) + else() # Compilation succeeded. - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Compiling the ${lang} compiler identification source file \"${src}\" succeeded. ${COMPILER_DESCRIPTION} The output was: @@ -153,120 +277,124 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT} # Find the executable produced by the compiler, try all files in the # binary dir. - FILE(GLOB COMPILER_${lang}_PRODUCED_FILES + file(GLOB files RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR} ${CMAKE_${lang}_COMPILER_ID_DIR}/*) - LIST(REMOVE_ITEM COMPILER_${lang}_PRODUCED_FILES "${src}") - FOREACH(file ${COMPILER_${lang}_PRODUCED_FILES}) - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Compilation of the ${lang} compiler identification source \"" - "${src}\" produced \"${file}\"\n\n") - ENDFOREACH(file) - - IF(NOT COMPILER_${lang}_PRODUCED_FILES) + list(REMOVE_ITEM files "${src}") + set(COMPILER_${lang}_PRODUCED_FILES "") + foreach(file ${files}) + if(NOT IS_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}/${file}) + list(APPEND COMPILER_${lang}_PRODUCED_FILES ${file}) + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Compilation of the ${lang} compiler identification source \"" + "${src}\" produced \"${file}\"\n\n") + endif() + endforeach() + + if(NOT COMPILER_${lang}_PRODUCED_FILES) # No executable was found. - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Compilation of the ${lang} compiler identification source \"" "${src}\" did not produce an executable in \"" "${CMAKE_${lang}_COMPILER_ID_DIR}\".\n\n") - ENDIF(NOT COMPILER_${lang}_PRODUCED_FILES) - ENDIF(CMAKE_${lang}_COMPILER_ID_RESULT) + endif() + endif() # Return the files produced by the compilation. - SET(COMPILER_${lang}_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE) -ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src) + set(COMPILER_${lang}_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE) +endfunction() #----------------------------------------------------------------------------- # Function to extract the compiler id from an executable. -FUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) +function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) # Look for a compiler id if not yet known. - IF(NOT CMAKE_${lang}_COMPILER_ID) + if(NOT CMAKE_${lang}_COMPILER_ID) # Read the compiler identification string from the executable file. - SET(COMPILER_ID) - SET(COMPILER_VERSION) - SET(PLATFORM_ID) - FILE(STRINGS ${file} + set(COMPILER_ID) + set(COMPILER_VERSION) + set(PLATFORM_ID) + file(STRINGS ${file} CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 4 REGEX "INFO:") - SET(HAVE_COMPILER_TWICE 0) - FOREACH(info ${CMAKE_${lang}_COMPILER_ID_STRINGS}) - IF("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*") - IF(COMPILER_ID) - SET(COMPILER_ID_TWICE 1) - ENDIF(COMPILER_ID) - STRING(REGEX REPLACE ".*INFO:compiler\\[([^]]*)\\].*" "\\1" + set(HAVE_COMPILER_TWICE 0) + foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS}) + if("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*") + if(COMPILER_ID) + set(COMPILER_ID_TWICE 1) + endif() + string(REGEX REPLACE ".*INFO:compiler\\[([^]]*)\\].*" "\\1" COMPILER_ID "${info}") - ENDIF("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*") - IF("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*") - STRING(REGEX REPLACE ".*INFO:platform\\[([^]]*)\\].*" "\\1" + endif() + if("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*") + string(REGEX REPLACE ".*INFO:platform\\[([^]]*)\\].*" "\\1" PLATFORM_ID "${info}") - ENDIF("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*") - IF("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*") - STRING(REGEX REPLACE ".*INFO:arch\\[([^]]*)\\].*" "\\1" + endif() + if("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*") + string(REGEX REPLACE ".*INFO:arch\\[([^]]*)\\].*" "\\1" ARCHITECTURE_ID "${info}") - ENDIF("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*") - IF("${info}" MATCHES ".*INFO:compiler_version\\[([^]\"]*)\\].*") - STRING(REGEX REPLACE ".*INFO:compiler_version\\[([^]]*)\\].*" "\\1" COMPILER_VERSION "${info}") - STRING(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${COMPILER_VERSION}") - STRING(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}") - ENDIF("${info}" MATCHES ".*INFO:compiler_version\\[([^]\"]*)\\].*") - ENDFOREACH(info) + endif() + if("${info}" MATCHES ".*INFO:compiler_version\\[([^]\"]*)\\].*") + string(REGEX REPLACE ".*INFO:compiler_version\\[([^]]*)\\].*" "\\1" COMPILER_VERSION "${info}") + string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${COMPILER_VERSION}") + string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}") + endif() + endforeach() # Check if a valid compiler and platform were found. - IF(COMPILER_ID AND NOT COMPILER_ID_TWICE) - SET(CMAKE_${lang}_COMPILER_ID "${COMPILER_ID}") - SET(CMAKE_${lang}_PLATFORM_ID "${PLATFORM_ID}") - SET(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}") - SET(CMAKE_${lang}_COMPILER_VERSION "${COMPILER_VERSION}") - ENDIF(COMPILER_ID AND NOT COMPILER_ID_TWICE) + if(COMPILER_ID AND NOT COMPILER_ID_TWICE) + set(CMAKE_${lang}_COMPILER_ID "${COMPILER_ID}") + set(CMAKE_${lang}_PLATFORM_ID "${PLATFORM_ID}") + set(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}") + set(CMAKE_${lang}_COMPILER_VERSION "${COMPILER_VERSION}") + endif() # Check the compiler identification string. - IF(CMAKE_${lang}_COMPILER_ID) + if(CMAKE_${lang}_COMPILER_ID) # The compiler identification was found. - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "The ${lang} compiler identification is ${CMAKE_${lang}_COMPILER_ID}, found in \"" "${file}\"\n\n") - ELSE(CMAKE_${lang}_COMPILER_ID) + else() # The compiler identification could not be found. - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "The ${lang} compiler identification could not be found in \"" "${file}\"\n\n") - ENDIF(CMAKE_${lang}_COMPILER_ID) - ENDIF(NOT CMAKE_${lang}_COMPILER_ID) + endif() + endif() # try to figure out the executable format: ELF, COFF, Mach-O - IF(NOT CMAKE_EXECUTABLE_FORMAT) - FILE(READ ${file} CMAKE_EXECUTABLE_MAGIC LIMIT 4 HEX) + if(NOT CMAKE_EXECUTABLE_FORMAT) + file(READ ${file} CMAKE_EXECUTABLE_MAGIC LIMIT 4 HEX) # ELF files start with 0x7f"ELF" - IF("${CMAKE_EXECUTABLE_MAGIC}" STREQUAL "7f454c46") - SET(CMAKE_EXECUTABLE_FORMAT "ELF" CACHE INTERNAL "Executable file format") - ENDIF("${CMAKE_EXECUTABLE_MAGIC}" STREQUAL "7f454c46") + if("${CMAKE_EXECUTABLE_MAGIC}" STREQUAL "7f454c46") + set(CMAKE_EXECUTABLE_FORMAT "ELF" CACHE INTERNAL "Executable file format") + endif() # # COFF (.exe) files start with "MZ" -# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "4d5a....") -# SET(CMAKE_EXECUTABLE_FORMAT "COFF" CACHE STRING "Executable file format") -# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "4d5a....") +# if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "4d5a....") +# set(CMAKE_EXECUTABLE_FORMAT "COFF" CACHE STRING "Executable file format") +# endif() # # # Mach-O files start with CAFEBABE or FEEDFACE, according to http://radio.weblogs.com/0100490/2003/01/28.html -# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "cafebabe") -# SET(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format") -# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "cafebabe") -# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface") -# SET(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format") -# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface") - - ENDIF(NOT CMAKE_EXECUTABLE_FORMAT) - IF(NOT DEFINED CMAKE_EXECUTABLE_FORMAT) - SET(CMAKE_EXECUTABLE_FORMAT) - ENDIF() +# if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "cafebabe") +# set(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format") +# endif() +# if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface") +# set(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format") +# endif() + + endif() + if(NOT DEFINED CMAKE_EXECUTABLE_FORMAT) + set(CMAKE_EXECUTABLE_FORMAT) + endif() # Return the information extracted. - SET(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) - SET(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) - SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" + set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) + set(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) + set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" PARENT_SCOPE) - SET(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) - SET(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE) -ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang) + set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) + set(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE) +endfunction() #----------------------------------------------------------------------------- # Function to query the compiler vendor. @@ -276,22 +404,22 @@ ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang) # set(CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor} "Some Vendor Output") # We try running the compiler with the flag for each vendor and # matching its regular expression in the output. -FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) +function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) - IF(NOT CMAKE_${lang}_COMPILER_ID_DIR) + if(NOT CMAKE_${lang}_COMPILER_ID_DIR) # We get here when this function is called not from within CMAKE_DETERMINE_COMPILER_ID() # This is done e.g. for detecting the compiler ID for assemblers. # Compute the directory in which to run the test and Create a clean working directory. - SET(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang}) - FILE(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR}) - FILE(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}) - ENDIF(NOT CMAKE_${lang}_COMPILER_ID_DIR) + set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang}) + file(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR}) + file(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}) + endif() - FOREACH(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS}) - SET(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}}) - SET(regex ${CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor}}) - EXECUTE_PROCESS( + foreach(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS}) + set(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}}) + set(regex ${CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor}}) + execute_process( COMMAND ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_ARG1} ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} @@ -302,22 +430,22 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) TIMEOUT 10 ) - IF("${output}" MATCHES "${regex}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if("${output}" MATCHES "${regex}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " "matched \"${regex}\":\n${output}") - SET(CMAKE_${lang}_COMPILER_ID "${vendor}" PARENT_SCOPE) - BREAK() - ELSE() - IF("${result}" MATCHES "timeout") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + set(CMAKE_${lang}_COMPILER_ID "${vendor}" PARENT_SCOPE) + break() + else() + if("${result}" MATCHES "timeout") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " "terminated after 10 s due to timeout.") - ELSE() - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + else() + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " "did not match \"${regex}\":\n${output}") - ENDIF() - ENDIF() - ENDFOREACH() -ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR) + endif() + endif() + endforeach() +endfunction() diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index ade6d586c..f861e3954 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -15,214 +15,215 @@ # determine the compiler to use for Fortran programs # NOTE, a generator may set CMAKE_Fortran_COMPILER before # loading this file to force a compiler. -# use environment variable FC first if defined by user, next use +# use environment variable FC first if defined by user, next use # the cmake variable CMAKE_GENERATOR_FC which can be defined by a generator # as a default compiler -IF(NOT CMAKE_Fortran_COMPILER) - # prefer the environment variable CC - IF($ENV{FC} MATCHES ".+") - GET_FILENAME_COMPONENT(CMAKE_Fortran_COMPILER_INIT $ENV{FC} PROGRAM PROGRAM_ARGS CMAKE_Fortran_FLAGS_ENV_INIT) - IF(CMAKE_Fortran_FLAGS_ENV_INIT) - SET(CMAKE_Fortran_COMPILER_ARG1 "${CMAKE_Fortran_FLAGS_ENV_INIT}" CACHE STRING "First argument to Fortran compiler") - ENDIF(CMAKE_Fortran_FLAGS_ENV_INIT) - IF(EXISTS ${CMAKE_Fortran_COMPILER_INIT}) - ELSE(EXISTS ${CMAKE_Fortran_COMPILER_INIT}) - MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable FC:\n$ENV{FC}.") - ENDIF(EXISTS ${CMAKE_Fortran_COMPILER_INIT}) - ENDIF($ENV{FC} MATCHES ".+") - - # next try prefer the compiler specified by the generator - IF(CMAKE_GENERATOR_FC) - IF(NOT CMAKE_Fortran_COMPILER_INIT) - SET(CMAKE_Fortran_COMPILER_INIT ${CMAKE_GENERATOR_FC}) - ENDIF(NOT CMAKE_Fortran_COMPILER_INIT) - ENDIF(CMAKE_GENERATOR_FC) - - # finally list compilers to try - IF(CMAKE_Fortran_COMPILER_INIT) - SET(CMAKE_Fortran_COMPILER_LIST ${CMAKE_Fortran_COMPILER_INIT}) - ELSE(CMAKE_Fortran_COMPILER_INIT) - # Known compilers: - # f77/f90/f95: generic compiler names - # g77: GNU Fortran 77 compiler - # gfortran: putative GNU Fortran 95+ compiler (in progress) - # fort77: native F77 compiler under HP-UX (and some older Crays) - # frt: Fujitsu F77 compiler - # pathf90/pathf95/pathf2003: PathScale Fortran compiler - # pgf77/pgf90/pgf95/pgfortran: Portland Group F77/F90/F95 compilers - # xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers - # lf95: Lahey-Fujitsu F95 compiler - # fl32: Microsoft Fortran 77 "PowerStation" compiler - # af77: Apogee F77 compiler for Intergraph hardware running CLIX - # epcf90: "Edinburgh Portable Compiler" F90 - # fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha - # ifc: Intel Fortran 95 compiler for Linux/x86 - # efc: Intel Fortran 95 compiler for IA64 - # - # The order is 95 or newer compilers first, then 90, - # then 77 or older compilers, gnu is always last in the group, - # so if you paid for a compiler it is picked by default. - SET(CMAKE_Fortran_COMPILER_LIST - ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 pgfortran lf95 xlf95 - fort gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77 - frt pgf77 xlf fl32 af77 g77 f77 - ) - - # Vendor-specific compiler names. - SET(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77) - SET(_Fortran_COMPILER_NAMES_Intel ifort ifc efc) - SET(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77) - SET(_Fortran_COMPILER_NAMES_PGI pgf95 pgfortran pgf90 pgf77) - SET(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90) - SET(_Fortran_COMPILER_NAMES_XL xlf) - SET(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf) - - # Prefer vendors matching the C and C++ compilers. - SET(CMAKE_Fortran_COMPILER_LIST - ${_Fortran_COMPILER_NAMES_${CMAKE_C_COMPILER_ID}} - ${_Fortran_COMPILER_NAMES_${CMAKE_CXX_COMPILER_ID}} - ${CMAKE_Fortran_COMPILER_LIST}) - LIST(REMOVE_DUPLICATES CMAKE_Fortran_COMPILER_LIST) - ENDIF(CMAKE_Fortran_COMPILER_INIT) - - # Look for directories containing the C and C++ compilers. - SET(_Fortran_COMPILER_HINTS) - FOREACH(lang C CXX) - IF(CMAKE_${lang}_COMPILER AND IS_ABSOLUTE "${CMAKE_${lang}_COMPILER}") - GET_FILENAME_COMPONENT(_hint "${CMAKE_${lang}_COMPILER}" PATH) - IF(IS_DIRECTORY "${_hint}") - LIST(APPEND _Fortran_COMPILER_HINTS "${_hint}") - ENDIF() - SET(_hint) - ENDIF() - ENDFOREACH() - - # Find the compiler. - IF(_Fortran_COMPILER_HINTS) - # Prefer directories containing C and C++ compilers. - LIST(REMOVE_DUPLICATES _Fortran_COMPILER_HINTS) - FIND_PROGRAM(CMAKE_Fortran_COMPILER - NAMES ${CMAKE_Fortran_COMPILER_LIST} - PATHS ${_Fortran_COMPILER_HINTS} - NO_DEFAULT_PATH - DOC "Fortran compiler") - ENDIF() - FIND_PROGRAM(CMAKE_Fortran_COMPILER NAMES ${CMAKE_Fortran_COMPILER_LIST} DOC "Fortran compiler") - IF(CMAKE_Fortran_COMPILER_INIT AND NOT CMAKE_Fortran_COMPILER) - SET(CMAKE_Fortran_COMPILER "${CMAKE_Fortran_COMPILER_INIT}" CACHE FILEPATH "Fortran compiler" FORCE) - ENDIF(CMAKE_Fortran_COMPILER_INIT AND NOT CMAKE_Fortran_COMPILER) -ELSE(NOT CMAKE_Fortran_COMPILER) - # we only get here if CMAKE_Fortran_COMPILER was specified using -D or a pre-made CMakeCache.txt - # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE - # if CMAKE_Fortran_COMPILER is a list of length 2, use the first item as - # CMAKE_Fortran_COMPILER and the 2nd one as CMAKE_Fortran_COMPILER_ARG1 - - LIST(LENGTH CMAKE_Fortran_COMPILER _CMAKE_Fortran_COMPILER_LIST_LENGTH) - IF("${_CMAKE_Fortran_COMPILER_LIST_LENGTH}" EQUAL 2) - LIST(GET CMAKE_Fortran_COMPILER 1 CMAKE_Fortran_COMPILER_ARG1) - LIST(GET CMAKE_Fortran_COMPILER 0 CMAKE_Fortran_COMPILER) - ENDIF("${_CMAKE_Fortran_COMPILER_LIST_LENGTH}" EQUAL 2) - - # if a compiler was specified by the user but without path, - # now try to find it with the full path - # if it is found, force it into the cache, - # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" - # if the C compiler already had a path, reuse it for searching the CXX compiler - GET_FILENAME_COMPONENT(_CMAKE_USER_Fortran_COMPILER_PATH "${CMAKE_Fortran_COMPILER}" PATH) - IF(NOT _CMAKE_USER_Fortran_COMPILER_PATH) - FIND_PROGRAM(CMAKE_Fortran_COMPILER_WITH_PATH NAMES ${CMAKE_Fortran_COMPILER}) - MARK_AS_ADVANCED(CMAKE_Fortran_COMPILER_WITH_PATH) - IF(CMAKE_Fortran_COMPILER_WITH_PATH) - SET(CMAKE_Fortran_COMPILER ${CMAKE_Fortran_COMPILER_WITH_PATH} - CACHE STRING "Fortran compiler" FORCE) - ENDIF(CMAKE_Fortran_COMPILER_WITH_PATH) - ENDIF(NOT _CMAKE_USER_Fortran_COMPILER_PATH) -ENDIF(NOT CMAKE_Fortran_COMPILER) - -MARK_AS_ADVANCED(CMAKE_Fortran_COMPILER) - -# Build a small source file to identify the compiler. -IF(${CMAKE_GENERATOR} MATCHES "Visual Studio") - SET(CMAKE_Fortran_COMPILER_ID_RUN 1) - SET(CMAKE_Fortran_PLATFORM_ID "Windows") - SET(CMAKE_Fortran_COMPILER_ID "Intel") -ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio") - -IF(NOT CMAKE_Fortran_COMPILER_ID_RUN) - SET(CMAKE_Fortran_COMPILER_ID_RUN 1) +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) +include(Platform/${CMAKE_SYSTEM_NAME}-Fortran OPTIONAL) +if(NOT CMAKE_Fortran_COMPILER_NAMES) + set(CMAKE_Fortran_COMPILER_NAMES f95) +endif() + +if(${CMAKE_GENERATOR} MATCHES "Visual Studio") + set(CMAKE_Fortran_COMPILER_ID_RUN 1) + set(CMAKE_Fortran_PLATFORM_ID "Windows") + set(CMAKE_Fortran_COMPILER_ID "Intel") + set(CMAKE_Fortran_COMPILER "${CMAKE_GENERATOR_FC}") +elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") + set(CMAKE_Fortran_COMPILER_XCODE_TYPE sourcecode.fortran.f90) +else() + if(NOT CMAKE_Fortran_COMPILER) + # prefer the environment variable CC + if($ENV{FC} MATCHES ".+") + get_filename_component(CMAKE_Fortran_COMPILER_INIT $ENV{FC} PROGRAM PROGRAM_ARGS CMAKE_Fortran_FLAGS_ENV_INIT) + if(CMAKE_Fortran_FLAGS_ENV_INIT) + set(CMAKE_Fortran_COMPILER_ARG1 "${CMAKE_Fortran_FLAGS_ENV_INIT}" CACHE STRING "First argument to Fortran compiler") + endif() + if(EXISTS ${CMAKE_Fortran_COMPILER_INIT}) + else() + message(FATAL_ERROR "Could not find compiler set in environment variable FC:\n$ENV{FC}.") + endif() + endif() + + # next try prefer the compiler specified by the generator + if(CMAKE_GENERATOR_FC) + if(NOT CMAKE_Fortran_COMPILER_INIT) + set(CMAKE_Fortran_COMPILER_INIT ${CMAKE_GENERATOR_FC}) + endif() + endif() + + # finally list compilers to try + if(NOT CMAKE_Fortran_COMPILER_INIT) + # Known compilers: + # f77/f90/f95: generic compiler names + # g77: GNU Fortran 77 compiler + # gfortran: putative GNU Fortran 95+ compiler (in progress) + # fort77: native F77 compiler under HP-UX (and some older Crays) + # frt: Fujitsu F77 compiler + # pathf90/pathf95/pathf2003: PathScale Fortran compiler + # pgf77/pgf90/pgf95/pgfortran: Portland Group F77/F90/F95 compilers + # xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers + # lf95: Lahey-Fujitsu F95 compiler + # fl32: Microsoft Fortran 77 "PowerStation" compiler + # af77: Apogee F77 compiler for Intergraph hardware running CLIX + # epcf90: "Edinburgh Portable Compiler" F90 + # fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha + # ifc: Intel Fortran 95 compiler for Linux/x86 + # efc: Intel Fortran 95 compiler for IA64 + # + # The order is 95 or newer compilers first, then 90, + # then 77 or older compilers, gnu is always last in the group, + # so if you paid for a compiler it is picked by default. + set(CMAKE_Fortran_COMPILER_LIST + ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 pgfortran lf95 xlf95 + fort gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77 + frt pgf77 xlf fl32 af77 g77 f77 + ) + + # Vendor-specific compiler names. + set(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77) + set(_Fortran_COMPILER_NAMES_Intel ifort ifc efc) + set(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77) + set(_Fortran_COMPILER_NAMES_PGI pgf95 pgfortran pgf90 pgf77) + set(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90) + set(_Fortran_COMPILER_NAMES_XL xlf) + set(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf) + endif() + + _cmake_find_compiler(Fortran) + + else() + # we only get here if CMAKE_Fortran_COMPILER was specified using -D or a pre-made CMakeCache.txt + # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE + # if CMAKE_Fortran_COMPILER is a list of length 2, use the first item as + # CMAKE_Fortran_COMPILER and the 2nd one as CMAKE_Fortran_COMPILER_ARG1 + + list(LENGTH CMAKE_Fortran_COMPILER _CMAKE_Fortran_COMPILER_LIST_LENGTH) + if("${_CMAKE_Fortran_COMPILER_LIST_LENGTH}" EQUAL 2) + list(GET CMAKE_Fortran_COMPILER 1 CMAKE_Fortran_COMPILER_ARG1) + list(GET CMAKE_Fortran_COMPILER 0 CMAKE_Fortran_COMPILER) + endif() + + # if a compiler was specified by the user but without path, + # now try to find it with the full path + # if it is found, force it into the cache, + # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" + # if the C compiler already had a path, reuse it for searching the CXX compiler + get_filename_component(_CMAKE_USER_Fortran_COMPILER_PATH "${CMAKE_Fortran_COMPILER}" PATH) + if(NOT _CMAKE_USER_Fortran_COMPILER_PATH) + find_program(CMAKE_Fortran_COMPILER_WITH_PATH NAMES ${CMAKE_Fortran_COMPILER}) + mark_as_advanced(CMAKE_Fortran_COMPILER_WITH_PATH) + if(CMAKE_Fortran_COMPILER_WITH_PATH) + set(CMAKE_Fortran_COMPILER ${CMAKE_Fortran_COMPILER_WITH_PATH} + CACHE STRING "Fortran compiler" FORCE) + endif() + endif() + endif() + mark_as_advanced(CMAKE_Fortran_COMPILER) # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce # a valid identification executable. - SET(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS + set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS # Try compiling to an object file only. "-c" # Intel on windows does not preprocess by default. "-fpp" ) +endif() + +# Build a small source file to identify the compiler. +if(NOT CMAKE_Fortran_COMPILER_ID_RUN) + set(CMAKE_Fortran_COMPILER_ID_RUN 1) # Table of per-vendor compiler id flags with expected output. - LIST(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq) - SET(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_Compaq "-what") - SET(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_Compaq "Compaq Visual Fortran") - LIST(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS NAG) # Numerical Algorithms Group - SET(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_NAG "-V") - SET(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_NAG "NAG Fortran Compiler") + list(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq) + set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_Compaq "-what") + set(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_Compaq "Compaq Visual Fortran") + list(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS NAG) # Numerical Algorithms Group + set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_NAG "-V") + set(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_NAG "NAG Fortran Compiler") # Try to identify the compiler. - SET(CMAKE_Fortran_COMPILER_ID) - INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) + set(CMAKE_Fortran_COMPILER_ID) + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) CMAKE_DETERMINE_COMPILER_ID(Fortran FFLAGS CMakeFortranCompilerId.F) # Fall back to old is-GNU test. - IF(NOT CMAKE_Fortran_COMPILER_ID) - EXEC_PROGRAM(${CMAKE_Fortran_COMPILER} + if(NOT CMAKE_Fortran_COMPILER_ID) + exec_program(${CMAKE_Fortran_COMPILER} ARGS ${CMAKE_Fortran_COMPILER_ID_FLAGS_LIST} -E "\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\"" OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN) - IF(NOT CMAKE_COMPILER_RETURN) - IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" ) - SET(CMAKE_Fortran_COMPILER_ID "GNU") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if(NOT CMAKE_COMPILER_RETURN) + if("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" ) + set(CMAKE_Fortran_COMPILER_ID "GNU") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the Fortran compiler is GNU succeeded with " "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n") - ELSE("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" ) - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + else() + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the Fortran compiler is GNU failed with " "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n") - ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" ) - IF(NOT CMAKE_Fortran_PLATFORM_ID) - IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" ) - SET(CMAKE_Fortran_PLATFORM_ID "MinGW") - ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" ) - IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" ) - SET(CMAKE_Fortran_PLATFORM_ID "Cygwin") - ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" ) - ENDIF(NOT CMAKE_Fortran_PLATFORM_ID) - ENDIF(NOT CMAKE_COMPILER_RETURN) - ENDIF(NOT CMAKE_Fortran_COMPILER_ID) + endif() + if(NOT CMAKE_Fortran_PLATFORM_ID) + if("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" ) + set(CMAKE_Fortran_PLATFORM_ID "MinGW") + endif() + if("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" ) + set(CMAKE_Fortran_PLATFORM_ID "Cygwin") + endif() + endif() + endif() + endif() # Set old compiler and platform id variables. - IF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") - SET(CMAKE_COMPILER_IS_GNUG77 1) - ENDIF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") - IF("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "MinGW") - SET(CMAKE_COMPILER_IS_MINGW 1) - ELSEIF("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "Cygwin") - SET(CMAKE_COMPILER_IS_CYGWIN 1) - ENDIF("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "MinGW") -ENDIF(NOT CMAKE_Fortran_COMPILER_ID_RUN) - -INCLUDE(CMakeFindBinUtils) - -IF(MSVC_Fortran_ARCHITECTURE_ID) - SET(SET_MSVC_Fortran_ARCHITECTURE_ID - "SET(MSVC_Fortran_ARCHITECTURE_ID ${MSVC_Fortran_ARCHITECTURE_ID})") -ENDIF() + if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + set(CMAKE_COMPILER_IS_GNUG77 1) + endif() + if("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "MinGW") + set(CMAKE_COMPILER_IS_MINGW 1) + elseif("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "Cygwin") + set(CMAKE_COMPILER_IS_CYGWIN 1) + endif() +endif() + +if (NOT _CMAKE_TOOLCHAIN_LOCATION) + get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Fortran_COMPILER}" PATH) +endif () + +# if we have a fortran cross compiler, they have usually some prefix, like +# e.g. powerpc-linux-gfortran, arm-elf-gfortran or i586-mingw32msvc-gfortran , optionally +# with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2). +# The other tools of the toolchain usually have the same prefix +# NAME_WE cannot be used since then this test will fail for names lile +# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be +# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" +if (CMAKE_CROSSCOMPILING + AND "${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU" + AND NOT _CMAKE_TOOLCHAIN_PREFIX) + get_filename_component(COMPILER_BASENAME "${CMAKE_Fortran_COMPILER}" NAME) + if (COMPILER_BASENAME MATCHES "^(.+-)g?fortran(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + endif () + + # if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils + # but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.) + if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + endif () +endif () + +include(CMakeFindBinUtils) + +if(MSVC_Fortran_ARCHITECTURE_ID) + set(SET_MSVC_Fortran_ARCHITECTURE_ID + "set(MSVC_Fortran_ARCHITECTURE_ID ${MSVC_Fortran_ARCHITECTURE_ID})") +endif() # configure variables set in this file for fast reload later on -CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake +configure_file(${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) -SET(CMAKE_Fortran_COMPILER_ENV_VAR "FC") +set(CMAKE_Fortran_COMPILER_ENV_VAR "FC") diff --git a/Modules/CMakeDetermineJavaCompiler.cmake b/Modules/CMakeDetermineJavaCompiler.cmake index aefcaba36..ae9f5fcaf 100644 --- a/Modules/CMakeDetermineJavaCompiler.cmake +++ b/Modules/CMakeDetermineJavaCompiler.cmake @@ -16,33 +16,33 @@ # NOTE, a generator may set CMAKE_Java_COMPILER before # loading this file to force a compiler. -IF(NOT CMAKE_Java_COMPILER) +if(NOT CMAKE_Java_COMPILER) # prefer the environment variable CC - IF($ENV{JAVA_COMPILER} MATCHES ".+") - GET_FILENAME_COMPONENT(CMAKE_Java_COMPILER_INIT $ENV{JAVA_COMPILER} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT) - IF(CMAKE_Java_FLAGS_ENV_INIT) - SET(CMAKE_Java_COMPILER_ARG1 "${CMAKE_Java_FLAGS_ENV_INIT}" CACHE STRING "First argument to Java compiler") - ENDIF(CMAKE_Java_FLAGS_ENV_INIT) - IF(NOT EXISTS ${CMAKE_Java_COMPILER_INIT}) - MESSAGE(SEND_ERROR "Could not find compiler set in environment variable JAVA_COMPILER:\n$ENV{JAVA_COMPILER}.") - ENDIF(NOT EXISTS ${CMAKE_Java_COMPILER_INIT}) - ENDIF($ENV{JAVA_COMPILER} MATCHES ".+") + if($ENV{JAVA_COMPILER} MATCHES ".+") + get_filename_component(CMAKE_Java_COMPILER_INIT $ENV{JAVA_COMPILER} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT) + if(CMAKE_Java_FLAGS_ENV_INIT) + set(CMAKE_Java_COMPILER_ARG1 "${CMAKE_Java_FLAGS_ENV_INIT}" CACHE STRING "First argument to Java compiler") + endif() + if(NOT EXISTS ${CMAKE_Java_COMPILER_INIT}) + message(SEND_ERROR "Could not find compiler set in environment variable JAVA_COMPILER:\n$ENV{JAVA_COMPILER}.") + endif() + endif() - IF($ENV{JAVA_RUNTIME} MATCHES ".+") - GET_FILENAME_COMPONENT(CMAKE_Java_RUNTIME_INIT $ENV{JAVA_RUNTIME} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT) - IF(NOT EXISTS ${CMAKE_Java_RUNTIME_INIT}) - MESSAGE(SEND_ERROR "Could not find compiler set in environment variable JAVA_RUNTIME:\n$ENV{JAVA_RUNTIME}.") - ENDIF(NOT EXISTS ${CMAKE_Java_RUNTIME_INIT}) - ENDIF($ENV{JAVA_RUNTIME} MATCHES ".+") + if($ENV{JAVA_RUNTIME} MATCHES ".+") + get_filename_component(CMAKE_Java_RUNTIME_INIT $ENV{JAVA_RUNTIME} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT) + if(NOT EXISTS ${CMAKE_Java_RUNTIME_INIT}) + message(SEND_ERROR "Could not find compiler set in environment variable JAVA_RUNTIME:\n$ENV{JAVA_RUNTIME}.") + endif() + endif() - IF($ENV{JAVA_ARCHIVE} MATCHES ".+") - GET_FILENAME_COMPONENT(CMAKE_Java_ARCHIVE_INIT $ENV{JAVA_ARCHIVE} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT) - IF(NOT EXISTS ${CMAKE_Java_ARCHIVE_INIT}) - MESSAGE(SEND_ERROR "Could not find compiler set in environment variable JAVA_ARCHIVE:\n$ENV{JAVA_ARCHIVE}.") - ENDIF(NOT EXISTS ${CMAKE_Java_ARCHIVE_INIT}) - ENDIF($ENV{JAVA_ARCHIVE} MATCHES ".+") + if($ENV{JAVA_ARCHIVE} MATCHES ".+") + get_filename_component(CMAKE_Java_ARCHIVE_INIT $ENV{JAVA_ARCHIVE} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT) + if(NOT EXISTS ${CMAKE_Java_ARCHIVE_INIT}) + message(SEND_ERROR "Could not find compiler set in environment variable JAVA_ARCHIVE:\n$ENV{JAVA_ARCHIVE}.") + endif() + endif() - SET(Java_BIN_PATH + set(Java_BIN_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\2.0;JavaHome]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/bin" @@ -63,40 +63,42 @@ IF(NOT CMAKE_Java_COMPILER) /usr/java/j2sdk1.4.2_09/bin /usr/lib/j2sdk1.5-sun/bin /opt/sun-jdk-1.5.0.04/bin + /usr/local/jdk-1.7.0/bin + /usr/local/jdk-1.6.0/bin ) # if no compiler has been specified yet, then look for one - IF(CMAKE_Java_COMPILER_INIT) - SET(CMAKE_Java_COMPILER ${CMAKE_Java_COMPILER_INIT} CACHE PATH "Java Compiler") - ELSE(CMAKE_Java_COMPILER_INIT) - FIND_PROGRAM(CMAKE_Java_COMPILER + if(CMAKE_Java_COMPILER_INIT) + set(CMAKE_Java_COMPILER ${CMAKE_Java_COMPILER_INIT} CACHE PATH "Java Compiler") + else() + find_program(CMAKE_Java_COMPILER NAMES javac PATHS ${Java_BIN_PATH} - ) - ENDIF(CMAKE_Java_COMPILER_INIT) + ) + endif() # if no runtime has been specified yet, then look for one - IF(CMAKE_Java_RUNTIME_INIT) - SET(CMAKE_Java_RUNTIME ${CMAKE_Java_RUNTIME_INIT} CACHE PATH "Java Compiler") - ELSE(CMAKE_Java_RUNTIME_INIT) - FIND_PROGRAM(CMAKE_Java_RUNTIME + if(CMAKE_Java_RUNTIME_INIT) + set(CMAKE_Java_RUNTIME ${CMAKE_Java_RUNTIME_INIT} CACHE PATH "Java Compiler") + else() + find_program(CMAKE_Java_RUNTIME NAMES java PATHS ${Java_BIN_PATH} - ) - ENDIF(CMAKE_Java_RUNTIME_INIT) + ) + endif() # if no archive has been specified yet, then look for one - IF(CMAKE_Java_ARCHIVE_INIT) - SET(CMAKE_Java_ARCHIVE ${CMAKE_Java_ARCHIVE_INIT} CACHE PATH "Java Compiler") - ELSE(CMAKE_Java_ARCHIVE_INIT) - FIND_PROGRAM(CMAKE_Java_ARCHIVE + if(CMAKE_Java_ARCHIVE_INIT) + set(CMAKE_Java_ARCHIVE ${CMAKE_Java_ARCHIVE_INIT} CACHE PATH "Java Compiler") + else() + find_program(CMAKE_Java_ARCHIVE NAMES jar PATHS ${Java_BIN_PATH} - ) - ENDIF(CMAKE_Java_ARCHIVE_INIT) -ENDIF(NOT CMAKE_Java_COMPILER) -MARK_AS_ADVANCED(CMAKE_Java_COMPILER) + ) + endif() +endif() +mark_as_advanced(CMAKE_Java_COMPILER) # configure variables set in this file for fast reload later on -CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeJavaCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeJavaCompiler.cmake IMMEDIATE @ONLY) -SET(CMAKE_Java_COMPILER_ENV_VAR "JAVA_COMPILER") +configure_file(${CMAKE_ROOT}/Modules/CMakeJavaCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeJavaCompiler.cmake IMMEDIATE @ONLY) +set(CMAKE_Java_COMPILER_ENV_VAR "JAVA_COMPILER") diff --git a/Modules/CMakeDetermineRCCompiler.cmake b/Modules/CMakeDetermineRCCompiler.cmake index 8e085af7a..fa78da03c 100644 --- a/Modules/CMakeDetermineRCCompiler.cmake +++ b/Modules/CMakeDetermineRCCompiler.cmake @@ -15,53 +15,53 @@ # determine the compiler to use for C programs # NOTE, a generator may set CMAKE_C_COMPILER before # loading this file to force a compiler. -# use environment variable CCC first if defined by user, next use +# use environment variable CCC first if defined by user, next use # the cmake variable CMAKE_GENERATOR_CC which can be defined by a generator # as a default compiler -IF(NOT CMAKE_RC_COMPILER) +if(NOT CMAKE_RC_COMPILER) # prefer the environment variable CC - IF($ENV{RC} MATCHES ".+") - GET_FILENAME_COMPONENT(CMAKE_RC_COMPILER_INIT $ENV{RC} PROGRAM PROGRAM_ARGS CMAKE_RC_FLAGS_ENV_INIT) - IF(CMAKE_RC_FLAGS_ENV_INIT) - SET(CMAKE_RC_COMPILER_ARG1 "${CMAKE_RC_FLAGS_ENV_INIT}" CACHE STRING "First argument to RC compiler") - ENDIF(CMAKE_RC_FLAGS_ENV_INIT) - IF(EXISTS ${CMAKE_RC_COMPILER_INIT}) - ELSE(EXISTS ${CMAKE_RC_COMPILER_INIT}) - MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable RC:\n$ENV{RC}.") - ENDIF(EXISTS ${CMAKE_RC_COMPILER_INIT}) - ENDIF($ENV{RC} MATCHES ".+") - + if($ENV{RC} MATCHES ".+") + get_filename_component(CMAKE_RC_COMPILER_INIT $ENV{RC} PROGRAM PROGRAM_ARGS CMAKE_RC_FLAGS_ENV_INIT) + if(CMAKE_RC_FLAGS_ENV_INIT) + set(CMAKE_RC_COMPILER_ARG1 "${CMAKE_RC_FLAGS_ENV_INIT}" CACHE STRING "First argument to RC compiler") + endif() + if(EXISTS ${CMAKE_RC_COMPILER_INIT}) + else() + message(FATAL_ERROR "Could not find compiler set in environment variable RC:\n$ENV{RC}.") + endif() + endif() + # next try prefer the compiler specified by the generator - IF(CMAKE_GENERATOR_RC) - IF(NOT CMAKE_RC_COMPILER_INIT) - SET(CMAKE_RC_COMPILER_INIT ${CMAKE_GENERATOR_RC}) - ENDIF(NOT CMAKE_RC_COMPILER_INIT) - ENDIF(CMAKE_GENERATOR_RC) + if(CMAKE_GENERATOR_RC) + if(NOT CMAKE_RC_COMPILER_INIT) + set(CMAKE_RC_COMPILER_INIT ${CMAKE_GENERATOR_RC}) + endif() + endif() # finally list compilers to try - IF(CMAKE_RC_COMPILER_INIT) - SET(CMAKE_RC_COMPILER_LIST ${CMAKE_RC_COMPILER_INIT}) - ELSE(CMAKE_RC_COMPILER_INIT) - SET(CMAKE_RC_COMPILER_LIST rc) - ENDIF(CMAKE_RC_COMPILER_INIT) + if(CMAKE_RC_COMPILER_INIT) + set(CMAKE_RC_COMPILER_LIST ${CMAKE_RC_COMPILER_INIT}) + else() + set(CMAKE_RC_COMPILER_LIST rc) + endif() # Find the compiler. - FIND_PROGRAM(CMAKE_RC_COMPILER NAMES ${CMAKE_RC_COMPILER_LIST} DOC "RC compiler") - IF(CMAKE_RC_COMPILER_INIT AND NOT CMAKE_RC_COMPILER) - SET(CMAKE_RC_COMPILER "${CMAKE_RC_COMPILER_INIT}" CACHE FILEPATH "RC compiler" FORCE) - ENDIF(CMAKE_RC_COMPILER_INIT AND NOT CMAKE_RC_COMPILER) -ENDIF(NOT CMAKE_RC_COMPILER) + find_program(CMAKE_RC_COMPILER NAMES ${CMAKE_RC_COMPILER_LIST} DOC "RC compiler") + if(CMAKE_RC_COMPILER_INIT AND NOT CMAKE_RC_COMPILER) + set(CMAKE_RC_COMPILER "${CMAKE_RC_COMPILER_INIT}" CACHE FILEPATH "RC compiler" FORCE) + endif() +endif() -MARK_AS_ADVANCED(CMAKE_RC_COMPILER) +mark_as_advanced(CMAKE_RC_COMPILER) -GET_FILENAME_COMPONENT(_CMAKE_RC_COMPILER_NAME_WE ${CMAKE_RC_COMPILER} NAME_WE) -IF(_CMAKE_RC_COMPILER_NAME_WE STREQUAL "windres") - SET(CMAKE_RC_OUTPUT_EXTENSION .obj) -ELSE() - SET(CMAKE_RC_OUTPUT_EXTENSION .res) -ENDIF() +get_filename_component(_CMAKE_RC_COMPILER_NAME_WE ${CMAKE_RC_COMPILER} NAME_WE) +if(_CMAKE_RC_COMPILER_NAME_WE STREQUAL "windres") + set(CMAKE_RC_OUTPUT_EXTENSION .obj) +else() + set(CMAKE_RC_OUTPUT_EXTENSION .res) +endif() # configure variables set in this file for fast reload later on -CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeRCCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeRCCompiler.cmake IMMEDIATE) -SET(CMAKE_RC_COMPILER_ENV_VAR "RC") +configure_file(${CMAKE_ROOT}/Modules/CMakeRCCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeRCCompiler.cmake IMMEDIATE) +set(CMAKE_RC_COMPILER_ENV_VAR "RC") diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 7ae377517..3a95d2a6f 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -19,158 +19,168 @@ # # Expected uname -s output: # -# AIX AIX -# BSD/OS BSD/OS -# FreeBSD FreeBSD -# HP-UX HP-UX -# IRIX IRIX -# Linux Linux +# AIX AIX +# BSD/OS BSD/OS +# FreeBSD FreeBSD +# HP-UX HP-UX +# IRIX IRIX +# Linux Linux # GNU/kFreeBSD GNU/kFreeBSD -# NetBSD NetBSD -# OpenBSD OpenBSD -# OFS/1 (Digital Unix) OSF1 -# SCO OpenServer 5 SCO_SV -# SCO UnixWare 7 UnixWare -# SCO UnixWare (pre release 7) UNIX_SV -# SCO XENIX Xenix -# Solaris SunOS -# SunOS SunOS -# Tru64 Tru64 -# Ultrix ULTRIX +# NetBSD NetBSD +# OpenBSD OpenBSD +# OFS/1 (Digital Unix) OSF1 +# SCO OpenServer 5 SCO_SV +# SCO UnixWare 7 UnixWare +# SCO UnixWare (pre release 7) UNIX_SV +# SCO XENIX Xenix +# Solaris SunOS +# SunOS SunOS +# Tru64 Tru64 +# Ultrix ULTRIX # cygwin CYGWIN_NT-5.1 # MacOSX Darwin # find out on which system cmake runs -IF(CMAKE_HOST_UNIX) - FIND_PROGRAM(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin ) - IF(CMAKE_UNAME) - EXEC_PROGRAM(uname ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_NAME) - EXEC_PROGRAM(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION) - IF(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*") - EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR +if(CMAKE_HOST_UNIX) + find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin ) + if(CMAKE_UNAME) + exec_program(uname ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_NAME) + exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION) + if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*") + exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) - ELSEIF(CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD") - EXEC_PROGRAM(arch ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR + elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD") + exec_program(arch ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) - ELSE() - EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR + else() + exec_program(uname ARGS -p OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) - IF("${val}" GREATER 0) - EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR + if("${val}" GREATER 0) + exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) - ENDIF("${val}" GREATER 0) - ENDIF() - # check the return of the last uname -m or -p - IF("${val}" GREATER 0) - SET(CMAKE_HOST_SYSTEM_PROCESSOR "unknown") - ENDIF("${val}" GREATER 0) - SET(CMAKE_UNAME ${CMAKE_UNAME} CACHE INTERNAL "uname command") + endif() + endif() + # check the return of the last uname -m or -p + if("${val}" GREATER 0) + set(CMAKE_HOST_SYSTEM_PROCESSOR "unknown") + endif() + set(CMAKE_UNAME ${CMAKE_UNAME} CACHE INTERNAL "uname command") # processor may have double quote in the name, and that needs to be removed - STRING(REGEX REPLACE "\"" "" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") - STRING(REGEX REPLACE "/" "_" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") - ENDIF(CMAKE_UNAME) -ELSE(CMAKE_HOST_UNIX) - IF(CMAKE_HOST_WIN32) - SET (CMAKE_HOST_SYSTEM_NAME "Windows") - SET (CMAKE_HOST_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}") - ENDIF(CMAKE_HOST_WIN32) -ENDIF(CMAKE_HOST_UNIX) + string(REGEX REPLACE "\"" "" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") + string(REGEX REPLACE "/" "_" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") + endif() +else() + if(CMAKE_HOST_WIN32) + set (CMAKE_HOST_SYSTEM_NAME "Windows") + if (DEFINED ENV{PROCESSOR_ARCHITEW6432}) + set (CMAKE_HOST_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITEW6432}") + else() + set (CMAKE_HOST_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}") + endif() + endif() +endif() # if a toolchain file is used, the user wants to cross compile. # in this case read the toolchain file and keep the CMAKE_HOST_SYSTEM_* -# variables around so they can be used in CMakeLists.txt. +# variables around so they can be used in CMakeLists.txt. # In all other cases, the host and target platform are the same. -IF(CMAKE_TOOLCHAIN_FILE) +if(CMAKE_TOOLCHAIN_FILE) # at first try to load it as path relative to the directory from which cmake has been run - INCLUDE("${CMAKE_BINARY_DIR}/${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE) - IF(NOT _INCLUDED_TOOLCHAIN_FILE) + include("${CMAKE_BINARY_DIR}/${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE) + if(NOT _INCLUDED_TOOLCHAIN_FILE) # if the file isn't found there, check the default locations - INCLUDE("${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE) - ENDIF(NOT _INCLUDED_TOOLCHAIN_FILE) + include("${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE) + endif() - IF(_INCLUDED_TOOLCHAIN_FILE) - SET(CMAKE_TOOLCHAIN_FILE "${_INCLUDED_TOOLCHAIN_FILE}" CACHE FILEPATH "The CMake toolchain file" FORCE) - ELSE(_INCLUDED_TOOLCHAIN_FILE) - MESSAGE(FATAL_ERROR "Could not find toolchain file: ${CMAKE_TOOLCHAIN_FILE}") - SET(CMAKE_TOOLCHAIN_FILE "NOTFOUND" CACHE FILEPATH "The CMake toolchain file" FORCE) - ENDIF(_INCLUDED_TOOLCHAIN_FILE) -ENDIF(CMAKE_TOOLCHAIN_FILE) + if(_INCLUDED_TOOLCHAIN_FILE) + set(CMAKE_TOOLCHAIN_FILE "${_INCLUDED_TOOLCHAIN_FILE}" CACHE FILEPATH "The CMake toolchain file" FORCE) + else() + message(FATAL_ERROR "Could not find toolchain file: ${CMAKE_TOOLCHAIN_FILE}") + set(CMAKE_TOOLCHAIN_FILE "NOTFOUND" CACHE FILEPATH "The CMake toolchain file" FORCE) + endif() +endif() # if CMAKE_SYSTEM_NAME is here already set, either it comes from a toolchain file # or it was set via -DCMAKE_SYSTEM_NAME=... # if that's the case, assume we are crosscompiling -IF(CMAKE_SYSTEM_NAME) - IF(NOT DEFINED CMAKE_CROSSCOMPILING) - SET(CMAKE_CROSSCOMPILING TRUE) - ENDIF(NOT DEFINED CMAKE_CROSSCOMPILING) - SET(PRESET_CMAKE_SYSTEM_NAME TRUE) -ELSE(CMAKE_SYSTEM_NAME) - SET(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}") - SET(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}") - SET(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") - SET(CMAKE_CROSSCOMPILING FALSE) - SET(PRESET_CMAKE_SYSTEM_NAME FALSE) -ENDIF(CMAKE_SYSTEM_NAME) - - -MACRO(ADJUST_CMAKE_SYSTEM_VARIABLES _PREFIX) - IF(NOT ${_PREFIX}_NAME) - SET(${_PREFIX}_NAME "UnknownOS") - ENDIF(NOT ${_PREFIX}_NAME) +if(CMAKE_SYSTEM_NAME) + if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING TRUE) + endif() + set(PRESET_CMAKE_SYSTEM_NAME TRUE) +elseif(CMAKE_VS_WINCE_VERSION) + set(CMAKE_SYSTEM_NAME "WindowsCE") + set(CMAKE_SYSTEM_VERSION "${CMAKE_VS_WINCE_VERSION}") + set(CMAKE_SYSTEM_PROCESSOR "${MSVC_C_ARCHITECTURE_ID}") + set(CMAKE_CROSSCOMPILING TRUE) + set(PRESET_CMAKE_SYSTEM_NAME TRUE) +else() + set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}") + set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}") + set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") + set(CMAKE_CROSSCOMPILING FALSE) + set(PRESET_CMAKE_SYSTEM_NAME FALSE) +endif() + + +macro(ADJUST_CMAKE_SYSTEM_VARIABLES _PREFIX) + if(NOT ${_PREFIX}_NAME) + set(${_PREFIX}_NAME "UnknownOS") + endif() # fix for BSD/OS , remove the / - IF(${_PREFIX}_NAME MATCHES BSD.OS) - SET(${_PREFIX}_NAME BSDOS) - ENDIF(${_PREFIX}_NAME MATCHES BSD.OS) + if(${_PREFIX}_NAME MATCHES BSD.OS) + set(${_PREFIX}_NAME BSDOS) + endif() # fix for GNU/kFreeBSD, remove the GNU/ - IF(${_PREFIX}_NAME MATCHES kFreeBSD) - SET(${_PREFIX}_NAME kFreeBSD) - ENDIF(${_PREFIX}_NAME MATCHES kFreeBSD) + if(${_PREFIX}_NAME MATCHES kFreeBSD) + set(${_PREFIX}_NAME kFreeBSD) + endif() - # fix for CYGWIN which has windows version in it - IF(${_PREFIX}_NAME MATCHES CYGWIN) - SET(${_PREFIX}_NAME CYGWIN) - ENDIF(${_PREFIX}_NAME MATCHES CYGWIN) + # fix for CYGWIN which has windows version in it + if(${_PREFIX}_NAME MATCHES CYGWIN) + set(${_PREFIX}_NAME CYGWIN) + endif() # set CMAKE_SYSTEM to the CMAKE_SYSTEM_NAME - SET(${_PREFIX} ${${_PREFIX}_NAME}) + set(${_PREFIX} ${${_PREFIX}_NAME}) # if there is a CMAKE_SYSTEM_VERSION then add a -${CMAKE_SYSTEM_VERSION} - IF(${_PREFIX}_VERSION) - SET(${_PREFIX} ${${_PREFIX}}-${${_PREFIX}_VERSION}) - ENDIF(${_PREFIX}_VERSION) + if(${_PREFIX}_VERSION) + set(${_PREFIX} ${${_PREFIX}}-${${_PREFIX}_VERSION}) + endif() -ENDMACRO(ADJUST_CMAKE_SYSTEM_VARIABLES _PREFIX) +endmacro() ADJUST_CMAKE_SYSTEM_VARIABLES(CMAKE_SYSTEM) ADJUST_CMAKE_SYSTEM_VARIABLES(CMAKE_HOST_SYSTEM) -# this file is also executed from cpack, then we don't need to generate these files +# this file is also executed from cpack, then we don't need to generate these files # in this case there is no CMAKE_BINARY_DIR -IF(CMAKE_BINARY_DIR) +if(CMAKE_BINARY_DIR) # write entry to the log file - IF(PRESET_CMAKE_SYSTEM_NAME) - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if(PRESET_CMAKE_SYSTEM_NAME) + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "The target system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "The host system is: ${CMAKE_HOST_SYSTEM_NAME} - ${CMAKE_HOST_SYSTEM_VERSION} - ${CMAKE_HOST_SYSTEM_PROCESSOR}\n") - ELSE(PRESET_CMAKE_SYSTEM_NAME) - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + else() + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "The system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n") - ENDIF(PRESET_CMAKE_SYSTEM_NAME) + endif() # if a toolchain file is used, it needs to be included in the configured file, - # so settings done there are also available if they don't go in the cache and in TRY_COMPILE() - SET(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED) - IF(DEFINED CMAKE_TOOLCHAIN_FILE) - SET(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED "INCLUDE(\"${CMAKE_TOOLCHAIN_FILE}\")") - ENDIF(DEFINED CMAKE_TOOLCHAIN_FILE) + # so settings done there are also available if they don't go in the cache and in try_compile() + set(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED) + if(DEFINED CMAKE_TOOLCHAIN_FILE) + set(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED "include(\"${CMAKE_TOOLCHAIN_FILE}\")") + endif() # configure variables set in this file for fast reload, the template file is defined at the top of this file - CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake + configure_file(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeSystem.cmake IMMEDIATE @ONLY) -ENDIF(CMAKE_BINARY_DIR) +endif() diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake index 33f01415e..98e5bb873 100644 --- a/Modules/CMakeDetermineVSServicePack.cmake +++ b/Modules/CMakeDetermineVSServicePack.cmake @@ -9,6 +9,7 @@ # vc90sp1 # vc100 # vc100sp1 +# vc110 # # Usage: # =========================== @@ -54,6 +55,8 @@ function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version) set(_version "vc100") elseif(${_cl_version} VERSION_EQUAL "16.00.40219.01") set(_version "vc100sp1") + elseif(${_cl_version} VERSION_EQUAL "17.00.50727.1") + set(_version "vc110") else() set(_version "") endif() diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake index fba071a06..f5c009cad 100644 --- a/Modules/CMakeExpandImportedTargets.cmake +++ b/Modules/CMakeExpandImportedTargets.cmake @@ -10,7 +10,7 @@ # the first configuration from ${CMAKE_CONFIGURATION_TYPES} if set, otherwise # ${CMAKE_BUILD_TYPE}. # This macro is used by all Check*.cmake files which use -# TRY_COMPILE() or TRY_RUN() and support CMAKE_REQUIRED_LIBRARIES , so that +# try_compile() or try_run() and support CMAKE_REQUIRED_LIBRARIES , so that # these checks support imported targets in CMAKE_REQUIRED_LIBRARIES: # cmake_expand_imported_targets(expandedLibs LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} # CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}" ) @@ -30,7 +30,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -include(CMakeParseArguments) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT ) @@ -76,16 +76,16 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT ) # guard against infinite loop: abort after 100 iterations ( 100 is arbitrary chosen) if ("${_CCSR_LOOP_COUNTER}" LESS 100) set(_CHECK_FOR_IMPORTED_TARGETS TRUE) -# else ("${_CCSR_LOOP_COUNTER}" LESS 1) +# else () # message(STATUS "********* aborting loop, counter : ${_CCSR_LOOP_COUNTER}") - endif ("${_CCSR_LOOP_COUNTER}" LESS 100) + endif () # if one of the imported configurations equals ${CMAKE_TRY_COMPILE_CONFIGURATION}, # use it, otherwise simply use the first one: list(FIND _importedConfigs "${CEIT_CONFIGURATION}" _configIndexToUse) if("${_configIndexToUse}" EQUAL -1) set(_configIndexToUse 0) - endif("${_configIndexToUse}" EQUAL -1) + endif() list(GET _importedConfigs ${_configIndexToUse} _importedConfigToUse) get_target_property(_importedLocation "${_CURRENT_LIB}" IMPORTED_LOCATION_${_importedConfigToUse}) @@ -98,18 +98,18 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT ) # message(STATUS "Appending link interface lib ${_currentLinkInterfaceLib}") if(_currentLinkInterfaceLib) list(APPEND _CCSR_NEW_REQ_LIBS "${_currentLinkInterfaceLib}" ) - endif(_currentLinkInterfaceLib) - endforeach(_currentLinkInterfaceLib "${_linkInterfaceLibs}") - endif(_linkInterfaceLibs) - else(_importedConfigs) + endif() + endforeach() + endif() + else() # "Normal" libraries are just used as they are. list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" ) # message(STATUS "Appending lib directly: ${_CURRENT_LIB}") - endif(_importedConfigs) - endforeach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) + endif() + endforeach() set(_CCSR_REQ_LIBS ${_CCSR_NEW_REQ_LIBS} ) - endwhile(_CHECK_FOR_IMPORTED_TARGETS) + endwhile() # Finally we iterate once more over all libraries. This loop only removes # all remaining imported target names (there shouldn't be any left anyway). @@ -119,10 +119,10 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT ) if (NOT _importedConfigs) list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" ) # message(STATUS "final: appending ${_CURRENT_LIB}") - else (NOT _importedConfigs) + else () # message(STATUS "final: skipping ${_CURRENT_LIB}") - endif (NOT _importedConfigs) - endforeach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) + endif () + endforeach() # message(STATUS "setting -${_RESULT}- to -${_CCSR_NEW_REQ_LIBS}-") set(${_RESULT} "${_CCSR_NEW_REQ_LIBS}" PARENT_SCOPE) diff --git a/Modules/CMakeExportBuildSettings.cmake b/Modules/CMakeExportBuildSettings.cmake index 8d316b941..a18f95062 100644 --- a/Modules/CMakeExportBuildSettings.cmake +++ b/Modules/CMakeExportBuildSettings.cmake @@ -13,24 +13,24 @@ # License text for the above reference.) # This module is purposely no longer documented. It does nothing useful. -IF(NOT "${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS 2.7) - MESSAGE(FATAL_ERROR +if(NOT "${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS 2.7) + message(FATAL_ERROR "The functionality of this module has been dropped as of CMake 2.8. " "It was deemed harmful (confusing users by changing their compiler). " "Please remove calls to the CMAKE_EXPORT_BUILD_SETTINGS macro and " "stop including this module. " "If this project generates any files for use by external projects, " "remove any use of the CMakeImportBuildSettings module from them.") -ENDIF() +endif() # This macro used to store build settings of a project in a file to be # loaded by another project using CMAKE_IMPORT_BUILD_SETTINGS. Now it # creates a file that refuses to load (with comment explaining why). -MACRO(CMAKE_EXPORT_BUILD_SETTINGS SETTINGS_FILE) - IF(${SETTINGS_FILE} MATCHES ".+") - CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeBuildSettings.cmake.in +macro(CMAKE_EXPORT_BUILD_SETTINGS SETTINGS_FILE) + if(${SETTINGS_FILE} MATCHES ".+") + configure_file(${CMAKE_ROOT}/Modules/CMakeBuildSettings.cmake.in ${SETTINGS_FILE} @ONLY IMMEDIATE) - ELSE(${SETTINGS_FILE} MATCHES ".+") - MESSAGE(SEND_ERROR "CMAKE_EXPORT_BUILD_SETTINGS called with no argument.") - ENDIF(${SETTINGS_FILE} MATCHES ".+") -ENDMACRO(CMAKE_EXPORT_BUILD_SETTINGS) + else() + message(SEND_ERROR "CMAKE_EXPORT_BUILD_SETTINGS called with no argument.") + endif() +endmacro() diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake index 455f95fe3..365d381ef 100644 --- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake +++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake @@ -18,39 +18,42 @@ # so that they can find the headers at runtime and parsing etc. works better # This is done here by actually running gcc with the options so it prints its # system include directories, which are parsed then and stored in the cache. -MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines) - SET(${_resultIncludeDirs}) - SET(_gccOutput) - FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n" ) - - IF (${_lang} STREQUAL "c++") - SET(_compilerExecutable "${CMAKE_CXX_COMPILER}") - SET(_arg1 "${CMAKE_CXX_COMPILER_ARG1}") - ELSE () - SET(_compilerExecutable "${CMAKE_C_COMPILER}") - SET(_arg1 "${CMAKE_C_COMPILER_ARG1}") - ENDIF () - EXECUTE_PROCESS(COMMAND ${_compilerExecutable} ${_arg1} -v -E -x ${_lang} -dD dummy +macro(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines) + set(${_resultIncludeDirs}) + set(_gccOutput) + file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n" ) + + if (${_lang} STREQUAL "c++") + set(_compilerExecutable "${CMAKE_CXX_COMPILER}") + set(_arg1 "${CMAKE_CXX_COMPILER_ARG1}") + else () + set(_compilerExecutable "${CMAKE_C_COMPILER}") + set(_arg1 "${CMAKE_C_COMPILER_ARG1}") + endif () + execute_process(COMMAND ${_compilerExecutable} ${_arg1} -v -E -x ${_lang} -dD dummy WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles ERROR_VARIABLE _gccOutput OUTPUT_VARIABLE _gccStdout ) - FILE(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy") + file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy") # First find the system include dirs: - IF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+ *\n) *End of (search) list" ) + if( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+ *\n) *End of (search) list" ) # split the output into lines and then remove leading and trailing spaces from each of them: - STRING(REGEX MATCHALL "[^\n]+\n" _includeLines "${CMAKE_MATCH_1}") - FOREACH(nextLine ${_includeLines}) - STRING(STRIP "${nextLine}" _includePath) - LIST(APPEND ${_resultIncludeDirs} "${_includePath}") - ENDFOREACH(nextLine) + string(REGEX MATCHALL "[^\n]+\n" _includeLines "${CMAKE_MATCH_1}") + foreach(nextLine ${_includeLines}) + # on OSX, gcc says things like this: "/System/Library/Frameworks (framework directory)", strip the last part + string(REGEX REPLACE "\\(framework directory\\)" "" nextLineNoFramework "${nextLine}") + # strip spaces at the beginning and the end + string(STRIP "${nextLineNoFramework}" _includePath) + list(APPEND ${_resultIncludeDirs} "${_includePath}") + endforeach() - ENDIF() + endif() # now find the builtin macros: - STRING(REGEX MATCHALL "#define[^\n]+\n" _defineLines "${_gccStdout}") + string(REGEX MATCHALL "#define[^\n]+\n" _defineLines "${_gccStdout}") # A few example lines which the regexp below has to match properly: # #define MAX(a,b) ((a) > (b) ? (a) : (b)) # #define __fastcall __attribute__((__fastcall__)) @@ -59,51 +62,51 @@ MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines # #define __UINTMAX_TYPE__ long long unsigned int # #define __i386__ 1 - FOREACH(nextLine ${_defineLines}) - STRING(REGEX MATCH "^#define +([A-Za-z_][A-Za-z0-9_]*)(\\([^\\)]+\\))? +(.+) *$" _dummy "${nextLine}") - SET(_name "${CMAKE_MATCH_1}${CMAKE_MATCH_2}") - STRING(STRIP "${CMAKE_MATCH_3}" _value) - #MESSAGE(STATUS "m1: -${CMAKE_MATCH_1}- m2: -${CMAKE_MATCH_2}- m3: -${CMAKE_MATCH_3}-") + foreach(nextLine ${_defineLines}) + string(REGEX MATCH "^#define +([A-Za-z_][A-Za-z0-9_]*)(\\([^\\)]+\\))? +(.+) *$" _dummy "${nextLine}") + set(_name "${CMAKE_MATCH_1}${CMAKE_MATCH_2}") + string(STRIP "${CMAKE_MATCH_3}" _value) + #message(STATUS "m1: -${CMAKE_MATCH_1}- m2: -${CMAKE_MATCH_2}- m3: -${CMAKE_MATCH_3}-") - LIST(APPEND ${_resultDefines} "${_name}") - IF(_value) - LIST(APPEND ${_resultDefines} "${_value}") - ELSE() - LIST(APPEND ${_resultDefines} " ") - ENDIF() - ENDFOREACH(nextLine) + list(APPEND ${_resultDefines} "${_name}") + if(_value) + list(APPEND ${_resultDefines} "${_value}") + else() + list(APPEND ${_resultDefines} " ") + endif() + endforeach() -ENDMACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang) +endmacro() # Save the current LC_ALL, LC_MESSAGES, and LANG environment variables and set them # to "C" that way GCC's "search starts here" text is in English and we can grok it. -SET(_orig_lc_all $ENV{LC_ALL}) -SET(_orig_lc_messages $ENV{LC_MESSAGES}) -SET(_orig_lang $ENV{LANG}) +set(_orig_lc_all $ENV{LC_ALL}) +set(_orig_lc_messages $ENV{LC_MESSAGES}) +set(_orig_lang $ENV{LANG}) -SET(ENV{LC_ALL} C) -SET(ENV{LC_MESSAGES} C) -SET(ENV{LANG} C) +set(ENV{LC_ALL} C) +set(ENV{LC_MESSAGES} C) +set(ENV{LANG} C) # Now check for C, works for gcc and Intel compiler at least -IF (NOT CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS) - IF ("${CMAKE_C_COMPILER_ID}" MATCHES GNU OR "${CMAKE_C_COMPILER_ID}" MATCHES Intel) +if (NOT CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS) + if ("${CMAKE_C_COMPILER_ID}" MATCHES GNU OR "${CMAKE_C_COMPILER_ID}" MATCHES Intel OR "${CMAKE_C_COMPILER_ID}" MATCHES Clang) _DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c _dirs _defines) - SET(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "C compiler system include directories") - SET(CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "C compiler system defined macros") - ENDIF () -ENDIF () + set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "C compiler system include directories") + set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "C compiler system defined macros") + endif () +endif () # And now the same for C++ -IF (NOT CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS) - IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Intel) +if (NOT CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS) + if ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Intel OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Clang) _DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c++ _dirs _defines) - SET(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "CXX compiler system include directories") - SET(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "CXX compiler system defined macros") - ENDIF () -ENDIF () + set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "CXX compiler system include directories") + set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "CXX compiler system defined macros") + endif () +endif () # Restore original LC_ALL, LC_MESSAGES, and LANG -SET(ENV{LC_ALL} ${_orig_lc_all}) -SET(ENV{LC_MESSAGES} ${_orig_lc_messages}) -SET(ENV{LANG} ${_orig_lang}) +set(ENV{LC_ALL} ${_orig_lc_all}) +set(ENV{LC_MESSAGES} ${_orig_lc_messages}) +set(ENV{LANG} ${_orig_lang}) diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 64ec403ad..e08c1c6a5 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -1,13 +1,13 @@ # search for additional tools required for C/C++ (and other languages ?) # -# If the internal cmake variable _CMAKE_TOOLCHAIN_PREFIX is set, this is used +# If the internal cmake variable _CMAKE_TOOLCHAIN_PREFIX is set, this is used # as prefix for the tools (e.g. arm-elf-gcc etc.) # If the cmake variable _CMAKE_TOOLCHAIN_LOCATION is set, the compiler is -# searched only there. The other tools are at first searched there, then +# searched only there. The other tools are at first searched there, then # also in the default locations. # -# Sets the following variables: +# Sets the following variables: # CMAKE_AR # CMAKE_RANLIB # CMAKE_LINKER @@ -30,46 +30,42 @@ # License text for the above reference.) # if it's the MS C/CXX compiler, search for link -IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" +if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio") - FIND_PROGRAM(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - MARK_AS_ADVANCED(CMAKE_LINKER) + mark_as_advanced(CMAKE_LINKER) # in all other cases search for ar, ranlib, etc. -ELSE("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" - OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC" - OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio") +else() - FIND_PROGRAM(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + find_program(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - FIND_PROGRAM(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - IF(NOT CMAKE_RANLIB) - SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib") - ENDIF(NOT CMAKE_RANLIB) + find_program(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + if(NOT CMAKE_RANLIB) + set(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib") + endif() - FIND_PROGRAM(CMAKE_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - FIND_PROGRAM(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - FIND_PROGRAM(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - FIND_PROGRAM(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - FIND_PROGRAM(CMAKE_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + find_program(CMAKE_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + find_program(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + find_program(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + find_program(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + find_program(CMAKE_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - MARK_AS_ADVANCED(CMAKE_AR CMAKE_RANLIB CMAKE_STRIP CMAKE_LINKER CMAKE_NM CMAKE_OBJDUMP CMAKE_OBJCOPY) + mark_as_advanced(CMAKE_AR CMAKE_RANLIB CMAKE_STRIP CMAKE_LINKER CMAKE_NM CMAKE_OBJDUMP CMAKE_OBJCOPY) -ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" - OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC" - OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio") +endif() # on Apple there really should be install_name_tool -IF(APPLE) - FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) +if(APPLE) + find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - IF(NOT CMAKE_INSTALL_NAME_TOOL) - MESSAGE(FATAL_ERROR "Could not find install_name_tool, please check your installation.") - ENDIF(NOT CMAKE_INSTALL_NAME_TOOL) + if(NOT CMAKE_INSTALL_NAME_TOOL) + message(FATAL_ERROR "Could not find install_name_tool, please check your installation.") + endif() - MARK_AS_ADVANCED(CMAKE_INSTALL_NAME_TOOL) -ENDIF(APPLE) + mark_as_advanced(CMAKE_INSTALL_NAME_TOOL) +endif() diff --git a/Modules/CMakeFindCodeBlocks.cmake b/Modules/CMakeFindCodeBlocks.cmake index 23f2c821d..f8d8d5908 100644 --- a/Modules/CMakeFindCodeBlocks.cmake +++ b/Modules/CMakeFindCodeBlocks.cmake @@ -15,11 +15,11 @@ # This file is included in CMakeSystemSpecificInformation.cmake if # the CodeBlocks extra generator has been selected. -FIND_PROGRAM(CMAKE_CODEBLOCKS_EXECUTABLE NAMES codeblocks DOC "The CodeBlocks executable") +find_program(CMAKE_CODEBLOCKS_EXECUTABLE NAMES codeblocks DOC "The CodeBlocks executable") -IF(CMAKE_CODEBLOCKS_EXECUTABLE) - SET(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_CODEBLOCKS_EXECUTABLE} " ) -ENDIF(CMAKE_CODEBLOCKS_EXECUTABLE) +if(CMAKE_CODEBLOCKS_EXECUTABLE) + set(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_CODEBLOCKS_EXECUTABLE} " ) +endif() # Determine builtin macros and include dirs: -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake) diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake index a4264e78e..ae174544b 100644 --- a/Modules/CMakeFindEclipseCDT4.cmake +++ b/Modules/CMakeFindEclipseCDT4.cmake @@ -15,65 +15,73 @@ # This file is included in CMakeSystemSpecificInformation.cmake if # the Eclipse CDT4 extra generator has been selected. -FIND_PROGRAM(CMAKE_ECLIPSE_EXECUTABLE NAMES eclipse DOC "The Eclipse executable") +find_program(CMAKE_ECLIPSE_EXECUTABLE NAMES eclipse DOC "The Eclipse executable") -FUNCTION(_FIND_ECLIPSE_VERSION) +function(_FIND_ECLIPSE_VERSION) # This code is in a function so the variables used here have only local scope - IF(CMAKE_ECLIPSE_EXECUTABLE) + if(CMAKE_ECLIPSE_EXECUTABLE) # use REALPATH to resolve symlinks (http://public.kitware.com/Bug/view.php?id=13036) - GET_FILENAME_COMPONENT(_REALPATH_CMAKE_ECLIPSE_EXECUTABLE "${CMAKE_ECLIPSE_EXECUTABLE}" REALPATH) - GET_FILENAME_COMPONENT(_ECLIPSE_DIR "${_REALPATH_CMAKE_ECLIPSE_EXECUTABLE}" PATH) - FILE(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/features/org.eclipse.platform*") - IF("${_ECLIPSE_FEATURE_DIR}" MATCHES ".+org.eclipse.platform_([0-9]+\\.[0-9]+).+") - SET(_ECLIPSE_VERSION ${CMAKE_MATCH_1}) - ENDIF() - ENDIF() + get_filename_component(_REALPATH_CMAKE_ECLIPSE_EXECUTABLE "${CMAKE_ECLIPSE_EXECUTABLE}" REALPATH) + get_filename_component(_ECLIPSE_DIR "${_REALPATH_CMAKE_ECLIPSE_EXECUTABLE}" PATH) + file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/features/org.eclipse.platform*") + if(APPLE AND NOT _ECLIPSE_FEATURE_DIR) + file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/../../../features/org.eclipse.platform*") + endif() + if("${_ECLIPSE_FEATURE_DIR}" MATCHES ".+org.eclipse.platform_([0-9]+\\.[0-9]+).+") + set(_ECLIPSE_VERSION ${CMAKE_MATCH_1}) + endif() + endif() # Set up a map with the names of the Eclipse releases: - SET(_ECLIPSE_VERSION_NAME_ "Unknown" ) - SET(_ECLIPSE_VERSION_NAME_3.2 "Callisto" ) - SET(_ECLIPSE_VERSION_NAME_3.3 "Europa" ) - SET(_ECLIPSE_VERSION_NAME_3.4 "Ganymede" ) - SET(_ECLIPSE_VERSION_NAME_3.5 "Galileo" ) - SET(_ECLIPSE_VERSION_NAME_3.6 "Helios" ) - SET(_ECLIPSE_VERSION_NAME_3.7 "Indigo" ) + set(_ECLIPSE_VERSION_NAME_ "Unknown" ) + set(_ECLIPSE_VERSION_NAME_3.2 "Callisto" ) + set(_ECLIPSE_VERSION_NAME_3.3 "Europa" ) + set(_ECLIPSE_VERSION_NAME_3.4 "Ganymede" ) + set(_ECLIPSE_VERSION_NAME_3.5 "Galileo" ) + set(_ECLIPSE_VERSION_NAME_3.6 "Helios" ) + set(_ECLIPSE_VERSION_NAME_3.7 "Indigo" ) + set(_ECLIPSE_VERSION_NAME_4.2 "Juno" ) - IF(_ECLIPSE_VERSION) - MESSAGE(STATUS "Found Eclipse version ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})") - ELSE() - SET(_ECLIPSE_VERSION "3.6" ) - MESSAGE(STATUS "Could not determine Eclipse version, assuming at least ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}}). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.") - ENDIF() + if(_ECLIPSE_VERSION) + message(STATUS "Found Eclipse version ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})") + else() + set(_ECLIPSE_VERSION "3.6" ) + message(STATUS "Could not determine Eclipse version, assuming at least ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}}). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.") + endif() - SET(CMAKE_ECLIPSE_VERSION "${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})" CACHE STRING "The version of Eclipse. If Eclipse has not been found, 3.6 (Helios) is assumed.") - SET_PROPERTY(CACHE CMAKE_ECLIPSE_VERSION PROPERTY STRINGS "3.2 (${_ECLIPSE_VERSION_NAME_3.2})" + set(CMAKE_ECLIPSE_VERSION "${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})" CACHE STRING "The version of Eclipse. If Eclipse has not been found, 3.6 (Helios) is assumed.") + set_property(CACHE CMAKE_ECLIPSE_VERSION PROPERTY STRINGS "3.2 (${_ECLIPSE_VERSION_NAME_3.2})" "3.3 (${_ECLIPSE_VERSION_NAME_3.3})" "3.4 (${_ECLIPSE_VERSION_NAME_3.4})" "3.5 (${_ECLIPSE_VERSION_NAME_3.5})" "3.6 (${_ECLIPSE_VERSION_NAME_3.6})" - "3.7 (${_ECLIPSE_VERSION_NAME_3.7})") -ENDFUNCTION() + "3.7 (${_ECLIPSE_VERSION_NAME_3.7})" + "4.2 (${_ECLIPSE_VERSION_NAME_4.2})" + ) +endfunction() _FIND_ECLIPSE_VERSION() # Try to find out how many CPUs we have and set the -j argument for make accordingly -SET(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "") +set(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "") -INCLUDE(ProcessorCount) +include(ProcessorCount) PROCESSORCOUNT(_CMAKE_ECLIPSE_PROCESSOR_COUNT) # Only set -j if we are under UNIX and if the make-tool used actually has "make" in the name # (we may also get here in the future e.g. for ninja) -IF("${_CMAKE_ECLIPSE_PROCESSOR_COUNT}" GREATER 1 AND UNIX AND "${CMAKE_MAKE_PROGRAM}" MATCHES make) - SET(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "-j${_CMAKE_ECLIPSE_PROCESSOR_COUNT}") -ENDIF() +if("${_CMAKE_ECLIPSE_PROCESSOR_COUNT}" GREATER 1 AND UNIX AND "${CMAKE_MAKE_PROGRAM}" MATCHES make) + set(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "-j${_CMAKE_ECLIPSE_PROCESSOR_COUNT}") +endif() # This variable is used by the Eclipse generator and appended to the make invocation commands. -SET(CMAKE_ECLIPSE_MAKE_ARGUMENTS "${_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j to get parallel builds") +set(CMAKE_ECLIPSE_MAKE_ARGUMENTS "${_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j to get parallel builds") + +set(CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES TRUE CACHE BOOL "If disabled, CMake will not generate linked resource to the subprojects and to the source files within targets") # This variable is used by the Eclipse generator in out-of-source builds only. -SET(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR") -MARK_AS_ADVANCED(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT) +set(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR") +mark_as_advanced(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT) # Determine builtin macros and include dirs: -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake) diff --git a/Modules/CMakeFindFrameworks.cmake b/Modules/CMakeFindFrameworks.cmake index 001da20f3..7fdeb84be 100644 --- a/Modules/CMakeFindFrameworks.cmake +++ b/Modules/CMakeFindFrameworks.cmake @@ -13,20 +13,20 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED) - SET(CMAKE_FIND_FRAMEWORKS_INCLUDED 1) - MACRO(CMAKE_FIND_FRAMEWORKS fwk) - SET(${fwk}_FRAMEWORKS) - IF(APPLE) - FOREACH(dir +if(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED) + set(CMAKE_FIND_FRAMEWORKS_INCLUDED 1) + macro(CMAKE_FIND_FRAMEWORKS fwk) + set(${fwk}_FRAMEWORKS) + if(APPLE) + foreach(dir ~/Library/Frameworks/${fwk}.framework /Library/Frameworks/${fwk}.framework /System/Library/Frameworks/${fwk}.framework /Network/Library/Frameworks/${fwk}.framework) - IF(EXISTS ${dir}) - SET(${fwk}_FRAMEWORKS ${${fwk}_FRAMEWORKS} ${dir}) - ENDIF(EXISTS ${dir}) - ENDFOREACH(dir) - ENDIF(APPLE) - ENDMACRO(CMAKE_FIND_FRAMEWORKS) -ENDIF(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED) + if(EXISTS ${dir}) + set(${fwk}_FRAMEWORKS ${${fwk}_FRAMEWORKS} ${dir}) + endif() + endforeach() + endif() + endmacro() +endif() diff --git a/Modules/CMakeFindKDevelop3.cmake b/Modules/CMakeFindKDevelop3.cmake index 331dc6ef9..2abd52376 100644 --- a/Modules/CMakeFindKDevelop3.cmake +++ b/Modules/CMakeFindKDevelop3.cmake @@ -15,9 +15,9 @@ # This file is included in CMakeSystemSpecificInformation.cmake if # the KDevelop3 extra generator has been selected. -FIND_PROGRAM(CMAKE_KDEVELOP3_EXECUTABLE NAMES kdevelop DOC "The KDevelop3 executable") +find_program(CMAKE_KDEVELOP3_EXECUTABLE NAMES kdevelop DOC "The KDevelop3 executable") -IF(CMAKE_KDEVELOP3_EXECUTABLE) - SET(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_KDEVELOP3_EXECUTABLE} " ) -ENDIF(CMAKE_KDEVELOP3_EXECUTABLE) +if(CMAKE_KDEVELOP3_EXECUTABLE) + set(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_KDEVELOP3_EXECUTABLE} " ) +endif() diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake index 59c7ba5ee..cea018706 100644 --- a/Modules/CMakeFindPackageMode.cmake +++ b/Modules/CMakeFindPackageMode.cmake @@ -47,12 +47,14 @@ macro(ENABLE_LANGUAGE) # But in --find-package mode, we don't want (and can't) enable any language. endmacro() +set(CMAKE_PLATFORM_INFO_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}) + include(CMakeDetermineSystem) # short-cut some tests on Darwin, see Darwin-GNU.cmake: if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin AND "${COMPILER_ID}" MATCHES GNU) - set(${CMAKE_${LANGUAGE}_HAS_ISYSROOT} 0 ) - set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "") + set(CMAKE_${LANGUAGE}_SYSROOT_FLAG "") + set(CMAKE_${LANGUAGE}_OSX_DEPLOYMENT_TARGET_FLAG "") endif() # Also load the system specific file, which sets up e.g. the search paths. @@ -179,7 +181,7 @@ if(${NAME}_FOUND OR ${UPPERCASE_NAME}_FOUND) set_compile_flags_var(${NAME}) elseif("${MODE}" STREQUAL "LINK") set_link_flags_var(${NAME}) - else("${MODE}" STREQUAL "LINK") + else() message(FATAL_ERROR "Invalid mode argument ${MODE} given.") endif() diff --git a/Modules/CMakeFindWMake.cmake b/Modules/CMakeFindWMake.cmake index 6972c4c40..60275aea4 100644 --- a/Modules/CMakeFindWMake.cmake +++ b/Modules/CMakeFindWMake.cmake @@ -12,6 +12,6 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET (CMAKE_MAKE_PROGRAM "wmake" CACHE STRING +set (CMAKE_MAKE_PROGRAM "wmake" CACHE STRING "Program used to build from makefiles.") -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) +mark_as_advanced(CMAKE_MAKE_PROGRAM) diff --git a/Modules/CMakeFindXCode.cmake b/Modules/CMakeFindXCode.cmake index 53967b52a..5c4f59639 100644 --- a/Modules/CMakeFindXCode.cmake +++ b/Modules/CMakeFindXCode.cmake @@ -12,9 +12,9 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(CMAKE_MAKE_PROGRAM +find_program(CMAKE_MAKE_PROGRAM NAMES xcodebuild PATHS /usr/bin ) -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) +mark_as_advanced(CMAKE_MAKE_PROGRAM) diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake index 2a839fd93..207c8ad35 100644 --- a/Modules/CMakeForceCompiler.cmake +++ b/Modules/CMakeForceCompiler.cmake @@ -24,8 +24,8 @@ # information tests. # # So a simple toolchain file could look like this: -# INCLUDE (CMakeForceCompiler) -# SET(CMAKE_SYSTEM_NAME Generic) +# include (CMakeForceCompiler) +# set(CMAKE_SYSTEM_NAME Generic) # CMAKE_FORCE_C_COMPILER (chc12 MetrowerksHicross) # CMAKE_FORCE_CXX_COMPILER (chc12 MetrowerksHicross) @@ -42,41 +42,38 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -MACRO(CMAKE_FORCE_C_COMPILER compiler id) - SET(CMAKE_C_COMPILER "${compiler}") - SET(CMAKE_C_COMPILER_ID_RUN TRUE) - SET(CMAKE_C_COMPILER_ID ${id}) - SET(CMAKE_C_COMPILER_WORKS TRUE) - SET(CMAKE_C_COMPILER_FORCED TRUE) +macro(CMAKE_FORCE_C_COMPILER compiler id) + set(CMAKE_C_COMPILER "${compiler}") + set(CMAKE_C_COMPILER_ID_RUN TRUE) + set(CMAKE_C_COMPILER_ID ${id}) + set(CMAKE_C_COMPILER_FORCED TRUE) # Set old compiler id variables. - IF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") - SET(CMAKE_COMPILER_IS_GNUCC 1) - ENDIF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") -ENDMACRO(CMAKE_FORCE_C_COMPILER) + if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") + set(CMAKE_COMPILER_IS_GNUCC 1) + endif() +endmacro() -MACRO(CMAKE_FORCE_CXX_COMPILER compiler id) - SET(CMAKE_CXX_COMPILER "${compiler}") - SET(CMAKE_CXX_COMPILER_ID_RUN TRUE) - SET(CMAKE_CXX_COMPILER_ID ${id}) - SET(CMAKE_CXX_COMPILER_WORKS TRUE) - SET(CMAKE_CXX_COMPILER_FORCED TRUE) +macro(CMAKE_FORCE_CXX_COMPILER compiler id) + set(CMAKE_CXX_COMPILER "${compiler}") + set(CMAKE_CXX_COMPILER_ID_RUN TRUE) + set(CMAKE_CXX_COMPILER_ID ${id}) + set(CMAKE_CXX_COMPILER_FORCED TRUE) # Set old compiler id variables. - IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") - SET(CMAKE_COMPILER_IS_GNUCXX 1) - ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") -ENDMACRO(CMAKE_FORCE_CXX_COMPILER) + if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") + set(CMAKE_COMPILER_IS_GNUCXX 1) + endif() +endmacro() -MACRO(CMAKE_FORCE_Fortran_COMPILER compiler id) - SET(CMAKE_Fortran_COMPILER "${compiler}") - SET(CMAKE_Fortran_COMPILER_ID_RUN TRUE) - SET(CMAKE_Fortran_COMPILER_ID ${id}) - SET(CMAKE_Fortran_COMPILER_WORKS TRUE) - SET(CMAKE_Fortran_COMPILER_FORCED TRUE) +macro(CMAKE_FORCE_Fortran_COMPILER compiler id) + set(CMAKE_Fortran_COMPILER "${compiler}") + set(CMAKE_Fortran_COMPILER_ID_RUN TRUE) + set(CMAKE_Fortran_COMPILER_ID ${id}) + set(CMAKE_Fortran_COMPILER_FORCED TRUE) # Set old compiler id variables. - IF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") - SET(CMAKE_COMPILER_IS_GNUG77 1) - ENDIF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") -ENDMACRO(CMAKE_FORCE_Fortran_COMPILER) + if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + set(CMAKE_COMPILER_IS_GNUG77 1) + endif() +endmacro() diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 53d95525f..d193881d9 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -1,52 +1,55 @@ -SET(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@") -SET(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@") -SET(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@") -SET(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@") +set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@") +set(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@") +set(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@") +set(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@") @SET_MSVC_Fortran_ARCHITECTURE_ID@ -SET(CMAKE_AR "@CMAKE_AR@") -SET(CMAKE_RANLIB "@CMAKE_RANLIB@") -SET(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@) -SET(CMAKE_Fortran_COMPILER_LOADED 1) -SET(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) -SET(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@) -IF(CMAKE_COMPILER_IS_CYGWIN) - SET(CYGWIN 1) - SET(UNIX 1) -ENDIF(CMAKE_COMPILER_IS_CYGWIN) - -SET(CMAKE_Fortran_COMPILER_ENV_VAR "FC") - -SET(CMAKE_Fortran_COMPILER_SUPPORTS_F90 @CMAKE_Fortran_COMPILER_SUPPORTS_F90@) - -IF(CMAKE_COMPILER_IS_MINGW) - SET(MINGW 1) -ENDIF(CMAKE_COMPILER_IS_MINGW) -SET(CMAKE_Fortran_COMPILER_ID_RUN 1) -SET(CMAKE_Fortran_SOURCE_FILE_EXTENSIONS f;F;f77;F77;f90;F90;for;For;FOR;f95;F95) -SET(CMAKE_Fortran_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) -SET(CMAKE_Fortran_LINKER_PREFERENCE 20) -IF(UNIX) - SET(CMAKE_Fortran_OUTPUT_EXTENSION .o) -ELSE(UNIX) - SET(CMAKE_Fortran_OUTPUT_EXTENSION .obj) -ENDIF(UNIX) +set(CMAKE_AR "@CMAKE_AR@") +set(CMAKE_RANLIB "@CMAKE_RANLIB@") +set(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@) +set(CMAKE_Fortran_COMPILER_LOADED 1) +set(CMAKE_Fortran_COMPILER_WORKS @CMAKE_Fortran_COMPILER_WORKS@) +set(CMAKE_Fortran_ABI_COMPILED @CMAKE_Fortran_ABI_COMPILED@) +set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) +set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_Fortran_COMPILER_ENV_VAR "FC") + +set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 @CMAKE_Fortran_COMPILER_SUPPORTS_F90@) + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_Fortran_COMPILER_ID_RUN 1) +set(CMAKE_Fortran_SOURCE_FILE_EXTENSIONS f;F;f77;F77;f90;F90;for;For;FOR;f95;F95) +set(CMAKE_Fortran_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_Fortran_LINKER_PREFERENCE 20) +if(UNIX) + set(CMAKE_Fortran_OUTPUT_EXTENSION .o) +else() + set(CMAKE_Fortran_OUTPUT_EXTENSION .obj) +endif() # Save compiler ABI information. -SET(CMAKE_Fortran_SIZEOF_DATA_PTR "@CMAKE_Fortran_SIZEOF_DATA_PTR@") -SET(CMAKE_Fortran_COMPILER_ABI "@CMAKE_Fortran_COMPILER_ABI@") -SET(CMAKE_Fortran_LIBRARY_ARCHITECTURE "@CMAKE_Fortran_LIBRARY_ARCHITECTURE@") +set(CMAKE_Fortran_SIZEOF_DATA_PTR "@CMAKE_Fortran_SIZEOF_DATA_PTR@") +set(CMAKE_Fortran_COMPILER_ABI "@CMAKE_Fortran_COMPILER_ABI@") +set(CMAKE_Fortran_LIBRARY_ARCHITECTURE "@CMAKE_Fortran_LIBRARY_ARCHITECTURE@") -IF(CMAKE_Fortran_SIZEOF_DATA_PTR AND NOT CMAKE_SIZEOF_VOID_P) - SET(CMAKE_SIZEOF_VOID_P "${CMAKE_Fortran_SIZEOF_DATA_PTR}") -ENDIF() +if(CMAKE_Fortran_SIZEOF_DATA_PTR AND NOT CMAKE_SIZEOF_VOID_P) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_Fortran_SIZEOF_DATA_PTR}") +endif() -IF(CMAKE_Fortran_COMPILER_ABI) - SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_Fortran_COMPILER_ABI}") -ENDIF(CMAKE_Fortran_COMPILER_ABI) +if(CMAKE_Fortran_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_Fortran_COMPILER_ABI}") +endif() -IF(CMAKE_Fortran_LIBRARY_ARCHITECTURE) - SET(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_Fortran_LIBRARY_ARCHITECTURE@") -ENDIF() +if(CMAKE_Fortran_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_Fortran_LIBRARY_ARCHITECTURE@") +endif() -SET(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "@CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES@") -SET(CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES@") +set(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "@CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES@") +set(CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES@") +set(CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@") diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 4d25de0ba..f84852aeb 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -74,12 +74,8 @@ PRINT *, 'INFO:platform[IRIX]' #elif defined(__hpux) || defined(__hpux__) PRINT *, 'INFO:platform[HP-UX]' -#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU) +#elif defined(__HAIKU__) PRINT *, 'INFO:platform[Haiku]' -# if 0 -! Haiku also defines __BEOS__ so we must -! put it prior to the check for __BEOS__ -# endif #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) PRINT *, 'INFO:platform[BeOS]' #elif defined(__QNX__) || defined(__QNXNTO__) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index d962f4cb5..512ec4864 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -16,163 +16,163 @@ # It also loads the available platform file for the system-compiler # if it exists. -SET(_INCLUDED_FILE 0) +set(_INCLUDED_FILE 0) # Load compiler-specific information. -IF(CMAKE_Fortran_COMPILER_ID) - INCLUDE(Compiler/${CMAKE_Fortran_COMPILER_ID}-Fortran OPTIONAL) -ENDIF(CMAKE_Fortran_COMPILER_ID) +if(CMAKE_Fortran_COMPILER_ID) + include(Compiler/${CMAKE_Fortran_COMPILER_ID}-Fortran OPTIONAL) +endif() -SET(CMAKE_BASE_NAME) -GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_Fortran_COMPILER} NAME_WE) +set(CMAKE_BASE_NAME) +get_filename_component(CMAKE_BASE_NAME ${CMAKE_Fortran_COMPILER} NAME_WE) # since the gnu compiler has several names force g++ -IF(CMAKE_COMPILER_IS_GNUG77) - SET(CMAKE_BASE_NAME g77) -ENDIF(CMAKE_COMPILER_IS_GNUG77) -IF(CMAKE_Fortran_COMPILER_ID) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_ID}-Fortran OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) -ENDIF(CMAKE_Fortran_COMPILER_ID) -IF (NOT _INCLUDED_FILE) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL +if(CMAKE_COMPILER_IS_GNUG77) + set(CMAKE_BASE_NAME g77) +endif() +if(CMAKE_Fortran_COMPILER_ID) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_ID}-Fortran OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() +if (NOT _INCLUDED_FILE) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) -ENDIF (NOT _INCLUDED_FILE) +endif () # We specify the compiler information in the system file for some # platforms, but this language may not have been enabled when the file # was first included. Include it again to get the language info. # Remove this when all compiler info is removed from system files. -IF (NOT _INCLUDED_FILE) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL) -ENDIF (NOT _INCLUDED_FILE) +if (NOT _INCLUDED_FILE) + include(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL) +endif () -IF(CMAKE_Fortran_SIZEOF_DATA_PTR) - FOREACH(f ${CMAKE_Fortran_ABI_FILES}) - INCLUDE(${f}) - ENDFOREACH() - UNSET(CMAKE_Fortran_ABI_FILES) -ENDIF() +if(CMAKE_Fortran_SIZEOF_DATA_PTR) + foreach(f ${CMAKE_Fortran_ABI_FILES}) + include(${f}) + endforeach() + unset(CMAKE_Fortran_ABI_FILES) +endif() # This should be included before the _INIT variables are -# used to initialize the cache. Since the rule variables +# used to initialize the cache. Since the rule variables # have if blocks on them, users can still define them here. # But, it should still be after the platform file so changes can # be made to those values. -IF(CMAKE_USER_MAKE_RULES_OVERRIDE) +if(CMAKE_USER_MAKE_RULES_OVERRIDE) # Save the full path of the file so try_compile can use it. - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override) - SET(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}") -ENDIF() + include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override) + set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}") +endif() -IF(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran) +if(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran) # Save the full path of the file so try_compile can use it. - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran} RESULT_VARIABLE _override) - SET(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran "${_override}") -ENDIF() + include(${CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran} RESULT_VARIABLE _override) + set(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran "${_override}") +endif() -# Fortran needs cmake to do a requires step during its build process to +# Fortran needs cmake to do a requires step during its build process to # catch any modules -SET(CMAKE_NEEDS_REQUIRES_STEP_Fortran_FLAG 1) +set(CMAKE_NEEDS_REQUIRES_STEP_Fortran_FLAG 1) -IF(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIC) - SET(CMAKE_Fortran_COMPILE_OPTIONS_PIC ${CMAKE_C_COMPILE_OPTIONS_PIC}) -ENDIF(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIC) +if(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIC) + set(CMAKE_Fortran_COMPILE_OPTIONS_PIC ${CMAKE_C_COMPILE_OPTIONS_PIC}) +endif() -IF(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIE) - SET(CMAKE_Fortran_COMPILE_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE}) -ENDIF(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIE) +if(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIE) + set(CMAKE_Fortran_COMPILE_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE}) +endif() -IF(NOT CMAKE_Fortran_COMPILE_OPTIONS_DLL) - SET(CMAKE_Fortran_COMPILE_OPTIONS_DLL ${CMAKE_C_COMPILE_OPTIONS_DLL}) -ENDIF(NOT CMAKE_Fortran_COMPILE_OPTIONS_DLL) +if(NOT CMAKE_Fortran_COMPILE_OPTIONS_DLL) + set(CMAKE_Fortran_COMPILE_OPTIONS_DLL ${CMAKE_C_COMPILE_OPTIONS_DLL}) +endif() # Create a set of shared library variable specific to Fortran # For 90% of the systems, these are the same flags as the C versions # so if these are not set just copy the flags from the c version -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS) - SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) -ENDIF() +if(NOT DEFINED CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS) + set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) +endif() -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_Fortran_FLAGS) - SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) -ENDIF() +if(NOT DEFINED CMAKE_SHARED_LIBRARY_Fortran_FLAGS) + set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) +endif() -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) - SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) -ENDIF() +if(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) + set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) +endif() -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) -ENDIF() +if(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG) + set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) +endif() -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) -ENDIF() +if(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP) + set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) +endif() -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) - SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) -ENDIF() +if(NOT DEFINED CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) + set(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) +endif() -IF(NOT DEFINED CMAKE_EXE_EXPORTS_Fortran_FLAG) - SET(CMAKE_EXE_EXPORTS_Fortran_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG}) -ENDIF() +if(NOT DEFINED CMAKE_EXE_EXPORTS_Fortran_FLAG) + set(CMAKE_EXE_EXPORTS_Fortran_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG}) +endif() -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG) - SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG}) -ENDIF() +if(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG) + set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG}) +endif() # for most systems a module is the same as a shared library # so unless the variable CMAKE_MODULE_EXISTS is set just # copy the values from the LIBRARY variables -IF(NOT CMAKE_MODULE_EXISTS) - SET(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_Fortran_FLAGS}) - SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS}) -ENDIF(NOT CMAKE_MODULE_EXISTS) +if(NOT CMAKE_MODULE_EXISTS) + set(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_Fortran_FLAGS}) + set(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS}) +endif() # repeat for modules -IF(NOT DEFINED CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) - SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) -ENDIF() - -IF(NOT DEFINED CMAKE_SHARED_MODULE_Fortran_FLAGS) - SET(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) -ENDIF() - -IF(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) - SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG}) -ENDIF() - -IF(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP) - SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP}) -ENDIF() - -IF(NOT DEFINED CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG) - SET(CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG}) -ENDIF() - -IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH) - SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH}) -ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH) - -IF(NOT CMAKE_INCLUDE_FLAG_Fortran) - SET(CMAKE_INCLUDE_FLAG_Fortran ${CMAKE_INCLUDE_FLAG_C}) -ENDIF(NOT CMAKE_INCLUDE_FLAG_Fortran) - -IF(NOT CMAKE_INCLUDE_FLAG_SEP_Fortran) - SET(CMAKE_INCLUDE_FLAG_SEP_Fortran ${CMAKE_INCLUDE_FLAG_SEP_C}) -ENDIF(NOT CMAKE_INCLUDE_FLAG_SEP_Fortran) - -SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.") - -SET(CMAKE_Fortran_FLAGS_INIT "$ENV{FFLAGS} ${CMAKE_Fortran_FLAGS_INIT}") -# avoid just having a space as the initial value for the cache -IF(CMAKE_Fortran_FLAGS_INIT STREQUAL " ") - SET(CMAKE_Fortran_FLAGS_INIT) -ENDIF(CMAKE_Fortran_FLAGS_INIT STREQUAL " ") -SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_INIT}" CACHE STRING +if(NOT DEFINED CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) + set(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) +endif() + +if(NOT DEFINED CMAKE_SHARED_MODULE_Fortran_FLAGS) + set(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) +endif() + +if(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) + set(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG}) +endif() + +if(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP) + set(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP}) +endif() + +if(NOT DEFINED CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG) + set(CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG}) +endif() + +if(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH) + set(CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH}) +endif() + +if(NOT CMAKE_INCLUDE_FLAG_Fortran) + set(CMAKE_INCLUDE_FLAG_Fortran ${CMAKE_INCLUDE_FLAG_C}) +endif() + +if(NOT CMAKE_INCLUDE_FLAG_SEP_Fortran) + set(CMAKE_INCLUDE_FLAG_SEP_Fortran ${CMAKE_INCLUDE_FLAG_SEP_C}) +endif() + +set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.") + +set(CMAKE_Fortran_FLAGS_INIT "$ENV{FFLAGS} ${CMAKE_Fortran_FLAGS_INIT}") +# avoid just having a space as the initial value for the cache +if(CMAKE_Fortran_FLAGS_INIT STREQUAL " ") + set(CMAKE_Fortran_FLAGS_INIT) +endif() +set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_INIT}" CACHE STRING "Flags for Fortran compiler.") -INCLUDE(CMakeCommonLanguageInclude) +include(CMakeCommonLanguageInclude) # now define the following rule variables # CMAKE_Fortran_CREATE_SHARED_LIBRARY @@ -181,60 +181,60 @@ INCLUDE(CMakeCommonLanguageInclude) # CMAKE_Fortran_LINK_EXECUTABLE # create a Fortran shared library -IF(NOT CMAKE_Fortran_CREATE_SHARED_LIBRARY) - SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY +if(NOT CMAKE_Fortran_CREATE_SHARED_LIBRARY) + set(CMAKE_Fortran_CREATE_SHARED_LIBRARY " -o ") -ENDIF(NOT CMAKE_Fortran_CREATE_SHARED_LIBRARY) +endif() # create a Fortran shared module just copy the shared library rule -IF(NOT CMAKE_Fortran_CREATE_SHARED_MODULE) - SET(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY}) -ENDIF(NOT CMAKE_Fortran_CREATE_SHARED_MODULE) +if(NOT CMAKE_Fortran_CREATE_SHARED_MODULE) + set(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY}) +endif() # Create a static archive incrementally for large object file counts. # If CMAKE_Fortran_CREATE_STATIC_LIBRARY is set it will override these. -IF(NOT DEFINED CMAKE_Fortran_ARCHIVE_CREATE) - SET(CMAKE_Fortran_ARCHIVE_CREATE " cr ") -ENDIF() -IF(NOT DEFINED CMAKE_Fortran_ARCHIVE_APPEND) - SET(CMAKE_Fortran_ARCHIVE_APPEND " r ") -ENDIF() -IF(NOT DEFINED CMAKE_Fortran_ARCHIVE_FINISH) - SET(CMAKE_Fortran_ARCHIVE_FINISH " ") -ENDIF() +if(NOT DEFINED CMAKE_Fortran_ARCHIVE_CREATE) + set(CMAKE_Fortran_ARCHIVE_CREATE " cr ") +endif() +if(NOT DEFINED CMAKE_Fortran_ARCHIVE_APPEND) + set(CMAKE_Fortran_ARCHIVE_APPEND " r ") +endif() +if(NOT DEFINED CMAKE_Fortran_ARCHIVE_FINISH) + set(CMAKE_Fortran_ARCHIVE_FINISH " ") +endif() # compile a Fortran file into an object file # (put -o after -c to workaround bug in at least one mpif77 wrapper) -IF(NOT CMAKE_Fortran_COMPILE_OBJECT) - SET(CMAKE_Fortran_COMPILE_OBJECT +if(NOT CMAKE_Fortran_COMPILE_OBJECT) + set(CMAKE_Fortran_COMPILE_OBJECT " -c -o ") -ENDIF(NOT CMAKE_Fortran_COMPILE_OBJECT) +endif() # link a fortran program -IF(NOT CMAKE_Fortran_LINK_EXECUTABLE) - SET(CMAKE_Fortran_LINK_EXECUTABLE +if(NOT CMAKE_Fortran_LINK_EXECUTABLE) + set(CMAKE_Fortran_LINK_EXECUTABLE " -o ") -ENDIF(NOT CMAKE_Fortran_LINK_EXECUTABLE) +endif() -IF(CMAKE_Fortran_STANDARD_LIBRARIES_INIT) - SET(CMAKE_Fortran_STANDARD_LIBRARIES "${CMAKE_Fortran_STANDARD_LIBRARIES_INIT}" +if(CMAKE_Fortran_STANDARD_LIBRARIES_INIT) + set(CMAKE_Fortran_STANDARD_LIBRARIES "${CMAKE_Fortran_STANDARD_LIBRARIES_INIT}" CACHE STRING "Libraries linked by defalut with all Fortran applications.") - MARK_AS_ADVANCED(CMAKE_Fortran_STANDARD_LIBRARIES) -ENDIF(CMAKE_Fortran_STANDARD_LIBRARIES_INIT) + mark_as_advanced(CMAKE_Fortran_STANDARD_LIBRARIES) +endif() -IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) - SET (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG_INIT}" CACHE STRING +if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) + set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG_INIT}" CACHE STRING "Flags used by the compiler during debug builds.") - SET (CMAKE_Fortran_FLAGS_MINSIZEREL "${CMAKE_Fortran_FLAGS_MINSIZEREL_INIT}" CACHE STRING + set (CMAKE_Fortran_FLAGS_MINSIZEREL "${CMAKE_Fortran_FLAGS_MINSIZEREL_INIT}" CACHE STRING "Flags used by the compiler during release minsize builds.") - SET (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE_INIT}" CACHE STRING + set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE_INIT}" CACHE STRING "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).") - SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO "${CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING + set (CMAKE_Fortran_FLAGS_RELWITHDEBINFO "${CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING "Flags used by the compiler during Release with Debug Info builds.") -ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) +endif() -MARK_AS_ADVANCED( +mark_as_advanced( CMAKE_Fortran_FLAGS CMAKE_Fortran_FLAGS_DEBUG CMAKE_Fortran_FLAGS_MINSIZEREL @@ -242,4 +242,4 @@ CMAKE_Fortran_FLAGS_RELEASE CMAKE_Fortran_FLAGS_RELWITHDEBINFO) # set this variable so we can avoid loading this more than once. -SET(CMAKE_Fortran_INFORMATION_LOADED 1) +set(CMAKE_Fortran_INFORMATION_LOADED 1) diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 0ccbfac56..8a14aea60 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -12,60 +12,60 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty -SET(CMAKE_INCLUDE_FLAG_C "-I") # -I -SET(CMAKE_INCLUDE_FLAG_C_SEP "") # , or empty -SET(CMAKE_LIBRARY_PATH_FLAG "-L") -SET(CMAKE_LIBRARY_PATH_TERMINATOR "") # for the Digital Mars D compiler the link paths have to be terminated with a "/" -SET(CMAKE_LINK_LIBRARY_FLAG "-l") - -SET(CMAKE_LINK_LIBRARY_SUFFIX "") -SET(CMAKE_STATIC_LIBRARY_PREFIX "lib") -SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a") -SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so -SET(CMAKE_EXECUTABLE_SUFFIX "") # .exe -SET(CMAKE_DL_LIBS "dl") - -SET(CMAKE_FIND_LIBRARY_PREFIXES "lib") -SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty +set(CMAKE_INCLUDE_FLAG_C "-I") # -I +set(CMAKE_INCLUDE_FLAG_C_SEP "") # , or empty +set(CMAKE_LIBRARY_PATH_FLAG "-L") +set(CMAKE_LIBRARY_PATH_TERMINATOR "") # for the Digital Mars D compiler the link paths have to be terminated with a "/" +set(CMAKE_LINK_LIBRARY_FLAG "-l") + +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so +set(CMAKE_EXECUTABLE_SUFFIX "") # .exe +set(CMAKE_DL_LIBS "dl") + +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") # basically all general purpose OSs support shared libs -SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) -SET (CMAKE_SKIP_RPATH "NO" CACHE BOOL +set (CMAKE_SKIP_RPATH "NO" CACHE BOOL "If set, runtime paths are not added when using shared libraries.") -SET (CMAKE_SKIP_INSTALL_RPATH "NO" CACHE BOOL +set (CMAKE_SKIP_INSTALL_RPATH "NO" CACHE BOOL "If set, runtime paths are not added when installing shared libraries, but are added when building.") -SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.") +set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.") -IF(CMAKE_GENERATOR MATCHES "Makefiles") - SET(CMAKE_COLOR_MAKEFILE ON CACHE BOOL +if(CMAKE_GENERATOR MATCHES "Makefiles") + set(CMAKE_COLOR_MAKEFILE ON CACHE BOOL "Enable/Disable color output during build." ) - MARK_AS_ADVANCED(CMAKE_COLOR_MAKEFILE) - IF(DEFINED CMAKE_RULE_MESSAGES) - SET_PROPERTY(GLOBAL PROPERTY RULE_MESSAGES ${CMAKE_RULE_MESSAGES}) - ENDIF(DEFINED CMAKE_RULE_MESSAGES) - IF(CMAKE_GENERATOR MATCHES "Unix Makefiles") - SET(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL + mark_as_advanced(CMAKE_COLOR_MAKEFILE) + if(DEFINED CMAKE_RULE_MESSAGES) + set_property(GLOBAL PROPERTY RULE_MESSAGES ${CMAKE_RULE_MESSAGES}) + endif() + if(CMAKE_GENERATOR MATCHES "Unix Makefiles") + set(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL "Enable/Disable output of compile commands during generation." ) - MARK_AS_ADVANCED(CMAKE_EXPORT_COMPILE_COMMANDS) - ENDIF(CMAKE_GENERATOR MATCHES "Unix Makefiles") -ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + mark_as_advanced(CMAKE_EXPORT_COMPILE_COMMANDS) + endif() +endif() -IF(CMAKE_GENERATOR MATCHES "Ninja") - SET(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL +if(CMAKE_GENERATOR MATCHES "Ninja") + set(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL "Enable/Disable output of compile commands during generation." ) - MARK_AS_ADVANCED(CMAKE_EXPORT_COMPILE_COMMANDS) -ENDIF(CMAKE_GENERATOR MATCHES "Ninja") + mark_as_advanced(CMAKE_EXPORT_COMPILE_COMMANDS) +endif() # GetDefaultWindowsPrefixBase # @@ -160,27 +160,27 @@ endfunction() # was initialized by the block below. This is useful for user # projects to change the default prefix while still allowing the # command line to override it. -IF(NOT DEFINED CMAKE_INSTALL_PREFIX) - SET(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 1) -ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX) +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 1) +endif() # Choose a default install prefix for this platform. -IF(CMAKE_HOST_UNIX) - SET(CMAKE_INSTALL_PREFIX "/usr/local" +if(CMAKE_HOST_UNIX) + set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Install path prefix, prepended onto install directories.") -ELSE(CMAKE_HOST_UNIX) +else() GetDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES) - SET(CMAKE_INSTALL_PREFIX + set(CMAKE_INSTALL_PREFIX "${CMAKE_GENERIC_PROGRAM_FILES}/${PROJECT_NAME}" CACHE PATH "Install path prefix, prepended onto install directories.") - SET(CMAKE_GENERIC_PROGRAM_FILES) -ENDIF(CMAKE_HOST_UNIX) + set(CMAKE_GENERIC_PROGRAM_FILES) +endif() # Set a variable which will be used as component name in install() commands # where no COMPONENT has been given: -SET(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "Unspecified") +set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "Unspecified") -MARK_AS_ADVANCED( +mark_as_advanced( CMAKE_SKIP_RPATH CMAKE_SKIP_INSTALL_RPATH CMAKE_VERBOSE_MAKEFILE diff --git a/Modules/CMakeImportBuildSettings.cmake b/Modules/CMakeImportBuildSettings.cmake index 848d89445..60b887aed 100644 --- a/Modules/CMakeImportBuildSettings.cmake +++ b/Modules/CMakeImportBuildSettings.cmake @@ -16,9 +16,9 @@ # This macro used to load build settings from another project that # stored settings using the CMAKE_EXPORT_BUILD_SETTINGS macro. -MACRO(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE) - IF(${SETTINGS_FILE} MATCHES ".+") - ELSE(${SETTINGS_FILE} MATCHES ".+") - MESSAGE(SEND_ERROR "CMAKE_IMPORT_BUILD_SETTINGS called with no argument.") - ENDIF(${SETTINGS_FILE} MATCHES ".+") -ENDMACRO(CMAKE_IMPORT_BUILD_SETTINGS) +macro(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE) + if(${SETTINGS_FILE} MATCHES ".+") + else() + message(SEND_ERROR "CMAKE_IMPORT_BUILD_SETTINGS called with no argument.") + endif() +endmacro() diff --git a/Modules/CMakeJOMFindMake.cmake b/Modules/CMakeJOMFindMake.cmake index 617f3bb90..cb3cf12c8 100644 --- a/Modules/CMakeJOMFindMake.cmake +++ b/Modules/CMakeJOMFindMake.cmake @@ -13,6 +13,6 @@ # License text for the above reference.) -SET (CMAKE_MAKE_PROGRAM "jom" CACHE STRING +set (CMAKE_MAKE_PROGRAM "jom" CACHE STRING "Program used to build from makefiles.") -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) +mark_as_advanced(CMAKE_MAKE_PROGRAM) diff --git a/Modules/CMakeJavaCompiler.cmake.in b/Modules/CMakeJavaCompiler.cmake.in index 79c9288bc..cd4158c8e 100644 --- a/Modules/CMakeJavaCompiler.cmake.in +++ b/Modules/CMakeJavaCompiler.cmake.in @@ -1,13 +1,13 @@ -SET(CMAKE_Java_COMPILER "@CMAKE_Java_COMPILER@") -SET(CMAKE_Java_COMPILER_ARG1 "@CMAKE_Java_COMPILER_ARG1@") -SET(CMAKE_Java_RUNTIME "@CMAKE_Java_RUNTIME@") -SET(CMAKE_Java_ARCHIVE "@CMAKE_Java_ARCHIVE@") -SET(CMAKE_Java_COMPILER_LOADED 1) +set(CMAKE_Java_COMPILER "@CMAKE_Java_COMPILER@") +set(CMAKE_Java_COMPILER_ARG1 "@CMAKE_Java_COMPILER_ARG1@") +set(CMAKE_Java_RUNTIME "@CMAKE_Java_RUNTIME@") +set(CMAKE_Java_ARCHIVE "@CMAKE_Java_ARCHIVE@") +set(CMAKE_Java_COMPILER_LOADED 1) -SET(CMAKE_Java_SOURCE_FILE_EXTENSIONS java) -SET(CMAKE_Java_LINKER_PREFERENCE 40) -SET(CMAKE_Java_OUTPUT_EXTENSION .class) -SET(CMAKE_Java_OUTPUT_EXTENSION_REPLACE 1) -SET(CMAKE_STATIC_LIBRARY_PREFIX_Java "") -SET(CMAKE_STATIC_LIBRARY_SUFFIX_Java ".jar") -SET(CMAKE_Java_COMPILER_ENV_VAR "JAVA_COMPILER") +set(CMAKE_Java_SOURCE_FILE_EXTENSIONS java) +set(CMAKE_Java_LINKER_PREFERENCE 40) +set(CMAKE_Java_OUTPUT_EXTENSION .class) +set(CMAKE_Java_OUTPUT_EXTENSION_REPLACE 1) +set(CMAKE_STATIC_LIBRARY_PREFIX_Java "") +set(CMAKE_STATIC_LIBRARY_SUFFIX_Java ".jar") +set(CMAKE_Java_COMPILER_ENV_VAR "JAVA_COMPILER") diff --git a/Modules/CMakeJavaInformation.cmake b/Modules/CMakeJavaInformation.cmake index e192db100..928c6ac32 100644 --- a/Modules/CMakeJavaInformation.cmake +++ b/Modules/CMakeJavaInformation.cmake @@ -13,47 +13,47 @@ # License text for the above reference.) # This should be included before the _INIT variables are -# used to initialize the cache. Since the rule variables +# used to initialize the cache. Since the rule variables # have if blocks on them, users can still define them here. # But, it should still be after the platform file so changes can # be made to those values. -IF(CMAKE_USER_MAKE_RULES_OVERRIDE) +if(CMAKE_USER_MAKE_RULES_OVERRIDE) # Save the full path of the file so try_compile can use it. - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override) - SET(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}") -ENDIF() + include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override) + set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}") +endif() -IF(CMAKE_USER_MAKE_RULES_OVERRIDE_Java) +if(CMAKE_USER_MAKE_RULES_OVERRIDE_Java) # Save the full path of the file so try_compile can use it. - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_Java} RESULT_VARIABLE _override) - SET(CMAKE_USER_MAKE_RULES_OVERRIDE_Java "${_override}") -ENDIF() + include(${CMAKE_USER_MAKE_RULES_OVERRIDE_Java} RESULT_VARIABLE _override) + set(CMAKE_USER_MAKE_RULES_OVERRIDE_Java "${_override}") +endif() # this is a place holder if java needed flags for javac they would go here. -IF(NOT CMAKE_Java_CREATE_STATIC_LIBRARY) -# IF(WIN32) -# SET(class_files_mask "*.class") -# ELSE(WIN32) - SET(class_files_mask ".") -# ENDIF(WIN32) - - SET(CMAKE_Java_CREATE_STATIC_LIBRARY +if(NOT CMAKE_Java_CREATE_STATIC_LIBRARY) +# if(WIN32) +# set(class_files_mask "*.class") +# else() + set(class_files_mask ".") +# endif() + + set(CMAKE_Java_CREATE_STATIC_LIBRARY " -cf -C ${class_files_mask}") # "${class_files_mask}" should really be "" but compling a *.java # file can create more than one *.class file... -ENDIF(NOT CMAKE_Java_CREATE_STATIC_LIBRARY) +endif() # compile a Java file into an object file -IF(NOT CMAKE_Java_COMPILE_OBJECT) - SET(CMAKE_Java_COMPILE_OBJECT +if(NOT CMAKE_Java_COMPILE_OBJECT) + set(CMAKE_Java_COMPILE_OBJECT " -d ") -ENDIF(NOT CMAKE_Java_COMPILE_OBJECT) +endif() # set java include flag option and the separator for multiple include paths -SET(CMAKE_INCLUDE_FLAG_Java "-classpath ") -IF(WIN32 AND NOT CYGWIN) - SET(CMAKE_INCLUDE_FLAG_SEP_Java ";") -ELSE(WIN32 AND NOT CYGWIN) - SET(CMAKE_INCLUDE_FLAG_SEP_Java ":") -ENDIF(WIN32 AND NOT CYGWIN) +set(CMAKE_INCLUDE_FLAG_Java "-classpath ") +if(WIN32 AND NOT CYGWIN) + set(CMAKE_INCLUDE_FLAG_SEP_Java ";") +else() + set(CMAKE_INCLUDE_FLAG_SEP_Java ":") +endif() diff --git a/Modules/CMakeMSYSFindMake.cmake b/Modules/CMakeMSYSFindMake.cmake index 95492a0b0..bc0f89fff 100644 --- a/Modules/CMakeMSYSFindMake.cmake +++ b/Modules/CMakeMSYSFindMake.cmake @@ -12,9 +12,9 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(CMAKE_MAKE_PROGRAM make - PATHS +find_program(CMAKE_MAKE_PROGRAM make + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MSYS-1.0_is1;Inno Setup: App Path]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin" c:/msys/1.0/bin /msys/1.0/bin) -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) +mark_as_advanced(CMAKE_MAKE_PROGRAM) diff --git a/Modules/CMakeMinGWFindMake.cmake b/Modules/CMakeMinGWFindMake.cmake index f760d74d4..efba20a31 100644 --- a/Modules/CMakeMinGWFindMake.cmake +++ b/Modules/CMakeMinGWFindMake.cmake @@ -12,13 +12,13 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(CMAKE_MAKE_PROGRAM mingw32-make.exe PATHS - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin" +find_program(CMAKE_MAKE_PROGRAM mingw32-make.exe PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin" c:/MinGW/bin /MinGW/bin) -FIND_PROGRAM(CMAKE_SH sh.exe ) -IF(CMAKE_SH) - MESSAGE(FATAL_ERROR "sh.exe was found in your PATH, here:\n${CMAKE_SH}\nFor MinGW make to work correctly sh.exe must NOT be in your path.\nRun cmake from a shell that does not have sh.exe in your PATH.\nIf you want to use a UNIX shell, then use MSYS Makefiles.\n") - SET(CMAKE_MAKE_PROGRAM NOTFOUND) -ENDIF(CMAKE_SH) +find_program(CMAKE_SH sh.exe ) +if(CMAKE_SH) + message(FATAL_ERROR "sh.exe was found in your PATH, here:\n${CMAKE_SH}\nFor MinGW make to work correctly sh.exe must NOT be in your path.\nRun cmake from a shell that does not have sh.exe in your PATH.\nIf you want to use a UNIX shell, then use MSYS Makefiles.\n") + set(CMAKE_MAKE_PROGRAM NOTFOUND) +endif() -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM CMAKE_SH) +mark_as_advanced(CMAKE_MAKE_PROGRAM CMAKE_SH) diff --git a/Modules/CMakeNMakeFindMake.cmake b/Modules/CMakeNMakeFindMake.cmake index f6472170c..d807df82b 100644 --- a/Modules/CMakeNMakeFindMake.cmake +++ b/Modules/CMakeNMakeFindMake.cmake @@ -13,6 +13,6 @@ # License text for the above reference.) -SET (CMAKE_MAKE_PROGRAM "nmake" CACHE STRING +set (CMAKE_MAKE_PROGRAM "nmake" CACHE STRING "Program used to build from makefiles.") -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) +mark_as_advanced(CMAKE_MAKE_PROGRAM) diff --git a/Modules/CMakeNinjaFindMake.cmake b/Modules/CMakeNinjaFindMake.cmake index f15c3e0d4..c3ca7671c 100644 --- a/Modules/CMakeNinjaFindMake.cmake +++ b/Modules/CMakeNinjaFindMake.cmake @@ -12,6 +12,6 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(CMAKE_MAKE_PROGRAM ninja +find_program(CMAKE_MAKE_PROGRAM ninja DOC "Program used to build from build.ninja files.") -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) +mark_as_advanced(CMAKE_MAKE_PROGRAM) diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 48039e522..393d05c80 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -6,9 +6,11 @@ # [NO_CHECK_REQUIRED_COMPONENTS_MACRO]) # # CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain -# CONFIGURE_FILE() command when creating the Config.cmake or -config.cmake +# configure_file() command when creating the Config.cmake or -config.cmake # file for installing a project or library. It helps making the resulting package # relocatable by avoiding hardcoded paths in the installed Config.cmake file. +# Config.cmake files installed under UNIX into /lib(64) or /usr/lib(64) are +# considered system packages and are not relocatable. # # In a FooConfig.cmake file there may be code like this to make the # install destinations know to the using project: @@ -31,12 +33,12 @@ # Usage: # 1. write a FooConfig.cmake.in file as you are used to # 2. insert a line containing only the string "@PACKAGE_INIT@" -# 3. instead of SET(FOO_DIR "@SOME_INSTALL_DIR@"), use SET(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@") +# 3. instead of set(FOO_DIR "@SOME_INSTALL_DIR@"), use set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@") # (this must be after the @PACKAGE_INIT@ line) -# 4. instead of using the normal CONFIGURE_FILE(), use CONFIGURE_PACKAGE_CONFIG_FILE() +# 4. instead of using the normal configure_file(), use CONFIGURE_PACKAGE_CONFIG_FILE() # # The and arguments are the input and output file, the same way -# as in CONFIGURE_FILE(). +# as in configure_file(). # # The given to INSTALL_DESTINATION must be the destination where the FooConfig.cmake # file will be installed to. This can either be a relative or absolute path, both work. @@ -77,7 +79,7 @@ # WRITE_BASIC_PACKAGE_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) ) # # Writes a file for use as ConfigVersion.cmake file to . -# See the documentation of FIND_PACKAGE() for details on this. +# See the documentation of find_package() for details on this. # filename is the output filename, it should be in the build tree. # major.minor.patch is the version number of the project to be installed # The COMPATIBILITY mode AnyNewerVersion means that the installed package version @@ -173,23 +175,44 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) else() set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}") endif() + + # with the /usr-move, /lib(64) is a symlink to /usr/lib on Fedora, ArchLinux, Mageira and others. + # If we are installed to such a location, force using absolute paths. + set(forceAbsolutePaths FALSE) + if("${absInstallDir}" MATCHES "^(/usr)?/lib(64)?/.+") + set(forceAbsolutePaths TRUE) + endif() + file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" ) foreach(var ${CCF_PATH_VARS}) if(NOT DEFINED ${var}) message(FATAL_ERROR "Variable ${var} does not exist") else() - if(IS_ABSOLUTE "${${var}}") - string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}" - PACKAGE_${var} "${${var}}") + if(forceAbsolutePaths) + if(IS_ABSOLUTE "${${var}}") + set(PACKAGE_${var} "${${var}}") + else() + set(PACKAGE_${var} "${CMAKE_INSTALL_PREFIX}/${${var}}") + endif() else() - set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}") + if(IS_ABSOLUTE "${${var}}") + string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}" + PACKAGE_${var} "${${var}}") + else() + set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}") + endif() endif() endif() endforeach() + get_filename_component(inputFileName "${_inputFile}" NAME) + set(PACKAGE_INIT " ####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### +####### Any changes to this file will be overwritten by the next CMake run #### +####### The input file was ${inputFileName} ######## + get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE) ") @@ -214,7 +237,7 @@ macro(check_required_components _NAME) set(\${_NAME}_FOUND FALSE) endif() endif() - endforeach(comp) + endforeach() endmacro() ") endif() diff --git a/Modules/CMakeParseArguments.cmake b/Modules/CMakeParseArguments.cmake index 7ce4c49ae..406780eb4 100644 --- a/Modules/CMakeParseArguments.cmake +++ b/Modules/CMakeParseArguments.cmake @@ -84,11 +84,11 @@ function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgName # first set all result variables to empty/FALSE foreach(arg_name ${_singleArgNames} ${_multiArgNames}) set(${prefix}_${arg_name}) - endforeach(arg_name) + endforeach() foreach(option ${_optionNames}) set(${prefix}_${option} FALSE) - endforeach(option) + endforeach() set(${prefix}_UNPARSED_ARGUMENTS) @@ -109,9 +109,9 @@ function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgName elseif("${insideValues}" STREQUAL "MULTI") list(APPEND ${prefix}_${currentArgName} ${currentArg}) endif() - else(insideValues) + else() list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) - endif(insideValues) + endif() else() if(NOT ${optionIndex} EQUAL -1) set(${prefix}_${currentArg} TRUE) @@ -127,12 +127,12 @@ function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgName endif() endif() - endforeach(currentArg) + endforeach() # propagate the result variables to the caller: foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) - endforeach(arg_name) + endforeach() set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) -endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs) +endfunction() diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index ecb20dc6b..80e02188a 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -16,9 +16,10 @@ # This is used internally by CMake and should not be included by user # code. -function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex) +function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj_regex) set(implicit_libs_tmp "") set(implicit_dirs_tmp) + set(implicit_fwks_tmp) set(log "") # Parse implicit linker arguments. @@ -36,6 +37,16 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex) set(cmd) if("${line}" MATCHES "${linker_regex}" AND NOT "${line}" MATCHES "${linker_exclude_regex}") + if(XCODE) + # Xcode unconditionally adds a path under the project build tree and + # on older versions it is not reported with proper quotes. Remove it. + string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" _dir_regex "${CMAKE_BINARY_DIR}") + string(REGEX REPLACE " -[FL]${_dir_regex}/([^ ]| [^-])+( |$)" " " xline "${line}") + if(NOT "x${xline}" STREQUAL "x${line}") + set(log "${log} reduced line: [${line}]\n to: [${xline}]\n") + set(line "${xline}") + endif() + endif() if(UNIX) separate_arguments(args UNIX_COMMAND "${line}") else() @@ -97,32 +108,62 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex) endif() endforeach() + # Look for library search paths reported by linker. + if("${output_lines}" MATCHES ";Library search paths:((;\t[^;]+)+)") + string(REPLACE ";\t" ";" implicit_dirs_match "${CMAKE_MATCH_1}") + set(log "${log} Library search paths: [${implicit_dirs_match}]\n") + list(APPEND implicit_dirs_tmp ${implicit_dirs_match}) + endif() + if("${output_lines}" MATCHES ";Framework search paths:((;\t[^;]+)+)") + string(REPLACE ";\t" ";" implicit_fwks_match "${CMAKE_MATCH_1}") + set(log "${log} Framework search paths: [${implicit_fwks_match}]\n") + list(APPEND implicit_fwks_tmp ${implicit_fwks_match}) + endif() + # Cleanup list of libraries and flags. # We remove items that are not language-specific. set(implicit_libs "") foreach(lib IN LISTS implicit_libs_tmp) if("${lib}" MATCHES "^(crt.*\\.o|gcc.*|System.*)$") set(log "${log} remove lib [${lib}]\n") + elseif(IS_ABSOLUTE "${lib}") + get_filename_component(abs "${lib}" ABSOLUTE) + if(NOT "x${lib}" STREQUAL "x${abs}") + set(log "${log} collapse lib [${lib}] ==> [${abs}]\n") + endif() + list(APPEND implicit_libs "${abs}") else() list(APPEND implicit_libs "${lib}") endif() endforeach() - # Cleanup list of directories. - set(implicit_dirs "") - foreach(d IN LISTS implicit_dirs_tmp) - get_filename_component(dir "${d}" ABSOLUTE) - list(APPEND implicit_dirs "${dir}") - set(log "${log} collapse dir [${d}] ==> [${dir}]\n") + # Cleanup list of library and framework directories. + set(desc_dirs "library") + set(desc_fwks "framework") + foreach(t dirs fwks) + set(implicit_${t} "") + foreach(d IN LISTS implicit_${t}_tmp) + get_filename_component(dir "${d}" ABSOLUTE) + string(FIND "${dir}" "${CMAKE_FILES_DIRECTORY}/" pos) + if(NOT pos LESS 0) + set(msg ", skipping non-system directory") + else() + set(msg "") + list(APPEND implicit_${t} "${dir}") + endif() + set(log "${log} collapse ${desc_${t}} dir [${d}] ==> [${dir}]${msg}\n") + endforeach() + list(REMOVE_DUPLICATES implicit_${t}) endforeach() - list(REMOVE_DUPLICATES implicit_dirs) # Log results. set(log "${log} implicit libs: [${implicit_libs}]\n") set(log "${log} implicit dirs: [${implicit_dirs}]\n") + set(log "${log} implicit fwks: [${implicit_fwks}]\n") # Return results. set(${lib_var} "${implicit_libs}" PARENT_SCOPE) set(${dir_var} "${implicit_dirs}" PARENT_SCOPE) + set(${fwk_var} "${implicit_fwks}" PARENT_SCOPE) set(${log_var} "${log}" PARENT_SCOPE) endfunction() diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index 6341dca9a..69171c2a3 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -35,11 +35,8 @@ #elif defined(__hpux) || defined(__hpux__) # define PLATFORM_ID "HP-UX" -#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU) +#elif defined(__HAIKU__) # define PLATFORM_ID "Haiku" -/* Haiku also defines __BEOS__ so we must - put it prior to the check for __BEOS__ -*/ #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) # define PLATFORM_ID "BeOS" @@ -92,7 +89,7 @@ # define ARCHITECTURE_ID "IA64" # elif defined(_M_X64) || defined(_M_AMD64) -# define ARCHITECTURE_ID "x64" +# define ARCHITECTURE_ID "x64" # elif defined(_M_IX86) # define ARCHITECTURE_ID "X86" @@ -100,6 +97,12 @@ # elif defined(_M_ARM) # define ARCHITECTURE_ID "ARM" +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + # else /* unknown architecture */ # define ARCHITECTURE_ID "" # endif diff --git a/Modules/CMakePrintSystemInformation.cmake b/Modules/CMakePrintSystemInformation.cmake index 2c5d0f2ae..e0c73346b 100644 --- a/Modules/CMakePrintSystemInformation.cmake +++ b/Modules/CMakePrintSystemInformation.cmake @@ -16,31 +16,31 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -MESSAGE("CMAKE_SYSTEM is ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}") -MESSAGE("CMAKE_SYSTEM file is ${CMAKE_SYSTEM_INFO_FILE}") -MESSAGE("CMAKE_C_COMPILER is ${CMAKE_C_COMPILER}") -MESSAGE("CMAKE_CXX_COMPILER is ${CMAKE_CXX_COMPILER}") +message("CMAKE_SYSTEM is ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}") +message("CMAKE_SYSTEM file is ${CMAKE_SYSTEM_INFO_FILE}") +message("CMAKE_C_COMPILER is ${CMAKE_C_COMPILER}") +message("CMAKE_CXX_COMPILER is ${CMAKE_CXX_COMPILER}") -MESSAGE("CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS is ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}") -MESSAGE("CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS is ${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS}") -MESSAGE("CMAKE_DL_LIBS is ${CMAKE_DL_LIBS}") -MESSAGE("CMAKE_SHARED_LIBRARY_PREFIX is ${CMAKE_SHARED_LIBRARY_PREFIX}") -MESSAGE("CMAKE_SHARED_LIBRARY_SUFFIX is ${CMAKE_SHARED_LIBRARY_SUFFIX}") -MESSAGE("CMAKE_COMPILER_IS_GNUCC = ${CMAKE_COMPILER_IS_GNUCC}") -MESSAGE("CMAKE_COMPILER_IS_GNUCXX = ${CMAKE_COMPILER_IS_GNUCXX}") +message("CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS is ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}") +message("CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS is ${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS}") +message("CMAKE_DL_LIBS is ${CMAKE_DL_LIBS}") +message("CMAKE_SHARED_LIBRARY_PREFIX is ${CMAKE_SHARED_LIBRARY_PREFIX}") +message("CMAKE_SHARED_LIBRARY_SUFFIX is ${CMAKE_SHARED_LIBRARY_SUFFIX}") +message("CMAKE_COMPILER_IS_GNUCC = ${CMAKE_COMPILER_IS_GNUCC}") +message("CMAKE_COMPILER_IS_GNUCXX = ${CMAKE_COMPILER_IS_GNUCXX}") -MESSAGE("CMAKE_CXX_CREATE_SHARED_LIBRARY is ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") -MESSAGE("CMAKE_CXX_CREATE_SHARED_MODULE is ${CMAKE_CXX_CREATE_SHARED_MODULE}") -MESSAGE("CMAKE_CXX_CREATE_STATIC_LIBRARY is ${CMAKE_CXX_CREATE_STATIC_LIBRARY}") -MESSAGE("CMAKE_CXX_COMPILE_OBJECT is ${CMAKE_CXX_COMPILE_OBJECT}") -MESSAGE("CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_CXX_LINK_EXECUTABLE}") +message("CMAKE_CXX_CREATE_SHARED_LIBRARY is ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") +message("CMAKE_CXX_CREATE_SHARED_MODULE is ${CMAKE_CXX_CREATE_SHARED_MODULE}") +message("CMAKE_CXX_CREATE_STATIC_LIBRARY is ${CMAKE_CXX_CREATE_STATIC_LIBRARY}") +message("CMAKE_CXX_COMPILE_OBJECT is ${CMAKE_CXX_COMPILE_OBJECT}") +message("CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_CXX_LINK_EXECUTABLE}") -MESSAGE("CMAKE_C_CREATE_SHARED_LIBRARY is ${CMAKE_C_CREATE_SHARED_LIBRARY}") -MESSAGE("CMAKE_C_CREATE_SHARED_MODULE is ${CMAKE_C_CREATE_SHARED_MODULE}") -MESSAGE("CMAKE_C_CREATE_STATIC_LIBRARY is ${CMAKE_C_CREATE_STATIC_LIBRARY}") -MESSAGE("CMAKE_C_COMPILE_OBJECT is ${CMAKE_C_COMPILE_OBJECT}") -MESSAGE("CMAKE_C_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}") +message("CMAKE_C_CREATE_SHARED_LIBRARY is ${CMAKE_C_CREATE_SHARED_LIBRARY}") +message("CMAKE_C_CREATE_SHARED_MODULE is ${CMAKE_C_CREATE_SHARED_MODULE}") +message("CMAKE_C_CREATE_STATIC_LIBRARY is ${CMAKE_C_CREATE_STATIC_LIBRARY}") +message("CMAKE_C_COMPILE_OBJECT is ${CMAKE_C_COMPILE_OBJECT}") +message("CMAKE_C_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}") -MESSAGE("CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE ${CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE}") -MESSAGE("CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE ${CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE}") +message("CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE ${CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE}") +message("CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE ${CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE}") diff --git a/Modules/CMakePushCheckState.cmake b/Modules/CMakePushCheckState.cmake index 0a4212818..08809bf25 100644 --- a/Modules/CMakePushCheckState.cmake +++ b/Modules/CMakePushCheckState.cmake @@ -31,31 +31,31 @@ # License text for the above reference.) -MACRO(CMAKE_PUSH_CHECK_STATE) +macro(CMAKE_PUSH_CHECK_STATE) - IF(NOT DEFINED _CMAKE_PUSH_CHECK_STATE_COUNTER) - SET(_CMAKE_PUSH_CHECK_STATE_COUNTER 0) - ENDIF() + if(NOT DEFINED _CMAKE_PUSH_CHECK_STATE_COUNTER) + set(_CMAKE_PUSH_CHECK_STATE_COUNTER 0) + endif() - MATH(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}+1") + math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}+1") - SET(_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_INCLUDES}) - SET(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS}) - SET(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES}) - SET(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS}) -ENDMACRO(CMAKE_PUSH_CHECK_STATE) + set(_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_INCLUDES}) + set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS}) + set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES}) + set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS}) +endmacro() -MACRO(CMAKE_POP_CHECK_STATE) +macro(CMAKE_POP_CHECK_STATE) # don't pop more than we pushed - IF("${_CMAKE_PUSH_CHECK_STATE_COUNTER}" GREATER "0") + if("${_CMAKE_PUSH_CHECK_STATE_COUNTER}" GREATER "0") - SET(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) - SET(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) - SET(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) - SET(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) - MATH(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1") - ENDIF() + math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1") + endif() -ENDMACRO(CMAKE_POP_CHECK_STATE) +endmacro() diff --git a/Modules/CMakeRCCompiler.cmake.in b/Modules/CMakeRCCompiler.cmake.in index 83428e2eb..0fc314220 100644 --- a/Modules/CMakeRCCompiler.cmake.in +++ b/Modules/CMakeRCCompiler.cmake.in @@ -1,6 +1,6 @@ -SET(CMAKE_RC_COMPILER "@CMAKE_RC_COMPILER@") -SET(CMAKE_RC_COMPILER_ARG1 "@CMAKE_RC_COMPILER_ARG1@") -SET(CMAKE_RC_COMPILER_LOADED 1) -SET(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc) -SET(CMAKE_RC_OUTPUT_EXTENSION @CMAKE_RC_OUTPUT_EXTENSION@) -SET(CMAKE_RC_COMPILER_ENV_VAR "RC") +set(CMAKE_RC_COMPILER "@CMAKE_RC_COMPILER@") +set(CMAKE_RC_COMPILER_ARG1 "@CMAKE_RC_COMPILER_ARG1@") +set(CMAKE_RC_COMPILER_LOADED 1) +set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc) +set(CMAKE_RC_OUTPUT_EXTENSION @CMAKE_RC_OUTPUT_EXTENSION@) +set(CMAKE_RC_COMPILER_ENV_VAR "RC") diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake index 859fe1158..8ffe50aba 100644 --- a/Modules/CMakeRCInformation.cmake +++ b/Modules/CMakeRCInformation.cmake @@ -18,36 +18,36 @@ # if it exists. # make sure we don't use CMAKE_BASE_NAME from somewhere else -SET(CMAKE_BASE_NAME) -GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_RC_COMPILER} NAME_WE) -IF("${CMAKE_BASE_NAME}" MATCHES "windres") - SET(CMAKE_BASE_NAME "windres") -ENDIF() -SET(CMAKE_SYSTEM_AND_RC_COMPILER_INFO_FILE +set(CMAKE_BASE_NAME) +get_filename_component(CMAKE_BASE_NAME ${CMAKE_RC_COMPILER} NAME_WE) +if("${CMAKE_BASE_NAME}" MATCHES "windres") + set(CMAKE_BASE_NAME "windres") +endif() +set(CMAKE_SYSTEM_AND_RC_COMPILER_INFO_FILE ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) -INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) +include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) -SET (CMAKE_RC_FLAGS "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}" CACHE STRING +set (CMAKE_RC_FLAGS "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}" CACHE STRING "Flags for Fortran compiler.") # These are the only types of flags that should be passed to the rc # command, if COMPILE_FLAGS is used on a target this will be used # to filter out any other flags -SET(CMAKE_RC_FLAG_REGEX "^[-/](D|I)") +set(CMAKE_RC_FLAG_REGEX "^[-/](D|I)") # now define the following rule variables # CMAKE_RC_COMPILE_OBJECT -SET(CMAKE_INCLUDE_FLAG_RC "-I") +set(CMAKE_INCLUDE_FLAG_RC "-I") # compile a Resource file into an object file -IF(NOT CMAKE_RC_COMPILE_OBJECT) - SET(CMAKE_RC_COMPILE_OBJECT +if(NOT CMAKE_RC_COMPILE_OBJECT) + set(CMAKE_RC_COMPILE_OBJECT " /fo ") -ENDIF(NOT CMAKE_RC_COMPILE_OBJECT) +endif() -MARK_AS_ADVANCED( +mark_as_advanced( CMAKE_RC_FLAGS ) # set this variable so we can avoid loading this more than once. -SET(CMAKE_RC_INFORMATION_LOADED 1) +set(CMAKE_RC_INFORMATION_LOADED 1) diff --git a/Modules/CMakeSystem.cmake.in b/Modules/CMakeSystem.cmake.in index a9f3a552d..7e2a3584b 100644 --- a/Modules/CMakeSystem.cmake.in +++ b/Modules/CMakeSystem.cmake.in @@ -1,15 +1,15 @@ @INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED@ -SET(CMAKE_SYSTEM "@CMAKE_SYSTEM@") -SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@") -SET(CMAKE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@") -SET(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@") +set(CMAKE_SYSTEM "@CMAKE_SYSTEM@") +set(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@") +set(CMAKE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@") +set(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@") -SET(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@") -SET(CMAKE_HOST_SYSTEM_NAME "@CMAKE_HOST_SYSTEM_NAME@") -SET(CMAKE_HOST_SYSTEM_VERSION "@CMAKE_HOST_SYSTEM_VERSION@") -SET(CMAKE_HOST_SYSTEM_PROCESSOR "@CMAKE_HOST_SYSTEM_PROCESSOR@") +set(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@") +set(CMAKE_HOST_SYSTEM_NAME "@CMAKE_HOST_SYSTEM_NAME@") +set(CMAKE_HOST_SYSTEM_VERSION "@CMAKE_HOST_SYSTEM_VERSION@") +set(CMAKE_HOST_SYSTEM_PROCESSOR "@CMAKE_HOST_SYSTEM_PROCESSOR@") -SET(CMAKE_CROSSCOMPILING "@CMAKE_CROSSCOMPILING@") +set(CMAKE_CROSSCOMPILING "@CMAKE_CROSSCOMPILING@") -SET(CMAKE_SYSTEM_LOADED 1) +set(CMAKE_SYSTEM_LOADED 1) diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index faa9e3625..b9f8e0aaa 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -21,49 +21,49 @@ # But they are reset here and set again in the platform files for the target # platform, so they can be used for testing the target platform instead # of testing the host platform. -SET(APPLE ) -SET(UNIX ) -SET(CYGWIN ) -SET(WIN32 ) +set(APPLE ) +set(UNIX ) +set(CYGWIN ) +set(WIN32 ) # include Generic system information -INCLUDE(CMakeGenericSystem) +include(CMakeGenericSystem) # 2. now include SystemName.cmake file to set the system specific information -SET(CMAKE_SYSTEM_INFO_FILE Platform/${CMAKE_SYSTEM_NAME}) +set(CMAKE_SYSTEM_INFO_FILE Platform/${CMAKE_SYSTEM_NAME}) -INCLUDE(${CMAKE_SYSTEM_INFO_FILE} OPTIONAL RESULT_VARIABLE _INCLUDED_SYSTEM_INFO_FILE) +include(${CMAKE_SYSTEM_INFO_FILE} OPTIONAL RESULT_VARIABLE _INCLUDED_SYSTEM_INFO_FILE) -IF(NOT _INCLUDED_SYSTEM_INFO_FILE) - MESSAGE("System is unknown to cmake, create:\n${CMAKE_SYSTEM_INFO_FILE}" +if(NOT _INCLUDED_SYSTEM_INFO_FILE) + message("System is unknown to cmake, create:\n${CMAKE_SYSTEM_INFO_FILE}" " to use this system, please send your config file to " "cmake@www.cmake.org so it can be added to cmake") - IF(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt) - CONFIGURE_FILE(${CMAKE_BINARY_DIR}/CMakeCache.txt + if(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt) + configure_file(${CMAKE_BINARY_DIR}/CMakeCache.txt ${CMAKE_BINARY_DIR}/CopyOfCMakeCache.txt COPYONLY) - MESSAGE("Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. " + message("Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. " "Please send that file to cmake@www.cmake.org.") - ENDIF(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt) -ENDIF(NOT _INCLUDED_SYSTEM_INFO_FILE) + endif() +endif() # optionally include a file which can do extra-generator specific things, e.g. # CMakeFindEclipseCDT4.cmake asks gcc for the system include dirs for the Eclipse CDT4 generator -IF(CMAKE_EXTRA_GENERATOR) - STRING(REPLACE " " "" _CMAKE_EXTRA_GENERATOR_NO_SPACES ${CMAKE_EXTRA_GENERATOR} ) - INCLUDE("CMakeFind${_CMAKE_EXTRA_GENERATOR_NO_SPACES}" OPTIONAL) -ENDIF(CMAKE_EXTRA_GENERATOR) +if(CMAKE_EXTRA_GENERATOR) + string(REPLACE " " "" _CMAKE_EXTRA_GENERATOR_NO_SPACES ${CMAKE_EXTRA_GENERATOR} ) + include("CMakeFind${_CMAKE_EXTRA_GENERATOR_NO_SPACES}" OPTIONAL) +endif() # for most systems a module is the same as a shared library # so unless the variable CMAKE_MODULE_EXISTS is set just # copy the values from the LIBRARY variables # this has to be done after the system information has been loaded -IF(NOT CMAKE_MODULE_EXISTS) - SET(CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}") - SET(CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}") -ENDIF(NOT CMAKE_MODULE_EXISTS) +if(NOT CMAKE_MODULE_EXISTS) + set(CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}") + set(CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}") +endif() -SET(CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED 1) +set(CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED 1) diff --git a/Modules/CMakeTestASM-ATTCompiler.cmake b/Modules/CMakeTestASM-ATTCompiler.cmake index 581ad0c23..0cc68573e 100644 --- a/Modules/CMakeTestASM-ATTCompiler.cmake +++ b/Modules/CMakeTestASM-ATTCompiler.cmake @@ -18,6 +18,6 @@ # because otherwise there would have to be a separate assembler source file # for each assembler on every architecture. -SET(ASM_DIALECT "-ATT") -INCLUDE(CMakeTestASMCompiler) -SET(ASM_DIALECT) +set(ASM_DIALECT "-ATT") +include(CMakeTestASMCompiler) +set(ASM_DIALECT) diff --git a/Modules/CMakeTestASMCompiler.cmake b/Modules/CMakeTestASMCompiler.cmake index 294511d89..9381619c4 100644 --- a/Modules/CMakeTestASMCompiler.cmake +++ b/Modules/CMakeTestASMCompiler.cmake @@ -19,17 +19,17 @@ # for each assembler on every architecture. -SET(_ASM_COMPILER_WORKS 0) +set(_ASM_COMPILER_WORKS 0) -IF(CMAKE_ASM${ASM_DIALECT}_COMPILER) - SET(_ASM_COMPILER_WORKS 1) -ENDIF() +if(CMAKE_ASM${ASM_DIALECT}_COMPILER) + set(_ASM_COMPILER_WORKS 1) +endif() # when using generic "ASM" support, we must have detected the compiler ID, fail otherwise: -IF("ASM${ASM_DIALECT}" STREQUAL "ASM") - IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) - SET(_ASM_COMPILER_WORKS 0) - ENDIF() -ENDIF() +if("ASM${ASM_DIALECT}" STREQUAL "ASM") + if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + set(_ASM_COMPILER_WORKS 0) + endif() +endif() -SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_WORKS ${_ASM_COMPILER_WORKS} CACHE INTERNAL "") +set(CMAKE_ASM${ASM_DIALECT}_COMPILER_WORKS ${_ASM_COMPILER_WORKS} CACHE INTERNAL "") diff --git a/Modules/CMakeTestASM_MASMCompiler.cmake b/Modules/CMakeTestASM_MASMCompiler.cmake index 8369b942c..462b1fc07 100644 --- a/Modules/CMakeTestASM_MASMCompiler.cmake +++ b/Modules/CMakeTestASM_MASMCompiler.cmake @@ -18,6 +18,6 @@ # because otherwise there would have to be a separate assembler source file # for each assembler on every architecture. -SET(ASM_DIALECT "_MASM") -INCLUDE(CMakeTestASMCompiler) -SET(ASM_DIALECT) +set(ASM_DIALECT "_MASM") +include(CMakeTestASMCompiler) +set(ASM_DIALECT) diff --git a/Modules/CMakeTestASM_NASMCompiler.cmake b/Modules/CMakeTestASM_NASMCompiler.cmake index a5e2bea0a..414c2f550 100644 --- a/Modules/CMakeTestASM_NASMCompiler.cmake +++ b/Modules/CMakeTestASM_NASMCompiler.cmake @@ -18,6 +18,6 @@ # because otherwise there would have to be a separate assembler source file # for each assembler on every architecture. -SET(ASM_DIALECT "_NASM") -INCLUDE(CMakeTestASMCompiler) -SET(ASM_DIALECT) +set(ASM_DIALECT "_NASM") +include(CMakeTestASMCompiler) +set(ASM_DIALECT) diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake index 779b2f007..2c751471a 100644 --- a/Modules/CMakeTestCCompiler.cmake +++ b/Modules/CMakeTestCCompiler.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2003-2009 Kitware, Inc. +# Copyright 2003-2012 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -12,16 +12,27 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(CMakeTestCompilerCommon) +if(CMAKE_C_COMPILER_FORCED) + # The compiler configuration was forced by the user. + # Assume the user has configured all compiler information. + set(CMAKE_C_COMPILER_WORKS TRUE) + return() +endif() + +include(CMakeTestCompilerCommon) + +# Remove any cached result from an older CMake version. +# We now store this in CMakeCCompiler.cmake. +unset(CMAKE_C_COMPILER_WORKS CACHE) # This file is used by EnableLanguage in cmGlobalGenerator to # determine that that selected C compiler can actually compile # and link the most basic of programs. If not, a fatal error # is set and cmake stops processing commands and will not generate # any makefiles or projects. -IF(NOT CMAKE_C_COMPILER_WORKS) +if(NOT CMAKE_C_COMPILER_WORKS) PrintTestCompilerStatus("C" "") - FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c + file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c "#ifdef __cplusplus\n" "# error \"The CMAKE_C_COMPILER is set to a C++ compiler\"\n" "#endif\n" @@ -33,55 +44,50 @@ IF(NOT CMAKE_C_COMPILER_WORKS) "int main(int argc, char* argv[])\n" "#endif\n" "{ (void)argv; return argc-1;}\n") - TRY_COMPILE(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR} + try_compile(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c OUTPUT_VARIABLE __CMAKE_C_COMPILER_OUTPUT) - SET(C_TEST_WAS_RUN 1) -ENDIF(NOT CMAKE_C_COMPILER_WORKS) + # Move result from cache to normal variable. + set(CMAKE_C_COMPILER_WORKS ${CMAKE_C_COMPILER_WORKS}) + unset(CMAKE_C_COMPILER_WORKS CACHE) + set(C_TEST_WAS_RUN 1) +endif() -IF(NOT CMAKE_C_COMPILER_WORKS) +if(NOT CMAKE_C_COMPILER_WORKS) PrintTestCompilerStatus("C" " -- broken") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the C compiler works failed with " "the following output:\n${__CMAKE_C_COMPILER_OUTPUT}\n\n") - # if the compiler is broken make sure to remove the platform file - # since Windows-cl configures both c/cxx files both need to be removed - # when c or c++ fails - FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake ) - FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake ) - MESSAGE(FATAL_ERROR "The C compiler \"${CMAKE_C_COMPILER}\" " + message(FATAL_ERROR "The C compiler \"${CMAKE_C_COMPILER}\" " "is not able to compile a simple test program.\nIt fails " "with the following output:\n ${__CMAKE_C_COMPILER_OUTPUT}\n\n" "CMake will not be able to correctly generate this project.") -ELSE(NOT CMAKE_C_COMPILER_WORKS) - IF(C_TEST_WAS_RUN) +else() + if(C_TEST_WAS_RUN) PrintTestCompilerStatus("C" " -- works") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the C compiler works passed with " "the following output:\n${__CMAKE_C_COMPILER_OUTPUT}\n\n") - ENDIF(C_TEST_WAS_RUN) - SET(CMAKE_C_COMPILER_WORKS 1 CACHE INTERNAL "") + endif() + + # Try to identify the ABI and configure it into CMakeCCompiler.cmake + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) + CMAKE_DETERMINE_COMPILER_ABI(C ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c) + + # Re-configure to save learned information. + configure_file( + ${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake + @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 + ) + include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake) - IF(CMAKE_C_COMPILER_FORCED) - # The compiler configuration was forced by the user. - # Assume the user has configured all compiler information. - ELSE(CMAKE_C_COMPILER_FORCED) - # Try to identify the ABI and configure it into CMakeCCompiler.cmake - INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) - CMAKE_DETERMINE_COMPILER_ABI(C ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c) - CONFIGURE_FILE( - ${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake - @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 - ) - INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake) - ENDIF(CMAKE_C_COMPILER_FORCED) - IF(CMAKE_C_SIZEOF_DATA_PTR) - FOREACH(f ${CMAKE_C_ABI_FILES}) - INCLUDE(${f}) - ENDFOREACH() - UNSET(CMAKE_C_ABI_FILES) - ENDIF() -ENDIF(NOT CMAKE_C_COMPILER_WORKS) + if(CMAKE_C_SIZEOF_DATA_PTR) + foreach(f ${CMAKE_C_ABI_FILES}) + include(${f}) + endforeach() + unset(CMAKE_C_ABI_FILES) + endif() +endif() -UNSET(__CMAKE_C_COMPILER_OUTPUT) +unset(__CMAKE_C_COMPILER_OUTPUT) diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake index 87022e9f9..a5cdf5669 100644 --- a/Modules/CMakeTestCXXCompiler.cmake +++ b/Modules/CMakeTestCXXCompiler.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2003-2009 Kitware, Inc. +# Copyright 2003-2012 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -12,69 +12,75 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(CMakeTestCompilerCommon) +if(CMAKE_CXX_COMPILER_FORCED) + # The compiler configuration was forced by the user. + # Assume the user has configured all compiler information. + set(CMAKE_CXX_COMPILER_WORKS TRUE) + return() +endif() + +include(CMakeTestCompilerCommon) + +# Remove any cached result from an older CMake version. +# We now store this in CMakeCXXCompiler.cmake. +unset(CMAKE_CXX_COMPILER_WORKS CACHE) # This file is used by EnableLanguage in cmGlobalGenerator to # determine that that selected C++ compiler can actually compile # and link the most basic of programs. If not, a fatal error # is set and cmake stops processing commands and will not generate # any makefiles or projects. -IF(NOT CMAKE_CXX_COMPILER_WORKS) +if(NOT CMAKE_CXX_COMPILER_WORKS) PrintTestCompilerStatus("CXX" "") - FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx + file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx "#ifndef __cplusplus\n" "# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n" "#endif\n" "int main(){return 0;}\n") - TRY_COMPILE(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR} + try_compile(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx OUTPUT_VARIABLE __CMAKE_CXX_COMPILER_OUTPUT) - SET(CXX_TEST_WAS_RUN 1) -ENDIF(NOT CMAKE_CXX_COMPILER_WORKS) + # Move result from cache to normal variable. + set(CMAKE_CXX_COMPILER_WORKS ${CMAKE_CXX_COMPILER_WORKS}) + unset(CMAKE_CXX_COMPILER_WORKS CACHE) + set(CXX_TEST_WAS_RUN 1) +endif() -IF(NOT CMAKE_CXX_COMPILER_WORKS) +if(NOT CMAKE_CXX_COMPILER_WORKS) PrintTestCompilerStatus("CXX" " -- broken") - # if the compiler is broken make sure to remove the platform file - # since Windows-cl configures both c/cxx files both need to be removed - # when c or c++ fails - FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake ) - FILE(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake ) - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the CXX compiler works failed with " "the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n") - MESSAGE(FATAL_ERROR "The C++ compiler \"${CMAKE_CXX_COMPILER}\" " + message(FATAL_ERROR "The C++ compiler \"${CMAKE_CXX_COMPILER}\" " "is not able to compile a simple test program.\nIt fails " "with the following output:\n ${__CMAKE_CXX_COMPILER_OUTPUT}\n\n" "CMake will not be able to correctly generate this project.") -ELSE(NOT CMAKE_CXX_COMPILER_WORKS) - IF(CXX_TEST_WAS_RUN) +else() + if(CXX_TEST_WAS_RUN) PrintTestCompilerStatus("CXX" " -- works") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the CXX compiler works passed with " "the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n") - ENDIF(CXX_TEST_WAS_RUN) - SET(CMAKE_CXX_COMPILER_WORKS 1 CACHE INTERNAL "") + endif() + + # Try to identify the ABI and configure it into CMakeCXXCompiler.cmake + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) + CMAKE_DETERMINE_COMPILER_ABI(CXX ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp) + + # Re-configure to save learned information. + configure_file( + ${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake + @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 + ) + include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake) - IF(CMAKE_CXX_COMPILER_FORCED) - # The compiler configuration was forced by the user. - # Assume the user has configured all compiler information. - ELSE(CMAKE_CXX_COMPILER_FORCED) - # Try to identify the ABI and configure it into CMakeCXXCompiler.cmake - INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) - CMAKE_DETERMINE_COMPILER_ABI(CXX ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp) - CONFIGURE_FILE( - ${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake - @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 - ) - INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake) - ENDIF(CMAKE_CXX_COMPILER_FORCED) - IF(CMAKE_CXX_SIZEOF_DATA_PTR) - FOREACH(f ${CMAKE_CXX_ABI_FILES}) - INCLUDE(${f}) - ENDFOREACH() - UNSET(CMAKE_CXX_ABI_FILES) - ENDIF() -ENDIF(NOT CMAKE_CXX_COMPILER_WORKS) + if(CMAKE_CXX_SIZEOF_DATA_PTR) + foreach(f ${CMAKE_CXX_ABI_FILES}) + include(${f}) + endforeach() + unset(CMAKE_CXX_ABI_FILES) + endif() +endif() -UNSET(__CMAKE_CXX_COMPILER_OUTPUT) +unset(__CMAKE_CXX_COMPILER_OUTPUT) diff --git a/Modules/CMakeTestCompilerCommon.cmake b/Modules/CMakeTestCompilerCommon.cmake index fd8a105b2..d51b503a1 100644 --- a/Modules/CMakeTestCompilerCommon.cmake +++ b/Modules/CMakeTestCompilerCommon.cmake @@ -13,9 +13,9 @@ # License text for the above reference.) function(PrintTestCompilerStatus LANG MSG) - IF(CMAKE_GENERATOR MATCHES Make) - MESSAGE(STATUS "Check for working ${LANG} compiler: ${CMAKE_${LANG}_COMPILER}${MSG}") - ELSE() - MESSAGE(STATUS "Check for working ${LANG} compiler using: ${CMAKE_GENERATOR}${MSG}") - ENDIF() + if(CMAKE_GENERATOR MATCHES Make) + message(STATUS "Check for working ${LANG} compiler: ${CMAKE_${LANG}_COMPILER}${MSG}") + else() + message(STATUS "Check for working ${LANG} compiler using: ${CMAKE_GENERATOR}${MSG}") + endif() endfunction() diff --git a/Modules/CMakeTestForFreeVC.cxx b/Modules/CMakeTestForFreeVC.cxx deleted file mode 100644 index e580c1f6b..000000000 --- a/Modules/CMakeTestForFreeVC.cxx +++ /dev/null @@ -1,3 +0,0 @@ -#include - -int main(){return 0;} diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake index b4dcea634..e26334514 100644 --- a/Modules/CMakeTestFortranCompiler.cmake +++ b/Modules/CMakeTestFortranCompiler.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2004-2009 Kitware, Inc. +# Copyright 2004-2012 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -12,90 +12,100 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(CMakeTestCompilerCommon) +if(CMAKE_Fortran_COMPILER_FORCED) + # The compiler configuration was forced by the user. + # Assume the user has configured all compiler information. + set(CMAKE_Fortran_COMPILER_WORKS TRUE) + return() +endif() + +include(CMakeTestCompilerCommon) + +# Remove any cached result from an older CMake version. +# We now store this in CMakeFortranCompiler.cmake. +unset(CMAKE_Fortran_COMPILER_WORKS CACHE) # This file is used by EnableLanguage in cmGlobalGenerator to # determine that that selected Fortran compiler can actually compile # and link the most basic of programs. If not, a fatal error # is set and cmake stops processing commands and will not generate # any makefiles or projects. -IF(NOT CMAKE_Fortran_COMPILER_WORKS) +if(NOT CMAKE_Fortran_COMPILER_WORKS) PrintTestCompilerStatus("Fortran" "") - FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f " + file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f " PROGRAM TESTFortran PRINT *, 'Hello' END ") - TRY_COMPILE(CMAKE_Fortran_COMPILER_WORKS ${CMAKE_BINARY_DIR} + try_compile(CMAKE_Fortran_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f OUTPUT_VARIABLE OUTPUT) - SET(FORTRAN_TEST_WAS_RUN 1) -ENDIF(NOT CMAKE_Fortran_COMPILER_WORKS) + # Move result from cache to normal variable. + set(CMAKE_Fortran_COMPILER_WORKS ${CMAKE_Fortran_COMPILER_WORKS}) + unset(CMAKE_Fortran_COMPILER_WORKS CACHE) + set(FORTRAN_TEST_WAS_RUN 1) +endif() -IF(NOT CMAKE_Fortran_COMPILER_WORKS) +if(NOT CMAKE_Fortran_COMPILER_WORKS) PrintTestCompilerStatus("Fortran" " -- broken") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the Fortran compiler works failed with " "the following output:\n${OUTPUT}\n\n") - MESSAGE(FATAL_ERROR "The Fortran compiler \"${CMAKE_Fortran_COMPILER}\" " + message(FATAL_ERROR "The Fortran compiler \"${CMAKE_Fortran_COMPILER}\" " "is not able to compile a simple test program.\nIt fails " "with the following output:\n ${OUTPUT}\n\n" "CMake will not be able to correctly generate this project.") -ELSE(NOT CMAKE_Fortran_COMPILER_WORKS) - IF(FORTRAN_TEST_WAS_RUN) +else() + if(FORTRAN_TEST_WAS_RUN) PrintTestCompilerStatus("Fortran" " -- works") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the Fortran compiler works passed with " "the following output:\n${OUTPUT}\n\n") - ENDIF(FORTRAN_TEST_WAS_RUN) - SET(CMAKE_Fortran_COMPILER_WORKS 1 CACHE INTERNAL "") + endif() - IF(CMAKE_Fortran_COMPILER_FORCED) - # The compiler configuration was forced by the user. - # Assume the user has configured all compiler information. - ELSE(CMAKE_Fortran_COMPILER_FORCED) - # Try to identify the ABI and configure it into CMakeFortranCompiler.cmake - INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) - CMAKE_DETERMINE_COMPILER_ABI(Fortran ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F) + # Try to identify the ABI and configure it into CMakeFortranCompiler.cmake + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) + CMAKE_DETERMINE_COMPILER_ABI(Fortran ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F) - # Test for Fortran 90 support by using an f90-specific construct. - IF(NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90) - MESSAGE(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90") - FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 " + # Test for Fortran 90 support by using an f90-specific construct. + if(NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90) + message(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90") + file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 " PROGRAM TESTFortran90 stop = 1 ; do while ( stop .eq. 0 ) ; end do END PROGRAM TESTFortran90 ") - TRY_COMPILE(CMAKE_Fortran_COMPILER_SUPPORTS_F90 ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 - OUTPUT_VARIABLE OUTPUT) - IF(CMAKE_Fortran_COMPILER_SUPPORTS_F90) - MESSAGE(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90 -- yes") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Fortran compiler supports Fortran 90 passed with " - "the following output:\n${OUTPUT}\n\n") - SET(CMAKE_Fortran_COMPILER_SUPPORTS_F90 1) - ELSE(CMAKE_Fortran_COMPILER_SUPPORTS_F90) - MESSAGE(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90 -- no") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the Fortran compiler supports Fortran 90 failed with " - "the following output:\n${OUTPUT}\n\n") - SET(CMAKE_Fortran_COMPILER_SUPPORTS_F90 0) - ENDIF(CMAKE_Fortran_COMPILER_SUPPORTS_F90) - UNSET(CMAKE_Fortran_COMPILER_SUPPORTS_F90 CACHE) - ENDIF(NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90) + try_compile(CMAKE_Fortran_COMPILER_SUPPORTS_F90 ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 + OUTPUT_VARIABLE OUTPUT) + if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + message(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90 -- yes") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the Fortran compiler supports Fortran 90 passed with " + "the following output:\n${OUTPUT}\n\n") + set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 1) + else() + message(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90 -- no") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Fortran compiler supports Fortran 90 failed with " + "the following output:\n${OUTPUT}\n\n") + set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 0) + endif() + unset(CMAKE_Fortran_COMPILER_SUPPORTS_F90 CACHE) + endif() + + # Re-configure to save learned information. + configure_file( + ${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake + @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 + ) + include(${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake) - CONFIGURE_FILE( - ${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake - @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 - ) - INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake) - ENDIF(CMAKE_Fortran_COMPILER_FORCED) - IF(CMAKE_Fortran_SIZEOF_DATA_PTR) - FOREACH(f ${CMAKE_Fortran_ABI_FILES}) - INCLUDE(${f}) - ENDFOREACH() - UNSET(CMAKE_Fortran_ABI_FILES) - ENDIF() -ENDIF(NOT CMAKE_Fortran_COMPILER_WORKS) + if(CMAKE_Fortran_SIZEOF_DATA_PTR) + foreach(f ${CMAKE_Fortran_ABI_FILES}) + include(${f}) + endforeach() + unset(CMAKE_Fortran_ABI_FILES) + endif() +endif() diff --git a/Modules/CMakeTestJavaCompiler.cmake b/Modules/CMakeTestJavaCompiler.cmake index cfd3e24b6..d763412bf 100644 --- a/Modules/CMakeTestJavaCompiler.cmake +++ b/Modules/CMakeTestJavaCompiler.cmake @@ -17,4 +17,4 @@ # and link the most basic of programs. If not, a fatal error # is set and cmake stops processing commands and will not generate # any makefiles or projects. -SET(CMAKE_Java_COMPILER_WORKS 1 CACHE INTERNAL "") +set(CMAKE_Java_COMPILER_WORKS 1 CACHE INTERNAL "") diff --git a/Modules/CMakeTestNMakeCLVersion.c b/Modules/CMakeTestNMakeCLVersion.c deleted file mode 100644 index 3cece2a63..000000000 --- a/Modules/CMakeTestNMakeCLVersion.c +++ /dev/null @@ -1,2 +0,0 @@ -VERSION=_MSC_VER - diff --git a/Modules/CMakeTestRCCompiler.cmake b/Modules/CMakeTestRCCompiler.cmake index a5c8d1149..7969da1de 100644 --- a/Modules/CMakeTestRCCompiler.cmake +++ b/Modules/CMakeTestRCCompiler.cmake @@ -20,4 +20,4 @@ # For now there is no way to do a try compile on just a .rc file # so just do nothing in here. -SET(CMAKE_RC_COMPILER_WORKS 1 CACHE INTERNAL "") +set(CMAKE_RC_COMPILER_WORKS 1 CACHE INTERNAL "") diff --git a/Modules/CMakeUnixFindMake.cmake b/Modules/CMakeUnixFindMake.cmake index 39962c0d3..c75cf7cbc 100644 --- a/Modules/CMakeUnixFindMake.cmake +++ b/Modules/CMakeUnixFindMake.cmake @@ -12,5 +12,5 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES gmake make smake) -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) +find_program(CMAKE_MAKE_PROGRAM NAMES gmake make smake) +mark_as_advanced(CMAKE_MAKE_PROGRAM) diff --git a/Modules/CMakeVS10FindMake.cmake b/Modules/CMakeVS10FindMake.cmake index 695e92f52..189b62698 100644 --- a/Modules/CMakeVS10FindMake.cmake +++ b/Modules/CMakeVS10FindMake.cmake @@ -15,7 +15,7 @@ # Look for devenv as a build program. We need to use this to support # Intel Fortran integration into VS. MSBuild can not be used for that case # since Intel Fortran uses the older devenv file format. -FIND_PROGRAM(CMAKE_MAKE_PROGRAM +find_program(CMAKE_MAKE_PROGRAM NAMES devenv HINTS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;EnvironmentDirectory] @@ -39,16 +39,16 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM # causes the compiler checks and try-compile stuff to fail. MSbuild # is a better choice for this. However, VCExpress does not support # cross compiling needed for Win CE. -IF(NOT CMAKE_CROSSCOMPILING) - FIND_PROGRAM(CMAKE_MAKE_PROGRAM +if(NOT CMAKE_CROSSCOMPILING) + find_program(CMAKE_MAKE_PROGRAM NAMES MSBuild HINTS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;ProductDir] "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/" "c:/WINDOWS/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/" "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0;CLR Version]/") -ENDIF() +endif() -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) -SET(MSVC10 1) -SET(MSVC_VERSION 1600) +mark_as_advanced(CMAKE_MAKE_PROGRAM) +set(MSVC10 1) +set(MSVC_VERSION 1600) diff --git a/Modules/CMakeVS11FindMake.cmake b/Modules/CMakeVS11FindMake.cmake index 302efaa59..2df015d40 100644 --- a/Modules/CMakeVS11FindMake.cmake +++ b/Modules/CMakeVS11FindMake.cmake @@ -15,7 +15,7 @@ # Look for devenv as a build program. We need to use this to support # Intel Fortran integration into VS. MSBuild can not be used for that case # since Intel Fortran uses the older devenv file format. -FIND_PROGRAM(CMAKE_MAKE_PROGRAM +find_program(CMAKE_MAKE_PROGRAM NAMES devenv HINTS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;EnvironmentDirectory] @@ -34,21 +34,20 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM # if devenv is not found, then use MSBuild. # it is expected that if devenv is not found, then we are -# dealing with Visual Studio Express. VCExpress has random -# failures when being run as a command line build tool which -# causes the compiler checks and try-compile stuff to fail. MSbuild -# is a better choice for this. However, VCExpress does not support -# cross compiling needed for Win CE. -IF(NOT CMAKE_CROSSCOMPILING) - FIND_PROGRAM(CMAKE_MAKE_PROGRAM +# dealing with Visual Studio Express. +if(NOT CMAKE_CROSSCOMPILING) + set(_FDIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkDir32]") + set(_FVER "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkVer32]") + find_program(CMAKE_MAKE_PROGRAM NAMES MSBuild HINTS + ${_FDIR}/${_FVER} [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;ProductDir] "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;CLR Version]/" "c:/WINDOWS/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;CLR Version]/" "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0;CLR Version]/") -ENDIF() +endif() -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) -SET(MSVC11 1) -SET(MSVC_VERSION 1700) +mark_as_advanced(CMAKE_MAKE_PROGRAM) +set(MSVC11 1) +set(MSVC_VERSION 1700) diff --git a/Modules/CMakeVS6BackwardCompatibility.cmake b/Modules/CMakeVS6BackwardCompatibility.cmake index 438f64f6c..ca48b8587 100644 --- a/Modules/CMakeVS6BackwardCompatibility.cmake +++ b/Modules/CMakeVS6BackwardCompatibility.cmake @@ -13,14 +13,14 @@ # License text for the above reference.) # hard code these for fast backwards compatibility tests -SET (CMAKE_SIZEOF_INT 4 CACHE INTERNAL "Size of int data type") -SET (CMAKE_SIZEOF_LONG 4 CACHE INTERNAL "Size of long data type") -SET (CMAKE_SIZEOF_VOID_P 4 CACHE INTERNAL "Size of void* data type") -SET (CMAKE_SIZEOF_CHAR 1 CACHE INTERNAL "Size of char data type") -SET (CMAKE_SIZEOF_SHORT 2 CACHE INTERNAL "Size of short data type") -SET (CMAKE_SIZEOF_FLOAT 4 CACHE INTERNAL "Size of float data type") -SET (CMAKE_SIZEOF_DOUBLE 8 CACHE INTERNAL "Size of double data type") -SET (CMAKE_NO_ANSI_FOR_SCOPE 1 CACHE INTERNAL +set (CMAKE_SIZEOF_INT 4 CACHE INTERNAL "Size of int data type") +set (CMAKE_SIZEOF_LONG 4 CACHE INTERNAL "Size of long data type") +set (CMAKE_SIZEOF_VOID_P 4 CACHE INTERNAL "Size of void* data type") +set (CMAKE_SIZEOF_CHAR 1 CACHE INTERNAL "Size of char data type") +set (CMAKE_SIZEOF_SHORT 2 CACHE INTERNAL "Size of short data type") +set (CMAKE_SIZEOF_FLOAT 4 CACHE INTERNAL "Size of float data type") +set (CMAKE_SIZEOF_DOUBLE 8 CACHE INTERNAL "Size of double data type") +set (CMAKE_NO_ANSI_FOR_SCOPE 1 CACHE INTERNAL "Does the compiler support ansi for scope.") -SET (CMAKE_USE_WIN32_THREADS TRUE CACHE BOOL "Use the win32 thread library.") -SET (CMAKE_WORDS_BIGENDIAN 0 CACHE INTERNAL "endianness of bytes") +set (CMAKE_USE_WIN32_THREADS TRUE CACHE BOOL "Use the win32 thread library.") +set (CMAKE_WORDS_BIGENDIAN 0 CACHE INTERNAL "endianness of bytes") diff --git a/Modules/CMakeVS6FindMake.cmake b/Modules/CMakeVS6FindMake.cmake index dccf8c462..40bf5b172 100644 --- a/Modules/CMakeVS6FindMake.cmake +++ b/Modules/CMakeVS6FindMake.cmake @@ -12,7 +12,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(CMAKE_MAKE_PROGRAM +find_program(CMAKE_MAKE_PROGRAM NAMES msdev PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\6.0\\Setup;VsCommonDir]/MSDev98/Bin @@ -20,6 +20,6 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM "c:/Program Files/Microsoft Visual Studio/Common/MSDev98/Bin" "/Program Files/Microsoft Visual Studio/Common/MSDev98/Bin" ) -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) -SET(MSVC60 1) -SET(MSVC_VERSION 1200) +mark_as_advanced(CMAKE_MAKE_PROGRAM) +set(MSVC60 1) +set(MSVC_VERSION 1200) diff --git a/Modules/CMakeVS71FindMake.cmake b/Modules/CMakeVS71FindMake.cmake index 2381adb55..945c3faf8 100644 --- a/Modules/CMakeVS71FindMake.cmake +++ b/Modules/CMakeVS71FindMake.cmake @@ -12,7 +12,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(CMAKE_MAKE_PROGRAM +find_program(CMAKE_MAKE_PROGRAM NAMES devenv PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VS;EnvironmentDirectory] @@ -21,6 +21,6 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM "c:/Program Files/Microsoft Visual Studio.NET/Common7/IDE" "/Program Files/Microsoft Visual Studio .NET/Common7/IDE/" ) -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) -SET(MSVC71 1) -SET(MSVC_VERSION 1310) +mark_as_advanced(CMAKE_MAKE_PROGRAM) +set(MSVC71 1) +set(MSVC_VERSION 1310) diff --git a/Modules/CMakeVS7BackwardCompatibility.cmake b/Modules/CMakeVS7BackwardCompatibility.cmake index df0b3bb97..e9622eecf 100644 --- a/Modules/CMakeVS7BackwardCompatibility.cmake +++ b/Modules/CMakeVS7BackwardCompatibility.cmake @@ -13,14 +13,14 @@ # License text for the above reference.) # hard code these for fast backwards compatibility tests -SET (CMAKE_SIZEOF_INT 4 CACHE INTERNAL "Size of int data type") -SET (CMAKE_SIZEOF_LONG 4 CACHE INTERNAL "Size of long data type") -SET (CMAKE_SIZEOF_VOID_P 4 CACHE INTERNAL "Size of void* data type") -SET (CMAKE_SIZEOF_CHAR 1 CACHE INTERNAL "Size of char data type") -SET (CMAKE_SIZEOF_SHORT 2 CACHE INTERNAL "Size of short data type") -SET (CMAKE_SIZEOF_FLOAT 4 CACHE INTERNAL "Size of float data type") -SET (CMAKE_SIZEOF_DOUBLE 8 CACHE INTERNAL "Size of double data type") -SET (CMAKE_NO_ANSI_FOR_SCOPE 0 CACHE INTERNAL +set (CMAKE_SIZEOF_INT 4 CACHE INTERNAL "Size of int data type") +set (CMAKE_SIZEOF_LONG 4 CACHE INTERNAL "Size of long data type") +set (CMAKE_SIZEOF_VOID_P 4 CACHE INTERNAL "Size of void* data type") +set (CMAKE_SIZEOF_CHAR 1 CACHE INTERNAL "Size of char data type") +set (CMAKE_SIZEOF_SHORT 2 CACHE INTERNAL "Size of short data type") +set (CMAKE_SIZEOF_FLOAT 4 CACHE INTERNAL "Size of float data type") +set (CMAKE_SIZEOF_DOUBLE 8 CACHE INTERNAL "Size of double data type") +set (CMAKE_NO_ANSI_FOR_SCOPE 0 CACHE INTERNAL "Does the compiler support ansi for scope.") -SET (CMAKE_USE_WIN32_THREADS TRUE CACHE BOOL "Use the win32 thread library.") -SET (CMAKE_WORDS_BIGENDIAN 0 CACHE INTERNAL "endianness of bytes") +set (CMAKE_USE_WIN32_THREADS TRUE CACHE BOOL "Use the win32 thread library.") +set (CMAKE_WORDS_BIGENDIAN 0 CACHE INTERNAL "endianness of bytes") diff --git a/Modules/CMakeVS7FindMake.cmake b/Modules/CMakeVS7FindMake.cmake index 665158c88..218c5f2df 100644 --- a/Modules/CMakeVS7FindMake.cmake +++ b/Modules/CMakeVS7FindMake.cmake @@ -12,7 +12,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(CMAKE_MAKE_PROGRAM +find_program(CMAKE_MAKE_PROGRAM NAMES devenv PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.0\\Setup\\VS;EnvironmentDirectory] @@ -20,6 +20,6 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM "c:/Program Files/Microsoft Visual Studio.NET/Common7/IDE" "/Program Files/Microsoft Visual Studio .NET/Common7/IDE/" ) -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) -SET(MSVC70 1) -SET(MSVC_VERSION 1300) +mark_as_advanced(CMAKE_MAKE_PROGRAM) +set(MSVC70 1) +set(MSVC_VERSION 1300) diff --git a/Modules/CMakeVS8FindMake.cmake b/Modules/CMakeVS8FindMake.cmake index bb0818014..31df0268d 100644 --- a/Modules/CMakeVS8FindMake.cmake +++ b/Modules/CMakeVS8FindMake.cmake @@ -13,12 +13,12 @@ # License text for the above reference.) # VCExpress does not support cross compiling, which is necessary for Win CE -SET( _CMAKE_MAKE_PROGRAM_NAMES devenv) -IF(NOT CMAKE_CROSSCOMPILING) - SET( _CMAKE_MAKE_PROGRAM_NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} VCExpress) -ENDIF(NOT CMAKE_CROSSCOMPILING) +set( _CMAKE_MAKE_PROGRAM_NAMES devenv) +if(NOT CMAKE_CROSSCOMPILING) + set( _CMAKE_MAKE_PROGRAM_NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} VCExpress) +endif() -FIND_PROGRAM(CMAKE_MAKE_PROGRAM +find_program(CMAKE_MAKE_PROGRAM NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} HINTS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VS;EnvironmentDirectory] @@ -29,6 +29,6 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio8/Common7/IDE" "/Program Files/Microsoft Visual Studio 8/Common7/IDE/" ) -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) -SET(MSVC80 1) -SET(MSVC_VERSION 1400) +mark_as_advanced(CMAKE_MAKE_PROGRAM) +set(MSVC80 1) +set(MSVC_VERSION 1400) diff --git a/Modules/CMakeVS9FindMake.cmake b/Modules/CMakeVS9FindMake.cmake index 9e3c39ef3..35e9f981a 100644 --- a/Modules/CMakeVS9FindMake.cmake +++ b/Modules/CMakeVS9FindMake.cmake @@ -13,12 +13,12 @@ # License text for the above reference.) # VCExpress does not support cross compiling, which is necessary for Win CE -SET( _CMAKE_MAKE_PROGRAM_NAMES devenv) -IF(NOT CMAKE_CROSSCOMPILING) - SET( _CMAKE_MAKE_PROGRAM_NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} VCExpress) -ENDIF(NOT CMAKE_CROSSCOMPILING) +set( _CMAKE_MAKE_PROGRAM_NAMES devenv) +if(NOT CMAKE_CROSSCOMPILING) + set( _CMAKE_MAKE_PROGRAM_NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} VCExpress) +endif() -FIND_PROGRAM(CMAKE_MAKE_PROGRAM +find_program(CMAKE_MAKE_PROGRAM NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} HINTS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VS;EnvironmentDirectory] @@ -34,6 +34,6 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM "/Program Files/Microsoft Visual Studio 9.0/Common7/IDE/" "/Program Files/Microsoft Visual Studio 9/Common7/IDE/" ) -MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) -SET(MSVC90 1) -SET(MSVC_VERSION 1500) +mark_as_advanced(CMAKE_MAKE_PROGRAM) +set(MSVC90 1) +set(MSVC_VERSION 1500) diff --git a/Modules/CMakeVerifyManifest.cmake b/Modules/CMakeVerifyManifest.cmake index 75783691f..aebe77ea1 100644 --- a/Modules/CMakeVerifyManifest.cmake +++ b/Modules/CMakeVerifyManifest.cmake @@ -4,7 +4,7 @@ # side by side manifests for a project match. To run this # script, cd to a directory and run the script with cmake -P. # On the command line you can pass in versions that are OK even -# if not found in the .manifest files. For example, +# if not found in the .manifest files. For example, # cmake -Dallow_versions=8.0.50608.0 -PCmakeVerifyManifest.cmake # could be used to allow an embeded manifest of 8.0.50608.0 # to be used in a project even if that version was not found @@ -40,14 +40,14 @@ function(crt_version file list_var) foreach(s ${strings}) set(has_match 1) string(REGEX - REPLACE ".*.*$" "\\1" + REPLACE ".*.*$" "\\1" version "${s}") if(NOT "${version}" STREQUAL "") list(APPEND version_list ${version}) else() message(FATAL_ERROR "Parse error could not find version in [${s}]") endif() - endforeach(s) + endforeach() if(NOT DEFINED has_match) message("Information: no embeded manifest in: ${file}") return() @@ -57,25 +57,25 @@ function(crt_version file list_var) if(version_list) set(${list_var} ${version_list} PARENT_SCOPE) endif() -endfunction(crt_version) +endfunction() set(fatal_error FALSE) # check_version: -# +# # test a file against the shipped manifest versions # for a directory function(check_version file manifest_versions) set(manifest_versions ${manifest_versions} ${allow_versions}) # collect versions for a given file crt_version(${file} file_versions) - # see if the versions + # see if the versions foreach(ver ${file_versions}) list(FIND manifest_versions "${ver}" found_version) if("${found_version}" EQUAL -1) message("ERROR: ${file} uses ${ver} not found in shipped manifests:[${manifest_versions}].") set(fatal_error TRUE PARENT_SCOPE) endif() - endforeach(ver) + endforeach() list(LENGTH file_versions len) if(${len} GREATER 1) message("WARNING: found more than one version of MICROSOFT.VC80.CRT referenced in ${file}: [${file_versions}]") @@ -88,7 +88,7 @@ set(manifest_version_list ) file(GLOB_RECURSE manifest_files "*.manifest") foreach(f ${manifest_files}) crt_version("${f}" manifest_version_list) -endforeach(f) +endforeach() list(LENGTH manifest_version_list LEN) if(LEN EQUAL 0) message(FATAL_ERROR "No .manifest files found, no version check can be done.") diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 657595731..42d3c0c39 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -187,7 +187,7 @@ # in CMake, so this change is compatible). ##end # -# The following CPack variables are specific to source packages, and +# The following CPack variables are specific to source packages, and # will not affect binary packages: # ##variable @@ -285,48 +285,48 @@ # License text for the above reference.) # Define this var in order to avoid (or warn) concerning multiple inclusion -IF(CPack_CMake_INCLUDED) - MESSAGE(WARNING "CPack.cmake has already been included!!") -ELSE(CPack_CMake_INCLUDED) - SET(CPack_CMake_INCLUDED 1) -ENDIF(CPack_CMake_INCLUDED) +if(CPack_CMake_INCLUDED) + message(WARNING "CPack.cmake has already been included!!") +else() + set(CPack_CMake_INCLUDED 1) +endif() # Pick a configuration file -SET(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in") -IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in") - SET(cpack_input_file "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in") -ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in") -SET(cpack_source_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in") -IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in") - SET(cpack_source_input_file "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in") -ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in") +set(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in") +if(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in") + set(cpack_input_file "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in") +endif() +set(cpack_source_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in") +if(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in") + set(cpack_source_input_file "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in") +endif() # Backward compatibility # Include CPackComponent macros if it has not already been included before. include(CPackComponent) # Macro for setting values if a user did not overwrite them -MACRO(cpack_set_if_not_set name value) - IF(NOT DEFINED "${name}") - SET(${name} "${value}") - ENDIF(NOT DEFINED "${name}") -ENDMACRO(cpack_set_if_not_set) +macro(cpack_set_if_not_set name value) + if(NOT DEFINED "${name}") + set(${name} "${value}") + endif() +endmacro() # cpack_encode_variables - Macro to encode variables for the configuration file # find any variable that starts with CPACK and create a variable # _CPACK_OTHER_VARIABLES_ that contains SET commands for # each cpack variable. _CPACK_OTHER_VARIABLES_ is then # used as an @ replacment in configure_file for the CPackConfig. -MACRO(cpack_encode_variables) - SET(_CPACK_OTHER_VARIABLES_) - GET_CMAKE_PROPERTY(res VARIABLES) - FOREACH(var ${res}) - IF("xxx${var}" MATCHES "xxxCPACK") - SET(_CPACK_OTHER_VARIABLES_ +macro(cpack_encode_variables) + set(_CPACK_OTHER_VARIABLES_) + get_cmake_property(res VARIABLES) + foreach(var ${res}) + if("xxx${var}" MATCHES "xxxCPACK") + set(_CPACK_OTHER_VARIABLES_ "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")") - ENDIF("xxx${var}" MATCHES "xxxCPACK") - ENDFOREACH(var ${res}) -ENDMACRO(cpack_encode_variables) + endif() + endforeach() +endmacro() # Set the package name cpack_set_if_not_set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}") @@ -350,22 +350,22 @@ cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME cpack_set_if_not_set(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}") -IF(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL) - SET(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) -ENDIF(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL) - -IF(CPACK_NSIS_MODIFY_PATH) - SET(CPACK_NSIS_MODIFY_PATH ON) -ENDIF(CPACK_NSIS_MODIFY_PATH) - -SET(__cpack_system_name ${CMAKE_SYSTEM_NAME}) -IF(${__cpack_system_name} MATCHES Windows) - IF(CMAKE_CL_64) - SET(__cpack_system_name win64) - ELSE(CMAKE_CL_64) - SET(__cpack_system_name win32) - ENDIF(CMAKE_CL_64) -ENDIF(${__cpack_system_name} MATCHES Windows) +if(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL) + set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) +endif() + +if(CPACK_NSIS_MODIFY_PATH) + set(CPACK_NSIS_MODIFY_PATH ON) +endif() + +set(__cpack_system_name ${CMAKE_SYSTEM_NAME}) +if(${__cpack_system_name} MATCHES Windows) + if(CMAKE_CL_64) + set(__cpack_system_name win64) + else() + set(__cpack_system_name win32) + endif() +endif() cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}") # Root dir: default value should be the string literal "$PROGRAMFILES" @@ -386,15 +386,15 @@ cpack_set_if_not_set(CPACK_PACKAGE_RELOCATABLE "true") # always force to exactly "true" or "false" for CPack.Info.plist.in: if(CPACK_PACKAGE_RELOCATABLE) set(CPACK_PACKAGE_RELOCATABLE "true") -else(CPACK_PACKAGE_RELOCATABLE) +else() set(CPACK_PACKAGE_RELOCATABLE "false") -endif(CPACK_PACKAGE_RELOCATABLE) +endif() macro(cpack_check_file_exists file description) if(NOT EXISTS "${file}") message(SEND_ERROR "CPack ${description} file: \"${file}\" could not be found.") - endif(NOT EXISTS "${file}") -endmacro(cpack_check_file_exists) + endif() +endmacro() cpack_check_file_exists("${CPACK_PACKAGE_DESCRIPTION_FILE}" "package description") cpack_check_file_exists("${CPACK_RESOURCE_FILE_LICENSE}" "license resource") @@ -404,8 +404,8 @@ cpack_check_file_exists("${CPACK_RESOURCE_FILE_WELCOME}" "welcome resource") macro(cpack_optional_append _list _cond _item) if(${_cond}) set(${_list} ${${_list}} ${_item}) - endif(${_cond}) -endmacro(cpack_optional_append _list _cond _item) + endif() +endmacro() ##variable # CPACK_BINARY_ - CPack generated options for binary generators. The @@ -420,27 +420,28 @@ if(NOT CPACK_GENERATOR) if(UNIX) if(CYGWIN) option(CPACK_BINARY_CYGWIN "Enable to build Cygwin binary packages" ON) - else(CYGWIN) + else() if(APPLE) option(CPACK_BINARY_BUNDLE "Enable to build OSX bundles" OFF) option(CPACK_BINARY_DRAGNDROP "Enable to build OSX Drag And Drop package" OFF) option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" ON) option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages" OFF) - else(APPLE) + else() option(CPACK_BINARY_TZ "Enable to build TZ packages" ON) - endif(APPLE) + endif() option(CPACK_BINARY_STGZ "Enable to build STGZ packages" ON) option(CPACK_BINARY_TGZ "Enable to build TGZ packages" ON) option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages" OFF) option(CPACK_BINARY_DEB "Enable to build Debian packages" OFF) option(CPACK_BINARY_RPM "Enable to build RPM packages" OFF) option(CPACK_BINARY_NSIS "Enable to build NSIS packages" OFF) - endif(CYGWIN) - else(UNIX) + endif() + else() option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON) + option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF) option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF) - endif(UNIX) - + endif() + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_BUNDLE Bundle) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DRAGNDROP DragNDrop) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker) @@ -453,38 +454,39 @@ if(NOT CPACK_GENERATOR) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TGZ TGZ) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_WIX WIX) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP) - -endif(NOT CPACK_GENERATOR) + +endif() # Provide options to choose source generators if(NOT CPACK_SOURCE_GENERATOR) if(UNIX) if(CYGWIN) option(CPACK_SOURCE_CYGWIN "Enable to build Cygwin source packages" ON) - else(CYGWIN) + else() option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON) option(CPACK_SOURCE_TGZ "Enable to build TGZ source packages" ON) option(CPACK_SOURCE_TZ "Enable to build TZ source packages" ON) option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" OFF) - endif(CYGWIN) - else(UNIX) + endif() + else() option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON) - endif(UNIX) + endif() cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_CYGWIN CygwinSource) cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TGZ TGZ) cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TBZ2 TBZ2) cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TZ TZ) cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_ZIP ZIP) -endif(NOT CPACK_SOURCE_GENERATOR) +endif() # mark the above options as advanced mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11 - CPACK_BINARY_STGZ CPACK_BINARY_TGZ CPACK_BINARY_TBZ2 - CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ - CPACK_BINARY_NSIS CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE - CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ + CPACK_BINARY_STGZ CPACK_BINARY_TGZ CPACK_BINARY_TBZ2 + CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ + CPACK_BINARY_NSIS CPACK_BINARY_WIX CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE + CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP) # Set some other variables @@ -494,16 +496,16 @@ cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}") # if the user has set CPACK_NSIS_DISPLAY_NAME remember it if(DEFINED CPACK_NSIS_DISPLAY_NAME) - SET(CPACK_NSIS_DISPLAY_NAME_SET TRUE) + set(CPACK_NSIS_DISPLAY_NAME_SET TRUE) endif() # if the user has set CPACK_NSIS_DISPLAY # explicitly, then use that as the default # value of CPACK_NSIS_PACKAGE_NAME instead -# of CPACK_PACKAGE_INSTALL_DIRECTORY +# of CPACK_PACKAGE_INSTALL_DIRECTORY cpack_set_if_not_set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}") if(CPACK_NSIS_DISPLAY_NAME_SET) - string(REPLACE "\\" "\\\\" + string(REPLACE "\\" "\\\\" _NSIS_DISPLAY_NAME_TMP "${CPACK_NSIS_DISPLAY_NAME}") cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${_NSIS_DISPLAY_NAME_TMP}") else() @@ -522,31 +524,34 @@ cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "") cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "") -IF(DEFINED CPACK_COMPONENTS_ALL) - IF(CPACK_MONOLITHIC_INSTALL) - MESSAGE("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.") - SET(CPACK_COMPONENTS_ALL) - ELSE(CPACK_MONOLITHIC_INSTALL) +# WiX specific variables +cpack_set_if_not_set(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}") + +if(DEFINED CPACK_COMPONENTS_ALL) + if(CPACK_MONOLITHIC_INSTALL) + message("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.") + set(CPACK_COMPONENTS_ALL) + else() # The user has provided the set of components to be installed as # part of a component-based installation; trust her. - SET(CPACK_COMPONENTS_ALL_SET_BY_USER TRUE) - ENDIF(CPACK_MONOLITHIC_INSTALL) -ELSE(DEFINED CPACK_COMPONENTS_ALL) + set(CPACK_COMPONENTS_ALL_SET_BY_USER TRUE) + endif() +else() # If the user has not specifically requested a monolithic installer # but has specified components in various "install" commands, tell # CPack about those components. - IF(NOT CPACK_MONOLITHIC_INSTALL) - GET_CMAKE_PROPERTY(CPACK_COMPONENTS_ALL COMPONENTS) - LIST(LENGTH CPACK_COMPONENTS_ALL CPACK_COMPONENTS_LEN) - IF(CPACK_COMPONENTS_LEN EQUAL 1) + if(NOT CPACK_MONOLITHIC_INSTALL) + get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) + list(LENGTH CPACK_COMPONENTS_ALL CPACK_COMPONENTS_LEN) + if(CPACK_COMPONENTS_LEN EQUAL 1) # Only one component: this is not a component-based installation # (at least, it isn't a component-based installation, but may # become one later if the user uses the cpack_add_* commands). - SET(CPACK_COMPONENTS_ALL) - ENDIF(CPACK_COMPONENTS_LEN EQUAL 1) - SET(CPACK_COMPONENTS_LEN) - ENDIF(NOT CPACK_MONOLITHIC_INSTALL) -ENDIF(DEFINED CPACK_COMPONENTS_ALL) + set(CPACK_COMPONENTS_ALL) + endif() + set(CPACK_COMPONENTS_LEN) + endif() +endif() # CMake always generates a component named "Unspecified", which is # used to install everything that doesn't have an explicitly-provided @@ -566,13 +571,13 @@ cpack_set_if_not_set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source") cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES "/CVS/;/\\\\\\\\.svn/;/\\\\\\\\.bzr/;/\\\\\\\\.hg/;/\\\\\\\\.git/;\\\\\\\\.swp$;\\\\\\\\.#;/#") -SET(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}") -SET(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}") -SET(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}") -SET(CPACK_TOPLEVEL_TAG "${CPACK_SOURCE_TOPLEVEL_TAG}") -SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}") -SET(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}") -SET(CPACK_STRIP_FILES "${CPACK_SOURCE_STRIP_FILES}") +set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}") +set(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}") +set(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}") +set(CPACK_TOPLEVEL_TAG "${CPACK_SOURCE_TOPLEVEL_TAG}") +set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}") +set(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}") +set(CPACK_STRIP_FILES "${CPACK_SOURCE_STRIP_FILES}") cpack_encode_variables() configure_file("${cpack_source_input_file}" diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 15987030e..c85cfb454 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -28,31 +28,31 @@ ##variable # CPACK_COMPONENTS_ALL - The list of component to install. # -# The default value of this variable is computed by CPack -# and contains all components defined by the project. The -# user may set it to only include the specified components. +#The default value of this variable is computed by CPack +#and contains all components defined by the project. The +#user may set it to only include the specified components. ##end # ##variable # CPACK__COMPONENT_INSTALL - Enable/Disable component install for # CPack generator . # -# Each CPack Generator (RPM, DEB, ARCHIVE, NSIS, DMG, etc...) has a legacy -# default behavior. e.g. RPM builds monolithic whereas NSIS builds component. -# One can change the default behavior by setting this variable to 0/1 or OFF/ON. +#Each CPack Generator (RPM, DEB, ARCHIVE, NSIS, DMG, etc...) has a legacy +#default behavior. e.g. RPM builds monolithic whereas NSIS builds component. +#One can change the default behavior by setting this variable to 0/1 or OFF/ON. ##end ##variable # CPACK_COMPONENTS_GROUPING - Specify how components are grouped for multi-package # component-aware CPack generators. # -# Some generators like RPM or ARCHIVE family (TGZ, ZIP, ...) generates several -# packages files when asked for component packaging. They group the component -# differently depending on the value of this variable: -# - ONE_PER_GROUP (default): creates one package file per component group -# - ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) component -# - IGNORE : creates one package per component, i.e. IGNORE component group -# One can specify different grouping for different CPack generator by using -# a CPACK_PROJECT_CONFIG_FILE. +#Some generators like RPM or ARCHIVE family (TGZ, ZIP, ...) generates several +#packages files when asked for component packaging. They group the component +#differently depending on the value of this variable: +# - ONE_PER_GROUP (default): creates one package file per component group +# - ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) component +# - IGNORE : creates one package per component, i.e. IGNORE component group +#One can specify different grouping for different CPack generator by using +#a CPACK_PROJECT_CONFIG_FILE. ##end ##variable # CPACK_COMPONENT__DISPLAY_NAME - The name to be displayed for a component. @@ -71,194 +71,194 @@ # CPACK_COMPONENT__REQUIRED - True is this component is required. ##end ##macro -# cpack_add_component - Describes a CPack installation component -# named by the COMPONENT argument to a CMake INSTALL command. -# -# cpack_add_component(compname -# [DISPLAY_NAME name] -# [DESCRIPTION description] -# [HIDDEN | REQUIRED | DISABLED ] -# [GROUP group] -# [DEPENDS comp1 comp2 ... ] -# [INSTALL_TYPES type1 type2 ... ] -# [DOWNLOADED] -# [ARCHIVE_FILE filename]) -# -# The cmake_add_component command describes an installation -# component, which the user can opt to install or remove as part of -# the graphical installation process. compname is the name of the -# component, as provided to the COMPONENT argument of one or more -# CMake INSTALL commands. -# -# DISPLAY_NAME is the displayed name of the component, used in -# graphical installers to display the component name. This value can -# be any string. -# -# DESCRIPTION is an extended description of the component, used in -# graphical installers to give the user additional information about -# the component. Descriptions can span multiple lines using "\n" as -# the line separator. Typically, these descriptions should be no -# more than a few lines long. -# -# HIDDEN indicates that this component will be hidden in the -# graphical installer, so that the user cannot directly change -# whether it is installed or not. -# -# REQUIRED indicates that this component is required, and therefore -# will always be installed. It will be visible in the graphical -# installer, but it cannot be unselected. (Typically, required -# components are shown greyed out). -# -# DISABLED indicates that this component should be disabled -# (unselected) by default. The user is free to select this component -# for installation, unless it is also HIDDEN. -# -# DEPENDS lists the components on which this component depends. If -# this component is selected, then each of the components listed -# must also be selected. The dependency information is encoded -# within the installer itself, so that users cannot install -# inconsitent sets of components. -# -# GROUP names the component group of which this component is a -# part. If not provided, the component will be a standalone -# component, not part of any component group. Component groups are -# described with the cpack_add_component_group command, detailed -# below. -# -# INSTALL_TYPES lists the installation types of which this component -# is a part. When one of these installations types is selected, this -# component will automatically be selected. Installation types are -# described with the cpack_add_install_type command, detailed below. -# -# DOWNLOADED indicates that this component should be downloaded -# on-the-fly by the installer, rather than packaged in with the -# installer itself. For more information, see the cpack_configure_downloads -# command. -# -# ARCHIVE_FILE provides a name for the archive file created by CPack -# to be used for downloaded components. If not supplied, CPack will -# create a file with some name based on CPACK_PACKAGE_FILE_NAME and -# the name of the component. See cpack_configure_downloads for more -# information. +#cpack_add_component - Describes a CPack installation component +#named by the COMPONENT argument to a CMake INSTALL command. +# +# cpack_add_component(compname +# [DISPLAY_NAME name] +# [DESCRIPTION description] +# [HIDDEN | REQUIRED | DISABLED ] +# [GROUP group] +# [DEPENDS comp1 comp2 ... ] +# [INSTALL_TYPES type1 type2 ... ] +# [DOWNLOADED] +# [ARCHIVE_FILE filename]) +# +#The cmake_add_component command describes an installation +#component, which the user can opt to install or remove as part of +#the graphical installation process. compname is the name of the +#component, as provided to the COMPONENT argument of one or more +#CMake INSTALL commands. +# +#DISPLAY_NAME is the displayed name of the component, used in +#graphical installers to display the component name. This value can +#be any string. +# +#DESCRIPTION is an extended description of the component, used in +#graphical installers to give the user additional information about +#the component. Descriptions can span multiple lines using "\n" as +#the line separator. Typically, these descriptions should be no +#more than a few lines long. +# +#HIDDEN indicates that this component will be hidden in the +#graphical installer, so that the user cannot directly change +#whether it is installed or not. +# +#REQUIRED indicates that this component is required, and therefore +#will always be installed. It will be visible in the graphical +#installer, but it cannot be unselected. (Typically, required +#components are shown greyed out). +# +#DISABLED indicates that this component should be disabled +#(unselected) by default. The user is free to select this component +#for installation, unless it is also HIDDEN. +# +#DEPENDS lists the components on which this component depends. If +#this component is selected, then each of the components listed +#must also be selected. The dependency information is encoded +#within the installer itself, so that users cannot install +#inconsistent sets of components. +# +#GROUP names the component group of which this component is a +#part. If not provided, the component will be a standalone +#component, not part of any component group. Component groups are +#described with the cpack_add_component_group command, detailed +#below. +# +#INSTALL_TYPES lists the installation types of which this component +#is a part. When one of these installations types is selected, this +#component will automatically be selected. Installation types are +#described with the cpack_add_install_type command, detailed below. +# +#DOWNLOADED indicates that this component should be downloaded +#on-the-fly by the installer, rather than packaged in with the +#installer itself. For more information, see the cpack_configure_downloads +# command. +# +#ARCHIVE_FILE provides a name for the archive file created by CPack +#to be used for downloaded components. If not supplied, CPack will +#create a file with some name based on CPACK_PACKAGE_FILE_NAME and +#the name of the component. See cpack_configure_downloads for more +#information. ##end # ##macro -# cpack_add_component_group - Describes a group of related CPack -# installation components. -# -# cpack_add_component_group(groupname -# [DISPLAY_NAME name] -# [DESCRIPTION description] -# [PARENT_GROUP parent] -# [EXPANDED] -# [BOLD_TITLE]) -# -# The cpack_add_component_group describes a group of installation -# components, which will be placed together within the listing of -# options. Typically, component groups allow the user to -# select/deselect all of the components within a single group via a -# single group-level option. Use component groups to reduce the -# complexity of installers with many options. groupname is an -# arbitrary name used to identify the group in the GROUP argument of -# the cpack_add_component command, which is used to place a -# component in a group. The name of the group must not conflict with -# the name of any component. -# -# DISPLAY_NAME is the displayed name of the component group, used in -# graphical installers to display the component group name. This -# value can be any string. -# -# DESCRIPTION is an extended description of the component group, -# used in graphical installers to give the user additional -# information about the components within that group. Descriptions -# can span multiple lines using "\n" as the line -# separator. Typically, these descriptions should be no more than a -# few lines long. -# -# PARENT_GROUP, if supplied, names the parent group of this group. -# Parent groups are used to establish a hierarchy of groups, -# providing an arbitrary hierarchy of groups. -# -# EXPANDED indicates that, by default, the group should show up as -# "expanded", so that the user immediately sees all of the -# components within the group. Otherwise, the group will initially -# show up as a single entry. -# -# BOLD_TITLE indicates that the group title should appear in bold, -# to call the user's attention to the group. +#cpack_add_component_group - Describes a group of related CPack +#installation components. +# +# cpack_add_component_group(groupname +# [DISPLAY_NAME name] +# [DESCRIPTION description] +# [PARENT_GROUP parent] +# [EXPANDED] +# [BOLD_TITLE]) +# +#The cpack_add_component_group describes a group of installation +#components, which will be placed together within the listing of +#options. Typically, component groups allow the user to +#select/deselect all of the components within a single group via a +#single group-level option. Use component groups to reduce the +#complexity of installers with many options. groupname is an +#arbitrary name used to identify the group in the GROUP argument of +#the cpack_add_component command, which is used to place a +#component in a group. The name of the group must not conflict with +#the name of any component. +# +#DISPLAY_NAME is the displayed name of the component group, used in +#graphical installers to display the component group name. This +#value can be any string. +# +#DESCRIPTION is an extended description of the component group, +#used in graphical installers to give the user additional +#information about the components within that group. Descriptions +#can span multiple lines using "\n" as the line +#separator. Typically, these descriptions should be no more than a +#few lines long. +# +#PARENT_GROUP, if supplied, names the parent group of this group. +#Parent groups are used to establish a hierarchy of groups, +#providing an arbitrary hierarchy of groups. +# +#EXPANDED indicates that, by default, the group should show up as +#"expanded", so that the user immediately sees all of the +#components within the group. Otherwise, the group will initially +#show up as a single entry. +# +#BOLD_TITLE indicates that the group title should appear in bold, +#to call the user's attention to the group. ##end # ##macro -# cpack_add_install_type - Add a new installation type containing a -# set of predefined component selections to the graphical installer. -# -# cpack_add_install_type(typename -# [DISPLAY_NAME name]) -# -# The cpack_add_install_type command identifies a set of preselected -# components that represents a common use case for an -# application. For example, a "Developer" install type might include -# an application along with its header and library files, while an -# "End user" install type might just include the application's -# executable. Each component identifies itself with one or more -# install types via the INSTALL_TYPES argument to -# cpack_add_component. -# -# DISPLAY_NAME is the displayed name of the install type, which will -# typically show up in a drop-down box within a graphical -# installer. This value can be any string. +#cpack_add_install_type - Add a new installation type containing a +#set of predefined component selections to the graphical installer. +# +# cpack_add_install_type(typename +# [DISPLAY_NAME name]) +# +#The cpack_add_install_type command identifies a set of preselected +#components that represents a common use case for an +#application. For example, a "Developer" install type might include +#an application along with its header and library files, while an +#"End user" install type might just include the application's +#executable. Each component identifies itself with one or more +#install types via the INSTALL_TYPES argument to +#cpack_add_component. +# +#DISPLAY_NAME is the displayed name of the install type, which will +#typically show up in a drop-down box within a graphical +#installer. This value can be any string. ##end # ##macro -# cpack_configure_downloads - Configure CPack to download selected -# components on-the-fly as part of the installation process. -# -# cpack_configure_downloads(site -# [UPLOAD_DIRECTORY dirname] -# [ALL] -# [ADD_REMOVE|NO_ADD_REMOVE]) -# -# The cpack_configure_downloads command configures installation-time -# downloads of selected components. For each downloadable component, -# CPack will create an archive containing the contents of that -# component, which should be uploaded to the given site. When the -# user selects that component for installation, the installer will -# download and extract the component in place. This feature is -# useful for creating small installers that only download the -# requested components, saving bandwidth. Additionally, the -# installers are small enough that they will be installed as part of -# the normal installation process, and the "Change" button in -# Windows Add/Remove Programs control panel will allow one to add or -# remove parts of the application after the original -# installation. On Windows, the downloaded-components functionality -# requires the ZipDLL plug-in for NSIS, available at: -# -# http://nsis.sourceforge.net/ZipDLL_plug-in -# -# On Mac OS X, installers that download components on-the-fly can -# only be built and installed on system using Mac OS X 10.5 or -# later. -# -# The site argument is a URL where the archives for downloadable -# components will reside, e.g., http://www.cmake.org/files/2.6.1/installer/ -# All of the archives produced by CPack should be uploaded to that location. -# -# UPLOAD_DIRECTORY is the local directory where CPack will create the -# various archives for each of the components. The contents of this -# directory should be uploaded to a location accessible by the URL given -# in the site argument. If omitted, CPack will use the directory -# CPackUploads inside the CMake binary directory to store the generated -# archives. -# -# The ALL flag indicates that all components be downloaded. Otherwise, only -# those components explicitly marked as DOWNLOADED or that have a specified -# ARCHIVE_FILE will be downloaded. Additionally, the ALL option implies -# ADD_REMOVE (unless NO_ADD_REMOVE is specified). -# -# ADD_REMOVE indicates that CPack should install a copy of the installer -# that can be called from Windows' Add/Remove Programs dialog (via the -# "Modify" button) to change the set of installed components. NO_ADD_REMOVE -# turns off this behavior. This option is ignored on Mac OS X. +#cpack_configure_downloads - Configure CPack to download selected +#components on-the-fly as part of the installation process. +# +# cpack_configure_downloads(site +# [UPLOAD_DIRECTORY dirname] +# [ALL] +# [ADD_REMOVE|NO_ADD_REMOVE]) +# +#The cpack_configure_downloads command configures installation-time +#downloads of selected components. For each downloadable component, +#CPack will create an archive containing the contents of that +#component, which should be uploaded to the given site. When the +#user selects that component for installation, the installer will +#download and extract the component in place. This feature is +#useful for creating small installers that only download the +#requested components, saving bandwidth. Additionally, the +#installers are small enough that they will be installed as part of +#the normal installation process, and the "Change" button in +#Windows Add/Remove Programs control panel will allow one to add or +#remove parts of the application after the original +#installation. On Windows, the downloaded-components functionality +#requires the ZipDLL plug-in for NSIS, available at: +# +# http://nsis.sourceforge.net/ZipDLL_plug-in +# +#On Mac OS X, installers that download components on-the-fly can +#only be built and installed on system using Mac OS X 10.5 or +#later. +# +#The site argument is a URL where the archives for downloadable +#components will reside, e.g., http://www.cmake.org/files/2.6.1/installer/ +#All of the archives produced by CPack should be uploaded to that location. +# +#UPLOAD_DIRECTORY is the local directory where CPack will create the +#various archives for each of the components. The contents of this +#directory should be uploaded to a location accessible by the URL given +#in the site argument. If omitted, CPack will use the directory +#CPackUploads inside the CMake binary directory to store the generated +#archives. +# +#The ALL flag indicates that all components be downloaded. Otherwise, only +#those components explicitly marked as DOWNLOADED or that have a specified +#ARCHIVE_FILE will be downloaded. Additionally, the ALL option implies +#ADD_REMOVE (unless NO_ADD_REMOVE is specified). +# +#ADD_REMOVE indicates that CPack should install a copy of the installer +#that can be called from Windows' Add/Remove Programs dialog (via the +#"Modify" button) to change the set of installed components. NO_ADD_REMOVE +#turns off this behavior. This option is ignored on Mac OS X. ##endmacro #============================================================================= @@ -275,84 +275,84 @@ # License text for the above reference.) # Define var in order to avoid multiple inclusion -IF(NOT CPackComponent_CMake_INCLUDED) -SET(CPackComponent_CMake_INCLUDED 1) +if(NOT CPackComponent_CMake_INCLUDED) +set(CPackComponent_CMake_INCLUDED 1) # Argument-parsing macro from http://www.cmake.org/Wiki/CMakeMacroParseArguments -MACRO(cpack_parse_arguments prefix arg_names option_names) - SET(${prefix}_DEFAULT_ARGS) - FOREACH(arg_name ${arg_names}) - SET(${prefix}_${arg_name}) - ENDFOREACH(arg_name) - FOREACH(option ${option_names}) - SET(${prefix}_${option} FALSE) - ENDFOREACH(option) +macro(cpack_parse_arguments prefix arg_names option_names) + set(${prefix}_DEFAULT_ARGS) + foreach(arg_name ${arg_names}) + set(${prefix}_${arg_name}) + endforeach() + foreach(option ${option_names}) + set(${prefix}_${option} FALSE) + endforeach() - SET(current_arg_name DEFAULT_ARGS) - SET(current_arg_list) - FOREACH(arg ${ARGN}) - SET(larg_names ${arg_names}) - LIST(FIND larg_names "${arg}" is_arg_name) - IF (is_arg_name GREATER -1) - SET(${prefix}_${current_arg_name} ${current_arg_list}) - SET(current_arg_name ${arg}) - SET(current_arg_list) - ELSE (is_arg_name GREATER -1) - SET(loption_names ${option_names}) - LIST(FIND loption_names "${arg}" is_option) - IF (is_option GREATER -1) - SET(${prefix}_${arg} TRUE) - ELSE (is_option GREATER -1) - SET(current_arg_list ${current_arg_list} ${arg}) - ENDIF (is_option GREATER -1) - ENDIF (is_arg_name GREATER -1) - ENDFOREACH(arg) - SET(${prefix}_${current_arg_name} ${current_arg_list}) -ENDMACRO(cpack_parse_arguments) + set(current_arg_name DEFAULT_ARGS) + set(current_arg_list) + foreach(arg ${ARGN}) + set(larg_names ${arg_names}) + list(FIND larg_names "${arg}" is_arg_name) + if (is_arg_name GREATER -1) + set(${prefix}_${current_arg_name} ${current_arg_list}) + set(current_arg_name ${arg}) + set(current_arg_list) + else () + set(loption_names ${option_names}) + list(FIND loption_names "${arg}" is_option) + if (is_option GREATER -1) + set(${prefix}_${arg} TRUE) + else () + set(current_arg_list ${current_arg_list} ${arg}) + endif () + endif () + endforeach() + set(${prefix}_${current_arg_name} ${current_arg_list}) +endmacro() # Macro that appends a SET command for the given variable name (var) # to the macro named strvar, but only if the variable named "var" # has been defined. The string will eventually be appended to a CPack # configuration file. -MACRO(cpack_append_variable_set_command var strvar) - IF (DEFINED ${var}) - SET(${strvar} "${${strvar}}SET(${var}") - FOREACH(APPENDVAL ${${var}}) - SET(${strvar} "${${strvar}} ${APPENDVAL}") - ENDFOREACH(APPENDVAL) - SET(${strvar} "${${strvar}})\n") - ENDIF (DEFINED ${var}) -ENDMACRO(cpack_append_variable_set_command) +macro(cpack_append_variable_set_command var strvar) + if (DEFINED ${var}) + set(${strvar} "${${strvar}}set(${var}") + foreach(APPENDVAL ${${var}}) + set(${strvar} "${${strvar}} ${APPENDVAL}") + endforeach() + set(${strvar} "${${strvar}})\n") + endif () +endmacro() # Macro that appends a SET command for the given variable name (var) # to the macro named strvar, but only if the variable named "var" # has been defined and is a string. The string will eventually be # appended to a CPack configuration file. -MACRO(cpack_append_string_variable_set_command var strvar) - IF (DEFINED ${var}) - LIST(LENGTH ${var} CPACK_APP_VALUE_LEN) - IF(${CPACK_APP_VALUE_LEN} EQUAL 1) - SET(${strvar} "${${strvar}}SET(${var} \"${${var}}\")\n") - ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1) - ENDIF (DEFINED ${var}) -ENDMACRO(cpack_append_string_variable_set_command) +macro(cpack_append_string_variable_set_command var strvar) + if (DEFINED ${var}) + list(LENGTH ${var} CPACK_APP_VALUE_LEN) + if(${CPACK_APP_VALUE_LEN} EQUAL 1) + set(${strvar} "${${strvar}}set(${var} \"${${var}}\")\n") + endif() + endif () +endmacro() # Macro that appends a SET command for the given variable name (var) # to the macro named strvar, but only if the variable named "var" # has been set to true. The string will eventually be # appended to a CPack configuration file. -MACRO(cpack_append_option_set_command var strvar) - IF (${var}) - LIST(LENGTH ${var} CPACK_APP_VALUE_LEN) - IF(${CPACK_APP_VALUE_LEN} EQUAL 1) - SET(${strvar} "${${strvar}}SET(${var} TRUE)\n") - ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1) - ENDIF (${var}) -ENDMACRO(cpack_append_option_set_command) +macro(cpack_append_option_set_command var strvar) + if (${var}) + list(LENGTH ${var} CPACK_APP_VALUE_LEN) + if(${CPACK_APP_VALUE_LEN} EQUAL 1) + set(${strvar} "${${strvar}}set(${var} TRUE)\n") + endif() + endif () +endmacro() # Macro that adds a component to the CPack installer -MACRO(cpack_add_component compname) - STRING(TOUPPER ${compname} CPACK_ADDCOMP_UNAME) +macro(cpack_add_component compname) + string(TOUPPER ${compname} CPACK_ADDCOMP_UNAME) cpack_parse_arguments(CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME} "DISPLAY_NAME;DESCRIPTION;GROUP;DEPENDS;INSTALL_TYPES;ARCHIVE_FILE" "HIDDEN;REQUIRED;DISABLED;DOWNLOADED" @@ -360,25 +360,25 @@ MACRO(cpack_add_component compname) ) if (CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED) - SET(CPACK_ADDCOMP_STR "\n# Configuration for downloaded component \"${compname}\"\n") + set(CPACK_ADDCOMP_STR "\n# Configuration for downloaded component \"${compname}\"\n") else () - SET(CPACK_ADDCOMP_STR "\n# Configuration for component \"${compname}\"\n") + set(CPACK_ADDCOMP_STR "\n# Configuration for component \"${compname}\"\n") endif () - IF(NOT CPACK_MONOLITHIC_INSTALL) + if(NOT CPACK_MONOLITHIC_INSTALL) # If the user didn't set CPACK_COMPONENTS_ALL explicitly, update the # value of CPACK_COMPONENTS_ALL in the configuration file. This will # take care of any components that have been added after the CPack # moduled was included. - IF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER) - GET_CMAKE_PROPERTY(CPACK_ADDCOMP_COMPONENTS COMPONENTS) - SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR}\nSET(CPACK_COMPONENTS_ALL") - FOREACH(COMP ${CPACK_ADDCOMP_COMPONENTS}) - SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR} ${COMP}") - ENDFOREACH(COMP) - SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR})\n") - ENDIF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER) - ENDIF(NOT CPACK_MONOLITHIC_INSTALL) + if(NOT CPACK_COMPONENTS_ALL_SET_BY_USER) + get_cmake_property(CPACK_ADDCOMP_COMPONENTS COMPONENTS) + set(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR}\nSET(CPACK_COMPONENTS_ALL") + foreach(COMP ${CPACK_ADDCOMP_COMPONENTS}) + set(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR} ${COMP}") + endforeach() + set(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR})\n") + endif() + endif() cpack_append_string_variable_set_command( CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISPLAY_NAME @@ -414,21 +414,21 @@ MACRO(cpack_add_component compname) # Write to config iff the macros is used after CPack.cmake has been # included, other it's not necessary because the variables # will be encoded by cpack_encode_variables. - IF(CPack_CMake_INCLUDED) - FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDCOMP_STR}") - ENDIF(CPack_CMake_INCLUDED) -ENDMACRO(cpack_add_component) + if(CPack_CMake_INCLUDED) + file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDCOMP_STR}") + endif() +endmacro() # Macro that adds a component group to the CPack installer -MACRO(cpack_add_component_group grpname) - STRING(TOUPPER ${grpname} CPACK_ADDGRP_UNAME) +macro(cpack_add_component_group grpname) + string(TOUPPER ${grpname} CPACK_ADDGRP_UNAME) cpack_parse_arguments(CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME} "DISPLAY_NAME;DESCRIPTION" "EXPANDED;BOLD_TITLE" ${ARGN} ) - SET(CPACK_ADDGRP_STR "\n# Configuration for component group \"${grpname}\"\n") + set(CPACK_ADDGRP_STR "\n# Configuration for component group \"${grpname}\"\n") cpack_append_string_variable_set_command( CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DISPLAY_NAME CPACK_ADDGRP_STR) @@ -445,24 +445,24 @@ MACRO(cpack_add_component_group grpname) # Write to config iff the macros is used after CPack.cmake has been # included, other it's not necessary because the variables # will be encoded by cpack_encode_variables. - IF(CPack_CMake_INCLUDED) - FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDGRP_STR}") - ENDIF(CPack_CMake_INCLUDED) -ENDMACRO(cpack_add_component_group) + if(CPack_CMake_INCLUDED) + file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDGRP_STR}") + endif() +endmacro() # Macro that adds an installation type to the CPack installer -MACRO(cpack_add_install_type insttype) - STRING(TOUPPER ${insttype} CPACK_INSTTYPE_UNAME) +macro(cpack_add_install_type insttype) + string(TOUPPER ${insttype} CPACK_INSTTYPE_UNAME) cpack_parse_arguments(CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME} "DISPLAY_NAME" "" ${ARGN} ) - SET(CPACK_INSTTYPE_STR + set(CPACK_INSTTYPE_STR "\n# Configuration for installation type \"${insttype}\"\n") - SET(CPACK_INSTTYPE_STR - "${CPACK_INSTTYPE_STR}LIST(APPEND CPACK_ALL_INSTALL_TYPES ${insttype})\n") + set(CPACK_INSTTYPE_STR + "${CPACK_INSTTYPE_STR}list(APPEND CPACK_ALL_INSTALL_TYPES ${insttype})\n") cpack_append_string_variable_set_command( CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME}_DISPLAY_NAME CPACK_INSTTYPE_STR) @@ -470,22 +470,22 @@ MACRO(cpack_add_install_type insttype) # Write to config iff the macros is used after CPack.cmake has been # included, other it's not necessary because the variables # will be encoded by cpack_encode_variables. - IF(CPack_CMake_INCLUDED) - FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_INSTTYPE_STR}") - ENDIF(CPack_CMake_INCLUDED) -ENDMACRO(cpack_add_install_type) + if(CPack_CMake_INCLUDED) + file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_INSTTYPE_STR}") + endif() +endmacro() -MACRO(cpack_configure_downloads site) +macro(cpack_configure_downloads site) cpack_parse_arguments(CPACK_DOWNLOAD "UPLOAD_DIRECTORY" "ALL;ADD_REMOVE;NO_ADD_REMOVE" ${ARGN} ) - SET(CPACK_CONFIG_DL_STR + set(CPACK_CONFIG_DL_STR "\n# Downloaded components configuration\n") - SET(CPACK_UPLOAD_DIRECTORY ${CPACK_DOWNLOAD_UPLOAD_DIRECTORY}) - SET(CPACK_DOWNLOAD_SITE ${site}) + set(CPACK_UPLOAD_DIRECTORY ${CPACK_DOWNLOAD_UPLOAD_DIRECTORY}) + set(CPACK_DOWNLOAD_SITE ${site}) cpack_append_string_variable_set_command( CPACK_DOWNLOAD_SITE CPACK_CONFIG_DL_STR) @@ -495,10 +495,10 @@ MACRO(cpack_configure_downloads site) cpack_append_option_set_command( CPACK_DOWNLOAD_ALL CPACK_CONFIG_DL_STR) - IF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE}) - SET(CPACK_DOWNLOAD_ADD_REMOVE ON) - ENDIF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE}) - SET(CPACK_ADD_REMOVE ${CPACK_DOWNLOAD_ADD_REMOVE}) + if (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE}) + set(CPACK_DOWNLOAD_ADD_REMOVE ON) + endif () + set(CPACK_ADD_REMOVE ${CPACK_DOWNLOAD_ADD_REMOVE}) cpack_append_option_set_command( CPACK_ADD_REMOVE CPACK_CONFIG_DL_STR) @@ -506,8 +506,8 @@ MACRO(cpack_configure_downloads site) # Write to config iff the macros is used after CPack.cmake has been # included, other it's not necessary because the variables # will be encoded by cpack_encode_variables. - IF(CPack_CMake_INCLUDED) - FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_CONFIG_DL_STR}") - ENDIF(CPack_CMake_INCLUDED) -ENDMACRO(cpack_configure_downloads) -ENDIF(NOT CPackComponent_CMake_INCLUDED) + if(CPack_CMake_INCLUDED) + file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_CONFIG_DL_STR}") + endif() +endmacro() +endif() diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index bd3b94d74..75ff3bef1 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -161,7 +161,7 @@ # Default : - # This variable allow advanced user to add custom script to the control.tar.gz # Typical usage is for conffiles, postinst, postrm, prerm. -# Usage: SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA +# Usage: set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA # "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") ##end @@ -185,115 +185,115 @@ # # http://wiki.debian.org/HowToPackageForDebian -IF(CMAKE_BINARY_DIR) - MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.") -ENDIF(CMAKE_BINARY_DIR) +if(CMAKE_BINARY_DIR) + message(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.") +endif() -IF(NOT UNIX) - MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.") -ENDIF(NOT UNIX) +if(NOT UNIX) + message(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.") +endif() # CPACK_DEBIAN_PACKAGE_SHLIBDEPS # If specify OFF, only user depends are used -IF(NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS) - SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) -ENDIF(NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS) +if(NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS) + set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) +endif() -FIND_PROGRAM(FAKEROOT_EXECUTABLE fakeroot) -IF(FAKEROOT_EXECUTABLE) - SET(CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${FAKEROOT_EXECUTABLE}) -ENDIF(FAKEROOT_EXECUTABLE) +find_program(FAKEROOT_EXECUTABLE fakeroot) +if(FAKEROOT_EXECUTABLE) + set(CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${FAKEROOT_EXECUTABLE}) +endif() -IF(CPACK_DEBIAN_PACKAGE_SHLIBDEPS) +if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS) # dpkg-shlibdeps is a Debian utility for generating dependency list - FIND_PROGRAM(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps) + find_program(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps) # Check version of the dpkg-shlibdeps tool using CPackRPM method - IF(SHLIBDEPS_EXECUTABLE) - EXECUTE_PROCESS(COMMAND ${SHLIBDEPS_EXECUTABLE} --version + if(SHLIBDEPS_EXECUTABLE) + execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} --version OUTPUT_VARIABLE _TMP_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - STRING(REGEX MATCH "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)" + string(REGEX MATCH "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)" SHLIBDEPS_EXECUTABLE_VERSION ${_TMP_VERSION}) - SET(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}") - IF(CPACK_DEBIAN_PACKAGE_DEBUG) - MESSAGE( "CPackDeb Debug: dpkg-shlibdeps version is <${SHLIBDEPS_EXECUTABLE_VERSION}>") - ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG) + set(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}") + if(CPACK_DEBIAN_PACKAGE_DEBUG) + message( "CPackDeb Debug: dpkg-shlibdeps version is <${SHLIBDEPS_EXECUTABLE_VERSION}>") + endif() # Generating binary list - Get type of all install files - EXECUTE_PROCESS(COMMAND find -type f + execute_process(COMMAND find -type f COMMAND xargs file WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" OUTPUT_VARIABLE CPACK_DEB_INSTALL_FILES) # Convert to CMake list - STRING(REGEX REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES ${CPACK_DEB_INSTALL_FILES}) + string(REGEX REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES ${CPACK_DEB_INSTALL_FILES}) # Only dynamically linked ELF files are included # Extract only file name infront of ":" - FOREACH ( _FILE ${CPACK_DEB_INSTALL_FILES}) - IF ( ${_FILE} MATCHES "ELF.*dynamically linked") - STRING(REGEX MATCH "(^.*):" _FILE_NAME ${_FILE}) - LIST(APPEND CPACK_DEB_BINARY_FILES ${CMAKE_MATCH_1}) - ENDIF() - ENDFOREACH() + foreach ( _FILE ${CPACK_DEB_INSTALL_FILES}) + if ( ${_FILE} MATCHES "ELF.*dynamically linked") + string(REGEX MATCH "(^.*):" _FILE_NAME ${_FILE}) + list(APPEND CPACK_DEB_BINARY_FILES ${CMAKE_MATCH_1}) + endif() + endforeach() - MESSAGE( "CPackDeb: - Generating dependency list") + message( "CPackDeb: - Generating dependency list") # Create blank control file for running dpkg-shlibdeps # There might be some other way to invoke dpkg-shlibdeps without creating this file # but standard debian package should not have anything that can collide with this file or directory - FILE(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian) - FILE(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "") + file(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian) + file(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "") # Execute dpkg-shlibdeps # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package # -O : print to STDOUT - EXECUTE_PROCESS(COMMAND ${SHLIBDEPS_EXECUTABLE} --ignore-missing-info -O ${CPACK_DEB_BINARY_FILES} + execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} --ignore-missing-info -O ${CPACK_DEB_BINARY_FILES} WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" OUTPUT_VARIABLE SHLIBDEPS_OUTPUT RESULT_VARIABLE SHLIBDEPS_RESULT ERROR_VARIABLE SHLIBDEPS_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE ) - IF(CPACK_DEBIAN_PACKAGE_DEBUG) + if(CPACK_DEBIAN_PACKAGE_DEBUG) # dpkg-shlibdeps will throw some warnings if some input files are not binary - MESSAGE( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}") - ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG) - IF (NOT SHLIBDEPS_RESULT EQUAL 0) - MESSAGE (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: ${SHLIBDEPS_ERROR}") - ENDIF (NOT SHLIBDEPS_RESULT EQUAL 0) + message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}") + endif() + if (NOT SHLIBDEPS_RESULT EQUAL 0) + message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: ${SHLIBDEPS_ERROR}") + endif () #Get rid of prefix generated by dpkg-shlibdeps string (REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS ${SHLIBDEPS_OUTPUT}) - IF(CPACK_DEBIAN_PACKAGE_DEBUG) - MESSAGE( "CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") - ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG) + if(CPACK_DEBIAN_PACKAGE_DEBUG) + message( "CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") + endif() # Remove blank control file # Might not be safe if package actual contain file or directory named debian - FILE(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian") + file(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian") # Append user depend if set - IF (CPACK_DEBIAN_PACKAGE_DEPENDS) - SET (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}") - ELSE (CPACK_DEBIAN_PACKAGE_DEPENDS) - SET (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") - ENDIF (CPACK_DEBIAN_PACKAGE_DEPENDS) - - ELSE (SHLIBDEPS_EXECUTABLE) - IF(CPACK_DEBIAN_PACKAGE_DEBUG) - MESSAGE( "CPackDeb Debug: Using only user-provided depends because dpkg-shlibdeps is not found.") - ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG) - ENDIF(SHLIBDEPS_EXECUTABLE) - -ELSE (CPACK_DEBIAN_PACKAGE_SHLIBDEPS) - IF(CPACK_DEBIAN_PACKAGE_DEBUG) - MESSAGE( "CPackDeb Debug: Using only user-provided depends") - ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG) -ENDIF(CPACK_DEBIAN_PACKAGE_SHLIBDEPS) + if (CPACK_DEBIAN_PACKAGE_DEPENDS) + set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}") + else () + set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") + endif () + + else () + if(CPACK_DEBIAN_PACKAGE_DEBUG) + message( "CPackDeb Debug: Using only user-provided depends because dpkg-shlibdeps is not found.") + endif() + endif() + +else () + if(CPACK_DEBIAN_PACKAGE_DEBUG) + message( "CPackDeb Debug: Using only user-provided depends") + endif() +endif() # Let's define the control file found in debian package: @@ -303,67 +303,67 @@ ENDIF(CPACK_DEBIAN_PACKAGE_SHLIBDEPS) # DEBIAN/control # debian policy enforce lower case for package name # Package: (mandatory) -IF(NOT CPACK_DEBIAN_PACKAGE_NAME) - STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME) -ENDIF(NOT CPACK_DEBIAN_PACKAGE_NAME) +if(NOT CPACK_DEBIAN_PACKAGE_NAME) + string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME) +endif() # Version: (mandatory) -IF(NOT CPACK_DEBIAN_PACKAGE_VERSION) - IF(NOT CPACK_PACKAGE_VERSION) - MESSAGE(FATAL_ERROR "CPackDeb: Debian package requires a package version") - ENDIF(NOT CPACK_PACKAGE_VERSION) - SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) -ENDIF(NOT CPACK_DEBIAN_PACKAGE_VERSION) +if(NOT CPACK_DEBIAN_PACKAGE_VERSION) + if(NOT CPACK_PACKAGE_VERSION) + message(FATAL_ERROR "CPackDeb: Debian package requires a package version") + endif() + set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) +endif() # Architecture: (mandatory) -IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) +if(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) # There is no such thing as i686 architecture on debian, you should use i386 instead # $ dpkg --print-architecture - FIND_PROGRAM(DPKG_CMD dpkg) - IF(NOT DPKG_CMD) - MESSAGE(STATUS "CPackDeb: Can not find dpkg in your path, default to i386.") - SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386) - ENDIF(NOT DPKG_CMD) - EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture + find_program(DPKG_CMD dpkg) + if(NOT DPKG_CMD) + message(STATUS "CPackDeb: Can not find dpkg in your path, default to i386.") + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386) + endif() + execute_process(COMMAND "${DPKG_CMD}" --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE ) -ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) +endif() -# have a look at GET_PROPERTY(result GLOBAL PROPERTY ENABLED_FEATURES), -# this returns the successful FIND_PACKAGE() calls, maybe this can help +# have a look at get_property(result GLOBAL PROPERTY ENABLED_FEATURES), +# this returns the successful find_package() calls, maybe this can help # Depends: # You should set: DEBIAN_PACKAGE_DEPENDS # TODO: automate 'objdump -p | grep NEEDED' -IF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS) - MESSAGE(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.") -ENDIF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS) +if(NOT CPACK_DEBIAN_PACKAGE_DEPENDS) + message(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.") +endif() # Maintainer: (mandatory) -IF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER) - IF(NOT CPACK_PACKAGE_CONTACT) - MESSAGE(FATAL_ERROR "CPackDeb: Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER") - ENDIF(NOT CPACK_PACKAGE_CONTACT) - SET(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT}) -ENDIF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER) +if(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER) + if(NOT CPACK_PACKAGE_CONTACT) + message(FATAL_ERROR "CPackDeb: Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER") + endif() + set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT}) +endif() # Description: (mandatory) -IF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) - IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - MESSAGE(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION") - ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) -ENDIF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) +if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) + if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) + message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION") + endif() + set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) +endif() # Section: (recommended) -IF(NOT CPACK_DEBIAN_PACKAGE_SECTION) - SET(CPACK_DEBIAN_PACKAGE_SECTION "devel") -ENDIF(NOT CPACK_DEBIAN_PACKAGE_SECTION) +if(NOT CPACK_DEBIAN_PACKAGE_SECTION) + set(CPACK_DEBIAN_PACKAGE_SECTION "devel") +endif() # Priority: (recommended) -IF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY) - SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") -ENDIF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY ) +if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY) + set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") +endif() # Recommends: # You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS @@ -379,32 +379,30 @@ ENDIF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY ) # - postrm # - prerm" # Usage: -# SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA +# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA # "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") # Are we packaging components ? -IF(CPACK_DEB_PACKAGE_COMPONENT) - SET(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}") - SET(CPACK_DEB_PACKAGE_COMPONENT_PART_PATH "/${CPACK_DEB_PACKAGE_COMPONENT}") - SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_DEB_PACKAGE_COMPONENT}") - STRING(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME) -ELSE(CPACK_DEB_PACKAGE_COMPONENT) - SET(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "") - SET(CPACK_DEB_PACKAGE_COMPONENT_PART_PATH "") - SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}") -ENDIF(CPACK_DEB_PACKAGE_COMPONENT) +if(CPACK_DEB_PACKAGE_COMPONENT) + set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}") + string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME) +else() + set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "") +endif() + +set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}") # Print out some debug information if we were asked for that -IF(CPACK_DEBIAN_PACKAGE_DEBUG) - MESSAGE("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") - MESSAGE("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") - MESSAGE("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") - MESSAGE("CPackDeb:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") - MESSAGE("CPackDeb:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") - MESSAGE("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") - MESSAGE("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") - MESSAGE("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") -ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG) +if(CPACK_DEBIAN_PACKAGE_DEBUG) + message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") + message("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") + message("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") + message("CPackDeb:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") + message("CPackDeb:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") + message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") + message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") + message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") +endif() # For debian source packages: # debian/control @@ -414,8 +412,8 @@ ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG) # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-debiansourcecontrolfiles # Builds-Depends: -#IF(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS) -# SET(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS +#if(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS) +# set(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS # "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4" # ) -#ENDIF(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS) +#endif() diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index ae9351273..fa79e1bfc 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -162,7 +162,7 @@ # Default : - # May be set by the user in order to specify a USER binary spec file # to be used by CPackRPM instead of generating the file. -# The specified file will be processed by CONFIGURE_FILE( @ONLY). +# The specified file will be processed by configure_file( @ONLY). ##end ##variable # CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE - Spec file template. @@ -239,42 +239,42 @@ # Author: Eric Noulard with the help of Alexander Neundorf. -IF(CMAKE_BINARY_DIR) - MESSAGE(FATAL_ERROR "CPackRPM.cmake may only be used by CPack internally.") -ENDIF(CMAKE_BINARY_DIR) +if(CMAKE_BINARY_DIR) + message(FATAL_ERROR "CPackRPM.cmake may only be used by CPack internally.") +endif() -IF(NOT UNIX) - MESSAGE(FATAL_ERROR "CPackRPM.cmake may only be used under UNIX.") -ENDIF(NOT UNIX) +if(NOT UNIX) + message(FATAL_ERROR "CPackRPM.cmake may only be used under UNIX.") +endif() # rpmbuild is the basic command for building RPM package # it may be a simple (symbolic) link to rpm command. -FIND_PROGRAM(RPMBUILD_EXECUTABLE rpmbuild) +find_program(RPMBUILD_EXECUTABLE rpmbuild) # Check version of the rpmbuild tool this would be easier to # track bugs with users and CPackRPM debug mode. # We may use RPM version in order to check for available version dependent features -IF(RPMBUILD_EXECUTABLE) +if(RPMBUILD_EXECUTABLE) execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --version OUTPUT_VARIABLE _TMP_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX REPLACE "^.*\ " "" + string(REGEX REPLACE "^.* " "" RPMBUILD_EXECUTABLE_VERSION ${_TMP_VERSION}) - IF(CPACK_RPM_PACKAGE_DEBUG) - MESSAGE("CPackRPM:Debug: rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) -ENDIF(RPMBUILD_EXECUTABLE) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>") + endif() +endif() -IF(NOT RPMBUILD_EXECUTABLE) - MESSAGE(FATAL_ERROR "RPM package requires rpmbuild executable") -ENDIF(NOT RPMBUILD_EXECUTABLE) +if(NOT RPMBUILD_EXECUTABLE) + message(FATAL_ERROR "RPM package requires rpmbuild executable") +endif() # Display lsb_release output if DEBUG mode enable # This will help to diagnose problem with CPackRPM # because we will know on which kind of Linux we are -IF(CPACK_RPM_PACKAGE_DEBUG) +if(CPACK_RPM_PACKAGE_DEBUG) find_program(LSB_RELEASE_EXECUTABLE lsb_release) if(LSB_RELEASE_EXECUTABLE) execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -a @@ -284,40 +284,38 @@ IF(CPACK_RPM_PACKAGE_DEBUG) string(REGEX REPLACE "\n" ", " LSB_RELEASE_OUTPUT ${_TMP_LSB_RELEASE_OUTPUT}) - else (LSB_RELEASE_EXECUTABLE) + else () set(LSB_RELEASE_OUTPUT "lsb_release not installed/found!") - endif(LSB_RELEASE_EXECUTABLE) - MESSAGE("CPackRPM:Debug: LSB_RELEASE = ${LSB_RELEASE_OUTPUT}") -ENDIF(CPACK_RPM_PACKAGE_DEBUG) + endif() + message("CPackRPM:Debug: LSB_RELEASE = ${LSB_RELEASE_OUTPUT}") +endif() # We may use RPM version in the future in order # to shut down warning about space in buildtree # some recent RPM version should support space in different places. # not checked [yet]. -IF(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*") - MESSAGE(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.") -ENDIF(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*") +if(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*") + message(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.") +endif() # If rpmbuild is found # we try to discover alien since we may be on non RPM distro like Debian. # In this case we may try to to use more advanced features # like generating RPM directly from DEB using alien. # FIXME feature not finished (yet) -FIND_PROGRAM(ALIEN_EXECUTABLE alien) -IF(ALIEN_EXECUTABLE) - MESSAGE(STATUS "alien found, we may be on a Debian based distro.") -ENDIF(ALIEN_EXECUTABLE) +find_program(ALIEN_EXECUTABLE alien) +if(ALIEN_EXECUTABLE) + message(STATUS "alien found, we may be on a Debian based distro.") +endif() # Are we packaging components ? -IF(CPACK_RPM_PACKAGE_COMPONENT) - SET(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") - SET(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "/${CPACK_RPM_PACKAGE_COMPONENT}") - SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_RPM_PACKAGE_COMPONENT}") -ELSE(CPACK_RPM_PACKAGE_COMPONENT) - SET(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "") - SET(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "") - SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}") -ENDIF(CPACK_RPM_PACKAGE_COMPONENT) +if(CPACK_RPM_PACKAGE_COMPONENT) + set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") +else() + set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "") +endif() + +set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}") # # Use user-defined RPM specific variables value @@ -329,42 +327,42 @@ ENDIF(CPACK_RPM_PACKAGE_COMPONENT) # # CPACK_RPM_PACKAGE_SUMMARY (mandatory) -IF(NOT CPACK_RPM_PACKAGE_SUMMARY) +if(NOT CPACK_RPM_PACKAGE_SUMMARY) # if neither var is defined lets use the name as summary - IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_SUMMARY) - ELSE(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - SET(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) - ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) -ENDIF(NOT CPACK_RPM_PACKAGE_SUMMARY) + if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) + string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_SUMMARY) + else() + set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) + endif() +endif() # CPACK_RPM_PACKAGE_NAME (mandatory) -IF(NOT CPACK_RPM_PACKAGE_NAME) - STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME) -ENDIF(NOT CPACK_RPM_PACKAGE_NAME) +if(NOT CPACK_RPM_PACKAGE_NAME) + string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME) +endif() # CPACK_RPM_PACKAGE_VERSION (mandatory) -IF(NOT CPACK_RPM_PACKAGE_VERSION) - IF(NOT CPACK_PACKAGE_VERSION) - MESSAGE(FATAL_ERROR "RPM package requires a package version") - ENDIF(NOT CPACK_PACKAGE_VERSION) - SET(CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) -ENDIF(NOT CPACK_RPM_PACKAGE_VERSION) +if(NOT CPACK_RPM_PACKAGE_VERSION) + if(NOT CPACK_PACKAGE_VERSION) + message(FATAL_ERROR "RPM package requires a package version") + endif() + set(CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) +endif() # Replace '-' in version with '_' # '-' character is an Illegal RPM version character # it is illegal because it is used to separate # RPM "Version" from RPM "Release" -STRING(REPLACE "-" "_" CPACK_RPM_PACKAGE_VERSION ${CPACK_RPM_PACKAGE_VERSION}) +string(REPLACE "-" "_" CPACK_RPM_PACKAGE_VERSION ${CPACK_RPM_PACKAGE_VERSION}) # CPACK_RPM_PACKAGE_ARCHITECTURE (optional) -IF(CPACK_RPM_PACKAGE_ARCHITECTURE) - SET(TMP_RPM_BUILDARCH "Buildarch: ${CPACK_RPM_PACKAGE_ARCHITECTURE}") - IF(CPACK_RPM_PACKAGE_DEBUG) - MESSAGE("CPackRPM:Debug: using user-specified build arch = ${CPACK_RPM_PACKAGE_ARCHITECTURE}") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) -ELSE(CPACK_RPM_PACKAGE_ARCHITECTURE) - SET(TMP_RPM_BUILDARCH "") -ENDIF(CPACK_RPM_PACKAGE_ARCHITECTURE) +if(CPACK_RPM_PACKAGE_ARCHITECTURE) + set(TMP_RPM_BUILDARCH "Buildarch: ${CPACK_RPM_PACKAGE_ARCHITECTURE}") + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: using user-specified build arch = ${CPACK_RPM_PACKAGE_ARCHITECTURE}") + endif() +else() + set(TMP_RPM_BUILDARCH "") +endif() # CPACK_RPM_PACKAGE_RELEASE # The RPM release is the numbering of the RPM package ITSELF @@ -374,28 +372,28 @@ ENDIF(CPACK_RPM_PACKAGE_ARCHITECTURE) # without changing the version of the packaged software. # This is the case when the packaging is buggy (not) the software :=) # If not set, 1 is a good candidate -IF(NOT CPACK_RPM_PACKAGE_RELEASE) - SET(CPACK_RPM_PACKAGE_RELEASE 1) -ENDIF(NOT CPACK_RPM_PACKAGE_RELEASE) +if(NOT CPACK_RPM_PACKAGE_RELEASE) + set(CPACK_RPM_PACKAGE_RELEASE 1) +endif() # CPACK_RPM_PACKAGE_LICENSE -IF(NOT CPACK_RPM_PACKAGE_LICENSE) - SET(CPACK_RPM_PACKAGE_LICENSE "unknown") -ENDIF(NOT CPACK_RPM_PACKAGE_LICENSE) +if(NOT CPACK_RPM_PACKAGE_LICENSE) + set(CPACK_RPM_PACKAGE_LICENSE "unknown") +endif() # CPACK_RPM_PACKAGE_GROUP -IF(NOT CPACK_RPM_PACKAGE_GROUP) - SET(CPACK_RPM_PACKAGE_GROUP "unknown") -ENDIF(NOT CPACK_RPM_PACKAGE_GROUP) +if(NOT CPACK_RPM_PACKAGE_GROUP) + set(CPACK_RPM_PACKAGE_GROUP "unknown") +endif() # CPACK_RPM_PACKAGE_VENDOR -IF(NOT CPACK_RPM_PACKAGE_VENDOR) - IF(CPACK_PACKAGE_VENDOR) - SET(CPACK_RPM_PACKAGE_VENDOR "${CPACK_PACKAGE_VENDOR}") - ELSE(CPACK_PACKAGE_VENDOR) - SET(CPACK_RPM_PACKAGE_VENDOR "unknown") - ENDIF(CPACK_PACKAGE_VENDOR) -ENDIF(NOT CPACK_RPM_PACKAGE_VENDOR) +if(NOT CPACK_RPM_PACKAGE_VENDOR) + if(CPACK_PACKAGE_VENDOR) + set(CPACK_RPM_PACKAGE_VENDOR "${CPACK_PACKAGE_VENDOR}") + else() + set(CPACK_RPM_PACKAGE_VENDOR "unknown") + endif() +endif() # CPACK_RPM_PACKAGE_SOURCE # The name of the source tarball in case we generate a source RPM @@ -407,103 +405,113 @@ ENDIF(NOT CPACK_RPM_PACKAGE_VENDOR) # if it is defined # - set to a default value # -IF (NOT CPACK_RPM_PACKAGE_DESCRIPTION) - IF (CPACK_PACKAGE_DESCRIPTION_FILE) - FILE(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_RPM_PACKAGE_DESCRIPTION) - ELSE (CPACK_PACKAGE_DESCRIPTION_FILE) - SET(CPACK_RPM_PACKAGE_DESCRIPTION "no package description available") - ENDIF (CPACK_PACKAGE_DESCRIPTION_FILE) -ENDIF (NOT CPACK_RPM_PACKAGE_DESCRIPTION) +if (NOT CPACK_RPM_PACKAGE_DESCRIPTION) + if (CPACK_PACKAGE_DESCRIPTION_FILE) + file(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_RPM_PACKAGE_DESCRIPTION) + else () + set(CPACK_RPM_PACKAGE_DESCRIPTION "no package description available") + endif () +endif () # CPACK_RPM_COMPRESSION_TYPE # -IF (CPACK_RPM_COMPRESSION_TYPE) - IF(CPACK_RPM_PACKAGE_DEBUG) - MESSAGE("CPackRPM:Debug: User Specified RPM compression type: ${CPACK_RPM_COMPRESSION_TYPE}") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) - IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma") - SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio") - ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma") - IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz") - SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio") - ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz") - IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2") - SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio") - ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2") - IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip") - SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio") - ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip") -ELSE(CPACK_RPM_COMPRESSION_TYPE) - SET(CPACK_RPM_COMPRESSION_TYPE_TMP "") -ENDIF(CPACK_RPM_COMPRESSION_TYPE) +if (CPACK_RPM_COMPRESSION_TYPE) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: User Specified RPM compression type: ${CPACK_RPM_COMPRESSION_TYPE}") + endif() + if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma") + set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio") + endif() + if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz") + set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio") + endif() + if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2") + set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio") + endif() + if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip") + set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio") + endif() +else() + set(CPACK_RPM_COMPRESSION_TYPE_TMP "") +endif() if(CPACK_PACKAGE_RELOCATABLE) set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE) -endif(CPACK_PACKAGE_RELOCATABLE) +endif() if(CPACK_RPM_PACKAGE_RELOCATABLE) if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: Trying to build a relocatable package") - endif(CPACK_RPM_PACKAGE_DEBUG) + endif() if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON")) message("CPackRPM:Warning: CPACK_SET_DESTDIR is set (=${CPACK_SET_DESTDIR}) while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.") - else(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON")) + else() set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) - endif(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON")) -endif(CPACK_RPM_PACKAGE_RELOCATABLE) + endif() +endif() # Check if additional fields for RPM spec header are given # There may be some COMPONENT specific variables as well -FOREACH(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV) - IF(CPACK_RPM_PACKAGE_DEBUG) +# If component specific var is not provided we use the global one +# for each component +foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV) + if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) + endif() if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}) - IF(CPACK_RPM_PACKAGE_DEBUG) + if(DEFINED CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}) + if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: using CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) + endif() set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}}) else() - IF(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER} not defined") - message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) - set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) + if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER} not defined") + message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") + endif() + set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) + endif() endif() else() - IF(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) - set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) + if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") + endif() + set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) + endif() endif() - IF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) - STRING(LENGTH ${_RPM_SPEC_HEADER} _PACKAGE_HEADER_STRLENGTH) - MATH(EXPR _PACKAGE_HEADER_STRLENGTH "${_PACKAGE_HEADER_STRLENGTH} - 1") - STRING(SUBSTRING ${_RPM_SPEC_HEADER} 1 ${_PACKAGE_HEADER_STRLENGTH} _PACKAGE_HEADER_TAIL) - STRING(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL) - STRING(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME) - SET(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}") - IF(CPACK_RPM_PACKAGE_DEBUG) - MESSAGE("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) - SET(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") - ELSE(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) + # Treat the RPM Spec keyword iff it has been properly defined + if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) + # Transform NAME --> Name e.g. PROVIDES --> Provides + # The Upper-case first letter and lowercase tail is the + # appropriate value required in the final RPM spec file. + string(LENGTH ${_RPM_SPEC_HEADER} _PACKAGE_HEADER_STRLENGTH) + math(EXPR _PACKAGE_HEADER_STRLENGTH "${_PACKAGE_HEADER_STRLENGTH} - 1") + string(SUBSTRING ${_RPM_SPEC_HEADER} 1 ${_PACKAGE_HEADER_STRLENGTH} _PACKAGE_HEADER_TAIL) + string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL) + string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME) + set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}") + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") + endif() + set(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") + else() # Do not forget to unset previously set header (from previous component) - UNSET(TMP_RPM_${_RPM_SPEC_HEADER}) - ENDIF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) -ENDFOREACH(_RPM_SPEC_HEADER) + unset(TMP_RPM_${_RPM_SPEC_HEADER}) + endif() +endforeach() # CPACK_RPM_SPEC_INSTALL_POST # May be used to define a RPM post intallation script # for example setting it to "/bin/true" may prevent # rpmbuild from stripping binaries. -IF(CPACK_RPM_SPEC_INSTALL_POST) - IF(CPACK_RPM_PACKAGE_DEBUG) - MESSAGE("CPackRPM:Debug: User defined CPACK_RPM_SPEC_INSTALL_POST = ${CPACK_RPM_SPEC_INSTALL_POST}") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) - SET(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}") -ENDIF(CPACK_RPM_SPEC_INSTALL_POST) +if(CPACK_RPM_SPEC_INSTALL_POST) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: User defined CPACK_RPM_SPEC_INSTALL_POST = ${CPACK_RPM_SPEC_INSTALL_POST}") + endif() + set(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}") +endif() # CPACK_RPM_POST_INSTALL_SCRIPT_FILE (or CPACK_RPM__POST_INSTALL_SCRIPT_FILE) # CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE (or CPACK_RPM__POST_UNINSTALL_SCRIPT_FILE) @@ -518,39 +526,39 @@ if(CPACK_RPM_PACKAGE_COMPONENT) endif() if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE) set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE}) - else(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE) + else() set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}) - endif(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE) -else(CPACK_RPM_PACKAGE_COMPONENT) + endif() +else() set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}) set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}) -endif(CPACK_RPM_PACKAGE_COMPONENT) +endif() # Handle post-install file if it has been specified if(CPACK_RPM_POST_INSTALL_READ_FILE) if(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE}) file(READ ${CPACK_RPM_POST_INSTALL_READ_FILE} CPACK_RPM_SPEC_POSTINSTALL) - else(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE}) + else() message("CPackRPM:Warning: CPACK_RPM_POST_INSTALL_SCRIPT_FILE <${CPACK_RPM_POST_INSTALL_READ_FILE}> does not exists - ignoring") - endif(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE}) -else(CPACK_RPM_POST_INSTALL_READ_FILE) + endif() +else() # reset SPEC var value if no post install file has been specified # (either globally or component-wise) set(CPACK_RPM_SPEC_POSTINSTALL "") -endif(CPACK_RPM_POST_INSTALL_READ_FILE) +endif() # Handle post-uninstall file if it has been specified if(CPACK_RPM_POST_UNINSTALL_READ_FILE) if(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE}) file(READ ${CPACK_RPM_POST_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_POSTUNINSTALL) - else(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE}) + else() message("CPackRPM:Warning: CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_POST_UNINSTALL_READ_FILE}> does not exists - ignoring") - endif(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE}) -else(CPACK_RPM_POST_UNINSTALL_READ_FILE) + endif() +else() # reset SPEC var value if no post uninstall file has been specified # (either globally or component-wise) set(CPACK_RPM_SPEC_POSTUNINSTALL "") -endif(CPACK_RPM_POST_UNINSTALL_READ_FILE) +endif() # CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM__PRE_INSTALL_SCRIPT_FILE) # CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE (or CPACK_RPM__PRE_UNINSTALL_SCRIPT_FILE) @@ -560,44 +568,44 @@ endif(CPACK_RPM_POST_UNINSTALL_READ_FILE) if(CPACK_RPM_PACKAGE_COMPONENT) if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE) set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE}) - else(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE) + else() set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}) - endif(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE) + endif() if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE) set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE}) - else(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE) + else() set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) - endif(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE) -else(CPACK_RPM_PACKAGE_COMPONENT) + endif() +else() set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}) set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) -endif(CPACK_RPM_PACKAGE_COMPONENT) +endif() # Handle pre-install file if it has been specified if(CPACK_RPM_PRE_INSTALL_READ_FILE) if(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE}) file(READ ${CPACK_RPM_PRE_INSTALL_READ_FILE} CPACK_RPM_SPEC_PREINSTALL) - else(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE}) + else() message("CPackRPM:Warning: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_INSTALL_READ_FILE}> does not exists - ignoring") - endif(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE}) -else(CPACK_RPM_PRE_INSTALL_READ_FILE) + endif() +else() # reset SPEC var value if no pre-install file has been specified # (either globally or component-wise) set(CPACK_RPM_SPEC_PREINSTALL "") -endif(CPACK_RPM_PRE_INSTALL_READ_FILE) +endif() # Handle pre-uninstall file if it has been specified if(CPACK_RPM_PRE_UNINSTALL_READ_FILE) if(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE}) file(READ ${CPACK_RPM_PRE_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_PREUNINSTALL) - else(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE}) + else() message("CPackRPM:Warning: CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_UNINSTALL_READ_FILE}> does not exists - ignoring") - endif(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE}) -else(CPACK_RPM_PRE_UNINSTALL_READ_FILE) + endif() +else() # reset SPEC var value if no pre-uninstall file has been specified # (either globally or component-wise) set(CPACK_RPM_SPEC_PREUNINSTALL "") -endif(CPACK_RPM_PRE_UNINSTALL_READ_FILE) +endif() # CPACK_RPM_CHANGELOG_FILE # May be used to embed a changelog in the spec file. @@ -605,39 +613,58 @@ endif(CPACK_RPM_PRE_UNINSTALL_READ_FILE) if(CPACK_RPM_CHANGELOG_FILE) if(EXISTS ${CPACK_RPM_CHANGELOG_FILE}) file(READ ${CPACK_RPM_CHANGELOG_FILE} CPACK_RPM_SPEC_CHANGELOG) - else(EXISTS ${CPACK_RPM_CHANGELOG_FILE}) + else() message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exists - ignoring") - endif(EXISTS ${CPACK_RPM_CHANGELOG_FILE}) -else(CPACK_RPM_CHANGELOG_FILE) + endif() +else() set(CPACK_RPM_SPEC_CHANGELOG "* Sun Jul 4 2010 Erk \n Generated by CPack RPM (no Changelog file were provided)") -endif(CPACK_RPM_CHANGELOG_FILE) +endif() # CPACK_RPM_SPEC_MORE_DEFINE # This is a generated spec rpm file spaceholder -IF(CPACK_RPM_SPEC_MORE_DEFINE) - IF(CPACK_RPM_PACKAGE_DEBUG) - MESSAGE("CPackRPM:Debug: User defined more define spec line specified:\n ${CPACK_RPM_SPEC_MORE_DEFINE}") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) -ENDIF(CPACK_RPM_SPEC_MORE_DEFINE) +if(CPACK_RPM_SPEC_MORE_DEFINE) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: User defined more define spec line specified:\n ${CPACK_RPM_SPEC_MORE_DEFINE}") + endif() +endif() # Now we may create the RPM build tree structure -SET(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}") -MESSAGE(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}") +set(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}") +message(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}") # Prepare RPM build tree -FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}) -FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/tmp) -FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/BUILD) -FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/RPMS) -FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SOURCES) -FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SPECS) -FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SRPMS) - -#SET(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") -SET(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") +file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}) +file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/tmp) +file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/BUILD) +file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/RPMS) +file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SOURCES) +file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SPECS) +file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SRPMS) + +#set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") +set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") # it seems rpmbuild can't handle spaces in the path # neither escaping (as below) nor putting quotes around the path seem to help -#STRING(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") -SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") +#string(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") +set(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") + +# if we are creating a relocatable package, omit parent directories of +# CPACK_RPM_PACKAGE_PREFIX. This is achieved by building a "filter list" +# which is passed to the find command that generates the content-list +if(CPACK_RPM_PACKAGE_RELOCATABLE) + # get a list of the elements in CPACK_RPM_PACKAGE_PREFIX and remove + # the final element (so the install-prefix dir itself is not omitted + # from the RPM's content-list) + string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${CPACK_RPM_PACKAGE_PREFIX}") + list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) + # Now generate all of the parent dirs of CPACK_RPM_PACKAGE_PREFIX + foreach(_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS}) + list(APPEND _TMP_LIST "${_ELEM}") + string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}") + set(_OMIT_DIR "-o -path ${_OMIT_DIR}") + separate_arguments(_OMIT_DIR) + list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR}) + endforeach() +endif() # Use files tree to construct files command (spec file) # We should not forget to include symlinks (thus -o -type l) @@ -647,7 +674,7 @@ SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") # file name by enclosing it between double quotes (thus the sed) # Then we must authorize any man pages extension (adding * at the end) # because rpmbuild may automatically compress those files -EXECUTE_PROCESS(COMMAND find . -type f -o -type l -o (-type d -a -not -name ".") +execute_process(COMMAND find . -type f -o -type l -o (-type d -a -not ( -name "." ${_RPM_DIRS_TO_OMIT} ) ) COMMAND sed s:.*/man.*/.*:&*: COMMAND sed s/\\.\\\(.*\\\)/\"\\1\"/ WORKING_DIRECTORY "${WDIR}" @@ -664,7 +691,7 @@ if(CPACK_RPM_PACKAGE_COMPONENT) if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: Handling Absolute Destination Files: <${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}>") message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") - endif(CPACK_RPM_PACKAGE_DEBUG) + endif() endif() else() if(CPACK_ABSOLUTE_DESTINATION_FILES) @@ -679,7 +706,7 @@ if(CPACK_RPM_PACKAGE_COMPONENT) if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>") message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") - endif(CPACK_RPM_PACKAGE_DEBUG) + endif() else() set(CPACK_RPM_USER_FILELIST_INTERNAL "") endif() @@ -696,9 +723,9 @@ endif() # or CPACK_RPM_INSTALL_FILES, # hence it must be done before these auto-generated lists are processed. if(CPACK_RPM_USER_FILELIST_INTERNAL) - IF(CPACK_RPM_PACKAGE_DEBUG) + if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) + endif() # Create CMake list from CPACK_RPM_INSTALL_FILES string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) @@ -709,18 +736,24 @@ if(CPACK_RPM_USER_FILELIST_INTERNAL) set(CPACK_RPM_USER_INSTALL_FILES "") foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL) - string(REGEX REPLACE "%[A-Za-z\(\)]* " "" F_PATH ${F}) - string(REGEX MATCH "%[A-Za-z\(\)]*" F_PREFIX ${F}) + string(REGEX REPLACE "%[A-Za-z0-9\(\),-]* " "" F_PATH ${F}) + string(REGEX MATCH "%[A-Za-z0-9\(\),-]*" F_PREFIX ${F}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>") + endif() if(F_PREFIX) - set(F_PREFIX "${F_PREFIX} ") + set(F_PREFIX "${F_PREFIX} ") endif() # Rebuild the user list file set(CPACK_RPM_USER_INSTALL_FILES "${CPACK_RPM_USER_INSTALL_FILES}${F_PREFIX}\"${F_PATH}\"\n") # Remove from CPACK_RPM_INSTALL_FILES and CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${F_PATH}) - list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH}) + # ABSOLUTE destination files list may not exists at all + if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) + list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH}) + endif() endforeach() @@ -728,15 +761,15 @@ if(CPACK_RPM_USER_FILELIST_INTERNAL) set(CPACK_RPM_INSTALL_FILES "") foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") - endforeach(F) + endforeach() else() set(CPACK_RPM_USER_INSTALL_FILES "") endif() if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) - IF(CPACK_RPM_PACKAGE_DEBUG) + if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: Handling Absolute Destination Files: ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) + endif() # Remove trailing space string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) # Transform endline separated - string into CMake List @@ -749,20 +782,20 @@ if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) set(CPACK_RPM_INSTALL_FILES "") foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") - endforeach(F) + endforeach() # Build ABSOLUTE_INSTALL_FILES set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") foreach(F IN LISTS CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "${CPACK_RPM_ABSOLUTE_INSTALL_FILES}%config \"${F}\"\n") - endforeach(F) - IF(CPACK_RPM_PACKAGE_DEBUG) + endforeach() + if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: CPACK_RPM_ABSOLUTE_INSTALL_FILES=${CPACK_RPM_ABSOLUTE_INSTALL_FILES}") message("CPackRPM:Debug: CPACK_RPM_INSTALL_FILES=${CPACK_RPM_INSTALL_FILES}") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) + endif() else() # reset vars in order to avoid leakage of value(s) from one component to another set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") -endif(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) +endif() # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir # This is necessary to avoid duplicate files since rpmbuild do @@ -780,32 +813,32 @@ foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) else() set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") endif() -endforeach(F) +endforeach() set(CPACK_RPM_INSTALL_FILES_LIST "") # The name of the final spec file to be used by rpmbuild -SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") +set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") # Print out some debug information if we were asked for that -IF(CPACK_RPM_PACKAGE_DEBUG) - MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") - MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") - MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") - MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") - MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") - MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") - MESSAGE("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}") - MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") - MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") -ENDIF(CPACK_RPM_PACKAGE_DEBUG) +if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") + message("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") + message("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") + message("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") + message("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") + message("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") + message("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}") + message("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") + message("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") +endif() # USER generated spec file handling. # We should generate a spec file template: # - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE # - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE # -IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) - FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in +if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) + file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in "# -*- rpm-spec -*- BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH\@ Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ @@ -879,28 +912,28 @@ ${CPACK_RPM_USER_INSTALL_FILES} # Stop here if we were asked to only generate a template USER spec file # The generated file may then be used as a template by user who wants # to customize their own spec file. - IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE) - MESSAGE(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in") - ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE) -ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) + if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE) + message(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in") + endif() +endif() # After that we may either use a user provided spec file # or generate one using appropriate variables value. -IF(CPACK_RPM_USER_BINARY_SPECFILE) +if(CPACK_RPM_USER_BINARY_SPECFILE) # User may have specified SPECFILE just use it - MESSAGE("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}") + message("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}") # The user provided file is processed for @var replacement - CONFIGURE_FILE(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY) -ELSE(CPACK_RPM_USER_BINARY_SPECFILE) + configure_file(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY) +else() # No User specified spec file, will use the generated spec file - MESSAGE("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}") + message("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}") # Note the just created file is processed for @var replacement - CONFIGURE_FILE(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY) -ENDIF(CPACK_RPM_USER_BINARY_SPECFILE) + configure_file(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY) +endif() -IF(RPMBUILD_EXECUTABLE) +if(RPMBUILD_EXECUTABLE) # Now call rpmbuild using the SPECFILE - EXECUTE_PROCESS( + execute_process( COMMAND "${RPMBUILD_EXECUTABLE}" -bb --define "_topdir ${CPACK_RPM_DIRECTORY}" --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" @@ -909,17 +942,17 @@ IF(RPMBUILD_EXECUTABLE) RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err" OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") - IF(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT) - FILE(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err RPMBUILDERR) - FILE(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out RPMBUILDOUT) - MESSAGE("CPackRPM:Debug: You may consult rpmbuild logs in: ") - MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err") - MESSAGE("CPackRPM:Debug: *** ${RPMBUILDERR} ***") - MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") - MESSAGE("CPackRPM:Debug: *** ${RPMBUILDERR} ***") - ENDIF(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT) -ELSE(RPMBUILD_EXECUTABLE) - IF(ALIEN_EXECUTABLE) - MESSAGE(FATAL_ERROR "RPM packaging through alien not done (yet)") - ENDIF(ALIEN_EXECUTABLE) -ENDIF(RPMBUILD_EXECUTABLE) + if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT) + file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err RPMBUILDERR) + file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out RPMBUILDOUT) + message("CPackRPM:Debug: You may consult rpmbuild logs in: ") + message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err") + message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") + message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") + message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") + endif() +else() + if(ALIEN_EXECUTABLE) + message(FATAL_ERROR "RPM packaging through alien not done (yet)") + endif() +endif() diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake new file mode 100644 index 000000000..0c0a8f19f --- /dev/null +++ b/Modules/CPackWIX.cmake @@ -0,0 +1,109 @@ +##section Variables specific to CPack WiX generator +##end +##module +# - CPack WiX generator specific options +# +# The following variables are specific to the installers built +# on Windows using WiX. +##end +##variable +# CPACK_WIX_UPGRADE_GUID - Upgrade GUID (Product/@UpgradeCode) +# +# Will be automatically generated unless explicitly provided. +# +# It should be explicitly set to a constant generated +# gloabally unique identifier (GUID) to allow your installers +# to replace existing installations that use the same GUID. +# +# You may for example explicitly set this variable in +# your CMakeLists.txt to the value that has been generated per default. +# You should not use GUIDs that you did not generate yourself or which may +# belong to other projects. +# +# A GUID shall have the following fixed length syntax: +# XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +# (each X represents an uppercase hexadecimal digit) +##end +##variable +# CPACK_WIX_PRODUCT_GUID - Product GUID (Product/@Id) +# +# Will be automatically generated unless explicitly provided. +# +# If explicitly provided this will set the Product Id of your installer. +# +# The installer will abort if it detects a pre-existing installation that uses +# the same GUID. +# +# The GUID shall use the syntax described for CPACK_WIX_UPGRADE_GUID. +##end +##variable +# CPACK_WIX_LICENSE_RTF - RTF License File +# +# If CPACK_RESOURCE_FILE_LICENSE has an .rtf extension +# it is used as-is. +# +# If CPACK_RESOURCE_FILE_LICENSE has an .txt extension +# it is implicitly converted to RTF by the WiX Generator. +# +# With CPACK_WIX_LICENSE_RTF you can override the license file used +# by the WiX Generator in case CPACK_RESOURCE_FILE_LICENSE +# is in an unsupported format or the .txt -> .rtf +# conversion does not work as expected. +# +##end +# +##variable +# CPACK_WIX_PRODUCT_ICON - The Icon shown next to the program name in Add/Remove programs. +# +# If set, this icon is used in place of the default icon. +# +##end +# +##variable +# CPACK_WIX_UI_BANNER - The bitmap will appear at the top of all installer pages other than the welcome and completion dialogs. +# +# If set, this image will replace the default banner image. +# +# This image must be 493 by 58 pixels. +# +##end +# +##variable +# CPACK_WIX_UI_DIALOG - Background bitmap used on the welcome and completion dialogs. +# +# If this variable is set, the installer will replace the default dialog image. +# +# This image must be 493 by 312 pixels. +# +##end + +#============================================================================= +# Copyright 2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +if(NOT CPACK_WIX_ROOT) + file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT) +endif() + +find_program(CPACK_WIX_CANDLE_EXECUTABLE candle + PATHS "${CPACK_WIX_ROOT}/bin") + +if(NOT CPACK_WIX_CANDLE_EXECUTABLE) + message(FATAL_ERROR "Could not find the WiX candle executable.") +endif() + +find_program(CPACK_WIX_LIGHT_EXECUTABLE light + PATHS "${CPACK_WIX_ROOT}/bin") + +if(NOT CPACK_WIX_LIGHT_EXECUTABLE) + message(FATAL_ERROR "Could not find the WiX light executable.") +endif() diff --git a/Modules/CPackZIP.cmake b/Modules/CPackZIP.cmake index 99963cf91..a36589bd6 100644 --- a/Modules/CPackZIP.cmake +++ b/Modules/CPackZIP.cmake @@ -12,30 +12,30 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF(CMAKE_BINARY_DIR) - MESSAGE(FATAL_ERROR "CPackZIP.cmake may only be used by CPack internally.") -ENDIF(CMAKE_BINARY_DIR) +if(CMAKE_BINARY_DIR) + message(FATAL_ERROR "CPackZIP.cmake may only be used by CPack internally.") +endif() -FIND_PROGRAM(ZIP_EXECUTABLE wzzip PATHS "$ENV{ProgramFiles}/WinZip") -IF(ZIP_EXECUTABLE) - SET(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" -P \"\" @") - SET(CPACK_ZIP_NEED_QUOTES TRUE) -ENDIF(ZIP_EXECUTABLE) +find_program(ZIP_EXECUTABLE wzzip PATHS "$ENV{ProgramFiles}/WinZip") +if(ZIP_EXECUTABLE) + set(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" -P \"\" @") + set(CPACK_ZIP_NEED_QUOTES TRUE) +endif() -IF(NOT ZIP_EXECUTABLE) - FIND_PROGRAM(ZIP_EXECUTABLE 7z PATHS "$ENV{ProgramFiles}/7-Zip") - IF(ZIP_EXECUTABLE) - SET(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" a -tzip \"\" @") - SET(CPACK_ZIP_NEED_QUOTES TRUE) - ENDIF(ZIP_EXECUTABLE) -ENDIF(NOT ZIP_EXECUTABLE) +if(NOT ZIP_EXECUTABLE) + find_program(ZIP_EXECUTABLE 7z PATHS "$ENV{ProgramFiles}/7-Zip") + if(ZIP_EXECUTABLE) + set(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" a -tzip \"\" @") + set(CPACK_ZIP_NEED_QUOTES TRUE) + endif() +endif() -IF(NOT ZIP_EXECUTABLE) - FIND_PACKAGE(Cygwin) - FIND_PROGRAM(ZIP_EXECUTABLE zip PATHS "${CYGWIN_INSTALL_PATH}/bin") - IF(ZIP_EXECUTABLE) - SET(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" -r \"\" . -i@") - SET(CPACK_ZIP_NEED_QUOTES FALSE) - ENDIF(ZIP_EXECUTABLE) -ENDIF(NOT ZIP_EXECUTABLE) +if(NOT ZIP_EXECUTABLE) + find_package(Cygwin) + find_program(ZIP_EXECUTABLE zip PATHS "${CYGWIN_INSTALL_PATH}/bin") + if(ZIP_EXECUTABLE) + set(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" -r \"\" . -i@") + set(CPACK_ZIP_NEED_QUOTES FALSE) + endif() +endif() diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index ec9dbeb79..562e2486c 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -58,46 +58,48 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -OPTION(BUILD_TESTING "Build the testing tree." ON) +option(BUILD_TESTING "Build the testing tree." ON) # function to turn generator name into a version string -# like vs7 vs71 vs8 vs9 -FUNCTION(GET_VS_VERSION_STRING generator var) - STRING(REGEX REPLACE "Visual Studio ([0-9][0-9]?)($|.*)" "\\1" +# like vs7 vs71 vs8 vs9 +function(GET_VS_VERSION_STRING generator var) + string(REGEX REPLACE "Visual Studio ([0-9][0-9]?)($|.*)" "\\1" NUMBER "${generator}") - IF("${generator}" MATCHES "Visual Studio 7 .NET 2003") - SET(ver_string "vs71") - ELSE("${generator}" MATCHES "Visual Studio 7 .NET 2003") - SET(ver_string "vs${NUMBER}") - ENDIF("${generator}" MATCHES "Visual Studio 7 .NET 2003") - SET(${var} ${ver_string} PARENT_SCOPE) -ENDFUNCTION(GET_VS_VERSION_STRING) + if("${generator}" MATCHES "Visual Studio 7 .NET 2003") + set(ver_string "vs71") + else() + set(ver_string "vs${NUMBER}") + endif() + set(${var} ${ver_string} PARENT_SCOPE) +endfunction() -IF(BUILD_TESTING) +include(CTestUseLaunchers) + +if(BUILD_TESTING) # Setup some auxilary macros - MACRO(SET_IF_NOT_SET var val) - IF(NOT DEFINED "${var}") - SET("${var}" "${val}") - ENDIF(NOT DEFINED "${var}") - ENDMACRO(SET_IF_NOT_SET) + macro(SET_IF_NOT_SET var val) + if(NOT DEFINED "${var}") + set("${var}" "${val}") + endif() + endmacro() - MACRO(SET_IF_SET var val) - IF(NOT "${val}" MATCHES "^$") - SET("${var}" "${val}") - ENDIF(NOT "${val}" MATCHES "^$") - ENDMACRO(SET_IF_SET) + macro(SET_IF_SET var val) + if(NOT "${val}" MATCHES "^$") + set("${var}" "${val}") + endif() + endmacro() - MACRO(SET_IF_SET_AND_NOT_SET var val) - IF(NOT "${val}" MATCHES "^$") + macro(SET_IF_SET_AND_NOT_SET var val) + if(NOT "${val}" MATCHES "^$") SET_IF_NOT_SET("${var}" "${val}") - ENDIF(NOT "${val}" MATCHES "^$") - ENDMACRO(SET_IF_SET_AND_NOT_SET) + endif() + endmacro() # Make sure testing is enabled - ENABLE_TESTING() + enable_testing() - IF(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake") - INCLUDE("${PROJECT_SOURCE_DIR}/CTestConfig.cmake") + if(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake") + include("${PROJECT_SOURCE_DIR}/CTestConfig.cmake") SET_IF_SET_AND_NOT_SET(NIGHTLY_START_TIME "${CTEST_NIGHTLY_START_TIME}") SET_IF_SET_AND_NOT_SET(DROP_METHOD "${CTEST_DROP_METHOD}") SET_IF_SET_AND_NOT_SET(DROP_SITE "${CTEST_DROP_SITE}") @@ -107,155 +109,143 @@ IF(BUILD_TESTING) SET_IF_SET_AND_NOT_SET(DROP_LOCATION "${CTEST_DROP_LOCATION}") SET_IF_SET_AND_NOT_SET(TRIGGER_SITE "${CTEST_TRIGGER_SITE}") SET_IF_SET_AND_NOT_SET(UPDATE_TYPE "${CTEST_UPDATE_TYPE}") - ENDIF(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake") + endif() # the project can have a DartConfig.cmake file - IF(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake") - INCLUDE("${PROJECT_SOURCE_DIR}/DartConfig.cmake") - ELSE(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake") + if(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake") + include("${PROJECT_SOURCE_DIR}/DartConfig.cmake") + else() # Dashboard is opened for submissions for a 24 hour period starting at # the specified NIGHTLY_START_TIME. Time is specified in 24 hour format. SET_IF_NOT_SET (NIGHTLY_START_TIME "00:00:00 EDT") SET_IF_NOT_SET(DROP_METHOD "http") SET_IF_NOT_SET (COMPRESS_SUBMISSION ON) - ENDIF(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake") + endif() SET_IF_NOT_SET (NIGHTLY_START_TIME "00:00:00 EDT") - FIND_PROGRAM(CVSCOMMAND cvs ) - SET(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING + find_program(CVSCOMMAND cvs ) + set(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING "Options passed to the cvs update command.") - FIND_PROGRAM(SVNCOMMAND svn) - FIND_PROGRAM(BZRCOMMAND bzr) - FIND_PROGRAM(HGCOMMAND hg) - FIND_PROGRAM(GITCOMMAND git) + find_program(SVNCOMMAND svn) + find_program(BZRCOMMAND bzr) + find_program(HGCOMMAND hg) + find_program(GITCOMMAND git) - IF(NOT UPDATE_TYPE) - IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS") - SET(UPDATE_TYPE cvs) - ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn") - SET(UPDATE_TYPE svn) - ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr") - SET(UPDATE_TYPE bzr) - ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.hg") - SET(UPDATE_TYPE hg) - ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") - SET(UPDATE_TYPE git) - ENDIF() - ENDIF(NOT UPDATE_TYPE) + if(NOT UPDATE_TYPE) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS") + set(UPDATE_TYPE cvs) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn") + set(UPDATE_TYPE svn) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr") + set(UPDATE_TYPE bzr) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.hg") + set(UPDATE_TYPE hg) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") + set(UPDATE_TYPE git) + endif() + endif() - STRING(TOLOWER "${UPDATE_TYPE}" _update_type) - IF("${_update_type}" STREQUAL "cvs") - SET(UPDATE_COMMAND "${CVSCOMMAND}") - SET(UPDATE_OPTIONS "${CVS_UPDATE_OPTIONS}") - ELSEIF("${_update_type}" STREQUAL "svn") - SET(UPDATE_COMMAND "${SVNCOMMAND}") - SET(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}") - ELSEIF("${_update_type}" STREQUAL "bzr") - SET(UPDATE_COMMAND "${BZRCOMMAND}") - SET(UPDATE_OPTIONS "${BZR_UPDATE_OPTIONS}") - ELSEIF("${_update_type}" STREQUAL "hg") - SET(UPDATE_COMMAND "${HGCOMMAND}") - SET(UPDATE_OPTIONS "${HG_UPDATE_OPTIONS}") - ELSEIF("${_update_type}" STREQUAL "git") - SET(UPDATE_COMMAND "${GITCOMMAND}") - SET(UPDATE_OPTIONS "${GIT_UPDATE_OPTIONS}") - ENDIF() + string(TOLOWER "${UPDATE_TYPE}" _update_type) + if("${_update_type}" STREQUAL "cvs") + set(UPDATE_COMMAND "${CVSCOMMAND}") + set(UPDATE_OPTIONS "${CVS_UPDATE_OPTIONS}") + elseif("${_update_type}" STREQUAL "svn") + set(UPDATE_COMMAND "${SVNCOMMAND}") + set(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}") + elseif("${_update_type}" STREQUAL "bzr") + set(UPDATE_COMMAND "${BZRCOMMAND}") + set(UPDATE_OPTIONS "${BZR_UPDATE_OPTIONS}") + elseif("${_update_type}" STREQUAL "hg") + set(UPDATE_COMMAND "${HGCOMMAND}") + set(UPDATE_OPTIONS "${HG_UPDATE_OPTIONS}") + elseif("${_update_type}" STREQUAL "git") + set(UPDATE_COMMAND "${GITCOMMAND}") + set(UPDATE_OPTIONS "${GIT_UPDATE_OPTIONS}") + endif() - SET(DART_TESTING_TIMEOUT 1500 CACHE STRING + set(DART_TESTING_TIMEOUT 1500 CACHE STRING "Maximum time allowed before CTest will kill the test.") - SET(CTEST_SUBMIT_RETRY_DELAY 5 CACHE STRING + set(CTEST_SUBMIT_RETRY_DELAY 5 CACHE STRING "How long to wait between timed-out CTest submissions.") - SET(CTEST_SUBMIT_RETRY_COUNT 3 CACHE STRING + set(CTEST_SUBMIT_RETRY_COUNT 3 CACHE STRING "How many times to retry timed-out CTest submissions.") - FIND_PROGRAM(MEMORYCHECK_COMMAND + find_program(MEMORYCHECK_COMMAND NAMES purify valgrind boundscheck PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]" DOC "Path to the memory checking command, used for memory error detection." ) - FIND_PROGRAM(SLURM_SBATCH_COMMAND sbatch DOC + find_program(SLURM_SBATCH_COMMAND sbatch DOC "Path to the SLURM sbatch executable" ) - FIND_PROGRAM(SLURM_SRUN_COMMAND srun DOC + find_program(SLURM_SRUN_COMMAND srun DOC "Path to the SLURM srun executable" ) - SET(MEMORYCHECK_SUPPRESSIONS_FILE "" CACHE FILEPATH + set(MEMORYCHECK_SUPPRESSIONS_FILE "" CACHE FILEPATH "File that contains suppressions for the memory checker") - FIND_PROGRAM(SCPCOMMAND scp DOC + find_program(SCPCOMMAND scp DOC "Path to scp command, used by CTest for submitting results to a Dart server" ) - FIND_PROGRAM(COVERAGE_COMMAND gcov DOC + find_program(COVERAGE_COMMAND gcov DOC "Path to the coverage program that CTest uses for performing coverage inspection" ) - SET(COVERAGE_EXTRA_FLAGS "-l" CACHE STRING + set(COVERAGE_EXTRA_FLAGS "-l" CACHE STRING "Extra command line flags to pass to the coverage tool") # set the site name - SITE_NAME(SITE) + site_name(SITE) # set the build name - IF(NOT BUILDNAME) - SET(DART_COMPILER "${CMAKE_CXX_COMPILER}") - IF(NOT DART_COMPILER) - SET(DART_COMPILER "${CMAKE_C_COMPILER}") - ENDIF(NOT DART_COMPILER) - IF(NOT DART_COMPILER) - SET(DART_COMPILER "unknown") - ENDIF(NOT DART_COMPILER) - IF(WIN32) - SET(DART_NAME_COMPONENT "NAME_WE") - ELSE(WIN32) - SET(DART_NAME_COMPONENT "NAME") - ENDIF(WIN32) - IF(NOT BUILD_NAME_SYSTEM_NAME) - SET(BUILD_NAME_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") - ENDIF(NOT BUILD_NAME_SYSTEM_NAME) - IF(WIN32) - SET(BUILD_NAME_SYSTEM_NAME "Win32") - ENDIF(WIN32) - IF(UNIX OR BORLAND) - GET_FILENAME_COMPONENT(DART_CXX_NAME + if(NOT BUILDNAME) + set(DART_COMPILER "${CMAKE_CXX_COMPILER}") + if(NOT DART_COMPILER) + set(DART_COMPILER "${CMAKE_C_COMPILER}") + endif() + if(NOT DART_COMPILER) + set(DART_COMPILER "unknown") + endif() + if(WIN32) + set(DART_NAME_COMPONENT "NAME_WE") + else() + set(DART_NAME_COMPONENT "NAME") + endif() + if(NOT BUILD_NAME_SYSTEM_NAME) + set(BUILD_NAME_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") + endif() + if(WIN32) + set(BUILD_NAME_SYSTEM_NAME "Win32") + endif() + if(UNIX OR BORLAND) + get_filename_component(DART_CXX_NAME "${CMAKE_CXX_COMPILER}" ${DART_NAME_COMPONENT}) - ELSE(UNIX OR BORLAND) - GET_FILENAME_COMPONENT(DART_CXX_NAME + else() + get_filename_component(DART_CXX_NAME "${CMAKE_BUILD_TOOL}" ${DART_NAME_COMPONENT}) - ENDIF(UNIX OR BORLAND) - IF(DART_CXX_NAME MATCHES "msdev") - SET(DART_CXX_NAME "vs60") - ENDIF(DART_CXX_NAME MATCHES "msdev") - IF(DART_CXX_NAME MATCHES "devenv") + endif() + if(DART_CXX_NAME MATCHES "msdev") + set(DART_CXX_NAME "vs60") + endif() + if(DART_CXX_NAME MATCHES "devenv") GET_VS_VERSION_STRING("${CMAKE_GENERATOR}" DART_CXX_NAME) - ENDIF(DART_CXX_NAME MATCHES "devenv") - SET(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_CXX_NAME}") - ENDIF(NOT BUILDNAME) + endif() + set(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_CXX_NAME}") + endif() # the build command - BUILD_COMMAND(MAKECOMMAND_DEFAULT_VALUE + build_command(MAKECOMMAND_DEFAULT_VALUE CONFIGURATION "\${CTEST_CONFIGURATION_TYPE}") - SET(MAKECOMMAND ${MAKECOMMAND_DEFAULT_VALUE} + set(MAKECOMMAND ${MAKECOMMAND_DEFAULT_VALUE} CACHE STRING "Command to build the project") # the default build configuration the ctest build handler will use # if there is no -C arg given to ctest: - SET(DEFAULT_CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") - IF(DEFAULT_CTEST_CONFIGURATION_TYPE STREQUAL "") - SET(DEFAULT_CTEST_CONFIGURATION_TYPE "Release") - ENDIF(DEFAULT_CTEST_CONFIGURATION_TYPE STREQUAL "") - - IF(NOT "${CMAKE_GENERATOR}" MATCHES "Make") - SET(CTEST_USE_LAUNCHERS 0) - ENDIF(NOT "${CMAKE_GENERATOR}" MATCHES "Make") - IF(CTEST_USE_LAUNCHERS) - SET(CTEST_LAUNCH_COMPILE "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name --build-dir --output --source --language --") - SET(CTEST_LAUNCH_LINK "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name --build-dir --output --target-type --language --") - SET(CTEST_LAUNCH_CUSTOM "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name --build-dir --output --") - SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CTEST_LAUNCH_COMPILE}") - SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CTEST_LAUNCH_LINK}") - SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_CUSTOM "${CTEST_LAUNCH_CUSTOM}") - ENDIF(CTEST_USE_LAUNCHERS) + set(DEFAULT_CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") + if(DEFAULT_CTEST_CONFIGURATION_TYPE STREQUAL "") + set(DEFAULT_CTEST_CONFIGURATION_TYPE "Release") + endif() - MARK_AS_ADVANCED( + mark_as_advanced( BZRCOMMAND BZR_UPDATE_OPTIONS COVERAGE_COMMAND @@ -267,7 +257,7 @@ IF(BUILD_TESTING) DART_TESTING_TIMEOUT GITCOMMAND HGCOMMAND - MAKECOMMAND + MAKECOMMAND MEMORYCHECK_COMMAND MEMORYCHECK_SUPPRESSIONS_FILE PURIFYCOMMAND @@ -278,9 +268,9 @@ IF(BUILD_TESTING) SVNCOMMAND SVN_UPDATE_OPTIONS ) - IF(NOT RUN_FROM_DART) - SET(RUN_FROM_CTEST_OR_DART 1) - INCLUDE(CTestTargets) - SET(RUN_FROM_CTEST_OR_DART) - ENDIF(NOT RUN_FROM_DART) -ENDIF(BUILD_TESTING) + if(NOT RUN_FROM_DART) + set(RUN_FROM_CTEST_OR_DART 1) + include(CTestTargets) + set(RUN_FROM_CTEST_OR_DART) + endif() +endif() diff --git a/Modules/CTestScriptMode.cmake b/Modules/CTestScriptMode.cmake index e459c1d59..42d3764cb 100644 --- a/Modules/CTestScriptMode.cmake +++ b/Modules/CTestScriptMode.cmake @@ -14,7 +14,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -# Determine the current system, so this information can be used +# Determine the current system, so this information can be used # in ctest scripts include(CMakeDetermineSystem) diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake index bc4d9646a..5b6e062d0 100644 --- a/Modules/CTestTargets.cmake +++ b/Modules/CTestTargets.cmake @@ -12,29 +12,33 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF(NOT RUN_FROM_CTEST_OR_DART) - MESSAGE(FATAL_ERROR "Do not incldue CTestTargets.cmake directly") -ENDIF(NOT RUN_FROM_CTEST_OR_DART) +if(NOT RUN_FROM_CTEST_OR_DART) + message(FATAL_ERROR "Do not incldue CTestTargets.cmake directly") +endif() + +if(NOT PROJECT_BINARY_DIR) + message(FATAL_ERROR "Do not include(CTest) before calling project().") +endif() # make directories in the binary tree -FILE(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/Testing/Temporary) -GET_FILENAME_COMPONENT(CMAKE_HOST_PATH ${CMAKE_COMMAND} PATH) -SET(CMAKE_TARGET_PATH ${EXECUTABLE_OUTPUT_PATH}) -FIND_PROGRAM(CMAKE_CTEST_COMMAND ctest ${CMAKE_HOST_PATH} ${CMAKE_TARGET_PATH}) -MARK_AS_ADVANCED(CMAKE_CTEST_COMMAND) +file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/Testing/Temporary) +get_filename_component(CMAKE_HOST_PATH ${CMAKE_COMMAND} PATH) +set(CMAKE_TARGET_PATH ${EXECUTABLE_OUTPUT_PATH}) +find_program(CMAKE_CTEST_COMMAND ctest ${CMAKE_HOST_PATH} ${CMAKE_TARGET_PATH}) +mark_as_advanced(CMAKE_CTEST_COMMAND) # Use CTest # configure files -IF(CTEST_NEW_FORMAT) - CONFIGURE_FILE( +if(CTEST_NEW_FORMAT) + configure_file( ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in ${PROJECT_BINARY_DIR}/CTestConfiguration.ini ) -ELSE(CTEST_NEW_FORMAT) - CONFIGURE_FILE( +else() + configure_file( ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in ${PROJECT_BINARY_DIR}/DartConfiguration.tcl ) -ENDIF(CTEST_NEW_FORMAT) +endif() # # Section 3: @@ -43,53 +47,53 @@ ENDIF(CTEST_NEW_FORMAT) # These should NOT need to be modified from project to project. # -SET(__conf_types "") -IF(CMAKE_CONFIGURATION_TYPES) +set(__conf_types "") +if(CMAKE_CONFIGURATION_TYPES) # We need to pass the configuration type on the test command line. - SET(__conf_types -C "${CMAKE_CFG_INTDIR}") -ENDIF(CMAKE_CONFIGURATION_TYPES) + set(__conf_types -C "${CMAKE_CFG_INTDIR}") +endif() # Add convenience targets. Do this at most once in case of nested # projects. -DEFINE_PROPERTY(GLOBAL PROPERTY CTEST_TARGETS_ADDED +define_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED BRIEF_DOCS "Internal property used by CTestTargets module." FULL_DOCS "Set by the CTestTargets module to track addition of testing targets." ) -GET_PROPERTY(_CTEST_TARGETS_ADDED GLOBAL PROPERTY CTEST_TARGETS_ADDED) -IF(NOT _CTEST_TARGETS_ADDED) - SET_PROPERTY(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1) +get_property(_CTEST_TARGETS_ADDED GLOBAL PROPERTY CTEST_TARGETS_ADDED) +if(NOT _CTEST_TARGETS_ADDED) + set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1) # For all generators add basic testing targets. - FOREACH(mode Experimental Nightly Continuous NightlyMemoryCheck) - ADD_CUSTOM_TARGET(${mode} + foreach(mode Experimental Nightly Continuous NightlyMemoryCheck) + add_custom_target(${mode} ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode} ) - SET_PROPERTY(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "") - SET_PROPERTY(TARGET ${mode} PROPERTY FOLDER "CTestDashboardTargets") - ENDFOREACH(mode) + set_property(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "") + set_property(TARGET ${mode} PROPERTY FOLDER "CTestDashboardTargets") + endforeach() # For Makefile generators add more granular targets. - IF("${CMAKE_GENERATOR}" MATCHES "(Ninja|Make)") + if("${CMAKE_GENERATOR}" MATCHES "(Ninja|Make)") # Make targets for Experimental builds - FOREACH(mode Nightly Experimental Continuous) - FOREACH(testtype + foreach(mode Nightly Experimental Continuous) + foreach(testtype Start Update Configure Build Test Coverage MemCheck Submit # missing purify ) - ADD_CUSTOM_TARGET(${mode}${testtype} + add_custom_target(${mode}${testtype} ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype} ) - SET_PROPERTY(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "") - SET_PROPERTY(TARGET ${mode}${testtype} PROPERTY FOLDER "CTestDashboardTargets") - ENDFOREACH(testtype) - ENDFOREACH(mode) - ENDIF("${CMAKE_GENERATOR}" MATCHES "(Ninja|Make)") + set_property(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "") + set_property(TARGET ${mode}${testtype} PROPERTY FOLDER "CTestDashboardTargets") + endforeach() + endforeach() + endif() # If requested, add an alias that is the equivalent of the built-in "test" # or "RUN_TESTS" target: - IF(CTEST_TEST_TARGET_ALIAS) - ADD_CUSTOM_TARGET(${CTEST_TEST_TARGET_ALIAS} + if(CTEST_TEST_TARGET_ALIAS) + add_custom_target(${CTEST_TEST_TARGET_ALIAS} ${CMAKE_CTEST_COMMAND} ${__conf_types} ) - ENDIF() -ENDIF(NOT _CTEST_TARGETS_ADDED) + endif() +endif() diff --git a/Modules/CTestUseLaunchers.cmake b/Modules/CTestUseLaunchers.cmake new file mode 100644 index 000000000..24f5f2e16 --- /dev/null +++ b/Modules/CTestUseLaunchers.cmake @@ -0,0 +1,49 @@ +# - Set the RULE_LAUNCH_* global properties when CTEST_USE_LAUNCHERS is on. +# CTestUseLaunchers is automatically included when you include(CTest). +# However, it is split out into its own module file so projects +# can use the CTEST_USE_LAUNCHERS functionality independently. +# +# To use launchers, set CTEST_USE_LAUNCHERS to ON in a ctest -S +# dashboard script, and then also set it in the cache of the configured +# project. Both cmake and ctest need to know the value of it for the launchers +# to work properly. CMake needs to know in order to generate proper build +# rules, and ctest, in order to produce the proper error and warning +# analysis. +# +# For convenience, you may set the ENV variable CTEST_USE_LAUNCHERS_DEFAULT +# in your ctest -S script, too. Then, as long as your CMakeLists uses +# include(CTest) or include(CTestUseLaunchers), it will use the value of the +# ENV variable to initialize a CTEST_USE_LAUNCHERS cache variable. This cache +# variable initialization only occurs if CTEST_USE_LAUNCHERS is not already +# defined. + +#============================================================================= +# Copyright 2008-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +if(NOT DEFINED CTEST_USE_LAUNCHERS AND DEFINED ENV{CTEST_USE_LAUNCHERS_DEFAULT}) + set(CTEST_USE_LAUNCHERS "$ENV{CTEST_USE_LAUNCHERS_DEFAULT}" + CACHE INTERNAL "CTEST_USE_LAUNCHERS initial value from ENV") +endif() + +if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja") + set(CTEST_USE_LAUNCHERS 0) +endif() + +if(CTEST_USE_LAUNCHERS) + set(CTEST_LAUNCH_COMPILE "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name --build-dir --output --source --language --") + set(CTEST_LAUNCH_LINK "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name --build-dir --output --target-type --language --") + set(CTEST_LAUNCH_CUSTOM "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name --build-dir --output --") + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CTEST_LAUNCH_COMPILE}") + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CTEST_LAUNCH_LINK}") + set_property(GLOBAL PROPERTY RULE_LAUNCH_CUSTOM "${CTEST_LAUNCH_CUSTOM}") +endif() diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index 90d04ac66..08e80f756 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -21,11 +21,11 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(CheckCSourceCompiles) +include(CheckCSourceCompiles) -MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT) - SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") - SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") +macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT) + set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") + set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT} # Some compilers do not fail with a bad flag FAIL_REGEX "command line option .* is valid for .* but not for C" # GNU @@ -41,5 +41,5 @@ MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT) FAIL_REGEX "command option .* is not recognized" # XL FAIL_REGEX "WARNING: unknown flag:" # Open64 ) - SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") -ENDMACRO (CHECK_C_COMPILER_FLAG) + set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") +endmacro () diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index 266933634..86a4565ce 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -24,72 +24,69 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") -MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR) - IF("${VAR}" MATCHES "^${VAR}$") - SET(_FAIL_REGEX) - SET(_key) - FOREACH(arg ${ARGN}) - IF("${arg}" MATCHES "^(FAIL_REGEX)$") - SET(_key "${arg}") - ELSEIF(_key) - LIST(APPEND _${_key} "${arg}") - ELSE() - MESSAGE(FATAL_ERROR "Unknown argument:\n ${arg}\n") - ENDIF() - ENDFOREACH() - SET(MACRO_CHECK_FUNCTION_DEFINITIONS +macro(CHECK_C_SOURCE_COMPILES SOURCE VAR) + if("${VAR}" MATCHES "^${VAR}$") + set(_FAIL_REGEX) + set(_key) + foreach(arg ${ARGN}) + if("${arg}" MATCHES "^(FAIL_REGEX)$") + set(_key "${arg}") + elseif(_key) + list(APPEND _${_key} "${arg}") + else() + message(FATAL_ERROR "Unknown argument:\n ${arg}\n") + endif() + endforeach() + set(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") - IF(CMAKE_REQUIRED_LIBRARIES) - # this one translates potentially used imported library targets to their files on disk - CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") - SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") - ELSE(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) - ENDIF(CMAKE_REQUIRED_LIBRARIES) - IF(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) + endif() + if(CMAKE_REQUIRED_INCLUDES) + set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - ELSE(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) - ENDIF(CMAKE_REQUIRED_INCLUDES) - FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" + else() + set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) + endif() + file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" "${SOURCE}\n") - MESSAGE(STATUS "Performing Test ${VAR}") - TRY_COMPILE(${VAR} + message(STATUS "Performing Test ${VAR}") + try_compile(${VAR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" OUTPUT_VARIABLE OUTPUT) - FOREACH(_regex ${_FAIL_REGEX}) - IF("${OUTPUT}" MATCHES "${_regex}") - SET(${VAR} 0) - ENDIF() - ENDFOREACH() + foreach(_regex ${_FAIL_REGEX}) + if("${OUTPUT}" MATCHES "${_regex}") + set(${VAR} 0) + endif() + endforeach() - IF(${VAR}) - SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - MESSAGE(STATUS "Performing Test ${VAR} - Success") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if(${VAR}) + set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") + message(STATUS "Performing Test ${VAR} - Success") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") - ELSE(${VAR}) - MESSAGE(STATUS "Performing Test ${VAR} - Failed") - SET(${VAR} "" CACHE INTERNAL "Test ${VAR}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + else() + message(STATUS "Performing Test ${VAR} - Failed") + set(${VAR} "" CACHE INTERNAL "Test ${VAR}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") - ENDIF(${VAR}) - ENDIF("${VAR}" MATCHES "^${VAR}$") -ENDMACRO(CHECK_C_SOURCE_COMPILES) + endif() + endif() +endmacro() diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index feee93a71..e3a091fb3 100644 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -24,68 +24,65 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") -MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR) - IF("${VAR}" MATCHES "^${VAR}$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS +macro(CHECK_C_SOURCE_RUNS SOURCE VAR) + if("${VAR}" MATCHES "^${VAR}$") + set(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") - IF(CMAKE_REQUIRED_LIBRARIES) - # this one translates potentially used imported library targets to their files on disk - CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") - SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") - ELSE(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) - ENDIF(CMAKE_REQUIRED_LIBRARIES) - IF(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) + endif() + if(CMAKE_REQUIRED_INCLUDES) + set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - ELSE(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) - ENDIF(CMAKE_REQUIRED_INCLUDES) - FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" + else() + set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) + endif() + file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" "${SOURCE}\n") - MESSAGE(STATUS "Performing Test ${VAR}") - TRY_RUN(${VAR}_EXITCODE ${VAR}_COMPILED + message(STATUS "Performing Test ${VAR}") + try_run(${VAR}_EXITCODE ${VAR}_COMPILED ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} - "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" COMPILE_OUTPUT_VARIABLE OUTPUT) # if it did not compile make the return value fail code of 1 - IF(NOT ${VAR}_COMPILED) - SET(${VAR}_EXITCODE 1) - ENDIF(NOT ${VAR}_COMPILED) + if(NOT ${VAR}_COMPILED) + set(${VAR}_EXITCODE 1) + endif() # if the return value was 0 then it worked - IF("${${VAR}_EXITCODE}" EQUAL 0) - SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - MESSAGE(STATUS "Performing Test ${VAR} - Success") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if("${${VAR}_EXITCODE}" EQUAL 0) + set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") + message(STATUS "Performing Test ${VAR} - Success") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" "Return value: ${${VAR}}\n" "Source file was:\n${SOURCE}\n") - ELSE("${${VAR}_EXITCODE}" EQUAL 0) - IF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") - SET(${VAR} "${${VAR}_EXITCODE}") - ELSE(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") - SET(${VAR} "" CACHE INTERNAL "Test ${VAR}") - ENDIF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") + else() + if(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") + set(${VAR} "${${VAR}_EXITCODE}") + else() + set(${VAR} "" CACHE INTERNAL "Test ${VAR}") + endif() - MESSAGE(STATUS "Performing Test ${VAR} - Failed") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + message(STATUS "Performing Test ${VAR} - Failed") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" "Return value: ${${VAR}_EXITCODE}\n" "Source file was:\n${SOURCE}\n") - ENDIF("${${VAR}_EXITCODE}" EQUAL 0) - ENDIF("${VAR}" MATCHES "^${VAR}$") -ENDMACRO(CHECK_C_SOURCE_RUNS) + endif() + endif() +endmacro() diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index 19963ea4c..662640340 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -21,11 +21,11 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(CheckCXXSourceCompiles) +include(CheckCXXSourceCompiles) -MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) - SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") - SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") +macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) + set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") + set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT} # Some compilers do not fail with a bad flag FAIL_REGEX "command line option .* is valid for .* but not for C\\\\+\\\\+" # GNU @@ -43,6 +43,6 @@ MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) FAIL_REGEX "File with unknown suffix passed to linker" # PGI FAIL_REGEX "WARNING: unknown flag:" # Open64 ) - SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") -ENDMACRO (CHECK_CXX_COMPILER_FLAG) + set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") +endmacro () diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index 7f7336e5b..734c0839b 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -24,73 +24,70 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") -MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) - IF("${VAR}" MATCHES "^${VAR}$") - SET(_FAIL_REGEX) - SET(_key) - FOREACH(arg ${ARGN}) - IF("${arg}" MATCHES "^(FAIL_REGEX)$") - SET(_key "${arg}") - ELSEIF(_key) - LIST(APPEND _${_key} "${arg}") - ELSE() - MESSAGE(FATAL_ERROR "Unknown argument:\n ${arg}\n") - ENDIF() - ENDFOREACH() +macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) + if("${VAR}" MATCHES "^${VAR}$") + set(_FAIL_REGEX) + set(_key) + foreach(arg ${ARGN}) + if("${arg}" MATCHES "^(FAIL_REGEX)$") + set(_key "${arg}") + elseif(_key) + list(APPEND _${_key} "${arg}") + else() + message(FATAL_ERROR "Unknown argument:\n ${arg}\n") + endif() + endforeach() - SET(MACRO_CHECK_FUNCTION_DEFINITIONS + set(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") - IF(CMAKE_REQUIRED_LIBRARIES) - # this one translates potentially used imported library targets to their files on disk - CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") - SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") - ELSE(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES) - ENDIF(CMAKE_REQUIRED_LIBRARIES) - IF(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES) + endif() + if(CMAKE_REQUIRED_INCLUDES) + set(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - ELSE(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES) - ENDIF(CMAKE_REQUIRED_INCLUDES) - FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" + else() + set(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES) + endif() + file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" "${SOURCE}\n") - MESSAGE(STATUS "Performing Test ${VAR}") - TRY_COMPILE(${VAR} + message(STATUS "Performing Test ${VAR}") + try_compile(${VAR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}" "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}" OUTPUT_VARIABLE OUTPUT) - FOREACH(_regex ${_FAIL_REGEX}) - IF("${OUTPUT}" MATCHES "${_regex}") - SET(${VAR} 0) - ENDIF() - ENDFOREACH() + foreach(_regex ${_FAIL_REGEX}) + if("${OUTPUT}" MATCHES "${_regex}") + set(${VAR} 0) + endif() + endforeach() - IF(${VAR}) - SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - MESSAGE(STATUS "Performing Test ${VAR} - Success") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if(${VAR}) + set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") + message(STATUS "Performing Test ${VAR} - Success") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") - ELSE(${VAR}) - MESSAGE(STATUS "Performing Test ${VAR} - Failed") - SET(${VAR} "" CACHE INTERNAL "Test ${VAR}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + else() + message(STATUS "Performing Test ${VAR} - Failed") + set(${VAR} "" CACHE INTERNAL "Test ${VAR}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") - ENDIF(${VAR}) - ENDIF("${VAR}" MATCHES "^${VAR}$") -ENDMACRO(CHECK_CXX_SOURCE_COMPILES) + endif() + endif() +endmacro() diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index cd68d5706..9e401f18e 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -24,68 +24,65 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") -MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR) - IF("${VAR}" MATCHES "^${VAR}$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS +macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) + if("${VAR}" MATCHES "^${VAR}$") + set(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") - IF(CMAKE_REQUIRED_LIBRARIES) - # this one translates potentially used imported library targets to their files on disk - CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") - SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") - ELSE(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES) - ENDIF(CMAKE_REQUIRED_LIBRARIES) - IF(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES) + endif() + if(CMAKE_REQUIRED_INCLUDES) + set(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - ELSE(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES) - ENDIF(CMAKE_REQUIRED_INCLUDES) - FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" + else() + set(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES) + endif() + file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" "${SOURCE}\n") - MESSAGE(STATUS "Performing Test ${VAR}") - TRY_RUN(${VAR}_EXITCODE ${VAR}_COMPILED + message(STATUS "Performing Test ${VAR}") + try_run(${VAR}_EXITCODE ${VAR}_COMPILED ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} - "${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}" "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}" COMPILE_OUTPUT_VARIABLE OUTPUT) # if it did not compile make the return value fail code of 1 - IF(NOT ${VAR}_COMPILED) - SET(${VAR}_EXITCODE 1) - ENDIF(NOT ${VAR}_COMPILED) + if(NOT ${VAR}_COMPILED) + set(${VAR}_EXITCODE 1) + endif() # if the return value was 0 then it worked - IF("${${VAR}_EXITCODE}" EQUAL 0) - SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - MESSAGE(STATUS "Performing Test ${VAR} - Success") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if("${${VAR}_EXITCODE}" EQUAL 0) + set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") + message(STATUS "Performing Test ${VAR} - Success") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" "Return value: ${${VAR}}\n" "Source file was:\n${SOURCE}\n") - ELSE("${${VAR}_EXITCODE}" EQUAL 0) - IF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") - SET(${VAR} "${${VAR}_EXITCODE}") - ELSE(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") - SET(${VAR} "" CACHE INTERNAL "Test ${VAR}") - ENDIF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") + else() + if(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") + set(${VAR} "${${VAR}_EXITCODE}") + else() + set(${VAR} "" CACHE INTERNAL "Test ${VAR}") + endif() - MESSAGE(STATUS "Performing Test ${VAR} - Failed") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + message(STATUS "Performing Test ${VAR} - Failed") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" "Return value: ${${VAR}_EXITCODE}\n" "Source file was:\n${SOURCE}\n") - ENDIF("${${VAR}_EXITCODE}" EQUAL 0) - ENDIF("${VAR}" MATCHES "^${VAR}$") -ENDMACRO(CHECK_CXX_SOURCE_RUNS) + endif() + endif() +endmacro() diff --git a/Modules/CheckCXXSymbolExists.cmake b/Modules/CheckCXXSymbolExists.cmake index 1b012aefd..210097378 100644 --- a/Modules/CheckCXXSymbolExists.cmake +++ b/Modules/CheckCXXSymbolExists.cmake @@ -35,8 +35,8 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(CheckSymbolExists) +include(CheckSymbolExists) -MACRO(CHECK_CXX_SYMBOL_EXISTS SYMBOL FILES VARIABLE) +macro(CHECK_CXX_SYMBOL_EXISTS SYMBOL FILES VARIABLE) _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.cxx" "${SYMBOL}" "${FILES}" "${VARIABLE}" ) -ENDMACRO(CHECK_CXX_SYMBOL_EXISTS) +endmacro() diff --git a/Modules/CheckForPthreads.c b/Modules/CheckForPthreads.c index d83107851..7250fbff6 100644 --- a/Modules/CheckForPthreads.c +++ b/Modules/CheckForPthreads.c @@ -15,8 +15,8 @@ int main(int ac, char*av[]){ pthread_t tid[2]; pthread_create(&tid[0], 0, runner, (void*)1); pthread_create(&tid[1], 0, runner, (void*)2); - -#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) // (no usleep on BeOS 5.) + +#if defined(__BEOS__) && !defined(__ZETA__) // (no usleep on BeOS 5.) usleep(1); // for strange behavior on single-processor sun #endif diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake index abec9f738..45dd7bebe 100644 --- a/Modules/CheckFortranFunctionExists.cmake +++ b/Modules/CheckFortranFunctionExists.cmake @@ -22,21 +22,18 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE) if(NOT DEFINED ${VARIABLE}) message(STATUS "Looking for Fortran ${FUNCTION}") if(CMAKE_REQUIRED_LIBRARIES) - # this one translates potentially used imported library targets to their files on disk - cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") - else(CMAKE_REQUIRED_LIBRARIES) + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - endif(CMAKE_REQUIRED_LIBRARIES) - FILE(WRITE + endif() + file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f " program TESTFortran @@ -48,7 +45,7 @@ macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE) try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f - CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" + ${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES} OUTPUT_VARIABLE OUTPUT ) # message(STATUS "${OUTPUT}") @@ -58,12 +55,12 @@ macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n" "${OUTPUT}\n\n") - else(${VARIABLE}) + else() message(STATUS "Looking for Fortran ${FUNCTION} - not found") set(${VARIABLE} "" CACHE INTERNAL "Have Fortran function ${FUNCTION}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n" "${OUTPUT}\n\n") - endif(${VARIABLE}) - endif(NOT DEFINED ${VARIABLE}) -endmacro(CHECK_FORTRAN_FUNCTION_EXISTS) + endif() + endif() +endmacro() diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index 8c469f012..7aa1748da 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -27,48 +27,45 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") -MACRO(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) - IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS +macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) + if("${VARIABLE}" MATCHES "^${VARIABLE}$") + set(MACRO_CHECK_FUNCTION_DEFINITIONS "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") - MESSAGE(STATUS "Looking for ${FUNCTION}") - IF(CMAKE_REQUIRED_LIBRARIES) - # this one translates potentially used imported library targets to their files on disk - CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") - SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") - ELSE(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - ENDIF(CMAKE_REQUIRED_LIBRARIES) - IF(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_FUNCTION_EXISTS_ADD_INCLUDES + message(STATUS "Looking for ${FUNCTION}") + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) + endif() + if(CMAKE_REQUIRED_INCLUDES) + set(CHECK_FUNCTION_EXISTS_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - ELSE(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_FUNCTION_EXISTS_ADD_INCLUDES) - ENDIF(CMAKE_REQUIRED_INCLUDES) - TRY_COMPILE(${VARIABLE} + else() + set(CHECK_FUNCTION_EXISTS_ADD_INCLUDES) + endif() + try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_ROOT}/Modules/CheckFunctionExists.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" "${CHECK_FUNCTION_EXISTS_ADD_INCLUDES}" OUTPUT_VARIABLE OUTPUT) - IF(${VARIABLE}) - SET(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") - MESSAGE(STATUS "Looking for ${FUNCTION} - found") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if(${VARIABLE}) + set(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") + message(STATUS "Looking for ${FUNCTION} - found") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the function ${FUNCTION} exists passed with the following output:\n" "${OUTPUT}\n\n") - ELSE(${VARIABLE}) - MESSAGE(STATUS "Looking for ${FUNCTION} - not found") - SET(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + else() + message(STATUS "Looking for ${FUNCTION} - not found") + set(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists failed with the following output:\n" "${OUTPUT}\n\n") - ENDIF(${VARIABLE}) - ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") -ENDMACRO(CHECK_FUNCTION_EXISTS) + endif() + endif() +endmacro() diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake index eb732d28b..8067e65ce 100644 --- a/Modules/CheckIncludeFile.cmake +++ b/Modules/CheckIncludeFile.cmake @@ -3,8 +3,8 @@ # - macro which checks the include file exists. # INCLUDE - name of include file # VARIABLE - variable to return result -# -# an optional third argument is the CFlags to add to the compile line +# +# an optional third argument is the CFlags to add to the compile line # or you can use CMAKE_REQUIRED_FLAGS # # The following variables may be set before calling this macro to @@ -28,50 +28,50 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -MACRO(CHECK_INCLUDE_FILE INCLUDE VARIABLE) - IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - IF(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_INCLUDE_FILE_C_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}") - ELSE(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_INCLUDE_FILE_C_INCLUDE_DIRS) - ENDIF(CMAKE_REQUIRED_INCLUDES) - SET(MACRO_CHECK_INCLUDE_FILE_FLAGS ${CMAKE_REQUIRED_FLAGS}) - SET(CHECK_INCLUDE_FILE_VAR ${INCLUDE}) - CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.c.in +macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE) + if("${VARIABLE}" MATCHES "^${VARIABLE}$") + if(CMAKE_REQUIRED_INCLUDES) + set(CHECK_INCLUDE_FILE_C_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}") + else() + set(CHECK_INCLUDE_FILE_C_INCLUDE_DIRS) + endif() + set(MACRO_CHECK_INCLUDE_FILE_FLAGS ${CMAKE_REQUIRED_FLAGS}) + set(CHECK_INCLUDE_FILE_VAR ${INCLUDE}) + configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.c.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c IMMEDIATE) - MESSAGE(STATUS "Looking for ${INCLUDE}") - IF(${ARGC} EQUAL 3) - SET(CMAKE_C_FLAGS_SAVE ${CMAKE_C_FLAGS}) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGV2}") - ENDIF(${ARGC} EQUAL 3) + message(STATUS "Looking for ${INCLUDE}") + if(${ARGC} EQUAL 3) + set(CMAKE_C_FLAGS_SAVE ${CMAKE_C_FLAGS}) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGV2}") + endif() - TRY_COMPILE(${VARIABLE} + try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS} "${CHECK_INCLUDE_FILE_C_INCLUDE_DIRS}" - OUTPUT_VARIABLE OUTPUT) + OUTPUT_VARIABLE OUTPUT) - IF(${ARGC} EQUAL 3) - SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS_SAVE}) - ENDIF(${ARGC} EQUAL 3) + if(${ARGC} EQUAL 3) + set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS_SAVE}) + endif() - IF(${VARIABLE}) - MESSAGE(STATUS "Looking for ${INCLUDE} - found") - SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if(${VARIABLE}) + message(STATUS "Looking for ${INCLUDE} - found") + set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the include file ${INCLUDE} " "exists passed with the following output:\n" "${OUTPUT}\n\n") - ELSE(${VARIABLE}) - MESSAGE(STATUS "Looking for ${INCLUDE} - not found") - SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + else() + message(STATUS "Looking for ${INCLUDE} - not found") + set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the include file ${INCLUDE} " "exists failed with the following output:\n" "${OUTPUT}\n\n") - ENDIF(${VARIABLE}) - ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") -ENDMACRO(CHECK_INCLUDE_FILE) + endif() + endif() +endmacro() diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake index c5d8f9aa2..22c2d1ac7 100644 --- a/Modules/CheckIncludeFileCXX.cmake +++ b/Modules/CheckIncludeFileCXX.cmake @@ -3,8 +3,8 @@ # # INCLUDE - name of include file # VARIABLE - variable to return result -# -# An optional third argument is the CFlags to add to the compile line +# +# An optional third argument is the CFlags to add to the compile line # or you can use CMAKE_REQUIRED_FLAGS. # # The following variables may be set before calling this macro to @@ -28,50 +28,50 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -MACRO(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE) - IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - IF(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}") - ELSE(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS) - ENDIF(CMAKE_REQUIRED_INCLUDES) - SET(MACRO_CHECK_INCLUDE_FILE_FLAGS ${CMAKE_REQUIRED_FLAGS}) - SET(CHECK_INCLUDE_FILE_VAR ${INCLUDE}) - CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in +macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE) + if("${VARIABLE}" MATCHES "^${VARIABLE}$") + if(CMAKE_REQUIRED_INCLUDES) + set(CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}") + else() + set(CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS) + endif() + set(MACRO_CHECK_INCLUDE_FILE_FLAGS ${CMAKE_REQUIRED_FLAGS}) + set(CHECK_INCLUDE_FILE_VAR ${INCLUDE}) + configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx IMMEDIATE) - MESSAGE(STATUS "Looking for C++ include ${INCLUDE}") - IF(${ARGC} EQUAL 3) - SET(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS}) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}") - ENDIF(${ARGC} EQUAL 3) + message(STATUS "Looking for C++ include ${INCLUDE}") + if(${ARGC} EQUAL 3) + set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}") + endif() - TRY_COMPILE(${VARIABLE} + try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS} "${CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS}" - OUTPUT_VARIABLE OUTPUT) + OUTPUT_VARIABLE OUTPUT) - IF(${ARGC} EQUAL 3) - SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_SAVE}) - ENDIF(${ARGC} EQUAL 3) + if(${ARGC} EQUAL 3) + set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_SAVE}) + endif() - IF(${VARIABLE}) - MESSAGE(STATUS "Looking for C++ include ${INCLUDE} - found") - SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if(${VARIABLE}) + message(STATUS "Looking for C++ include ${INCLUDE} - found") + set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the include file ${INCLUDE} " "exists passed with the following output:\n" "${OUTPUT}\n\n") - ELSE(${VARIABLE}) - MESSAGE(STATUS "Looking for C++ include ${INCLUDE} - not found") - SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + else() + message(STATUS "Looking for C++ include ${INCLUDE} - not found") + set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the include file ${INCLUDE} " "exists failed with the following output:\n" "${OUTPUT}\n\n") - ENDIF(${VARIABLE}) - ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") -ENDMACRO(CHECK_INCLUDE_FILE_CXX) + endif() + endif() +endmacro() diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake index a94644e6a..daf2dd0ea 100644 --- a/Modules/CheckIncludeFiles.cmake +++ b/Modules/CheckIncludeFiles.cmake @@ -25,58 +25,58 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE) - IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - SET(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") - IF(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}") - ELSE(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_INCLUDE_FILES_INCLUDE_DIRS) - ENDIF(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_INCLUDE_FILES_CONTENT "/* */\n") - SET(MACRO_CHECK_INCLUDE_FILES_FLAGS ${CMAKE_REQUIRED_FLAGS}) - FOREACH(FILE ${INCLUDE}) - SET(CMAKE_CONFIGURABLE_FILE_CONTENT +macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE) + if("${VARIABLE}" MATCHES "^${VARIABLE}$") + set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") + if(CMAKE_REQUIRED_INCLUDES) + set(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}") + else() + set(CHECK_INCLUDE_FILES_INCLUDE_DIRS) + endif() + set(CHECK_INCLUDE_FILES_CONTENT "/* */\n") + set(MACRO_CHECK_INCLUDE_FILES_FLAGS ${CMAKE_REQUIRED_FLAGS}) + foreach(FILE ${INCLUDE}) + set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n") - ENDFOREACH(FILE) - SET(CMAKE_CONFIGURABLE_FILE_CONTENT + endforeach() + set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(){return 0;}\n") - CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" + configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c" @ONLY IMMEDIATE) - SET(_INCLUDE ${INCLUDE}) # remove empty elements - IF("${_INCLUDE}" MATCHES "^([^;]+);.+;([^;]+)$") - LIST(LENGTH _INCLUDE _INCLUDE_LEN) - SET(_description "${_INCLUDE_LEN} include files ${CMAKE_MATCH_1}, ..., ${CMAKE_MATCH_2}") - ELSEIF("${_INCLUDE}" MATCHES "^([^;]+);([^;]+)$") - SET(_description "include files ${CMAKE_MATCH_1}, ${CMAKE_MATCH_2}") - ELSE() - SET(_description "include file ${_INCLUDE}") - ENDIF() + set(_INCLUDE ${INCLUDE}) # remove empty elements + if("${_INCLUDE}" MATCHES "^([^;]+);.+;([^;]+)$") + list(LENGTH _INCLUDE _INCLUDE_LEN) + set(_description "${_INCLUDE_LEN} include files ${CMAKE_MATCH_1}, ..., ${CMAKE_MATCH_2}") + elseif("${_INCLUDE}" MATCHES "^([^;]+);([^;]+)$") + set(_description "include files ${CMAKE_MATCH_1}, ${CMAKE_MATCH_2}") + else() + set(_description "include file ${_INCLUDE}") + endif() - MESSAGE(STATUS "Looking for ${_description}") - TRY_COMPILE(${VARIABLE} + message(STATUS "Looking for ${_description}") + try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILES_FLAGS} "${CHECK_INCLUDE_FILES_INCLUDE_DIRS}" OUTPUT_VARIABLE OUTPUT) - IF(${VARIABLE}) - MESSAGE(STATUS "Looking for ${_description} - found") - SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if(${VARIABLE}) + message(STATUS "Looking for ${_description} - found") + set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if files ${INCLUDE} " "exist passed with the following output:\n" "${OUTPUT}\n\n") - ELSE(${VARIABLE}) - MESSAGE(STATUS "Looking for ${_description} - not found.") - SET(${VARIABLE} "" CACHE INTERNAL "Have includes ${INCLUDE}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + else() + message(STATUS "Looking for ${_description} - not found") + set(${VARIABLE} "" CACHE INTERNAL "Have includes ${INCLUDE}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if files ${INCLUDE} " "exist failed with the following output:\n" "${OUTPUT}\nSource:\n${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") - ENDIF(${VARIABLE}) - ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") -ENDMACRO(CHECK_INCLUDE_FILES) + endif() + endif() +endmacro() diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index 59fca0a32..fb7d0ec01 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -26,45 +26,42 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") -MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) - IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - SET(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION +macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) + if("${VARIABLE}" MATCHES "^${VARIABLE}$") + set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") - MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY}") - SET(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY}) - IF(CMAKE_REQUIRED_LIBRARIES) - # this one translates potentially used imported library targets to their files on disk - CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") - SET(CHECK_LIBRARY_EXISTS_LIBRARIES - ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}) - ENDIF(CMAKE_REQUIRED_LIBRARIES) - TRY_COMPILE(${VARIABLE} + message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}") + set(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY}) + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_LIBRARY_EXISTS_LIBRARIES + ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES}) + endif() + try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_ROOT}/Modules/CheckFunctionExists.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + LINK_LIBRARIES ${CHECK_LIBRARY_EXISTS_LIBRARIES} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION} -DLINK_DIRECTORIES:STRING=${LOCATION} - "-DLINK_LIBRARIES:STRING=${CHECK_LIBRARY_EXISTS_LIBRARIES}" OUTPUT_VARIABLE OUTPUT) - IF(${VARIABLE}) - MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found") - SET(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if(${VARIABLE}) + message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found") + set(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " "passed with the following output:\n" "${OUTPUT}\n\n") - ELSE(${VARIABLE}) - MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found") - SET(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + else() + message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found") + set(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " "failed with the following output:\n" "${OUTPUT}\n\n") - ENDIF(${VARIABLE}) - ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") -ENDMACRO(CHECK_LIBRARY_EXISTS) + endif() + endif() +endmacro() diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake index 63d424237..2342b3c4f 100644 --- a/Modules/CheckPrototypeDefinition.cmake +++ b/Modules/CheckPrototypeDefinition.cmake @@ -34,7 +34,6 @@ # License text for the above reference.) # -include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) @@ -46,24 +45,22 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS}) if (CMAKE_REQUIRED_LIBRARIES) - # this one translates potentially used imported library targets to their files on disk - cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") set(CHECK_PROTOTYPE_DEFINITION_LIBS - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") - else(CMAKE_REQUIRED_LIBRARIES) + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() set(CHECK_PROTOTYPE_DEFINITION_LIBS) - endif(CMAKE_REQUIRED_LIBRARIES) + endif() if (CMAKE_REQUIRED_INCLUDES) set(CMAKE_SYMBOL_EXISTS_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - else(CMAKE_REQUIRED_INCLUDES) + else() set(CMAKE_SYMBOL_EXISTS_INCLUDES) - endif(CMAKE_REQUIRED_INCLUDES) + endif() foreach(_FILE ${_HEADER}) set(CHECK_PROTOTYPE_DEFINITION_HEADER "${CHECK_PROTOTYPE_DEFINITION_HEADER}#include <${_FILE}>\n") - endforeach(_FILE) + endforeach() set(CHECK_PROTOTYPE_DEFINITION_SYMBOL ${_FUNCTION}) set(CHECK_PROTOTYPE_DEFINITION_PROTO ${_PROTOTYPE}) @@ -78,8 +75,8 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_PROTOTYPE_DEFINITION_LIBS} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CHECK_PROTOTYPE_DEFINITION_FLAGS} - "${CHECK_PROTOTYPE_DEFINITION_LIBS}" "${CMAKE_SYMBOL_EXISTS_INCLUDES}" OUTPUT_VARIABLE OUTPUT) @@ -89,13 +86,13 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} passed with the following output:\n" "${OUTPUT}\n\n") - else (${_VARIABLE}) + else () message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False") set(${_VARIABLE} 0 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} failed with the following output:\n" "${OUTPUT}\n\n${_SOURCE}\n\n") - endif (${_VARIABLE}) - endif("${_VARIABLE}" MATCHES "^${_VARIABLE}$") + endif () + endif() -endfunction(CHECK_PROTOTYPE_DEFINITION) +endfunction() diff --git a/Modules/CheckSizeOf.cmake b/Modules/CheckSizeOf.cmake index f6d6636e5..9f587b5c2 100644 --- a/Modules/CheckSizeOf.cmake +++ b/Modules/CheckSizeOf.cmake @@ -12,7 +12,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -MESSAGE(SEND_ERROR +message(SEND_ERROR "Modules/CheckSizeOf.cmake has been removed. " "Use Modules/CheckTypeSize.cmake instead. This " "compatability check may be removed before the next release!") diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index 18e80e3c0..ea2891c8b 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -28,15 +28,15 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(CheckCSourceCompiles) +include(CheckCSourceCompiles) -MACRO (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT) - SET(_INCLUDE_FILES) - FOREACH (it ${_HEADER}) - SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") - ENDFOREACH (it) +macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT) + set(_INCLUDE_FILES) + foreach (it ${_HEADER}) + set(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") + endforeach () - SET(_CHECK_STRUCT_MEMBER_SOURCE_CODE " + set(_CHECK_STRUCT_MEMBER_SOURCE_CODE " ${_INCLUDE_FILES} int main() { @@ -47,5 +47,5 @@ int main() ") CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) -ENDMACRO (CHECK_STRUCT_HAS_MEMBER) +endmacro () diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index e6e677d4f..0969bc562 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -35,67 +35,64 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") -MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) +macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" ) -ENDMACRO(CHECK_SYMBOL_EXISTS) +endmacro() -MACRO(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) - IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - SET(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") - SET(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) - IF(CMAKE_REQUIRED_LIBRARIES) - # this one translates potentially used imported library targets to their files on disk - CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") - SET(CHECK_SYMBOL_EXISTS_LIBS - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") - ELSE(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_SYMBOL_EXISTS_LIBS) - ENDIF(CMAKE_REQUIRED_LIBRARIES) - IF(CMAKE_REQUIRED_INCLUDES) - SET(CMAKE_SYMBOL_EXISTS_INCLUDES +macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) + if("${VARIABLE}" MATCHES "^${VARIABLE}$") + set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") + set(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_SYMBOL_EXISTS_LIBS + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_SYMBOL_EXISTS_LIBS) + endif() + if(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_SYMBOL_EXISTS_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - ELSE(CMAKE_REQUIRED_INCLUDES) - SET(CMAKE_SYMBOL_EXISTS_INCLUDES) - ENDIF(CMAKE_REQUIRED_INCLUDES) - FOREACH(FILE ${FILES}) - SET(CMAKE_CONFIGURABLE_FILE_CONTENT + else() + set(CMAKE_SYMBOL_EXISTS_INCLUDES) + endif() + foreach(FILE ${FILES}) + set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n") - ENDFOREACH(FILE) - SET(CMAKE_CONFIGURABLE_FILE_CONTENT + endforeach() + set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}\nint main(int argc, char** argv)\n{\n (void)argv;\n#ifndef ${SYMBOL}\n return ((int*)(&${SYMBOL}))[argc];\n#else\n (void)argc;\n return 0;\n#endif\n}\n") - CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" + configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" "${SOURCEFILE}" @ONLY IMMEDIATE) - MESSAGE(STATUS "Looking for ${SYMBOL}") - TRY_COMPILE(${VARIABLE} + message(STATUS "Looking for ${SYMBOL}") + try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} "${SOURCEFILE}" COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_SYMBOL_EXISTS_LIBS} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_SYMBOL_EXISTS_FLAGS} - "${CHECK_SYMBOL_EXISTS_LIBS}" "${CMAKE_SYMBOL_EXISTS_INCLUDES}" OUTPUT_VARIABLE OUTPUT) - IF(${VARIABLE}) - MESSAGE(STATUS "Looking for ${SYMBOL} - found") - SET(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if(${VARIABLE}) + message(STATUS "Looking for ${SYMBOL} - found") + set(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the ${SYMBOL} " "exist passed with the following output:\n" "${OUTPUT}\nFile ${SOURCEFILE}:\n" "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") - ELSE(${VARIABLE}) - MESSAGE(STATUS "Looking for ${SYMBOL} - not found.") - SET(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + else() + message(STATUS "Looking for ${SYMBOL} - not found") + set(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the ${SYMBOL} " "exist failed with the following output:\n" "${OUTPUT}\nFile ${SOURCEFILE}:\n" "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") - ENDIF(${VARIABLE}) - ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") -ENDMACRO(_CHECK_SYMBOL_EXISTS) + endif() + endif() +endmacro() diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 1717718c9..2d0eab51c 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -24,6 +24,11 @@ # size check automatically includes the available headers, thus # supporting checks of types defined in the headers. # +# Despite the name of the macro you may use it to check the size of +# more complex expressions, too. To check e.g. for the size of a struct +# member you can do something like this: +# check_type_size("((struct something*)0)->member" SIZEOF_MEMBER) +# # The following variables may be set before calling this macro to # modify the way the check is run: # @@ -47,7 +52,6 @@ # License text for the above reference.) include(CheckIncludeFile) -include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") cmake_policy(PUSH) cmake_minimum_required(VERSION 2.6 FATAL_ERROR) @@ -78,18 +82,16 @@ function(__check_type_size_impl type var map builtin) # Perform the check. - # this one translates potentially used imported library targets to their files on disk - cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.c) set(bin ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.bin) configure_file(${__check_type_size_dir}/CheckTypeSize.c.in ${src} @ONLY) try_compile(HAVE_${var} ${CMAKE_BINARY_DIR} ${src} COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${CMAKE_REQUIRED_FLAGS}" "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}" - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}" OUTPUT_VARIABLE output COPY_FILE ${bin} ) @@ -142,7 +144,7 @@ function(__check_type_size_impl type var map builtin) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining size of ${type} passed with the following output:\n${output}\n\n") set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_SIZE: sizeof(${type})") - else(HAVE_${var}) + else() # The check failed to compile. message(STATUS "Check size of ${type} - failed") file(READ ${src} content) @@ -150,7 +152,7 @@ function(__check_type_size_impl type var map builtin) "Determining size of ${type} failed with the following output:\n${output}\n${src}:\n${content}\n\n") set(${var} "" CACHE INTERNAL "CHECK_TYPE_SIZE: ${type} unknown") file(REMOVE ${map}) - endif(HAVE_${var}) + endif() endfunction() #----------------------------------------------------------------------------- diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake index 7d6c7945d..a21e65f26 100644 --- a/Modules/CheckVariableExists.cmake +++ b/Modules/CheckVariableExists.cmake @@ -26,41 +26,38 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") -MACRO(CHECK_VARIABLE_EXISTS VAR VARIABLE) - IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - SET(MACRO_CHECK_VARIABLE_DEFINITIONS +macro(CHECK_VARIABLE_EXISTS VAR VARIABLE) + if("${VARIABLE}" MATCHES "^${VARIABLE}$") + set(MACRO_CHECK_VARIABLE_DEFINITIONS "-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}") - MESSAGE(STATUS "Looking for ${VAR}") - IF(CMAKE_REQUIRED_LIBRARIES) - # this one translates potentially used imported library targets to their files on disk - CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") - SET(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") - ELSE(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES) - ENDIF(CMAKE_REQUIRED_LIBRARIES) - TRY_COMPILE(${VARIABLE} + message(STATUS "Looking for ${VAR}") + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES) + endif() + try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_ROOT}/Modules/CheckVariableExists.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_VARIABLE_EXISTS_ADD_LIBRARIES} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_VARIABLE_DEFINITIONS} - "${CHECK_VARIABLE_EXISTS_ADD_LIBRARIES}" OUTPUT_VARIABLE OUTPUT) - IF(${VARIABLE}) - SET(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}") - MESSAGE(STATUS "Looking for ${VAR} - found") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if(${VARIABLE}) + set(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}") + message(STATUS "Looking for ${VAR} - found") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the variable ${VAR} exists passed with the following output:\n" "${OUTPUT}\n\n") - ELSE(${VARIABLE}) - SET(${VARIABLE} "" CACHE INTERNAL "Have variable ${VAR}") - MESSAGE(STATUS "Looking for ${VAR} - not found") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + else() + set(${VARIABLE} "" CACHE INTERNAL "Have variable ${VAR}") + message(STATUS "Looking for ${VAR} - not found") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the variable ${VAR} exists failed with the following output:\n" "${OUTPUT}\n\n") - ENDIF(${VARIABLE}) - ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") -ENDMACRO(CHECK_VARIABLE_EXISTS) + endif() + endif() +endmacro() diff --git a/Modules/Compiler/Absoft-Fortran.cmake b/Modules/Compiler/Absoft-Fortran.cmake index 1bb7b1f82..2e1666fbf 100644 --- a/Modules/Compiler/Absoft-Fortran.cmake +++ b/Modules/Compiler/Absoft-Fortran.cmake @@ -1,10 +1,10 @@ -SET(CMAKE_Fortran_FLAGS_INIT "") -SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "") -SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3") -SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") -SET(CMAKE_Fortran_MODDIR_FLAG "-YMOD_OUT_DIR=") -SET(CMAKE_Fortran_MODPATH_FLAG "-p") -SET(CMAKE_Fortran_VERBOSE_FLAG "-v") +set(CMAKE_Fortran_FLAGS_INIT "") +set(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") +set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "") +set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3") +set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") +set(CMAKE_Fortran_MODDIR_FLAG "-YMOD_OUT_DIR=") +set(CMAKE_Fortran_MODPATH_FLAG "-p") +set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree") diff --git a/Modules/Compiler/Clang-ASM.cmake b/Modules/Compiler/Clang-ASM.cmake new file mode 100644 index 000000000..16c9c159c --- /dev/null +++ b/Modules/Compiler/Clang-ASM.cmake @@ -0,0 +1,5 @@ +include(Compiler/Clang) + +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm) + +__compiler_clang(ASM) diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index f7baf686a..98fcd0b3f 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -1 +1,2 @@ -include(Compiler/GNU-C) +include(Compiler/Clang) +__compiler_clang(C) diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index d3c403a69..486e2af88 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -1 +1,2 @@ -include(Compiler/GNU-CXX) +include(Compiler/Clang) +__compiler_clang(CXX) diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake new file mode 100644 index 000000000..75a971dd7 --- /dev/null +++ b/Modules/Compiler/Clang.cmake @@ -0,0 +1,26 @@ + +#============================================================================= +# Copyright 2002-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__COMPILER_CLANG) + return() +endif() +set(__COMPILER_CLANG 1) + +include(Compiler/GNU) + +macro(__compiler_clang lang) + __compiler_gnu(${lang}) + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") +endmacro() diff --git a/Modules/Compiler/GNU-Fortran.cmake b/Modules/Compiler/GNU-Fortran.cmake index c710e8698..313ccbd02 100644 --- a/Modules/Compiler/GNU-Fortran.cmake +++ b/Modules/Compiler/GNU-Fortran.cmake @@ -5,13 +5,13 @@ set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form") # No -DNDEBUG for Fortran. -SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os") -SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3") +set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os") +set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3") # We require updates to CMake C++ code to support preprocessing rules # for Fortran. -SET(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE) -SET(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE) +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE) +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE) # Fortran-specific feature flags. -SET(CMAKE_Fortran_MODDIR_FLAG -J) +set(CMAKE_Fortran_MODDIR_FLAG -J) diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 6aecf90e8..faad41672 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -32,7 +32,7 @@ macro(__compiler_gnu lang) # header file as a warning if depfiles are enabled, causing check_header_file # tests to always succeed. Work around this by disabling dependency tracking # in try_compile mode. - GET_PROPERTY(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE) + get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE) if(NOT _IN_TC OR CMAKE_FORCE_DEPFILES) # distcc does not transform -o to -MT when invoking the preprocessor # internally, as it ought to. Work around this bug by setting -MT here @@ -45,10 +45,10 @@ macro(__compiler_gnu lang) set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") - set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") if(NOT APPLE) set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ") - endif(NOT APPLE) + endif() endmacro() diff --git a/Modules/Compiler/HP-ASM.cmake b/Modules/Compiler/HP-ASM.cmake index 8aa7bdb7d..b60f207b4 100644 --- a/Modules/Compiler/HP-ASM.cmake +++ b/Modules/Compiler/HP-ASM.cmake @@ -1,3 +1,3 @@ -SET(CMAKE_ASM_VERBOSE_FLAG "-v") +set(CMAKE_ASM_VERBOSE_FLAG "-v") set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s ) diff --git a/Modules/Compiler/HP-C.cmake b/Modules/Compiler/HP-C.cmake index dc7fbb21d..6dddcbae1 100644 --- a/Modules/Compiler/HP-C.cmake +++ b/Modules/Compiler/HP-C.cmake @@ -1,4 +1,4 @@ -SET(CMAKE_C_VERBOSE_FLAG "-v") +set(CMAKE_C_VERBOSE_FLAG "-v") -SET(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") -SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") diff --git a/Modules/Compiler/HP-CXX.cmake b/Modules/Compiler/HP-CXX.cmake index 82c1a861e..44470cae0 100644 --- a/Modules/Compiler/HP-CXX.cmake +++ b/Modules/Compiler/HP-CXX.cmake @@ -1,4 +1,4 @@ -SET(CMAKE_CXX_VERBOSE_FLAG "-v") +set(CMAKE_CXX_VERBOSE_FLAG "-v") -SET(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") -SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") diff --git a/Modules/Compiler/HP-Fortran.cmake b/Modules/Compiler/HP-Fortran.cmake index 04fb96ea4..cc56b4611 100644 --- a/Modules/Compiler/HP-Fortran.cmake +++ b/Modules/Compiler/HP-Fortran.cmake @@ -1,3 +1,3 @@ -SET(CMAKE_Fortran_VERBOSE_FLAG "-v") +set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "+source=fixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "+source=free") diff --git a/Modules/Compiler/Intel-ASM.cmake b/Modules/Compiler/Intel-ASM.cmake index 59b50a15c..74ceb0a6a 100644 --- a/Modules/Compiler/Intel-ASM.cmake +++ b/Modules/Compiler/Intel-ASM.cmake @@ -1,13 +1,13 @@ -SET(CMAKE_ASM_VERBOSE_FLAG "-v") +set(CMAKE_ASM_VERBOSE_FLAG "-v") -SET(CMAKE_ASM_FLAGS_INIT "") -SET(CMAKE_ASM_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") -SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") -SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") +set(CMAKE_ASM_FLAGS_INIT "") +set(CMAKE_ASM_FLAGS_DEBUG_INIT "-g") +set(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") +set(CMAKE_ASM_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") +set(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") -IF(UNIX) - SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S) -ELSE(UNIX) - SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm) -ENDIF(UNIX) +if(UNIX) + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S) +else() + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm) +endif() diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 4be91d084..e23317c14 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -1,10 +1,10 @@ -SET(CMAKE_C_VERBOSE_FLAG "-v") +set(CMAKE_C_VERBOSE_FLAG "-v") -SET(CMAKE_C_FLAGS_INIT "") -SET(CMAKE_C_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") -SET(CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") -SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") +set(CMAKE_C_FLAGS_INIT "") +set(CMAKE_C_FLAGS_DEBUG_INIT "-g") +set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") +set(CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") +set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") -SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") -SET(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index ff01a81f6..ae6021a68 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -1,10 +1,10 @@ -SET(CMAKE_CXX_VERBOSE_FLAG "-v") +set(CMAKE_CXX_VERBOSE_FLAG "-v") -SET(CMAKE_CXX_FLAGS_INIT "") -SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") -SET(CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") -SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") +set(CMAKE_CXX_FLAGS_INIT "") +set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") +set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") -SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") -SET(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/Intel-Fortran.cmake b/Modules/Compiler/Intel-Fortran.cmake index 467abdcf5..84f6182a7 100644 --- a/Modules/Compiler/Intel-Fortran.cmake +++ b/Modules/Compiler/Intel-Fortran.cmake @@ -1,9 +1,9 @@ -SET(CMAKE_Fortran_FLAGS_INIT "") -SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os") -SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3") -SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") -SET(CMAKE_Fortran_MODDIR_FLAG "-module ") -SET(CMAKE_Fortran_VERBOSE_FLAG "-v") +set(CMAKE_Fortran_FLAGS_INIT "") +set(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") +set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os") +set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3") +set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") +set(CMAKE_Fortran_MODDIR_FLAG "-module ") +set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free") diff --git a/Modules/Compiler/MIPSpro-C.cmake b/Modules/Compiler/MIPSpro-C.cmake index abf384ab8..675560c2a 100644 --- a/Modules/Compiler/MIPSpro-C.cmake +++ b/Modules/Compiler/MIPSpro-C.cmake @@ -1 +1 @@ -SET(CMAKE_C_VERBOSE_FLAG "-v") +set(CMAKE_C_VERBOSE_FLAG "-v") diff --git a/Modules/Compiler/MIPSpro-CXX.cmake b/Modules/Compiler/MIPSpro-CXX.cmake index f3c6b5f82..9fb191c75 100644 --- a/Modules/Compiler/MIPSpro-CXX.cmake +++ b/Modules/Compiler/MIPSpro-CXX.cmake @@ -1 +1 @@ -SET(CMAKE_CXX_VERBOSE_FLAG "-v") +set(CMAKE_CXX_VERBOSE_FLAG "-v") diff --git a/Modules/Compiler/MIPSpro-Fortran.cmake b/Modules/Compiler/MIPSpro-Fortran.cmake index 9220d3bf0..ffceea80d 100644 --- a/Modules/Compiler/MIPSpro-Fortran.cmake +++ b/Modules/Compiler/MIPSpro-Fortran.cmake @@ -1,3 +1,3 @@ -SET(CMAKE_Fortran_VERBOSE_FLAG "-v") +set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixedform") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-freeform") diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake index 9a89746b5..18f141ed3 100644 --- a/Modules/Compiler/NAG-Fortran.cmake +++ b/Modules/Compiler/NAG-Fortran.cmake @@ -32,3 +32,4 @@ set(CMAKE_Fortran_MODDIR_FLAG "-mdir ") set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-PIC") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free") +set(CMAKE_Fortran_COMPILE_OPTIONS_PIC "-PIC") diff --git a/Modules/Compiler/PGI-Fortran.cmake b/Modules/Compiler/PGI-Fortran.cmake index aebc7b1c2..264c23e74 100644 --- a/Modules/Compiler/PGI-Fortran.cmake +++ b/Modules/Compiler/PGI-Fortran.cmake @@ -4,12 +4,12 @@ __compiler_pgi(Fortran) set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-Mnofreeform") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-Mfreeform") -SET(CMAKE_Fortran_FLAGS_INIT "${CMAKE_Fortran_FLAGS_INIT} -Mpreprocess -Kieee") -SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "${CMAKE_Fortran_FLAGS_DEBUG_INIT} -Mbounds") +set(CMAKE_Fortran_FLAGS_INIT "${CMAKE_Fortran_FLAGS_INIT} -Mpreprocess -Kieee") +set(CMAKE_Fortran_FLAGS_DEBUG_INIT "${CMAKE_Fortran_FLAGS_DEBUG_INIT} -Mbounds") # We require updates to CMake C++ code to support preprocessing rules # for Fortran. -SET(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE) -SET(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE) +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE) +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE) -SET(CMAKE_Fortran_MODDIR_FLAG "-module ") +set(CMAKE_Fortran_MODDIR_FLAG "-module ") diff --git a/Modules/Compiler/PathScale-Fortran.cmake b/Modules/Compiler/PathScale-Fortran.cmake index e05bf2afc..d90362104 100644 --- a/Modules/Compiler/PathScale-Fortran.cmake +++ b/Modules/Compiler/PathScale-Fortran.cmake @@ -1,6 +1,6 @@ include(Compiler/PathScale) __compiler_pathscale(Fortran) -SET(CMAKE_Fortran_MODDIR_FLAG "-module ") +set(CMAKE_Fortran_MODDIR_FLAG "-module ") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixedform") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-freeform") diff --git a/Modules/Compiler/SunPro-ASM.cmake b/Modules/Compiler/SunPro-ASM.cmake index dfc5702ee..2fa8b9950 100644 --- a/Modules/Compiler/SunPro-ASM.cmake +++ b/Modules/Compiler/SunPro-ASM.cmake @@ -1,24 +1,24 @@ set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s ) -SET(CMAKE_ASM_VERBOSE_FLAG "-#") +set(CMAKE_ASM_VERBOSE_FLAG "-#") -SET(CMAKE_SHARED_LIBRARY_ASM_FLAGS "-KPIC") -SET(CMAKE_SHARED_LIBRARY_CREATE_ASM_FLAGS "-G") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_ASM_FLAG "-R") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_ASM_FLAG_SEP ":") -SET(CMAKE_SHARED_LIBRARY_SONAME_ASM_FLAG "-h") +set(CMAKE_SHARED_LIBRARY_ASM_FLAGS "-KPIC") +set(CMAKE_SHARED_LIBRARY_CREATE_ASM_FLAGS "-G") +set(CMAKE_SHARED_LIBRARY_RUNTIME_ASM_FLAG "-R") +set(CMAKE_SHARED_LIBRARY_RUNTIME_ASM_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_SONAME_ASM_FLAG "-h") -SET(CMAKE_ASM_FLAGS_INIT "") -SET(CMAKE_ASM_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") -SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG") -SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-g -xO2") +set(CMAKE_ASM_FLAGS_INIT "") +set(CMAKE_ASM_FLAGS_DEBUG_INIT "-g") +set(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") +set(CMAKE_ASM_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG") +set(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG") # Initialize ASM link type selection flags. These flags are used when # building a shared library, shared module, or executable that links # to other libraries to select whether to use the static or shared # versions of the libraries. -FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_ASM_FLAGS "-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_ASM_FLAGS "-Bdynamic") -ENDFOREACH(type) +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_ASM_FLAGS "-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_ASM_FLAGS "-Bdynamic") +endforeach() diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake index a1a3ae118..c5b5203fd 100644 --- a/Modules/Compiler/SunPro-C.cmake +++ b/Modules/Compiler/SunPro-C.cmake @@ -1,27 +1,27 @@ -SET(CMAKE_C_VERBOSE_FLAG "-#") +set(CMAKE_C_VERBOSE_FLAG "-#") -SET(CMAKE_C_COMPILE_OPTIONS_PIC -KPIC) -SET(CMAKE_C_COMPILE_OPTIONS_PIE -KPIE) -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC") -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-R") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") -SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-h") +set(CMAKE_C_COMPILE_OPTIONS_PIC -KPIC) +set(CMAKE_C_COMPILE_OPTIONS_PIE -KPIE) +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-R") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-h") -SET(CMAKE_C_FLAGS_INIT "") -SET(CMAKE_C_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") -SET(CMAKE_C_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG") -SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g -xO2") +set(CMAKE_C_FLAGS_INIT "") +set(CMAKE_C_FLAGS_DEBUG_INIT "-g") +set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") +set(CMAKE_C_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG") +set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG") # Initialize C link type selection flags. These flags are used when # building a shared library, shared module, or executable that links # to other libraries to select whether to use the static or shared # versions of the libraries. -FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic") -ENDFOREACH(type) +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic") +endforeach() -SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") -SET(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index 702e42458..59687129a 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -1,33 +1,33 @@ -SET(CMAKE_CXX_VERBOSE_FLAG "-v") +set(CMAKE_CXX_VERBOSE_FLAG "-v") -SET(CMAKE_CXX_COMPILE_OPTIONS_PIC -KPIC) -SET(CMAKE_CXX_COMPILE_OPTIONS_PIE -KPIE) -SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC") -SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-h") +set(CMAKE_CXX_COMPILE_OPTIONS_PIC -KPIC) +set(CMAKE_CXX_COMPILE_OPTIONS_PIE -KPIE) +set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC") +set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G") +set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R") +set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-h") -SET(CMAKE_CXX_FLAGS_INIT "") -SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") -SET(CMAKE_CXX_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG") -SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g -xO2") +set(CMAKE_CXX_FLAGS_INIT "") +set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") +set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG") # Initialize C link type selection flags. These flags are used when # building a shared library, shared module, or executable that links # to other libraries to select whether to use the static or shared # versions of the libraries. -FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Bdynamic") -ENDFOREACH(type) +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Bdynamic") +endforeach() -SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") -SET(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") # Create archives with "CC -xar" in case user adds "-instances=extern" # so that template instantiations are available to archive members. -SET(CMAKE_CXX_CREATE_STATIC_LIBRARY +set(CMAKE_CXX_CREATE_STATIC_LIBRARY " -xar -o " " ") diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake index 86d6def34..18e75b9e3 100644 --- a/Modules/Compiler/SunPro-Fortran.cmake +++ b/Modules/Compiler/SunPro-Fortran.cmake @@ -1,18 +1,18 @@ -SET(CMAKE_Fortran_VERBOSE_FLAG "-v") +set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free") -SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-KPIC") -SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-G") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-R") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") -SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-h") +set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-KPIC") +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-G") +set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-R") +set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-h") set(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG "-R") -SET(CMAKE_Fortran_FLAGS_INIT "") -SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") -SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG") -SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-g -xO2") -SET(CMAKE_Fortran_MODDIR_FLAG "-moddir=") -SET(CMAKE_Fortran_MODPATH_FLAG "-M") +set(CMAKE_Fortran_FLAGS_INIT "") +set(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") +set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") +set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG") +set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG") +set(CMAKE_Fortran_MODDIR_FLAG "-moddir=") +set(CMAKE_Fortran_MODPATH_FLAG "-M") diff --git a/Modules/Compiler/TI_DSP-ASM.cmake b/Modules/Compiler/TI_DSP-ASM.cmake new file mode 100644 index 000000000..e097626b6 --- /dev/null +++ b/Modules/Compiler/TI_DSP-ASM.cmake @@ -0,0 +1,8 @@ +set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") +set(CMAKE_LINK_LIBRARY_FLAG "--library=") +set(CMAKE_INCLUDE_FLAG_ASM "--include_path=") + +set(CMAKE_ASM_COMPILE_OBJECT " --compile_only --asm_file= --output_file=") +set(CMAKE_ASM_LINK_EXECUTABLE " --run_linker --output_file= ") + +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm;s;abs) diff --git a/Modules/Compiler/TI_DSP-C.cmake b/Modules/Compiler/TI_DSP-C.cmake new file mode 100644 index 000000000..b5809942e --- /dev/null +++ b/Modules/Compiler/TI_DSP-C.cmake @@ -0,0 +1,10 @@ +set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") +set(CMAKE_LINK_LIBRARY_FLAG "--library=") +set(CMAKE_INCLUDE_FLAG_C "--include_path=") + +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --c_file= --output_file=") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preproc_only --c_file= --output_file=") + +set(CMAKE_C_COMPILE_OBJECT " --compile_only --c_file= --output_file=") +set(CMAKE_C_ARCHIVE_CREATE " -r ") +set(CMAKE_C_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") diff --git a/Modules/Compiler/TI_DSP-CXX.cmake b/Modules/Compiler/TI_DSP-CXX.cmake new file mode 100644 index 000000000..8cf5ac37e --- /dev/null +++ b/Modules/Compiler/TI_DSP-CXX.cmake @@ -0,0 +1,10 @@ +set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") +set(CMAKE_LINK_LIBRARY_FLAG "--library=") +set(CMAKE_INCLUDE_FLAG_CXX "--include_path=") + +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --cpp_file= --output_file=") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preproc_only --cpp_file= --output_file=") + +set(CMAKE_CXX_COMPILE_OBJECT " --compile_only --cpp_file= --output_file=") +set(CMAKE_CXX_ARCHIVE_CREATE " -r ") +set(CMAKE_CXX_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") diff --git a/Modules/Compiler/TinyCC-C.cmake b/Modules/Compiler/TinyCC-C.cmake index 4a48c0af5..f7937acdf 100644 --- a/Modules/Compiler/TinyCC-C.cmake +++ b/Modules/Compiler/TinyCC-C.cmake @@ -1,8 +1,8 @@ -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # no optimization in tcc: -SET (CMAKE_C_FLAGS_INIT "") -SET (CMAKE_C_FLAGS_DEBUG_INIT "-g") -SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-DNDEBUG") -SET (CMAKE_C_FLAGS_RELEASE_INIT "-DNDEBUG") -SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g") +set (CMAKE_C_FLAGS_INIT "") +set (CMAKE_C_FLAGS_DEBUG_INIT "-g") +set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-DNDEBUG") +set (CMAKE_C_FLAGS_RELEASE_INIT "-DNDEBUG") +set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g -DNDEBUG") diff --git a/Modules/Compiler/XL-ASM.cmake b/Modules/Compiler/XL-ASM.cmake index e5d4ffa85..07507f9be 100644 --- a/Modules/Compiler/XL-ASM.cmake +++ b/Modules/Compiler/XL-ASM.cmake @@ -1,13 +1,13 @@ -SET(CMAKE_ASM_VERBOSE_FLAG "-V") +set(CMAKE_ASM_VERBOSE_FLAG "-V") # -qthreaded = Ensures that all optimizations will be thread-safe # -qalias=noansi = Turns off type-based aliasing completely (safer optimizer) # -qhalt=e = Halt on error messages (rather than just severe errors) -SET(CMAKE_ASM_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e -qsourcetype=assembler") +set(CMAKE_ASM_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e -qsourcetype=assembler") -SET(CMAKE_ASM_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-O -DNDEBUG") -SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-O -DNDEBUG") -SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-g") +set(CMAKE_ASM_FLAGS_DEBUG_INIT "-g") +set(CMAKE_ASM_FLAGS_RELEASE_INIT "-O -DNDEBUG") +set(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-O -DNDEBUG") +set(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-g -DNDEBUG") -SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s ) +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s ) diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake index ae869e37e..09a55291e 100644 --- a/Modules/Compiler/XL-C.cmake +++ b/Modules/Compiler/XL-C.cmake @@ -6,4 +6,4 @@ set(CMAKE_C_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT} -DNDEBUG") # -qthreaded = Ensures that all optimizations will be thread-safe # -qalias=noansi = Turns off type-based aliasing completely (safer optimizer) # -qhalt=e = Halt on error messages (rather than just severe errors) -SET(CMAKE_C_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e") +set(CMAKE_C_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e") diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index 29c4b5e37..6c842cd77 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -5,7 +5,7 @@ set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT} -DNDEBUG # -qthreaded = Ensures that all optimizations will be thread-safe # -qhalt=e = Halt on error messages (rather than just severe errors) -SET(CMAKE_CXX_FLAGS_INIT "-qthreaded -qhalt=e") +set(CMAKE_CXX_FLAGS_INIT "-qthreaded -qhalt=e") -SET(CMAKE_CXX_COMPILE_OBJECT +set(CMAKE_CXX_COMPILE_OBJECT " -+ -o -c ") diff --git a/Modules/Compiler/XL-Fortran.cmake b/Modules/Compiler/XL-Fortran.cmake index e7026f11a..f1c9158b2 100644 --- a/Modules/Compiler/XL-Fortran.cmake +++ b/Modules/Compiler/XL-Fortran.cmake @@ -4,14 +4,14 @@ __compiler_xl(Fortran) set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-qfixed") # [=] set(CMAKE_Fortran_FORMAT_FREE_FLAG "-qfree") # [=f90|ibm] -SET(CMAKE_Fortran_MODDIR_FLAG "-qmoddir=") +set(CMAKE_Fortran_MODDIR_FLAG "-qmoddir=") -SET(CMAKE_Fortran_DEFINE_FLAG "-WF,-D") +set(CMAKE_Fortran_DEFINE_FLAG "-WF,-D") # -qthreaded = Ensures that all optimizations will be thread-safe # -qhalt=e = Halt on error messages (rather than just severe errors) -SET(CMAKE_Fortran_FLAGS_INIT "-qthreaded -qhalt=e") +set(CMAKE_Fortran_FLAGS_INIT "-qthreaded -qhalt=e") # We require updates to CMake C++ code to support preprocessing rules for Fortran. -SET(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE) -SET(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE) +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE) +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE) diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake index d293610c3..7bf5020ac 100644 --- a/Modules/Compiler/XL.cmake +++ b/Modules/Compiler/XL.cmake @@ -27,6 +27,7 @@ find_program(CMAKE_XL_CreateExportList macro(__compiler_xl lang) # Feature flags. set(CMAKE_${lang}_VERBOSE_FLAG "-V") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-qpic") set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g") set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O") diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in new file mode 100644 index 000000000..ab4705fa3 --- /dev/null +++ b/Modules/CompilerId/VS-10.vcxproj.in @@ -0,0 +1,53 @@ + + + + + Debug + @id_arch@ + + + + {CAE07175-D007-4FC3-BFE8-47B392814159} + CompilerId@id_lang@ + Win32Proj + + + + Application + @id_toolset@ + MultiByte + + + + <_ProjectFileVersion>10.0.30319.1 + .\ + $(Configuration)\ + false + + + + Disabled + %(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDebugDLL + + + TurnOffAllWarnings + + + + + false + Console + @id_machine_10@ + + + for %%i in (@id_cl@) do %40echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i + + + + + + + diff --git a/Modules/CompilerId/VS-6.dsp.in b/Modules/CompilerId/VS-6.dsp.in new file mode 100644 index 000000000..4f7e67613 --- /dev/null +++ b/Modules/CompilerId/VS-6.dsp.in @@ -0,0 +1,48 @@ +# Microsoft Developer Studio Project File - Name="CompilerId@id_lang@" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 + +# TARGTYPE "Win32 (@id_machine_6@) Application" 0x0101 + +CFG=CompilerId@id_lang@ - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CompilerId@id_lang@.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CompilerId@id_lang@.mak" CFG="CompilerId@id_lang@ - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CompilerId@id_lang@ - Win32 Debug" (based on "Win32 (@id_machine_6@) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +CPP=cl.exe +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "." +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD CPP /nologo /MDd /c +LINK32=link.exe +# ADD LINK32 /nologo /version:0.0 /subsystem:console /machine:@id_machine_6@ /out:"CompilerId@id_lang@.exe" /IGNORE:4089 +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Cmds=for %%i in (@id_cl@) do @echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i +# End Special Build Tool +# Begin Target + +# Name "CompilerId@id_lang@ - Win32 Debug" +# Begin Group "Source Files" + +# Begin Source File + +SOURCE="@id_src@" +# End Source File +# End Group +# End Target +# End Project diff --git a/Modules/CompilerId/VS-7.vcproj.in b/Modules/CompilerId/VS-7.vcproj.in new file mode 100644 index 000000000..fa48cadb3 --- /dev/null +++ b/Modules/CompilerId/VS-7.vcproj.in @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Modules/CompilerId/Xcode-1.pbxproj.in b/Modules/CompilerId/Xcode-1.pbxproj.in new file mode 100644 index 000000000..f06960fec --- /dev/null +++ b/Modules/CompilerId/Xcode-1.pbxproj.in @@ -0,0 +1,120 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + 014CEA460018CE2711CA2923 = { + buildSettings = { + }; + isa = PBXBuildStyle; + name = Development; + }; + 08FB7793FE84155DC02AAC07 = { + buildSettings = { + }; + buildStyles = ( + 014CEA460018CE2711CA2923, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 08FB7794FE84155DC02AAC07; + projectDirPath = ""; + targets = ( + 8DD76FA90486AB0100D96B5E, + ); + }; + 08FB7794FE84155DC02AAC07 = { + children = ( + 08FB7795FE84155DC02AAC07, + 1AB674ADFE9D54B511CA2CBB, + ); + isa = PBXGroup; + name = CompilerId@id_lang@; + refType = 4; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 = { + children = ( + 2C18F0B415DC1DC700593670, + ); + isa = PBXGroup; + name = Source; + refType = 4; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB = { + children = ( + 8DD76F6C0486A84900D96B5E, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = ""; + }; + 2C18F0B415DC1DC700593670 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = @id_type@; + path = @id_src@; + refType = 4; + sourceTree = ""; + }; + 2C18F0B615DC1E0300593670 = { + fileRef = 2C18F0B415DC1DC700593670; + isa = PBXBuildFile; + settings = { + }; + }; + 2C8FEB8E15DC1A1A00E56A5D = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"GCC_VERSION=$GCC_VERSION\""; + }; + 8DD76FA90486AB0100D96B5E = { + buildPhases = ( + 2C18F0B515DC1DCE00593670, + 2C8FEB8E15DC1A1A00E56A5D, + ); + buildRules = ( + ); + buildSettings = { + PRODUCT_NAME = CompilerId@id_lang@; + SYMROOT = .; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = CompilerId@id_lang@; + productName = CompilerId@id_lang@; + productReference = 8DD76F6C0486A84900D96B5E; + productType = "com.apple.product-type.tool"; + }; + 2C18F0B515DC1DCE00593670 = { + buildActionMask = 2147483647; + files = ( + 2C18F0B615DC1E0300593670, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8DD76F6C0486A84900D96B5E = { + explicitFileType = "compiled.mach-o.executable"; + includeInIndex = 0; + isa = PBXFileReference; + path = CompilerId@id_lang@; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; + }; + rootObject = 08FB7793FE84155DC02AAC07; +} diff --git a/Modules/CompilerId/Xcode-2.pbxproj.in b/Modules/CompilerId/Xcode-2.pbxproj.in new file mode 100644 index 000000000..e3c7aa910 --- /dev/null +++ b/Modules/CompilerId/Xcode-2.pbxproj.in @@ -0,0 +1,119 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + + 2C18F0B615DC1E0300593670 = {isa = PBXBuildFile; fileRef = 2C18F0B415DC1DC700593670; }; + 2C18F0B415DC1DC700593670 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = @id_type@; path = @id_src@; sourceTree = ""; }; + 8DD76F6C0486A84900D96B5E = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CompilerId@id_lang@; sourceTree = BUILT_PRODUCTS_DIR; }; + + 08FB7794FE84155DC02AAC07 = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07, + 1AB674ADFE9D54B511CA2CBB, + ); + name = CompilerId@id_lang@; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 = { + isa = PBXGroup; + children = ( + 2C18F0B415DC1DC700593670, + ); + name = Source; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB = { + isa = PBXGroup; + children = ( + 8DD76F6C0486A84900D96B5E, + ); + name = Products; + sourceTree = ""; + }; + + 8DD76FA90486AB0100D96B5E = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB928508733DD80010E9CD; + buildPhases = ( + 2C18F0B515DC1DCE00593670, + 2C8FEB8E15DC1A1A00E56A5D, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CompilerId@id_lang@; + productName = CompilerId@id_lang@; + productReference = 8DD76F6C0486A84900D96B5E; + productType = "com.apple.product-type.tool"; + }; + 08FB7793FE84155DC02AAC07 = { + isa = PBXProject; + buildConfigurationList = 1DEB928908733DD80010E9CD; + hasScannedForEncodings = 1; + mainGroup = 08FB7794FE84155DC02AAC07; + projectDirPath = ""; + targets = ( + 8DD76FA90486AB0100D96B5E, + ); + }; + 2C8FEB8E15DC1A1A00E56A5D = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"GCC_VERSION=$GCC_VERSION\""; + }; + 2C18F0B515DC1DCE00593670 = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2C18F0B615DC1E0300593670, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1DEB928608733DD80010E9CD = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = CompilerId@id_lang@; + }; + name = Debug; + }; + 1DEB928A08733DD80010E9CD = { + isa = XCBuildConfiguration; + buildSettings = { + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; + SYMROOT = .; + }; + name = Debug; + }; + 1DEB928508733DD80010E9CD = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB928608733DD80010E9CD, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 1DEB928908733DD80010E9CD = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB928A08733DD80010E9CD, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + }; + rootObject = 08FB7793FE84155DC02AAC07; +} diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in new file mode 100644 index 000000000..d94a803fb --- /dev/null +++ b/Modules/CompilerId/Xcode-3.pbxproj.in @@ -0,0 +1,108 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + + 2C18F0B615DC1E0300593670 = {isa = PBXBuildFile; fileRef = 2C18F0B415DC1DC700593670; }; + 2C18F0B415DC1DC700593670 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = @id_type@; path = @id_src@; sourceTree = ""; }; + 08FB7794FE84155DC02AAC07 = { + isa = PBXGroup; + children = ( + 2C18F0B415DC1DC700593670, + ); + name = CompilerId@id_lang@; + sourceTree = ""; + }; + 8DD76FA90486AB0100D96B5E = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB928508733DD80010E9CD; + buildPhases = ( + 2C18F0B515DC1DCE00593670, + 2C8FEB8E15DC1A1A00E56A5D, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CompilerId@id_lang@; + productName = CompilerId@id_lang@; + productType = "com.apple.product-type.tool"; + }; + 08FB7793FE84155DC02AAC07 = { + isa = PBXProject; + buildConfigurationList = 1DEB928908733DD80010E9CD; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76FA90486AB0100D96B5E, + ); + }; + 2C8FEB8E15DC1A1A00E56A5D = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"GCC_VERSION=$GCC_VERSION\""; + showEnvVarsInLog = 0; + }; + 2C18F0B515DC1DCE00593670 = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2C18F0B615DC1E0300593670, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1DEB928608733DD80010E9CD = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = CompilerId@id_lang@; + }; + name = Debug; + }; + 1DEB928A08733DD80010E9CD = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + ONLY_ACTIVE_ARCH = YES; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; + SYMROOT = .; + @id_toolset@ + }; + name = Debug; + }; + 1DEB928508733DD80010E9CD = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB928608733DD80010E9CD, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 1DEB928908733DD80010E9CD = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB928A08733DD80010E9CD, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + }; + rootObject = 08FB7793FE84155DC02AAC07; +} diff --git a/Modules/Dart.cmake b/Modules/Dart.cmake index 870545471..bd744b003 100644 --- a/Modules/Dart.cmake +++ b/Modules/Dart.cmake @@ -3,10 +3,10 @@ # It supports using the old Dart 1 Tcl client for driving dashboard # submissions as well as testing with CTest. This module should be included # in the CMakeLists.txt file at the top of a project. Typical usage: -# INCLUDE(Dart) -# IF(BUILD_TESTING) +# include(Dart) +# if(BUILD_TESTING) # # ... testing related CMake code ... -# ENDIF(BUILD_TESTING) +# endif() # The BUILD_TESTING option is created by the Dart module to determine # whether testing support should be enabled. The default is ON. @@ -32,10 +32,10 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -OPTION(BUILD_TESTING "Build the testing tree." ON) +option(BUILD_TESTING "Build the testing tree." ON) -IF(BUILD_TESTING) - FIND_PACKAGE(Dart QUIET) +if(BUILD_TESTING) + find_package(Dart QUIET) # # Section #1: @@ -44,58 +44,58 @@ IF(BUILD_TESTING) # on the client and configure site name and build name. # - SET(RUN_FROM_DART 1) - INCLUDE(CTest) - SET(RUN_FROM_DART) + set(RUN_FROM_DART 1) + include(CTest) + set(RUN_FROM_DART) - FIND_PROGRAM(COMPRESSIONCOMMAND NAMES gzip compress zip + find_program(COMPRESSIONCOMMAND NAMES gzip compress zip DOC "Path to program used to compress files for transfer to the dart server") - FIND_PROGRAM(GUNZIPCOMMAND gunzip DOC "Path to gunzip executable") - FIND_PROGRAM(JAVACOMMAND java DOC "Path to java command, used by the Dart server to create html.") - OPTION(DART_VERBOSE_BUILD "Show the actual output of the build, or if off show a . for each 1024 bytes." + find_program(GUNZIPCOMMAND gunzip DOC "Path to gunzip executable") + find_program(JAVACOMMAND java DOC "Path to java command, used by the Dart server to create html.") + option(DART_VERBOSE_BUILD "Show the actual output of the build, or if off show a . for each 1024 bytes." OFF) - OPTION(DART_BUILD_ERROR_REPORT_LIMIT "Limit of reported errors, -1 reports all." -1 ) - OPTION(DART_BUILD_WARNING_REPORT_LIMIT "Limit of reported warnings, -1 reports all." -1 ) + option(DART_BUILD_ERROR_REPORT_LIMIT "Limit of reported errors, -1 reports all." -1 ) + option(DART_BUILD_WARNING_REPORT_LIMIT "Limit of reported warnings, -1 reports all." -1 ) - SET(VERBOSE_BUILD ${DART_VERBOSE_BUILD}) - SET(BUILD_ERROR_REPORT_LIMIT ${DART_BUILD_ERROR_REPORT_LIMIT}) - SET(BUILD_WARNING_REPORT_LIMIT ${DART_BUILD_WARNING_REPORT_LIMIT}) - SET (DELIVER_CONTINUOUS_EMAIL "Off" CACHE BOOL "Should Dart server send email when build errors are found in Continuous builds?") + set(VERBOSE_BUILD ${DART_VERBOSE_BUILD}) + set(BUILD_ERROR_REPORT_LIMIT ${DART_BUILD_ERROR_REPORT_LIMIT}) + set(BUILD_WARNING_REPORT_LIMIT ${DART_BUILD_WARNING_REPORT_LIMIT}) + set (DELIVER_CONTINUOUS_EMAIL "Off" CACHE BOOL "Should Dart server send email when build errors are found in Continuous builds?") - MARK_AS_ADVANCED( + mark_as_advanced( COMPRESSIONCOMMAND - DART_BUILD_ERROR_REPORT_LIMIT - DART_BUILD_WARNING_REPORT_LIMIT + DART_BUILD_ERROR_REPORT_LIMIT + DART_BUILD_WARNING_REPORT_LIMIT DART_TESTING_TIMEOUT DART_VERBOSE_BUILD DELIVER_CONTINUOUS_EMAIL GUNZIPCOMMAND - JAVACOMMAND + JAVACOMMAND ) - SET(HAVE_DART) - IF(EXISTS "${DART_ROOT}/Source/Client/Dart.conf.in") - SET(HAVE_DART 1) - ENDIF(EXISTS "${DART_ROOT}/Source/Client/Dart.conf.in") + set(HAVE_DART) + if(EXISTS "${DART_ROOT}/Source/Client/Dart.conf.in") + set(HAVE_DART 1) + endif() # # Section #2: - # + # # Make necessary directories and configure testing scripts # # find a tcl shell command - IF(HAVE_DART) - FIND_PACKAGE(Tclsh) - ENDIF(HAVE_DART) + if(HAVE_DART) + find_package(Tclsh) + endif() - IF (HAVE_DART) + if (HAVE_DART) # make directories in the binary tree - FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/Testing/HTML/TestingResults/Dashboard" + file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/Testing/HTML/TestingResults/Dashboard" "${PROJECT_BINARY_DIR}/Testing/HTML/TestingResults/Sites/${SITE}/${BUILDNAME}") # configure files - CONFIGURE_FILE( + configure_file( "${DART_ROOT}/Source/Client/Dart.conf.in" "${PROJECT_BINARY_DIR}/DartConfiguration.tcl" ) @@ -107,16 +107,16 @@ IF(BUILD_TESTING) # # add testing targets - SET(DART_EXPERIMENTAL_NAME Experimental) - IF(DART_EXPERIMENTAL_USE_PROJECT_NAME) - SET(DART_EXPERIMENTAL_NAME "${DART_EXPERIMENTAL_NAME}${PROJECT_NAME}") - ENDIF(DART_EXPERIMENTAL_USE_PROJECT_NAME) - ENDIF (HAVE_DART) - - SET(RUN_FROM_CTEST_OR_DART 1) - INCLUDE(CTestTargets) - SET(RUN_FROM_CTEST_OR_DART) -ENDIF(BUILD_TESTING) + set(DART_EXPERIMENTAL_NAME Experimental) + if(DART_EXPERIMENTAL_USE_PROJECT_NAME) + set(DART_EXPERIMENTAL_NAME "${DART_EXPERIMENTAL_NAME}${PROJECT_NAME}") + endif() + endif () + + set(RUN_FROM_CTEST_OR_DART 1) + include(CTestTargets) + set(RUN_FROM_CTEST_OR_DART) +endif() # # End of Dart.cmake diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index ad7f80517..9e49ac776 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -44,6 +44,7 @@ CVSUpdateOptions: @CVS_UPDATE_OPTIONS@ # Subversion options SVNCommand: @SVNCOMMAND@ +SVNOptions: @CTEST_SVN_OPTIONS@ SVNUpdateOptions: @SVN_UPDATE_OPTIONS@ # Git options diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index edf4b4e76..5f8a9fbf3 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -80,7 +80,7 @@ # The functions defined in this file depend on the fixup_bundle function # (and others) found in BundleUtilities.cmake -include(BundleUtilities) +include("${CMAKE_CURRENT_LIST_DIR}/BundleUtilities.cmake") set(DeployQt4_cmake_dir "${CMAKE_CURRENT_LIST_DIR}") set(DeployQt4_apple_plugins_dir "PlugIns") @@ -101,7 +101,7 @@ function(resolve_qt4_paths paths_var) if(${executable_path}) list(APPEND paths_resolved "${executable_path}/${path}") else() - list(APPEND paths_resolved "\${CMAKE_INSTALL_PREFIX}/${path}") + list(APPEND paths_resolved "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${path}") endif() endif() endforeach() @@ -293,9 +293,9 @@ function(install_qt4_executable executable) resolve_qt4_paths(libs "") install(CODE - "INCLUDE(\"${DeployQt4_cmake_dir}/DeployQt4.cmake\") - SET(BU_CHMOD_BUNDLE_ITEMS TRUE) - FIXUP_QT4_EXECUTABLE(\"\${CMAKE_INSTALL_PREFIX}/${executable}\" \"\" \"${libs}\" \"${dirs}\" \"${plugins_dir}\" \"${request_qt_conf}\")" + "include(\"${DeployQt4_cmake_dir}/DeployQt4.cmake\") + set(BU_CHMOD_BUNDLE_ITEMS TRUE) + FIXUP_QT4_EXECUTABLE(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${executable}\" \"\" \"${libs}\" \"${dirs}\" \"${plugins_dir}\" \"${request_qt_conf}\")" ${component} ) endfunction() diff --git a/Modules/Documentation.cmake b/Modules/Documentation.cmake index ffeb371cc..d1c3afe47 100644 --- a/Modules/Documentation.cmake +++ b/Modules/Documentation.cmake @@ -18,35 +18,35 @@ # # Build the documentation ? # -OPTION(BUILD_DOCUMENTATION "Build the documentation (Doxygen)." OFF) -MARK_AS_ADVANCED(BUILD_DOCUMENTATION) +option(BUILD_DOCUMENTATION "Build the documentation (Doxygen)." OFF) +mark_as_advanced(BUILD_DOCUMENTATION) -IF (BUILD_DOCUMENTATION) +if (BUILD_DOCUMENTATION) # # Check for the tools # - FIND_PACKAGE(UnixCommands) - FIND_PACKAGE(Doxygen) - FIND_PACKAGE(Gnuplot) - FIND_PACKAGE(HTMLHelp) - FIND_PACKAGE(Perl) - FIND_PACKAGE(Wget) - - OPTION(DOCUMENTATION_HTML_HELP + find_package(UnixCommands) + find_package(Doxygen) + find_package(Gnuplot) + find_package(HTMLHelp) + find_package(Perl) + find_package(Wget) + + option(DOCUMENTATION_HTML_HELP "Build the HTML Help file (CHM)." OFF) - OPTION(DOCUMENTATION_HTML_TARZ + option(DOCUMENTATION_HTML_TARZ "Build a compressed tar archive of the HTML doc." OFF) - MARK_AS_ADVANCED( + mark_as_advanced( DOCUMENTATION_HTML_HELP DOCUMENTATION_HTML_TARZ ) - # + # # The documentation process is controled by a batch file. # We will probably need bash to create the custom target # -ENDIF (BUILD_DOCUMENTATION) +endif () diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake new file mode 100644 index 000000000..187f408ff --- /dev/null +++ b/Modules/ExternalData.cmake @@ -0,0 +1,768 @@ +# - Manage data files stored outside source tree +# Use this module to unambiguously reference data files stored outside the +# source tree and fetch them at build time from arbitrary local and remote +# content-addressed locations. Functions provided by this module recognize +# arguments with the syntax "DATA{}" as references to external data, +# replace them with full paths to local copies of those data, and create build +# rules to fetch and update the local copies. +# +# The DATA{} syntax is literal and the is a full or relative path +# within the source tree. The source tree must contain either a real data +# file at or a "content link" at containing a hash of the +# real file using a hash algorithm corresponding to . For example, the +# argument "DATA{img.png}" may be satisfied by either a real "img.png" file in +# the current source directory or a "img.png.md5" file containing its MD5 sum. +# +# The 'ExternalData_Expand_Arguments' function evaluates DATA{} references +# in its arguments and constructs a new list of arguments: +# ExternalData_Expand_Arguments( +# # Name of data management target +# # Output variable +# [args...] # Input arguments, DATA{} allowed +# ) +# It replaces each DATA{} reference in an argument with the full path of a +# real data file on disk that will exist after the builds. +# +# The 'ExternalData_Add_Test' function wraps around the CMake add_test() +# command but supports DATA{} references in its arguments: +# ExternalData_Add_Test( +# # Name of data management target +# ... # Arguments of add_test(), DATA{} allowed +# ) +# It passes its arguments through ExternalData_Expand_Arguments and then +# invokes add_test() using the results. +# +# The 'ExternalData_Add_Target' function creates a custom target to manage +# local instances of data files stored externally: +# ExternalData_Add_Target( +# # Name of data management target +# ) +# It creates custom commands in the target as necessary to make data files +# available for each DATA{} reference previously evaluated by other functions +# provided by this module. A list of URL templates must be provided in the +# variable ExternalData_URL_TEMPLATES using the placeholders "%(algo)" and +# "%(hash)" in each template. Data fetch rules try each URL template in order +# by substituting the hash algorithm name for "%(algo)" and the hash value for +# "%(hash)". +# +# The following hash algorithms are supported: +# %(algo) Description +# ------- ----- ----------- +# MD5 .md5 Message-Digest Algorithm 5, RFC 1321 +# SHA1 .sha1 US Secure Hash Algorithm 1, RFC 3174 +# SHA224 .sha224 US Secure Hash Algorithms, RFC 4634 +# SHA256 .sha256 US Secure Hash Algorithms, RFC 4634 +# SHA384 .sha384 US Secure Hash Algorithms, RFC 4634 +# SHA512 .sha512 US Secure Hash Algorithms, RFC 4634 +# Note that the hashes are used only for unique data identification and +# download verification. This is not security software. +# +# Example usage: +# include(ExternalData) +# set(ExternalData_URL_TEMPLATES "file:///local/%(algo)/%(hash)" +# "http://data.org/%(algo)/%(hash)") +# ExternalData_Add_Test(MyData +# NAME MyTest +# COMMAND MyExe DATA{MyInput.png} +# ) +# ExternalData_Add_Target(MyData) +# When test "MyTest" runs the "DATA{MyInput.png}" argument will be replaced by +# the full path to a real instance of the data file "MyInput.png" on disk. If +# the source tree contains a content link such as "MyInput.png.md5" then the +# "MyData" target creates a real "MyInput.png" in the build tree. +# +# The DATA{} syntax can be told to fetch a file series using the form +# "DATA{,:}", where the ":" is literal. If the source tree contains a +# group of files or content links named like a series then a reference to one +# member adds rules to fetch all of them. Although all members of a series +# are fetched, only the file originally named by the DATA{} argument is +# substituted for it. The default configuration recognizes file series names +# ending with "#.ext", "_#.ext", ".#.ext", or "-#.ext" where "#" is a sequence +# of decimal digits and ".ext" is any single extension. Configure it with a +# regex that parses and parts from the end of : +# ExternalData_SERIES_PARSE = regex of the form ()()$ +# For more complicated cases set: +# ExternalData_SERIES_PARSE = regex with at least two () groups +# ExternalData_SERIES_PARSE_PREFIX = regex group number, if any +# ExternalData_SERIES_PARSE_NUMBER = regex group number +# ExternalData_SERIES_PARSE_SUFFIX = regex group number +# Configure series number matching with a regex that matches the +# part of series members named : +# ExternalData_SERIES_MATCH = regex matching in all series members +# Note that the of a series does not include a hash-algorithm +# extension. +# +# The DATA{} syntax can alternatively match files associated with the named +# file and contained in the same directory. Associated files may be specified +# by options using the syntax DATA{,,,...}. Each option may +# specify one file by name or specify a regular expression to match file names +# using the syntax REGEX:. For example, the arguments +# DATA{MyData/MyInput.mhd,MyInput.img} # File pair +# DATA{MyData/MyFrames00.png,REGEX:MyFrames[0-9]+\\.png} # Series +# will pass MyInput.mha and MyFrames00.png on the command line but ensure +# that the associated files are present next to them. +# +# The DATA{} syntax may reference a directory using a trailing slash and a +# list of associated files. The form DATA{/,,,...} adds +# rules to fetch any files in the directory that match one of the associated +# file options. For example, the argument DATA{MyDataDir/,REGEX:.*} will pass +# the full path to a MyDataDir directory on the command line and ensure that +# the directory contains files corresponding to every file or content link in +# the MyDataDir source directory. +# +# The variable ExternalData_LINK_CONTENT may be set to the name of a supported +# hash algorithm to enable automatic conversion of real data files referenced +# by the DATA{} syntax into content links. For each such a content +# link named "" is created. The original file is renamed to the +# form ".ExternalData__" to stage it for future transmission to +# one of the locations in the list of URL templates (by means outside the +# scope of this module). The data fetch rule created for the content link +# will use the staged object if it cannot be found using any URL template. +# +# The variable ExternalData_OBJECT_STORES may be set to a list of local +# directories that store objects using the layout /%(algo)/%(hash). +# These directories will be searched first for a needed object. If the object +# is not available in any store then it will be fetched remotely using the URL +# templates and added to the first local store listed. If no stores are +# specified the default is a location inside the build tree. +# +# The variable ExternalData_SOURCE_ROOT may be set to the highest source +# directory containing any path named by a DATA{} reference. The default is +# CMAKE_SOURCE_DIR. ExternalData_SOURCE_ROOT and CMAKE_SOURCE_DIR must refer +# to directories within a single source distribution (e.g. they come together +# in one tarball). +# +# The variable ExternalData_BINARY_ROOT may be set to the directory to hold +# the real data files named by expanded DATA{} references. The default is +# CMAKE_BINARY_DIR. The directory layout will mirror that of content links +# under ExternalData_SOURCE_ROOT. +# +# Variables ExternalData_TIMEOUT_INACTIVITY and ExternalData_TIMEOUT_ABSOLUTE +# set the download inactivity and absolute timeouts, in seconds. The defaults +# are 60 seconds and 300 seconds, respectively. Set either timeout to 0 +# seconds to disable enforcement. + +#============================================================================= +# Copyright 2010-2013 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +function(ExternalData_add_test target) + # Expand all arguments as a single string to preserve escaped semicolons. + ExternalData_expand_arguments("${target}" testArgs "${ARGN}") + add_test(${testArgs}) +endfunction() + +function(ExternalData_add_target target) + if(NOT ExternalData_URL_TEMPLATES) + message(FATAL_ERROR "ExternalData_URL_TEMPLATES is not set!") + endif() + if(NOT ExternalData_OBJECT_STORES) + set(ExternalData_OBJECT_STORES ${CMAKE_BINARY_DIR}/ExternalData/Objects) + endif() + set(config ${CMAKE_CURRENT_BINARY_DIR}/${target}_config.cmake) + configure_file(${_ExternalData_SELF_DIR}/ExternalData_config.cmake.in ${config} @ONLY) + + set(files "") + + # Set "_ExternalData_FILE_${file}" for each output file to avoid duplicate + # rules. Use local data first to prefer real files over content links. + + # Custom commands to copy or link local data. + get_property(data_local GLOBAL PROPERTY _ExternalData_${target}_LOCAL) + foreach(entry IN LISTS data_local) + string(REPLACE "|" ";" tuple "${entry}") + list(GET tuple 0 file) + list(GET tuple 1 name) + if(NOT DEFINED "_ExternalData_FILE_${file}") + set("_ExternalData_FILE_${file}" 1) + add_custom_command( + COMMENT "Generating ${file}" + OUTPUT "${file}" + COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR} + -Dfile=${file} -Dname=${name} + -DExternalData_ACTION=local + -DExternalData_CONFIG=${config} + -P ${_ExternalData_SELF} + MAIN_DEPENDENCY "${name}" + ) + list(APPEND files "${file}") + endif() + endforeach() + + # Custom commands to fetch remote data. + get_property(data_fetch GLOBAL PROPERTY _ExternalData_${target}_FETCH) + foreach(entry IN LISTS data_fetch) + string(REPLACE "|" ";" tuple "${entry}") + list(GET tuple 0 file) + list(GET tuple 1 name) + list(GET tuple 2 ext) + set(stamp "${ext}-stamp") + if(NOT DEFINED "_ExternalData_FILE_${file}") + set("_ExternalData_FILE_${file}" 1) + add_custom_command( + # Users care about the data file, so hide the hash/timestamp file. + COMMENT "Generating ${file}" + # The hash/timestamp file is the output from the build perspective. + # List the real file as a second output in case it is a broken link. + # The files must be listed in this order so CMake can hide from the + # make tool that a symlink target may not be newer than the input. + OUTPUT "${file}${stamp}" "${file}" + # Run the data fetch/update script. + COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR} + -Dfile=${file} -Dname=${name} -Dext=${ext} + -DExternalData_ACTION=fetch + -DExternalData_CONFIG=${config} + -P ${_ExternalData_SELF} + # Update whenever the object hash changes. + MAIN_DEPENDENCY "${name}${ext}" + ) + list(APPEND files "${file}${stamp}") + endif() + endforeach() + + # Custom target to drive all update commands. + add_custom_target(${target} ALL DEPENDS ${files}) +endfunction() + +function(ExternalData_expand_arguments target outArgsVar) + # Replace DATA{} references with real arguments. + set(data_regex "DATA{([^;{}\r\n]*)}") + set(other_regex "([^D]|D[^A]|DA[^T]|DAT[^A]|DATA[^{])+|.") + set(outArgs "") + # This list expansion un-escapes semicolons in list element values so we + # must re-escape them below anywhere a new list expansion will occur. + foreach(arg IN LISTS ARGN) + if("x${arg}" MATCHES "${data_regex}") + # Re-escape in-value semicolons before expansion in foreach below. + string(REPLACE ";" "\\;" tmp "${arg}") + # Split argument into DATA{}-pieces and other pieces. + string(REGEX MATCHALL "${data_regex}|${other_regex}" pieces "${tmp}") + # Compose output argument with DATA{}-pieces replaced. + set(outArg "") + foreach(piece IN LISTS pieces) + if("x${piece}" MATCHES "^x${data_regex}$") + # Replace this DATA{}-piece with a file path. + string(REGEX REPLACE "${data_regex}" "\\1" data "${piece}") + _ExternalData_arg("${target}" "${piece}" "${data}" file) + set(outArg "${outArg}${file}") + else() + # No replacement needed for this piece. + set(outArg "${outArg}${piece}") + endif() + endforeach() + else() + # No replacements needed in this argument. + set(outArg "${arg}") + endif() + # Re-escape in-value semicolons in resulting list. + string(REPLACE ";" "\\;" outArg "${outArg}") + list(APPEND outArgs "${outArg}") + endforeach() + set("${outArgsVar}" "${outArgs}" PARENT_SCOPE) +endfunction() + +#----------------------------------------------------------------------------- +# Private helper interface + +set(_ExternalData_REGEX_ALGO "MD5|SHA1|SHA224|SHA256|SHA384|SHA512") +set(_ExternalData_REGEX_EXT "md5|sha1|sha224|sha256|sha384|sha512") +set(_ExternalData_SELF "${CMAKE_CURRENT_LIST_FILE}") +get_filename_component(_ExternalData_SELF_DIR "${_ExternalData_SELF}" PATH) + +function(_ExternalData_compute_hash var_hash algo file) + if("${algo}" MATCHES "^${_ExternalData_REGEX_ALGO}$") + file("${algo}" "${file}" hash) + set("${var_hash}" "${hash}" PARENT_SCOPE) + else() + message(FATAL_ERROR "Hash algorithm ${algo} unimplemented.") + endif() +endfunction() + +function(_ExternalData_random var) + string(RANDOM LENGTH 6 random) + set("${var}" "${random}" PARENT_SCOPE) +endfunction() + +function(_ExternalData_exact_regex regex_var string) + string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" regex "${string}") + set("${regex_var}" "${regex}" PARENT_SCOPE) +endfunction() + +function(_ExternalData_atomic_write file content) + _ExternalData_random(random) + set(tmp "${file}.tmp${random}") + file(WRITE "${tmp}" "${content}") + file(RENAME "${tmp}" "${file}") +endfunction() + +function(_ExternalData_link_content name var_ext) + if("${ExternalData_LINK_CONTENT}" MATCHES "^(${_ExternalData_REGEX_ALGO})$") + set(algo "${ExternalData_LINK_CONTENT}") + else() + message(FATAL_ERROR + "Unknown hash algorithm specified by ExternalData_LINK_CONTENT:\n" + " ${ExternalData_LINK_CONTENT}") + endif() + _ExternalData_compute_hash(hash "${algo}" "${name}") + get_filename_component(dir "${name}" PATH) + set(staged "${dir}/.ExternalData_${algo}_${hash}") + string(TOLOWER ".${algo}" ext) + _ExternalData_atomic_write("${name}${ext}" "${hash}\n") + file(RENAME "${name}" "${staged}") + set("${var_ext}" "${ext}" PARENT_SCOPE) + + file(RELATIVE_PATH relname "${ExternalData_SOURCE_ROOT}" "${name}${ext}") + message(STATUS "Linked ${relname} to ExternalData ${algo}/${hash}") +endfunction() + +function(_ExternalData_arg target arg options var_file) + # Separate data path from the options. + string(REPLACE "," ";" options "${options}") + list(GET options 0 data) + list(REMOVE_AT options 0) + + # Interpret trailing slashes as directories. + set(data_is_directory 0) + if("x${data}" MATCHES "^x(.*)([/\\])$") + set(data_is_directory 1) + set(data "${CMAKE_MATCH_1}") + endif() + + # Convert to full path. + if(IS_ABSOLUTE "${data}") + set(absdata "${data}") + else() + set(absdata "${CMAKE_CURRENT_SOURCE_DIR}/${data}") + endif() + get_filename_component(absdata "${absdata}" ABSOLUTE) + + # Convert to relative path under the source tree. + if(NOT ExternalData_SOURCE_ROOT) + set(ExternalData_SOURCE_ROOT "${CMAKE_SOURCE_DIR}") + endif() + set(top_src "${ExternalData_SOURCE_ROOT}") + file(RELATIVE_PATH reldata "${top_src}" "${absdata}") + if(IS_ABSOLUTE "${reldata}" OR "${reldata}" MATCHES "^\\.\\./") + message(FATAL_ERROR "Data file referenced by argument\n" + " ${arg}\n" + "does not lie under the top-level source directory\n" + " ${top_src}\n") + endif() + if(data_is_directory AND NOT IS_DIRECTORY "${top_src}/${reldata}") + message(FATAL_ERROR "Data directory referenced by argument\n" + " ${arg}\n" + "corresponds to source tree path\n" + " ${reldata}\n" + "that does not exist as a directory!") + endif() + if(NOT ExternalData_BINARY_ROOT) + set(ExternalData_BINARY_ROOT "${CMAKE_BINARY_DIR}") + endif() + set(top_bin "${ExternalData_BINARY_ROOT}") + + # Handle in-source builds gracefully. + if("${top_src}" STREQUAL "${top_bin}") + if(ExternalData_LINK_CONTENT) + message(WARNING "ExternalData_LINK_CONTENT cannot be used in-source") + set(ExternalData_LINK_CONTENT 0) + endif() + set(top_same 1) + endif() + + set(external "") # Entries external to the source tree. + set(internal "") # Entries internal to the source tree. + set(have_original ${data_is_directory}) + + # Process options. + set(series_option "") + set(associated_files "") + set(associated_regex "") + foreach(opt ${options}) + if("x${opt}" MATCHES "^xREGEX:[^:/]+$") + # Regular expression to match associated files. + string(REGEX REPLACE "^REGEX:" "" regex "${opt}") + list(APPEND associated_regex "${regex}") + elseif("x${opt}" MATCHES "^x:$") + # Activate series matching. + set(series_option "${opt}") + elseif("x${opt}" MATCHES "^[^][:/*?]+$") + # Specific associated file. + list(APPEND associated_files "${opt}") + else() + message(FATAL_ERROR "Unknown option \"${opt}\" in argument\n" + " ${arg}\n") + endif() + endforeach() + + if(series_option) + if(data_is_directory) + message(FATAL_ERROR "Series option \"${series_option}\" not allowed with directories.") + endif() + if(associated_files OR associated_regex) + message(FATAL_ERROR "Series option \"${series_option}\" not allowed with associated files.") + endif() + # Load a whole file series. + _ExternalData_arg_series() + elseif(data_is_directory) + if(associated_files OR associated_regex) + # Load listed/matching associated files in the directory. + _ExternalData_arg_associated() + else() + message(FATAL_ERROR "Data directory referenced by argument\n" + " ${arg}\n" + "must list associated files.") + endif() + else() + # Load the named data file. + _ExternalData_arg_single() + if(associated_files OR associated_regex) + # Load listed/matching associated files. + _ExternalData_arg_associated() + endif() + endif() + + if(NOT have_original) + message(FATAL_ERROR "Data file referenced by argument\n" + " ${arg}\n" + "corresponds to source tree path\n" + " ${reldata}\n" + "that does not exist as a file (with or without an extension)!") + endif() + + if(external) + # Make the series available in the build tree. + set_property(GLOBAL APPEND PROPERTY + _ExternalData_${target}_FETCH "${external}") + set_property(GLOBAL APPEND PROPERTY + _ExternalData_${target}_LOCAL "${internal}") + set("${var_file}" "${top_bin}/${reldata}" PARENT_SCOPE) + else() + # The whole series is in the source tree. + set("${var_file}" "${top_src}/${reldata}" PARENT_SCOPE) + endif() +endfunction() + +macro(_ExternalData_arg_associated) + # Associated files lie in the same directory. + if(data_is_directory) + set(reldir "${reldata}") + else() + get_filename_component(reldir "${reldata}" PATH) + endif() + if(reldir) + set(reldir "${reldir}/") + endif() + _ExternalData_exact_regex(reldir_regex "${reldir}") + + # Find files named explicitly. + foreach(file ${associated_files}) + _ExternalData_exact_regex(file_regex "${file}") + _ExternalData_arg_find_files("${reldir}${file}" "${reldir_regex}${file_regex}") + endforeach() + + # Find files matching the given regular expressions. + set(all "") + set(sep "") + foreach(regex ${associated_regex}) + set(all "${all}${sep}${reldir_regex}${regex}") + set(sep "|") + endforeach() + _ExternalData_arg_find_files("${reldir}" "${all}") +endmacro() + +macro(_ExternalData_arg_single) + # Match only the named data by itself. + _ExternalData_exact_regex(data_regex "${reldata}") + _ExternalData_arg_find_files("${reldata}" "${data_regex}") +endmacro() + +macro(_ExternalData_arg_series) + # Configure series parsing and matching. + set(series_parse_prefix "") + set(series_parse_number "\\1") + set(series_parse_suffix "\\2") + if(ExternalData_SERIES_PARSE) + if(ExternalData_SERIES_PARSE_NUMBER AND ExternalData_SERIES_PARSE_SUFFIX) + if(ExternalData_SERIES_PARSE_PREFIX) + set(series_parse_prefix "\\${ExternalData_SERIES_PARSE_PREFIX}") + endif() + set(series_parse_number "\\${ExternalData_SERIES_PARSE_NUMBER}") + set(series_parse_suffix "\\${ExternalData_SERIES_PARSE_SUFFIX}") + elseif(NOT "x${ExternalData_SERIES_PARSE}" MATCHES "^x\\([^()]*\\)\\([^()]*\\)\\$$") + message(FATAL_ERROR + "ExternalData_SERIES_PARSE is set to\n" + " ${ExternalData_SERIES_PARSE}\n" + "which is not of the form\n" + " ()()$\n" + "Fix the regular expression or set variables\n" + " ExternalData_SERIES_PARSE_PREFIX = regex group number, if any\n" + " ExternalData_SERIES_PARSE_NUMBER = regex group number\n" + " ExternalData_SERIES_PARSE_SUFFIX = regex group number\n" + ) + endif() + set(series_parse "${ExternalData_SERIES_PARSE}") + else() + set(series_parse "([0-9]*)(\\.[^./]*)$") + endif() + if(ExternalData_SERIES_MATCH) + set(series_match "${ExternalData_SERIES_MATCH}") + else() + set(series_match "[_.-]?[0-9]*") + endif() + + # Parse the base, number, and extension components of the series. + string(REGEX REPLACE "${series_parse}" "${series_parse_prefix};${series_parse_number};${series_parse_suffix}" tuple "${reldata}") + list(LENGTH tuple len) + if(NOT "${len}" EQUAL 3) + message(FATAL_ERROR "Data file referenced by argument\n" + " ${arg}\n" + "corresponds to path\n" + " ${reldata}\n" + "that does not match regular expression\n" + " ${series_parse}") + endif() + list(GET tuple 0 relbase) + list(GET tuple 2 ext) + + # Glob files that might match the series. + # Then match base, number, and extension. + _ExternalData_exact_regex(series_base "${relbase}") + _ExternalData_exact_regex(series_ext "${ext}") + _ExternalData_arg_find_files("${relbase}*${ext}" + "${series_base}${series_match}${series_ext}") +endmacro() + +function(_ExternalData_arg_find_files pattern regex) + file(GLOB globbed RELATIVE "${top_src}" "${top_src}/${pattern}*") + foreach(entry IN LISTS globbed) + if("x${entry}" MATCHES "^x(.*)(\\.(${_ExternalData_REGEX_EXT}))$") + set(relname "${CMAKE_MATCH_1}") + set(alg "${CMAKE_MATCH_2}") + else() + set(relname "${entry}") + set(alg "") + endif() + if("x${relname}" MATCHES "^x${regex}$" AND NOT IS_DIRECTORY "${top_src}/${entry}") + set(name "${top_src}/${relname}") + set(file "${top_bin}/${relname}") + if(alg) + list(APPEND external "${file}|${name}|${alg}") + elseif(ExternalData_LINK_CONTENT) + _ExternalData_link_content("${name}" alg) + list(APPEND external "${file}|${name}|${alg}") + elseif(NOT top_same) + list(APPEND internal "${file}|${name}") + endif() + if("${relname}" STREQUAL "${reldata}") + set(have_original 1) + endif() + endif() + endforeach() + set(external "${external}" PARENT_SCOPE) + set(internal "${internal}" PARENT_SCOPE) + set(have_original "${have_original}" PARENT_SCOPE) +endfunction() + +#----------------------------------------------------------------------------- +# Private script mode interface + +if(CMAKE_GENERATOR OR NOT ExternalData_ACTION) + return() +endif() + +if(ExternalData_CONFIG) + include(${ExternalData_CONFIG}) +endif() +if(NOT ExternalData_URL_TEMPLATES) + message(FATAL_ERROR "No ExternalData_URL_TEMPLATES set!") +endif() + +function(_ExternalData_link_or_copy src dst) + # Create a temporary file first. + get_filename_component(dst_dir "${dst}" PATH) + file(MAKE_DIRECTORY "${dst_dir}") + _ExternalData_random(random) + set(tmp "${dst}.tmp${random}") + if(UNIX) + # Create a symbolic link. + set(tgt "${src}") + if(relative_top) + # Use relative path if files are close enough. + file(RELATIVE_PATH relsrc "${relative_top}" "${src}") + file(RELATIVE_PATH relfile "${relative_top}" "${dst}") + if(NOT IS_ABSOLUTE "${relsrc}" AND NOT "${relsrc}" MATCHES "^\\.\\./" AND + NOT IS_ABSOLUTE "${reldst}" AND NOT "${reldst}" MATCHES "^\\.\\./") + file(RELATIVE_PATH tgt "${dst_dir}" "${src}") + endif() + endif() + execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${tgt}" "${tmp}" RESULT_VARIABLE result) + else() + # Create a copy. + execute_process(COMMAND "${CMAKE_COMMAND}" -E copy "${src}" "${tmp}" RESULT_VARIABLE result) + endif() + if(result) + file(REMOVE "${tmp}") + message(FATAL_ERROR "Failed to create\n ${tmp}\nfrom\n ${obj}") + endif() + + # Atomically create/replace the real destination. + file(RENAME "${tmp}" "${dst}") +endfunction() + +function(_ExternalData_download_file url file err_var msg_var) + set(retry 3) + while(retry) + math(EXPR retry "${retry} - 1") + if(ExternalData_TIMEOUT_INACTIVITY) + set(inactivity_timeout INACTIVITY_TIMEOUT ${ExternalData_TIMEOUT_INACTIVITY}) + elseif(NOT "${ExternalData_TIMEOUT_INACTIVITY}" EQUAL 0) + set(inactivity_timeout INACTIVITY_TIMEOUT 60) + else() + set(inactivity_timeout "") + endif() + if(ExternalData_TIMEOUT_ABSOLUTE) + set(absolute_timeout TIMEOUT ${ExternalData_TIMEOUT_ABSOLUTE}) + elseif(NOT "${ExternalData_TIMEOUT_ABSOLUTE}" EQUAL 0) + set(absolute_timeout TIMEOUT 300) + else() + set(absolute_timeout "") + endif() + file(DOWNLOAD "${url}" "${file}" STATUS status LOG log ${inactivity_timeout} ${absolute_timeout} SHOW_PROGRESS) + list(GET status 0 err) + list(GET status 1 msg) + if(err) + if("${msg}" MATCHES "HTTP response code said error" AND + "${log}" MATCHES "error: 503") + set(msg "temporarily unavailable") + endif() + elseif("${log}" MATCHES "\nHTTP[^\n]* 503") + set(err TRUE) + set(msg "temporarily unavailable") + endif() + if(NOT err OR NOT "${msg}" MATCHES "partial|timeout|temporarily") + break() + elseif(retry) + message(STATUS "[download terminated: ${msg}, retries left: ${retry}]") + endif() + endwhile() + set("${err_var}" "${err}" PARENT_SCOPE) + set("${msg_var}" "${msg}" PARENT_SCOPE) +endfunction() + +function(_ExternalData_download_object name hash algo var_obj) + # Search all object stores for an existing object. + foreach(dir ${ExternalData_OBJECT_STORES}) + set(obj "${dir}/${algo}/${hash}") + if(EXISTS "${obj}") + message(STATUS "Found object: \"${obj}\"") + set("${var_obj}" "${obj}" PARENT_SCOPE) + return() + endif() + endforeach() + + # Download object to the first store. + list(GET ExternalData_OBJECT_STORES 0 store) + set(obj "${store}/${algo}/${hash}") + + _ExternalData_random(random) + set(tmp "${obj}.tmp${random}") + set(found 0) + set(tried "") + foreach(url_template IN LISTS ExternalData_URL_TEMPLATES) + string(REPLACE "%(hash)" "${hash}" url_tmp "${url_template}") + string(REPLACE "%(algo)" "${algo}" url "${url_tmp}") + message(STATUS "Fetching \"${url}\"") + _ExternalData_download_file("${url}" "${tmp}" err errMsg) + set(tried "${tried}\n ${url}") + if(err) + set(tried "${tried} (${errMsg})") + else() + # Verify downloaded object. + _ExternalData_compute_hash(dl_hash "${algo}" "${tmp}") + if("${dl_hash}" STREQUAL "${hash}") + set(found 1) + break() + else() + set(tried "${tried} (wrong hash ${algo}=${dl_hash})") + if("$ENV{ExternalData_DEBUG_DOWNLOAD}" MATCHES ".") + file(RENAME "${tmp}" "${store}/${algo}/${dl_hash}") + endif() + endif() + endif() + file(REMOVE "${tmp}") + endforeach() + + get_filename_component(dir "${name}" PATH) + set(staged "${dir}/.ExternalData_${algo}_${hash}") + + if(found) + file(RENAME "${tmp}" "${obj}") + message(STATUS "Downloaded object: \"${obj}\"") + elseif(EXISTS "${staged}") + set(obj "${staged}") + message(STATUS "Staged object: \"${obj}\"") + else() + message(FATAL_ERROR "Object ${algo}=${hash} not found at:${tried}") + endif() + + set("${var_obj}" "${obj}" PARENT_SCOPE) +endfunction() + +if("${ExternalData_ACTION}" STREQUAL "fetch") + foreach(v ExternalData_OBJECT_STORES file name ext) + if(NOT DEFINED "${v}") + message(FATAL_ERROR "No \"-D${v}=\" value provided!") + endif() + endforeach() + + file(READ "${name}${ext}" hash) + string(STRIP "${hash}" hash) + + if("${ext}" MATCHES "^\\.(${_ExternalData_REGEX_EXT})$") + string(TOUPPER "${CMAKE_MATCH_1}" algo) + else() + message(FATAL_ERROR "Unknown hash algorithm extension \"${ext}\"") + endif() + + _ExternalData_download_object("${name}" "${hash}" "${algo}" obj) + + # Check if file already corresponds to the object. + set(stamp "${ext}-stamp") + set(file_up_to_date 0) + if(EXISTS "${file}" AND EXISTS "${file}${stamp}") + file(READ "${file}${stamp}" f_hash) + string(STRIP "${f_hash}" f_hash) + if("${f_hash}" STREQUAL "${hash}") + #message(STATUS "File already corresponds to object") + set(file_up_to_date 1) + endif() + endif() + + if(file_up_to_date) + # Touch the file to convince the build system it is up to date. + execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${file}") + else() + _ExternalData_link_or_copy("${obj}" "${file}") + endif() + + # Atomically update the hash/timestamp file to record the object referenced. + _ExternalData_atomic_write("${file}${stamp}" "${hash}\n") +elseif("${ExternalData_ACTION}" STREQUAL "local") + foreach(v file name) + if(NOT DEFINED "${v}") + message(FATAL_ERROR "No \"-D${v}=\" value provided!") + endif() + endforeach() + _ExternalData_link_or_copy("${name}" "${file}") +else() + message(FATAL_ERROR "Unknown ExternalData_ACTION=[${ExternalData_ACTION}]") +endif() diff --git a/Modules/ExternalData_config.cmake.in b/Modules/ExternalData_config.cmake.in new file mode 100644 index 000000000..0858f5368 --- /dev/null +++ b/Modules/ExternalData_config.cmake.in @@ -0,0 +1,4 @@ +set(ExternalData_OBJECT_STORES "@ExternalData_OBJECT_STORES@") +set(ExternalData_URL_TEMPLATES "@ExternalData_URL_TEMPLATES@") +set(ExternalData_TIMEOUT_INACTIVITY "@ExternalData_TIMEOUT_INACTIVITY@") +set(ExternalData_TIMEOUT_ABSOLUTE "@ExternalData_TIMEOUT_ABSOLUTE@") diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index a0a9aead5..bf2892b74 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -9,6 +9,7 @@ # [TMP_DIR dir] # Directory to store temporary files # [STAMP_DIR dir] # Directory to store step timestamps # #--Download step-------------- +# [DOWNLOAD_NAME fname] # File name to store (if not end of URL) # [DOWNLOAD_DIR dir] # Directory to store downloaded files # [DOWNLOAD_COMMAND cmd...] # Command to download source tree # [CVS_REPOSITORY cvsroot] # CVSROOT of CVS repository @@ -21,8 +22,13 @@ # [SVN_TRUST_CERT 1 ] # Trust the Subversion server site certificate # [GIT_REPOSITORY url] # URL of git repo # [GIT_TAG tag] # Git branch name, commit id or tag +# [HG_REPOSITORY url] # URL of mercurial repo +# [HG_TAG tag] # Mercurial branch name, commit id or tag # [URL /.../src.tgz] # Full path or URL of source -# [URL_MD5 md5] # MD5 checksum of file at URL +# [URL_HASH ALGO=value] # Hash of file at URL +# [URL_MD5 md5] # Equivalent to URL_HASH MD5=md5 +# [TLS_VERIFY bool] # Should certificate for https be checked +# [TLS_CAINFO file] # Path to a certificate authority file # [TIMEOUT seconds] # Time allowed for file download operations # #--Update/Patch step---------- # [UPDATE_COMMAND cmd...] # Source work-tree update command @@ -32,6 +38,7 @@ # [CONFIGURE_COMMAND cmd...] # Build tree configuration command # [CMAKE_COMMAND /.../cmake] # Specify alternative cmake executable # [CMAKE_GENERATOR gen] # Specify generator for native build +# [CMAKE_GENERATOR_TOOLSET t] # Generator-specific toolset name # [CMAKE_ARGS args...] # Arguments to CMake command line # [CMAKE_CACHE_ARGS args...] # Initial cache arguments, of the form -Dvar:string=on # #--Build step----------------- @@ -182,6 +189,9 @@ if(_ep_func) set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$") endif() +# Save regex matching supported hash algorithm names. +set(_ep_hash_algos "MD5|SHA1|SHA224|SHA256|SHA384|SHA512") +set(_ep_hash_regex "^(${_ep_hash_algos})=([0-9A-Fa-f]+)$") function(_ep_parse_arguments f name ns args) # Transfer the arguments to this function into target properties for the @@ -226,7 +236,7 @@ function(_ep_parse_arguments f name ns args) set(key "${arg}") endif() endforeach() -endfunction(_ep_parse_arguments) +endfunction() define_property(DIRECTORY PROPERTY "EP_BASE" INHERITED @@ -329,10 +339,144 @@ endif() " ) -endfunction(_ep_write_gitclone_script) +endfunction() + +function(_ep_write_hgclone_script script_filename source_dir hg_EXECUTABLE hg_repository hg_tag src_name work_dir hgclone_infofile hgclone_stampfile) + file(WRITE ${script_filename} +"if(\"${hg_tag}\" STREQUAL \"\") + message(FATAL_ERROR \"Tag for hg checkout should not be empty.\") +endif() + +set(run 0) + +if(\"${hgclone_infofile}\" IS_NEWER_THAN \"${hgclone_stampfile}\") + set(run 1) +endif() + +if(NOT run) + message(STATUS \"Avoiding repeated hg clone, stamp file is up to date: '${hgclone_stampfile}'\") + return() +endif() +execute_process( + COMMAND \${CMAKE_COMMAND} -E remove_directory \"${source_dir}\" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR \"Failed to remove directory: '${source_dir}'\") +endif() -function(_ep_write_downloadfile_script script_filename remote local timeout md5) +execute_process( + COMMAND \"${hg_EXECUTABLE}\" clone \"${hg_repository}\" \"${src_name}\" + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR \"Failed to clone repository: '${hg_repository}'\") +endif() + +execute_process( + COMMAND \"${hg_EXECUTABLE}\" update ${hg_tag} + WORKING_DIRECTORY \"${work_dir}/${src_name}\" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR \"Failed to checkout tag: '${hg_tag}'\") +endif() + +# Complete success, update the script-last-run stamp file: +# +execute_process( + COMMAND \${CMAKE_COMMAND} -E copy + \"${hgclone_infofile}\" + \"${hgclone_stampfile}\" + WORKING_DIRECTORY \"${work_dir}/${src_name}\" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR \"Failed to copy script-last-run stamp file: '${hgclone_stampfile}'\") +endif() + +" +) + +endfunction() + + +function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_repository work_dir) + file(WRITE ${script_filename} +"if(\"${git_tag}\" STREQUAL \"\") + message(FATAL_ERROR \"Tag for git checkout should not be empty.\") +endif() + +execute_process( + COMMAND \"${git_EXECUTABLE}\" rev-list --max-count=1 HEAD + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + OUTPUT_VARIABLE head_sha + ) +if(error_code) + message(FATAL_ERROR \"Failed to get the hash for HEAD\") +endif() + +execute_process( + COMMAND \"${git_EXECUTABLE}\" show-ref ${git_tag} + WORKING_DIRECTORY \"${work_dir}\" + OUTPUT_VARIABLE show_ref_output + ) +# If a remote ref is asked for, which can possibly move around, +# we must always do a fetch and checkout. +if(\"\${show_ref_output}\" MATCHES \"remotes\") + set(is_remote_ref 1) +else() + set(is_remote_ref 0) +endif() + +# This will fail if the tag does not exist (it probably has not been fetched +# yet). +execute_process( + COMMAND \"${git_EXECUTABLE}\" rev-list --max-count=1 ${git_tag} + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + OUTPUT_VARIABLE tag_sha + ) + +# Is the hash checkout out that we want? +if(error_code OR is_remote_ref OR NOT (\"\${tag_sha}\" STREQUAL \"\${head_sha}\")) + execute_process( + COMMAND \"${git_EXECUTABLE}\" fetch + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + if(error_code) + message(FATAL_ERROR \"Failed to fetch repository '${git_repository}'\") + endif() + + execute_process( + COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag} + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + if(error_code) + message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\") + endif() + + execute_process( + COMMAND \"${git_EXECUTABLE}\" submodule update --recursive + WORKING_DIRECTORY \"${work_dir}/${src_name}\" + RESULT_VARIABLE error_code + ) + if(error_code) + message(FATAL_ERROR \"Failed to update submodules in: '${work_dir}/${src_name}'\") + endif() +endif() + +" +) + +endfunction(_ep_write_gitupdate_script) + +function(_ep_write_downloadfile_script script_filename remote local timeout hash tls_verify tls_cainfo) if(timeout) set(timeout_args TIMEOUT ${timeout}) set(timeout_msg "${timeout} seconds") @@ -341,10 +485,31 @@ function(_ep_write_downloadfile_script script_filename remote local timeout md5) set(timeout_msg "none") endif() - if(md5) - set(md5_args EXPECTED_MD5 ${md5}) + if("${hash}" MATCHES "${_ep_hash_regex}") + set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1}=${CMAKE_MATCH_2}) else() - set(md5_args "# no EXPECTED_MD5") + set(hash_args "# no EXPECTED_HASH") + endif() + # check for curl globals in the project + if(DEFINED CMAKE_TLS_VERIFY) + set(tls_verify "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})") + endif() + if(DEFINED CMAKE_TLS_CAINFO) + set(tls_cainfo "set(CMAKE_TLS_CAINFO \"${CMAKE_TLS_CAINFO}\")") + endif() + + # now check for curl locals so that the local values + # will override the globals + + # check for tls_verify argument + string(LENGTH "${tls_verify}" tls_verify_len) + if(tls_verify_len GREATER 0) + set(tls_verify "set(CMAKE_TLS_VERIFY ${tls_verify})") + endif() + # check for tls_cainfo argument + string(LENGTH "${tls_cainfo}" tls_cainfo_len) + if(tls_cainfo_len GREATER 0) + set(tls_cainfo "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")") endif() file(WRITE ${script_filename} @@ -353,11 +518,14 @@ function(_ep_write_downloadfile_script script_filename remote local timeout md5) dst='${local}' timeout='${timeout_msg}'\") +${tls_verify} +${tls_cainfo} + file(DOWNLOAD \"${remote}\" \"${local}\" SHOW_PROGRESS - ${md5_args} + ${hash_args} ${timeout_args} STATUS status LOG log) @@ -377,52 +545,34 @@ message(STATUS \"downloading... done\") " ) -endfunction(_ep_write_downloadfile_script) - - -function(_ep_write_verifyfile_script script_filename local md5) - file(WRITE ${script_filename} -"message(STATUS \"verifying file... - file='${local}'\") - -set(verified 0) - -# If an expected md5 checksum exists, compare against it: -# -if(NOT \"${md5}\" STREQUAL \"\") - execute_process(COMMAND \${CMAKE_COMMAND} -E md5sum \"${local}\" - OUTPUT_VARIABLE ov - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE rv) - - if(NOT rv EQUAL 0) - message(FATAL_ERROR \"error: computing md5sum of '${local}' failed\") - endif() - - string(REGEX MATCH \"^([0-9A-Fa-f]+)\" md5_actual \"\${ov}\") - - string(TOLOWER \"\${md5_actual}\" md5_actual) - string(TOLOWER \"${md5}\" md5) - - if(NOT \"\${md5}\" STREQUAL \"\${md5_actual}\") - message(FATAL_ERROR \"error: md5sum of '${local}' does not match expected value - md5_expected: \${md5} - md5_actual: \${md5_actual} -\") - endif() +endfunction() - set(verified 1) -endif() -if(verified) +function(_ep_write_verifyfile_script script_filename local hash) + if("${hash}" MATCHES "${_ep_hash_regex}") + set(algo "${CMAKE_MATCH_1}") + string(TOLOWER "${CMAKE_MATCH_2}" expect_value) + set(script_content "set(expect_value \"${expect_value}\") +file(${algo} \"\${file}\" actual_value) +if(\"\${actual_value}\" STREQUAL \"\${expect_value}\") message(STATUS \"verifying file... done\") else() - message(STATUS \"verifying file... warning: did not verify file - no URL_MD5 checksum argument? corrupt file?\") -endif() -" -) - -endfunction(_ep_write_verifyfile_script) + message(FATAL_ERROR \"error: ${algo} hash of + \${file} +does not match expected value + expected: \${expect_value} + actual: \${actual_value} +\") +endif()") + else() + set(script_content "message(STATUS \"verifying file... warning: did not verify file - no URL_HASH specified?\")") + endif() + file(WRITE ${script_filename} "set(file \"${local}\") +message(STATUS \"verifying file... + file='\${file}'\") +${script_content} +") +endfunction() function(_ep_write_extractfile_script script_filename name filename directory) @@ -502,7 +652,7 @@ message(STATUS \"extracting... done\") " ) -endfunction(_ep_write_extractfile_script) +endfunction() function(_ep_set_directories name) @@ -523,7 +673,7 @@ function(_ep_set_directories name) set(binary_default "${prefix}/src/${name}-build") set(stamp_default "${prefix}/src/${name}-stamp") set(install_default "${prefix}") - else() # assert(base) + else() set(tmp_default "${base}/tmp/${name}") set(download_default "${base}/Download/${name}") set(source_default "${base}/Source/${name}") @@ -573,7 +723,7 @@ function(_ep_set_directories name) message(FATAL_ERROR "dir '${dir}' does not exist after file(MAKE_DIRECTORY)") endif() endforeach() -endfunction(_ep_set_directories) +endfunction() # IMPORTANT: this MUST be a macro and not a function because of the @@ -633,7 +783,7 @@ function(_ep_write_initial_cache target_name script_filename args) file(WRITE "${script_filename}.in" "\@script_initial_cache\@\n") endif() configure_file("${script_filename}.in" "${script_filename}") -endfunction(_ep_write_initial_cache) +endfunction() function(ExternalProject_Get_Property name) @@ -645,7 +795,7 @@ function(ExternalProject_Get_Property name) endif() set(${var} "${${var}}" PARENT_SCOPE) endforeach() -endfunction(ExternalProject_Get_Property) +endfunction() function(_ep_get_configure_command_id name cfg_cmd_id_var) @@ -671,7 +821,7 @@ function(_ep_get_configure_command_id name cfg_cmd_id_var) endif() endif() endif() -endfunction(_ep_get_configure_command_id) +endfunction() function(_ep_get_build_command name step cmd_var) @@ -710,7 +860,7 @@ function(_ep_get_build_command name step cmd_var) set(args "") endif() endif() - else() # if(cfg_cmd_id STREQUAL "configure") + else() # Non-CMake project. Guess "make" and "make install" and "make test". if("${CMAKE_GENERATOR}" MATCHES "Makefiles") # Try to get the parallel arguments @@ -736,7 +886,7 @@ function(_ep_get_build_command name step cmd_var) endif() set(${cmd_var} "${cmd}" PARENT_SCOPE) -endfunction(_ep_get_build_command) +endfunction() function(_ep_write_log_script name step cmd_var) ExternalProject_Get_Property(${name} stamp_dir) @@ -784,7 +934,7 @@ if(result) set(msg \"Command failed (\${result}):\\n\") foreach(arg IN LISTS command) set(msg \"\${msg} '\${arg}'\") - endforeach(arg) + endforeach() message(FATAL_ERROR \"\${msg}\") endif() ") @@ -823,7 +973,7 @@ if(result) set(msg \"Command failed: \${result}\\n\") foreach(arg IN LISTS command) set(msg \"\${msg} '\${arg}'\") - endforeach(arg) + endforeach() set(msg \"\${msg}\\nSee also\\n ${logbase}-*.log\\n\") message(FATAL_ERROR \"\${msg}\") else() @@ -833,7 +983,7 @@ endif() ") set(command ${CMAKE_COMMAND} ${make} ${config} -P ${script}) set(${cmd_var} "${command}" PARENT_SCOPE) -endfunction(_ep_write_log_script) +endfunction() # This module used to use "/${CMAKE_CFG_INTDIR}" directly and produced # makefiles with "/./" in paths for custom command dependencies. Which @@ -849,7 +999,7 @@ function(_ep_get_configuration_subdir_suffix suffix_var) set(suffix "/${CMAKE_CFG_INTDIR}") endif() set(${suffix_var} "${suffix}" PARENT_SCOPE) -endfunction(_ep_get_configuration_subdir_suffix) +endfunction() function(_ep_get_step_stampfile name step stampfile_var) @@ -876,7 +1026,7 @@ function(ExternalProject_Add_StepTargets name) add_dependencies(${name}-${step} ${arg}) endforeach() endforeach() -endfunction(ExternalProject_Add_StepTargets) +endfunction() function(ExternalProject_Add_Step name step) @@ -974,7 +1124,7 @@ function(ExternalProject_Add_Step name step) break() endif() endforeach() -endfunction(ExternalProject_Add_Step) +endfunction() function(_ep_add_mkdir_command name) @@ -992,7 +1142,7 @@ function(_ep_add_mkdir_command name) COMMAND ${CMAKE_COMMAND} -E make_directory ${stamp_dir}${cfgdir} COMMAND ${CMAKE_COMMAND} -E make_directory ${download_dir} ) -endfunction(_ep_add_mkdir_command) +endfunction() function(_ep_get_git_version git_EXECUTABLE git_version_var) @@ -1027,7 +1177,9 @@ function(_ep_add_download_command name) get_property(cvs_repository TARGET ${name} PROPERTY _EP_CVS_REPOSITORY) get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_REPOSITORY) get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY) + get_property(hg_repository TARGET ${name} PROPERTY _EP_HG_REPOSITORY ) get_property(url TARGET ${name} PROPERTY _EP_URL) + get_property(fname TARGET ${name} PROPERTY _EP_DOWNLOAD_NAME) # TODO: Perhaps file:// should be copied to download dir before extraction. string(REGEX REPLACE "^file://" "" url "${url}") @@ -1148,12 +1300,64 @@ function(_ep_add_download_command name) set(comment "Performing download step (git clone) for '${name}'") set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitclone.cmake) list(APPEND depends ${stamp_dir}/${name}-gitinfo.txt) + elseif(hg_repository) + find_package(Hg) + if(NOT HG_EXECUTABLE) + message(FATAL_ERROR "error: could not find hg for clone of ${name}") + endif() + + get_property(hg_tag TARGET ${name} PROPERTY _EP_HG_TAG) + if(NOT hg_tag) + set(hg_tag "tip") + endif() + + # For the download step, and the hg clone operation, only the repository + # should be recorded in a configured RepositoryInfo file. If the repo + # changes, the clone script should be run again. But if only the tag + # changes, avoid running the clone script again. Let the 'always' running + # update step checkout the new tag. + # + set(repository ${hg_repository}) + set(module) + set(tag) + configure_file( + "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in" + "${stamp_dir}/${name}-hginfo.txt" + @ONLY + ) + + get_filename_component(src_name "${source_dir}" NAME) + get_filename_component(work_dir "${source_dir}" PATH) + + # Since hg clone doesn't succeed if the non-empty source_dir exists, + # create a cmake script to invoke as download command. + # The script will delete the source directory and then call hg clone. + # + _ep_write_hgclone_script(${tmp_dir}/${name}-hgclone.cmake ${source_dir} + ${HG_EXECUTABLE} ${hg_repository} ${hg_tag} ${src_name} ${work_dir} + ${stamp_dir}/${name}-hginfo.txt ${stamp_dir}/${name}-hgclone-lastrun.txt + ) + set(comment "Performing download step (hg clone) for '${name}'") + set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-hgclone.cmake) + list(APPEND depends ${stamp_dir}/${name}-hginfo.txt) elseif(url) get_filename_component(work_dir "${source_dir}" PATH) + get_property(hash TARGET ${name} PROPERTY _EP_URL_HASH) + if(hash AND NOT "${hash}" MATCHES "${_ep_hash_regex}") + message(FATAL_ERROR "URL_HASH is set to\n ${hash}\n" + "but must be ALGO=value where ALGO is\n ${_ep_hash_algos}\n" + "and value is a hex string.") + endif() get_property(md5 TARGET ${name} PROPERTY _EP_URL_MD5) + if(md5 AND NOT "MD5=${md5}" MATCHES "${_ep_hash_regex}") + message(FATAL_ERROR "URL_MD5 is set to\n ${md5}\nbut must be a hex string.") + endif() + if(md5 AND NOT hash) + set(hash "MD5=${md5}") + endif() set(repository "external project URL") set(module "${url}") - set(tag "${md5}") + set(tag "${hash}") configure_file( "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in" "${stamp_dir}/${name}-urlinfo.txt" @@ -1168,7 +1372,9 @@ function(_ep_add_download_command name) else() if("${url}" MATCHES "^[a-z]+://") # TODO: Should download and extraction be different steps? - string(REGEX MATCH "[^/\\?]*$" fname "${url}") + if("x${fname}" STREQUAL "x") + string(REGEX MATCH "[^/\\?]*$" fname "${url}") + endif() if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$") string(REGEX MATCH "([^/\\?]+(\\.|=)(bz2|tar|tgz|tar\\.gz|zip))/.*$" match_result "${url}") set(fname "${CMAKE_MATCH_1}") @@ -1179,7 +1385,10 @@ function(_ep_add_download_command name) string(REPLACE ";" "-" fname "${fname}") set(file ${download_dir}/${fname}) get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) - _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}" "${md5}") + get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY) + get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO) + _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" + "${url}" "${file}" "${timeout}" "${hash}" "${tls_verify}" "${tls_cainfo}") set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake COMMAND) set(comment "Performing download step (download, verify and extract) for '${name}'") @@ -1187,7 +1396,7 @@ function(_ep_add_download_command name) set(file "${url}") set(comment "Performing download step (verify and extract) for '${name}'") endif() - _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${md5}") + _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}") list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake COMMAND) _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${name}" "${file}" "${source_dir}") @@ -1196,7 +1405,7 @@ function(_ep_add_download_command name) else() _ep_is_dir_empty("${source_dir}" empty) if(${empty}) - message(SEND_ERROR "error: no download info for '${name}' -- please specify existing/non-empty SOURCE_DIR or one of URL, CVS_REPOSITORY and CVS_MODULE, SVN_REPOSITORY, GIT_REPOSITORY or DOWNLOAD_COMMAND") + message(SEND_ERROR "error: no download info for '${name}' -- please specify existing/non-empty SOURCE_DIR or one of URL, CVS_REPOSITORY and CVS_MODULE, SVN_REPOSITORY, GIT_REPOSITORY, HG_REPOSITORY or DOWNLOAD_COMMAND") endif() endif() @@ -1215,17 +1424,18 @@ function(_ep_add_download_command name) DEPENDEES mkdir ${log} ) -endfunction(_ep_add_download_command) +endfunction() function(_ep_add_update_command name) - ExternalProject_Get_Property(${name} source_dir) + ExternalProject_Get_Property(${name} source_dir tmp_dir) get_property(cmd_set TARGET ${name} PROPERTY _EP_UPDATE_COMMAND SET) get_property(cmd TARGET ${name} PROPERTY _EP_UPDATE_COMMAND) get_property(cvs_repository TARGET ${name} PROPERTY _EP_CVS_REPOSITORY) get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_REPOSITORY) get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY) + get_property(hg_repository TARGET ${name} PROPERTY _EP_HG_REPOSITORY ) set(work_dir) set(comment) @@ -1270,14 +1480,35 @@ function(_ep_add_update_command name) message(FATAL_ERROR "error: could not find git for fetch of ${name}") endif() set(work_dir ${source_dir}) - set(comment "Performing update step (git fetch) for '${name}'") + set(comment "Performing update step for '${name}'") get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG) if(NOT git_tag) set(git_tag "master") endif() - set(cmd ${GIT_EXECUTABLE} fetch - COMMAND ${GIT_EXECUTABLE} checkout ${git_tag} - COMMAND ${GIT_EXECUTABLE} submodule update --recursive + _ep_write_gitupdate_script(${tmp_dir}/${name}-gitupdate.cmake + ${GIT_EXECUTABLE} ${git_tag} ${git_repository} ${work_dir} + ) + set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitupdate.cmake) + set(always 1) + elseif(hg_repository) + if(NOT HG_EXECUTABLE) + message(FATAL_ERROR "error: could not find hg for pull of ${name}") + endif() + set(work_dir ${source_dir}) + set(comment "Performing update step (hg pull) for '${name}'") + get_property(hg_tag TARGET ${name} PROPERTY _EP_HG_TAG) + if(NOT hg_tag) + set(hg_tag "tip") + endif() + if("${HG_VERSION_STRING}" STREQUAL "2.1") + message(WARNING "Mercurial 2.1 does not distinguish an empty pull from a failed pull: + http://mercurial.selenic.com/wiki/UpgradeNotes#A2.1.1:_revert_pull_return_code_change.2C_compile_issue_on_OS_X + http://thread.gmane.org/gmane.comp.version-control.mercurial.devel/47656 +Update to Mercurial >= 2.1.1. +") + endif() + set(cmd ${HG_EXECUTABLE} pull + COMMAND ${HG_EXECUTABLE} update ${hg_tag} ) set(always 1) endif() @@ -1297,7 +1528,7 @@ function(_ep_add_update_command name) DEPENDEES download ${log} ) -endfunction(_ep_add_update_command) +endfunction() function(_ep_add_patch_command name) @@ -1317,7 +1548,7 @@ function(_ep_add_patch_command name) WORKING_DIRECTORY ${work_dir} DEPENDEES download ) -endfunction(_ep_add_patch_command) +endfunction() # TODO: Make sure external projects use the proper compiler @@ -1328,8 +1559,11 @@ function(_ep_add_configure_command name) set(file_deps) get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS) foreach(dep IN LISTS deps) - _ep_get_step_stampfile(${dep} "done" done_stamp_file) - list(APPEND file_deps ${done_stamp_file}) + get_property(is_ep TARGET ${dep} PROPERTY _EP_IS_EXTERNAL_PROJECT) + if(is_ep) + _ep_get_step_stampfile(${dep} "done" done_stamp_file) + list(APPEND file_deps ${done_stamp_file}) + endif() endforeach() get_property(cmd_set TARGET ${name} PROPERTY _EP_CONFIGURE_COMMAND SET) @@ -1355,16 +1589,27 @@ function(_ep_add_configure_command name) endif() get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR) + get_target_property(cmake_generator_toolset ${name} _EP_CMAKE_GENERATOR_TOOLSET) if(cmake_generator) - list(APPEND cmd "-G${cmake_generator}" "${source_dir}") + list(APPEND cmd "-G${cmake_generator}") + if(cmake_generator_toolset) + list(APPEND cmd "-T${cmake_generator_toolset}") + endif() else() if(CMAKE_EXTRA_GENERATOR) - list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}" - "${source_dir}") + list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}") else() - list(APPEND cmd "-G${CMAKE_GENERATOR}" "${source_dir}") + list(APPEND cmd "-G${CMAKE_GENERATOR}") + endif() + if(cmake_generator_toolset) + message(FATAL_ERROR "Option CMAKE_GENERATOR_TOOLSET not allowed without CMAKE_GENERATOR.") + endif() + if(CMAKE_GENERATOR_TOOLSET) + list(APPEND cmd "-T${CMAKE_GENERATOR_TOOLSET}") endif() endif() + + list(APPEND cmd "${source_dir}") endif() # If anything about the configure command changes, (command itself, cmake @@ -1392,7 +1637,7 @@ function(_ep_add_configure_command name) DEPENDS ${file_deps} ${log} ) -endfunction(_ep_add_configure_command) +endfunction() function(_ep_add_build_command name) @@ -1418,7 +1663,7 @@ function(_ep_add_build_command name) DEPENDEES configure ${log} ) -endfunction(_ep_add_build_command) +endfunction() function(_ep_add_install_command name) @@ -1444,7 +1689,7 @@ function(_ep_add_install_command name) DEPENDEES build ${log} ) -endfunction(_ep_add_install_command) +endfunction() function(_ep_add_test_command name) @@ -1484,7 +1729,7 @@ function(_ep_add_test_command name) ${log} ) endif() -endfunction(_ep_add_test_command) +endfunction() function(ExternalProject_Add name) @@ -1550,4 +1795,4 @@ function(ExternalProject_Add name) # on install. # _ep_add_test_command(${name}) -endfunction(ExternalProject_Add) +endfunction() diff --git a/Modules/FLTKCompatibility.cmake b/Modules/FLTKCompatibility.cmake index 6b6f9607b..58c52da34 100644 --- a/Modules/FLTKCompatibility.cmake +++ b/Modules/FLTKCompatibility.cmake @@ -12,4 +12,4 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(CheckIncludeFile) +include(CheckIncludeFile) diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index a5b94d199..5d98ac3cf 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -87,7 +87,7 @@ # Use this macro to set up information about the named package, which can # then be displayed via FEATURE_SUMMARY(). # This can be done either directly in the Find-module or in the project -# which uses the module after the FIND_PACKAGE() call. +# which uses the module after the find_package() call. # The features for which information can be set are added automatically by the # find_package() command. # @@ -151,7 +151,7 @@ # Use this macro to set up information about the named package, which can # then be displayed via FEATURE_SUMMARY(). # This can be done either directly in the Find-module or in the project -# which uses the module after the FIND_PACKAGE() call. +# which uses the module after the find_package() call. # The features for which information can be set are added automatically by the # find_package() command. # @@ -177,177 +177,177 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(CMakeParseArguments) +include("${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake") -FUNCTION(ADD_FEATURE_INFO _name _enabled _desc) - IF (${_enabled}) - SET_PROPERTY(GLOBAL APPEND PROPERTY ENABLED_FEATURES "${_name}") - ELSE () - SET_PROPERTY(GLOBAL APPEND PROPERTY DISABLED_FEATURES "${_name}") - ENDIF () +function(ADD_FEATURE_INFO _name _enabled _desc) + if (${_enabled}) + set_property(GLOBAL APPEND PROPERTY ENABLED_FEATURES "${_name}") + else () + set_property(GLOBAL APPEND PROPERTY DISABLED_FEATURES "${_name}") + endif () - SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" ) -ENDFUNCTION(ADD_FEATURE_INFO) + set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" ) +endfunction() -FUNCTION(SET_PACKAGE_PROPERTIES _name _props) - IF(NOT "${_props}" STREQUAL "PROPERTIES") - MESSAGE(FATAL_ERROR "PROPERTIES keyword is missing in SET_PACKAGE_PROPERTIES() call.") - ENDIF() +function(SET_PACKAGE_PROPERTIES _name _props) + if(NOT "${_props}" STREQUAL "PROPERTIES") + message(FATAL_ERROR "PROPERTIES keyword is missing in SET_PACKAGE_PROPERTIES() call.") + endif() - SET(options ) # none - SET(oneValueArgs DESCRIPTION URL TYPE PURPOSE ) - SET(multiValueArgs ) # none + set(options ) # none + set(oneValueArgs DESCRIPTION URL TYPE PURPOSE ) + set(multiValueArgs ) # none CMAKE_PARSE_ARGUMENTS(_SPP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - IF(_SPP_UNPARSED_ARGUMENTS) - MESSAGE(FATAL_ERROR "Unknown keywords given to SET_PACKAGE_PROPERTIES(): \"${_SPP_UNPARSED_ARGUMENTS}\"") - ENDIF() + if(_SPP_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to SET_PACKAGE_PROPERTIES(): \"${_SPP_UNPARSED_ARGUMENTS}\"") + endif() - IF(_SPP_DESCRIPTION) - GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION) - IF(_info AND NOT "${_info}" STREQUAL "${_SPP_DESCRIPTION}") - MESSAGE(STATUS "Warning: Property DESCRIPTION for package ${_name} already set to \"${_info}\", overriding it with \"${_SPP_DESCRIPTION}\"") - ENDIF() + if(_SPP_DESCRIPTION) + get_property(_info GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION) + if(_info AND NOT "${_info}" STREQUAL "${_SPP_DESCRIPTION}") + message(STATUS "Warning: Property DESCRIPTION for package ${_name} already set to \"${_info}\", overriding it with \"${_SPP_DESCRIPTION}\"") + endif() - SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_SPP_DESCRIPTION}" ) - ENDIF() + set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_SPP_DESCRIPTION}" ) + endif() - IF(_SPP_URL) - GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_name}_URL) - IF(_info AND NOT "${_info}" STREQUAL "${_SPP_URL}") - MESSAGE(STATUS "Warning: Property URL already set to \"${_info}\", overriding it with \"${_SPP_URL}\"") - ENDIF() + if(_SPP_URL) + get_property(_info GLOBAL PROPERTY _CMAKE_${_name}_URL) + if(_info AND NOT "${_info}" STREQUAL "${_SPP_URL}") + message(STATUS "Warning: Property URL already set to \"${_info}\", overriding it with \"${_SPP_URL}\"") + endif() - SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_SPP_URL}" ) - ENDIF() + set_property(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_SPP_URL}" ) + endif() # handle the PURPOSE: use APPEND, since there can be multiple purposes for one package inside a project - IF(_SPP_PURPOSE) - SET_PROPERTY(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_SPP_PURPOSE}" ) - ENDIF() + if(_SPP_PURPOSE) + set_property(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_SPP_PURPOSE}" ) + endif() # handle the TYPE - IF(NOT _SPP_TYPE) - SET(_SPP_TYPE OPTIONAL) - ENDIF() + if(NOT _SPP_TYPE) + set(_SPP_TYPE OPTIONAL) + endif() # List the supported types, according to their priority - SET(validTypes "RUNTIME" "OPTIONAL" "RECOMMENDED" "REQUIRED" ) - LIST(FIND validTypes ${_SPP_TYPE} _typeIndexInList) - IF("${_typeIndexInList}" STREQUAL "-1" ) - MESSAGE(FATAL_ERROR "Bad package property type ${_SPP_TYPE} used in SET_PACKAGE_PROPERTIES(). " + set(validTypes "RUNTIME" "OPTIONAL" "RECOMMENDED" "REQUIRED" ) + list(FIND validTypes ${_SPP_TYPE} _typeIndexInList) + if("${_typeIndexInList}" STREQUAL "-1" ) + message(FATAL_ERROR "Bad package property type ${_SPP_TYPE} used in SET_PACKAGE_PROPERTIES(). " "Valid types are OPTIONAL, RECOMMENDED, REQUIRED and RUNTIME." ) - ENDIF() + endif() - GET_PROPERTY(_previousType GLOBAL PROPERTY _CMAKE_${_name}_TYPE) - LIST(FIND validTypes "${_previousType}" _prevTypeIndexInList) + get_property(_previousType GLOBAL PROPERTY _CMAKE_${_name}_TYPE) + list(FIND validTypes "${_previousType}" _prevTypeIndexInList) # make sure a previously set TYPE is not overridden with a lower new TYPE: - IF("${_typeIndexInList}" GREATER "${_prevTypeIndexInList}") - SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_TYPE "${_SPP_TYPE}" ) - ENDIF() + if("${_typeIndexInList}" GREATER "${_prevTypeIndexInList}") + set_property(GLOBAL PROPERTY _CMAKE_${_name}_TYPE "${_SPP_TYPE}" ) + endif() -ENDFUNCTION(SET_PACKAGE_PROPERTIES) +endfunction() -FUNCTION(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet) +function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet) - SET(_type "ANY") - IF("${_property}" MATCHES "REQUIRED_") - SET(_type "REQUIRED") - ELSEIF("${_property}" MATCHES "RECOMMENDED_") - SET(_type "RECOMMENDED") - ELSEIF("${_property}" MATCHES "RUNTIME_") - SET(_type "RUNTIME") - ELSEIF("${_property}" MATCHES "OPTIONAL_") - SET(_type "OPTIONAL") - ENDIF() + set(_type "ANY") + if("${_property}" MATCHES "REQUIRED_") + set(_type "REQUIRED") + elseif("${_property}" MATCHES "RECOMMENDED_") + set(_type "RECOMMENDED") + elseif("${_property}" MATCHES "RUNTIME_") + set(_type "RUNTIME") + elseif("${_property}" MATCHES "OPTIONAL_") + set(_type "OPTIONAL") + endif() - IF("${_property}" MATCHES "PACKAGES_FOUND") - SET(_property "PACKAGES_FOUND") - ELSEIF("${_property}" MATCHES "PACKAGES_NOT_FOUND") - SET(_property "PACKAGES_NOT_FOUND") - ENDIF() + if("${_property}" MATCHES "PACKAGES_FOUND") + set(_property "PACKAGES_FOUND") + elseif("${_property}" MATCHES "PACKAGES_NOT_FOUND") + set(_property "PACKAGES_NOT_FOUND") + endif() - SET(_currentFeatureText "") - GET_PROPERTY(_EnabledFeatures GLOBAL PROPERTY ${_property}) + set(_currentFeatureText "") + get_property(_EnabledFeatures GLOBAL PROPERTY ${_property}) - FOREACH(_currentFeature ${_EnabledFeatures}) + foreach(_currentFeature ${_EnabledFeatures}) # does this package belong to the type we currently want to list ? - GET_PROPERTY(_currentType GLOBAL PROPERTY _CMAKE_${_currentFeature}_TYPE) - IF(NOT _currentType) - SET(_currentType OPTIONAL) - ENDIF() + get_property(_currentType GLOBAL PROPERTY _CMAKE_${_currentFeature}_TYPE) + if(NOT _currentType) + set(_currentType OPTIONAL) + endif() - IF("${_type}" STREQUAL ANY OR "${_type}" STREQUAL "${_currentType}") + if("${_type}" STREQUAL ANY OR "${_type}" STREQUAL "${_currentType}") # check whether the current feature/package should be in the output depending on whether it was QUIET or not - SET(includeThisOne TRUE) + set(includeThisOne TRUE) # skip QUIET packages, except if they are REQUIRED or INCLUDE_QUIET_PACKAGES has been set - IF((NOT "${_currentType}" STREQUAL "REQUIRED") AND NOT _includeQuiet) - GET_PROPERTY(_isQuiet GLOBAL PROPERTY _CMAKE_${_currentFeature}_QUIET) - IF(_isQuiet) - SET(includeThisOne FALSE) - ENDIF() - ENDIF() + if((NOT "${_currentType}" STREQUAL "REQUIRED") AND NOT _includeQuiet) + get_property(_isQuiet GLOBAL PROPERTY _CMAKE_${_currentFeature}_QUIET) + if(_isQuiet) + set(includeThisOne FALSE) + endif() + endif() - IF(includeThisOne) + if(includeThisOne) - SET(_currentFeatureText "${_currentFeatureText}\n * ${_currentFeature}") - GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_REQUIRED_VERSION) - IF(_info) - SET(_currentFeatureText "${_currentFeatureText} (required version ${_info})") - ENDIF(_info) - GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_DESCRIPTION) - IF(_info) - SET(_currentFeatureText "${_currentFeatureText} , ${_info}") - ENDIF(_info) - GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_URL) - IF(_info) - SET(_currentFeatureText "${_currentFeatureText} , <${_info}>") - ENDIF(_info) + set(_currentFeatureText "${_currentFeatureText}\n * ${_currentFeature}") + get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_REQUIRED_VERSION) + if(_info) + set(_currentFeatureText "${_currentFeatureText} (required version ${_info})") + endif() + get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_DESCRIPTION) + if(_info) + set(_currentFeatureText "${_currentFeatureText} , ${_info}") + endif() + get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_URL) + if(_info) + set(_currentFeatureText "${_currentFeatureText} , <${_info}>") + endif() - GET_PROPERTY(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_PURPOSE) - FOREACH(_purpose ${_info}) - SET(_currentFeatureText "${_currentFeatureText}\n ${_purpose}") - ENDFOREACH() + get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_PURPOSE) + foreach(_purpose ${_info}) + set(_currentFeatureText "${_currentFeatureText}\n ${_purpose}") + endforeach() - ENDIF(includeThisOne) + endif() - ENDIF("${_type}" STREQUAL ANY OR "${_type}" STREQUAL "${_currentType}") + endif() - ENDFOREACH(_currentFeature) - SET(${_var} "${_currentFeatureText}" PARENT_SCOPE) -ENDFUNCTION(_FS_GET_FEATURE_SUMMARY) + endforeach() + set(${_var} "${_currentFeatureText}" PARENT_SCOPE) +endfunction() -FUNCTION(FEATURE_SUMMARY) +function(FEATURE_SUMMARY) # CMAKE_PARSE_ARGUMENTS( args...) - SET(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) - SET(oneValueArgs FILENAME VAR DESCRIPTION WHAT) - SET(multiValueArgs ) # none + set(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) + set(oneValueArgs FILENAME VAR DESCRIPTION WHAT) + set(multiValueArgs ) # none CMAKE_PARSE_ARGUMENTS(_FS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) - IF(_FS_UNPARSED_ARGUMENTS) - MESSAGE(FATAL_ERROR "Unknown keywords given to FEATURE_SUMMARY(): \"${_FS_UNPARSED_ARGUMENTS}\"") - ENDIF() + if(_FS_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to FEATURE_SUMMARY(): \"${_FS_UNPARSED_ARGUMENTS}\"") + endif() - IF(NOT _FS_WHAT) - MESSAGE(FATAL_ERROR "The call to FEATURE_SUMMARY() doesn't set the required WHAT argument.") - ENDIF() + if(NOT _FS_WHAT) + message(FATAL_ERROR "The call to FEATURE_SUMMARY() doesn't set the required WHAT argument.") + endif() - SET(validWhatParts "ENABLED_FEATURES" + set(validWhatParts "ENABLED_FEATURES" "DISABLED_FEATURES" "PACKAGES_FOUND" "PACKAGES_NOT_FOUND" @@ -360,17 +360,17 @@ FUNCTION(FEATURE_SUMMARY) "RUNTIME_PACKAGES_FOUND" "RUNTIME_PACKAGES_NOT_FOUND") - LIST(FIND validWhatParts "${_FS_WHAT}" indexInList) - IF(NOT "${indexInList}" STREQUAL "-1") + list(FIND validWhatParts "${_FS_WHAT}" indexInList) + if(NOT "${indexInList}" STREQUAL "-1") _FS_GET_FEATURE_SUMMARY( ${_FS_WHAT} _featureSummary ${_FS_INCLUDE_QUIET_PACKAGES} ) - SET(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n") - IF (("${_FS_WHAT}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND") AND _featureSummary) - SET(requiredPackagesNotFound TRUE) - ENDIF() + set(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n") + if (("${_FS_WHAT}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND") AND _featureSummary) + set(requiredPackagesNotFound TRUE) + endif() - ELSEIF("${_FS_WHAT}" STREQUAL "ALL") + elseif("${_FS_WHAT}" STREQUAL "ALL") - SET(allWhatParts "ENABLED_FEATURES" + set(allWhatParts "ENABLED_FEATURES" "RUNTIME_PACKAGES_FOUND" "OPTIONAL_PACKAGES_FOUND" "RECOMMENDED_PACKAGES_FOUND" @@ -383,84 +383,84 @@ FUNCTION(FEATURE_SUMMARY) "REQUIRED_PACKAGES_NOT_FOUND" ) - SET(title_ENABLED_FEATURES "The following features have been enabled:") - SET(title_DISABLED_FEATURES "The following features have been disabled:") - SET(title_OPTIONAL_PACKAGES_FOUND "The following OPTIONAL packages have been found:") - SET(title_OPTIONAL_PACKAGES_NOT_FOUND "The following OPTIONAL packages have not been found:") - SET(title_RECOMMENDED_PACKAGES_FOUND "The following RECOMMENDED packages have been found:") - SET(title_RECOMMENDED_PACKAGES_NOT_FOUND "The following RECOMMENDED packages have not been found:") - SET(title_REQUIRED_PACKAGES_FOUND "The following REQUIRED packages have been found:") - SET(title_REQUIRED_PACKAGES_NOT_FOUND "The following REQUIRED packages have not been found:") - SET(title_RUNTIME_PACKAGES_FOUND "The following RUNTIME packages have been found:") - SET(title_RUNTIME_PACKAGES_NOT_FOUND "The following RUNTIME packages have not been found:") - - SET(_fullText "${_FS_DESCRIPTION}") - FOREACH(part ${allWhatParts}) - SET(_tmp) + set(title_ENABLED_FEATURES "The following features have been enabled:") + set(title_DISABLED_FEATURES "The following features have been disabled:") + set(title_OPTIONAL_PACKAGES_FOUND "The following OPTIONAL packages have been found:") + set(title_OPTIONAL_PACKAGES_NOT_FOUND "The following OPTIONAL packages have not been found:") + set(title_RECOMMENDED_PACKAGES_FOUND "The following RECOMMENDED packages have been found:") + set(title_RECOMMENDED_PACKAGES_NOT_FOUND "The following RECOMMENDED packages have not been found:") + set(title_REQUIRED_PACKAGES_FOUND "The following REQUIRED packages have been found:") + set(title_REQUIRED_PACKAGES_NOT_FOUND "The following REQUIRED packages have not been found:") + set(title_RUNTIME_PACKAGES_FOUND "The following RUNTIME packages have been found:") + set(title_RUNTIME_PACKAGES_NOT_FOUND "The following RUNTIME packages have not been found:") + + set(_fullText "${_FS_DESCRIPTION}") + foreach(part ${allWhatParts}) + set(_tmp) _FS_GET_FEATURE_SUMMARY( ${part} _tmp ${_FS_INCLUDE_QUIET_PACKAGES}) - IF(_tmp) - SET(_fullText "${_fullText}\n-- ${title_${part}}\n${_tmp}\n") - IF("${part}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND") - SET(requiredPackagesNotFound TRUE) - ENDIF() - ENDIF() - ENDFOREACH() - ELSE() - MESSAGE(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() is set to ${_FS_WHAT}, which is not a valid value.") - ENDIF() - - IF(_FS_FILENAME) - IF(_FS_APPEND) - FILE(APPEND "${_FS_FILENAME}" "${_fullText}") - ELSE(_FS_APPEND) - FILE(WRITE "${_FS_FILENAME}" "${_fullText}") - ENDIF() - - ELSE(_FS_FILENAME) - IF(NOT _FS_VAR) - MESSAGE(STATUS "${_fullText}") - ENDIF() - ENDIF() - - IF(_FS_VAR) - SET(${_FS_VAR} "${_fullText}" PARENT_SCOPE) - ENDIF() - - IF(requiredPackagesNotFound AND _FS_FATAL_ON_MISSING_REQUIRED_PACKAGES) - MESSAGE(FATAL_ERROR "feature_summary() Error: REQUIRED package(s) are missing, aborting CMake run.") - ENDIF() - -ENDFUNCTION(FEATURE_SUMMARY) + if(_tmp) + set(_fullText "${_fullText}\n-- ${title_${part}}\n${_tmp}\n") + if("${part}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND") + set(requiredPackagesNotFound TRUE) + endif() + endif() + endforeach() + else() + message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() is set to ${_FS_WHAT}, which is not a valid value.") + endif() + + if(_FS_FILENAME) + if(_FS_APPEND) + file(APPEND "${_FS_FILENAME}" "${_fullText}") + else() + file(WRITE "${_FS_FILENAME}" "${_fullText}") + endif() + + else() + if(NOT _FS_VAR) + message(STATUS "${_fullText}") + endif() + endif() + + if(_FS_VAR) + set(${_FS_VAR} "${_fullText}" PARENT_SCOPE) + endif() + + if(requiredPackagesNotFound AND _FS_FATAL_ON_MISSING_REQUIRED_PACKAGES) + message(FATAL_ERROR "feature_summary() Error: REQUIRED package(s) are missing, aborting CMake run.") + endif() + +endfunction() # The stuff below is only kept for compatibility -FUNCTION(SET_PACKAGE_INFO _name _desc) - SET(_url "${ARGV2}") - SET(_purpose "${ARGV3}") - SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" ) - IF(_url MATCHES ".+") - SET_PROPERTY(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_url}" ) - ENDIF() - IF(_purpose MATCHES ".+") - SET_PROPERTY(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_purpose}" ) - ENDIF() -ENDFUNCTION(SET_PACKAGE_INFO) +function(SET_PACKAGE_INFO _name _desc) + set(_url "${ARGV2}") + set(_purpose "${ARGV3}") + set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" ) + if(_url MATCHES ".+") + set_property(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_url}" ) + endif() + if(_purpose MATCHES ".+") + set_property(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_purpose}" ) + endif() +endfunction() -FUNCTION(SET_FEATURE_INFO) +function(SET_FEATURE_INFO) SET_PACKAGE_INFO(${ARGN}) -ENDFUNCTION(SET_FEATURE_INFO) +endfunction() -FUNCTION(PRINT_ENABLED_FEATURES) +function(PRINT_ENABLED_FEATURES) FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:") -ENDFUNCTION(PRINT_ENABLED_FEATURES) +endfunction() -FUNCTION(PRINT_DISABLED_FEATURES) +function(PRINT_DISABLED_FEATURES) FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:") -ENDFUNCTION(PRINT_DISABLED_FEATURES) +endfunction() diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake index 4a0b69303..60b0f56e6 100644 --- a/Modules/FindALSA.cmake +++ b/Modules/FindALSA.cmake @@ -40,7 +40,7 @@ if(ALSA_INCLUDE_DIR AND EXISTS "${ALSA_INCLUDE_DIR}/alsa/version.h") unset(alsa_version_str) endif() -# handle the QUIETLY and REQUIRED arguments and set ALSA_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set ALSA_FOUND to TRUE if # all listed variables are TRUE include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA diff --git a/Modules/FindASPELL.cmake b/Modules/FindASPELL.cmake index 713ab7e19..5b383c4d3 100644 --- a/Modules/FindASPELL.cmake +++ b/Modules/FindASPELL.cmake @@ -21,17 +21,17 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(ASPELL_INCLUDE_DIR aspell.h ) +find_path(ASPELL_INCLUDE_DIR aspell.h ) -FIND_PROGRAM(ASPELL_EXECUTABLE +find_program(ASPELL_EXECUTABLE NAMES aspell ) -FIND_LIBRARY(ASPELL_LIBRARIES NAMES aspell aspell-15 libaspell-15 libaspell) +find_library(ASPELL_LIBRARIES NAMES aspell aspell-15 libaspell-15 libaspell) # handle the QUIETLY and REQUIRED arguments and set ASPELL_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASPELL DEFAULT_MSG ASPELL_LIBRARIES ASPELL_INCLUDE_DIR ASPELL_EXECUTABLE) -MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARIES ASPELL_EXECUTABLE) +mark_as_advanced(ASPELL_INCLUDE_DIR ASPELL_LIBRARIES ASPELL_EXECUTABLE) diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake index 8b5b05ae3..93fa40004 100644 --- a/Modules/FindAVIFile.cmake +++ b/Modules/FindAVIFile.cmake @@ -1,5 +1,5 @@ # - Locate AVIFILE library and include paths -# AVIFILE (http://avifile.sourceforge.net/)is a set of libraries for +# AVIFILE (http://avifile.sourceforge.net/)is a set of libraries for # i386 machines # to use various AVI codecs. Support is limited beyond Linux. Windows # provides native AVI support, and so doesn't need this library. @@ -22,27 +22,27 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF (UNIX) +if (UNIX) - FIND_PATH(AVIFILE_INCLUDE_DIR avifile.h + find_path(AVIFILE_INCLUDE_DIR avifile.h /usr/local/avifile/include /usr/local/include/avifile ) - FIND_LIBRARY(AVIFILE_AVIPLAY_LIBRARY aviplay + find_library(AVIFILE_AVIPLAY_LIBRARY aviplay /usr/local/avifile/lib ) -ENDIF (UNIX) +endif () # handle the QUIETLY and REQUIRED arguments and set AVIFILE_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(AVIFile DEFAULT_MSG AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY) -IF (AVIFILE_FOUND) - SET(AVIFILE_LIBRARIES ${AVIFILE_AVIPLAY_LIBRARY}) - SET(AVIFILE_DEFINITIONS "") -ENDIF() +if (AVIFILE_FOUND) + set(AVIFILE_LIBRARIES ${AVIFILE_AVIPLAY_LIBRARY}) + set(AVIFILE_DEFINITIONS "") +endif() -MARK_AS_ADVANCED(AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY) +mark_as_advanced(AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY) diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake index 84ed3cab6..4758534d7 100644 --- a/Modules/FindArmadillo.cmake +++ b/Modules/FindArmadillo.cmake @@ -58,24 +58,25 @@ if(ARMADILLO_INCLUDE_DIR) if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp") # Read and parse armdillo version header file for version number - file(READ "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp" _armadillo_HEADER_CONTENTS) + file(STRINGS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp" _armadillo_HEADER_CONTENTS REGEX "#define ARMA_VERSION_[A-Z]+ ") string(REGEX REPLACE ".*#define ARMA_VERSION_MAJOR ([0-9]+).*" "\\1" ARMADILLO_VERSION_MAJOR "${_armadillo_HEADER_CONTENTS}") string(REGEX REPLACE ".*#define ARMA_VERSION_MINOR ([0-9]+).*" "\\1" ARMADILLO_VERSION_MINOR "${_armadillo_HEADER_CONTENTS}") string(REGEX REPLACE ".*#define ARMA_VERSION_PATCH ([0-9]+).*" "\\1" ARMADILLO_VERSION_PATCH "${_armadillo_HEADER_CONTENTS}") # WARNING: The number of spaces before the version name is not one. - string(REGEX REPLACE ".*#define ARMA_VERSION_NAME\ +\"([0-9a-zA-Z\ _-]+)\".*" "\\1" ARMADILLO_VERSION_NAME "${_armadillo_HEADER_CONTENTS}") + string(REGEX REPLACE ".*#define ARMA_VERSION_NAME +\"([0-9a-zA-Z _-]+)\".*" "\\1" ARMADILLO_VERSION_NAME "${_armadillo_HEADER_CONTENTS}") - endif(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp") + unset(_armadillo_HEADER_CONTENTS) + endif() set(ARMADILLO_VERSION_STRING "${ARMADILLO_VERSION_MAJOR}.${ARMADILLO_VERSION_MINOR}.${ARMADILLO_VERSION_PATCH}") -endif (ARMADILLO_INCLUDE_DIR) +endif () #====================== # Checks 'REQUIRED', 'QUIET' and versions. -include(FindPackageHandleStandardArgs) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(Armadillo REQUIRED_VARS ARMADILLO_LIBRARY ARMADILLO_INCLUDE_DIR VERSION_VAR ARMADILLO_VERSION_STRING) @@ -84,7 +85,7 @@ find_package_handle_standard_args(Armadillo if (ARMADILLO_FOUND) set(ARMADILLO_INCLUDE_DIRS ${ARMADILLO_INCLUDE_DIR}) set(ARMADILLO_LIBRARIES ${ARMADILLO_LIBRARY}) -endif (ARMADILLO_FOUND) +endif () # Hide internal variables diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index 7af336788..4a3e68c68 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -47,46 +47,46 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable") -MARK_AS_ADVANCED(BISON_EXECUTABLE) +find_program(BISON_EXECUTABLE NAMES bison win_bison DOC "path to the bison executable") +mark_as_advanced(BISON_EXECUTABLE) -IF(BISON_EXECUTABLE) +if(BISON_EXECUTABLE) # the bison commands should be executed with the C locale, otherwise # the message (which are parsed) may be translated - SET(_Bison_SAVED_LC_ALL "$ENV{LC_ALL}") - SET(ENV{LC_ALL} C) + set(_Bison_SAVED_LC_ALL "$ENV{LC_ALL}") + set(ENV{LC_ALL} C) - EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version + execute_process(COMMAND ${BISON_EXECUTABLE} --version OUTPUT_VARIABLE BISON_version_output ERROR_VARIABLE BISON_version_error RESULT_VARIABLE BISON_version_result OUTPUT_STRIP_TRAILING_WHITESPACE) - SET(ENV{LC_ALL} ${_Bison_SAVED_LC_ALL}) + set(ENV{LC_ALL} ${_Bison_SAVED_LC_ALL}) - IF(NOT ${BISON_version_result} EQUAL 0) - MESSAGE(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}") - ELSE() + if(NOT ${BISON_version_result} EQUAL 0) + message(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}") + else() # Bison++ - IF("${BISON_version_output}" MATCHES "^bison\\+\\+") - STRING(REGEX REPLACE "^bison\\+\\+ Version ([^,]+).*" "\\1" + if("${BISON_version_output}" MATCHES "^bison\\+\\+") + string(REGEX REPLACE "^bison\\+\\+ Version ([^,]+).*" "\\1" BISON_VERSION "${BISON_version_output}") # GNU Bison - ELSEIF("${BISON_version_output}" MATCHES "^bison[^+]") - STRING(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1" + elseif("${BISON_version_output}" MATCHES "^bison[^+]") + string(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1" BISON_VERSION "${BISON_version_output}") - ELSEIF("${BISON_version_output}" MATCHES "^GNU Bison ") - STRING(REGEX REPLACE "^GNU Bison (version )?([^\n]+).*" "\\2" + elseif("${BISON_version_output}" MATCHES "^GNU Bison ") + string(REGEX REPLACE "^GNU Bison (version )?([^\n]+).*" "\\2" BISON_VERSION "${BISON_version_output}") - ENDIF() - ENDIF() + endif() + endif() # internal macro - MACRO(BISON_TARGET_option_verbose Name BisonOutput filename) - LIST(APPEND BISON_TARGET_cmdopt "--verbose") - GET_FILENAME_COMPONENT(BISON_TARGET_output_path "${BisonOutput}" PATH) - GET_FILENAME_COMPONENT(BISON_TARGET_output_name "${BisonOutput}" NAME_WE) - ADD_CUSTOM_COMMAND(OUTPUT ${filename} + macro(BISON_TARGET_option_verbose Name BisonOutput filename) + list(APPEND BISON_TARGET_cmdopt "--verbose") + get_filename_component(BISON_TARGET_output_path "${BisonOutput}" PATH) + get_filename_component(BISON_TARGET_output_name "${BisonOutput}" NAME_WE) + add_custom_command(OUTPUT ${filename} COMMAND ${CMAKE_COMMAND} ARGS -E copy "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output" @@ -95,58 +95,58 @@ IF(BISON_EXECUTABLE) "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output" COMMENT "[BISON][${Name}] Copying bison verbose table to ${filename}" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) - SET(BISON_${Name}_VERBOSE_FILE ${filename}) - LIST(APPEND BISON_TARGET_extraoutputs + set(BISON_${Name}_VERBOSE_FILE ${filename}) + list(APPEND BISON_TARGET_extraoutputs "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output") - ENDMACRO(BISON_TARGET_option_verbose) + endmacro() # internal macro - MACRO(BISON_TARGET_option_extraopts Options) - SET(BISON_TARGET_extraopts "${Options}") - SEPARATE_ARGUMENTS(BISON_TARGET_extraopts) - LIST(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts}) - ENDMACRO(BISON_TARGET_option_extraopts) + macro(BISON_TARGET_option_extraopts Options) + set(BISON_TARGET_extraopts "${Options}") + separate_arguments(BISON_TARGET_extraopts) + list(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts}) + endmacro() #============================================================ # BISON_TARGET (public macro) #============================================================ # - MACRO(BISON_TARGET Name BisonInput BisonOutput) - SET(BISON_TARGET_output_header "") - SET(BISON_TARGET_cmdopt "") - SET(BISON_TARGET_outputs "${BisonOutput}") - IF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7) - MESSAGE(SEND_ERROR "Usage") - ELSE() + macro(BISON_TARGET Name BisonInput BisonOutput) + set(BISON_TARGET_output_header "") + set(BISON_TARGET_cmdopt "") + set(BISON_TARGET_outputs "${BisonOutput}") + if(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7) + message(SEND_ERROR "Usage") + else() # Parsing parameters - IF(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5) - IF("${ARGV3}" STREQUAL "VERBOSE") + if(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5) + if("${ARGV3}" STREQUAL "VERBOSE") BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV4}") - ENDIF() - IF("${ARGV3}" STREQUAL "COMPILE_FLAGS") + endif() + if("${ARGV3}" STREQUAL "COMPILE_FLAGS") BISON_TARGET_option_extraopts("${ARGV4}") - ENDIF() - ENDIF() + endif() + endif() - IF(${ARGC} EQUAL 7) - IF("${ARGV5}" STREQUAL "VERBOSE") + if(${ARGC} EQUAL 7) + if("${ARGV5}" STREQUAL "VERBOSE") BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV6}") - ENDIF() + endif() - IF("${ARGV5}" STREQUAL "COMPILE_FLAGS") + if("${ARGV5}" STREQUAL "COMPILE_FLAGS") BISON_TARGET_option_extraopts("${ARGV6}") - ENDIF() - ENDIF() + endif() + endif() # Header's name generated by bison (see option -d) - LIST(APPEND BISON_TARGET_cmdopt "-d") - STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}") - STRING(REPLACE "c" "h" _fileext ${_fileext}) - STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" + list(APPEND BISON_TARGET_cmdopt "-d") + string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}") + string(REPLACE "c" "h" _fileext ${_fileext}) + string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" BISON_${Name}_OUTPUT_HEADER "${ARGV2}") - LIST(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}") + list(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}") - ADD_CUSTOM_COMMAND(OUTPUT ${BISON_TARGET_outputs} + add_custom_command(OUTPUT ${BISON_TARGET_outputs} ${BISON_TARGET_extraoutputs} COMMAND ${BISON_EXECUTABLE} ARGS ${BISON_TARGET_cmdopt} -o ${ARGV2} ${ARGV1} @@ -155,20 +155,20 @@ IF(BISON_EXECUTABLE) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) # define target variables - SET(BISON_${Name}_DEFINED TRUE) - SET(BISON_${Name}_INPUT ${ARGV1}) - SET(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs}) - SET(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt}) - SET(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}") - - ENDIF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7) - ENDMACRO(BISON_TARGET) + set(BISON_${Name}_DEFINED TRUE) + set(BISON_${Name}_INPUT ${ARGV1}) + set(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs}) + set(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt}) + set(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}") + + endif() + endmacro() # #============================================================ -ENDIF(BISON_EXECUTABLE) +endif() -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE VERSION_VAR BISON_VERSION) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 1cf31c4a6..f8a284d71 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -40,8 +40,8 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -include(CheckFunctionExists) -include(CheckFortranFunctionExists) +include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake) set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) @@ -54,11 +54,11 @@ elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) ) else() if(BLAS_FIND_REQUIRED) message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.") - else(BLAS_FIND_REQUIRED) + else() message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)") return() - endif(BLAS_FIND_REQUIRED) -endif( ) + endif() +endif() macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) # This macro checks for the existence of the combination of fortran libraries @@ -81,9 +81,9 @@ if (NOT _libdir) if (WIN32) set(_libdir ENV LIB) elseif (APPLE) - set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH) + set(_libdir ENV DYLD_LIBRARY_PATH) else () - set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH) + set(_libdir ENV LD_LIBRARY_PATH) endif () endif () @@ -94,18 +94,18 @@ foreach(_library ${_list}) if (BLA_STATIC) if (WIN32) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif ( WIN32 ) + endif () if (APPLE) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else (APPLE) + else () set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif (APPLE) - else (BLA_STATIC) + endif () + else () if (CMAKE_SYSTEM_NAME STREQUAL "Linux") # for ubuntu's libblas3gf and liblapack3gf packages set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) endif () - endif (BLA_STATIC) + endif () find_library(${_prefix}_${_library}_LIBRARY NAMES ${_library} PATHS ${_libdir} @@ -113,8 +113,8 @@ foreach(_library ${_list}) mark_as_advanced(${_prefix}_${_library}_LIBRARY) set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) - endif(_libraries_work) -endforeach(_library ${_list}) + endif() +endforeach() if(_libraries_work) # Test this combination of libraries. set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread}) @@ -127,23 +127,23 @@ if(_libraries_work) set(CMAKE_REQUIRED_LIBRARIES) mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) -endif(_libraries_work) +endif() if(NOT _libraries_work) set(${LIBRARIES} FALSE) -endif(NOT _libraries_work) +endif() #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") -endmacro(Check_Fortran_Libraries) +endmacro() set(BLAS_LINKER_FLAGS) set(BLAS_LIBRARIES) set(BLAS95_LIBRARIES) if ($ENV{BLA_VENDOR} MATCHES ".+") set(BLA_VENDOR $ENV{BLA_VENDOR}) -else ($ENV{BLA_VENDOR} MATCHES ".+") +else () if(NOT BLA_VENDOR) set(BLA_VENDOR "All") - endif(NOT BLA_VENDOR) -endif ($ENV{BLA_VENDOR} MATCHES ".+") + endif() +endif () if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) @@ -156,8 +156,8 @@ if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") "goto2" "" ) - endif(NOT BLAS_LIBRARIES) -endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") + endif() +endif () if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) @@ -170,8 +170,8 @@ if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") "f77blas;atlas" "" ) - endif(NOT BLAS_LIBRARIES) -endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") + endif() +endif () # BLAS in PhiPACK libraries? (requires generic BLAS lib, too) if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") @@ -184,8 +184,8 @@ if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") "sgemm;dgemm;blas" "" ) - endif(NOT BLAS_LIBRARIES) -endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") + endif() +endif () # BLAS in Alpha CXML library? if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") @@ -198,8 +198,8 @@ if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") "cxml" "" ) - endif(NOT BLAS_LIBRARIES) -endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") + endif() +endif () # BLAS in Alpha DXML library? (now called CXML, see above) if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") @@ -212,8 +212,8 @@ if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") "dxml" "" ) - endif(NOT BLAS_LIBRARIES) -endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") + endif() +endif () # BLAS in Sun Performance library? if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") @@ -228,9 +228,9 @@ if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") ) if(BLAS_LIBRARIES) set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf") - endif(BLAS_LIBRARIES) - endif(NOT BLAS_LIBRARIES) -endif (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") + endif() + endif() +endif () # BLAS in SCSL library? (SGI/Cray Scientific Library) if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") @@ -243,8 +243,8 @@ if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") "scsl" "" ) - endif(NOT BLAS_LIBRARIES) -endif (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") + endif() +endif () # BLAS in SGIMATH library? if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") @@ -257,8 +257,8 @@ if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") "complib.sgimath" "" ) - endif(NOT BLAS_LIBRARIES) -endif (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") + endif() +endif () # BLAS in IBM ESSL library? (requires generic BLAS lib, too) if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") @@ -271,8 +271,8 @@ if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") "essl;blas" "" ) - endif(NOT BLAS_LIBRARIES) -endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") + endif() +endif () #BLAS in acml library? if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") @@ -321,7 +321,7 @@ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" ) set( _ACML_COMPILER32 "nag32" ) set( _ACML_COMPILER64 "nag64" ) - else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" ) + else() set( _ACML_COMPILER32 "gfortran32" ) set( _ACML_COMPILER64 "gfortran64" ) endif() @@ -330,7 +330,7 @@ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") set(_ACML_MP_LIB_DIRS "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib" "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" ) - else() #if( _BLAS_VENDOR STREQUAL "ACML" ) + else() set(_ACML_LIB_DIRS "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib" "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" ) @@ -364,7 +364,7 @@ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") break() endif() endforeach() - else() #if( _BLAS_VENDOR STREQUAL "ACML" ) + else() foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} ) check_fortran_libraries ( BLAS_LIBRARIES @@ -388,7 +388,7 @@ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") "acml;acml_mv" "" ) - endif(NOT BLAS_LIBRARIES) + endif() if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES @@ -398,7 +398,7 @@ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") "acml_mp;acml_mv" "" ) - endif(NOT BLAS_LIBRARIES) + endif() if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES @@ -408,7 +408,7 @@ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") "acml;acml_mv;CALBLAS" "" ) - endif(NOT BLAS_LIBRARIES) + endif() endif () # ACML # Apple BLAS library? @@ -422,8 +422,8 @@ if(NOT BLAS_LIBRARIES) "Accelerate" "" ) - endif(NOT BLAS_LIBRARIES) -endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") + endif() +endif () if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") if ( NOT BLAS_LIBRARIES ) @@ -435,8 +435,8 @@ if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") "vecLib" "" ) - endif ( NOT BLAS_LIBRARIES ) -endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") + endif () +endif () # Generic BLAS library? if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) @@ -448,8 +448,8 @@ if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") "blas" "" ) - endif(NOT BLAS_LIBRARIES) -endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") + endif() +endif () #BLAS in intel mkl 10 library? (em64t 64bit) if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") @@ -459,9 +459,9 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) find_package(Threads) - else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) + else() find_package(Threads REQUIRED) - endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) + endif() set(BLAS_SEARCH_LIBS "") @@ -471,7 +471,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") if (WIN32) list(APPEND BLAS_SEARCH_LIBS "mkl_blas95 mkl_intel_c mkl_intel_thread mkl_core libguide40") - else (WIN32) + else () if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide") @@ -490,18 +490,18 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") endif () endif () - endif (WIN32) + endif () if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS "mkl_blas95_lp64 mkl_intel_lp64 mkl_sequential mkl_core") endif () - else (BLA_F95) + else () set(BLAS_mkl_SEARCH_SYMBOL sgemm) set(_LIBRARIES BLAS_LIBRARIES) if (WIN32) list(APPEND BLAS_SEARCH_LIBS "mkl_c_dll mkl_intel_thread_dll mkl_core_dll libguide40") - else (WIN32) + else () if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS "mkl_intel mkl_intel_thread mkl_core guide") @@ -531,12 +531,12 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS "mkl_em64t") endif () - endif (WIN32) + endif () if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS "mkl_intel_lp64 mkl_sequential mkl_core") endif () - endif (BLA_F95) + endif () foreach (IT ${BLAS_SEARCH_LIBS}) string(REPLACE " " ";" SEARCH_LIBS ${IT}) @@ -553,54 +553,54 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") endif () endforeach () - endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) -endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") + endif () +endif () if(BLA_F95) if(BLAS95_LIBRARIES) set(BLAS95_FOUND TRUE) - else(BLAS95_LIBRARIES) + else() set(BLAS95_FOUND FALSE) - endif(BLAS95_LIBRARIES) + endif() if(NOT BLAS_FIND_QUIETLY) if(BLAS95_FOUND) message(STATUS "A library with BLAS95 API found.") - else(BLAS95_FOUND) + else() if(BLAS_FIND_REQUIRED) message(FATAL_ERROR "A required library with BLAS95 API not found. Please specify library location.") - else(BLAS_FIND_REQUIRED) + else() message(STATUS "A library with BLAS95 API not found. Please specify library location.") - endif(BLAS_FIND_REQUIRED) - endif(BLAS95_FOUND) - endif(NOT BLAS_FIND_QUIETLY) + endif() + endif() + endif() set(BLAS_FOUND TRUE) set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}") -else(BLA_F95) +else() if(BLAS_LIBRARIES) set(BLAS_FOUND TRUE) - else(BLAS_LIBRARIES) + else() set(BLAS_FOUND FALSE) - endif(BLAS_LIBRARIES) + endif() if(NOT BLAS_FIND_QUIETLY) if(BLAS_FOUND) message(STATUS "A library with BLAS API found.") - else(BLAS_FOUND) + else() if(BLAS_FIND_REQUIRED) message(FATAL_ERROR "A required library with BLAS API not found. Please specify library location." ) - else(BLAS_FIND_REQUIRED) + else() message(STATUS "A library with BLAS API not found. Please specify library location." ) - endif(BLAS_FIND_REQUIRED) - endif(BLAS_FOUND) - endif(NOT BLAS_FIND_QUIETLY) -endif(BLA_F95) + endif() + endif() + endif() +endif() set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index ce7f2555d..9fb29d0f4 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -22,35 +22,35 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET(_BZIP2_PATHS PATHS +set(_BZIP2_PATHS PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Bzip2;InstallPath]" ) -FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h ${_BZIP2_PATHS} PATH_SUFFIXES include) +find_path(BZIP2_INCLUDE_DIR bzlib.h ${_BZIP2_PATHS} PATH_SUFFIXES include) -IF (NOT BZIP2_LIBRARIES) - FIND_LIBRARY(BZIP2_LIBRARY_RELEASE NAMES bz2 bzip2 ${_BZIP2_PATHS} PATH_SUFFIXES lib) - FIND_LIBRARY(BZIP2_LIBRARY_DEBUG NAMES bzip2d ${_BZIP2_PATHS} PATH_SUFFIXES lib) +if (NOT BZIP2_LIBRARIES) + find_library(BZIP2_LIBRARY_RELEASE NAMES bz2 bzip2 ${_BZIP2_PATHS} PATH_SUFFIXES lib) + find_library(BZIP2_LIBRARY_DEBUG NAMES bzip2d ${_BZIP2_PATHS} PATH_SUFFIXES lib) - INCLUDE(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) SELECT_LIBRARY_CONFIGURATIONS(BZIP2) -ENDIF (NOT BZIP2_LIBRARIES) +endif () -IF (BZIP2_INCLUDE_DIR AND EXISTS "${BZIP2_INCLUDE_DIR}/bzlib.h") - FILE(STRINGS "${BZIP2_INCLUDE_DIR}/bzlib.h" BZLIB_H REGEX "bzip2/libbzip2 version [0-9]+\\.[^ ]+ of [0-9]+ ") - STRING(REGEX REPLACE ".* bzip2/libbzip2 version ([0-9]+\\.[^ ]+) of [0-9]+ .*" "\\1" BZIP2_VERSION_STRING "${BZLIB_H}") -ENDIF (BZIP2_INCLUDE_DIR AND EXISTS "${BZIP2_INCLUDE_DIR}/bzlib.h") +if (BZIP2_INCLUDE_DIR AND EXISTS "${BZIP2_INCLUDE_DIR}/bzlib.h") + file(STRINGS "${BZIP2_INCLUDE_DIR}/bzlib.h" BZLIB_H REGEX "bzip2/libbzip2 version [0-9]+\\.[^ ]+ of [0-9]+ ") + string(REGEX REPLACE ".* bzip2/libbzip2 version ([0-9]+\\.[^ ]+) of [0-9]+ .*" "\\1" BZIP2_VERSION_STRING "${BZLIB_H}") +endif () -# handle the QUIETLY and REQUIRED arguments and set BZip2_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set BZip2_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 REQUIRED_VARS BZIP2_LIBRARIES BZIP2_INCLUDE_DIR VERSION_VAR BZIP2_VERSION_STRING) -IF (BZIP2_FOUND) - INCLUDE(CheckLibraryExists) +if (BZIP2_FOUND) + include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX) -ENDIF (BZIP2_FOUND) +endif () -MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR) +mark_as_advanced(BZIP2_INCLUDE_DIR) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index ad6b1598d..8d8b10c0f 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1,248 +1,141 @@ -# - Try to find Boost include dirs and libraries -# Usage of this module as follows: -# -# NOTE: Take note of the Boost_ADDITIONAL_VERSIONS variable below. -# Due to Boost naming conventions and limitations in CMake this find -# module is NOT future safe with respect to Boost version numbers, -# and may break. -# -# == Using Header-Only libraries from within Boost: == -# -# find_package( Boost 1.36.0 ) -# if(Boost_FOUND) -# include_directories(${Boost_INCLUDE_DIRS}) -# add_executable(foo foo.cc) -# endif() -# -# -# == Using actual libraries from within Boost: == -# -# set(Boost_USE_STATIC_LIBS ON) -# set(Boost_USE_MULTITHREADED ON) -# set(Boost_USE_STATIC_RUNTIME OFF) -# find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... ) -# -# if(Boost_FOUND) -# include_directories(${Boost_INCLUDE_DIRS}) -# add_executable(foo foo.cc) -# target_link_libraries(foo ${Boost_LIBRARIES}) -# endif() -# -# -# The components list needs to contain actual names of boost libraries only, -# such as "date_time" for "libboost_date_time". If you're using parts of -# Boost that contain header files only (e.g. foreach) you do not need to -# specify COMPONENTS. -# -# You should provide a minimum version number that should be used. If you provide this -# version number and specify the REQUIRED attribute, this module will fail if it -# can't find the specified or a later version. If you specify a version number this is -# automatically put into the considered list of version numbers and thus doesn't need -# to be specified in the Boost_ADDITIONAL_VERSIONS variable (see below). -# -# NOTE for Visual Studio Users: -# Automatic linking is used on MSVC & Borland compilers by default when -# #including things in Boost. It's important to note that setting -# Boost_USE_STATIC_LIBS to OFF is NOT enough to get you dynamic linking, -# should you need this feature. Automatic linking typically uses static -# libraries with a few exceptions (Boost.Python is one). -# -# Please see the section below near Boost_LIB_DIAGNOSTIC_DEFINITIONS for -# more details. Adding a TARGET_LINK_LIBRARIES() as shown in the example -# above appears to cause VS to link dynamically if Boost_USE_STATIC_LIBS -# gets set to OFF. It is suggested you avoid automatic linking since it -# will make your application less portable. -# -# =========== The mess that is Boost_ADDITIONAL_VERSIONS (sorry?) ============ -# -# OK, so the Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of -# boost version numbers that should be taken into account when searching -# for Boost. Unfortunately boost puts the version number into the -# actual filename for the libraries, so this variable will certainly be needed -# in the future when new Boost versions are released. -# -# Currently this module searches for the following version numbers: -# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, -# 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0, -# 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0, -# 1.45, 1.45.0, 1.46, 1.46.0, 1.46.1, 1.47, 1.47.0, 1.48, 1.48.0, -# 1.49, 1.49.0, 1.50, 1.50.0, 1.51, 1.51.0, 1.52, 1.52.0, -# 1.53, 1.53.0, 1.54, 1.54.0, 1.55, 1.55.0, 1.56, 1.56.0 -# -# NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should -# add both 1.x and 1.x.0 as shown above. Official Boost include directories -# omit the 3rd version number from include paths if it is 0 although not all -# binary Boost releases do so. -# -# set(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0") -# -# ===================================== ============= ======================== -# -# Variables used by this module, they can change the default behaviour and -# need to be set before calling find_package: -# -# Boost_USE_MULTITHREADED Can be set to OFF to use the non-multithreaded -# boost libraries. If not specified, defaults -# to ON. -# -# Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static -# boost libraries. Defaults to OFF. -# -# Boost_NO_SYSTEM_PATHS Set to TRUE to suppress searching in system -# paths (or other locations outside of BOOST_ROOT -# or BOOST_INCLUDEDIR). Useful when specifying -# BOOST_ROOT. Defaults to OFF. -# [Since CMake 2.8.3] -# -# Boost_NO_BOOST_CMAKE Do not do a find_package call in config mode -# before searching for a regular boost install. -# This will avoid finding boost-cmake installs. -# Defaults to OFF. -# [Since CMake 2.8.6] -# -# Boost_USE_STATIC_RUNTIME If enabled, searches for boost libraries -# linked against a static C++ standard library -# ('s' ABI tag). This option should be set to -# ON or OFF because the default behavior -# if not specified is platform dependent -# for backwards compatibility. -# [Since CMake 2.8.3] -# -# Boost_USE_DEBUG_PYTHON If enabled, searches for boost libraries -# compiled against a special debug build of -# Python ('y' ABI tag). Defaults to OFF. -# [Since CMake 2.8.3] -# -# Boost_USE_STLPORT If enabled, searches for boost libraries -# compiled against the STLPort standard -# library ('p' ABI tag). Defaults to OFF. -# [Since CMake 2.8.3] -# -# Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS -# If enabled, searches for boost libraries -# compiled against the deprecated STLPort -# "native iostreams" feature ('n' ABI tag). -# Defaults to OFF. -# [Since CMake 2.8.3] -# -# Other Variables used by this module which you may want to set. -# -# Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching -# the boost include directory. Please see -# the documentation above regarding this -# annoying, but necessary variable :( -# -# Boost_DEBUG Set this to TRUE to enable debugging output -# of FindBoost.cmake if you are having problems. -# Please enable this before filing any bug -# reports. -# -# Boost_DETAILED_FAILURE_MSG FindBoost doesn't output detailed information -# about why it failed or how to fix the problem -# unless this is set to TRUE or the REQUIRED -# keyword is specified in find_package(). -# [Since CMake 2.8.0] -# -# Boost_COMPILER Set this to the compiler suffix used by Boost -# (e.g. "-gcc43") if FindBoost has problems finding -# the proper Boost installation -# -# Boost_THREADAPI When building boost.thread, sometimes the name of the -# library contains an additional "pthread" or "win32" -# string known as the threadapi. This can happen when -# compiling against pthreads on Windows or win32 threads -# on Cygwin. You may specify this variable and if set -# when FindBoost searches for the Boost threading library -# it will first try to match the threadapi you specify. -# For Example: libboost_thread_win32-mgw45-mt-1_43.a -# might be found if you specified "win32" here before -# falling back on libboost_thread-mgw45-mt-1_43.a. -# [Since CMake 2.8.3] -# -# Boost_REALPATH Resolves symbolic links for discovered boost libraries -# to assist with packaging. For example, instead of -# Boost_SYSTEM_LIBRARY_RELEASE being resolved to -# "/usr/lib/libboost_system.so" it would be -# "/usr/lib/libboost_system.so.1.42.0" instead. -# This does not affect linking and should not be -# enabled unless the user needs this information. -# [Since CMake 2.8.3] -# - - -# -# These last three variables are available also as environment variables: -# Also, note they are completely UPPERCASE, except Boost_DIR. -# -# Boost_DIR or The preferred installation prefix for searching for -# BOOST_ROOT or BOOSTROOT Boost. Set this if the module has problems finding -# the proper Boost installation. -# -# Note that Boost_DIR behaves exactly as _DIR -# variables are documented to behave in find_package's -# Config mode. That is, if it is set as a -D argument -# to CMake, it must point to the location of the -# BoostConfig.cmake or Boost-config.cmake file. If it -# is set as an environment variable, it must point to -# the root of the boost installation. BOOST_ROOT and -# BOOSTROOT, on the other hand, will point to the root -# in either case. -# -# To prevent falling back on the system paths, set -# Boost_NO_SYSTEM_PATHS to true. -# -# To avoid finding boost-cmake installations, set -# Boost_NO_BOOST_CMAKE to true. -# -# BOOST_INCLUDEDIR Set this to the include directory of Boost, if the -# module has problems finding the proper Boost installation -# -# BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the -# module has problems finding the proper Boost installation -# -# Variables defined by this module: -# -# Boost_FOUND System has Boost, this means the include dir was -# found, as well as all the libraries specified in -# the COMPONENTS list. -# -# Boost_INCLUDE_DIRS Boost include directories: not cached -# -# Boost_INCLUDE_DIR This is almost the same as above, but this one is -# cached and may be modified by advanced users -# -# Boost_LIBRARIES Link to these to use the Boost libraries that you -# specified: not cached -# -# Boost_LIBRARY_DIRS The path to where the Boost library files are. -# -# Boost_VERSION The version number of the boost libraries that -# have been found, same as in version.hpp from Boost -# -# Boost_LIB_VERSION The version number in filename form as -# it's appended to the library filenames -# -# Boost_MAJOR_VERSION major version number of boost -# Boost_MINOR_VERSION minor version number of boost -# Boost_SUBMINOR_VERSION subminor version number of boost -# -# Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call -# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) -# to have diagnostic information about Boost's -# automatic linking outputted during compilation time. -# -# For each component you specify in find_package(), the following (UPPER-CASE) -# variables are set. You can use these variables if you would like to pick and -# choose components for your targets instead of just using Boost_LIBRARIES. -# -# Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found. -# -# Boost_${COMPONENT}_LIBRARY Contains the libraries for the specified Boost -# "component" (includes debug and optimized keywords -# when needed). +# - Find Boost include dirs and libraries +# Use this module by invoking find_package with the form: +# find_package(Boost +# [version] [EXACT] # Minimum or EXACT version e.g. 1.36.0 +# [REQUIRED] # Fail with error if Boost is not found +# [COMPONENTS ...] # Boost libraries by their canonical name +# ) # e.g. "date_time" for "libboost_date_time" +# This module finds headers and requested component libraries OR a CMake +# package configuration file provided by a "Boost CMake" build. For the +# latter case skip to the "Boost CMake" section below. For the former +# case results are reported in variables: +# Boost_FOUND - True if headers and requested libraries were found +# Boost_INCLUDE_DIRS - Boost include directories +# Boost_LIBRARY_DIRS - Link directories for Boost libraries +# Boost_LIBRARIES - Boost component libraries to be linked +# Boost__FOUND - True if component was found ( is upper-case) +# Boost__LIBRARY - Libraries to link for component (may include +# target_link_libraries debug/optimized keywords) +# Boost_VERSION - BOOST_VERSION value from boost/version.hpp +# Boost_LIB_VERSION - Version string appended to library filenames +# Boost_MAJOR_VERSION - Boost major version number (X in X.y.z) +# Boost_MINOR_VERSION - Boost minor version number (Y in x.Y.z) +# Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z) +# Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows) +# - Pass to add_definitions() to have diagnostic +# information about Boost's automatic linking +# displayed during compilation +# +# This module reads hints about search locations from variables: +# BOOST_ROOT - Preferred installation prefix +# (or BOOSTROOT) +# BOOST_INCLUDEDIR - Preferred include directory e.g. /include +# BOOST_LIBRARYDIR - Preferred library directory e.g. /lib +# Boost_NO_SYSTEM_PATHS - Set to ON to disable searching in locations not +# specified by these hint variables. Default is OFF. +# Boost_ADDITIONAL_VERSIONS +# - List of Boost versions not known to this module +# (Boost install locations may contain the version) +# and saves search results persistently in CMake cache entries: +# Boost_INCLUDE_DIR - Directory containing Boost headers +# Boost_LIBRARY_DIR - Directory containing Boost libraries +# Boost__LIBRARY_DEBUG - Component library debug variant +# Boost__LIBRARY_RELEASE - Component library release variant +# Users may set the these hints or results as cache entries. Projects should +# not read these entries directly but instead use the above result variables. +# Note that some hint names start in upper-case "BOOST". One may specify +# these as environment variables if they are not specified as CMake variables +# or cache entries. +# +# This module first searches for the Boost header files using the above hint +# variables (excluding BOOST_LIBRARYDIR) and saves the result in +# Boost_INCLUDE_DIR. Then it searches for requested component libraries using +# the above hints (excluding BOOST_INCLUDEDIR and Boost_ADDITIONAL_VERSIONS), +# "lib" directories near Boost_INCLUDE_DIR, and the library name configuration +# settings below. It saves the library directory in Boost_LIBRARY_DIR and +# individual library locations in Boost__LIBRARY_DEBUG and +# Boost__LIBRARY_RELEASE. When one changes settings used by previous +# searches in the same build tree (excluding environment variables) this +# module discards previous search results affected by the changes and searches +# again. +# +# Boost libraries come in many variants encoded in their file name. Users or +# projects may tell this module which variant to find by setting variables: +# Boost_USE_MULTITHREADED - Set to OFF to use the non-multithreaded +# libraries ('mt' tag). Default is ON. +# Boost_USE_STATIC_LIBS - Set to ON to force the use of the static +# libraries. Default is OFF. +# Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use +# libraries linked statically to the C++ runtime +# ('s' tag). Default is platform dependent. +# Boost_USE_DEBUG_PYTHON - Set to ON to use libraries compiled with a +# debug Python build ('y' tag). Default is OFF. +# Boost_USE_STLPORT - Set to ON to use libraries compiled with +# STLPort ('p' tag). Default is OFF. +# Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS +# - Set to ON to use libraries compiled with +# STLPort deprecated "native iostreams" +# ('n' tag). Default is OFF. +# Boost_COMPILER - Set to the compiler-specific library suffix +# (e.g. "-gcc43"). Default is auto-computed +# for the C++ compiler in use. +# Boost_THREADAPI - Suffix for "thread" component library name, +# such as "pthread" or "win32". Names with +# and without this suffix will both be tried. +# Other variables one may set to control this module are: +# Boost_DEBUG - Set to ON to enable debug output from FindBoost. +# Please enable this before filing any bug report. +# Boost_DETAILED_FAILURE_MSG +# - Set to ON to add detailed information to the +# failure message even when the REQUIRED option +# is not given to the find_package call. +# Boost_REALPATH - Set to ON to resolve symlinks for discovered +# libraries to assist with packaging. For example, +# the "system" component library may be resolved to +# "/usr/lib/libboost_system.so.1.42.0" instead of +# "/usr/lib/libboost_system.so". This does not +# affect linking and should not be enabled unless +# the user needs this information. +# On Visual Studio and Borland compilers Boost headers request automatic +# linking to corresponding libraries. This requires matching libraries to be +# linked explicitly or available in the link library search path. In this +# case setting Boost_USE_STATIC_LIBS to OFF may not achieve dynamic linking. +# Boost automatic linking typically requests static libraries with a few +# exceptions (such as Boost.Python). Use +# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) +# to ask Boost to report information about automatic linking requests. +# +# Example to find Boost headers only: +# find_package(Boost 1.36.0) +# if(Boost_FOUND) +# include_directories(${Boost_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# endif() +# Example to find Boost headers and some libraries: +# set(Boost_USE_STATIC_LIBS ON) +# set(Boost_USE_MULTITHREADED ON) +# set(Boost_USE_STATIC_RUNTIME OFF) +# find_package(Boost 1.36.0 COMPONENTS date_time filesystem system ...) +# if(Boost_FOUND) +# include_directories(${Boost_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# target_link_libraries(foo ${Boost_LIBRARIES}) +# endif() +# +# Boost CMake ---------------------------------------------------------- +# +# If Boost was built using the boost-cmake project it provides a package +# configuration file for use with find_package's Config mode. This module +# looks for the package configuration file called BoostConfig.cmake or +# boost-config.cmake and stores the result in cache entry "Boost_DIR". If +# found, the package configuration file is loaded and this module returns with +# no further action. See documentation of the Boost CMake package +# configuration for details on what it provides. +# +# Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake. #============================================================================= -# Copyright 2006-2009 Kitware, Inc. +# Copyright 2006-2012 Kitware, Inc. # Copyright 2006-2008 Andreas Schneider # Copyright 2007 Wengo # Copyright 2007 Mike Jackson @@ -282,6 +175,7 @@ if (NOT Boost_NO_BOOST_CMAKE) # Note that args are passed in the Boost_FIND_xxxxx variables, so there is no # need to delegate them to this find_package call. find_package(Boost QUIET NO_MODULE) + mark_as_advanced(Boost_DIR) # If we found boost-cmake, then we're done. Print out what we found. # Otherwise let the rest of the module try to find it. @@ -349,28 +243,53 @@ macro(_Boost_ADJUST_LIB_VARS basename) endif() if(Boost_${basename}_LIBRARY) - set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library") - - # Remove superfluous "debug" / "optimized" keywords from - # Boost_LIBRARY_DIRS - foreach(_boost_my_lib ${Boost_${basename}_LIBRARY}) - get_filename_component(_boost_my_lib_path "${_boost_my_lib}" PATH) - list(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path}) - endforeach() - list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS) - - set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory") - set(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found") - endif(Boost_${basename}_LIBRARY) + set(Boost_${basename}_FOUND ON) + endif() - endif(Boost_INCLUDE_DIR ) + endif() # Make variables changeble to the advanced user mark_as_advanced( - Boost_${basename}_LIBRARY Boost_${basename}_LIBRARY_RELEASE Boost_${basename}_LIBRARY_DEBUG ) -endmacro(_Boost_ADJUST_LIB_VARS) +endmacro() + +macro(_Boost_CHANGE_DETECT changed_var) + set(${changed_var} 0) + foreach(v ${ARGN}) + if(DEFINED _Boost_COMPONENTS_SEARCHED) + if(${v}) + if(_${v}_LAST) + string(COMPARE NOTEQUAL "${${v}}" "${_${v}_LAST}" _${v}_CHANGED) + else() + set(_${v}_CHANGED 1) + endif() + elseif(_${v}_LAST) + set(_${v}_CHANGED 1) + endif() + if(_${v}_CHANGED) + set(${changed_var} 1) + endif() + else() + set(_${v}_CHANGED 0) + endif() + endforeach() +endmacro() + +macro(_Boost_FIND_LIBRARY var) + find_library(${var} ${ARGN}) + + # If we found the first library save Boost_LIBRARY_DIR. + if(${var} AND NOT Boost_LIBRARY_DIR) + get_filename_component(_dir "${${var}}" PATH) + set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE) + endif() + + # If Boost_LIBRARY_DIR is known then search only there. + if(Boost_LIBRARY_DIR) + set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH) + endif() +endmacro() #------------------------------------------------------------------------------- @@ -390,17 +309,6 @@ function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION) set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE) endfunction() -# -# A convenience function for marking desired components -# as found or not -# -function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no) - foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - string(TOUPPER ${COMPONENT} UPPERCOMPONENT) - set(Boost_${UPPERCOMPONENT}_FOUND ${_yes_or_no} CACHE INTERNAL "Whether the Boost ${COMPONENT} library found" FORCE) - endforeach() -endfunction() - # # Take a list of libraries with "thread" in it # and prepend duplicates with "thread_${Boost_THREADAPI}" @@ -479,21 +387,21 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) # In Boost 1.36.0 and newer, the mangled compiler name used # on Mac OS X/Darwin is "xgcc". set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}") - else(${Boost_MINOR_VERSION} GREATER 35) + else() # In Boost <= 1.35.0, there is no mangled compiler name for # the Mac OS X/Darwin version of GCC. set(_boost_COMPILER "") - endif(${Boost_MINOR_VERSION} GREATER 35) - else(Boost_MINOR_VERSION) + endif() + else() # We don't know the Boost version, so assume it's # pre-1.36.0. set(_boost_COMPILER "") - endif(Boost_MINOR_VERSION) + endif() else() set(_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}") endif() endif() - endif (CMAKE_COMPILER_IS_GNUCXX) + endif () else() # TODO at least Boost_DEBUG here? set(_boost_COMPILER "") @@ -525,7 +433,7 @@ if(Boost_FIND_VERSION_EXACT) set(_boost_TEST_VERSIONS "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}" "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") -else(Boost_FIND_VERSION_EXACT) +else() # The user has not requested an exact version. Among known # versions, find those that are acceptable to the user request. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} @@ -549,663 +457,691 @@ else(Boost_FIND_VERSION_EXACT) # the patch level dropped. list(APPEND _boost_TEST_VERSIONS "${version}") endif() - endforeach(version) - else(Boost_FIND_VERSION) + endforeach() + else() # Any version is acceptable. set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}") - endif(Boost_FIND_VERSION) -endif(Boost_FIND_VERSION_EXACT) + endif() +endif() # The reason that we failed to find Boost. This will be set to a # user-friendly message when we fail to find some necessary piece of # Boost. set(Boost_ERROR_REASON) - if(Boost_DEBUG) - # Output some of their choices - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}") - endif() +if(Boost_DEBUG) + # Output some of their choices + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}") +endif() - if(WIN32) - # In windows, automatic linking is performed, so you do not have - # to specify the libraries. If you are linking to a dynamic - # runtime, then you can choose to link to either a static or a - # dynamic Boost library, the default is to do a static link. You - # can alter this for a specific library "whatever" by defining - # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be - # linked dynamically. Alternatively you can force all Boost - # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. - - # This feature can be disabled for Boost library "whatever" by - # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining - # BOOST_ALL_NO_LIB. - - # If you want to observe which libraries are being linked against - # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking - # code to emit a #pragma message each time a library is selected - # for linking. - set(Boost_LIB_DIAGNOSTIC_DEFINITIONS - "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define") - endif(WIN32) - - set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM - C:/boost/include - C:/boost - "$ENV{ProgramFiles}/boost/include" - "$ENV{ProgramFiles}/boost" - /sw/local/include - ) +if(WIN32) + # In windows, automatic linking is performed, so you do not have + # to specify the libraries. If you are linking to a dynamic + # runtime, then you can choose to link to either a static or a + # dynamic Boost library, the default is to do a static link. You + # can alter this for a specific library "whatever" by defining + # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be + # linked dynamically. Alternatively you can force all Boost + # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. + + # This feature can be disabled for Boost library "whatever" by + # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining + # BOOST_ALL_NO_LIB. + + # If you want to observe which libraries are being linked against + # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking + # code to emit a #pragma message each time a library is selected + # for linking. + set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC") +endif() - _Boost_CHECK_SPELLING(Boost_ROOT) - _Boost_CHECK_SPELLING(Boost_LIBRARYDIR) - _Boost_CHECK_SPELLING(Boost_INCLUDEDIR) +_Boost_CHECK_SPELLING(Boost_ROOT) +_Boost_CHECK_SPELLING(Boost_LIBRARYDIR) +_Boost_CHECK_SPELLING(Boost_INCLUDEDIR) - # If BOOST_ROOT was defined in the environment, use it. - if (NOT BOOST_ROOT AND NOT $ENV{Boost_DIR} STREQUAL "") - set(BOOST_ROOT $ENV{Boost_DIR}) +# Collect environment variable inputs as hints. Do not consider changes. +foreach(v BOOSTROOT BOOST_ROOT BOOST_INCLUDEDIR BOOST_LIBRARYDIR) + set(_env $ENV{${v}}) + if(_env) + file(TO_CMAKE_PATH "${_env}" _ENV_${v}) + else() + set(_ENV_${v} "") endif() +endforeach() +if(NOT _ENV_BOOST_ROOT AND _ENV_BOOSTROOT) + set(_ENV_BOOST_ROOT "${_ENV_BOOSTROOT}") +endif() - # If BOOST_ROOT was defined in the environment, use it. - if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "") - set(BOOST_ROOT $ENV{BOOST_ROOT}) - endif() +# Collect inputs and cached results. Detect changes since the last run. +if(NOT BOOST_ROOT AND BOOSTROOT) + set(BOOST_ROOT "${BOOSTROOT}") +endif() +set(_Boost_VARS_DIR + BOOST_ROOT + Boost_NO_SYSTEM_PATHS + ) - # If BOOSTROOT was defined in the environment, use it. - if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "") - set(BOOST_ROOT $ENV{BOOSTROOT}) - endif() +if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Declared as CMake or Environmental Variables:") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_ROOT = ${BOOST_ROOT}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") +endif() - # If BOOST_INCLUDEDIR was defined in the environment, use it. - if( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) - set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR}) - endif() +# ------------------------------------------------------------------------ +# Search for Boost include DIR +# ------------------------------------------------------------------------ - # If BOOST_LIBRARYDIR was defined in the environment, use it. - if( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) - set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR}) - endif() +set(_Boost_VARS_INC BOOST_INCLUDEDIR Boost_INCLUDE_DIR Boost_ADDITIONAL_VERSIONS) +_Boost_CHANGE_DETECT(_Boost_CHANGE_INCDIR ${_Boost_VARS_DIR} ${_Boost_VARS_INC}) +# Clear Boost_INCLUDE_DIR if it did not change but other input affecting the +# location did. We will find a new one based on the new inputs. +if(_Boost_CHANGE_INCDIR AND NOT _Boost_INCLUDE_DIR_CHANGED) + unset(Boost_INCLUDE_DIR CACHE) +endif() - if( BOOST_ROOT ) - file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT) +if(NOT Boost_INCLUDE_DIR) + set(_boost_INCLUDE_SEARCH_DIRS "") + if(BOOST_INCLUDEDIR) + list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR}) + elseif(_ENV_BOOST_INCLUDEDIR) + list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_INCLUDEDIR}) endif() - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Declared as CMake or Environmental Variables:") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " BOOST_ROOT = ${BOOST_ROOT}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") + if( BOOST_ROOT ) + list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT}) + elseif( _ENV_BOOST_ROOT ) + list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_ROOT}/include ${_ENV_BOOST_ROOT}) endif() if( Boost_NO_SYSTEM_PATHS) - set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH) + list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH) else() - set(_boost_INCLUDE_SEARCH_DIRS ${_boost_INCLUDE_SEARCH_DIRS_SYSTEM}) - endif() - - if( BOOST_ROOT ) - set(_boost_INCLUDE_SEARCH_DIRS - ${BOOST_ROOT}/include - ${BOOST_ROOT} - ${_boost_INCLUDE_SEARCH_DIRS}) + list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS + C:/boost/include + C:/boost + /sw/local/include + ) endif() - # prepend BOOST_INCLUDEDIR to search path if specified - if( BOOST_INCLUDEDIR ) - file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR) - set(_boost_INCLUDE_SEARCH_DIRS - ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS}) - endif( BOOST_INCLUDEDIR ) - - # ------------------------------------------------------------------------ - # Search for Boost include DIR - # ------------------------------------------------------------------------ # Try to find Boost by stepping backwards through the Boost versions # we know about. - if( NOT Boost_INCLUDE_DIR ) - # Build a list of path suffixes for each version. - set(_boost_PATH_SUFFIXES) - foreach(_boost_VER ${_boost_TEST_VERSIONS}) - # Add in a path suffix, based on the required version, ideally - # we could read this from version.hpp, but for that to work we'd - # need to know the include dir already - set(_boost_BOOSTIFIED_VERSION) - - # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 - if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") - string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" - _boost_BOOSTIFIED_VERSION ${_boost_VER}) - elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+") - string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" - _boost_BOOSTIFIED_VERSION ${_boost_VER}) - endif() - - list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}") - list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}") - - endforeach(_boost_VER) - - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Include debugging info:") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}") + # Build a list of path suffixes for each version. + set(_boost_PATH_SUFFIXES) + foreach(_boost_VER ${_boost_TEST_VERSIONS}) + # Add in a path suffix, based on the required version, ideally + # we could read this from version.hpp, but for that to work we'd + # need to know the include dir already + set(_boost_BOOSTIFIED_VERSION) + + # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 + if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") + string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" + _boost_BOOSTIFIED_VERSION ${_boost_VER}) + elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+") + string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" + _boost_BOOSTIFIED_VERSION ${_boost_VER}) endif() - # Look for a standard boost header file. - find_path(Boost_INCLUDE_DIR - NAMES boost/config.hpp - HINTS ${_boost_INCLUDE_SEARCH_DIRS} - PATH_SUFFIXES ${_boost_PATH_SUFFIXES} - ${_boost_FIND_OPTIONS} + list(APPEND _boost_PATH_SUFFIXES + "boost-${_boost_BOOSTIFIED_VERSION}" + "boost_${_boost_BOOSTIFIED_VERSION}" + "boost/boost-${_boost_BOOSTIFIED_VERSION}" + "boost/boost_${_boost_BOOSTIFIED_VERSION}" ) - endif( NOT Boost_INCLUDE_DIR ) - - # ------------------------------------------------------------------------ - # Extract version information from version.hpp - # ------------------------------------------------------------------------ - - if(Boost_INCLUDE_DIR) - # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp - # Read the whole file: - # - set(BOOST_VERSION 0) - set(BOOST_LIB_VERSION "") - file(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS) - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") - endif() - - string(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}") - string(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}") - set(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries") - set(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries") + endforeach() - if(NOT "${Boost_VERSION}" STREQUAL "0") - math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") - math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") - math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Include debugging info:") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}") + endif() - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") - endif(NOT "${Boost_VERSION}" STREQUAL "0") - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "version.hpp reveals boost " - "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") - endif() - else(Boost_INCLUDE_DIR) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") - endif(Boost_INCLUDE_DIR) + # Look for a standard boost header file. + find_path(Boost_INCLUDE_DIR + NAMES boost/config.hpp + HINTS ${_boost_INCLUDE_SEARCH_DIRS} + PATH_SUFFIXES ${_boost_PATH_SUFFIXES} + ) +endif() - # ------------------------------------------------------------------------ - # Suffix initialization and compiler suffix detection. - # ------------------------------------------------------------------------ +# ------------------------------------------------------------------------ +# Extract version information from version.hpp +# ------------------------------------------------------------------------ - # Setting some more suffixes for the library - set(Boost_LIB_PREFIX "") - if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) - set(Boost_LIB_PREFIX "lib") +# Set Boost_FOUND based only on header location and version. +# It will be updated below for component libraries. +if(Boost_INCLUDE_DIR) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") endif() - if (Boost_COMPILER) - set(_boost_COMPILER ${Boost_COMPILER}) - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "using user-specified Boost_COMPILER = ${_boost_COMPILER}") + # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp + set(Boost_VERSION 0) + set(Boost_LIB_VERSION "") + file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ") + set(_Boost_VERSION_REGEX "([0-9]+)") + set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"") + foreach(v VERSION LIB_VERSION) + if("${_boost_VERSION_HPP_CONTENTS}" MATCHES ".*#define BOOST_${v} ${_Boost_${v}_REGEX}.*") + set(Boost_${v} "${CMAKE_MATCH_1}") endif() - else() - # Attempt to guess the compiler suffix - # NOTE: this is not perfect yet, if you experience any issues - # please report them and use the Boost_COMPILER variable - # to work around the problems. - _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER) - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "guessed _boost_COMPILER = ${_boost_COMPILER}") - endif() - endif() + endforeach() + unset(_boost_VERSION_HPP_CONTENTS) - set (_boost_MULTITHREADED "-mt") - if( NOT Boost_USE_MULTITHREADED ) - set (_boost_MULTITHREADED "") - endif() + math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") + math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") + math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") + + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_MULTITHREADED = ${_boost_MULTITHREADED}") + "version.hpp reveals boost " + "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") endif() - #====================== - # Systematically build up the Boost ABI tag - # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming - set( _boost_RELEASE_ABI_TAG "-") - set( _boost_DEBUG_ABI_TAG "-") - # Key Use this library when: - # s linking statically to the C++ standard library and - # compiler runtime support libraries. - if(Boost_USE_STATIC_RUNTIME) - set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s") - set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s") - endif() - # g using debug versions of the standard and runtime - # support libraries - if(WIN32) - if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" - OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") - set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g") + if(Boost_FIND_VERSION) + # Set Boost_FOUND based on requested version. + set(_Boost_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") + if("${_Boost_VERSION}" VERSION_LESS "${Boost_FIND_VERSION}") + set(Boost_FOUND 0) + set(_Boost_VERSION_AGE "old") + elseif(Boost_FIND_VERSION_EXACT AND + NOT "${_Boost_VERSION}" VERSION_EQUAL "${Boost_FIND_VERSION}") + set(Boost_FOUND 0) + set(_Boost_VERSION_AGE "new") + else() + set(Boost_FOUND 1) endif() + if(NOT Boost_FOUND) + # State that we found a version of Boost that is too new or too old. + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") + if (Boost_FIND_VERSION_PATCH) + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}") + endif () + if (NOT Boost_FIND_VERSION_EXACT) + set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)") + endif () + set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.") + endif () + else() + # Caller will accept any Boost version. + set(Boost_FOUND 1) endif() - # y using special debug build of python - if(Boost_USE_DEBUG_PYTHON) - set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y") - endif() - # d using a debug version of your code - set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d") - # p using the STLport standard library rather than the - # default one supplied with your compiler - if(Boost_USE_STLPORT) - set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p") - set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p") - endif() - # n using the STLport deprecated "native iostreams" feature - if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS) - set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n") - set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n") - endif() +else() + set(Boost_FOUND 0) + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") +endif() + +# ------------------------------------------------------------------------ +# Suffix initialization and compiler suffix detection. +# ------------------------------------------------------------------------ + +set(_Boost_VARS_NAME + Boost_COMPILER + Boost_THREADAPI + Boost_USE_DEBUG_PYTHON + Boost_USE_MULTITHREADED + Boost_USE_STATIC_LIBS + Boost_USE_STATIC_RUNTIME + Boost_USE_STLPORT + Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS + ) +_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME}) +# Setting some more suffixes for the library +set(Boost_LIB_PREFIX "") +if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) + set(Boost_LIB_PREFIX "lib") +endif() + +if (Boost_COMPILER) + set(_boost_COMPILER ${Boost_COMPILER}) if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}") + "using user-specified Boost_COMPILER = ${_boost_COMPILER}") + endif() +else() + # Attempt to guess the compiler suffix + # NOTE: this is not perfect yet, if you experience any issues + # please report them and use the Boost_COMPILER variable + # to work around the problems. + _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER) + if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}") + "guessed _boost_COMPILER = ${_boost_COMPILER}") endif() +endif() - # ------------------------------------------------------------------------ - # Begin finding boost libraries - # ------------------------------------------------------------------------ +set (_boost_MULTITHREADED "-mt") +if( NOT Boost_USE_MULTITHREADED ) + set (_boost_MULTITHREADED "") +endif() +if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_MULTITHREADED = ${_boost_MULTITHREADED}") +endif() + +#====================== +# Systematically build up the Boost ABI tag +# http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming +set( _boost_RELEASE_ABI_TAG "-") +set( _boost_DEBUG_ABI_TAG "-") +# Key Use this library when: +# s linking statically to the C++ standard library and +# compiler runtime support libraries. +if(Boost_USE_STATIC_RUNTIME) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s") +endif() +# g using debug versions of the standard and runtime +# support libraries +if(WIN32) + if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" + OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") + set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g") + endif() +endif() +# y using special debug build of python +if(Boost_USE_DEBUG_PYTHON) + set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y") +endif() +# d using a debug version of your code +set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d") +# p using the STLport standard library rather than the +# default one supplied with your compiler +if(Boost_USE_STLPORT) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p") +endif() +# n using the STLport deprecated "native iostreams" feature +if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n") +endif() + +if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}") +endif() + +# ------------------------------------------------------------------------ +# Begin finding boost libraries +# ------------------------------------------------------------------------ +set(_Boost_VARS_LIB BOOST_LIBRARYDIR Boost_LIBRARY_DIR) +_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR ${_Boost_VARS_DIR} ${_Boost_VARS_LIB} Boost_INCLUDE_DIR) +# Clear Boost_LIBRARY_DIR if it did not change but other input affecting the +# location did. We will find a new one based on the new inputs. +if(_Boost_CHANGE_LIBDIR AND NOT _Boost_LIBRARY_DIR_CHANGED) + unset(Boost_LIBRARY_DIR CACHE) +endif() + +if(Boost_LIBRARY_DIR) + set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH) +else() + set(_boost_LIBRARY_SEARCH_DIRS "") + if(BOOST_LIBRARYDIR) + list(APPEND _boost_LIBRARY_SEARCH_DIRS ${BOOST_LIBRARYDIR}) + elseif(_ENV_BOOST_LIBRARYDIR) + list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_ENV_BOOST_LIBRARYDIR}) + endif() if(BOOST_ROOT) - set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS - ${BOOST_ROOT}/lib - ${BOOST_ROOT}/stage/lib) + list(APPEND _boost_LIBRARY_SEARCH_DIRS ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib) + elseif(_ENV_BOOST_ROOT) + list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib) endif() - set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS - ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS} + + list(APPEND _boost_LIBRARY_SEARCH_DIRS ${Boost_INCLUDE_DIR}/lib ${Boost_INCLUDE_DIR}/../lib ${Boost_INCLUDE_DIR}/stage/lib - ) - set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM - C:/boost/lib - C:/boost - "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib" - "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib" - "$ENV{ProgramFiles}/boost/lib" - "$ENV{ProgramFiles}/boost" - /sw/local/lib - ) - set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}) + ) if( Boost_NO_SYSTEM_PATHS ) - set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH) + list(APPEND _boost_LIBRARY_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH) else() - list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_SYSTEM}) - endif() - - # prepend BOOST_LIBRARYDIR to search path if specified - if( BOOST_LIBRARYDIR ) - file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR) - set(_boost_LIBRARY_SEARCH_DIRS - ${BOOST_LIBRARYDIR} ${_boost_LIBRARY_SEARCH_DIRS}) + list(APPEND _boost_LIBRARY_SEARCH_DIRS PATHS + C:/boost/lib + C:/boost + /sw/local/lib + ) endif() +endif() - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}") - endif() +if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}") +endif() - # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES - if( Boost_USE_STATIC_LIBS ) - set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - if(WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else() - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) - endif() +# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES +if( Boost_USE_STATIC_LIBS ) + set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) endif() +endif() - # We want to use the tag inline below without risking double dashes - if(_boost_RELEASE_ABI_TAG) - if(${_boost_RELEASE_ABI_TAG} STREQUAL "-") - set(_boost_RELEASE_ABI_TAG "") - endif() +# We want to use the tag inline below without risking double dashes +if(_boost_RELEASE_ABI_TAG) + if(${_boost_RELEASE_ABI_TAG} STREQUAL "-") + set(_boost_RELEASE_ABI_TAG "") endif() - if(_boost_DEBUG_ABI_TAG) - if(${_boost_DEBUG_ABI_TAG} STREQUAL "-") - set(_boost_DEBUG_ABI_TAG "") - endif() +endif() +if(_boost_DEBUG_ABI_TAG) + if(${_boost_DEBUG_ABI_TAG} STREQUAL "-") + set(_boost_DEBUG_ABI_TAG "") endif() +endif() - # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled - # on WIN32 was to: - # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found) - # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found) - # We maintain this behavior since changing it could break people's builds. - # To disable the ambiguous behavior, the user need only - # set Boost_USE_STATIC_RUNTIME either ON or OFF. - set(_boost_STATIC_RUNTIME_WORKAROUND false) - if(WIN32 AND Boost_USE_STATIC_LIBS) - if(NOT DEFINED Boost_USE_STATIC_RUNTIME) - set(_boost_STATIC_RUNTIME_WORKAROUND true) - endif() +# The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled +# on WIN32 was to: +# 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found) +# 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found) +# We maintain this behavior since changing it could break people's builds. +# To disable the ambiguous behavior, the user need only +# set Boost_USE_STATIC_RUNTIME either ON or OFF. +set(_boost_STATIC_RUNTIME_WORKAROUND false) +if(WIN32 AND Boost_USE_STATIC_LIBS) + if(NOT DEFINED Boost_USE_STATIC_RUNTIME) + set(_boost_STATIC_RUNTIME_WORKAROUND true) endif() +endif() - # On versions < 1.35, remove the System library from the considered list - # since it wasn't added until 1.35. - if(Boost_VERSION AND Boost_FIND_COMPONENTS) - if(Boost_VERSION LESS 103500) - list(REMOVE_ITEM Boost_FIND_COMPONENTS system) - endif() - endif() +# On versions < 1.35, remove the System library from the considered list +# since it wasn't added until 1.35. +if(Boost_VERSION AND Boost_FIND_COMPONENTS) + if(Boost_VERSION LESS 103500) + list(REMOVE_ITEM Boost_FIND_COMPONENTS system) + endif() +endif() - foreach(COMPONENT ${Boost_FIND_COMPONENTS}) +# If the user changed any of our control inputs flush previous results. +if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME) + foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED}) string(TOUPPER ${COMPONENT} UPPERCOMPONENT) - set( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" ) - set( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" ) - set( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND") - - set( _boost_docstring_release "Boost ${COMPONENT} library (release)") - set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)") - - # - # Find RELEASE libraries - # - set(_boost_RELEASE_NAMES - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT} ) - if(_boost_STATIC_RUNTIME_WORKAROUND) - set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") - list(APPEND _boost_RELEASE_NAMES - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) - endif() - if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") - _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES}) - endif() - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") - endif() - find_library(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE - NAMES ${_boost_RELEASE_NAMES} - HINTS ${_boost_LIBRARY_SEARCH_DIRS} - ${_boost_FIND_OPTIONS} - DOC "${_boost_docstring_release}" - ) + foreach(c DEBUG RELEASE) + set(_var Boost_${UPPERCOMPONENT}_LIBRARY_${c}) + unset(${_var} CACHE) + set(${_var} "${_var}-NOTFOUND") + endforeach() + endforeach() + set(_Boost_COMPONENTS_SEARCHED "") +endif() - # - # Find DEBUG libraries - # - set(_boost_DEBUG_NAMES - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED} - ${Boost_LIB_PREFIX}boost_${COMPONENT} ) - if(_boost_STATIC_RUNTIME_WORKAROUND) - set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") - list(APPEND _boost_DEBUG_NAMES - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) - endif() - if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") - _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES}) - endif() - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") - endif() - find_library(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG - NAMES ${_boost_DEBUG_NAMES} - HINTS ${_boost_LIBRARY_SEARCH_DIRS} - ${_boost_FIND_OPTIONS} - DOC "${_boost_docstring_debug}" +foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + + set( _boost_docstring_release "Boost ${COMPONENT} library (release)") + set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)") + + # + # Find RELEASE libraries + # + set(_boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT} ) + if(_boost_STATIC_RUNTIME_WORKAROUND) + set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") + list(APPEND _boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) + endif() + if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") + _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES}) + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") + endif() + _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE + NAMES ${_boost_RELEASE_NAMES} + HINTS ${_boost_LIBRARY_SEARCH_DIRS} + NAMES_PER_DIR + DOC "${_boost_docstring_release}" ) - if(Boost_REALPATH) - _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}") - _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" ) - endif() - - _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) - - endforeach(COMPONENT) + # + # Find DEBUG libraries + # + set(_boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED} + ${Boost_LIB_PREFIX}boost_${COMPONENT} ) + if(_boost_STATIC_RUNTIME_WORKAROUND) + set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") + list(APPEND _boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) + endif() + if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") + _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES}) + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") + endif() + _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG + NAMES ${_boost_DEBUG_NAMES} + HINTS ${_boost_LIBRARY_SEARCH_DIRS} + NAMES_PER_DIR + DOC "${_boost_docstring_debug}" + ) - # Restore the original find library ordering - if( Boost_USE_STATIC_LIBS ) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) + if(Boost_REALPATH) + _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}") + _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" ) endif() - # ------------------------------------------------------------------------ - # End finding boost libraries - # ------------------------------------------------------------------------ + _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) - # ------------------------------------------------------------------------ - # Begin long process of determining Boost_FOUND, starting with version - # number checks, followed by - # TODO: Ideally the version check logic should happen prior to searching - # for libraries... - # ------------------------------------------------------------------------ +endforeach() - set(Boost_INCLUDE_DIRS - ${Boost_INCLUDE_DIR} - ) +# Restore the original find library ordering +if( Boost_USE_STATIC_LIBS ) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) +endif() - set(Boost_FOUND FALSE) - if(Boost_INCLUDE_DIR) - set( Boost_FOUND TRUE ) +# ------------------------------------------------------------------------ +# End finding boost libraries +# ------------------------------------------------------------------------ - if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" ) - set( Boost_FOUND FALSE ) - set(_Boost_VERSION_AGE "old") - elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) - if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" ) - set( Boost_FOUND FALSE ) - set(_Boost_VERSION_AGE "old") - elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) - if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" ) - set( Boost_FOUND FALSE ) - set(_Boost_VERSION_AGE "old") - endif( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" ) - endif( Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" ) - endif( Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" ) - - if (NOT Boost_FOUND) - _Boost_MARK_COMPONENTS_FOUND(OFF) - endif() +set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) +set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR}) - if (Boost_FOUND AND Boost_FIND_VERSION_EXACT) - # If the user requested an exact version of Boost, check - # that. We already know that the Boost version we have is >= the - # requested version. - set(_Boost_VERSION_AGE "new") +# The above setting of Boost_FOUND was based only on the header files. +# Update it for the requested component libraries. +if(Boost_FOUND) + # The headers were found. Check for requested component libs. + set(_boost_CHECKED_COMPONENT FALSE) + set(_Boost_MISSING_COMPONENTS "") + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} COMPONENT) + set(_boost_CHECKED_COMPONENT TRUE) + if(NOT Boost_${COMPONENT}_FOUND) + string(TOLOWER ${COMPONENT} COMPONENT) + list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) + endif() + endforeach() - # If the user didn't specify a patchlevel, it's 0. - if (NOT Boost_FIND_VERSION_PATCH) - set(Boost_FIND_VERSION_PATCH 0) - endif (NOT Boost_FIND_VERSION_PATCH) - - # We'll set Boost_FOUND true again if we have an exact version match. - set(Boost_FOUND FALSE) - _Boost_MARK_COMPONENTS_FOUND(OFF) - if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) - if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) - if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" ) - set( Boost_FOUND TRUE ) - _Boost_MARK_COMPONENTS_FOUND(ON) - endif(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" ) - endif( Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) - endif( Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) - endif (Boost_FOUND AND Boost_FIND_VERSION_EXACT) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}") + endif() - if(NOT Boost_FOUND) - # State that we found a version of Boost that is too new or too old. + if (_Boost_MISSING_COMPONENTS) + set(Boost_FOUND 0) + # We were unable to find some libraries, so generate a sensible + # error message that lists the libraries we were unable to find. + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n") + foreach(COMPONENT ${_Boost_MISSING_COMPONENTS}) set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") - if (Boost_FIND_VERSION_PATCH) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}") - endif (Boost_FIND_VERSION_PATCH) - if (NOT Boost_FIND_VERSION_EXACT) - set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)") - endif (NOT Boost_FIND_VERSION_EXACT) - set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.") - endif (NOT Boost_FOUND) - - # Always check for missing components - set(_boost_CHECKED_COMPONENT FALSE) - set(_Boost_MISSING_COMPONENTS "") - foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - string(TOUPPER ${COMPONENT} COMPONENT) - set(_boost_CHECKED_COMPONENT TRUE) - if(NOT Boost_${COMPONENT}_FOUND) - string(TOLOWER ${COMPONENT} COMPONENT) - list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) - set( Boost_FOUND FALSE) - endif() - endforeach(COMPONENT) - - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}") - endif() + "${Boost_ERROR_REASON} boost_${COMPONENT}\n") + endforeach() - if (_Boost_MISSING_COMPONENTS) - # We were unable to find some libraries, so generate a sensible - # error message that lists the libraries we were unable to find. + list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED) + list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS) + if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n") - foreach(COMPONENT ${_Boost_MISSING_COMPONENTS}) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON} boost_${COMPONENT}\n") - endforeach(COMPONENT) - - list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED) - list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS) - if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") - else (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") - endif (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) - endif (_Boost_MISSING_COMPONENTS) + "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + else () + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + endif () + endif () - if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) - # Compatibility Code for backwards compatibility with CMake - # 2.4's FindBoost module. + if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) + # Compatibility Code for backwards compatibility with CMake + # 2.4's FindBoost module. - # Look for the boost library path. - # Note that the user may not have installed any libraries - # so it is quite possible the Boost_LIBRARY_DIRS may not exist. - set(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) + # Look for the boost library path. + # Note that the user may not have installed any libraries + # so it is quite possible the Boost_LIBRARY_DIRS may not exist. + set(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) - if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") - get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) - endif() + if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") + get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) + endif() - if("${_boost_LIB_DIR}" MATCHES "/include$") - # Strip off the trailing "/include" in the path. - get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) - endif() + if("${_boost_LIB_DIR}" MATCHES "/include$") + # Strip off the trailing "/include" in the path. + get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) + endif() - if(EXISTS "${_boost_LIB_DIR}/lib") - set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib) + if(EXISTS "${_boost_LIB_DIR}/lib") + set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib) + else() + if(EXISTS "${_boost_LIB_DIR}/stage/lib") + set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib) else() - if(EXISTS "${_boost_LIB_DIR}/stage/lib") - set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib) - else() - set(_boost_LIB_DIR "") - endif() - endif() - - if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") - set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory") + set(_boost_LIB_DIR "") endif() + endif() - endif( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) + if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") + set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR}) + endif() - else(Boost_INCLUDE_DIR) - set( Boost_FOUND FALSE) - endif(Boost_INCLUDE_DIR) + endif() +else() + # Boost headers were not found so no components were found. + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + set(Boost_${UPPERCOMPONENT}_FOUND 0) + endforeach() +endif() - # ------------------------------------------------------------------------ - # Notification to end user about what was found - # ------------------------------------------------------------------------ +# ------------------------------------------------------------------------ +# Notification to end user about what was found +# ------------------------------------------------------------------------ - if(Boost_FOUND) +set(Boost_LIBRARIES "") +if(Boost_FOUND) + if(NOT Boost_FIND_QUIETLY) + message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") + if(Boost_FIND_COMPONENTS) + message(STATUS "Found the following Boost libraries:") + endif() + endif() + foreach( COMPONENT ${Boost_FIND_COMPONENTS} ) + string( TOUPPER ${COMPONENT} UPPERCOMPONENT ) + if( Boost_${UPPERCOMPONENT}_FOUND ) if(NOT Boost_FIND_QUIETLY) - message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") - if(Boost_FIND_COMPONENTS) - message(STATUS "Found the following Boost libraries:") - endif() - endif(NOT Boost_FIND_QUIETLY) - foreach( COMPONENT ${Boost_FIND_COMPONENTS} ) - string( TOUPPER ${COMPONENT} UPPERCOMPONENT ) - if( Boost_${UPPERCOMPONENT}_FOUND ) - if(NOT Boost_FIND_QUIETLY) - message (STATUS " ${COMPONENT}") - endif(NOT Boost_FIND_QUIETLY) - set(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY}) - endif( Boost_${UPPERCOMPONENT}_FOUND ) - endforeach(COMPONENT) + message (STATUS " ${COMPONENT}") + endif() + list(APPEND Boost_LIBRARIES ${Boost_${UPPERCOMPONENT}_LIBRARY}) + endif() + endforeach() +else() + if(Boost_FIND_REQUIRED) + message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}") else() - if(Boost_FIND_REQUIRED) - message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}") - else() - if(NOT Boost_FIND_QUIETLY) - # we opt not to automatically output Boost_ERROR_REASON here as - # it could be quite lengthy and somewhat imposing in its requests - # Since Boost is not always a required dependency we'll leave this - # up to the end-user. - if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG) - message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}") - else() - message(STATUS "Could NOT find Boost") - endif() + if(NOT Boost_FIND_QUIETLY) + # we opt not to automatically output Boost_ERROR_REASON here as + # it could be quite lengthy and somewhat imposing in its requests + # Since Boost is not always a required dependency we'll leave this + # up to the end-user. + if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG) + message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}") + else() + message(STATUS "Could NOT find Boost") + endif() + endif() + endif() +endif() + +# Configure display of cache entries in GUI. +foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB}) + get_property(_type CACHE ${v} PROPERTY TYPE) + if(_type) + set_property(CACHE ${v} PROPERTY ADVANCED 1) + if("x${_type}" STREQUAL "xUNINITIALIZED") + if("x${v}" STREQUAL "xBoost_ADDITIONAL_VERSIONS") + set_property(CACHE ${v} PROPERTY TYPE STRING) + else() + set_property(CACHE ${v} PROPERTY TYPE PATH) endif() - endif(Boost_FIND_REQUIRED) + endif() endif() +endforeach() - # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view - mark_as_advanced(Boost_INCLUDE_DIR - Boost_INCLUDE_DIRS - Boost_LIBRARY_DIRS - ) +# Record last used values of input variables so we can +# detect on the next run if the user changed them. +foreach(v + ${_Boost_VARS_INC} ${_Boost_VARS_LIB} + ${_Boost_VARS_DIR} ${_Boost_VARS_NAME} + ) + if(DEFINED ${v}) + set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.") + else() + unset(_${v}_LAST CACHE) + endif() +endforeach() + +# Maintain a persistent list of components requested anywhere since +# the last flush. +set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}") +list(APPEND _Boost_COMPONENTS_SEARCHED ${Boost_FIND_COMPONENTS}) +list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED) +list(SORT _Boost_COMPONENTS_SEARCHED) +set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}" + CACHE INTERNAL "Components requested for this build tree.") diff --git a/Modules/FindBullet.cmake b/Modules/FindBullet.cmake index c96755fa4..1a27fc32b 100644 --- a/Modules/FindBullet.cmake +++ b/Modules/FindBullet.cmake @@ -29,10 +29,12 @@ macro(_FIND_BULLET_LIBRARY _var) find_library(${_var} - NAMES + NAMES ${ARGN} HINTS ${BULLET_ROOT} + ${BULLET_ROOT}/lib/Release + ${BULLET_ROOT}/lib/Debug ${BULLET_ROOT}/out/release8/libs ${BULLET_ROOT}/out/debug8/libs PATH_SUFFIXES lib @@ -68,7 +70,7 @@ _FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY BulletSoftBody) _FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY_DEBUG BulletSoftBody_Debug BulletSoftBody_d) -# handle the QUIETLY and REQUIRED arguments and set BULLET_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set BULLET_FOUND to TRUE if # all listed variables are TRUE include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Bullet DEFAULT_MSG diff --git a/Modules/FindCABLE.cmake b/Modules/FindCABLE.cmake index 678fb07ca..3e2d5d3bb 100644 --- a/Modules/FindCABLE.cmake +++ b/Modules/FindCABLE.cmake @@ -23,12 +23,12 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF(NOT CABLE) - FIND_PATH(CABLE_BUILD_DIR cableVersion.h) -ENDIF(NOT CABLE) +if(NOT CABLE) + find_path(CABLE_BUILD_DIR cableVersion.h) +endif() -IF(CABLE_BUILD_DIR) - LOAD_CACHE(${CABLE_BUILD_DIR} +if(CABLE_BUILD_DIR) + load_cache(${CABLE_BUILD_DIR} EXCLUDE BUILD_SHARED_LIBS LIBRARY_OUTPUT_PATH @@ -39,43 +39,43 @@ IF(CABLE_BUILD_DIR) CABLE_LIBRARY_PATH CABLE_EXECUTABLE_PATH) - IF(CABLE_LIBRARY_PATH) - FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS + if(CABLE_LIBRARY_PATH) + find_library(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS ${CABLE_LIBRARY_PATH} ${CABLE_LIBRARY_PATH}/*) - ELSE(CABLE_LIBRARY_PATH) - FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS + else() + find_library(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS ${CABLE_BINARY_DIR}/CableTclFacility ${CABLE_BINARY_DIR}/CableTclFacility/*) - ENDIF(CABLE_LIBRARY_PATH) + endif() - IF(CABLE_EXECUTABLE_PATH) - FIND_PROGRAM(CABLE NAMES cable PATHS + if(CABLE_EXECUTABLE_PATH) + find_program(CABLE NAMES cable PATHS ${CABLE_EXECUTABLE_PATH} ${CABLE_EXECUTABLE_PATH}/*) - ELSE(CABLE_EXECUTABLE_PATH) - FIND_PROGRAM(CABLE NAMES cable PATHS + else() + find_program(CABLE NAMES cable PATHS ${CABLE_BINARY_DIR}/Executables ${CABLE_BINARY_DIR}/Executables/*) - ENDIF(CABLE_EXECUTABLE_PATH) + endif() - FIND_PATH(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h + find_path(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h ${CABLE_SOURCE_DIR}) -ELSE(CABLE_BUILD_DIR) +else() # Find the cable executable in the path. - FIND_PROGRAM(CABLE NAMES cable) + find_program(CABLE NAMES cable) # Get the path where the executable sits, but without the executable # name on it. - GET_FILENAME_COMPONENT(CABLE_ROOT_BIN ${CABLE} PATH) + get_filename_component(CABLE_ROOT_BIN ${CABLE} PATH) # Find the cable include directory in a path relative to the cable # executable. - FIND_PATH(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h + find_path(CABLE_INCLUDE_DIR CableTclFacility/ctCalls.h ${CABLE_ROOT_BIN}/../include/Cable) # Find the WrapTclFacility library in a path relative to the cable # executable. - FIND_LIBRARY(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS + find_library(CABLE_TCL_LIBRARY NAMES CableTclFacility PATHS ${CABLE_ROOT_BIN}/../lib/Cable) -ENDIF(CABLE_BUILD_DIR) +endif() diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 56a92c199..61d6ea771 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -68,6 +68,13 @@ # CUDA_HOST_COMPILATION_CPP (Default ON) # -- Set to OFF for C compilation of host code. # +# CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER, $(VCInstallDir)/bin for VS) +# -- Set the host compiler to be used by nvcc. Ignored if -ccbin or +# --compiler-bindir is already present in the CUDA_NVCC_FLAGS or +# CUDA_NVCC_FLAGS_ variables. For Visual Studio targets +# $(VCInstallDir)/bin is a special value that expands out to the path when +# the command is run from withing VS. +# # CUDA_NVCC_FLAGS # CUDA_NVCC_FLAGS_ # -- Additional NVCC command line arguments. NOTE: multiple arguments must be @@ -84,6 +91,13 @@ # CUDA_ADD_LIBRARY, CUDA_ADD_EXECUTABLE, or CUDA_WRAP_SRCS. Flags used for # shared library compilation are not affected by this flag. # +# CUDA_SEPARABLE_COMPILATION (Default OFF) +# -- If set this will enable separable compilation for all CUDA runtime object +# files. If used outside of CUDA_ADD_EXECUTABLE and CUDA_ADD_LIBRARY +# (e.g. calling CUDA_WRAP_SRCS directly), +# CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME and +# CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS should be called. +# # CUDA_VERBOSE_BUILD (Default OFF) # -- Set to ON to see all the commands used when building the CUDA file. When # using a Makefile generator the value defaults to VERBOSE (run make @@ -130,11 +144,36 @@ # CUDA_COMPILE_PTX( generated_files file0 file1 ... [OPTIONS ...] ) # -- Returns a list of PTX files generated from the input source files. # +# CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME( output_file_var +# cuda_target +# object_files ) +# -- Compute the name of the intermediate link file used for separable +# compilation. This file name is typically passed into +# CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS. output_file_var is produced +# based on cuda_target the list of objects files that need separable +# compilation as specified by object_files. If the object_files list is +# empty, then output_file_var will be empty. This function is called +# automatically for CUDA_ADD_LIBRARY and CUDA_ADD_EXECUTABLE. Note that +# this is a function and not a macro. +# # CUDA_INCLUDE_DIRECTORIES( path0 path1 ... ) # -- Sets the directories that should be passed to nvcc # (e.g. nvcc -Ipath0 -Ipath1 ... ). These paths usually contain other .cu # files. # +# +# CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS( output_file_var cuda_target +# nvcc_flags object_files) +# +# -- Generates the link object required by separable compilation from the given +# object files. This is called automatically for CUDA_ADD_EXECUTABLE and +# CUDA_ADD_LIBRARY, but can be called manually when using CUDA_WRAP_SRCS +# directly. When called from CUDA_ADD_LIBRARY or CUDA_ADD_EXECUTABLE the +# nvcc_flags passed in are the same as the flags passed in via the OPTIONS +# argument. The only nvcc flag added automatically is the bitness flag as +# specified by CUDA_64_BIT_DEVICE_CODE. Note that this is a function +# instead of a macro. +# # CUDA_WRAP_SRCS ( cuda_target format generated_files file0 file1 ... # [STATIC | SHARED | MODULE] [OPTIONS ...] ) # -- This is where all the magic happens. CUDA_ADD_EXECUTABLE, @@ -216,6 +255,8 @@ # CUDA_CUBLAS_LIBRARIES -- Device or emulation library for the Cuda BLAS # implementation (alterative to: # CUDA_ADD_CUBLAS_TO_TARGET macro). +# CUDA_cupti_LIBRARY -- CUDA Profiling Tools Interface library. +# Only available for CUDA version 4.0+. # CUDA_curand_LIBRARY -- CUDA Random Number Generation library. # Only available for CUDA version 3.2+. # CUDA_cusparse_LIBRARY -- CUDA Sparse Matrix library. @@ -291,7 +332,7 @@ macro(CUDA_FIND_HELPER_FILE _name _extension) endif() # Set this variable as internal, so the user isn't bugged with it. set(CUDA_${_name} ${CUDA_${_name}} CACHE INTERNAL "Location of ${_full_name}" FORCE) -endmacro(CUDA_FIND_HELPER_FILE) +endmacro() ##################################################################### ## CUDA_INCLUDE_NVCC_DEPENDENCIES @@ -339,12 +380,12 @@ macro(CUDA_INCLUDE_NVCC_DEPENDENCIES dependency_file) #message("file ${f} not found") set(CUDA_NVCC_DEPEND_REGENERATE TRUE) endif() - endforeach(f) - else(CUDA_NVCC_DEPEND) + endforeach() + else() #message("CUDA_NVCC_DEPEND false") # No dependencies, so regenerate the file. set(CUDA_NVCC_DEPEND_REGENERATE TRUE) - endif(CUDA_NVCC_DEPEND) + endif() #message("CUDA_NVCC_DEPEND_REGENERATE = ${CUDA_NVCC_DEPEND_REGENERATE}") # No incoming dependencies, so we need to generate them. Make the @@ -354,9 +395,9 @@ macro(CUDA_INCLUDE_NVCC_DEPENDENCIES dependency_file) set(CUDA_NVCC_DEPEND ${dependency_file}) #message("Generating an empty dependency_file: ${dependency_file}") file(WRITE ${dependency_file} "#FindCUDA.cmake generated file. Do not edit.\n") - endif(CUDA_NVCC_DEPEND_REGENERATE) + endif() -endmacro(CUDA_INCLUDE_NVCC_DEPENDENCIES) +endmacro() ############################################################################### ############################################################################### @@ -390,9 +431,18 @@ option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON) # Extra user settable flags set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.") +if(CMAKE_GENERATOR MATCHES "Visual Studio") + set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC") +else() + set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC") +endif() + # Propagate the host flags to the host compiler via -Xcompiler option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" ON) +# Enable CUDA_SEPARABLE_COMPILATION +option(CUDA_SEPARABLE_COMPILATION "Compile CUDA objects with separable compilation enabled. Requires CUDA 5.0+" OFF) + # Specifies whether the commands used when compiling the .cu file will be printed out. option(CUDA_VERBOSE_BUILD "Print out the commands run while compiling the CUDA source file. With the Makefile generator this defaults to VERBOSE variable specified on the command line, but can be forced on with this option." OFF) @@ -438,6 +488,7 @@ if(NOT "${CUDA_TOOLKIT_ROOT_DIR}" STREQUAL "${CUDA_TOOLKIT_ROOT_DIR_INTERNAL}") endif() unset(CUDA_VERSION CACHE) unset(CUDA_CUDA_LIBRARY CACHE) + unset(CUDA_cupti_LIBRARY CACHE) unset(CUDA_cublas_LIBRARY CACHE) unset(CUDA_cublasemu_LIBRARY CACHE) unset(CUDA_cufft_LIBRARY CACHE) @@ -482,15 +533,15 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR) string(REGEX REPLACE "[/\\\\]?bin[64]*[/\\\\]?$" "" CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR}) # We need to force this back into the cache. set(CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR} CACHE PATH "Toolkit location." FORCE) - endif(CUDA_TOOLKIT_ROOT_DIR) + endif() if (NOT EXISTS ${CUDA_TOOLKIT_ROOT_DIR}) if(CUDA_FIND_REQUIRED) message(FATAL_ERROR "Specify CUDA_TOOLKIT_ROOT_DIR") elseif(NOT CUDA_FIND_QUIETLY) message("CUDA_TOOLKIT_ROOT_DIR not found or specified") endif() - endif (NOT EXISTS ${CUDA_TOOLKIT_ROOT_DIR}) -endif (NOT CUDA_TOOLKIT_ROOT_DIR) + endif () +endif () # CUDA_NVCC_EXECUTABLE find_program(CUDA_NVCC_EXECUTABLE @@ -538,11 +589,11 @@ mark_as_advanced(CUDA_TOOLKIT_INCLUDE) set (CUDA_NVCC_INCLUDE_ARGS_USER "") set (CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE}) -macro(FIND_LIBRARY_LOCAL_FIRST _var _names _doc) +macro(cuda_find_library_local_first_with_path_ext _var _names _doc _path_ext ) if(CMAKE_SIZEOF_VOID_P EQUAL 8) # CUDA 3.2+ on Windows moved the library directories, so we need the new # and old paths. - set(_cuda_64bit_lib_dir "lib/x64" "lib64" ) + set(_cuda_64bit_lib_dir "${_path_ext}lib/x64" "${_path_ext}lib64" "${_path_ext}libx64" ) endif() # CUDA 3.2+ on Windows moved the library directories, so we need to new # (lib/Win32) and the old path (lib). @@ -551,7 +602,7 @@ macro(FIND_LIBRARY_LOCAL_FIRST _var _names _doc) PATHS "${CUDA_TOOLKIT_ROOT_DIR}" ENV CUDA_PATH ENV CUDA_LIB_PATH - PATH_SUFFIXES ${_cuda_64bit_lib_dir} "lib/Win32" "lib" + PATH_SUFFIXES ${_cuda_64bit_lib_dir} "${_path_ext}lib/Win32" "${_path_ext}lib" "${_path_ext}libWin32" DOC ${_doc} NO_DEFAULT_PATH ) @@ -559,15 +610,31 @@ macro(FIND_LIBRARY_LOCAL_FIRST _var _names _doc) find_library(${_var} NAMES ${_names} DOC ${_doc}) endmacro() +macro(cuda_find_library_local_first _var _names _doc) + cuda_find_library_local_first_with_path_ext( "${_var}" "${_names}" "${_doc}" "" ) +endmacro() + +macro(find_library_local_first _var _names _doc ) + cuda_find_library_local_first( "${_var}" "${_names}" "${_doc}" "" ) +endmacro() + + # CUDA_LIBRARIES -find_library_local_first(CUDA_CUDART_LIBRARY cudart "\"cudart\" library") +cuda_find_library_local_first(CUDA_CUDART_LIBRARY cudart "\"cudart\" library") if(CUDA_VERSION VERSION_EQUAL "3.0") # The cudartemu library only existed for the 3.0 version of CUDA. - find_library_local_first(CUDA_CUDARTEMU_LIBRARY cudartemu "\"cudartemu\" library") + cuda_find_library_local_first(CUDA_CUDARTEMU_LIBRARY cudartemu "\"cudartemu\" library") mark_as_advanced( CUDA_CUDARTEMU_LIBRARY ) endif() + +# CUPTI library showed up in cuda toolkit 4.0 +if(NOT CUDA_VERSION VERSION_LESS "4.0") + cuda_find_library_local_first_with_path_ext(CUDA_cupti_LIBRARY cupti "\"cupti\" library" "extras/CUPTI/") + mark_as_advanced(CUDA_cupti_LIBRARY) +endif() + # If we are using emulation mode and we found the cudartemu library then use # that one instead of cudart. if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY) @@ -590,12 +657,7 @@ endif() # 1.1 toolkit on linux doesn't appear to have a separate library on # some platforms. -find_library_local_first(CUDA_CUDA_LIBRARY cuda "\"cuda\" library (older versions only).") - -# Add cuda library to the link line only if it is found. -if (CUDA_CUDA_LIBRARY) - set(CUDA_LIBRARIES ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY}) -endif(CUDA_CUDA_LIBRARY) +cuda_find_library_local_first(CUDA_CUDA_LIBRARY cuda "\"cuda\" library (older versions only).") mark_as_advanced( CUDA_CUDA_LIBRARY @@ -605,9 +667,9 @@ mark_as_advanced( ####################### # Look for some of the toolkit helper libraries macro(FIND_CUDA_HELPER_LIBS _name) - find_library_local_first(CUDA_${_name}_LIBRARY ${_name} "\"${_name}\" library") + cuda_find_library_local_first(CUDA_${_name}_LIBRARY ${_name} "\"${_name}\" library") mark_as_advanced(CUDA_${_name}_LIBRARY) -endmacro(FIND_CUDA_HELPER_LIBS) +endmacro() ####################### # Disable emulation for v3.1 onward @@ -650,9 +712,11 @@ endif() # Look for the SDK stuff. As of CUDA 3.0 NVSDKCUDA_ROOT has been replaced with # NVSDKCOMPUTE_ROOT with the old CUDA C contents moved into the C subdirectory find_path(CUDA_SDK_ROOT_DIR common/inc/cutil.h + HINTS "$ENV{NVSDKCOMPUTE_ROOT}/C" - "$ENV{NVSDKCUDA_ROOT}" + ENV NVSDKCUDA_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Installed Products\\NVIDIA SDK 10\\Compute;InstallDir]" + PATHS "/Developer/GPU\ Computing/C" ) @@ -691,9 +755,9 @@ set(CUDA_SDK_SEARCH_PATH # if(CMAKE_SIZEOF_VOID_P EQUAL 8) # set(cuda_cutil_name cutil64) -# else(CMAKE_SIZEOF_VOID_P EQUAL 8) +# else() # set(cuda_cutil_name cutil32) -# endif(CMAKE_SIZEOF_VOID_P EQUAL 8) +# endif() # find_library(CUDA_CUT_LIBRARY # NAMES cutil ${cuda_cutil_name} @@ -743,8 +807,8 @@ find_package_handle_standard_args(CUDA macro(CUDA_INCLUDE_DIRECTORIES) foreach(dir ${ARGN}) list(APPEND CUDA_NVCC_INCLUDE_ARGS_USER -I${dir}) - endforeach(dir ${ARGN}) -endmacro(CUDA_INCLUDE_DIRECTORIES) + endforeach() +endmacro() ############################################################################## @@ -855,7 +919,7 @@ function(CUDA_COMPUTE_BUILD_PATH path build_path) file(TO_CMAKE_PATH "${path}" bpath) if (IS_ABSOLUTE "${bpath}") # Absolute paths are generally unnessary, especially if something like - # FILE(GLOB_RECURSE) is used to pick up the files. + # file(GLOB_RECURSE) is used to pick up the files. file(RELATIVE_PATH bpath "${CMAKE_CURRENT_SOURCE_DIR}" "${bpath}") endif() @@ -898,12 +962,9 @@ endfunction() macro(CUDA_WRAP_SRCS cuda_target format generated_files) - if( ${format} MATCHES "PTX" ) - set( compile_to_ptx ON ) - elseif( ${format} MATCHES "OBJ") - set( compile_to_ptx OFF ) - else() - message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS: '${format}'. Use OBJ or PTX.") + # If CMake doesn't support separable compilation, complain + if(CUDA_SEPARABLE_COMPILATION AND CMAKE_VERSION VERSION_LESS "2.8.10.1") + message(SEND_ERROR "CUDA_SEPARABLE_COMPILATION isn't supported for CMake versions less than 2.8.10.1") endif() # Set up all the command line flags here, so that they can be overridden on a per target basis. @@ -914,20 +975,20 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) if (CUDA_BUILD_EMULATION) # Emulation. set(nvcc_flags ${nvcc_flags} --device-emulation -D_DEVICEEMU -g) - else(CUDA_BUILD_EMULATION) + else() # Device mode. No flags necessary. - endif(CUDA_BUILD_EMULATION) + endif() if(CUDA_HOST_COMPILATION_CPP) set(CUDA_C_OR_CXX CXX) - else(CUDA_HOST_COMPILATION_CPP) + else() if(CUDA_VERSION VERSION_LESS "3.0") set(nvcc_flags ${nvcc_flags} --host-compilation C) else() message(WARNING "--host-compilation flag is deprecated in CUDA version >= 3.0. Removing --host-compilation C flag" ) endif() set(CUDA_C_OR_CXX C) - endif(CUDA_HOST_COMPILATION_CPP) + endif() set(generated_extension ${CMAKE_${CUDA_C_OR_CXX}_OUTPUT_EXTENSION}) @@ -938,12 +999,13 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) endif() # This needs to be passed in at this stage, because VS needs to fill out the - # value of VCInstallDir from within VS. + # value of VCInstallDir from within VS. Note that CCBIN is only used if + # -ccbin or --compiler-bindir isn't used and CUDA_HOST_COMPILER matches + # $(VCInstallDir)/bin. if(CMAKE_GENERATOR MATCHES "Visual Studio") - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - # Add nvcc flag for 64b Windows - set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" ) - endif() + set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" ) + else() + set(ccbin_flags) endif() # Figure out which configure we will use and pass that in as an argument to @@ -1002,12 +1064,12 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) # Only add the CMAKE_{C,CXX}_FLAGS if we are propagating host flags. We # always need to set the SHARED_FLAGS, though. if(CUDA_PROPAGATE_HOST_FLAGS) - set(CUDA_HOST_FLAGS "set(CMAKE_HOST_FLAGS ${CMAKE_${CUDA_C_OR_CXX}_FLAGS} ${CUDA_HOST_SHARED_FLAGS})") + set(_cuda_host_flags "set(CMAKE_HOST_FLAGS ${CMAKE_${CUDA_C_OR_CXX}_FLAGS} ${CUDA_HOST_SHARED_FLAGS})") else() - set(CUDA_HOST_FLAGS "set(CMAKE_HOST_FLAGS ${CUDA_HOST_SHARED_FLAGS})") + set(_cuda_host_flags "set(CMAKE_HOST_FLAGS ${CUDA_HOST_SHARED_FLAGS})") endif() - set(CUDA_NVCC_FLAGS_CONFIG "# Build specific configuration flags") + set(_cuda_nvcc_flags_config "# Build specific configuration flags") # Loop over all the configuration types to generate appropriate flags for run_nvcc.cmake foreach(config ${CUDA_configuration_types}) string(TOUPPER ${config} config_upper) @@ -1016,27 +1078,31 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) if(CUDA_PROPAGATE_HOST_FLAGS) # nvcc chokes on -g3 in versions previous to 3.0, so replace it with -g - if(CMAKE_COMPILER_IS_GNUCC AND CUDA_VERSION VERSION_LESS "3.0") + set(_cuda_fix_g3 FALSE) + + if(CMAKE_COMPILER_IS_GNUCC) + if (CUDA_VERSION VERSION_LESS "3.0" OR + CUDA_VERSION VERSION_EQUAL "4.1" OR + CUDA_VERSION VERSION_EQUAL "4.2" + ) + set(_cuda_fix_g3 TRUE) + endif() + endif() + if(_cuda_fix_g3) string(REPLACE "-g3" "-g" _cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") else() set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") endif() - set(CUDA_HOST_FLAGS "${CUDA_HOST_FLAGS}\nset(CMAKE_HOST_FLAGS_${config_upper} ${_cuda_C_FLAGS})") + set(_cuda_host_flags "${_cuda_host_flags}\nset(CMAKE_HOST_FLAGS_${config_upper} ${_cuda_C_FLAGS})") endif() # Note that if we ever want CUDA_NVCC_FLAGS_ to be string (instead of a list # like it is currently), we can remove the quotes around the # ${CUDA_NVCC_FLAGS_${config_upper}} variable like the CMAKE_HOST_FLAGS_ variable. - set(CUDA_NVCC_FLAGS_CONFIG "${CUDA_NVCC_FLAGS_CONFIG}\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})") + set(_cuda_nvcc_flags_config "${_cuda_nvcc_flags_config}\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})") endforeach() - if(compile_to_ptx) - # Don't use any of the host compilation flags for PTX targets. - set(CUDA_HOST_FLAGS) - set(CUDA_NVCC_FLAGS_CONFIG) - endif() - # Get the list of definitions from the directory property get_directory_property(CUDA_NVCC_DEFINITIONS COMPILE_DEFINITIONS) if(CUDA_NVCC_DEFINITIONS) @@ -1059,6 +1125,30 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) get_source_file_property(_is_header ${file} HEADER_FILE_ONLY) if(${file} MATCHES ".*\\.cu$" AND NOT _is_header) + # Allow per source file overrides of the format. + get_source_file_property(_cuda_source_format ${file} CUDA_SOURCE_PROPERTY_FORMAT) + if(NOT _cuda_source_format) + set(_cuda_source_format ${format}) + endif() + + if( ${_cuda_source_format} MATCHES "PTX" ) + set( compile_to_ptx ON ) + elseif( ${_cuda_source_format} MATCHES "OBJ") + set( compile_to_ptx OFF ) + else() + message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS for file '${file}': '${_cuda_source_format}'. Use OBJ or PTX.") + endif() + + + if(compile_to_ptx) + # Don't use any of the host compilation flags for PTX targets. + set(CUDA_HOST_FLAGS) + set(CUDA_NVCC_FLAGS_CONFIG) + else() + set(CUDA_HOST_FLAGS ${_cuda_host_flags}) + set(CUDA_NVCC_FLAGS_CONFIG ${_cuda_nvcc_flags_config}) + endif() + # Determine output directory cuda_compute_build_path("${file}" cuda_build_path) set(cuda_compile_intermediate_directory "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${cuda_target}.dir/${cuda_build_path}") @@ -1080,11 +1170,15 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) set(generated_file_basename "${cuda_target}_generated_${basename}.ptx") set(format_flag "-ptx") file(MAKE_DIRECTORY "${cuda_compile_output_dir}") - else( compile_to_ptx ) + else() set(generated_file_path "${cuda_compile_output_dir}/${CMAKE_CFG_INTDIR}") set(generated_file_basename "${cuda_target}_generated_${basename}${generated_extension}") - set(format_flag "-c") - endif( compile_to_ptx ) + if(CUDA_SEPARABLE_COMPILATION) + set(format_flag "-dc") + else() + set(format_flag "-c") + endif() + endif() # Set all of our file names. Make sure that whatever filenames that have # generated_file_path in them get passed in through as a command line @@ -1112,23 +1206,27 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) set(source_file "${CMAKE_CURRENT_SOURCE_DIR}/${file}") endif() + if( NOT compile_to_ptx AND CUDA_SEPARABLE_COMPILATION) + list(APPEND ${cuda_target}_SEPARABLE_COMPILATION_OBJECTS "${generated_file}") + endif() + # Bring in the dependencies. Creates a variable CUDA_NVCC_DEPEND ####### cuda_include_nvcc_dependencies(${cmake_dependency_file}) # Convience string for output ########################################### if(CUDA_BUILD_EMULATION) set(cuda_build_type "Emulation") - else(CUDA_BUILD_EMULATION) + else() set(cuda_build_type "Device") - endif(CUDA_BUILD_EMULATION) + endif() # Build the NVCC made dependency file ################################### set(build_cubin OFF) if ( NOT CUDA_BUILD_EMULATION AND CUDA_BUILD_CUBIN ) if ( NOT compile_to_ptx ) set ( build_cubin ON ) - endif( NOT compile_to_ptx ) - endif( NOT CUDA_BUILD_EMULATION AND CUDA_BUILD_CUBIN ) + endif() + endif() # Configure the build script configure_file("${CUDA_run_nvcc}" "${custom_target_script}" @ONLY) @@ -1203,13 +1301,92 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) list(REMOVE_DUPLICATES CUDA_ADDITIONAL_CLEAN_FILES) set(CUDA_ADDITIONAL_CLEAN_FILES ${CUDA_ADDITIONAL_CLEAN_FILES} CACHE INTERNAL "List of intermediate files that are part of the cuda dependency scanning.") - endif(${file} MATCHES ".*\\.cu$" AND NOT _is_header) - endforeach(file) + endif() + endforeach() # Set the return parameter set(${generated_files} ${_cuda_wrap_generated_files}) -endmacro(CUDA_WRAP_SRCS) +endmacro() +function(_cuda_get_important_host_flags important_flags flag_string) + if(CMAKE_GENERATOR MATCHES "Visual Studio") + string(REGEX MATCHALL "/M[DT][d]?" flags ${flag_string}) + list(APPEND ${important_flags} ${flags}) + else() + string(REGEX MATCHALL "-fPIC" flags ${flag_string}) + list(APPEND ${important_flags} ${flags}) + endif() + set(${important_flags} ${${important_flags}} PARENT_SCOPE) +endfunction() + +############################################################################### +############################################################################### +# Separable Compilation Link +############################################################################### +############################################################################### + +# Compute the filename to be used by CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS +function(CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME output_file_var cuda_target object_files) + if (object_files) + set(generated_extension ${CMAKE_${CUDA_C_OR_CXX}_OUTPUT_EXTENSION}) + set(output_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${cuda_target}.dir/${CMAKE_CFG_INTDIR}/${cuda_target}_intermediate_link${generated_extension}") + else() + set(output_file) + endif() + + set(${output_file_var} "${output_file}" PARENT_SCOPE) +endfunction() + +# Setup the build rule for the separable compilation intermediate link file. +function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options object_files) + if (object_files) + + if(NOT EXISTS "${output_file}") + # Some generators (e.g. makefiles) can't proceed to the link phase if all + # input files aren't available. This guarantees the file exists, so that + # linking can begin. + execute_process(COMMAND ${CMAKE_COMMAND} -E touch "${output_file}") + endif() + + set_source_files_properties("${output_file}" + PROPERTIES + EXTERNAL_OBJECT TRUE # This is an object file not to be compiled, but only + # be linked. + GENERATED TRUE # This file is generated during the build + ) + + # For now we are ignoring all the configuration specific flags. + set(nvcc_flags) + CUDA_PARSE_NVCC_OPTIONS(nvcc_flags ${options}) + if(CUDA_64_BIT_DEVICE_CODE) + list(APPEND nvcc_flags -m64) + else() + list(APPEND nvcc_flags -m32) + endif() + # If -ccbin, --compiler-bindir has been specified, don't do anything. Otherwise add it here. + list( FIND nvcc_flags "-ccbin" ccbin_found0 ) + list( FIND nvcc_flags "--compiler-bindir" ccbin_found1 ) + if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 ) + list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"") + endif() + set(flags) + foreach(config ${CUDA_configuration_types}) + string(TOUPPER ${config} config_upper) + set(important_host_flags) + _cuda_get_important_host_flags(important_host_flags ${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}) + foreach(f ${important_host_flags}) + list(APPEND flags $<$:-Xcompiler> $<$:${f}>) + endforeach() + endforeach() + file(RELATIVE_PATH output_file_relative_path "${CMAKE_BINARY_DIR}" "${output_file}") + add_custom_command( + TARGET ${cuda_target} + PRE_LINK + COMMAND ${CMAKE_COMMAND} -E echo "Building NVCC intermediate link file ${output_file_relative_path}" + COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} -o "${output_file}" + ) + endif() +endfunction() ############################################################################### ############################################################################### @@ -1228,12 +1405,22 @@ macro(CUDA_ADD_LIBRARY cuda_target) ${_cmake_options} ${_cuda_shared_flag} OPTIONS ${_options} ) + # Compute the file name of the intermedate link file used for separable + # compilation. + CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME(link_file ${cuda_target} "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}") + # Add the library. add_library(${cuda_target} ${_cmake_options} ${_generated_files} ${_sources} + ${link_file} ) + # Add a link phase for the separable compilation if it has been enabled. If + # it has been enabled then the ${cuda_target}_SEPARABLE_COMPILATION_OBJECTS + # variable will have been defined. + CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS("${link_file}" ${cuda_target} "${_options}" "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}") + target_link_libraries(${cuda_target} ${CUDA_LIBRARIES} ) @@ -1245,7 +1432,7 @@ macro(CUDA_ADD_LIBRARY cuda_target) LINKER_LANGUAGE ${CUDA_C_OR_CXX} ) -endmacro(CUDA_ADD_LIBRARY cuda_target) +endmacro() ############################################################################### @@ -1262,12 +1449,22 @@ macro(CUDA_ADD_EXECUTABLE cuda_target) # Create custom commands and targets for each file. CUDA_WRAP_SRCS( ${cuda_target} OBJ _generated_files ${_sources} OPTIONS ${_options} ) + # Compute the file name of the intermedate link file used for separable + # compilation. + CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME(link_file ${cuda_target} "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}") + # Add the library. add_executable(${cuda_target} ${_cmake_options} ${_generated_files} ${_sources} + ${link_file} ) + # Add a link phase for the separable compilation if it has been enabled. If + # it has been enabled then the ${cuda_target}_SEPARABLE_COMPILATION_OBJECTS + # variable will have been defined. + CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS("${link_file}" ${cuda_target} "${_options}" "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}") + target_link_libraries(${cuda_target} ${CUDA_LIBRARIES} ) @@ -1279,7 +1476,7 @@ macro(CUDA_ADD_EXECUTABLE cuda_target) LINKER_LANGUAGE ${CUDA_C_OR_CXX} ) -endmacro(CUDA_ADD_EXECUTABLE cuda_target) +endmacro() ############################################################################### @@ -1297,7 +1494,7 @@ macro(CUDA_COMPILE generated_files) set( ${generated_files} ${_generated_files}) -endmacro(CUDA_COMPILE) +endmacro() ############################################################################### @@ -1315,7 +1512,7 @@ macro(CUDA_COMPILE_PTX generated_files) set( ${generated_files} ${_generated_files}) -endmacro(CUDA_COMPILE_PTX) +endmacro() ############################################################################### ############################################################################### @@ -1364,4 +1561,4 @@ macro(CUDA_BUILD_CLEAN_TARGET) # This is useful so that the files won't persist in the list after targets # have been removed. set(CUDA_ADDITIONAL_CLEAN_FILES "" CACHE INTERNAL "List of intermediate files that are part of the cuda dependency scanning.") -endmacro(CUDA_BUILD_CLEAN_TARGET) +endmacro() diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake index d41b72dc2..c2405f44f 100644 --- a/Modules/FindCUDA/make2cmake.cmake +++ b/Modules/FindCUDA/make2cmake.cmake @@ -76,7 +76,7 @@ if (${depend_text} MATCHES ".+") list(APPEND dependency_list "${file_absolute}") endif() - endforeach(file) + endforeach() else() # message("FOUND NO DEPENDS") diff --git a/Modules/FindCUDA/parse_cubin.cmake b/Modules/FindCUDA/parse_cubin.cmake index 2518c6852..94be7e2cb 100644 --- a/Modules/FindCUDA/parse_cubin.cmake +++ b/Modules/FindCUDA/parse_cubin.cmake @@ -65,11 +65,11 @@ if (${file_text} MATCHES ".+") # Skip the rest of this block. # message("Skipping ${entry}") # set(skip TRUE) - # else (${entry} MATCHES "^_") + # else () message("Kernel: ${entry}") - # endif (${entry} MATCHES "^_") + # endif () - endif(${entry} MATCHES "[^g]name = ([^ ]+)") + endif() # Skip the rest of the block if necessary if(NOT skip) @@ -96,14 +96,14 @@ if (${file_text} MATCHES ".+") message("") endif() - endif(NOT skip) + endif() - endforeach(entry) + endforeach() - endif(line MATCHES "^code") + endif() - endforeach(line) + endforeach() else() # message("FOUND NO DEPENDS") diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index b31011c0e..f0aac8487 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -62,6 +62,7 @@ set(cmake_dependency_file "@cmake_dependency_file@") # path set(CUDA_make2cmake "@CUDA_make2cmake@") # path set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path set(build_cubin @build_cubin@) # bool +set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # bool # We won't actually use these variables for now, but we need to set this, in # order to force this file to be run again if it changes. set(generated_file_path "@generated_file_path@") # path @@ -102,8 +103,15 @@ endif() # Add the build specific configuration flags list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}}) -if(DEFINED CCBIN) - set(CCBIN -ccbin "${CCBIN}") +# Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority +list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 ) +list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 ) +if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 ) + if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN) + set(CCBIN -ccbin "${CCBIN}") + else() + set(CCBIN -ccbin "${CUDA_HOST_COMPILER}") + endif() endif() # cuda_execute_process - Executes a command with optional command echo and status message. @@ -139,7 +147,7 @@ macro(cuda_execute_process status command) endforeach() # Echo the command execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${cuda_execute_process_string}) - endif(verbose) + endif() # Run the command execute_process(COMMAND ${ARGN} RESULT_VARIABLE CUDA_result ) endmacro() @@ -277,4 +285,4 @@ if( build_cubin ) -P "${CUDA_parse_cubin}" ) -endif( build_cubin ) +endif() diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index cc00d53f4..0fb8f45d4 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -21,39 +21,41 @@ # License text for the above reference.) # Look for the header file. -FIND_PATH(CURL_INCLUDE_DIR NAMES curl/curl.h) -MARK_AS_ADVANCED(CURL_INCLUDE_DIR) +find_path(CURL_INCLUDE_DIR NAMES curl/curl.h) +mark_as_advanced(CURL_INCLUDE_DIR) -# Look for the library. -FIND_LIBRARY(CURL_LIBRARY NAMES +# Look for the library (sorted from most current/relevant entry to least). +find_library(CURL_LIBRARY NAMES curl # Windows MSVC prebuilts: curllib libcurl_imp curllib_static + # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip): + libcurl ) -MARK_AS_ADVANCED(CURL_LIBRARY) +mark_as_advanced(CURL_LIBRARY) -IF(CURL_INCLUDE_DIR) - FOREACH(_curl_version_header curlver.h curl.h) - IF(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}") - FILE(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"") +if(CURL_INCLUDE_DIR) + foreach(_curl_version_header curlver.h curl.h) + if(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}") + file(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"") - STRING(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}") - UNSET(curl_version_str) - BREAK() - ENDIF() - ENDFOREACH(_curl_version_header) -ENDIF() + string(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}") + unset(curl_version_str) + break() + endif() + endforeach() +endif() -# handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR VERSION_VAR CURL_VERSION_STRING) -IF(CURL_FOUND) - SET(CURL_LIBRARIES ${CURL_LIBRARY}) - SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR}) -ENDIF(CURL_FOUND) +if(CURL_FOUND) + set(CURL_LIBRARIES ${CURL_LIBRARY}) + set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR}) +endif() diff --git a/Modules/FindCVS.cmake b/Modules/FindCVS.cmake index 57680bd97..07079bb5a 100644 --- a/Modules/FindCVS.cmake +++ b/Modules/FindCVS.cmake @@ -5,7 +5,7 @@ # find_package(CVS) # if(CVS_FOUND) # message("CVS found: ${CVS_EXECUTABLE}") -# endif(CVS_FOUND) +# endif() #============================================================================= # Copyright 2008-2009 Kitware, Inc. @@ -24,31 +24,31 @@ get_filename_component( CVSNT_TypeLib_Win32 - "[HKEY_CLASSES_ROOT\\TypeLib\\{2BDF7A65-0BFE-4B1A-9205-9AB900C7D0DA}\\1.0\\0\\win32]" + "[HKEY_CLASSES_ROOT\\TypeLib\\{2BDF7A65-0BFE-4B1A-9205-9AB900C7D0DA}\\1.0\\0\\win32]" PATH) get_filename_component( CVSNT_Services_EventMessagePath - "[HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Services\\Eventlog\\Application\\cvsnt;EventMessageFile]" + "[HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Services\\Eventlog\\Application\\cvsnt;EventMessageFile]" PATH) # WinCVS (in case CVSNT was installed in the same directory) get_filename_component( WinCVS_Folder_Command - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Folder\\shell\\wincvs\\command]" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Folder\\shell\\wincvs\\command]" PATH) # TortoiseCVS (in case CVSNT was installed in the same directory) get_filename_component( TortoiseCVS_Folder_Command - "[HKEY_CLASSES_ROOT\\CVS\\shell\\open\\command]" + "[HKEY_CLASSES_ROOT\\CVS\\shell\\open\\command]" PATH) get_filename_component( TortoiseCVS_DefaultIcon - "[HKEY_CLASSES_ROOT\\CVS\\DefaultIcon]" + "[HKEY_CLASSES_ROOT\\CVS\\DefaultIcon]" PATH) find_program(CVS_EXECUTABLE cvs @@ -62,7 +62,7 @@ find_program(CVS_EXECUTABLE cvs ) mark_as_advanced(CVS_EXECUTABLE) -# Handle the QUIETLY and REQUIRED arguments and set CVS_FOUND to TRUE if +# Handle the QUIETLY and REQUIRED arguments and set CVS_FOUND to TRUE if # all listed variables are TRUE include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindCoin3D.cmake b/Modules/FindCoin3D.cmake index 8bfe97acc..bbda87b3a 100644 --- a/Modules/FindCoin3D.cmake +++ b/Modules/FindCoin3D.cmake @@ -22,63 +22,63 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF (WIN32) - IF (CYGWIN) +if (WIN32) + if (CYGWIN) - FIND_PATH(COIN3D_INCLUDE_DIRS Inventor/So.h) - FIND_LIBRARY(COIN3D_LIBRARIES Coin) + find_path(COIN3D_INCLUDE_DIRS Inventor/So.h) + find_library(COIN3D_LIBRARIES Coin) - ELSE (CYGWIN) + else () - FIND_PATH(COIN3D_INCLUDE_DIRS Inventor/So.h + find_path(COIN3D_INCLUDE_DIRS Inventor/So.h "[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\Coin3D\\2;Installation Path]/include" ) - FIND_LIBRARY(COIN3D_LIBRARY_DEBUG coin2d + find_library(COIN3D_LIBRARY_DEBUG coin2d "[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\Coin3D\\2;Installation Path]/lib" ) - FIND_LIBRARY(COIN3D_LIBRARY_RELEASE coin2 + find_library(COIN3D_LIBRARY_RELEASE coin2 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\Coin3D\\2;Installation Path]/lib" ) - IF (COIN3D_LIBRARY_DEBUG AND COIN3D_LIBRARY_RELEASE) - SET(COIN3D_LIBRARIES optimized ${COIN3D_LIBRARY_RELEASE} + if (COIN3D_LIBRARY_DEBUG AND COIN3D_LIBRARY_RELEASE) + set(COIN3D_LIBRARIES optimized ${COIN3D_LIBRARY_RELEASE} debug ${COIN3D_LIBRARY_DEBUG}) - ELSE (COIN3D_LIBRARY_DEBUG AND COIN3D_LIBRARY_RELEASE) - IF (COIN3D_LIBRARY_DEBUG) - SET (COIN3D_LIBRARIES ${COIN3D_LIBRARY_DEBUG}) - ENDIF (COIN3D_LIBRARY_DEBUG) - IF (COIN3D_LIBRARY_RELEASE) - SET (COIN3D_LIBRARIES ${COIN3D_LIBRARY_RELEASE}) - ENDIF (COIN3D_LIBRARY_RELEASE) - ENDIF (COIN3D_LIBRARY_DEBUG AND COIN3D_LIBRARY_RELEASE) - - ENDIF (CYGWIN) - -ELSE (WIN32) - IF(APPLE) - FIND_PATH(COIN3D_INCLUDE_DIRS Inventor/So.h - /Library/Frameworks/Inventor.framework/Headers + else () + if (COIN3D_LIBRARY_DEBUG) + set (COIN3D_LIBRARIES ${COIN3D_LIBRARY_DEBUG}) + endif () + if (COIN3D_LIBRARY_RELEASE) + set (COIN3D_LIBRARIES ${COIN3D_LIBRARY_RELEASE}) + endif () + endif () + + endif () + +else () + if(APPLE) + find_path(COIN3D_INCLUDE_DIRS Inventor/So.h + /Library/Frameworks/Inventor.framework/Headers ) - FIND_LIBRARY(COIN3D_LIBRARIES Coin + find_library(COIN3D_LIBRARIES Coin /Library/Frameworks/Inventor.framework/Libraries - ) - SET(COIN3D_LIBRARIES "-framework Coin3d" CACHE STRING "Coin3D library for OSX") - ELSE(APPLE) + ) + set(COIN3D_LIBRARIES "-framework Coin3d" CACHE STRING "Coin3D library for OSX") + else() - FIND_PATH(COIN3D_INCLUDE_DIRS Inventor/So.h) - FIND_LIBRARY(COIN3D_LIBRARIES Coin) + find_path(COIN3D_INCLUDE_DIRS Inventor/So.h) + find_library(COIN3D_LIBRARIES Coin) - ENDIF(APPLE) + endif() -ENDIF (WIN32) +endif () -# handle the QUIETLY and REQUIRED arguments and set COIN3D_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set COIN3D_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Coin3D DEFAULT_MSG COIN3D_LIBRARIES COIN3D_INCLUDE_DIRS) -MARK_AS_ADVANCED(COIN3D_INCLUDE_DIRS COIN3D_LIBRARIES ) +mark_as_advanced(COIN3D_INCLUDE_DIRS COIN3D_LIBRARIES ) diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake index 3862f7ddf..53ab031cf 100644 --- a/Modules/FindCups.cmake +++ b/Modules/FindCups.cmake @@ -5,7 +5,7 @@ # CUPS_INCLUDE_DIR - the Cups include directory # CUPS_LIBRARIES - Libraries needed to use Cups # CUPS_VERSION_STRING - version of Cups found (since CMake 2.8.8) -# Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which +# Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which # features this function (i.e. at least 1.1.19) #============================================================================= @@ -28,11 +28,11 @@ find_path(CUPS_INCLUDE_DIR cups/cups.h ) find_library(CUPS_LIBRARIES NAMES cups ) if (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE) - include(CheckLibraryExists) + include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) # ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint) CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE) -endif (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE) +endif () if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h") file(STRINGS "${CUPS_INCLUDE_DIR}/cups/cups.h" cups_version_str @@ -46,13 +46,13 @@ if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h") CUPS_VERSION_PART "${VLINE}") if(CUPS_VERSION_STRING) set(CUPS_VERSION_STRING "${CUPS_VERSION_STRING}.${CUPS_VERSION_PART}") - else(CUPS_VERSION_STRING) + else() set(CUPS_VERSION_STRING "${CUPS_VERSION_PART}") - endif(CUPS_VERSION_STRING) + endif() endif() - endforeach(VLINE) - endforeach(VPART) -endif (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h") + endforeach() + endforeach() +endif () include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) @@ -60,10 +60,10 @@ if (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cups REQUIRED_VARS CUPS_LIBRARIES CUPS_INCLUDE_DIR CUPS_HAS_IPP_DELETE_ATTRIBUTE VERSION_VAR CUPS_VERSION_STRING) -else (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE) +else () FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cups REQUIRED_VARS CUPS_LIBRARIES CUPS_INCLUDE_DIR VERSION_VAR CUPS_VERSION_STRING) -endif (CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE) - +endif () + mark_as_advanced(CUPS_INCLUDE_DIR CUPS_LIBRARIES) diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index d1e13116d..09d1ba401 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -9,7 +9,7 @@ # CURSES_HAVE_NCURSES_CURSES_H - true if ncurses/curses.h is available # CURSES_LIBRARY - set for backwards compatibility with 2.4 CMake # -# Set CURSES_NEED_NCURSES to TRUE before the FIND_PACKAGE() command if NCurses +# Set CURSES_NEED_NCURSES to TRUE before the find_package() command if NCurses # functionality is required. #============================================================================= @@ -25,23 +25,23 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_LIBRARY(CURSES_CURSES_LIBRARY NAMES curses ) +find_library(CURSES_CURSES_LIBRARY NAMES curses ) -FIND_LIBRARY(CURSES_NCURSES_LIBRARY NAMES ncurses ) -SET(CURSES_USE_NCURSES FALSE) +find_library(CURSES_NCURSES_LIBRARY NAMES ncurses ) +set(CURSES_USE_NCURSES FALSE) -IF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY) - SET(CURSES_USE_NCURSES TRUE) -ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY) +if(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY) + set(CURSES_USE_NCURSES TRUE) +endif() # http://cygwin.com/ml/cygwin-announce/2010-01/msg00002.html # cygwin ncurses stopped providing curses.h symlinks see above # message. Cygwin is an ncurses package, so force ncurses on # cygwin if the curses.h is missing -IF(CYGWIN) - IF(NOT EXISTS /usr/include/curses.h) - SET(CURSES_USE_NCURSES TRUE) - ENDIF() -ENDIF() +if(CYGWIN) + if(NOT EXISTS /usr/include/curses.h) + set(CURSES_USE_NCURSES TRUE) + endif() +endif() # Not sure the logic is correct here. @@ -53,113 +53,113 @@ ENDIF() # some web pages also say that even with ncurses there is not always a ncurses.h: # http://osdir.com/ml/gnome.apps.mc.devel/2002-06/msg00029.html # So at first try ncurses.h, if not found, try to find curses.h under the same -# prefix as the library was found, if still not found, try curses.h with the +# prefix as the library was found, if still not found, try curses.h with the # default search paths. -IF(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) - INCLUDE(CheckLibraryExists) - CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}" +if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) + include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}" wsyncup "" CURSES_CURSES_HAS_WSYNCUP) - IF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP) - CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" + if(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP) + CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" wsyncup "" CURSES_NCURSES_HAS_WSYNCUP) - IF( CURSES_NCURSES_HAS_WSYNCUP) - SET(CURSES_USE_NCURSES TRUE) - ENDIF( CURSES_NCURSES_HAS_WSYNCUP) - ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP) + if( CURSES_NCURSES_HAS_WSYNCUP) + set(CURSES_USE_NCURSES TRUE) + endif() + endif() -ENDIF(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) +endif() -IF(NOT CURSES_USE_NCURSES) - FIND_FILE(CURSES_HAVE_CURSES_H curses.h ) - FIND_PATH(CURSES_CURSES_H_PATH curses.h ) - GET_FILENAME_COMPONENT(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) - GET_FILENAME_COMPONENT(_cursesParentDir "${_cursesLibDir}" PATH) +if(NOT CURSES_USE_NCURSES) + find_file(CURSES_HAVE_CURSES_H curses.h ) + find_path(CURSES_CURSES_H_PATH curses.h ) + get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) + get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) # for compatibility with older FindCurses.cmake this has to be in the cache # FORCE must not be used since this would break builds which preload a cache wqith these variables set - SET(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}" + set(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}" CACHE FILEPATH "The curses include path") - SET(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}" + set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}" CACHE FILEPATH "The curses library") -ELSE(NOT CURSES_USE_NCURSES) +else() # we need to find ncurses - GET_FILENAME_COMPONENT(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH) - GET_FILENAME_COMPONENT(_cursesParentDir "${_cursesLibDir}" PATH) + get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH) + get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) - FIND_FILE(CURSES_HAVE_NCURSES_H ncurses.h) - FIND_FILE(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h) - FIND_FILE(CURSES_HAVE_NCURSES_CURSES_H ncurses/curses.h) - FIND_FILE(CURSES_HAVE_CURSES_H curses.h + find_file(CURSES_HAVE_NCURSES_H ncurses.h) + find_file(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h) + find_file(CURSES_HAVE_NCURSES_CURSES_H ncurses/curses.h) + find_file(CURSES_HAVE_CURSES_H curses.h HINTS "${_cursesParentDir}/include") - FIND_PATH(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h + find_path(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h ncurses/curses.h) - FIND_PATH(CURSES_NCURSES_INCLUDE_PATH curses.h + find_path(CURSES_NCURSES_INCLUDE_PATH curses.h HINTS "${_cursesParentDir}/include") # for compatibility with older FindCurses.cmake this has to be in the cache # FORCE must not be used since this would break builds which preload - # however if the value of the variable has NOTFOUND in it, then + # however if the value of the variable has NOTFOUND in it, then # it is OK to force, and we need to force in order to have it work. # a cache wqith these variables set - # only put ncurses include and library into + # only put ncurses include and library into # variables if they are found - IF(NOT CURSES_NCURSES_INCLUDE_PATH AND CURSES_HAVE_NCURSES_NCURSES_H) - GET_FILENAME_COMPONENT(CURSES_NCURSES_INCLUDE_PATH + if(NOT CURSES_NCURSES_INCLUDE_PATH AND CURSES_HAVE_NCURSES_NCURSES_H) + get_filename_component(CURSES_NCURSES_INCLUDE_PATH "${CURSES_HAVE_NCURSES_NCURSES_H}" PATH) - ENDIF(NOT CURSES_NCURSES_INCLUDE_PATH AND CURSES_HAVE_NCURSES_NCURSES_H) - IF(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY) - SET( FORCE_IT ) - IF(CURSES_INCLUDE_PATH MATCHES NOTFOUND) - SET(FORCE_IT FORCE) - ENDIF(CURSES_INCLUDE_PATH MATCHES NOTFOUND) - SET(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}" + endif() + if(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY) + set( FORCE_IT ) + if(CURSES_INCLUDE_PATH MATCHES NOTFOUND) + set(FORCE_IT FORCE) + endif() + set(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}" CACHE FILEPATH "The curses include path" ${FORCE_IT}) - SET( FORCE_IT) - IF(CURSES_LIBRARY MATCHES NOTFOUND) - SET(FORCE_IT FORCE) - ENDIF(CURSES_LIBRARY MATCHES NOTFOUND) - SET(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}" + set( FORCE_IT) + if(CURSES_LIBRARY MATCHES NOTFOUND) + set(FORCE_IT FORCE) + endif() + set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}" CACHE FILEPATH "The curses library" ${FORCE_IT}) - ENDIF(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY) + endif() -ENDIF(NOT CURSES_USE_NCURSES) +endif() -FIND_LIBRARY(CURSES_EXTRA_LIBRARY cur_colr HINTS "${_cursesLibDir}") -FIND_LIBRARY(CURSES_EXTRA_LIBRARY cur_colr ) +find_library(CURSES_EXTRA_LIBRARY cur_colr HINTS "${_cursesLibDir}") +find_library(CURSES_EXTRA_LIBRARY cur_colr ) -FIND_LIBRARY(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}") -FIND_LIBRARY(CURSES_FORM_LIBRARY form ) +find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}") +find_library(CURSES_FORM_LIBRARY form ) # for compatibility with older FindCurses.cmake this has to be in the cache # FORCE must not be used since this would break builds which preload a cache # qith these variables set -SET(FORM_LIBRARY "${CURSES_FORM_LIBRARY}" +set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}" CACHE FILEPATH "The curses form library") # Need to provide the *_LIBRARIES -SET(CURSES_LIBRARIES ${CURSES_LIBRARY}) +set(CURSES_LIBRARIES ${CURSES_LIBRARY}) -IF(CURSES_EXTRA_LIBRARY) - SET(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_EXTRA_LIBRARY}) -ENDIF(CURSES_EXTRA_LIBRARY) +if(CURSES_EXTRA_LIBRARY) + set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_EXTRA_LIBRARY}) +endif() -IF(CURSES_FORM_LIBRARY) - SET(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY}) -ENDIF(CURSES_FORM_LIBRARY) +if(CURSES_FORM_LIBRARY) + set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY}) +endif() # Proper name is *_INCLUDE_DIR -SET(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) +set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) -# handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG CURSES_LIBRARY CURSES_INCLUDE_PATH) -MARK_AS_ADVANCED( +mark_as_advanced( CURSES_INCLUDE_PATH CURSES_LIBRARY CURSES_CURSES_INCLUDE_PATH diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake index a4d150493..48de64afd 100644 --- a/Modules/FindCxxTest.cmake +++ b/Modules/FindCxxTest.cmake @@ -49,7 +49,7 @@ # input_files_to_testgen The list of header files containing the # CxxTest::TestSuite's to be included in # this runner -# +# # #============== # Example Usage: # @@ -67,13 +67,13 @@ # 1. Invoke the testgen executable to autogenerate foo_test.cc in the # binary tree from "foo_test.h" in the current source directory. # 2. Create an executable and test called unittest_foo. -# +# # #============= # Example foo_test.h: # # #include -# -# class MyTestSuite : public CxxTest::TestSuite +# +# class MyTestSuite : public CxxTest::TestSuite # { # public: # void testAddition( void ) @@ -147,7 +147,7 @@ macro(CXXTEST_ADD_TEST _cxxtest_testname _cxxtest_outfname) add_test(${_cxxtest_testname} ${CMAKE_CURRENT_BINARY_DIR}/${_cxxtest_testname}) endif() -endmacro(CXXTEST_ADD_TEST) +endmacro() #============================================================= # main() diff --git a/Modules/FindCygwin.cmake b/Modules/FindCygwin.cmake index 28f55ba0c..d7ab7cc80 100644 --- a/Modules/FindCygwin.cmake +++ b/Modules/FindCygwin.cmake @@ -14,15 +14,15 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF (WIN32) - FIND_PATH(CYGWIN_INSTALL_PATH +if (WIN32) + find_path(CYGWIN_INSTALL_PATH cygwin.bat "C:/Cygwin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygwin\\setup;rootdir]" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/;native]" ) - MARK_AS_ADVANCED( + mark_as_advanced( CYGWIN_INSTALL_PATH ) -ENDIF (WIN32) +endif () diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake index f7c54df43..a2b2926a7 100644 --- a/Modules/FindDart.cmake +++ b/Modules/FindDart.cmake @@ -16,21 +16,25 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(DART_ROOT README.INSTALL - $ENV{DART_ROOT} - ${PROJECT_SOURCE_DIR}/Dart - /usr/share/Dart - C:/Dart - "$ENV{ProgramFiles}/Dart" - "C:/Program Files/Dart" - ${PROJECT_SOURCE_DIR}/../Dart - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Dart\\InstallPath] +find_path(DART_ROOT README.INSTALL + HINTS + ENV DART_ROOT + PATHS + ${PROJECT_SOURCE_DIR} + /usr/share + C:/ + "C:/Program Files" + ${PROJECT_SOURCE_DIR}/.. + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Dart\\InstallPath] + ENV ProgramFiles + PATH_SUFFIXES + Dart DOC "If you have Dart installed, where is it located?" ) # handle the QUIETLY and REQUIRED arguments and set DART_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Dart DEFAULT_MSG DART_ROOT) -MARK_AS_ADVANCED(DART_ROOT) +mark_as_advanced(DART_ROOT) diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake index 4a0fbe064..dacc60422 100644 --- a/Modules/FindDevIL.cmake +++ b/Modules/FindDevIL.cmake @@ -36,39 +36,39 @@ # TODO: Add version support. # Tested under Linux and Windows (MSVC) -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PATH(IL_INCLUDE_DIR il.h +find_path(IL_INCLUDE_DIR il.h PATH_SUFFIXES include IL DOC "The path the the directory that contains il.h" ) -#MESSAGE("IL_INCLUDE_DIR is ${IL_INCLUDE_DIR}") +#message("IL_INCLUDE_DIR is ${IL_INCLUDE_DIR}") -FIND_LIBRARY(IL_LIBRARIES +find_library(IL_LIBRARIES NAMES IL DEVIL PATH_SUFFIXES lib64 lib lib32 DOC "The file that corresponds to the base il library." ) -#MESSAGE("IL_LIBRARIES is ${IL_LIBRARIES}") +#message("IL_LIBRARIES is ${IL_LIBRARIES}") -FIND_LIBRARY(ILUT_LIBRARIES +find_library(ILUT_LIBRARIES NAMES ILUT PATH_SUFFIXES lib64 lib lib32 DOC "The file that corresponds to the il (system?) utility library." ) -#MESSAGE("ILUT_LIBRARIES is ${ILUT_LIBRARIES}") +#message("ILUT_LIBRARIES is ${ILUT_LIBRARIES}") -FIND_LIBRARY(ILU_LIBRARIES +find_library(ILU_LIBRARIES NAMES ILU PATH_SUFFIXES lib64 lib lib32 DOC "The file that corresponds to the il utility library." ) -#MESSAGE("ILU_LIBRARIES is ${ILU_LIBRARIES}") +#message("ILU_LIBRARIES is ${ILU_LIBRARIES}") -FIND_PACKAGE_HANDLE_STANDARD_ARGS(IL DEFAULT_MSG - IL_LIBRARIES ILU_LIBRARIES +FIND_PACKAGE_HANDLE_STANDARD_ARGS(IL DEFAULT_MSG + IL_LIBRARIES ILU_LIBRARIES ILUT_LIBRARIES IL_INCLUDE_DIR) diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index 6cc9efb18..d2ede6ab9 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -33,19 +33,19 @@ # License text for the above reference.) # For backwards compatibility support -IF(Doxygen_FIND_QUIETLY) - SET(DOXYGEN_FIND_QUIETLY TRUE) -ENDIF(Doxygen_FIND_QUIETLY) +if(Doxygen_FIND_QUIETLY) + set(DOXYGEN_FIND_QUIETLY TRUE) +endif() # ===== Rationale for OS X AppBundle mods below ===== # With the OS X GUI version, Doxygen likes to be installed to /Applications and -# it contains the doxygen executable in the bundle. In the versions I've -# seen, it is located in Resources, but in general, more often binaries are +# it contains the doxygen executable in the bundle. In the versions I've +# seen, it is located in Resources, but in general, more often binaries are # located in MacOS. # -# NOTE: The official Doxygen.app that is distributed for OS X uses non-standard +# NOTE: The official Doxygen.app that is distributed for OS X uses non-standard # conventions. Instead of the command-line "doxygen" tool being placed in -# Doxygen.app/Contents/MacOS, "Doxywizard" is placed there instead and +# Doxygen.app/Contents/MacOS, "Doxywizard" is placed there instead and # "doxygen" is placed in Contents/Resources. This is most likely done # so that something happens when people double-click on the Doxygen.app # package. Unfortunately, CMake gets confused by this as when it sees the @@ -54,12 +54,12 @@ ENDIF(Doxygen_FIND_QUIETLY) # the app-bundle feature, just for this CMake module: if(APPLE) # Save the old setting - SET(TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE}) + set(TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE}) # Disable the App-bundle detection feature - SET(CMAKE_FIND_APPBUNDLE "NEVER") + set(CMAKE_FIND_APPBUNDLE "NEVER") endif() # FYI: -# In the older versions of OS X Doxygen, dot was included with the +# In the older versions of OS X Doxygen, dot was included with the # Doxygen bundle. But the new versions require you to download # Graphviz.app which contains "dot" in it's bundle. # ============== End OSX stuff ================ @@ -68,7 +68,7 @@ endif() # Find Doxygen... # -FIND_PROGRAM(DOXYGEN_EXECUTABLE +find_program(DOXYGEN_EXECUTABLE NAMES doxygen PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\doxygen_is1;Inno Setup: App Path]/bin" @@ -77,9 +77,9 @@ FIND_PROGRAM(DOXYGEN_EXECUTABLE DOC "Doxygen documentation generation tool (http://www.doxygen.org)" ) -IF(DOXYGEN_EXECUTABLE) - EXECUTE_PROCESS(COMMAND ${DOXYGEN_EXECUTABLE} "--version" OUTPUT_VARIABLE DOXYGEN_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) -ENDIF() +if(DOXYGEN_EXECUTABLE) + execute_process(COMMAND ${DOXYGEN_EXECUTABLE} "--version" OUTPUT_VARIABLE DOXYGEN_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Doxygen REQUIRED_VARS DOXYGEN_EXECUTABLE VERSION_VAR DOXYGEN_VERSION) @@ -88,10 +88,10 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Doxygen REQUIRED_VARS DOXYGEN_EXECUTABLE VERSI # Find Dot... # -IF(NOT DOXYGEN_SKIP_DOT) - FIND_PROGRAM(DOXYGEN_DOT_EXECUTABLE +if(NOT DOXYGEN_SKIP_DOT) + find_program(DOXYGEN_DOT_EXECUTABLE NAMES dot - PATHS + PATHS "$ENV{ProgramFiles}/Graphviz 2.21/bin" "C:/Program Files/Graphviz 2.21/bin" "$ENV{ProgramFiles}/ATT/Graphviz/bin" @@ -102,14 +102,14 @@ IF(NOT DOXYGEN_SKIP_DOT) /Applications/Doxygen.app/Contents/MacOS DOC "Graphviz Dot tool for using Doxygen" ) - + if(DOXYGEN_DOT_EXECUTABLE) set(DOXYGEN_DOT_FOUND TRUE) # The Doxyfile wants the path to Dot, not the entire path and executable get_filename_component(DOXYGEN_DOT_PATH "${DOXYGEN_DOT_EXECUTABLE}" PATH CACHE) endif() - -endif(NOT DOXYGEN_SKIP_DOT) + +endif() # # Backwards compatibility... @@ -117,7 +117,7 @@ endif(NOT DOXYGEN_SKIP_DOT) if(APPLE) # Restore the old app-bundle setting setting - SET(CMAKE_FIND_APPBUNDLE ${TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE}) + set(CMAKE_FIND_APPBUNDLE ${TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE}) endif() # Maintain the _FOUND variables as "YES" or "NO" for backwards compatibility @@ -134,10 +134,10 @@ else() endif() # For backwards compatibility support -SET (DOXYGEN ${DOXYGEN_EXECUTABLE} ) -SET (DOT ${DOXYGEN_DOT_EXECUTABLE} ) +set (DOXYGEN ${DOXYGEN_EXECUTABLE} ) +set (DOT ${DOXYGEN_DOT_EXECUTABLE} ) -MARK_AS_ADVANCED( +mark_as_advanced( DOXYGEN_EXECUTABLE DOXYGEN_DOT_EXECUTABLE DOXYGEN_DOT_PATH diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake index 1bf074357..c681a0dfd 100644 --- a/Modules/FindEXPAT.cmake +++ b/Modules/FindEXPAT.cmake @@ -19,10 +19,10 @@ # License text for the above reference.) # Look for the header file. -FIND_PATH(EXPAT_INCLUDE_DIR NAMES expat.h) +find_path(EXPAT_INCLUDE_DIR NAMES expat.h) # Look for the library. -FIND_LIBRARY(EXPAT_LIBRARY NAMES expat libexpat) +find_library(EXPAT_LIBRARY NAMES expat libexpat) if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h") file(STRINGS "${EXPAT_INCLUDE_DIR}/expat.h" expat_version_str @@ -36,25 +36,25 @@ if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h") EXPAT_VERSION_PART "${VLINE}") if(EXPAT_VERSION_STRING) set(EXPAT_VERSION_STRING "${EXPAT_VERSION_STRING}.${EXPAT_VERSION_PART}") - else(EXPAT_VERSION_STRING) + else() set(EXPAT_VERSION_STRING "${EXPAT_VERSION_PART}") - endif(EXPAT_VERSION_STRING) + endif() endif() - endforeach(VLINE) - endforeach(VPART) -endif (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h") + endforeach() + endforeach() +endif () -# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT REQUIRED_VARS EXPAT_LIBRARY EXPAT_INCLUDE_DIR VERSION_VAR EXPAT_VERSION_STRING) # Copy the results to the output variables. -IF(EXPAT_FOUND) - SET(EXPAT_LIBRARIES ${EXPAT_LIBRARY}) - SET(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR}) -ENDIF(EXPAT_FOUND) +if(EXPAT_FOUND) + set(EXPAT_LIBRARIES ${EXPAT_LIBRARY}) + set(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR}) +endif() -MARK_AS_ADVANCED(EXPAT_INCLUDE_DIR EXPAT_LIBRARY) +mark_as_advanced(EXPAT_INCLUDE_DIR EXPAT_LIBRARY) diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index 586f77a6e..79a3a1e6c 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -8,7 +8,7 @@ # FLEX_INCLUDE_DIRS - The path to the flex headers # # The minimum required version of flex can be specified using the -# standard syntax, e.g. FIND_PACKAGE(FLEX 2.5.13) +# standard syntax, e.g. find_package(FLEX 2.5.13) # # # If flex is found on the system, the module provides the macro: @@ -63,73 +63,75 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(FLEX_EXECUTABLE flex DOC "path to the flex executable") -MARK_AS_ADVANCED(FLEX_EXECUTABLE) +find_program(FLEX_EXECUTABLE NAMES flex win_flex DOC "path to the flex executable") +mark_as_advanced(FLEX_EXECUTABLE) -FIND_LIBRARY(FL_LIBRARY NAMES fl +find_library(FL_LIBRARY NAMES fl DOC "Path to the fl library") -FIND_PATH(FLEX_INCLUDE_DIR FlexLexer.h +find_path(FLEX_INCLUDE_DIR FlexLexer.h DOC "Path to the flex headers") -MARK_AS_ADVANCED(FL_LIBRARY FLEX_INCLUDE_DIR) +mark_as_advanced(FL_LIBRARY FLEX_INCLUDE_DIR) -SET(FLEX_INCLUDE_DIRS ${FLEX_INCLUDE_DIR}) -SET(FLEX_LIBRARIES ${FL_LIBRARY}) +set(FLEX_INCLUDE_DIRS ${FLEX_INCLUDE_DIR}) +set(FLEX_LIBRARIES ${FL_LIBRARY}) -IF(FLEX_EXECUTABLE) +if(FLEX_EXECUTABLE) - EXECUTE_PROCESS(COMMAND ${FLEX_EXECUTABLE} --version + execute_process(COMMAND ${FLEX_EXECUTABLE} --version OUTPUT_VARIABLE FLEX_version_output ERROR_VARIABLE FLEX_version_error RESULT_VARIABLE FLEX_version_result OUTPUT_STRIP_TRAILING_WHITESPACE) - IF(NOT ${FLEX_version_result} EQUAL 0) - IF(FLEX_FIND_REQUIRED) - MESSAGE(SEND_ERROR "Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_output}\n${FLEX_version_error}") - ELSE() - MESSAGE("Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_output}\n${FLEX_version_error}\nFLEX_VERSION will not be available") - ENDIF() - ELSE() + if(NOT ${FLEX_version_result} EQUAL 0) + if(FLEX_FIND_REQUIRED) + message(SEND_ERROR "Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_output}\n${FLEX_version_error}") + else() + message("Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_output}\n${FLEX_version_error}\nFLEX_VERSION will not be available") + endif() + else() # older versions of flex printed "/full/path/to/executable version X.Y" # newer versions use "basename(executable) X.Y" - GET_FILENAME_COMPONENT(FLEX_EXE_NAME "${FLEX_EXECUTABLE}" NAME) - STRING(REGEX REPLACE "^.*${FLEX_EXE_NAME}\"? (version )?([0-9]+[^ ]*)$" "\\2" + get_filename_component(FLEX_EXE_NAME_WE "${FLEX_EXECUTABLE}" NAME_WE) + get_filename_component(FLEX_EXE_EXT "${FLEX_EXECUTABLE}" EXT) + string(REGEX REPLACE "^.*${FLEX_EXE_NAME_WE}(${FLEX_EXE_EXT})?\"? (version )?([0-9]+[^ ]*)( .*)?$" "\\3" FLEX_VERSION "${FLEX_version_output}") - UNSET(FLEX_EXE_NAME) - ENDIF() + unset(FLEX_EXE_EXT) + unset(FLEX_EXE_NAME_WE) + endif() #============================================================ # FLEX_TARGET (public macro) #============================================================ # - MACRO(FLEX_TARGET Name Input Output) - SET(FLEX_TARGET_usage "FLEX_TARGET( [COMPILE_FLAGS ]") - IF(${ARGC} GREATER 3) - IF(${ARGC} EQUAL 5) - IF("${ARGV3}" STREQUAL "COMPILE_FLAGS") - SET(FLEX_EXECUTABLE_opts "${ARGV4}") - SEPARATE_ARGUMENTS(FLEX_EXECUTABLE_opts) - ELSE() - MESSAGE(SEND_ERROR ${FLEX_TARGET_usage}) - ENDIF() - ELSE() - MESSAGE(SEND_ERROR ${FLEX_TARGET_usage}) - ENDIF() - ENDIF() - - ADD_CUSTOM_COMMAND(OUTPUT ${Output} + macro(FLEX_TARGET Name Input Output) + set(FLEX_TARGET_usage "FLEX_TARGET( [COMPILE_FLAGS ]") + if(${ARGC} GREATER 3) + if(${ARGC} EQUAL 5) + if("${ARGV3}" STREQUAL "COMPILE_FLAGS") + set(FLEX_EXECUTABLE_opts "${ARGV4}") + separate_arguments(FLEX_EXECUTABLE_opts) + else() + message(SEND_ERROR ${FLEX_TARGET_usage}) + endif() + else() + message(SEND_ERROR ${FLEX_TARGET_usage}) + endif() + endif() + + add_custom_command(OUTPUT ${Output} COMMAND ${FLEX_EXECUTABLE} ARGS ${FLEX_EXECUTABLE_opts} -o${Output} ${Input} DEPENDS ${Input} COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - SET(FLEX_${Name}_DEFINED TRUE) - SET(FLEX_${Name}_OUTPUTS ${Output}) - SET(FLEX_${Name}_INPUT ${Input}) - SET(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts}) - ENDMACRO(FLEX_TARGET) + set(FLEX_${Name}_DEFINED TRUE) + set(FLEX_${Name}_OUTPUTS ${Output}) + set(FLEX_${Name}_INPUT ${Input}) + set(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts}) + endmacro() #============================================================ @@ -137,24 +139,24 @@ IF(FLEX_EXECUTABLE) # ADD_FLEX_BISON_DEPENDENCY (public macro) #============================================================ # - MACRO(ADD_FLEX_BISON_DEPENDENCY FlexTarget BisonTarget) + macro(ADD_FLEX_BISON_DEPENDENCY FlexTarget BisonTarget) - IF(NOT FLEX_${FlexTarget}_OUTPUTS) - MESSAGE(SEND_ERROR "Flex target `${FlexTarget}' does not exists.") - ENDIF() + if(NOT FLEX_${FlexTarget}_OUTPUTS) + message(SEND_ERROR "Flex target `${FlexTarget}' does not exists.") + endif() - IF(NOT BISON_${BisonTarget}_OUTPUT_HEADER) - MESSAGE(SEND_ERROR "Bison target `${BisonTarget}' does not exists.") - ENDIF() + if(NOT BISON_${BisonTarget}_OUTPUT_HEADER) + message(SEND_ERROR "Bison target `${BisonTarget}' does not exists.") + endif() - SET_SOURCE_FILES_PROPERTIES(${FLEX_${FlexTarget}_OUTPUTS} + set_source_files_properties(${FLEX_${FlexTarget}_OUTPUTS} PROPERTIES OBJECT_DEPENDS ${BISON_${BisonTarget}_OUTPUT_HEADER}) - ENDMACRO(ADD_FLEX_BISON_DEPENDENCY) + endmacro() #============================================================ -ENDIF(FLEX_EXECUTABLE) +endif() -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLEX REQUIRED_VARS FLEX_EXECUTABLE VERSION_VAR FLEX_VERSION) diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake index bdea95bdc..92c14daed 100644 --- a/Modules/FindFLTK.cmake +++ b/Modules/FindFLTK.cmake @@ -42,62 +42,64 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF(NOT FLTK_SKIP_OPENGL) - FIND_PACKAGE(OpenGL) -ENDIF() +if(NOT FLTK_SKIP_OPENGL) + find_package(OpenGL) +endif() # Platform dependent libraries required by FLTK -IF(WIN32) - IF(NOT CYGWIN) - IF(BORLAND) - SET( FLTK_PLATFORM_DEPENDENT_LIBS import32 ) - ELSE(BORLAND) - SET( FLTK_PLATFORM_DEPENDENT_LIBS wsock32 comctl32 ) - ENDIF(BORLAND) - ENDIF(NOT CYGWIN) -ENDIF(WIN32) - -IF(UNIX) - INCLUDE(FindX11) - FIND_LIBRARY(FLTK_MATH_LIBRARY m) - SET( FLTK_PLATFORM_DEPENDENT_LIBS ${X11_LIBRARIES} ${FLTK_MATH_LIBRARY}) -ENDIF(UNIX) - -IF(APPLE) - SET( FLTK_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz") -ENDIF(APPLE) +if(WIN32) + if(NOT CYGWIN) + if(BORLAND) + set( FLTK_PLATFORM_DEPENDENT_LIBS import32 ) + else() + set( FLTK_PLATFORM_DEPENDENT_LIBS wsock32 comctl32 ) + endif() + endif() +endif() + +if(UNIX) + include(${CMAKE_CURRENT_LIST_DIR}/FindX11.cmake) + find_library(FLTK_MATH_LIBRARY m) + set( FLTK_PLATFORM_DEPENDENT_LIBS ${X11_LIBRARIES} ${FLTK_MATH_LIBRARY}) +endif() + +if(APPLE) + set( FLTK_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz") +endif() # If FLTK_INCLUDE_DIR is already defined we assigne its value to FLTK_DIR -IF(FLTK_INCLUDE_DIR) - SET(FLTK_DIR ${FLTK_INCLUDE_DIR}) -ENDIF(FLTK_INCLUDE_DIR) +if(FLTK_INCLUDE_DIR) + set(FLTK_DIR ${FLTK_INCLUDE_DIR}) +endif() # If FLTK has been built using CMake we try to find everything directly -SET(FLTK_DIR_STRING "directory containing FLTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/fltk for an installation.") +set(FLTK_DIR_STRING "directory containing FLTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/fltk for an installation.") # Search only if the location is not already known. -IF(NOT FLTK_DIR) +if(NOT FLTK_DIR) # Get the system search path as a list. - FILE(TO_CMAKE_PATH "$ENV{PATH}" FLTK_DIR_SEARCH2) + file(TO_CMAKE_PATH "$ENV{PATH}" FLTK_DIR_SEARCH2) # Construct a set of paths relative to the system search path. - SET(FLTK_DIR_SEARCH "") - FOREACH(dir ${FLTK_DIR_SEARCH2}) - SET(FLTK_DIR_SEARCH ${FLTK_DIR_SEARCH} "${dir}/../lib/fltk") - ENDFOREACH(dir) - STRING(REPLACE "//" "/" FLTK_DIR_SEARCH "${FLTK_DIR_SEARCH}") + set(FLTK_DIR_SEARCH "") + foreach(dir ${FLTK_DIR_SEARCH2}) + set(FLTK_DIR_SEARCH ${FLTK_DIR_SEARCH} "${dir}/../lib/fltk") + endforeach() + string(REPLACE "//" "/" FLTK_DIR_SEARCH "${FLTK_DIR_SEARCH}") # # Look for an installation or build tree. # - FIND_PATH(FLTK_DIR FLTKConfig.cmake + find_path(FLTK_DIR FLTKConfig.cmake # Look for an environment variable FLTK_DIR. - $ENV{FLTK_DIR} + HINTS + ENV FLTK_DIR # Look in places relative to the system executable search path. ${FLTK_DIR_SEARCH} + PATHS # Look in standard UNIX install locations. /usr/local/lib/fltk /usr/lib/fltk @@ -122,188 +124,188 @@ IF(NOT FLTK_DIR) # Help the user find it if we cannot. DOC "The ${FLTK_DIR_STRING}" ) -ENDIF(NOT FLTK_DIR) +endif() # Check if FLTK was built using CMake - IF(EXISTS ${FLTK_DIR}/FLTKConfig.cmake) - SET(FLTK_BUILT_WITH_CMAKE 1) - ENDIF(EXISTS ${FLTK_DIR}/FLTKConfig.cmake) + if(EXISTS ${FLTK_DIR}/FLTKConfig.cmake) + set(FLTK_BUILT_WITH_CMAKE 1) + endif() - IF(FLTK_BUILT_WITH_CMAKE) - SET(FLTK_FOUND 1) - INCLUDE(${FLTK_DIR}/FLTKConfig.cmake) + if(FLTK_BUILT_WITH_CMAKE) + set(FLTK_FOUND 1) + include(${FLTK_DIR}/FLTKConfig.cmake) # Fluid - IF(FLUID_COMMAND) - SET(FLTK_FLUID_EXECUTABLE ${FLUID_COMMAND} CACHE FILEPATH "Fluid executable") - ELSE(FLUID_COMMAND) - FIND_PROGRAM(FLTK_FLUID_EXECUTABLE fluid PATHS + if(FLUID_COMMAND) + set(FLTK_FLUID_EXECUTABLE ${FLUID_COMMAND} CACHE FILEPATH "Fluid executable") + else() + find_program(FLTK_FLUID_EXECUTABLE fluid PATHS ${FLTK_EXECUTABLE_DIRS} ${FLTK_EXECUTABLE_DIRS}/RelWithDebInfo ${FLTK_EXECUTABLE_DIRS}/Debug ${FLTK_EXECUTABLE_DIRS}/Release NO_SYSTEM_PATH) - ENDIF(FLUID_COMMAND) - # MARK_AS_ADVANCED(FLTK_FLUID_EXECUTABLE) + endif() + # mark_as_advanced(FLTK_FLUID_EXECUTABLE) - SET(FLTK_INCLUDE_DIR ${FLTK_DIR}) - LINK_DIRECTORIES(${FLTK_LIBRARY_DIRS}) + set(FLTK_INCLUDE_DIR ${FLTK_DIR}) + link_directories(${FLTK_LIBRARY_DIRS}) - SET(FLTK_BASE_LIBRARY fltk) - SET(FLTK_GL_LIBRARY fltk_gl) - SET(FLTK_FORMS_LIBRARY fltk_forms) - SET(FLTK_IMAGES_LIBRARY fltk_images) + set(FLTK_BASE_LIBRARY fltk) + set(FLTK_GL_LIBRARY fltk_gl) + set(FLTK_FORMS_LIBRARY fltk_forms) + set(FLTK_IMAGES_LIBRARY fltk_images) # Add the extra libraries - LOAD_CACHE(${FLTK_DIR} + load_cache(${FLTK_DIR} READ_WITH_PREFIX FL FLTK_USE_SYSTEM_JPEG FL FLTK_USE_SYSTEM_PNG FL FLTK_USE_SYSTEM_ZLIB ) - SET(FLTK_IMAGES_LIBS "") - IF(FLFLTK_USE_SYSTEM_JPEG) - SET(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_jpeg) - ENDIF(FLFLTK_USE_SYSTEM_JPEG) - IF(FLFLTK_USE_SYSTEM_PNG) - SET(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_png) - ENDIF(FLFLTK_USE_SYSTEM_PNG) - IF(FLFLTK_USE_SYSTEM_ZLIB) - SET(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_zlib) - ENDIF(FLFLTK_USE_SYSTEM_ZLIB) - SET(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL + set(FLTK_IMAGES_LIBS "") + if(FLFLTK_USE_SYSTEM_JPEG) + set(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_jpeg) + endif() + if(FLFLTK_USE_SYSTEM_PNG) + set(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_png) + endif() + if(FLFLTK_USE_SYSTEM_ZLIB) + set(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_zlib) + endif() + set(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL "Extra libraries for fltk_images library.") - ELSE(FLTK_BUILT_WITH_CMAKE) + else() # if FLTK was not built using CMake # Find fluid executable. - FIND_PROGRAM(FLTK_FLUID_EXECUTABLE fluid ${FLTK_INCLUDE_DIR}/fluid) + find_program(FLTK_FLUID_EXECUTABLE fluid ${FLTK_INCLUDE_DIR}/fluid) # Use location of fluid to help find everything else. - SET(FLTK_INCLUDE_SEARCH_PATH "") - SET(FLTK_LIBRARY_SEARCH_PATH "") - IF(FLTK_FLUID_EXECUTABLE) - GET_FILENAME_COMPONENT(FLTK_BIN_DIR "${FLTK_FLUID_EXECUTABLE}" PATH) - SET(FLTK_INCLUDE_SEARCH_PATH ${FLTK_INCLUDE_SEARCH_PATH} + set(FLTK_INCLUDE_SEARCH_PATH "") + set(FLTK_LIBRARY_SEARCH_PATH "") + if(FLTK_FLUID_EXECUTABLE) + get_filename_component(FLTK_BIN_DIR "${FLTK_FLUID_EXECUTABLE}" PATH) + set(FLTK_INCLUDE_SEARCH_PATH ${FLTK_INCLUDE_SEARCH_PATH} ${FLTK_BIN_DIR}/../include ${FLTK_BIN_DIR}/..) - SET(FLTK_LIBRARY_SEARCH_PATH ${FLTK_LIBRARY_SEARCH_PATH} + set(FLTK_LIBRARY_SEARCH_PATH ${FLTK_LIBRARY_SEARCH_PATH} ${FLTK_BIN_DIR}/../lib) - SET(FLTK_WRAP_UI 1) - ENDIF(FLTK_FLUID_EXECUTABLE) + set(FLTK_WRAP_UI 1) + endif() # # Try to find FLTK include dir using fltk-config # - IF(UNIX) + if(UNIX) # Use fltk-config to generate a list of possible include directories - FIND_PROGRAM(FLTK_CONFIG_SCRIPT fltk-config PATHS ${FLTK_BIN_DIR}) - IF(FLTK_CONFIG_SCRIPT) - IF(NOT FLTK_INCLUDE_DIR) - EXEC_PROGRAM(${FLTK_CONFIG_SCRIPT} ARGS --cxxflags OUTPUT_VARIABLE FLTK_CXXFLAGS) - IF(FLTK_CXXFLAGS) - STRING(REGEX MATCHALL "-I[^ ]*" _fltk_temp_dirs ${FLTK_CXXFLAGS}) - STRING(REPLACE "-I" "" _fltk_temp_dirs "${_fltk_temp_dirs}") - FOREACH(_dir ${_fltk_temp_dirs}) - STRING(STRIP ${_dir} _output) - LIST(APPEND _FLTK_POSSIBLE_INCLUDE_DIRS ${_output}) - ENDFOREACH() - ENDIF(FLTK_CXXFLAGS) - ENDIF() - ENDIF() - ENDIF() - - SET(FLTK_INCLUDE_SEARCH_PATH ${FLTK_INCLUDE_SEARCH_PATH} + find_program(FLTK_CONFIG_SCRIPT fltk-config PATHS ${FLTK_BIN_DIR}) + if(FLTK_CONFIG_SCRIPT) + if(NOT FLTK_INCLUDE_DIR) + exec_program(${FLTK_CONFIG_SCRIPT} ARGS --cxxflags OUTPUT_VARIABLE FLTK_CXXFLAGS) + if(FLTK_CXXFLAGS) + string(REGEX MATCHALL "-I[^ ]*" _fltk_temp_dirs ${FLTK_CXXFLAGS}) + string(REPLACE "-I" "" _fltk_temp_dirs "${_fltk_temp_dirs}") + foreach(_dir ${_fltk_temp_dirs}) + string(STRIP ${_dir} _output) + list(APPEND _FLTK_POSSIBLE_INCLUDE_DIRS ${_output}) + endforeach() + endif() + endif() + endif() + endif() + + set(FLTK_INCLUDE_SEARCH_PATH ${FLTK_INCLUDE_SEARCH_PATH} /usr/local/fltk /usr/X11R6/include ${_FLTK_POSSIBLE_INCLUDE_DIRS} ) - FIND_PATH(FLTK_INCLUDE_DIR + find_path(FLTK_INCLUDE_DIR NAMES FL/Fl.h FL/Fl.H # fltk 1.1.9 has Fl.H (#8376) PATHS ${FLTK_INCLUDE_SEARCH_PATH}) - + # # Try to find FLTK library - IF(UNIX) - IF(FLTK_CONFIG_SCRIPT) - EXEC_PROGRAM(${FLTK_CONFIG_SCRIPT} ARGS --libs OUTPUT_VARIABLE _FLTK_POSSIBLE_LIBS) - IF(_FLTK_POSSIBLE_LIBS) - GET_FILENAME_COMPONENT(_FLTK_POSSIBLE_LIBRARY_DIR ${_FLTK_POSSIBLE_LIBS} PATH) - ENDIF() - ENDIF() - ENDIF() - - SET(FLTK_LIBRARY_SEARCH_PATH ${FLTK_LIBRARY_SEARCH_PATH} + if(UNIX) + if(FLTK_CONFIG_SCRIPT) + exec_program(${FLTK_CONFIG_SCRIPT} ARGS --libs OUTPUT_VARIABLE _FLTK_POSSIBLE_LIBS) + if(_FLTK_POSSIBLE_LIBS) + get_filename_component(_FLTK_POSSIBLE_LIBRARY_DIR ${_FLTK_POSSIBLE_LIBS} PATH) + endif() + endif() + endif() + + set(FLTK_LIBRARY_SEARCH_PATH ${FLTK_LIBRARY_SEARCH_PATH} /usr/local/fltk/lib /usr/X11R6/lib ${FLTK_INCLUDE_DIR}/lib ${_FLTK_POSSIBLE_LIBRARY_DIR} ) - FIND_LIBRARY(FLTK_BASE_LIBRARY NAMES fltk fltkd + find_library(FLTK_BASE_LIBRARY NAMES fltk fltkd PATHS ${FLTK_LIBRARY_SEARCH_PATH}) - FIND_LIBRARY(FLTK_GL_LIBRARY NAMES fltkgl fltkgld fltk_gl + find_library(FLTK_GL_LIBRARY NAMES fltkgl fltkgld fltk_gl PATHS ${FLTK_LIBRARY_SEARCH_PATH}) - FIND_LIBRARY(FLTK_FORMS_LIBRARY NAMES fltkforms fltkformsd fltk_forms + find_library(FLTK_FORMS_LIBRARY NAMES fltkforms fltkformsd fltk_forms PATHS ${FLTK_LIBRARY_SEARCH_PATH}) - FIND_LIBRARY(FLTK_IMAGES_LIBRARY NAMES fltkimages fltkimagesd fltk_images + find_library(FLTK_IMAGES_LIBRARY NAMES fltkimages fltkimagesd fltk_images PATHS ${FLTK_LIBRARY_SEARCH_PATH}) # Find the extra libraries needed for the fltk_images library. - IF(UNIX) - IF(FLTK_CONFIG_SCRIPT) - EXEC_PROGRAM(${FLTK_CONFIG_SCRIPT} ARGS --use-images --ldflags + if(UNIX) + if(FLTK_CONFIG_SCRIPT) + exec_program(${FLTK_CONFIG_SCRIPT} ARGS --use-images --ldflags OUTPUT_VARIABLE FLTK_IMAGES_LDFLAGS) - SET(FLTK_LIBS_EXTRACT_REGEX ".*-lfltk_images (.*) -lfltk.*") - IF("${FLTK_IMAGES_LDFLAGS}" MATCHES "${FLTK_LIBS_EXTRACT_REGEX}") - STRING(REGEX REPLACE "${FLTK_LIBS_EXTRACT_REGEX}" "\\1" + set(FLTK_LIBS_EXTRACT_REGEX ".*-lfltk_images (.*) -lfltk.*") + if("${FLTK_IMAGES_LDFLAGS}" MATCHES "${FLTK_LIBS_EXTRACT_REGEX}") + string(REGEX REPLACE "${FLTK_LIBS_EXTRACT_REGEX}" "\\1" FLTK_IMAGES_LIBS "${FLTK_IMAGES_LDFLAGS}") - STRING(REGEX REPLACE " +" ";" FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}") + string(REGEX REPLACE " +" ";" FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}") # The EXEC_PROGRAM will not be inherited into subdirectories from # the file that originally included this module. Save the answer. - SET(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL + set(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL "Extra libraries for fltk_images library.") - ENDIF("${FLTK_IMAGES_LDFLAGS}" MATCHES "${FLTK_LIBS_EXTRACT_REGEX}") - ENDIF(FLTK_CONFIG_SCRIPT) - ENDIF(UNIX) + endif() + endif() + endif() - ENDIF(FLTK_BUILT_WITH_CMAKE) + endif() # Append all of the required libraries together (by default, everything) - SET(FLTK_LIBRARIES) - IF(NOT FLTK_SKIP_IMAGES) - LIST(APPEND FLTK_LIBRARIES ${FLTK_IMAGES_LIBRARY}) - ENDIF() - IF(NOT FLTK_SKIP_FORMS) - LIST(APPEND FLTK_LIBRARIES ${FLTK_FORMS_LIBRARY}) - ENDIF() - IF(NOT FLTK_SKIP_OPENGL) - LIST(APPEND FLTK_LIBRARIES ${FLTK_GL_LIBRARY} ${OPENGL_gl_LIBRARY}) - LIST(APPEND FLTK_INCLUDE_DIR ${OPENGL_INCLUDE_DIR}) - LIST(REMOVE_DUPLICATES FLTK_INCLUDE_DIR) - ENDIF() - LIST(APPEND FLTK_LIBRARIES ${FLTK_BASE_LIBRARY}) - -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -IF(FLTK_SKIP_FLUID) + set(FLTK_LIBRARIES) + if(NOT FLTK_SKIP_IMAGES) + list(APPEND FLTK_LIBRARIES ${FLTK_IMAGES_LIBRARY}) + endif() + if(NOT FLTK_SKIP_FORMS) + list(APPEND FLTK_LIBRARIES ${FLTK_FORMS_LIBRARY}) + endif() + if(NOT FLTK_SKIP_OPENGL) + list(APPEND FLTK_LIBRARIES ${FLTK_GL_LIBRARY} ${OPENGL_gl_LIBRARY}) + list(APPEND FLTK_INCLUDE_DIR ${OPENGL_INCLUDE_DIR}) + list(REMOVE_DUPLICATES FLTK_INCLUDE_DIR) + endif() + list(APPEND FLTK_LIBRARIES ${FLTK_BASE_LIBRARY}) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +if(FLTK_SKIP_FLUID) FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLTK DEFAULT_MSG FLTK_LIBRARIES FLTK_INCLUDE_DIR) -ELSE() +else() FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLTK DEFAULT_MSG FLTK_LIBRARIES FLTK_INCLUDE_DIR FLTK_FLUID_EXECUTABLE) -ENDIF() +endif() -IF(FLTK_FOUND) - IF(APPLE) - SET(FLTK_LIBRARIES ${FLTK_PLATFORM_DEPENDENT_LIBS} ${FLTK_LIBRARIES}) - ELSE(APPLE) - SET(FLTK_LIBRARIES ${FLTK_LIBRARIES} ${FLTK_PLATFORM_DEPENDENT_LIBS}) - ENDIF(APPLE) +if(FLTK_FOUND) + if(APPLE) + set(FLTK_LIBRARIES ${FLTK_PLATFORM_DEPENDENT_LIBS} ${FLTK_LIBRARIES}) + else() + set(FLTK_LIBRARIES ${FLTK_LIBRARIES} ${FLTK_PLATFORM_DEPENDENT_LIBS}) + endif() # The following deprecated settings are for compatibility with CMake 1.4 - SET (HAS_FLTK ${FLTK_FOUND}) - SET (FLTK_INCLUDE_PATH ${FLTK_INCLUDE_DIR}) - SET (FLTK_FLUID_EXE ${FLTK_FLUID_EXECUTABLE}) - SET (FLTK_LIBRARY ${FLTK_LIBRARIES}) -ENDIF(FLTK_FOUND) + set (HAS_FLTK ${FLTK_FOUND}) + set (FLTK_INCLUDE_PATH ${FLTK_INCLUDE_DIR}) + set (FLTK_FLUID_EXE ${FLTK_FLUID_EXECUTABLE}) + set (FLTK_LIBRARY ${FLTK_LIBRARIES}) +endif() diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake index 916474579..071c318ff 100644 --- a/Modules/FindFLTK2.cmake +++ b/Modules/FindFLTK2.cmake @@ -23,57 +23,57 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET (FLTK2_DIR $ENV{FLTK2_DIR} ) +set (FLTK2_DIR $ENV{FLTK2_DIR} ) # Platform dependent libraries required by FLTK2 -IF(WIN32) - IF(NOT CYGWIN) - IF(BORLAND) - SET( FLTK2_PLATFORM_DEPENDENT_LIBS import32 ) - ELSE(BORLAND) - SET( FLTK2_PLATFORM_DEPENDENT_LIBS wsock32 comctl32 ) - ENDIF(BORLAND) - ENDIF(NOT CYGWIN) -ENDIF(WIN32) - -IF(UNIX) - INCLUDE(${CMAKE_ROOT}/Modules/FindX11.cmake) - SET( FLTK2_PLATFORM_DEPENDENT_LIBS ${X11_LIBRARIES} -lm) -ENDIF(UNIX) - -IF(APPLE) - SET( FLTK2_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz") -ENDIF(APPLE) +if(WIN32) + if(NOT CYGWIN) + if(BORLAND) + set( FLTK2_PLATFORM_DEPENDENT_LIBS import32 ) + else() + set( FLTK2_PLATFORM_DEPENDENT_LIBS wsock32 comctl32 ) + endif() + endif() +endif() + +if(UNIX) + include(${CMAKE_ROOT}/Modules/FindX11.cmake) + set( FLTK2_PLATFORM_DEPENDENT_LIBS ${X11_LIBRARIES} -lm) +endif() + +if(APPLE) + set( FLTK2_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz") +endif() # If FLTK2_INCLUDE_DIR is already defined we assigne its value to FLTK2_DIR -IF(FLTK2_INCLUDE_DIR) - SET(FLTK2_DIR ${FLTK2_INCLUDE_DIR}) -ELSE(FLTK2_INCLUDE_DIR) - SET(FLTK2_INCLUDE_DIR ${FLTK2_DIR}) -ENDIF(FLTK2_INCLUDE_DIR) +if(FLTK2_INCLUDE_DIR) + set(FLTK2_DIR ${FLTK2_INCLUDE_DIR}) +else() + set(FLTK2_INCLUDE_DIR ${FLTK2_DIR}) +endif() # If FLTK2 has been built using CMake we try to find everything directly -SET(FLTK2_DIR_STRING "directory containing FLTK2Config.cmake. This is either the root of the build tree, or PREFIX/lib/fltk for an installation.") +set(FLTK2_DIR_STRING "directory containing FLTK2Config.cmake. This is either the root of the build tree, or PREFIX/lib/fltk for an installation.") # Search only if the location is not already known. -IF(NOT FLTK2_DIR) +if(NOT FLTK2_DIR) # Get the system search path as a list. - FILE(TO_CMAKE_PATH "$ENV{PATH}" FLTK2_DIR_SEARCH2) + file(TO_CMAKE_PATH "$ENV{PATH}" FLTK2_DIR_SEARCH2) # Construct a set of paths relative to the system search path. - SET(FLTK2_DIR_SEARCH "") - FOREACH(dir ${FLTK2_DIR_SEARCH2}) - SET(FLTK2_DIR_SEARCH ${FLTK2_DIR_SEARCH} "${dir}/../lib/fltk") - ENDFOREACH(dir) - STRING(REPLACE "//" "/" FLTK2_DIR_SEARCH "${FLTK2_DIR_SEARCH}") + set(FLTK2_DIR_SEARCH "") + foreach(dir ${FLTK2_DIR_SEARCH2}) + set(FLTK2_DIR_SEARCH ${FLTK2_DIR_SEARCH} "${dir}/../lib/fltk") + endforeach() + string(REPLACE "//" "/" FLTK2_DIR_SEARCH "${FLTK2_DIR_SEARCH}") # # Look for an installation or build tree. # - FIND_PATH(FLTK2_DIR FLTK2Config.cmake + find_path(FLTK2_DIR FLTK2Config.cmake # Look for an environment variable FLTK2_DIR. - $ENV{FLTK2_DIR} + ENV FLTK2_DIR # Look in places relative to the system executable search path. ${FLTK2_DIR_SEARCH} @@ -101,167 +101,167 @@ IF(NOT FLTK2_DIR) DOC "The ${FLTK2_DIR_STRING}" ) - IF(NOT FLTK2_DIR) - FIND_PATH(FLTK2_DIR fltk/run.h ${FLTK2_INCLUDE_SEARCH_PATH}) - ENDIF(NOT FLTK2_DIR) + if(NOT FLTK2_DIR) + find_path(FLTK2_DIR fltk/run.h ${FLTK2_INCLUDE_SEARCH_PATH}) + endif() -ENDIF(NOT FLTK2_DIR) +endif() # If FLTK2 was found, load the configuration file to get the rest of the # settings. -IF(FLTK2_DIR) +if(FLTK2_DIR) # Check if FLTK2 was built using CMake - IF(EXISTS ${FLTK2_DIR}/FLTK2Config.cmake) - SET(FLTK2_BUILT_WITH_CMAKE 1) - ENDIF(EXISTS ${FLTK2_DIR}/FLTK2Config.cmake) + if(EXISTS ${FLTK2_DIR}/FLTK2Config.cmake) + set(FLTK2_BUILT_WITH_CMAKE 1) + endif() - IF(FLTK2_BUILT_WITH_CMAKE) - SET(FLTK2_FOUND 1) - INCLUDE(${FLTK2_DIR}/FLTK2Config.cmake) + if(FLTK2_BUILT_WITH_CMAKE) + set(FLTK2_FOUND 1) + include(${FLTK2_DIR}/FLTK2Config.cmake) # Fluid - IF(FLUID_COMMAND) - SET(FLTK2_FLUID_EXECUTABLE ${FLUID_COMMAND} CACHE FILEPATH "Fluid executable") - ELSE(FLUID_COMMAND) - FIND_PROGRAM(FLTK2_FLUID_EXECUTABLE fluid2 PATHS + if(FLUID_COMMAND) + set(FLTK2_FLUID_EXECUTABLE ${FLUID_COMMAND} CACHE FILEPATH "Fluid executable") + else() + find_program(FLTK2_FLUID_EXECUTABLE fluid2 PATHS ${FLTK2_EXECUTABLE_DIRS} ${FLTK2_EXECUTABLE_DIRS}/RelWithDebInfo ${FLTK2_EXECUTABLE_DIRS}/Debug ${FLTK2_EXECUTABLE_DIRS}/Release NO_SYSTEM_PATH) - ENDIF(FLUID_COMMAND) + endif() - MARK_AS_ADVANCED(FLTK2_FLUID_EXECUTABLE) - SET( FLTK_FLUID_EXECUTABLE ${FLTK2_FLUID_EXECUTABLE} ) + mark_as_advanced(FLTK2_FLUID_EXECUTABLE) + set( FLTK_FLUID_EXECUTABLE ${FLTK2_FLUID_EXECUTABLE} ) - - SET(FLTK2_INCLUDE_DIR ${FLTK2_DIR}) - LINK_DIRECTORIES(${FLTK2_LIBRARY_DIRS}) - SET(FLTK2_BASE_LIBRARY fltk2) - SET(FLTK2_GL_LIBRARY fltk2_gl) - SET(FLTK2_IMAGES_LIBRARY fltk2_images) + set(FLTK2_INCLUDE_DIR ${FLTK2_DIR}) + link_directories(${FLTK2_LIBRARY_DIRS}) + + set(FLTK2_BASE_LIBRARY fltk2) + set(FLTK2_GL_LIBRARY fltk2_gl) + set(FLTK2_IMAGES_LIBRARY fltk2_images) # Add the extra libraries - LOAD_CACHE(${FLTK2_DIR} + load_cache(${FLTK2_DIR} READ_WITH_PREFIX FL FLTK2_USE_SYSTEM_JPEG FL FLTK2_USE_SYSTEM_PNG FL FLTK2_USE_SYSTEM_ZLIB ) - SET(FLTK2_IMAGES_LIBS "") - IF(FLFLTK2_USE_SYSTEM_JPEG) - SET(FLTK2_IMAGES_LIBS ${FLTK2_IMAGES_LIBS} fltk2_jpeg) - ENDIF(FLFLTK2_USE_SYSTEM_JPEG) - IF(FLFLTK2_USE_SYSTEM_PNG) - SET(FLTK2_IMAGES_LIBS ${FLTK2_IMAGES_LIBS} fltk2_png) - ENDIF(FLFLTK2_USE_SYSTEM_PNG) - IF(FLFLTK2_USE_SYSTEM_ZLIB) - SET(FLTK2_IMAGES_LIBS ${FLTK2_IMAGES_LIBS} fltk2_zlib) - ENDIF(FLFLTK2_USE_SYSTEM_ZLIB) - SET(FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}" CACHE INTERNAL + set(FLTK2_IMAGES_LIBS "") + if(FLFLTK2_USE_SYSTEM_JPEG) + set(FLTK2_IMAGES_LIBS ${FLTK2_IMAGES_LIBS} fltk2_jpeg) + endif() + if(FLFLTK2_USE_SYSTEM_PNG) + set(FLTK2_IMAGES_LIBS ${FLTK2_IMAGES_LIBS} fltk2_png) + endif() + if(FLFLTK2_USE_SYSTEM_ZLIB) + set(FLTK2_IMAGES_LIBS ${FLTK2_IMAGES_LIBS} fltk2_zlib) + endif() + set(FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}" CACHE INTERNAL "Extra libraries for fltk2_images library.") - ELSE(FLTK2_BUILT_WITH_CMAKE) + else() # if FLTK2 was not built using CMake # Find fluid executable. - FIND_PROGRAM(FLTK2_FLUID_EXECUTABLE fluid2 ${FLTK2_INCLUDE_DIR}/fluid) + find_program(FLTK2_FLUID_EXECUTABLE fluid2 ${FLTK2_INCLUDE_DIR}/fluid) # Use location of fluid to help find everything else. - SET(FLTK2_INCLUDE_SEARCH_PATH "") - SET(FLTK2_LIBRARY_SEARCH_PATH "") - IF(FLTK2_FLUID_EXECUTABLE) - SET( FLTK_FLUID_EXECUTABLE ${FLTK2_FLUID_EXECUTABLE} ) - GET_FILENAME_COMPONENT(FLTK2_BIN_DIR "${FLTK2_FLUID_EXECUTABLE}" PATH) - SET(FLTK2_INCLUDE_SEARCH_PATH ${FLTK2_INCLUDE_SEARCH_PATH} + set(FLTK2_INCLUDE_SEARCH_PATH "") + set(FLTK2_LIBRARY_SEARCH_PATH "") + if(FLTK2_FLUID_EXECUTABLE) + set( FLTK_FLUID_EXECUTABLE ${FLTK2_FLUID_EXECUTABLE} ) + get_filename_component(FLTK2_BIN_DIR "${FLTK2_FLUID_EXECUTABLE}" PATH) + set(FLTK2_INCLUDE_SEARCH_PATH ${FLTK2_INCLUDE_SEARCH_PATH} ${FLTK2_BIN_DIR}/../include ${FLTK2_BIN_DIR}/..) - SET(FLTK2_LIBRARY_SEARCH_PATH ${FLTK2_LIBRARY_SEARCH_PATH} + set(FLTK2_LIBRARY_SEARCH_PATH ${FLTK2_LIBRARY_SEARCH_PATH} ${FLTK2_BIN_DIR}/../lib) - SET(FLTK2_WRAP_UI 1) - ENDIF(FLTK2_FLUID_EXECUTABLE) + set(FLTK2_WRAP_UI 1) + endif() - SET(FLTK2_INCLUDE_SEARCH_PATH ${FLTK2_INCLUDE_SEARCH_PATH} + set(FLTK2_INCLUDE_SEARCH_PATH ${FLTK2_INCLUDE_SEARCH_PATH} /usr/local/fltk2 /usr/X11R6/include ) - FIND_PATH(FLTK2_INCLUDE_DIR fltk/run.h ${FLTK2_INCLUDE_SEARCH_PATH}) + find_path(FLTK2_INCLUDE_DIR fltk/run.h ${FLTK2_INCLUDE_SEARCH_PATH}) - SET(FLTK2_LIBRARY_SEARCH_PATH ${FLTK2_LIBRARY_SEARCH_PATH} + set(FLTK2_LIBRARY_SEARCH_PATH ${FLTK2_LIBRARY_SEARCH_PATH} /usr/local/fltk2/lib /usr/X11R6/lib ${FLTK2_INCLUDE_DIR}/lib ) - FIND_LIBRARY(FLTK2_BASE_LIBRARY NAMES fltk2 + find_library(FLTK2_BASE_LIBRARY NAMES fltk2 PATHS ${FLTK2_LIBRARY_SEARCH_PATH}) - FIND_LIBRARY(FLTK2_GL_LIBRARY NAMES fltk2_gl + find_library(FLTK2_GL_LIBRARY NAMES fltk2_gl PATHS ${FLTK2_LIBRARY_SEARCH_PATH}) - FIND_LIBRARY(FLTK2_IMAGES_LIBRARY NAMES fltk2_images + find_library(FLTK2_IMAGES_LIBRARY NAMES fltk2_images PATHS ${FLTK2_LIBRARY_SEARCH_PATH}) # Find the extra libraries needed for the fltk_images library. - IF(UNIX) - FIND_PROGRAM(FLTK2_CONFIG_SCRIPT fltk2-config PATHS ${FLTK2_BIN_DIR}) - IF(FLTK2_CONFIG_SCRIPT) - EXEC_PROGRAM(${FLTK2_CONFIG_SCRIPT} ARGS --use-images --ldflags + if(UNIX) + find_program(FLTK2_CONFIG_SCRIPT fltk2-config PATHS ${FLTK2_BIN_DIR}) + if(FLTK2_CONFIG_SCRIPT) + exec_program(${FLTK2_CONFIG_SCRIPT} ARGS --use-images --ldflags OUTPUT_VARIABLE FLTK2_IMAGES_LDFLAGS) - SET(FLTK2_LIBS_EXTRACT_REGEX ".*-lfltk2_images (.*) -lfltk2.*") - IF("${FLTK2_IMAGES_LDFLAGS}" MATCHES "${FLTK2_LIBS_EXTRACT_REGEX}") - STRING(REGEX REPLACE "${FLTK2_LIBS_EXTRACT_REGEX}" "\\1" + set(FLTK2_LIBS_EXTRACT_REGEX ".*-lfltk2_images (.*) -lfltk2.*") + if("${FLTK2_IMAGES_LDFLAGS}" MATCHES "${FLTK2_LIBS_EXTRACT_REGEX}") + string(REGEX REPLACE "${FLTK2_LIBS_EXTRACT_REGEX}" "\\1" FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LDFLAGS}") - STRING(REGEX REPLACE " +" ";" FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}") + string(REGEX REPLACE " +" ";" FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}") # The EXEC_PROGRAM will not be inherited into subdirectories from # the file that originally included this module. Save the answer. - SET(FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}" CACHE INTERNAL + set(FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}" CACHE INTERNAL "Extra libraries for fltk_images library.") - ENDIF("${FLTK2_IMAGES_LDFLAGS}" MATCHES "${FLTK2_LIBS_EXTRACT_REGEX}") - ENDIF(FLTK2_CONFIG_SCRIPT) - ENDIF(UNIX) + endif() + endif() + endif() - ENDIF(FLTK2_BUILT_WITH_CMAKE) -ENDIF(FLTK2_DIR) + endif() +endif() -SET(FLTK2_FOUND 1) -FOREACH(var FLTK2_FLUID_EXECUTABLE FLTK2_INCLUDE_DIR +set(FLTK2_FOUND 1) +foreach(var FLTK2_FLUID_EXECUTABLE FLTK2_INCLUDE_DIR FLTK2_BASE_LIBRARY FLTK2_GL_LIBRARY FLTK2_IMAGES_LIBRARY) - IF(NOT ${var}) - MESSAGE( STATUS "${var} not found" ) - SET(FLTK2_FOUND 0) - ENDIF(NOT ${var}) -ENDFOREACH(var) + if(NOT ${var}) + message( STATUS "${var} not found" ) + set(FLTK2_FOUND 0) + endif() +endforeach() -IF(FLTK2_FOUND) - SET(FLTK2_LIBRARIES ${FLTK2_IMAGES_LIBRARY} ${FLTK2_IMAGES_LIBS} ${FLTK2_BASE_LIBRARY} ${FLTK2_GL_LIBRARY} ) - IF(APPLE) - SET(FLTK2_LIBRARIES ${FLTK2_PLATFORM_DEPENDENT_LIBS} ${FLTK2_LIBRARIES}) - ELSE(APPLE) - SET(FLTK2_LIBRARIES ${FLTK2_LIBRARIES} ${FLTK2_PLATFORM_DEPENDENT_LIBS}) - ENDIF(APPLE) +if(FLTK2_FOUND) + set(FLTK2_LIBRARIES ${FLTK2_IMAGES_LIBRARY} ${FLTK2_IMAGES_LIBS} ${FLTK2_BASE_LIBRARY} ${FLTK2_GL_LIBRARY} ) + if(APPLE) + set(FLTK2_LIBRARIES ${FLTK2_PLATFORM_DEPENDENT_LIBS} ${FLTK2_LIBRARIES}) + else() + set(FLTK2_LIBRARIES ${FLTK2_LIBRARIES} ${FLTK2_PLATFORM_DEPENDENT_LIBS}) + endif() # The following deprecated settings are for compatibility with CMake 1.4 - SET (HAS_FLTK2 ${FLTK2_FOUND}) - SET (FLTK2_INCLUDE_PATH ${FLTK2_INCLUDE_DIR}) - SET (FLTK2_FLUID_EXE ${FLTK2_FLUID_EXECUTABLE}) - SET (FLTK2_LIBRARY ${FLTK2_LIBRARIES}) -ELSE(FLTK2_FOUND) + set (HAS_FLTK2 ${FLTK2_FOUND}) + set (FLTK2_INCLUDE_PATH ${FLTK2_INCLUDE_DIR}) + set (FLTK2_FLUID_EXE ${FLTK2_FLUID_EXECUTABLE}) + set (FLTK2_LIBRARY ${FLTK2_LIBRARIES}) +else() # make FIND_PACKAGE friendly - IF(NOT FLTK2_FIND_QUIETLY) - IF(FLTK2_FIND_REQUIRED) - MESSAGE(FATAL_ERROR + if(NOT FLTK2_FIND_QUIETLY) + if(FLTK2_FIND_REQUIRED) + message(FATAL_ERROR "FLTK2 required, please specify its location with FLTK2_DIR.") - ELSE(FLTK2_FIND_REQUIRED) - MESSAGE(STATUS "FLTK2 was not found.") - ENDIF(FLTK2_FIND_REQUIRED) - ENDIF(NOT FLTK2_FIND_QUIETLY) -ENDIF(FLTK2_FOUND) + else() + message(STATUS "FLTK2 was not found.") + endif() + endif() +endif() diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index e6f670256..1df239904 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -38,73 +38,77 @@ # Then from there, they need to set a bunch of #define's # so you can do something like: # #include FT_FREETYPE_H -# Unfortunately, using CMake's mechanisms like INCLUDE_DIRECTORIES() +# Unfortunately, using CMake's mechanisms like include_directories() # wants explicit full paths and this trickery doesn't work too well. # I'm going to attempt to cut out the middleman and hope # everything still works. -FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h +find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h HINTS - $ENV{FREETYPE_DIR} + ENV FREETYPE_DIR PATHS - /usr/local/X11R6/include - /usr/local/X11/include - /usr/freeware/include + /usr/X11R6 + /usr/local/X11R6 + /usr/local/X11 + /usr/freeware + PATH_SUFFIXES include/freetype2 include ) -FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h +find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h HINTS - $ENV{FREETYPE_DIR}/include/freetype2 + ENV FREETYPE_DIR PATHS - /usr/local/X11R6/include - /usr/local/X11/include - /usr/freeware/include - PATH_SUFFIXES freetype2 + /usr/X11R6 + /usr/local/X11R6 + /usr/local/X11 + /usr/freeware + PATH_SUFFIXES include/freetype2 include ) -FIND_LIBRARY(FREETYPE_LIBRARY +find_library(FREETYPE_LIBRARY NAMES freetype libfreetype freetype219 HINTS - $ENV{FREETYPE_DIR} - PATH_SUFFIXES lib64 lib + ENV FREETYPE_DIR + PATH_SUFFIXES lib PATHS + /usr/X11R6 /usr/local/X11R6 /usr/local/X11 /usr/freeware ) # set the user variables -IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) - SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}") -ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) -SET(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}") +if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) + set(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}") +endif() +set(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}") -IF(FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h") - FILE(STRINGS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h" freetype_version_str +if(FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h") + file(STRINGS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h" freetype_version_str REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$") - UNSET(FREETYPE_VERSION_STRING) - FOREACH(VPART MAJOR MINOR PATCH) - FOREACH(VLINE ${freetype_version_str}) - IF(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}") - STRING(REGEX REPLACE "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$" "\\1" + unset(FREETYPE_VERSION_STRING) + foreach(VPART MAJOR MINOR PATCH) + foreach(VLINE ${freetype_version_str}) + if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}") + string(REGEX REPLACE "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$" "\\1" FREETYPE_VERSION_PART "${VLINE}") - IF(FREETYPE_VERSION_STRING) - SET(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}") - ELSE(FREETYPE_VERSION_STRING) - SET(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}") - ENDIF(FREETYPE_VERSION_STRING) - UNSET(FREETYPE_VERSION_PART) - ENDIF() - ENDFOREACH(VLINE) - ENDFOREACH(VPART) -ENDIF(FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h") + if(FREETYPE_VERSION_STRING) + set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}") + else() + set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}") + endif() + unset(FREETYPE_VERSION_PART) + endif() + endforeach() + endforeach() +endif() # handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype REQUIRED_VARS FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS VERSION_VAR FREETYPE_VERSION_STRING) -MARK_AS_ADVANCED(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build) +mark_as_advanced(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build) diff --git a/Modules/FindGCCXML.cmake b/Modules/FindGCCXML.cmake index 261a5d180..05f08a639 100644 --- a/Modules/FindGCCXML.cmake +++ b/Modules/FindGCCXML.cmake @@ -16,7 +16,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(GCCXML +find_program(GCCXML NAMES gccxml ../GCC_XML/gccxml PATHS [HKEY_CURRENT_USER\\Software\\Kitware\\GCC_XML;loc] @@ -24,4 +24,4 @@ FIND_PROGRAM(GCCXML "C:/Program Files/GCC_XML" ) -MARK_AS_ADVANCED(GCCXML) +mark_as_advanced(GCCXML) diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake index c31bef5ca..6e898474b 100644 --- a/Modules/FindGDAL.cmake +++ b/Modules/FindGDAL.cmake @@ -28,22 +28,22 @@ # correspond to the ./configure --prefix=$GDAL_DIR # used in building gdal. # -# Created by Eric Wing. I'm not a gdal user, but OpenSceneGraph uses it +# Created by Eric Wing. I'm not a gdal user, but OpenSceneGraph uses it # for osgTerrain so I whipped this module together for completeness. # I actually don't know the conventions or where files are typically # placed in distros. # Any real gdal users are encouraged to correct this (but please don't -# break the OS X framework stuff when doing so which is what usually seems +# break the OS X framework stuff when doing so which is what usually seems # to happen). # This makes the presumption that you are include gdal.h like # #include "gdal.h" -FIND_PATH(GDAL_INCLUDE_DIR gdal.h +find_path(GDAL_INCLUDE_DIR gdal.h HINTS - $ENV{GDAL_DIR} - $ENV{GDAL_ROOT} + ENV GDAL_DIR + ENV GDAL_ROOT PATH_SUFFIXES include/gdal include/GDAL @@ -57,15 +57,15 @@ FIND_PATH(GDAL_INCLUDE_DIR gdal.h /opt ) -IF(UNIX) +if(UNIX) # Use gdal-config to obtain the library version (this should hopefully # allow us to -lgdal1.x.y where x.y are correct version) # For some reason, libgdal development packages do not contain # libgdal.so... - FIND_PROGRAM(GDAL_CONFIG gdal-config + find_program(GDAL_CONFIG gdal-config HINTS - $ENV{GDAL_DIR} - $ENV{GDAL_ROOT} + ENV GDAL_DIR + ENV GDAL_ROOT PATH_SUFFIXES bin PATHS /sw # Fink @@ -85,13 +85,13 @@ IF(UNIX) endif() endif() -FIND_LIBRARY(GDAL_LIBRARY +find_library(GDAL_LIBRARY NAMES ${_gdal_lib} gdal gdal_i gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL HINTS - $ENV{GDAL_DIR} - $ENV{GDAL_ROOT} + ENV GDAL_DIR + ENV GDAL_ROOT ${_gdal_libpath} - PATH_SUFFIXES lib64 lib + PATH_SUFFIXES lib PATHS /sw /opt/local diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake index 41e909805..90ff7377f 100644 --- a/Modules/FindGIF.cmake +++ b/Modules/FindGIF.cmake @@ -5,7 +5,7 @@ # GIF_VERSION, reports either version 4 or 3 (for everything before version 4) # # The minimum required version of giflib can be specified using the -# standard syntax, e.g. FIND_PACKAGE(GIF 4) +# standard syntax, e.g. find_package(GIF 4) # # $GIF_DIR is an environment variable that would # correspond to the ./configure --prefix=$GIF_DIR @@ -26,9 +26,9 @@ # Created by Eric Wing. # Modifications by Alexander Neundorf -FIND_PATH(GIF_INCLUDE_DIR gif_lib.h +find_path(GIF_INCLUDE_DIR gif_lib.h HINTS - $ENV{GIF_DIR} + ENV GIF_DIR PATH_SUFFIXES include PATHS ~/Library/Frameworks @@ -36,20 +36,20 @@ FIND_PATH(GIF_INCLUDE_DIR gif_lib.h ) # the gif library can have many names :-/ -SET(POTENTIAL_GIF_LIBS gif libgif ungif libungif giflib giflib4) +set(POTENTIAL_GIF_LIBS gif libgif ungif libungif giflib giflib4) -FIND_LIBRARY(GIF_LIBRARY +find_library(GIF_LIBRARY NAMES ${POTENTIAL_GIF_LIBS} HINTS - $ENV{GIF_DIR} - PATH_SUFFIXES lib64 lib + ENV GIF_DIR + PATH_SUFFIXES lib PATHS ~/Library/Frameworks /usr/freeware ) # see readme.txt -SET(GIF_LIBRARIES ${GIF_LIBRARY}) +set(GIF_LIBRARIES ${GIF_LIBRARY}) # Very basic version detection. # The GIF_LIB_VERSION string in gif_lib.h seems to be unreliable, since it seems @@ -57,24 +57,24 @@ SET(GIF_LIBRARIES ${GIF_LIBRARY}) # In version 4 the member UserData was added to GifFileType, so we check for this # one. # http://giflib.sourcearchive.com/documentation/4.1.4/files.html -IF(GIF_INCLUDE_DIR) - INCLUDE(CMakePushCheckState) - INCLUDE(CheckStructHasMember) +if(GIF_INCLUDE_DIR) + include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CheckStructHasMember.cmake) CMAKE_PUSH_CHECK_STATE() - SET(GIF_VERSION 3) - SET(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}") + set(GIF_VERSION 3) + set(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}") CHECK_STRUCT_HAS_MEMBER(GifFileType UserData gif_lib.h GIF_GifFileType_UserData ) - IF(GIF_GifFileType_UserData) - SET(GIF_VERSION 4) - ENDIF() + if(GIF_GifFileType_UserData) + set(GIF_VERSION 4) + endif() CMAKE_POP_CHECK_STATE() -ENDIF() +endif() # handle the QUIETLY and REQUIRED arguments and set GIF_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GIF REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR VERSION_VAR GIF_VERSION ) -MARK_AS_ADVANCED(GIF_INCLUDE_DIR GIF_LIBRARY) +mark_as_advanced(GIF_INCLUDE_DIR GIF_LIBRARY) diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake new file mode 100644 index 000000000..37dff0324 --- /dev/null +++ b/Modules/FindGLEW.cmake @@ -0,0 +1,30 @@ +# - Find the OpenGL Extension Wrangler Library (GLEW) +# This module defines the following variables: +# GLEW_INCLUDE_DIRS - include directories for GLEW +# GLEW_LIBRARIES - libraries to link against GLEW +# GLEW_FOUND - true if GLEW has been found and can be used + +#============================================================================= +# Copyright 2012 Benjamin Eikel +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +find_path(GLEW_INCLUDE_DIR GL/glew.h) +find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64) + +set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR}) +set(GLEW_LIBRARIES ${GLEW_LIBRARY}) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(GLEW + REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY) + +mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY) diff --git a/Modules/FindGLU.cmake b/Modules/FindGLU.cmake index 5198f11e1..0d36fad3d 100644 --- a/Modules/FindGLU.cmake +++ b/Modules/FindGLU.cmake @@ -16,13 +16,13 @@ # GLU library is now found by FindOpenGL.cmake # -MESSAGE(STATUS +message(STATUS "WARNING: you are using the obsolete 'GLU' package, please use 'OpenGL' instead") -INCLUDE(FindOpenGL) +include(${CMAKE_CURRENT_LIST_DIR}/FindOpenGL.cmake) -IF (OPENGL_GLU_FOUND) - SET (GLU_LIBRARY ${OPENGL_LIBRARIES}) - SET (GLU_INCLUDE_PATH ${OPENGL_INCLUDE_DIR}) -ENDIF (OPENGL_GLU_FOUND) +if (OPENGL_GLU_FOUND) + set (GLU_LIBRARY ${OPENGL_LIBRARIES}) + set (GLU_INCLUDE_PATH ${OPENGL_INCLUDE_DIR}) +endif () diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake index 82057792d..843d1389f 100644 --- a/Modules/FindGLUT.cmake +++ b/Modules/FindGLUT.cmake @@ -20,69 +20,83 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF (WIN32) - FIND_PATH( GLUT_INCLUDE_DIR NAMES GL/glut.h +if (WIN32) + find_path( GLUT_INCLUDE_DIR NAMES GL/glut.h PATHS ${GLUT_ROOT_PATH}/include ) - FIND_LIBRARY( GLUT_glut_LIBRARY NAMES glut glut32 freeglut + find_library( GLUT_glut_LIBRARY NAMES glut glut32 freeglut PATHS ${OPENGL_LIBRARY_DIR} ${GLUT_ROOT_PATH}/Release ) -ELSE (WIN32) - - IF (APPLE) +else () + + if (APPLE) # These values for Apple could probably do with improvement. - FIND_PATH( GLUT_INCLUDE_DIR glut.h + find_path( GLUT_INCLUDE_DIR glut.h /System/Library/Frameworks/GLUT.framework/Versions/A/Headers ${OPENGL_LIBRARY_DIR} ) - SET(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX") - SET(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX") - ELSE (APPLE) - - FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h + set(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX") + set(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX") + else () + + if (BEOS) + + set(_GLUT_INC_DIR /boot/develop/headers/os/opengl) + set(_GLUT_glut_LIB_DIR /boot/develop/lib/x86) + + else() + + find_library( GLUT_Xi_LIBRARY Xi + /usr/openwin/lib + ) + + find_library( GLUT_Xmu_LIBRARY Xmu + /usr/openwin/lib + ) + + endif () + + find_path( GLUT_INCLUDE_DIR GL/glut.h /usr/include/GL /usr/openwin/share/include /usr/openwin/include /opt/graphics/OpenGL/include /opt/graphics/OpenGL/contrib/libglut + ${_GLUT_INC_DIR} ) - - FIND_LIBRARY( GLUT_glut_LIBRARY glut - /usr/openwin/lib - ) - - FIND_LIBRARY( GLUT_Xi_LIBRARY Xi - /usr/openwin/lib - ) - - FIND_LIBRARY( GLUT_Xmu_LIBRARY Xmu + + find_library( GLUT_glut_LIBRARY glut /usr/openwin/lib + ${_GLUT_glut_LIB_DIR} ) - - ENDIF (APPLE) - -ENDIF (WIN32) -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + unset(_GLUT_INC_DIR) + unset(_GLUT_glut_LIB_DIR) + + endif () + +endif () + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT REQUIRED_VARS GLUT_glut_LIBRARY GLUT_INCLUDE_DIR) -IF (GLUT_FOUND) +if (GLUT_FOUND) # Is -lXi and -lXmu required on all platforms that have it? # If not, we need some way to figure out what platform we are on. - SET( GLUT_LIBRARIES + set( GLUT_LIBRARIES ${GLUT_glut_LIBRARY} ${GLUT_Xmu_LIBRARY} ${GLUT_Xi_LIBRARY} ${GLUT_cocoa_LIBRARY} ) - + #The following deprecated settings are for backwards compatibility with CMake1.4 - SET (GLUT_LIBRARY ${GLUT_LIBRARIES}) - SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) -ENDIF(GLUT_FOUND) + set (GLUT_LIBRARY ${GLUT_LIBRARIES}) + set (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) +endif() -MARK_AS_ADVANCED( +mark_as_advanced( GLUT_INCLUDE_DIR GLUT_glut_LIBRARY GLUT_Xmu_LIBRARY diff --git a/Modules/FindGTK.cmake b/Modules/FindGTK.cmake index e9cc62f20..8a44ade41 100644 --- a/Modules/FindGTK.cmake +++ b/Modules/FindGTK.cmake @@ -18,9 +18,9 @@ # License text for the above reference.) # don't even bother under WIN32 -IF(UNIX) +if(UNIX) - FIND_PATH( GTK_gtk_INCLUDE_PATH NAMES gtk/gtk.h + find_path( GTK_gtk_INCLUDE_PATH NAMES gtk/gtk.h PATH_SUFFIXES gtk-1.2 gtk12 PATHS /usr/openwin/share/include @@ -33,7 +33,7 @@ IF(UNIX) # for both. # - Atanas Georgiev - FIND_PATH( GTK_glibconfig_INCLUDE_PATH NAMES glibconfig.h + find_path( GTK_glibconfig_INCLUDE_PATH NAMES glibconfig.h PATHS /usr/openwin/share/include /usr/local/include/glib12 @@ -43,7 +43,7 @@ IF(UNIX) /opt/gnome/lib/glib/include ) - FIND_PATH( GTK_glib_INCLUDE_PATH NAMES glib.h + find_path( GTK_glib_INCLUDE_PATH NAMES glib.h PATH_SUFFIXES gtk-1.2 glib-1.2 glib12 PATHS /usr/openwin/share/include @@ -51,12 +51,12 @@ IF(UNIX) /opt/gnome/include ) - FIND_PATH( GTK_gtkgl_INCLUDE_PATH NAMES gtkgl/gtkglarea.h + find_path( GTK_gtkgl_INCLUDE_PATH NAMES gtkgl/gtkglarea.h PATHS /usr/openwin/share/include /opt/gnome/include ) - FIND_LIBRARY( GTK_gtkgl_LIBRARY gtkgl + find_library( GTK_gtkgl_LIBRARY gtkgl /usr/openwin/lib /opt/gnome/lib ) @@ -65,43 +65,43 @@ IF(UNIX) # The 12 suffix is thanks to the FreeBSD ports collection # - FIND_LIBRARY( GTK_gtk_LIBRARY + find_library( GTK_gtk_LIBRARY NAMES gtk gtk12 PATHS /usr/openwin/lib /opt/gnome/lib ) - FIND_LIBRARY( GTK_gdk_LIBRARY + find_library( GTK_gdk_LIBRARY NAMES gdk gdk12 PATHS /usr/openwin/lib /opt/gnome/lib ) - FIND_LIBRARY( GTK_gmodule_LIBRARY + find_library( GTK_gmodule_LIBRARY NAMES gmodule gmodule12 PATHS /usr/openwin/lib /opt/gnome/lib ) - FIND_LIBRARY( GTK_glib_LIBRARY + find_library( GTK_glib_LIBRARY NAMES glib glib12 PATHS /usr/openwin/lib /opt/gnome/lib ) - FIND_LIBRARY( GTK_Xi_LIBRARY - NAMES Xi - PATHS /usr/openwin/lib - /opt/gnome/lib - ) + find_library( GTK_Xi_LIBRARY + NAMES Xi + PATHS /usr/openwin/lib + /opt/gnome/lib + ) - FIND_LIBRARY( GTK_gthread_LIBRARY + find_library( GTK_gthread_LIBRARY NAMES gthread gthread12 PATHS /usr/openwin/lib /opt/gnome/lib ) - IF(GTK_gtk_INCLUDE_PATH + if(GTK_gtk_INCLUDE_PATH AND GTK_glibconfig_INCLUDE_PATH AND GTK_glib_INCLUDE_PATH AND GTK_gtk_LIBRARY @@ -110,42 +110,38 @@ IF(UNIX) # Assume that if gtk and glib were found, the other # supporting libraries have also been found. - SET( GTK_FOUND "YES" ) - SET( GTK_INCLUDE_DIR ${GTK_gtk_INCLUDE_PATH} + set( GTK_FOUND "YES" ) + set( GTK_INCLUDE_DIR ${GTK_gtk_INCLUDE_PATH} ${GTK_glibconfig_INCLUDE_PATH} ${GTK_glib_INCLUDE_PATH} ) - SET( GTK_LIBRARIES ${GTK_gtk_LIBRARY} + set( GTK_LIBRARIES ${GTK_gtk_LIBRARY} ${GTK_gdk_LIBRARY} ${GTK_glib_LIBRARY} ) - IF(GTK_gmodule_LIBRARY) - SET(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_gmodule_LIBRARY}) - ENDIF(GTK_gmodule_LIBRARY) - IF(GTK_gthread_LIBRARY) - SET(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_gthread_LIBRARY}) - ENDIF(GTK_gthread_LIBRARY) - IF(GTK_Xi_LIBRARY) - SET(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_Xi_LIBRARY}) - ENDIF(GTK_Xi_LIBRARY) - - IF(GTK_gtkgl_INCLUDE_PATH AND GTK_gtkgl_LIBRARY) - SET( GTK_GL_FOUND "YES" ) - SET( GTK_INCLUDE_DIR ${GTK_INCLUDE_DIR} + if(GTK_gmodule_LIBRARY) + set(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_gmodule_LIBRARY}) + endif() + if(GTK_gthread_LIBRARY) + set(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_gthread_LIBRARY}) + endif() + if(GTK_Xi_LIBRARY) + set(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_Xi_LIBRARY}) + endif() + + if(GTK_gtkgl_INCLUDE_PATH AND GTK_gtkgl_LIBRARY) + set( GTK_GL_FOUND "YES" ) + set( GTK_INCLUDE_DIR ${GTK_INCLUDE_DIR} ${GTK_gtkgl_INCLUDE_PATH} ) - SET( GTK_LIBRARIES ${GTK_gtkgl_LIBRARY} ${GTK_LIBRARIES} ) - MARK_AS_ADVANCED( + set( GTK_LIBRARIES ${GTK_gtkgl_LIBRARY} ${GTK_LIBRARIES} ) + mark_as_advanced( GTK_gtkgl_LIBRARY GTK_gtkgl_INCLUDE_PATH ) - ENDIF(GTK_gtkgl_INCLUDE_PATH AND GTK_gtkgl_LIBRARY) + endif() - ENDIF(GTK_gtk_INCLUDE_PATH - AND GTK_glibconfig_INCLUDE_PATH - AND GTK_glib_INCLUDE_PATH - AND GTK_gtk_LIBRARY - AND GTK_glib_LIBRARY) + endif() - MARK_AS_ADVANCED( + mark_as_advanced( GTK_gdk_LIBRARY GTK_glib_INCLUDE_PATH GTK_glib_LIBRARY @@ -159,7 +155,7 @@ IF(UNIX) GTK_gtkgl_LIBRARY ) -ENDIF(UNIX) +endif() diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index a03c023e4..06cf96244 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -54,7 +54,7 @@ #============================================================================= # Copyright 2009 Kitware, Inc. -# Copyright 2008-2009 Philip Lowman +# Copyright 2008-2012 Philip Lowman # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -66,10 +66,13 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +# Version 1.4 (10/4/2012) (CMake 2.8.10) +# * 12596: Missing paths for FindGTK2 on NetBSD +# * 12049: Fixed detection of GTK include files in the lib folder on +# multiarch systems. # Version 1.3 (11/9/2010) (CMake 2.8.4) # * 11429: Add support for detecting GTK2 built with Visual Studio 10. # Thanks to Vincent Levesque for the patch. - # Version 1.2 (8/30/2010) (CMake 2.8.3) # * Merge patch for detecting gdk-pixbuf library (split off # from core GTK in 2.21). Thanks to Vincent Untz for the patch @@ -114,12 +117,12 @@ # _gtkversion_hdr = Header file to parse #============================================================= function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr) - file(READ ${_gtkversion_hdr} _contents) + file(STRINGS ${_gtkversion_hdr} _contents REGEX "#define GTK_M[A-Z]+_VERSION[ \t]+") if(_contents) string(REGEX REPLACE ".*#define GTK_MAJOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_major} "${_contents}") string(REGEX REPLACE ".*#define GTK_MINOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_minor} "${_contents}") string(REGEX REPLACE ".*#define GTK_MICRO_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_micro} "${_contents}") - + if(NOT ${_OUT_major} MATCHES "[0-9]+") message(FATAL_ERROR "Version parsing failed for GTK2_MAJOR_VERSION!") endif() @@ -151,7 +154,7 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) "_GTK2_FIND_INCLUDE_DIR( ${_var} ${_hdr} )") endif() - set(_relatives + set(_gtk_packages # If these ever change, things will break. ${GTK2_ADDITIONAL_SUFFIXES} glibmm-2.4 @@ -172,8 +175,15 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) sigc++-2.0 ) + # + # NOTE: The following suffixes cause searching for header files in both of + # these directories: + # /usr/include/ + # /usr/lib//include + # + set(_suffixes) - foreach(_d ${_relatives}) + foreach(_d ${_gtk_packages}) list(APPEND _suffixes ${_d}) list(APPEND _suffixes ${_d}/include) # for /usr/lib/gtk-2.0/include endforeach() @@ -183,8 +193,15 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) "include suffixes = ${_suffixes}") endif() + if(CMAKE_LIBRARY_ARCHITECTURE) + set(_gtk2_arch_dir /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}) + if(GTK2_DEBUG) + message(STATUS "Adding ${_gtk2_arch_dir} to search path for multiarch support") + endif() + endif() find_path(${_var} ${_hdr} PATHS + ${_gtk2_arch_dir} /usr/local/lib64 /usr/local/lib /usr/lib64 @@ -197,6 +214,8 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) /sw/lib /opt/local/include /opt/local/lib + /usr/pkg/lib + /usr/pkg/include/glib $ENV{GTKMM_BASEPATH}/include $ENV{GTKMM_BASEPATH}/lib [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/include @@ -214,7 +233,7 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) endif() endif() -endfunction(_GTK2_FIND_INCLUDE_DIR) +endfunction() #============================================================= # _GTK2_FIND_LIBRARY @@ -269,7 +288,7 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) set(_lib_list ${_library}) set(_libd_list ${_library_d}) endif() - + if(GTK2_DEBUG) message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " "library list = ${_lib_list} and library debug list = ${_libd_list}") @@ -301,13 +320,11 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) "While searching for ${_var}, our proposed library list is ${_lib_list}") endif() - find_library(${_var} + find_library(${_var} NAMES ${_lib_list} PATHS /opt/gnome/lib - /opt/gnome/lib64 /usr/openwin/lib - /usr/openwin/lib64 /sw/lib $ENV{GTKMM_BASEPATH}/lib [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib @@ -345,7 +362,7 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) set(${_var}_DEBUG ${${_var}}) set(${_var}_DEBUG ${${_var}} PARENT_SCOPE) endif() -endfunction(_GTK2_FIND_LIBRARY) +endfunction() #============================================================= @@ -405,8 +422,8 @@ if(GTK2_FIND_VERSION) else() message(FATAL_ERROR "GTK2 version check failed. Version ${GTK2_VERSION} was found, at least version ${GTK2_FIND_VERSION} is required") endif() - endif() - + endif() + # If the version check fails, exit out of the module here return() endif() @@ -422,28 +439,19 @@ list(APPEND GTK2_LIBRARIES ${FREETYPE_LIBRARIES}) foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) if(_GTK2_component STREQUAL "gtk") - _GTK2_FIND_INCLUDE_DIR(GTK2_GLIB_INCLUDE_DIR glib.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBCONFIG_INCLUDE_DIR glibconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GLIB_LIBRARY glib false true) - - _GTK2_FIND_INCLUDE_DIR(GTK2_GOBJECT_INCLUDE_DIR gobject/gobject.h) - _GTK2_FIND_LIBRARY (GTK2_GOBJECT_LIBRARY gobject false true) - - _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_PIXBUF_INCLUDE_DIR gdk-pixbuf/gdk-pixbuf.h) - _GTK2_FIND_LIBRARY (GTK2_GDK_PIXBUF_LIBRARY gdk_pixbuf false true) - - _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_INCLUDE_DIR gdk/gdk.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG_INCLUDE_DIR gdkconfig.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GTK_INCLUDE_DIR gtk/gtk.h) if(UNIX) - _GTK2_FIND_LIBRARY (GTK2_GDK_LIBRARY gdk-x11 false true) _GTK2_FIND_LIBRARY (GTK2_GTK_LIBRARY gtk-x11 false true) + _GTK2_FIND_LIBRARY (GTK2_GDK_LIBRARY gdk-x11 false true) else() - _GTK2_FIND_LIBRARY (GTK2_GDK_LIBRARY gdk-win32 false true) _GTK2_FIND_LIBRARY (GTK2_GTK_LIBRARY gtk-win32 false true) + _GTK2_FIND_LIBRARY (GTK2_GDK_LIBRARY gdk-win32 false true) endif() + _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_INCLUDE_DIR gdk/gdk.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG_INCLUDE_DIR gdkconfig.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_CAIRO_INCLUDE_DIR cairo.h) _GTK2_FIND_LIBRARY (GTK2_CAIRO_LIBRARY cairo false false) @@ -452,34 +460,40 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(GTK2_PANGO_INCLUDE_DIR pango/pango.h) _GTK2_FIND_LIBRARY (GTK2_PANGO_LIBRARY pango false true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_PIXBUF_INCLUDE_DIR gdk-pixbuf/gdk-pixbuf.h) + _GTK2_FIND_LIBRARY (GTK2_GDK_PIXBUF_LIBRARY gdk_pixbuf false true) + + _GTK2_FIND_LIBRARY (GTK2_GIO_LIBRARY gio false true) + _GTK2_FIND_INCLUDE_DIR(GTK2_ATK_INCLUDE_DIR atk/atk.h) _GTK2_FIND_LIBRARY (GTK2_ATK_LIBRARY atk false true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GOBJECT_INCLUDE_DIR gobject/gobject.h) + _GTK2_FIND_LIBRARY (GTK2_GOBJECT_LIBRARY gobject false true) - elseif(_GTK2_component STREQUAL "gtkmm") - - _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMM_INCLUDE_DIR glibmm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMMCONFIG_INCLUDE_DIR glibmmconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GLIBMM_LIBRARY glibmm true true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GLIB_INCLUDE_DIR glib.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBCONFIG_INCLUDE_DIR glibconfig.h) + _GTK2_FIND_LIBRARY (GTK2_GLIB_LIBRARY glib false true) - _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMM_INCLUDE_DIR gdkmm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMMCONFIG_INCLUDE_DIR gdkmmconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GDKMM_LIBRARY gdkmm true true) + elseif(_GTK2_component STREQUAL "gtkmm") _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMM_INCLUDE_DIR gtkmm.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMMCONFIG_INCLUDE_DIR gtkmmconfig.h) _GTK2_FIND_LIBRARY (GTK2_GTKMM_LIBRARY gtkmm true true) - _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMM_INCLUDE_DIR cairomm/cairomm.h) - _GTK2_FIND_LIBRARY (GTK2_CAIROMM_LIBRARY cairomm true true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMM_INCLUDE_DIR gdkmm.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMMCONFIG_INCLUDE_DIR gdkmmconfig.h) + _GTK2_FIND_LIBRARY (GTK2_GDKMM_LIBRARY gdkmm true true) _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMM_INCLUDE_DIR pangomm.h) _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMMCONFIG_INCLUDE_DIR pangommconfig.h) _GTK2_FIND_LIBRARY (GTK2_PANGOMM_LIBRARY pangomm true true) - _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++_INCLUDE_DIR sigc++/sigc++.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++CONFIG_INCLUDE_DIR sigc++config.h) - _GTK2_FIND_LIBRARY (GTK2_SIGC++_LIBRARY sigc true true) + _GTK2_FIND_LIBRARY (GTK2_PANGOCAIRO_LIBRARY pangocairo true true) + + _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMM_INCLUDE_DIR cairomm/cairomm.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMMCONFIG_INCLUDE_DIR cairommconfig.h) + _GTK2_FIND_LIBRARY (GTK2_CAIROMM_LIBRARY cairomm true true) _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMM_INCLUDE_DIR giomm.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMMCONFIG_INCLUDE_DIR giommconfig.h) @@ -488,11 +502,20 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(GTK2_ATKMM_INCLUDE_DIR atkmm.h) _GTK2_FIND_LIBRARY (GTK2_ATKMM_LIBRARY atkmm true true) + _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMM_INCLUDE_DIR glibmm.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMMCONFIG_INCLUDE_DIR glibmmconfig.h) + _GTK2_FIND_LIBRARY (GTK2_GLIBMM_LIBRARY glibmm true true) + + _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++_INCLUDE_DIR sigc++/sigc++.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++CONFIG_INCLUDE_DIR sigc++config.h) + _GTK2_FIND_LIBRARY (GTK2_SIGC++_LIBRARY sigc true true) + + elseif(_GTK2_component STREQUAL "glade") _GTK2_FIND_INCLUDE_DIR(GTK2_GLADE_INCLUDE_DIR glade/glade.h) _GTK2_FIND_LIBRARY (GTK2_GLADE_LIBRARY glade false true) - + elseif(_GTK2_component STREQUAL "glademm") _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMM_INCLUDE_DIR libglademm.h) @@ -531,13 +554,13 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) GTK2_GTK_LIBRARY GTK2_GTK_INCLUDE_DIR - GTK2_GLIB_INCLUDE_DIR - GTK2_GLIBCONFIG_INCLUDE_DIR - GTK2_GLIB_LIBRARY - GTK2_GDK_INCLUDE_DIR GTK2_GDKCONFIG_INCLUDE_DIR GTK2_GDK_LIBRARY + + GTK2_GLIB_INCLUDE_DIR + GTK2_GLIBCONFIG_INCLUDE_DIR + GTK2_GLIB_LIBRARY ) elseif(_GTK2_component STREQUAL "gtkmm") FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "Some or all of the gtkmm libraries were not found." @@ -545,13 +568,14 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) GTK2_GTKMM_INCLUDE_DIR GTK2_GTKMMCONFIG_INCLUDE_DIR + GTK2_GDKMM_INCLUDE_DIR + GTK2_GDKMMCONFIG_INCLUDE_DIR + GTK2_GDKMM_LIBRARY + GTK2_GLIBMM_INCLUDE_DIR GTK2_GLIBMMCONFIG_INCLUDE_DIR GTK2_GLIBMM_LIBRARY - GTK2_GDKMM_INCLUDE_DIR - GTK2_GDKMMCONFIG_INCLUDE_DIR - GTK2_GDKMM_LIBRARY ) elseif(_GTK2_component STREQUAL "glade") FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glade library was not found." diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index 6cffb5c59..d531dd12d 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -98,7 +98,7 @@ function(_gtest_find_library _name) find_library(${_name} NAMES ${ARGN} HINTS - $ENV{GTEST_ROOT} + ENV GTEST_ROOT ${GTEST_ROOT} PATH_SUFFIXES ${_gtest_libpath_suffixes} ) diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index 6dbc02618..1a6bd39dd 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -39,182 +39,173 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge) +find_program(GETTEXT_MSGMERGE_EXECUTABLE msgmerge) -FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt) +find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt) -IF(GETTEXT_MSGMERGE_EXECUTABLE) - EXECUTE_PROCESS(COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --version +if(GETTEXT_MSGMERGE_EXECUTABLE) + execute_process(COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --version OUTPUT_VARIABLE gettext_version ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - IF (gettext_version MATCHES "^msgmerge \\(.*\\) [0-9]") - STRING(REGEX REPLACE "^msgmerge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1" GETTEXT_VERSION_STRING "${gettext_version}") - ENDIF() - UNSET(gettext_version) -ENDIF(GETTEXT_MSGMERGE_EXECUTABLE) + if (gettext_version MATCHES "^msgmerge \\(.*\\) [0-9]") + string(REGEX REPLACE "^msgmerge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1" GETTEXT_VERSION_STRING "${gettext_version}") + endif() + unset(gettext_version) +endif() -INCLUDE(FindPackageHandleStandardArgs) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE VERSION_VAR GETTEXT_VERSION_STRING) -INCLUDE(CMakeParseArguments) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) -FUNCTION(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name) - SET(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}") - GET_PROPERTY(currentCounter GLOBAL PROPERTY "${propertyName}") - IF(NOT currentCounter) - SET(currentCounter 1) - ENDIF() - SET(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE) - MATH(EXPR currentCounter "${currentCounter} + 1") - SET_PROPERTY(GLOBAL PROPERTY ${propertyName} ${currentCounter} ) -ENDFUNCTION() +function(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name) + set(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}") + get_property(currentCounter GLOBAL PROPERTY "${propertyName}") + if(NOT currentCounter) + set(currentCounter 1) + endif() + set(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE) + math(EXPR currentCounter "${currentCounter} + 1") + set_property(GLOBAL PROPERTY ${propertyName} ${currentCounter} ) +endfunction() -MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) +macro(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) # make it a real variable, so we can modify it here - SET(_firstPoFile "${_firstPoFileArg}") - - SET(_gmoFiles) - GET_FILENAME_COMPONENT(_potName ${_potFile} NAME) - STRING(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) - GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE) - - SET(_addToAll) - IF(${_firstPoFile} STREQUAL "ALL") - SET(_addToAll "ALL") - SET(_firstPoFile) - ENDIF(${_firstPoFile} STREQUAL "ALL") - - FOREACH (_currentPoFile ${_firstPoFile} ${ARGN}) - GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE) - GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH) - GET_FILENAME_COMPONENT(_lang ${_absFile} NAME_WE) - SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) - - ADD_CUSTOM_COMMAND( + set(_firstPoFile "${_firstPoFileArg}") + + set(_gmoFiles) + get_filename_component(_potName ${_potFile} NAME) + string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) + get_filename_component(_absPotFile ${_potFile} ABSOLUTE) + + set(_addToAll) + if(${_firstPoFile} STREQUAL "ALL") + set(_addToAll "ALL") + set(_firstPoFile) + endif() + + foreach (_currentPoFile ${_firstPoFile} ${ARGN}) + get_filename_component(_absFile ${_currentPoFile} ABSOLUTE) + get_filename_component(_abs_PATH ${_absFile} PATH) + get_filename_component(_lang ${_absFile} NAME_WE) + set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) + + add_custom_command( OUTPUT ${_gmoFile} COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} DEPENDS ${_absPotFile} ${_absFile} ) - INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) - SET(_gmoFiles ${_gmoFiles} ${_gmoFile}) + install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) + set(_gmoFiles ${_gmoFiles} ${_gmoFile}) - ENDFOREACH (_currentPoFile ) + endforeach () - IF(NOT TARGET translations) - ADD_CUSTOM_TARGET(translations) - ENDIF() + if(NOT TARGET translations) + add_custom_target(translations) + endif() _GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName) - ADD_CUSTOM_TARGET(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles}) + add_custom_target(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles}) - ADD_DEPENDENCIES(translations ${uniqueTargetName}) + add_dependencies(translations ${uniqueTargetName}) -ENDMACRO(GETTEXT_CREATE_TRANSLATIONS ) +endmacro() -FUNCTION(GETTEXT_PROCESS_POT_FILE _potFile) - SET(_gmoFiles) - SET(_options ALL) - SET(_oneValueArgs INSTALL_DESTINATION) - SET(_multiValueArgs LANGUAGES) +function(GETTEXT_PROCESS_POT_FILE _potFile) + set(_gmoFiles) + set(_options ALL) + set(_oneValueArgs INSTALL_DESTINATION) + set(_multiValueArgs LANGUAGES) CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) - GET_FILENAME_COMPONENT(_potName ${_potFile} NAME) - STRING(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) - GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE) + get_filename_component(_potName ${_potFile} NAME) + string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) + get_filename_component(_absPotFile ${_potFile} ABSOLUTE) - FOREACH (_lang ${_parsedArguments_LANGUAGES}) - SET(_poFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po") - SET(_gmoFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo") + foreach (_lang ${_parsedArguments_LANGUAGES}) + set(_poFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po") + set(_gmoFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo") - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT "${_poFile}" COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_poFile} ${_absPotFile} DEPENDS ${_absPotFile} ) - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT "${_gmoFile}" COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile} DEPENDS ${_absPotFile} ${_poFile} ) - IF(_parsedArguments_INSTALL_DESTINATION) - INSTALL(FILES ${_gmoFile} DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) - ENDIF(_parsedArguments_INSTALL_DESTINATION) - LIST(APPEND _gmoFiles ${_gmoFile}) - ENDFOREACH (_lang ) + if(_parsedArguments_INSTALL_DESTINATION) + install(FILES ${_gmoFile} DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) + endif() + list(APPEND _gmoFiles ${_gmoFile}) + endforeach () - IF(NOT TARGET potfiles) - ADD_CUSTOM_TARGET(potfiles) - ENDIF() + if(NOT TARGET potfiles) + add_custom_target(potfiles) + endif() _GETTEXT_GET_UNIQUE_TARGET_NAME( potfiles uniqueTargetName) - IF(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) - ELSE(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles}) - ENDIF(_parsedArguments_ALL) + if(_parsedArguments_ALL) + add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) + else() + add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles}) + endif() - ADD_DEPENDENCIES(potfiles ${uniqueTargetName}) + add_dependencies(potfiles ${uniqueTargetName}) -ENDFUNCTION(GETTEXT_PROCESS_POT_FILE) +endfunction() -FUNCTION(GETTEXT_PROCESS_PO_FILES _lang) - SET(_options ALL) - SET(_oneValueArgs INSTALL_DESTINATION) - SET(_multiValueArgs PO_FILES) - SET(_gmoFiles) +function(GETTEXT_PROCESS_PO_FILES _lang) + set(_options ALL) + set(_oneValueArgs INSTALL_DESTINATION) + set(_multiValueArgs PO_FILES) + set(_gmoFiles) CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) - FOREACH(_current_PO_FILE ${_parsedArguments_PO_FILES}) - GET_FILENAME_COMPONENT(_name ${_current_PO_FILE} NAME) - STRING(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name}) - SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo) - ADD_CUSTOM_COMMAND(OUTPUT ${_gmoFile} + foreach(_current_PO_FILE ${_parsedArguments_PO_FILES}) + get_filename_component(_name ${_current_PO_FILE} NAME) + string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name}) + set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo) + add_custom_command(OUTPUT ${_gmoFile} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" DEPENDS ${_current_PO_FILE} ) - IF(_parsedArguments_INSTALL_DESTINATION) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES/ RENAME ${_basename}.mo) - ENDIF(_parsedArguments_INSTALL_DESTINATION) - LIST(APPEND _gmoFiles ${_gmoFile}) - ENDFOREACH(_current_PO_FILE) + if(_parsedArguments_INSTALL_DESTINATION) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES/ RENAME ${_basename}.mo) + endif() + list(APPEND _gmoFiles ${_gmoFile}) + endforeach() - IF(NOT TARGET pofiles) - ADD_CUSTOM_TARGET(pofiles) - ENDIF() + if(NOT TARGET pofiles) + add_custom_target(pofiles) + endif() _GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName) - IF(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) - ELSE(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles}) - ENDIF(_parsedArguments_ALL) + if(_parsedArguments_ALL) + add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) + else() + add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles}) + endif() - ADD_DEPENDENCIES(pofiles ${uniqueTargetName}) + add_dependencies(pofiles ${uniqueTargetName}) -ENDFUNCTION(GETTEXT_PROCESS_PO_FILES) - -IF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) - SET(GETTEXT_FOUND TRUE) -ELSE (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) - SET(GETTEXT_FOUND FALSE) - IF (GetText_REQUIRED) - MESSAGE(FATAL_ERROR "GetText not found") - ENDIF (GetText_REQUIRED) -ENDIF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) +endfunction() diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake index f89d1afa3..41d2a7a8c 100644 --- a/Modules/FindGit.cmake +++ b/Modules/FindGit.cmake @@ -51,7 +51,7 @@ if(GIT_EXECUTABLE) string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}") endif() unset(git_version) -endif(GIT_EXECUTABLE) +endif() # Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if # all listed variables are TRUE diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake index 02f29648a..7315f1dd4 100644 --- a/Modules/FindGnuTLS.cmake +++ b/Modules/FindGnuTLS.cmake @@ -26,44 +26,44 @@ # Note that this doesn't try to find the gnutls-extra package. -IF (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY) +if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY) # in cache already - SET(gnutls_FIND_QUIETLY TRUE) -ENDIF (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY) + set(gnutls_FIND_QUIETLY TRUE) +endif () -IF (NOT WIN32) +if (NOT WIN32) # try using pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls + # in the find_path() and find_library() calls # also fills in GNUTLS_DEFINITIONS, although that isn't normally useful - FIND_PACKAGE(PkgConfig QUIET) + find_package(PkgConfig QUIET) PKG_CHECK_MODULES(PC_GNUTLS QUIET gnutls) - SET(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER}) - SET(GNUTLS_VERSION_STRING ${PC_GNUTLS_VERSION}) -ENDIF (NOT WIN32) + set(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER}) + set(GNUTLS_VERSION_STRING ${PC_GNUTLS_VERSION}) +endif () -FIND_PATH(GNUTLS_INCLUDE_DIR gnutls/gnutls.h +find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h HINTS ${PC_GNUTLS_INCLUDEDIR} ${PC_GNUTLS_INCLUDE_DIRS} ) -FIND_LIBRARY(GNUTLS_LIBRARY NAMES gnutls libgnutls +find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls HINTS ${PC_GNUTLS_LIBDIR} ${PC_GNUTLS_LIBRARY_DIRS} ) -MARK_AS_ADVANCED(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY) +mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY) -# handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS REQUIRED_VARS GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR VERSION_VAR GNUTLS_VERSION_STRING) -IF(GNUTLS_FOUND) - SET(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY}) - SET(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR}) -ENDIF() +if(GNUTLS_FOUND) + set(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY}) + set(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR}) +endif() diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake index b8dc3f49a..f2f9dd059 100644 --- a/Modules/FindGnuplot.cmake +++ b/Modules/FindGnuplot.cmake @@ -21,10 +21,10 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(FindCygwin) +include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) -FIND_PROGRAM(GNUPLOT_EXECUTABLE - NAMES +find_program(GNUPLOT_EXECUTABLE + NAMES gnuplot pgnuplot wgnupl32 @@ -32,26 +32,26 @@ FIND_PROGRAM(GNUPLOT_EXECUTABLE ${CYGWIN_INSTALL_PATH}/bin ) -IF (GNUPLOT_EXECUTABLE) - EXECUTE_PROCESS(COMMAND "${GNUPLOT_EXECUTABLE}" --version +if (GNUPLOT_EXECUTABLE) + execute_process(COMMAND "${GNUPLOT_EXECUTABLE}" --version OUTPUT_VARIABLE GNUPLOT_OUTPUT_VARIABLE ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - STRING(REGEX REPLACE "^gnuplot ([0-9\\.]+)( patchlevel )?" "\\1." GNUPLOT_VERSION_STRING "${GNUPLOT_OUTPUT_VARIABLE}") - STRING(REGEX REPLACE "\\.$" "" GNUPLOT_VERSION_STRING "${GNUPLOT_VERSION_STRING}") - UNSET(GNUPLOT_OUTPUT_VARIABLE) -ENDIF() + string(REGEX REPLACE "^gnuplot ([0-9\\.]+)( patchlevel )?" "\\1." GNUPLOT_VERSION_STRING "${GNUPLOT_OUTPUT_VARIABLE}") + string(REGEX REPLACE "\\.$" "" GNUPLOT_VERSION_STRING "${GNUPLOT_VERSION_STRING}") + unset(GNUPLOT_OUTPUT_VARIABLE) +endif() # for compatibility -SET(GNUPLOT ${GNUPLOT_EXECUTABLE}) +set(GNUPLOT ${GNUPLOT_EXECUTABLE}) -# handle the QUIETLY and REQUIRED arguments and set GNUPLOT_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set GNUPLOT_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gnuplot REQUIRED_VARS GNUPLOT_EXECUTABLE VERSION_VAR GNUPLOT_VERSION_STRING) -MARK_AS_ADVANCED( GNUPLOT_EXECUTABLE ) +mark_as_advanced( GNUPLOT_EXECUTABLE ) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index bc606389b..851416439 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -25,7 +25,7 @@ # In addition to finding the includes and libraries required to compile an HDF5 # client application, this module also makes an effort to find tools that come # with the HDF5 distribution that may be useful for regression testing. -# +# # This module will define the following variables: # HDF5_INCLUDE_DIRS - Location of the hdf5 includes # HDF5_INCLUDE_DIR - Location of the hdf5 includes (deprecated) @@ -60,11 +60,11 @@ # This module is maintained by Will Dicharry . -include(SelectLibraryConfigurations) +include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) # List of the valid HDF5 components -set( HDF5_VALID_COMPONENTS +set( HDF5_VALID_COMPONENTS C CXX Fortran @@ -110,10 +110,10 @@ find_program( HDF5_Fortran_COMPILER_EXECUTABLE DOC "HDF5 Fortran Wrapper compiler. Used only to detect HDF5 compile flags." ) mark_as_advanced( HDF5_Fortran_COMPILER_EXECUTABLE ) -find_program( HDF5_DIFF_EXECUTABLE +find_program( HDF5_DIFF_EXECUTABLE NAMES h5diff HINTS ENV HDF5_ROOT - PATH_SUFFIXES bin Bin + PATH_SUFFIXES bin Bin DOC "HDF5 file differencing tool." ) mark_as_advanced( HDF5_DIFF_EXECUTABLE ) @@ -121,7 +121,7 @@ mark_as_advanced( HDF5_DIFF_EXECUTABLE ) # return_value argument, the text output is stored to the output variable. macro( _HDF5_invoke_compiler language output return_value ) if( HDF5_${language}_COMPILER_EXECUTABLE ) - exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE} + exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE} ARGS -show OUTPUT_VARIABLE ${output} RETURN_VALUE ${return_value} @@ -129,14 +129,14 @@ macro( _HDF5_invoke_compiler language output return_value ) if( ${${return_value}} EQUAL 0 ) # do nothing else() - message( STATUS + message( STATUS "Unable to determine HDF5 ${language} flags from HDF5 wrapper." ) endif() endif() endmacro() # Parse a compile line for definitions, includes, library paths, and libraries. -macro( _HDF5_parse_compile_line +macro( _HDF5_parse_compile_line compile_line_var include_paths definitions @@ -144,7 +144,7 @@ macro( _HDF5_parse_compile_line libraries ) # Match the include paths - string( REGEX MATCHALL "-I([^\" ]+)" include_path_flags + string( REGEX MATCHALL "-I([^\" ]+)" include_path_flags "${${compile_line_var}}" ) foreach( IPATH ${include_path_flags} ) @@ -163,7 +163,7 @@ macro( _HDF5_parse_compile_line string( REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" library_path_flags "${${compile_line_var}}" ) - + foreach( LPATH ${library_path_flags} ) string( REGEX REPLACE "^-L" "" LPATH ${LPATH} ) string( REGEX REPLACE "//" "/" LPATH ${LPATH} ) @@ -219,7 +219,7 @@ if( NOT HDF5_FOUND ) ${HDF5_C_LIBRARY_NAMES_INIT} ) set( HDF5_Fortran_HL_LIBRARY_NAMES_INIT hdf5hl_fortran ${HDF5_Fortran_LIBRARY_NAMES_INIT} ) - + foreach( LANGUAGE ${HDF5_LANGUAGE_BINDINGS} ) if( HDF5_${LANGUAGE}_COMPILE_LINE ) _HDF5_parse_compile_line( HDF5_${LANGUAGE}_COMPILE_LINE @@ -228,7 +228,7 @@ if( NOT HDF5_FOUND ) HDF5_${LANGUAGE}_LIBRARY_DIRS HDF5_${LANGUAGE}_LIBRARY_NAMES ) - + # take a guess that the includes may be in the 'include' sibling # directory of a library directory. foreach( dir ${HDF5_${LANGUAGE}_LIBRARY_DIRS} ) @@ -238,7 +238,7 @@ if( NOT HDF5_FOUND ) # set the definitions for the language bindings. list( APPEND HDF5_DEFINITIONS ${HDF5_${LANGUAGE}_DEFINITIONS} ) - + # find the HDF5 include directories if(${LANGUAGE} MATCHES "Fortran.*") set(HDF5_INCLUDE_FILENAME hdf5.mod) @@ -251,7 +251,7 @@ if( NOT HDF5_FOUND ) ${HDF5_${LANGUAGE}_INCLUDE_FLAGS} ENV HDF5_ROOT - PATHS + PATHS $ENV{HOME}/.local/include PATH_SUFFIXES include @@ -259,11 +259,11 @@ if( NOT HDF5_FOUND ) ) mark_as_advanced( HDF5_${LANGUAGE}_INCLUDE_DIR ) list( APPEND HDF5_INCLUDE_DIRS ${HDF5_${LANGUAGE}_INCLUDE_DIR} ) - - set( HDF5_${LANGUAGE}_LIBRARY_NAMES - ${HDF5_${LANGUAGE}_LIBRARY_NAMES_INIT} + + set( HDF5_${LANGUAGE}_LIBRARY_NAMES + ${HDF5_${LANGUAGE}_LIBRARY_NAMES_INIT} ${HDF5_${LANGUAGE}_LIBRARY_NAMES} ) - + # find the HDF5 libraries foreach( LIB ${HDF5_${LANGUAGE}_LIBRARY_NAMES} ) if( UNIX AND HDF5_USE_STATIC_LIBRARIES ) @@ -278,15 +278,15 @@ if( NOT HDF5_FOUND ) set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ) set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ) endif() - find_library( HDF5_${LIB}_LIBRARY_DEBUG - NAMES ${THIS_LIBRARY_SEARCH_DEBUG} - HINTS ${HDF5_${LANGUAGE}_LIBRARY_DIRS} - ENV HDF5_ROOT + find_library( HDF5_${LIB}_LIBRARY_DEBUG + NAMES ${THIS_LIBRARY_SEARCH_DEBUG} + HINTS ${HDF5_${LANGUAGE}_LIBRARY_DIRS} + ENV HDF5_ROOT PATH_SUFFIXES lib Lib ) find_library( HDF5_${LIB}_LIBRARY_RELEASE - NAMES ${THIS_LIBRARY_SEARCH_RELEASE} - HINTS ${HDF5_${LANGUAGE}_LIBRARY_DIRS} - ENV HDF5_ROOT + NAMES ${THIS_LIBRARY_SEARCH_RELEASE} + HINTS ${HDF5_${LANGUAGE}_LIBRARY_DIRS} + ENV HDF5_ROOT PATH_SUFFIXES lib Lib ) select_library_configurations( HDF5_${LIB} ) # even though we adjusted the individual library names in @@ -297,16 +297,16 @@ if( NOT HDF5_FOUND ) # up by the selection macro above) because it may specify debug and # optimized variants for a particular library, but a list of # libraries is allowed to specify debug and optimized only once. - list( APPEND HDF5_${LANGUAGE}_LIBRARIES_DEBUG + list( APPEND HDF5_${LANGUAGE}_LIBRARIES_DEBUG ${HDF5_${LIB}_LIBRARY_DEBUG} ) - list( APPEND HDF5_${LANGUAGE}_LIBRARIES_RELEASE + list( APPEND HDF5_${LANGUAGE}_LIBRARIES_RELEASE ${HDF5_${LIB}_LIBRARY_RELEASE} ) endforeach() list( APPEND HDF5_LIBRARY_DIRS ${HDF5_${LANGUAGE}_LIBRARY_DIRS} ) - + # Append the libraries for this language binding to the list of all # required libraries. - list( APPEND HDF5_LIBRARIES_DEBUG + list( APPEND HDF5_LIBRARIES_DEBUG ${HDF5_${LANGUAGE}_LIBRARIES_DEBUG} ) list( APPEND HDF5_LIBRARIES_RELEASE ${HDF5_${LANGUAGE}_LIBRARIES_RELEASE} ) @@ -358,7 +358,7 @@ if( NOT HDF5_FOUND ) set( HDF5_IS_PARALLEL FALSE ) foreach( _dir IN LISTS HDF5_INCLUDE_DIRS ) if( EXISTS "${_dir}/H5pubconf.h" ) - file( STRINGS "${_dir}/H5pubconf.h" + file( STRINGS "${_dir}/H5pubconf.h" HDF5_HAVE_PARALLEL_DEFINE REGEX "HAVE_PARALLEL 1" ) if( HDF5_HAVE_PARALLEL_DEFINE ) @@ -378,8 +378,8 @@ if( NOT HDF5_FOUND ) endif() -find_package_handle_standard_args( HDF5 DEFAULT_MSG - HDF5_LIBRARIES +find_package_handle_standard_args( HDF5 DEFAULT_MSG + HDF5_LIBRARIES HDF5_INCLUDE_DIRS ) diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake index ca5709b62..71e55dad4 100644 --- a/Modules/FindHSPELL.cmake +++ b/Modules/FindHSPELL.cmake @@ -24,23 +24,24 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(HSPELL_INCLUDE_DIR hspell.h) +find_path(HSPELL_INCLUDE_DIR hspell.h) -FIND_LIBRARY(HSPELL_LIBRARIES NAMES hspell) +find_library(HSPELL_LIBRARIES NAMES hspell) -IF (HSPELL_INCLUDE_DIR) - FILE(READ "${HSPELL_INCLUDE_DIR}/hspell.h" HSPELL_H) - STRING(REGEX REPLACE ".*#define HSPELL_VERSION_MAJOR ([0-9]+).*" "\\1" HSPELL_VERSION_MAJOR "${HSPELL_H}") - STRING(REGEX REPLACE ".*#define HSPELL_VERSION_MINOR ([0-9]+).*" "\\1" HSPELL_VERSION_MINOR "${HSPELL_H}") - SET(HSPELL_VERSION_STRING "${HSPELL_VERSION_MAJOR}.${HSPELL_VERSION_MINOR}") -ENDIF() +if (HSPELL_INCLUDE_DIR) + file(STRINGS "${HSPELL_INCLUDE_DIR}/hspell.h" HSPELL_H REGEX "#define HSPELL_VERSION_M(AJO|INO)R [0-9]+") + string(REGEX REPLACE ".*#define HSPELL_VERSION_MAJOR ([0-9]+).*" "\\1" HSPELL_VERSION_MAJOR "${HSPELL_H}") + string(REGEX REPLACE ".*#define HSPELL_VERSION_MINOR ([0-9]+).*" "\\1" HSPELL_VERSION_MINOR "${HSPELL_H}") + set(HSPELL_VERSION_STRING "${HSPELL_VERSION_MAJOR}.${HSPELL_VERSION_MINOR}") + unset(HSPELL_H) +endif() -# handle the QUIETLY and REQUIRED arguments and set HSPELL_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set HSPELL_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL REQUIRED_VARS HSPELL_LIBRARIES HSPELL_INCLUDE_DIR VERSION_VAR HSPELL_VERSION_STRING) -MARK_AS_ADVANCED(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES) +mark_as_advanced(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES) diff --git a/Modules/FindHTMLHelp.cmake b/Modules/FindHTMLHelp.cmake index 4455b0797..c69e9e948 100644 --- a/Modules/FindHTMLHelp.cmake +++ b/Modules/FindHTMLHelp.cmake @@ -18,26 +18,26 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF(WIN32) +if(WIN32) - FIND_PROGRAM(HTML_HELP_COMPILER + find_program(HTML_HELP_COMPILER hhc "[HKEY_CURRENT_USER\\Software\\Microsoft\\HTML Help Workshop;InstallDir]" "$ENV{ProgramFiles}/HTML Help Workshop" - "C:/Program Files/HTML Help Workshop" + "C:/Program Files/HTML Help Workshop" ) - GET_FILENAME_COMPONENT(HTML_HELP_COMPILER_PATH "${HTML_HELP_COMPILER}" PATH) + get_filename_component(HTML_HELP_COMPILER_PATH "${HTML_HELP_COMPILER}" PATH) - FIND_PATH(HTML_HELP_INCLUDE_PATH - htmlhelp.h + find_path(HTML_HELP_INCLUDE_PATH + htmlhelp.h "${HTML_HELP_COMPILER_PATH}/include" "[HKEY_CURRENT_USER\\Software\\Microsoft\\HTML Help Workshop;InstallDir]/include" "$ENV{ProgramFiles}/HTML Help Workshop/include" - "C:/Program Files/HTML Help Workshop/include" + "C:/Program Files/HTML Help Workshop/include" ) - FIND_LIBRARY(HTML_HELP_LIBRARY + find_library(HTML_HELP_LIBRARY htmlhelp "${HTML_HELP_COMPILER_PATH}/lib" "[HKEY_CURRENT_USER\\Software\\Microsoft\\HTML Help Workshop;InstallDir]/lib" @@ -45,10 +45,10 @@ IF(WIN32) "C:/Program Files/HTML Help Workshop/lib" ) - MARK_AS_ADVANCED( + mark_as_advanced( HTML_HELP_COMPILER HTML_HELP_INCLUDE_PATH HTML_HELP_LIBRARY ) -ENDIF(WIN32) +endif() diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake new file mode 100644 index 000000000..a6a4aef24 --- /dev/null +++ b/Modules/FindHg.cmake @@ -0,0 +1,48 @@ +# The module defines the following variables: +# HG_EXECUTABLE - path to mercurial command line client (hg) +# HG_FOUND - true if the command line client was found +# HG_VERSION_STRING - the version of mercurial found +# Example usage: +# find_package(Hg) +# if(HG_FOUND) +# message("hg found: ${HG_EXECUTABLE}") +# endif() + +#============================================================================= +# Copyright 2010-2012 Kitware, Inc. +# Copyright 2012 Rolf Eike Beer +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +find_program(HG_EXECUTABLE + NAMES hg + PATH_SUFFIXES Mercurial + DOC "hg command line client" + ) +mark_as_advanced(HG_EXECUTABLE) + +if(HG_EXECUTABLE) + execute_process(COMMAND ${HG_EXECUTABLE} --version + OUTPUT_VARIABLE hg_version + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(hg_version MATCHES "^Mercurial Distributed SCM \\(version ([0-9][^)]*)\\)") + set(HG_VERSION_STRING "${CMAKE_MATCH_1}") + endif() + unset(hg_version) +endif() + +# Handle the QUIETLY and REQUIRED arguments and set HG_FOUND to TRUE if +# all listed variables are TRUE +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(Hg + REQUIRED_VARS HG_EXECUTABLE + VERSION_VAR HG_VERSION_STRING) diff --git a/Modules/FindITK.cmake b/Modules/FindITK.cmake index a3ca99899..b0b3f03f0 100644 --- a/Modules/FindITK.cmake +++ b/Modules/FindITK.cmake @@ -7,16 +7,16 @@ # that can be included to set the include directories, library directories, # and preprocessor macros. In addition to the variables read from # ITKConfig.cmake, this find module also defines -# ITK_DIR - The directory containing ITKConfig.cmake. -# This is either the root of the build tree, -# or the lib/InsightToolkit directory. +# ITK_DIR - The directory containing ITKConfig.cmake. +# This is either the root of the build tree, +# or the lib/InsightToolkit directory. # This is the only cache entry. -# -# ITK_FOUND - Whether ITK was found. If this is true, +# +# ITK_FOUND - Whether ITK was found. If this is true, # ITK_DIR is okay. # -# USE_ITK_FILE - The full path to the UseITK.cmake file. -# This is provided for backward +# USE_ITK_FILE - The full path to the UseITK.cmake file. +# This is provided for backward # compatability. Use ITK_USE_FILE # instead. @@ -36,22 +36,22 @@ # Use the Config mode of the find_package() command to find ITKConfig. # If this succeeds (possibly because ITK_DIR is already set), the # command will have already loaded ITKConfig.cmake and set ITK_FOUND. -IF(NOT ITK_FOUND) - SET(_ITK_REQUIRED "") - IF(ITK_FIND_REQUIRED) - SET(_ITK_REQUIRED REQUIRED) - ENDIF() - SET(_ITK_QUIET "") - IF(ITK_FIND_QUIETLY) - SET(_ITK_QUIET QUIET) - ENDIF() - FIND_PACKAGE(ITK ${_ITK_REQUIRED} ${_ITK_QUIET} NO_MODULE +if(NOT ITK_FOUND) + set(_ITK_REQUIRED "") + if(ITK_FIND_REQUIRED) + set(_ITK_REQUIRED REQUIRED) + endif() + set(_ITK_QUIET "") + if(ITK_FIND_QUIETLY) + set(_ITK_QUIET QUIET) + endif() + find_package(ITK ${_ITK_REQUIRED} ${_ITK_QUIET} NO_MODULE NAMES ITK InsightToolkit CONFIGS ITKConfig.cmake ) -ENDIF() +endif() -IF(ITK_FOUND) +if(ITK_FOUND) # Set USE_ITK_FILE for backward-compatability. - SET(USE_ITK_FILE ${ITK_USE_FILE}) -ENDIF() + set(USE_ITK_FILE ${ITK_USE_FILE}) +endif() diff --git a/Modules/FindIcotool.cmake b/Modules/FindIcotool.cmake new file mode 100644 index 000000000..8c101778d --- /dev/null +++ b/Modules/FindIcotool.cmake @@ -0,0 +1,56 @@ +# - Find icotool +# This module looks for icotool. This module defines the +# following values: +# ICOTOOL_EXECUTABLE: the full path to the icotool tool. +# ICOTOOL_FOUND: True if icotool has been found. +# ICOTOOL_VERSION_STRING: the version of icotool found. +# + +#============================================================================= +# Copyright 2012 Aleksey Avdeev +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +find_program(ICOTOOL_EXECUTABLE + icotool +) + +if(ICOTOOL_EXECUTABLE) + execute_process( + COMMAND ${ICOTOOL_EXECUTABLE} --version + OUTPUT_VARIABLE _icotool_version + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if("${_icotool_version}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*") + set( ICOTOOL_VERSION_STRING + "${CMAKE_MATCH_1}" + ) + else() + set( ICOTOOL_VERSION_STRING + "" + ) + endif() + unset(_icotool_version) +endif() + +# handle the QUIETLY and REQUIRED arguments and set ICOTOOL_FOUND to TRUE if +# all listed variables are TRUE +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( + Icotool + REQUIRED_VARS ICOTOOL_EXECUTABLE + VERSION_VAR ICOTOOL_VERSION_STRING +) + +mark_as_advanced( + ICOTOOL_EXECUTABLE +) diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index f21b63008..4aaefb75c 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -45,11 +45,11 @@ # ImageMagick__LIBRARIES - Full path to libraries. # # Example Usages: -# FIND_PACKAGE(ImageMagick) -# FIND_PACKAGE(ImageMagick COMPONENTS convert) -# FIND_PACKAGE(ImageMagick COMPONENTS convert mogrify display) -# FIND_PACKAGE(ImageMagick COMPONENTS Magick++) -# FIND_PACKAGE(ImageMagick COMPONENTS Magick++ convert) +# find_package(ImageMagick) +# find_package(ImageMagick COMPONENTS convert) +# find_package(ImageMagick COMPONENTS convert mogrify display) +# find_package(ImageMagick COMPONENTS Magick++) +# find_package(ImageMagick COMPONENTS Magick++ convert) # # Note that the standard FIND_PACKAGE features are supported # (i.e., QUIET, REQUIRED, etc.). @@ -72,10 +72,10 @@ #--------------------------------------------------------------------- # Helper functions #--------------------------------------------------------------------- -FUNCTION(FIND_IMAGEMAGICK_API component header) - SET(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE) +function(FIND_IMAGEMAGICK_API component header) + set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE) - FIND_PATH(ImageMagick_${component}_INCLUDE_DIR + find_path(ImageMagick_${component}_INCLUDE_DIR NAMES ${header} PATHS ${ImageMagick_INCLUDE_DIRS} @@ -84,150 +84,150 @@ FUNCTION(FIND_IMAGEMAGICK_API component header) ImageMagick DOC "Path to the ImageMagick include dir." ) - FIND_LIBRARY(ImageMagick_${component}_LIBRARY + find_library(ImageMagick_${component}_LIBRARY NAMES ${ARGN} PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/lib" DOC "Path to the ImageMagick Magick++ library." ) - IF(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY) - SET(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE) + if(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY) + set(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE) - LIST(APPEND ImageMagick_INCLUDE_DIRS + list(APPEND ImageMagick_INCLUDE_DIRS ${ImageMagick_${component}_INCLUDE_DIR} ) - LIST(REMOVE_DUPLICATES ImageMagick_INCLUDE_DIRS) - SET(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS} PARENT_SCOPE) + list(REMOVE_DUPLICATES ImageMagick_INCLUDE_DIRS) + set(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS} PARENT_SCOPE) - LIST(APPEND ImageMagick_LIBRARIES + list(APPEND ImageMagick_LIBRARIES ${ImageMagick_${component}_LIBRARY} ) - SET(ImageMagick_LIBRARIES ${ImageMagick_LIBRARIES} PARENT_SCOPE) - ENDIF(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY) -ENDFUNCTION(FIND_IMAGEMAGICK_API) + set(ImageMagick_LIBRARIES ${ImageMagick_LIBRARIES} PARENT_SCOPE) + endif() +endfunction() -FUNCTION(FIND_IMAGEMAGICK_EXE component) - SET(_IMAGEMAGICK_EXECUTABLE +function(FIND_IMAGEMAGICK_EXE component) + set(_IMAGEMAGICK_EXECUTABLE ${ImageMagick_EXECUTABLE_DIR}/${component}${CMAKE_EXECUTABLE_SUFFIX}) - IF(EXISTS ${_IMAGEMAGICK_EXECUTABLE}) - SET(ImageMagick_${component}_EXECUTABLE + if(EXISTS ${_IMAGEMAGICK_EXECUTABLE}) + set(ImageMagick_${component}_EXECUTABLE ${_IMAGEMAGICK_EXECUTABLE} PARENT_SCOPE ) - SET(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE) - ELSE(EXISTS ${_IMAGEMAGICK_EXECUTABLE}) - SET(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE) - ENDIF(EXISTS ${_IMAGEMAGICK_EXECUTABLE}) -ENDFUNCTION(FIND_IMAGEMAGICK_EXE) + set(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE) + else() + set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE) + endif() +endfunction() #--------------------------------------------------------------------- # Start Actual Work #--------------------------------------------------------------------- # Try to find a ImageMagick installation binary path. -FIND_PATH(ImageMagick_EXECUTABLE_DIR +find_path(ImageMagick_EXECUTABLE_DIR NAMES mogrify${CMAKE_EXECUTABLE_SUFFIX} PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]" DOC "Path to the ImageMagick binary directory." NO_DEFAULT_PATH ) -FIND_PATH(ImageMagick_EXECUTABLE_DIR +find_path(ImageMagick_EXECUTABLE_DIR NAMES mogrify${CMAKE_EXECUTABLE_SUFFIX} ) # Find each component. Search for all tools in same dir # ; otherwise they should be found # independently and not in a cohesive module such as this one. -UNSET(ImageMagick_REQUIRED_VARS) -UNSET(ImageMagick_DEFAULT_EXECUTABLES) -FOREACH(component ${ImageMagick_FIND_COMPONENTS} +unset(ImageMagick_REQUIRED_VARS) +unset(ImageMagick_DEFAULT_EXECUTABLES) +foreach(component ${ImageMagick_FIND_COMPONENTS} # DEPRECATED: forced components for backward compatibility convert mogrify import montage composite ) - IF(component STREQUAL "Magick++") + if(component STREQUAL "Magick++") FIND_IMAGEMAGICK_API(Magick++ Magick++.h - Magick++ CORE_RL_Magick++_ + Magick++ CORE_RL_Magick++_ Magick++-Q16 Magick++-Q8 ) - LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY) - ELSEIF(component STREQUAL "MagickWand") + list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY) + elseif(component STREQUAL "MagickWand") FIND_IMAGEMAGICK_API(MagickWand wand/MagickWand.h - Wand MagickWand CORE_RL_wand_ + Wand MagickWand CORE_RL_wand_ MagickWand-Q16 MagickWand-Q8 ) - LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY) - ELSEIF(component STREQUAL "MagickCore") + list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY) + elseif(component STREQUAL "MagickCore") FIND_IMAGEMAGICK_API(MagickCore magick/MagickCore.h - Magick MagickCore CORE_RL_magick_ + Magick MagickCore CORE_RL_magick_ MagickCore-Q16 MagickCore-Q8 ) - LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY) - ELSE(component STREQUAL "Magick++") - IF(ImageMagick_EXECUTABLE_DIR) + list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY) + else() + if(ImageMagick_EXECUTABLE_DIR) FIND_IMAGEMAGICK_EXE(${component}) - ENDIF(ImageMagick_EXECUTABLE_DIR) + endif() - IF(ImageMagick_FIND_COMPONENTS) - LIST(FIND ImageMagick_FIND_COMPONENTS ${component} is_requested) - IF(is_requested GREATER -1) - LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_${component}_EXECUTABLE) - ENDIF(is_requested GREATER -1) - ELSEIF(ImageMagick_${component}_EXECUTABLE) + if(ImageMagick_FIND_COMPONENTS) + list(FIND ImageMagick_FIND_COMPONENTS ${component} is_requested) + if(is_requested GREATER -1) + list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_${component}_EXECUTABLE) + endif() + elseif(ImageMagick_${component}_EXECUTABLE) # if no components were requested explicitly put all (default) executables # in the list - LIST(APPEND ImageMagick_DEFAULT_EXECUTABLES ImageMagick_${component}_EXECUTABLE) - ENDIF(ImageMagick_FIND_COMPONENTS) - ENDIF(component STREQUAL "Magick++") -ENDFOREACH(component) + list(APPEND ImageMagick_DEFAULT_EXECUTABLES ImageMagick_${component}_EXECUTABLE) + endif() + endif() +endforeach() -IF(NOT ImageMagick_FIND_COMPONENTS AND NOT ImageMagick_DEFAULT_EXECUTABLES) +if(NOT ImageMagick_FIND_COMPONENTS AND NOT ImageMagick_DEFAULT_EXECUTABLES) # No components were requested, and none of the default components were # found. Just insert mogrify into the list of the default components to # find so FPHSA below has something to check - LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_mogrify_EXECUTABLE) -ELSEIF(ImageMagick_DEFAULT_EXECUTABLES) - LIST(APPEND ImageMagick_REQUIRED_VARS ${ImageMagick_DEFAULT_EXECUTABLES}) -ENDIF() + list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_mogrify_EXECUTABLE) +elseif(ImageMagick_DEFAULT_EXECUTABLES) + list(APPEND ImageMagick_REQUIRED_VARS ${ImageMagick_DEFAULT_EXECUTABLES}) +endif() -SET(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS}) -SET(ImageMagick_LIBRARIES ${ImageMagick_LIBRARIES}) +set(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS}) +set(ImageMagick_LIBRARIES ${ImageMagick_LIBRARIES}) -IF(ImageMagick_mogrify_EXECUTABLE) - EXECUTE_PROCESS(COMMAND ${ImageMagick_mogrify_EXECUTABLE} -version +if(ImageMagick_mogrify_EXECUTABLE) + execute_process(COMMAND ${ImageMagick_mogrify_EXECUTABLE} -version OUTPUT_VARIABLE imagemagick_version ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - IF(imagemagick_version MATCHES "^Version: ImageMagick [0-9]") - STRING(REGEX REPLACE "^Version: ImageMagick ([-0-9\\.]+).*" "\\1" ImageMagick_VERSION_STRING "${imagemagick_version}") - ENDIF() - UNSET(imagemagick_version) -ENDIF(ImageMagick_mogrify_EXECUTABLE) + if(imagemagick_version MATCHES "^Version: ImageMagick [0-9]") + string(REGEX REPLACE "^Version: ImageMagick ([-0-9\\.]+).*" "\\1" ImageMagick_VERSION_STRING "${imagemagick_version}") + endif() + unset(imagemagick_version) +endif() #--------------------------------------------------------------------- # Standard Package Output #--------------------------------------------------------------------- -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ImageMagick REQUIRED_VARS ${ImageMagick_REQUIRED_VARS} VERSION_VAR ImageMagick_VERSION_STRING ) # Maintain consistency with all other variables. -SET(ImageMagick_FOUND ${IMAGEMAGICK_FOUND}) +set(ImageMagick_FOUND ${IMAGEMAGICK_FOUND}) #--------------------------------------------------------------------- # DEPRECATED: Setting variables for backward compatibility. #--------------------------------------------------------------------- -SET(IMAGEMAGICK_BINARY_PATH ${ImageMagick_EXECUTABLE_DIR} +set(IMAGEMAGICK_BINARY_PATH ${ImageMagick_EXECUTABLE_DIR} CACHE PATH "Path to the ImageMagick binary directory.") -SET(IMAGEMAGICK_CONVERT_EXECUTABLE ${ImageMagick_convert_EXECUTABLE} +set(IMAGEMAGICK_CONVERT_EXECUTABLE ${ImageMagick_convert_EXECUTABLE} CACHE FILEPATH "Path to ImageMagick's convert executable.") -SET(IMAGEMAGICK_MOGRIFY_EXECUTABLE ${ImageMagick_mogrify_EXECUTABLE} +set(IMAGEMAGICK_MOGRIFY_EXECUTABLE ${ImageMagick_mogrify_EXECUTABLE} CACHE FILEPATH "Path to ImageMagick's mogrify executable.") -SET(IMAGEMAGICK_IMPORT_EXECUTABLE ${ImageMagick_import_EXECUTABLE} +set(IMAGEMAGICK_IMPORT_EXECUTABLE ${ImageMagick_import_EXECUTABLE} CACHE FILEPATH "Path to ImageMagick's import executable.") -SET(IMAGEMAGICK_MONTAGE_EXECUTABLE ${ImageMagick_montage_EXECUTABLE} +set(IMAGEMAGICK_MONTAGE_EXECUTABLE ${ImageMagick_montage_EXECUTABLE} CACHE FILEPATH "Path to ImageMagick's montage executable.") -SET(IMAGEMAGICK_COMPOSITE_EXECUTABLE ${ImageMagick_composite_EXECUTABLE} +set(IMAGEMAGICK_COMPOSITE_EXECUTABLE ${ImageMagick_composite_EXECUTABLE} CACHE FILEPATH "Path to ImageMagick's composite executable.") -MARK_AS_ADVANCED( +mark_as_advanced( IMAGEMAGICK_BINARY_PATH IMAGEMAGICK_CONVERT_EXECUTABLE IMAGEMAGICK_MOGRIFY_EXECUTABLE diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index d49b44a55..9d708ca15 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -2,7 +2,7 @@ # This module finds if Java is installed and determines where the # include files and libraries are. It also determines what the name of # the library is. This code sets the following variables: -# +# # JNI_INCLUDE_DIRS = the include dirs to use # JNI_LIBRARIES = the libraries to use # JNI_FOUND = TRUE if JNI headers and libraries were found. @@ -27,74 +27,74 @@ # License text for the above reference.) # Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var} -MACRO(java_append_library_directories _var) +macro(java_append_library_directories _var) # Determine java arch-specific library subdir # Mostly based on openjdk/jdk/make/common/shared/Platform.gmk as of openjdk # 1.6.0_18 + icedtea patches. However, it would be much better to base the # guess on the first part of the GNU config.guess platform triplet. - IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - SET(_java_libarch "amd64") - ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") - SET(_java_libarch "i386") - ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha") - SET(_java_libarch "alpha") - ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(_java_libarch "amd64") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") + set(_java_libarch "i386") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha") + set(_java_libarch "alpha") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") # Subdir is "arm" for both big-endian (arm) and little-endian (armel). - SET(_java_libarch "arm") - ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") + set(_java_libarch "arm") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") # mips* machines are bi-endian mostly so processor does not tell # endianess of the underlying system. - SET(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb") - ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") - SET(_java_libarch "ppc64") - ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") - SET(_java_libarch "ppc") - ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") + set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") + set(_java_libarch "ppc64") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") + set(_java_libarch "ppc") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") # Both flavours can run on the same processor - SET(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9") - ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)") - SET(_java_libarch "parisc" "parisc64") - ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390") + set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)") + set(_java_libarch "parisc" "parisc64") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390") # s390 binaries can run on s390x machines - SET(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x") - ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh") - SET(_java_libarch "sh") - ELSE(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - SET(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}") - ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh") + set(_java_libarch "sh") + else() + set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}") + endif() # Append default list architectures if CMAKE_SYSTEM_PROCESSOR was empty or # system is non-Linux (where the code above has not been well tested) - IF(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux")) - LIST(APPEND _java_libarch "i386" "amd64" "ppc") - ENDIF(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux")) + if(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux")) + list(APPEND _java_libarch "i386" "amd64" "ppc") + endif() # Sometimes ${CMAKE_SYSTEM_PROCESSOR} is added to the list to prefer # current value to a hardcoded list. Remove possible duplicates. - LIST(REMOVE_DUPLICATES _java_libarch) + list(REMOVE_DUPLICATES _java_libarch) - FOREACH(_path ${ARGN}) - IF(_path MATCHES "{libarch}") - FOREACH(_libarch ${_java_libarch}) - STRING(REPLACE "{libarch}" "${_libarch}" _newpath "${_path}") - LIST(APPEND ${_var} "${_newpath}") - ENDFOREACH(_libarch) - ELSE(_path MATCHES "{libarch}") - LIST(APPEND ${_var} "${_path}") - ENDIF(_path MATCHES "{libarch}") - ENDFOREACH(_path) -ENDMACRO(java_append_library_directories) + foreach(_path ${ARGN}) + if(_path MATCHES "{libarch}") + foreach(_libarch ${_java_libarch}) + string(REPLACE "{libarch}" "${_libarch}" _newpath "${_path}") + list(APPEND ${_var} "${_newpath}") + endforeach() + else() + list(APPEND ${_var} "${_path}") + endif() + endforeach() +endmacro() -GET_FILENAME_COMPONENT(java_install_version +get_filename_component(java_install_version "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME) -SET(JAVA_AWT_LIBRARY_DIRECTORIES +set(JAVA_AWT_LIBRARY_DIRECTORIES "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib" ) -FILE(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _JAVA_HOME) +file(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _JAVA_HOME) JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES ${_JAVA_HOME}/jre/lib/{libarch} @@ -120,25 +120,30 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES /usr/lib/jvm/default-java/jre/lib/{libarch} /usr/lib/jvm/default-java/jre/lib /usr/lib/jvm/default-java/lib + # OpenBSD specific paths for default JVM + /usr/local/jdk-1.7.0/jre/lib/{libarch} + /usr/local/jre-1.7.0/lib/{libarch} + /usr/local/jdk-1.6.0/jre/lib/{libarch} + /usr/local/jre-1.6.0/lib/{libarch} ) -SET(JAVA_JVM_LIBRARY_DIRECTORIES) -FOREACH(dir ${JAVA_AWT_LIBRARY_DIRECTORIES}) - SET(JAVA_JVM_LIBRARY_DIRECTORIES +set(JAVA_JVM_LIBRARY_DIRECTORIES) +foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES}) + set(JAVA_JVM_LIBRARY_DIRECTORIES ${JAVA_JVM_LIBRARY_DIRECTORIES} "${dir}" "${dir}/client" "${dir}/server" ) -ENDFOREACH(dir) +endforeach() -SET(JAVA_AWT_INCLUDE_DIRECTORIES +set(JAVA_AWT_INCLUDE_DIRECTORIES "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include" ${_JAVA_HOME}/include - /usr/include + /usr/include /usr/local/include /usr/lib/java/include /usr/local/lib/java/include @@ -153,94 +158,98 @@ SET(JAVA_AWT_INCLUDE_DIRECTORIES /opt/sun-jdk-1.5.0.04/include # Debian specific path for default JVM /usr/lib/jvm/default-java/include + # OpenBSD specific path for default JVM + /usr/local/jdk-1.7.0/include + /usr/local/jdk-1.6.0/include ) -FOREACH(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}") - GET_FILENAME_COMPONENT(jpath "${JAVA_PROG}" PATH) - FOREACH(JAVA_INC_PATH ../include ../java/include ../share/java/include) - IF(EXISTS ${jpath}/${JAVA_INC_PATH}) - SET(JAVA_AWT_INCLUDE_DIRECTORIES ${JAVA_AWT_INCLUDE_DIRECTORIES} "${jpath}/${JAVA_INC_PATH}") - ENDIF(EXISTS ${jpath}/${JAVA_INC_PATH}) - ENDFOREACH(JAVA_INC_PATH) - FOREACH(JAVA_LIB_PATH - ../lib ../jre/lib ../jre/lib/i386 - ../java/lib ../java/jre/lib ../java/jre/lib/i386 +foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}") + get_filename_component(jpath "${JAVA_PROG}" PATH) + foreach(JAVA_INC_PATH ../include ../java/include ../share/java/include) + if(EXISTS ${jpath}/${JAVA_INC_PATH}) + set(JAVA_AWT_INCLUDE_DIRECTORIES ${JAVA_AWT_INCLUDE_DIRECTORIES} "${jpath}/${JAVA_INC_PATH}") + endif() + endforeach() + foreach(JAVA_LIB_PATH + ../lib ../jre/lib ../jre/lib/i386 + ../java/lib ../java/jre/lib ../java/jre/lib/i386 ../share/java/lib ../share/java/jre/lib ../share/java/jre/lib/i386) - IF(EXISTS ${jpath}/${JAVA_LIB_PATH}) - SET(JAVA_AWT_LIBRARY_DIRECTORIES ${JAVA_AWT_LIBRARY_DIRECTORIES} "${jpath}/${JAVA_LIB_PATH}") - ENDIF(EXISTS ${jpath}/${JAVA_LIB_PATH}) - ENDFOREACH(JAVA_LIB_PATH) -ENDFOREACH(JAVA_PROG) + if(EXISTS ${jpath}/${JAVA_LIB_PATH}) + set(JAVA_AWT_LIBRARY_DIRECTORIES ${JAVA_AWT_LIBRARY_DIRECTORIES} "${jpath}/${JAVA_LIB_PATH}") + endif() + endforeach() +endforeach() -IF(APPLE) - IF(EXISTS ~/Library/Frameworks/JavaVM.framework) - SET(JAVA_HAVE_FRAMEWORK 1) - ENDIF(EXISTS ~/Library/Frameworks/JavaVM.framework) - IF(EXISTS /Library/Frameworks/JavaVM.framework) - SET(JAVA_HAVE_FRAMEWORK 1) - ENDIF(EXISTS /Library/Frameworks/JavaVM.framework) - IF(EXISTS /System/Library/Frameworks/JavaVM.framework) - SET(JAVA_HAVE_FRAMEWORK 1) - ENDIF(EXISTS /System/Library/Frameworks/JavaVM.framework) +if(APPLE) + if(EXISTS ~/Library/Frameworks/JavaVM.framework) + set(JAVA_HAVE_FRAMEWORK 1) + endif() + if(EXISTS /Library/Frameworks/JavaVM.framework) + set(JAVA_HAVE_FRAMEWORK 1) + endif() + if(EXISTS /System/Library/Frameworks/JavaVM.framework) + set(JAVA_HAVE_FRAMEWORK 1) + endif() - IF(JAVA_HAVE_FRAMEWORK) - IF(NOT JAVA_AWT_LIBRARY) - SET (JAVA_AWT_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE) - ENDIF(NOT JAVA_AWT_LIBRARY) + if(JAVA_HAVE_FRAMEWORK) + if(NOT JAVA_AWT_LIBRARY) + set (JAVA_AWT_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE) + endif() - IF(NOT JAVA_JVM_LIBRARY) - SET (JAVA_JVM_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE) - ENDIF(NOT JAVA_JVM_LIBRARY) + if(NOT JAVA_JVM_LIBRARY) + set (JAVA_JVM_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE) + endif() - IF(NOT JAVA_AWT_INCLUDE_PATH) - IF(EXISTS /System/Library/Frameworks/JavaVM.framework/Headers/jawt.h) - SET (JAVA_AWT_INCLUDE_PATH "/System/Library/Frameworks/JavaVM.framework/Headers" CACHE FILEPATH "jawt.h location" FORCE) - ENDIF(EXISTS /System/Library/Frameworks/JavaVM.framework/Headers/jawt.h) - ENDIF(NOT JAVA_AWT_INCLUDE_PATH) + if(NOT JAVA_AWT_INCLUDE_PATH) + if(EXISTS /System/Library/Frameworks/JavaVM.framework/Headers/jawt.h) + set (JAVA_AWT_INCLUDE_PATH "/System/Library/Frameworks/JavaVM.framework/Headers" CACHE FILEPATH "jawt.h location" FORCE) + endif() + endif() # If using "-framework JavaVM", prefer its headers *before* the others in # JAVA_AWT_INCLUDE_DIRECTORIES... (*prepend* to the list here) # - SET(JAVA_AWT_INCLUDE_DIRECTORIES + set(JAVA_AWT_INCLUDE_DIRECTORIES ~/Library/Frameworks/JavaVM.framework/Headers /Library/Frameworks/JavaVM.framework/Headers /System/Library/Frameworks/JavaVM.framework/Headers ${JAVA_AWT_INCLUDE_DIRECTORIES} ) - ENDIF(JAVA_HAVE_FRAMEWORK) -ELSE(APPLE) - FIND_LIBRARY(JAVA_AWT_LIBRARY jawt + endif() +else() + find_library(JAVA_AWT_LIBRARY jawt PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES} ) - FIND_LIBRARY(JAVA_JVM_LIBRARY NAMES jvm JavaVM + find_library(JAVA_JVM_LIBRARY NAMES jvm JavaVM PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES} ) -ENDIF(APPLE) +endif() -# add in the include path -FIND_PATH(JAVA_INCLUDE_PATH jni.h +# add in the include path +find_path(JAVA_INCLUDE_PATH jni.h ${JAVA_AWT_INCLUDE_DIRECTORIES} ) -FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h +find_path(JAVA_INCLUDE_PATH2 jni_md.h ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH}/win32 ${JAVA_INCLUDE_PATH}/linux ${JAVA_INCLUDE_PATH}/freebsd + ${JAVA_INCLUDE_PATH}/openbsd ${JAVA_INCLUDE_PATH}/solaris ${JAVA_INCLUDE_PATH}/hp-ux ${JAVA_INCLUDE_PATH}/alpha ) -FIND_PATH(JAVA_AWT_INCLUDE_PATH jawt.h +find_path(JAVA_AWT_INCLUDE_PATH jawt.h ${JAVA_INCLUDE_PATH} ) -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) -MARK_AS_ADVANCED( +mark_as_advanced( JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_AWT_INCLUDE_PATH @@ -248,12 +257,12 @@ MARK_AS_ADVANCED( JAVA_INCLUDE_PATH2 ) -SET(JNI_LIBRARIES +set(JNI_LIBRARIES ${JAVA_AWT_LIBRARY} ${JAVA_JVM_LIBRARY} ) -SET(JNI_INCLUDE_DIRS +set(JNI_INCLUDE_DIRS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${JAVA_AWT_INCLUDE_PATH} diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake index 349e7e175..7c1f0fd94 100644 --- a/Modules/FindJPEG.cmake +++ b/Modules/FindJPEG.cmake @@ -20,24 +20,24 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(JPEG_INCLUDE_DIR jpeglib.h) +find_path(JPEG_INCLUDE_DIR jpeglib.h) -SET(JPEG_NAMES ${JPEG_NAMES} jpeg) -FIND_LIBRARY(JPEG_LIBRARY NAMES ${JPEG_NAMES} ) +set(JPEG_NAMES ${JPEG_NAMES} jpeg) +find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES} ) -# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARY JPEG_INCLUDE_DIR) -IF(JPEG_FOUND) - SET(JPEG_LIBRARIES ${JPEG_LIBRARY}) -ENDIF(JPEG_FOUND) +if(JPEG_FOUND) + set(JPEG_LIBRARIES ${JPEG_LIBRARY}) +endif() # Deprecated declarations. -SET (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} ) -IF(JPEG_LIBRARY) - GET_FILENAME_COMPONENT (NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH) -ENDIF(JPEG_LIBRARY) +set (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} ) +if(JPEG_LIBRARY) + get_filename_component (NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH) +endif() -MARK_AS_ADVANCED(JPEG_LIBRARY JPEG_INCLUDE_DIR ) +mark_as_advanced(JPEG_LIBRARY JPEG_INCLUDE_DIR ) diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake index 6dc7e4db7..136056b84 100644 --- a/Modules/FindJasper.cmake +++ b/Modules/FindJasper.cmake @@ -21,33 +21,33 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h) +find_path(JASPER_INCLUDE_DIR jasper/jasper.h) -IF (NOT JASPER_LIBRARIES) - FIND_PACKAGE(JPEG) +if (NOT JASPER_LIBRARIES) + find_package(JPEG) - FIND_LIBRARY(JASPER_LIBRARY_RELEASE NAMES jasper libjasper) - FIND_LIBRARY(JASPER_LIBRARY_DEBUG NAMES jasperd) + find_library(JASPER_LIBRARY_RELEASE NAMES jasper libjasper) + find_library(JASPER_LIBRARY_DEBUG NAMES jasperd) - INCLUDE(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) SELECT_LIBRARY_CONFIGURATIONS(JASPER) -ENDIF (NOT JASPER_LIBRARIES) +endif () -IF (JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h") - FILE(STRINGS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h" jasper_version_str REGEX "^#define[\t ]+JAS_VERSION[\t ]+\".*\".*") +if (JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h") + file(STRINGS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h" jasper_version_str REGEX "^#define[\t ]+JAS_VERSION[\t ]+\".*\".*") - STRING(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" JASPER_VERSION_STRING "${jasper_version_str}") -ENDIF (JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h") + string(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" JASPER_VERSION_STRING "${jasper_version_str}") +endif () -# handle the QUIETLY and REQUIRED arguments and set JASPER_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set JASPER_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper REQUIRED_VARS JASPER_LIBRARIES JASPER_INCLUDE_DIR JPEG_LIBRARIES VERSION_VAR JASPER_VERSION_STRING) -IF (JASPER_FOUND) - SET(JASPER_LIBRARIES ${JASPER_LIBRARIES} ${JPEG_LIBRARIES} ) -ENDIF (JASPER_FOUND) +if (JASPER_FOUND) + set(JASPER_LIBRARIES ${JASPER_LIBRARIES} ${JPEG_LIBRARIES} ) +endif () -MARK_AS_ADVANCED(JASPER_INCLUDE_DIR) +mark_as_advanced(JASPER_INCLUDE_DIR) diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 345702122..2f02b7a4b 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -16,14 +16,14 @@ # Java_VERSION = This is set to: $major.$minor.$patch(.$tweak) # # The minimum required version of Java can be specified using the -# standard CMake syntax, e.g. FIND_PACKAGE(Java 1.5) +# standard CMake syntax, e.g. find_package(Java 1.5) # # NOTE: ${Java_VERSION} and ${Java_VERSION_STRING} are not guaranteed to be # identical. For example some java version may return: # Java_VERSION_STRING = 1.5.0_17 # and # Java_VERSION = 1.5.0.17 -# +# # another example is the Java OEM, with: # Java_VERSION_STRING = 1.6.0-oem # and @@ -37,9 +37,9 @@ # Java__FOUND - TRUE if is found. # # Example Usages: -# FIND_PACKAGE(Java) -# FIND_PACKAGE(Java COMPONENTS Runtime) -# FIND_PACKAGE(Java COMPONENTS Development) +# find_package(Java) +# find_package(Java COMPONENTS Runtime) +# find_package(Java COMPONENTS Development) # #============================================================================= @@ -57,7 +57,7 @@ # License text for the above reference.) # The HINTS option should only be used for values computed from the system. -SET(_JAVA_HINTS +set(_JAVA_HINTS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\2.0;JavaHome]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/bin" @@ -70,7 +70,7 @@ SET(_JAVA_HINTS ) # Hard-coded guesses should still go in PATHS. This ensures that the user # environment can always override hard guesses. -SET(_JAVA_PATHS +set(_JAVA_PATHS /usr/lib/java/bin /usr/share/java/bin /usr/local/java/bin @@ -80,80 +80,87 @@ SET(_JAVA_PATHS /usr/java/j2sdk1.4.2_09/bin /usr/lib/j2sdk1.5-sun/bin /opt/sun-jdk-1.5.0.04/bin + /usr/local/jdk-1.7.0/bin + /usr/local/jdk-1.6.0/bin ) -FIND_PROGRAM(Java_JAVA_EXECUTABLE +find_program(Java_JAVA_EXECUTABLE NAMES java HINTS ${_JAVA_HINTS} PATHS ${_JAVA_PATHS} ) -IF(Java_JAVA_EXECUTABLE) - EXECUTE_PROCESS(COMMAND ${Java_JAVA_EXECUTABLE} -version +if(Java_JAVA_EXECUTABLE) + execute_process(COMMAND ${Java_JAVA_EXECUTABLE} -version RESULT_VARIABLE res OUTPUT_VARIABLE var ERROR_VARIABLE var # sun-java output to stderr OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE) - IF( res ) - IF(${Java_FIND_REQUIRED}) - MESSAGE( FATAL_ERROR "Error executing java -version" ) - ELSE() - MESSAGE( STATUS "Warning, could not run java --version") - ENDIF() - ELSE() + if( res ) + if(${Java_FIND_REQUIRED}) + message( FATAL_ERROR "Error executing java -version" ) + else() + message( STATUS "Warning, could not run java --version") + endif() + else() # extract major/minor version and patch level from "java -version" output - # Tested on linux using + # Tested on linux using # 1. Sun / Sun OEM # 2. OpenJDK 1.6 # 3. GCJ 1.5 # 4. Kaffe 1.4.2 - IF(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*") + # 5. OpenJDK 1.7.x on OpenBSD + if(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*") # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer - STRING( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*" + string( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*" "\\1" Java_VERSION_STRING "${var}" ) - ELSEIF(var MATCHES "java full version \"kaffe-[0-9]+\\.[0-9]+\\.[0-9_]+\".*") + elseif(var MATCHES "java full version \"kaffe-[0-9]+\\.[0-9]+\\.[0-9_]+\".*") # Kaffe style - STRING( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*" + string( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*" + "\\1" Java_VERSION_STRING "${var}" ) + elseif(var MATCHES "openjdk version \"[0-9]+\\.[0-9]+\\.[0-9_]+\".*") + # OpenJDK ver 1.7.x on OpenBSD + string( REGEX REPLACE "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+).*" "\\1" Java_VERSION_STRING "${var}" ) - ELSE() - IF(NOT Java_FIND_QUIETLY) + else() + if(NOT Java_FIND_QUIETLY) message(WARNING "regex not supported: ${var}. Please report") - ENDIF(NOT Java_FIND_QUIETLY) - ENDIF() - STRING( REGEX REPLACE "([0-9]+).*" "\\1" Java_VERSION_MAJOR "${Java_VERSION_STRING}" ) - STRING( REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_MINOR "${Java_VERSION_STRING}" ) - STRING( REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_PATCH "${Java_VERSION_STRING}" ) + endif() + endif() + string( REGEX REPLACE "([0-9]+).*" "\\1" Java_VERSION_MAJOR "${Java_VERSION_STRING}" ) + string( REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_MINOR "${Java_VERSION_STRING}" ) + string( REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_PATCH "${Java_VERSION_STRING}" ) # warning tweak version can be empty: - STRING( REGEX REPLACE "[0-9]+\\.[0-9]+\\.[0-9]+[_\\.]?([0-9]*).*$" "\\1" Java_VERSION_TWEAK "${Java_VERSION_STRING}" ) + string( REGEX REPLACE "[0-9]+\\.[0-9]+\\.[0-9]+[_\\.]?([0-9]*).*$" "\\1" Java_VERSION_TWEAK "${Java_VERSION_STRING}" ) if( Java_VERSION_TWEAK STREQUAL "" ) # check case where tweak is not defined set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH}) - else( ) + else() set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH}.${Java_VERSION_TWEAK}) - endif( ) - ENDIF() + endif() + endif() -ENDIF(Java_JAVA_EXECUTABLE) +endif() -FIND_PROGRAM(Java_JAR_EXECUTABLE +find_program(Java_JAR_EXECUTABLE NAMES jar HINTS ${_JAVA_HINTS} PATHS ${_JAVA_PATHS} ) -FIND_PROGRAM(Java_JAVAC_EXECUTABLE +find_program(Java_JAVAC_EXECUTABLE NAMES javac HINTS ${_JAVA_HINTS} PATHS ${_JAVA_PATHS} ) -FIND_PROGRAM(Java_JAVAH_EXECUTABLE +find_program(Java_JAVAH_EXECUTABLE NAMES javah HINTS ${_JAVA_HINTS} PATHS ${_JAVA_PATHS} ) -FIND_PROGRAM(Java_JAVADOC_EXECUTABLE +find_program(Java_JAVADOC_EXECUTABLE NAMES javadoc HINTS ${_JAVA_HINTS} PATHS ${_JAVA_PATHS} @@ -178,7 +185,7 @@ if(Java_FIND_COMPONENTS) message(FATAL_ERROR "Comp: ${component} is not handled") endif() set(Java_${component}_FOUND TRUE) - endforeach(component) + endforeach() else() # Check for everything find_package_handle_standard_args(Java @@ -189,7 +196,7 @@ else() endif() -MARK_AS_ADVANCED( +mark_as_advanced( Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE @@ -198,7 +205,7 @@ MARK_AS_ADVANCED( ) # LEGACY -SET(JAVA_RUNTIME ${Java_JAVA_EXECUTABLE}) -SET(JAVA_ARCHIVE ${Java_JAR_EXECUTABLE}) -SET(JAVA_COMPILE ${Java_JAVAC_EXECUTABLE}) +set(JAVA_RUNTIME ${Java_JAVA_EXECUTABLE}) +set(JAVA_ARCHIVE ${Java_JAR_EXECUTABLE}) +set(JAVA_COMPILE ${Java_JAVAC_EXECUTABLE}) diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake index 9d1081405..70eccef60 100644 --- a/Modules/FindKDE3.cmake +++ b/Modules/FindKDE3.cmake @@ -3,8 +3,8 @@ # This module defines the following variables: # KDE3_DEFINITIONS - compiler definitions required for compiling KDE software # KDE3_INCLUDE_DIR - the KDE include directory -# KDE3_INCLUDE_DIRS - the KDE and the Qt include directory, for use with INCLUDE_DIRECTORIES() -# KDE3_LIB_DIR - the directory where the KDE libraries are installed, for use with LINK_DIRECTORIES() +# KDE3_INCLUDE_DIRS - the KDE and the Qt include directory, for use with include_directories() +# KDE3_LIB_DIR - the directory where the KDE libraries are installed, for use with link_directories() # QT_AND_KDECORE_LIBS - this contains both the Qt and the kdecore library # KDE3_DCOPIDL_EXECUTABLE - the dcopidl executable # KDE3_DCOPIDL2CPP_EXECUTABLE - the dcopidl2cpp executable @@ -23,7 +23,7 @@ # Call this if you want to have automatic moc file handling. # This means if you include "foo.moc" in the source file foo.cpp # a moc file for the header foo.h will be created automatically. -# You can set the property SKIP_AUTOMAKE using SET_SOURCE_FILES_PROPERTIES() +# You can set the property SKIP_AUTOMAKE using set_source_files_properties() # to exclude some files in the list from being processed. # # KDE3_ADD_MOC_FILES(SRCS_VAR file1 ... fileN ) @@ -46,7 +46,7 @@ # This will create and install a simple libtool file for the given target. # # KDE3_ADD_EXECUTABLE(name file1 ... fileN ) -# Currently identical to ADD_EXECUTABLE(), may provide some advanced features in the future. +# Currently identical to add_executable(), may provide some advanced features in the future. # # KDE3_ADD_KPART(name [WITH_PREFIX] file1 ... fileN ) # Create a KDE plugin (KPart, kioslave, etc.) from the given source files. @@ -77,37 +77,37 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF(NOT UNIX AND KDE3_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Compiling KDE3 applications and libraries under Windows is not supported") -ENDIF(NOT UNIX AND KDE3_FIND_REQUIRED) +if(NOT UNIX AND KDE3_FIND_REQUIRED) + message(FATAL_ERROR "Compiling KDE3 applications and libraries under Windows is not supported") +endif() # If Qt4 has already been found, fail. -IF(QT4_FOUND) - IF(KDE3_FIND_REQUIRED) - MESSAGE( FATAL_ERROR "KDE3/Qt3 and Qt4 cannot be used together in one project.") - ELSE(KDE3_FIND_REQUIRED) - IF(NOT KDE3_FIND_QUIETLY) - MESSAGE( STATUS "KDE3/Qt3 and Qt4 cannot be used together in one project.") - ENDIF(NOT KDE3_FIND_QUIETLY) - RETURN() - ENDIF(KDE3_FIND_REQUIRED) -ENDIF(QT4_FOUND) +if(QT4_FOUND) + if(KDE3_FIND_REQUIRED) + message( FATAL_ERROR "KDE3/Qt3 and Qt4 cannot be used together in one project.") + else() + if(NOT KDE3_FIND_QUIETLY) + message( STATUS "KDE3/Qt3 and Qt4 cannot be used together in one project.") + endif() + return() + endif() +endif() -SET(QT_MT_REQUIRED TRUE) -#SET(QT_MIN_VERSION "3.0.0") +set(QT_MT_REQUIRED TRUE) +#set(QT_MIN_VERSION "3.0.0") #this line includes FindQt.cmake, which searches the Qt library and headers -IF(KDE3_FIND_REQUIRED) - SET(_REQ_STRING_KDE3 "REQUIRED") -ENDIF(KDE3_FIND_REQUIRED) - -FIND_PACKAGE(Qt3 ${_REQ_STRING_KDE3}) -FIND_PACKAGE(X11 ${_REQ_STRING_KDE3}) +if(KDE3_FIND_REQUIRED) + set(_REQ_STRING_KDE3 "REQUIRED") +endif() + +find_package(Qt3 ${_REQ_STRING_KDE3}) +find_package(X11 ${_REQ_STRING_KDE3}) #now try to find some kde stuff -FIND_PROGRAM(KDECONFIG_EXECUTABLE NAMES kde-config +find_program(KDECONFIG_EXECUTABLE NAMES kde-config HINTS $ENV{KDEDIR}/bin PATHS @@ -115,25 +115,25 @@ FIND_PROGRAM(KDECONFIG_EXECUTABLE NAMES kde-config /opt/kde/bin ) -SET(KDE3PREFIX) -IF(KDECONFIG_EXECUTABLE) - EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --version +set(KDE3PREFIX) +if(KDECONFIG_EXECUTABLE) + execute_process(COMMAND ${KDECONFIG_EXECUTABLE} --version OUTPUT_VARIABLE kde_config_version ) - STRING(REGEX MATCH "KDE: .\\." kde_version "${kde_config_version}") - IF ("${kde_version}" MATCHES "KDE: 3\\.") - EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --prefix + string(REGEX MATCH "KDE: .\\." kde_version "${kde_config_version}") + if ("${kde_version}" MATCHES "KDE: 3\\.") + execute_process(COMMAND ${KDECONFIG_EXECUTABLE} --prefix OUTPUT_VARIABLE kdedir ) - STRING(REGEX REPLACE "\n" "" KDE3PREFIX "${kdedir}") + string(REGEX REPLACE "\n" "" KDE3PREFIX "${kdedir}") - ENDIF ("${kde_version}" MATCHES "KDE: 3\\.") -ENDIF(KDECONFIG_EXECUTABLE) + endif () +endif() -# at first the KDE include direcory +# at first the KDE include directory # kpassdlg.h comes from kdeui and doesn't exist in KDE4 anymore -FIND_PATH(KDE3_INCLUDE_DIR kpassdlg.h +find_path(KDE3_INCLUDE_DIR kpassdlg.h HINTS $ENV{KDEDIR}/include ${KDE3PREFIX}/include @@ -145,7 +145,7 @@ FIND_PATH(KDE3_INCLUDE_DIR kpassdlg.h ) #now the KDE library directory -FIND_LIBRARY(KDE3_KDECORE_LIBRARY NAMES kdecore +find_library(KDE3_KDECORE_LIBRARY NAMES kdecore HINTS $ENV{KDEDIR}/lib ${KDE3PREFIX}/lib @@ -154,20 +154,20 @@ FIND_LIBRARY(KDE3_KDECORE_LIBRARY NAMES kdecore /opt/kde/lib ) -SET(QT_AND_KDECORE_LIBS ${QT_LIBRARIES} ${KDE3_KDECORE_LIBRARY}) +set(QT_AND_KDECORE_LIBS ${QT_LIBRARIES} ${KDE3_KDECORE_LIBRARY}) -GET_FILENAME_COMPONENT(KDE3_LIB_DIR ${KDE3_KDECORE_LIBRARY} PATH ) +get_filename_component(KDE3_LIB_DIR ${KDE3_KDECORE_LIBRARY} PATH ) -IF(NOT KDE3_LIBTOOL_DIR) - IF(KDE3_KDECORE_LIBRARY MATCHES lib64) - SET(KDE3_LIBTOOL_DIR /lib64/kde3) - ELSE(KDE3_KDECORE_LIBRARY MATCHES lib64) - SET(KDE3_LIBTOOL_DIR /lib/kde3) - ENDIF(KDE3_KDECORE_LIBRARY MATCHES lib64) -ENDIF(NOT KDE3_LIBTOOL_DIR) +if(NOT KDE3_LIBTOOL_DIR) + if(KDE3_KDECORE_LIBRARY MATCHES lib64) + set(KDE3_LIBTOOL_DIR /lib64/kde3) + else() + set(KDE3_LIBTOOL_DIR /lib/kde3) + endif() +endif() #now search for the dcop utilities -FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl +find_program(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl HINTS $ENV{KDEDIR}/bin ${KDE3PREFIX}/bin @@ -176,7 +176,7 @@ FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl /opt/kde/bin ) -FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp +find_program(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp HINTS $ENV{KDEDIR}/bin ${KDE3PREFIX}/bin @@ -185,7 +185,7 @@ FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp /opt/kde/bin ) -FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler +find_program(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler HINTS $ENV{KDEDIR}/bin ${KDE3PREFIX}/bin @@ -196,104 +196,104 @@ FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler #SET KDE3_FOUND -IF (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE) - SET(KDE3_FOUND TRUE) -ELSE (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE) - SET(KDE3_FOUND FALSE) -ENDIF (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE) +if (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE) + set(KDE3_FOUND TRUE) +else () + set(KDE3_FOUND FALSE) +endif () # add some KDE specific stuff -SET(KDE3_DEFINITIONS -DQT_CLEAN_NAMESPACE -D_GNU_SOURCE) +set(KDE3_DEFINITIONS -DQT_CLEAN_NAMESPACE -D_GNU_SOURCE) # set compiler flags only if KDE3 has actually been found -IF(KDE3_FOUND) - SET(_KDE3_USE_FLAGS FALSE) - IF(CMAKE_COMPILER_IS_GNUCXX) - SET(_KDE3_USE_FLAGS TRUE) # use flags for gnu compiler - EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} --version +if(KDE3_FOUND) + set(_KDE3_USE_FLAGS FALSE) + if(CMAKE_COMPILER_IS_GNUCXX) + set(_KDE3_USE_FLAGS TRUE) # use flags for gnu compiler + execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE out) # gnu gcc 2.96 does not work with flags # I guess 2.95 also doesn't then - IF("${out}" MATCHES "2.9[56]") - SET(_KDE3_USE_FLAGS FALSE) - ENDIF("${out}" MATCHES "2.9[56]") - ENDIF(CMAKE_COMPILER_IS_GNUCXX) + if("${out}" MATCHES "2.9[56]") + set(_KDE3_USE_FLAGS FALSE) + endif() + endif() #only on linux, but NOT e.g. on FreeBSD: - IF(CMAKE_SYSTEM_NAME MATCHES "Linux" AND _KDE3_USE_FLAGS) - SET (KDE3_DEFINITIONS ${KDE3_DEFINITIONS} -D_XOPEN_SOURCE=500 -D_BSD_SOURCE) - SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") - SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-exceptions -fno-check-new -fno-common") - ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux" AND _KDE3_USE_FLAGS) + if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND _KDE3_USE_FLAGS) + set (KDE3_DEFINITIONS ${KDE3_DEFINITIONS} -D_XOPEN_SOURCE=500 -D_BSD_SOURCE) + set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") + set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-exceptions -fno-check-new -fno-common") + endif() # works on FreeBSD, NOT tested on NetBSD and OpenBSD - IF (CMAKE_SYSTEM_NAME MATCHES BSD AND _KDE3_USE_FLAGS) - SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") - SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common") - ENDIF (CMAKE_SYSTEM_NAME MATCHES BSD AND _KDE3_USE_FLAGS) + if (CMAKE_SYSTEM_NAME MATCHES BSD AND _KDE3_USE_FLAGS) + set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") + set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common") + endif () # if no special buildtype is selected, add -O2 as default optimization - IF (NOT CMAKE_BUILD_TYPE AND _KDE3_USE_FLAGS) - SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") - SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") - ENDIF (NOT CMAKE_BUILD_TYPE AND _KDE3_USE_FLAGS) + if (NOT CMAKE_BUILD_TYPE AND _KDE3_USE_FLAGS) + set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") + set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") + endif () -#SET(CMAKE_SHARED_LINKER_FLAGS "-avoid-version -module -Wl,--no-undefined -Wl,--allow-shlib-undefined") -#SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") -#SET(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") -ENDIF(KDE3_FOUND) +#set(CMAKE_SHARED_LINKER_FLAGS "-avoid-version -module -Wl,--no-undefined -Wl,--allow-shlib-undefined") +#set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") +#set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") +endif() # KDE3Macros.cmake contains all the KDE specific macros -INCLUDE(KDE3Macros) +include(${CMAKE_CURRENT_LIST_DIR}/KDE3Macros.cmake) -MACRO (KDE3_PRINT_RESULTS) - IF(KDE3_INCLUDE_DIR) - MESSAGE(STATUS "Found KDE3 include dir: ${KDE3_INCLUDE_DIR}") - ELSE(KDE3_INCLUDE_DIR) - MESSAGE(STATUS "Didn't find KDE3 headers") - ENDIF(KDE3_INCLUDE_DIR) +macro (KDE3_PRINT_RESULTS) + if(KDE3_INCLUDE_DIR) + message(STATUS "Found KDE3 include dir: ${KDE3_INCLUDE_DIR}") + else() + message(STATUS "Didn't find KDE3 headers") + endif() - IF(KDE3_LIB_DIR) - MESSAGE(STATUS "Found KDE3 library dir: ${KDE3_LIB_DIR}") - ELSE(KDE3_LIB_DIR) - MESSAGE(STATUS "Didn't find KDE3 core library") - ENDIF(KDE3_LIB_DIR) + if(KDE3_LIB_DIR) + message(STATUS "Found KDE3 library dir: ${KDE3_LIB_DIR}") + else() + message(STATUS "Didn't find KDE3 core library") + endif() - IF(KDE3_DCOPIDL_EXECUTABLE) - MESSAGE(STATUS "Found KDE3 dcopidl preprocessor: ${KDE3_DCOPIDL_EXECUTABLE}") - ELSE(KDE3_DCOPIDL_EXECUTABLE) - MESSAGE(STATUS "Didn't find the KDE3 dcopidl preprocessor") - ENDIF(KDE3_DCOPIDL_EXECUTABLE) + if(KDE3_DCOPIDL_EXECUTABLE) + message(STATUS "Found KDE3 dcopidl preprocessor: ${KDE3_DCOPIDL_EXECUTABLE}") + else() + message(STATUS "Didn't find the KDE3 dcopidl preprocessor") + endif() - IF(KDE3_DCOPIDL2CPP_EXECUTABLE) - MESSAGE(STATUS "Found KDE3 dcopidl2cpp preprocessor: ${KDE3_DCOPIDL2CPP_EXECUTABLE}") - ELSE(KDE3_DCOPIDL2CPP_EXECUTABLE) - MESSAGE(STATUS "Didn't find the KDE3 dcopidl2cpp preprocessor") - ENDIF(KDE3_DCOPIDL2CPP_EXECUTABLE) + if(KDE3_DCOPIDL2CPP_EXECUTABLE) + message(STATUS "Found KDE3 dcopidl2cpp preprocessor: ${KDE3_DCOPIDL2CPP_EXECUTABLE}") + else() + message(STATUS "Didn't find the KDE3 dcopidl2cpp preprocessor") + endif() - IF(KDE3_KCFGC_EXECUTABLE) - MESSAGE(STATUS "Found KDE3 kconfig_compiler preprocessor: ${KDE3_KCFGC_EXECUTABLE}") - ELSE(KDE3_KCFGC_EXECUTABLE) - MESSAGE(STATUS "Didn't find the KDE3 kconfig_compiler preprocessor") - ENDIF(KDE3_KCFGC_EXECUTABLE) + if(KDE3_KCFGC_EXECUTABLE) + message(STATUS "Found KDE3 kconfig_compiler preprocessor: ${KDE3_KCFGC_EXECUTABLE}") + else() + message(STATUS "Didn't find the KDE3 kconfig_compiler preprocessor") + endif() -ENDMACRO (KDE3_PRINT_RESULTS) +endmacro () -IF (KDE3_FIND_REQUIRED AND NOT KDE3_FOUND) +if (KDE3_FIND_REQUIRED AND NOT KDE3_FOUND) #bail out if something wasn't found KDE3_PRINT_RESULTS() - MESSAGE(FATAL_ERROR "Could NOT find everything required for compiling KDE 3 programs") + message(FATAL_ERROR "Could NOT find everything required for compiling KDE 3 programs") -ENDIF (KDE3_FIND_REQUIRED AND NOT KDE3_FOUND) +endif () -IF (NOT KDE3_FIND_QUIETLY) +if (NOT KDE3_FIND_QUIETLY) KDE3_PRINT_RESULTS() -ENDIF (NOT KDE3_FIND_QUIETLY) +endif () #add the found Qt and KDE include directories to the current include path -SET(KDE3_INCLUDE_DIRS ${QT_INCLUDE_DIR} ${KDE3_INCLUDE_DIR}) +set(KDE3_INCLUDE_DIRS ${QT_INCLUDE_DIR} ${KDE3_INCLUDE_DIR}) diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake index ed4f270b0..c653a04cd 100644 --- a/Modules/FindKDE4.cmake +++ b/Modules/FindKDE4.cmake @@ -24,28 +24,28 @@ # License text for the above reference.) # If Qt3 has already been found, fail. -IF(QT_QT_LIBRARY) - IF(KDE4_FIND_REQUIRED) - MESSAGE( FATAL_ERROR "KDE4/Qt4 and Qt3 cannot be used together in one project.") - ELSE(KDE4_FIND_REQUIRED) - IF(NOT KDE4_FIND_QUIETLY) - MESSAGE( STATUS "KDE4/Qt4 and Qt3 cannot be used together in one project.") - ENDIF(NOT KDE4_FIND_QUIETLY) - RETURN() - ENDIF(KDE4_FIND_REQUIRED) -ENDIF(QT_QT_LIBRARY) +if(QT_QT_LIBRARY) + if(KDE4_FIND_REQUIRED) + message( FATAL_ERROR "KDE4/Qt4 and Qt3 cannot be used together in one project.") + else() + if(NOT KDE4_FIND_QUIETLY) + message( STATUS "KDE4/Qt4 and Qt3 cannot be used together in one project.") + endif() + return() + endif() +endif() -FILE(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS) +file(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS) # when cross compiling, searching kde4-config in order to run it later on -# doesn't make a lot of sense. We'll have to do something about this. +# doesn't make a lot of sense. We'll have to do something about this. # Searching always in the target environment ? Then we get at least the correct one, # still it can't be used to run it. Alex # For KDE4 kde-config has been renamed to kde4-config -FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config +find_program(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config # the suffix must be used since KDEDIRS can be a list of directories which don't have bin/ appended - PATH_SUFFIXES bin + PATH_SUFFIXES bin HINTS ${CMAKE_INSTALL_PREFIX} ${_KDEDIRS} @@ -53,48 +53,48 @@ FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config ONLY_CMAKE_FIND_ROOT_PATH ) -IF (NOT KDE4_KDECONFIG_EXECUTABLE) - IF (KDE4_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "ERROR: Could not find KDE4 kde4-config") - ENDIF (KDE4_FIND_REQUIRED) -ENDIF (NOT KDE4_KDECONFIG_EXECUTABLE) +if (NOT KDE4_KDECONFIG_EXECUTABLE) + if (KDE4_FIND_REQUIRED) + message(FATAL_ERROR "ERROR: Could not find KDE4 kde4-config") + endif () +endif () # when cross compiling, KDE4_DATA_DIR may be already preset -IF(NOT KDE4_DATA_DIR) - IF(CMAKE_CROSSCOMPILING) +if(NOT KDE4_DATA_DIR) + if(CMAKE_CROSSCOMPILING) # when cross compiling, don't run kde4-config but use its location as install dir - GET_FILENAME_COMPONENT(KDE4_DATA_DIR "${KDE4_KDECONFIG_EXECUTABLE}" PATH) - GET_FILENAME_COMPONENT(KDE4_DATA_DIR "${KDE4_DATA_DIR}" PATH) - ELSE(CMAKE_CROSSCOMPILING) + get_filename_component(KDE4_DATA_DIR "${KDE4_KDECONFIG_EXECUTABLE}" PATH) + get_filename_component(KDE4_DATA_DIR "${KDE4_DATA_DIR}" PATH) + else() # then ask kde4-config for the kde data dirs - IF(KDE4_KDECONFIG_EXECUTABLE) - EXECUTE_PROCESS(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path data OUTPUT_VARIABLE _data_DIR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - FILE(TO_CMAKE_PATH "${_data_DIR}" _data_DIR) + if(KDE4_KDECONFIG_EXECUTABLE) + execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path data OUTPUT_VARIABLE _data_DIR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + file(TO_CMAKE_PATH "${_data_DIR}" _data_DIR) # then check the data dirs for FindKDE4Internal.cmake - FIND_PATH(KDE4_DATA_DIR cmake/modules/FindKDE4Internal.cmake HINTS ${_data_DIR}) - ENDIF(KDE4_KDECONFIG_EXECUTABLE) - ENDIF(CMAKE_CROSSCOMPILING) -ENDIF(NOT KDE4_DATA_DIR) + find_path(KDE4_DATA_DIR cmake/modules/FindKDE4Internal.cmake HINTS ${_data_DIR}) + endif() + endif() +endif() # if it has been found... -IF (KDE4_DATA_DIR) +if (KDE4_DATA_DIR) - SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${KDE4_DATA_DIR}/cmake/modules) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${KDE4_DATA_DIR}/cmake/modules) - IF (KDE4_FIND_QUIETLY) - SET(_quiet QUIET) - ENDIF (KDE4_FIND_QUIETLY) + if (KDE4_FIND_QUIETLY) + set(_quiet QUIET) + endif () - IF (KDE4_FIND_REQUIRED) - SET(_req REQUIRED) - ENDIF (KDE4_FIND_REQUIRED) + if (KDE4_FIND_REQUIRED) + set(_req REQUIRED) + endif () # use FindKDE4Internal.cmake to do the rest - FIND_PACKAGE(KDE4Internal ${_req} ${_quiet}) -ELSE (KDE4_DATA_DIR) - IF (KDE4_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "ERROR: cmake/modules/FindKDE4Internal.cmake not found in ${_data_DIR}") - ENDIF (KDE4_FIND_REQUIRED) -ENDIF (KDE4_DATA_DIR) + find_package(KDE4Internal ${_req} ${_quiet}) +else () + if (KDE4_FIND_REQUIRED) + message(FATAL_ERROR "ERROR: cmake/modules/FindKDE4Internal.cmake not found in ${_data_DIR}") + endif () +endif () diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 0ae98dfa7..3167850db 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -40,10 +40,10 @@ set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) if (NOT _LANGUAGES_ MATCHES Fortran) -include(CheckFunctionExists) -else (NOT _LANGUAGES_ MATCHES Fortran) -include(CheckFortranFunctionExists) -endif (NOT _LANGUAGES_ MATCHES Fortran) +include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) +else () +include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake) +endif () set(LAPACK_FOUND FALSE) set(LAPACK95_FOUND FALSE) @@ -69,9 +69,9 @@ if (NOT _libdir) if (WIN32) set(_libdir ENV LIB) elseif (APPLE) - set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH) + set(_libdir ENV DYLD_LIBRARY_PATH) else () - set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH) + set(_libdir ENV LD_LIBRARY_PATH) endif () endif () foreach(_library ${_list}) @@ -81,18 +81,18 @@ foreach(_library ${_list}) if (BLA_STATIC) if (WIN32) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif ( WIN32 ) + endif () if (APPLE) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else (APPLE) + else () set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif (APPLE) - else (BLA_STATIC) + endif () + else () if (CMAKE_SYSTEM_NAME STREQUAL "Linux") # for ubuntu's libblas3gf and liblapack3gf packages set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) endif () - endif (BLA_STATIC) + endif () find_library(${_prefix}_${_library}_LIBRARY NAMES ${_library} PATHS ${_libdir} @@ -100,35 +100,35 @@ foreach(_library ${_list}) mark_as_advanced(${_prefix}_${_library}_LIBRARY) set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) - endif(_libraries_work) -endforeach(_library ${_list}) + endif() +endforeach() if(_libraries_work) # Test this combination of libraries. if(UNIX AND BLA_STATIC) set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}} ${_blas} "-Wl,--end-group" ${_threads}) - else(UNIX AND BLA_STATIC) + else() set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads}) - endif(UNIX AND BLA_STATIC) + endif() # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") if (NOT _LANGUAGES_ MATCHES Fortran) check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) - else (NOT _LANGUAGES_ MATCHES Fortran) + else () check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) - endif (NOT _LANGUAGES_ MATCHES Fortran) + endif () set(CMAKE_REQUIRED_LIBRARIES) mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") -endif(_libraries_work) +endif() if(_libraries_work) set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads}) - else(_libraries_work) + else() set(${LIBRARIES} FALSE) - endif(_libraries_work) + endif() -endmacro(Check_Lapack_Libraries) +endmacro() set(LAPACK_LINKER_FLAGS) @@ -138,20 +138,20 @@ set(LAPACK95_LIBRARIES) if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) find_package(BLAS) -else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) +else() find_package(BLAS REQUIRED) -endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) +endif() if(BLAS_FOUND) set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) if ($ENV{BLA_VENDOR} MATCHES ".+") set(BLA_VENDOR $ENV{BLA_VENDOR}) - else ($ENV{BLA_VENDOR} MATCHES ".+") + else () if(NOT BLA_VENDOR) set(BLA_VENDOR "All") - endif(NOT BLA_VENDOR) - endif ($ENV{BLA_VENDOR} MATCHES ".+") + endif() + endif () if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") if(NOT LAPACK_LIBRARIES) @@ -164,8 +164,8 @@ if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") "${BLAS_LIBRARIES}" "" ) - endif(NOT LAPACK_LIBRARIES) -endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") + endif() +endif () #acml lapack @@ -187,8 +187,8 @@ if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") "${BLAS_LIBRARIES}" "" ) - endif(NOT LAPACK_LIBRARIES) -endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") + endif() +endif () if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") if ( NOT LAPACK_LIBRARIES ) check_lapack_libraries( @@ -200,8 +200,8 @@ if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") "${BLAS_LIBRARIES}" "" ) - endif ( NOT LAPACK_LIBRARIES ) -endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") + endif () +endif () # Generic LAPACK library? if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "ATLAS" OR @@ -216,7 +216,7 @@ if (BLA_VENDOR STREQUAL "Generic" OR "${BLAS_LIBRARIES}" "" ) - endif ( NOT LAPACK_LIBRARIES ) + endif () endif () #intel lapack if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") @@ -226,9 +226,9 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) find_PACKAGE(Threads) - else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + else() find_package(Threads REQUIRED) - endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + endif() if (BLA_F95) if(NOT LAPACK95_LIBRARIES) # old @@ -241,7 +241,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") "${BLAS95_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT};${LM}" ) - endif(NOT LAPACK95_LIBRARIES) + endif() if(NOT LAPACK95_LIBRARIES) # new >= 10.3 check_lapack_libraries( @@ -253,8 +253,8 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") "${BLAS95_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT};${LM}" ) - endif(NOT LAPACK95_LIBRARIES) - else(BLA_F95) + endif() + else() if(NOT LAPACK_LIBRARIES) # old check_lapack_libraries( @@ -266,7 +266,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") "${BLAS_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT};${LM}" ) - endif(NOT LAPACK_LIBRARIES) + endif() if(NOT LAPACK_LIBRARIES) # new >= 10.3 check_lapack_libraries( @@ -278,59 +278,59 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") "${BLAS_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT};${LM}" ) - endif(NOT LAPACK_LIBRARIES) - endif(BLA_F95) - endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) -endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") -else(BLAS_FOUND) + endif() + endif() + endif () +endif() +else() message(STATUS "LAPACK requires BLAS") -endif(BLAS_FOUND) +endif() if(BLA_F95) if(LAPACK95_LIBRARIES) set(LAPACK95_FOUND TRUE) - else(LAPACK95_LIBRARIES) + else() set(LAPACK95_FOUND FALSE) - endif(LAPACK95_LIBRARIES) + endif() if(NOT LAPACK_FIND_QUIETLY) if(LAPACK95_FOUND) message(STATUS "A library with LAPACK95 API found.") - else(LAPACK95_FOUND) + else() if(LAPACK_FIND_REQUIRED) message(FATAL_ERROR "A required library with LAPACK95 API not found. Please specify library location." ) - else(LAPACK_FIND_REQUIRED) + else() message(STATUS "A library with LAPACK95 API not found. Please specify library location." ) - endif(LAPACK_FIND_REQUIRED) - endif(LAPACK95_FOUND) - endif(NOT LAPACK_FIND_QUIETLY) + endif() + endif() + endif() set(LAPACK_FOUND "${LAPACK95_FOUND}") set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}") -else(BLA_F95) +else() if(LAPACK_LIBRARIES) set(LAPACK_FOUND TRUE) - else(LAPACK_LIBRARIES) + else() set(LAPACK_FOUND FALSE) - endif(LAPACK_LIBRARIES) + endif() if(NOT LAPACK_FIND_QUIETLY) if(LAPACK_FOUND) message(STATUS "A library with LAPACK API found.") - else(LAPACK_FOUND) + else() if(LAPACK_FIND_REQUIRED) message(FATAL_ERROR "A required library with LAPACK API not found. Please specify library location." ) - else(LAPACK_FIND_REQUIRED) + else() message(STATUS "A library with LAPACK API not found. Please specify library location." ) - endif(LAPACK_FIND_REQUIRED) - endif(LAPACK_FOUND) - endif(NOT LAPACK_FIND_QUIETLY) -endif(BLA_F95) + endif() + endif() + endif() +endif() set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake index 950daca5a..bc752a95a 100644 --- a/Modules/FindLATEX.cmake +++ b/Modules/FindLATEX.cmake @@ -1,14 +1,14 @@ # - Find Latex # This module finds if Latex is installed and determines where the # executables are. This code sets the following variables: -# +# # LATEX_COMPILER: path to the LaTeX compiler # PDFLATEX_COMPILER: path to the PdfLaTeX compiler # BIBTEX_COMPILER: path to the BibTeX compiler # MAKEINDEX_COMPILER: path to the MakeIndex compiler # DVIPS_CONVERTER: path to the DVIPS converter # PS2PDF_CONVERTER: path to the PS2PDF converter -# LATEX2HTML_CONVERTER: path to the LaTeX2Html converter +# LATEX2HTML_CONVERTER: path to the LaTeX2Html converter # #============================================================================= @@ -24,97 +24,97 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF (WIN32) +if (WIN32) # Try to find the MikTex binary path (look for its package manager). - FIND_PATH(MIKTEX_BINARY_PATH mpm.exe + find_path(MIKTEX_BINARY_PATH mpm.exe "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MiK\\MiKTeX\\CurrentVersion\\MiKTeX;Install Root]/miktex/bin" - DOC + DOC "Path to the MikTex binary directory." ) - MARK_AS_ADVANCED(MIKTEX_BINARY_PATH) + mark_as_advanced(MIKTEX_BINARY_PATH) # Try to find the GhostScript binary path (look for gswin32). - GET_FILENAME_COMPONENT(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00 + get_filename_component(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\8.00;GS_DLL]" PATH ) - GET_FILENAME_COMPONENT(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_7_04 + get_filename_component(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_7_04 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\7.04;GS_DLL]" PATH ) - FIND_PATH(GHOSTSCRIPT_BINARY_PATH gswin32.exe + find_path(GHOSTSCRIPT_BINARY_PATH gswin32.exe ${GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00} ${GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_7_04} DOC "Path to the GhostScript binary directory." ) - MARK_AS_ADVANCED(GHOSTSCRIPT_BINARY_PATH) + mark_as_advanced(GHOSTSCRIPT_BINARY_PATH) - FIND_PATH(GHOSTSCRIPT_LIBRARY_PATH ps2pdf13.bat + find_path(GHOSTSCRIPT_LIBRARY_PATH ps2pdf13.bat "${GHOSTSCRIPT_BINARY_PATH}/../lib" DOC "Path to the GhostScript library directory." ) - MARK_AS_ADVANCED(GHOSTSCRIPT_LIBRARY_PATH) + mark_as_advanced(GHOSTSCRIPT_LIBRARY_PATH) -ENDIF (WIN32) +endif () -FIND_PROGRAM(LATEX_COMPILER +find_program(LATEX_COMPILER NAMES latex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) -FIND_PROGRAM(PDFLATEX_COMPILER +find_program(PDFLATEX_COMPILER NAMES pdflatex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) -FIND_PROGRAM(BIBTEX_COMPILER +find_program(BIBTEX_COMPILER NAMES bibtex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) -FIND_PROGRAM(MAKEINDEX_COMPILER +find_program(MAKEINDEX_COMPILER NAMES makeindex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) -FIND_PROGRAM(DVIPS_CONVERTER +find_program(DVIPS_CONVERTER NAMES dvips PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) -FIND_PROGRAM(DVIPDF_CONVERTER +find_program(DVIPDF_CONVERTER NAMES dvipdfm dvipdft dvipdf PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) -IF (WIN32) - FIND_PROGRAM(PS2PDF_CONVERTER +if (WIN32) + find_program(PS2PDF_CONVERTER NAMES ps2pdf14.bat PATHS ${GHOSTSCRIPT_LIBRARY_PATH} ) -ELSE (WIN32) - FIND_PROGRAM(PS2PDF_CONVERTER +else () + find_program(PS2PDF_CONVERTER NAMES ps2pdf14 ps2pdf ) -ENDIF (WIN32) +endif () -FIND_PROGRAM(LATEX2HTML_CONVERTER +find_program(LATEX2HTML_CONVERTER NAMES latex2html PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) -MARK_AS_ADVANCED( +mark_as_advanced( LATEX_COMPILER PDFLATEX_COMPILER BIBTEX_COMPILER diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake index 729f5ce73..837e63324 100644 --- a/Modules/FindLibLZMA.cmake +++ b/Modules/FindLibLZMA.cmake @@ -29,30 +29,31 @@ # License text for the above reference.) -FIND_PATH(LIBLZMA_INCLUDE_DIR lzma.h ) -FIND_LIBRARY(LIBLZMA_LIBRARY lzma) +find_path(LIBLZMA_INCLUDE_DIR lzma.h ) +find_library(LIBLZMA_LIBRARY lzma) -IF(LIBLZMA_INCLUDE_DIR AND EXISTS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h") - FILE(READ "${LIBLZMA_INCLUDE_DIR}/lzma/version.h" LIBLZMA_HEADER_CONTENTS) +if(LIBLZMA_INCLUDE_DIR AND EXISTS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h") + file(STRINGS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h" LIBLZMA_HEADER_CONTENTS REGEX "#define LZMA_VERSION_[A-Z]+ [0-9]+") - STRING(REGEX REPLACE ".*#define LZMA_VERSION_MAJOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MAJOR "${LIBLZMA_HEADER_CONTENTS}") - STRING(REGEX REPLACE ".*#define LZMA_VERSION_MINOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MINOR "${LIBLZMA_HEADER_CONTENTS}") - STRING(REGEX REPLACE ".*#define LZMA_VERSION_PATCH ([0-9]+).*" "\\1" LIBLZMA_VERSION_PATCH "${LIBLZMA_HEADER_CONTENTS}") + string(REGEX REPLACE ".*#define LZMA_VERSION_MAJOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MAJOR "${LIBLZMA_HEADER_CONTENTS}") + string(REGEX REPLACE ".*#define LZMA_VERSION_MINOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MINOR "${LIBLZMA_HEADER_CONTENTS}") + string(REGEX REPLACE ".*#define LZMA_VERSION_PATCH ([0-9]+).*" "\\1" LIBLZMA_VERSION_PATCH "${LIBLZMA_HEADER_CONTENTS}") - SET(LIBLZMA_VERSION_STRING "${LIBLZMA_VERSION_MAJOR}.${LIBLZMA_VERSION_MINOR}.${LIBLZMA_VERSION_PATCH}") -ENDIF(LIBLZMA_INCLUDE_DIR AND EXISTS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h") + set(LIBLZMA_VERSION_STRING "${LIBLZMA_VERSION_MAJOR}.${LIBLZMA_VERSION_MINOR}.${LIBLZMA_VERSION_PATCH}") + unset(LIBLZMA_HEADER_CONTENTS) +endif() # We're using new code known now as XZ, even library still been called LZMA # it can be found in http://tukaani.org/xz/ # Avoid using old codebase -IF (LIBLZMA_LIBRARY) - INCLUDE(CheckLibraryExists) +if (LIBLZMA_LIBRARY) + include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET) -ENDIF (LIBLZMA_LIBRARY) +endif () -INCLUDE(FindPackageHandleStandardArgs) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibLZMA REQUIRED_VARS LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY LIBLZMA_HAS_AUTO_DECODER @@ -61,9 +62,9 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibLZMA REQUIRED_VARS LIBLZMA_INCLUDE_DIR VERSION_VAR LIBLZMA_VERSION_STRING ) -IF (LIBLZMA_FOUND) - SET(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY}) - SET(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR}) -ENDIF (LIBLZMA_FOUND) +if (LIBLZMA_FOUND) + set(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY}) + set(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR}) +endif () -MARK_AS_ADVANCED( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY ) +mark_as_advanced( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY ) diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake index 48a549806..858496e09 100644 --- a/Modules/FindLibXml2.cmake +++ b/Modules/FindLibXml2.cmake @@ -23,44 +23,44 @@ # License text for the above reference.) # use pkg-config to get the directories and then use these values -# in the FIND_PATH() and FIND_LIBRARY() calls -FIND_PACKAGE(PkgConfig QUIET) +# in the find_path() and find_library() calls +find_package(PkgConfig QUIET) PKG_CHECK_MODULES(PC_LIBXML QUIET libxml-2.0) -SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER}) +set(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER}) -FIND_PATH(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h +find_path(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h HINTS ${PC_LIBXML_INCLUDEDIR} ${PC_LIBXML_INCLUDE_DIRS} PATH_SUFFIXES libxml2 ) -FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2 +find_library(LIBXML2_LIBRARIES NAMES xml2 libxml2 HINTS ${PC_LIBXML_LIBDIR} ${PC_LIBXML_LIBRARY_DIRS} ) -FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint) +find_program(LIBXML2_XMLLINT_EXECUTABLE xmllint) # for backwards compat. with KDE 4.0.x: -SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}") +set(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}") -IF(PC_LIBXML_VERSION) - SET(LIBXML2_VERSION_STRING ${PC_LIBXML_VERSION}) -ELSEIF(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h") - FILE(STRINGS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h" libxml2_version_str +if(PC_LIBXML_VERSION) + set(LIBXML2_VERSION_STRING ${PC_LIBXML_VERSION}) +elseif(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h") + file(STRINGS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h" libxml2_version_str REGEX "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\".*\"") - STRING(REGEX REPLACE "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1" + string(REGEX REPLACE "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1" LIBXML2_VERSION_STRING "${libxml2_version_str}") - UNSET(libxml2_version_str) -ENDIF() + unset(libxml2_version_str) +endif() -# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 REQUIRED_VARS LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR VERSION_VAR LIBXML2_VERSION_STRING) -MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE) +mark_as_advanced(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE) diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake index dd5aac461..7d142f430 100644 --- a/Modules/FindLibXslt.cmake +++ b/Modules/FindLibXslt.cmake @@ -25,50 +25,50 @@ # License text for the above reference.) # use pkg-config to get the directories and then use these values -# in the FIND_PATH() and FIND_LIBRARY() calls -FIND_PACKAGE(PkgConfig QUIET) +# in the find_path() and find_library() calls +find_package(PkgConfig QUIET) PKG_CHECK_MODULES(PC_LIBXSLT QUIET libxslt) -SET(LIBXSLT_DEFINITIONS ${PC_LIBXSLT_CFLAGS_OTHER}) +set(LIBXSLT_DEFINITIONS ${PC_LIBXSLT_CFLAGS_OTHER}) -FIND_PATH(LIBXSLT_INCLUDE_DIR NAMES libxslt/xslt.h +find_path(LIBXSLT_INCLUDE_DIR NAMES libxslt/xslt.h HINTS ${PC_LIBXSLT_INCLUDEDIR} ${PC_LIBXSLT_INCLUDE_DIRS} ) -FIND_LIBRARY(LIBXSLT_LIBRARIES NAMES xslt libxslt +find_library(LIBXSLT_LIBRARIES NAMES xslt libxslt HINTS ${PC_LIBXSLT_LIBDIR} ${PC_LIBXSLT_LIBRARY_DIRS} ) -FIND_LIBRARY(LIBXSLT_EXSLT_LIBRARY NAMES exslt libexslt +find_library(LIBXSLT_EXSLT_LIBRARY NAMES exslt libexslt HINTS ${PC_LIBXSLT_LIBDIR} ${PC_LIBXSLT_LIBRARY_DIRS} ) -SET(LIBXSLT_EXSLT_LIBRARIES ${LIBXSLT_EXSLT_LIBRARY} ) +set(LIBXSLT_EXSLT_LIBRARIES ${LIBXSLT_EXSLT_LIBRARY} ) -FIND_PROGRAM(LIBXSLT_XSLTPROC_EXECUTABLE xsltproc) +find_program(LIBXSLT_XSLTPROC_EXECUTABLE xsltproc) -IF(PC_LIBXSLT_VERSION) - SET(LIBXSLT_VERSION_STRING ${PC_LIBXSLT_VERSION}) -ELSEIF(LIBXSLT_INCLUDE_DIR AND EXISTS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h") - FILE(STRINGS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h" libxslt_version_str +if(PC_LIBXSLT_VERSION) + set(LIBXSLT_VERSION_STRING ${PC_LIBXSLT_VERSION}) +elseif(LIBXSLT_INCLUDE_DIR AND EXISTS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h") + file(STRINGS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h" libxslt_version_str REGEX "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\".*\"") - STRING(REGEX REPLACE "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1" + string(REGEX REPLACE "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1" LIBXSLT_VERSION_STRING "${libxslt_version_str}") - UNSET(libxslt_version_str) -ENDIF() + unset(libxslt_version_str) +endif() -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt REQUIRED_VARS LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR VERSION_VAR LIBXSLT_VERSION_STRING) -MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR +mark_as_advanced(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES LIBXSLT_EXSLT_LIBRARY LIBXSLT_XSLTPROC_EXECUTABLE) diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake index 9a5cc1703..0276a98f4 100644 --- a/Modules/FindLua50.cmake +++ b/Modules/FindLua50.cmake @@ -1,6 +1,6 @@ # Locate Lua library # This module defines -# LUA50_FOUND, if false, do not try to link to Lua +# LUA50_FOUND, if false, do not try to link to Lua # LUA_LIBRARIES, both lua and lualib # LUA_INCLUDE_DIR, where to find lua.h and lualib.h (and probably lauxlib.h) # @@ -24,9 +24,9 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(LUA_INCLUDE_DIR lua.h +find_path(LUA_INCLUDE_DIR lua.h HINTS - $ENV{LUA_DIR} + ENV LUA_DIR PATH_SUFFIXES include/lua50 include/lua5.0 include/lua5 include/lua include PATHS ~/Library/Frameworks @@ -37,11 +37,11 @@ FIND_PATH(LUA_INCLUDE_DIR lua.h /opt ) -FIND_LIBRARY(LUA_LIBRARY_lua +find_library(LUA_LIBRARY_lua NAMES lua50 lua5.0 lua-5.0 lua5 lua HINTS - $ENV{LUA_DIR} - PATH_SUFFIXES lib64 lib + ENV LUA_DIR + PATH_SUFFIXES lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -53,38 +53,38 @@ FIND_LIBRARY(LUA_LIBRARY_lua # In an OS X framework, lualib is usually included as part of the framework # (like GLU in OpenGL.framework) -IF(${LUA_LIBRARY_lua} MATCHES "framework") - SET( LUA_LIBRARIES "${LUA_LIBRARY_lua}" CACHE STRING "Lua framework") -ELSE(${LUA_LIBRARY_lua} MATCHES "framework") - FIND_LIBRARY(LUA_LIBRARY_lualib +if(${LUA_LIBRARY_lua} MATCHES "framework") + set( LUA_LIBRARIES "${LUA_LIBRARY_lua}" CACHE STRING "Lua framework") +else() + find_library(LUA_LIBRARY_lualib NAMES lualib50 lualib5.0 lualib5 lualib HINTS - $ENV{LUALIB_DIR} - $ENV{LUA_DIR} - PATH_SUFFIXES lib64 lib + ENV LUALIB_DIR + ENV LUA_DIR + PATH_SUFFIXES lib PATHS /sw /opt/local /opt/csw /opt ) - IF(LUA_LIBRARY_lualib AND LUA_LIBRARY_lua) + if(LUA_LIBRARY_lualib AND LUA_LIBRARY_lua) # include the math library for Unix - IF(UNIX AND NOT APPLE) - FIND_LIBRARY(MATH_LIBRARY_FOR_LUA m) - SET( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua};${MATH_LIBRARY_FOR_LUA}" CACHE STRING "This is the concatentation of lua and lualib libraries") + if(UNIX AND NOT APPLE) + find_library(MATH_LIBRARY_FOR_LUA m) + set( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua};${MATH_LIBRARY_FOR_LUA}" CACHE STRING "This is the concatentation of lua and lualib libraries") # For Windows and Mac, don't need to explicitly include the math library - ELSE(UNIX AND NOT APPLE) - SET( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua}" CACHE STRING "This is the concatentation of lua and lualib libraries") - ENDIF(UNIX AND NOT APPLE) - ENDIF(LUA_LIBRARY_lualib AND LUA_LIBRARY_lua) -ENDIF(${LUA_LIBRARY_lua} MATCHES "framework") + else() + set( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua}" CACHE STRING "This is the concatentation of lua and lualib libraries") + endif() + endif() +endif() -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if # all listed variables are TRUE FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua50 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR) -MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES) +mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES) diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake index e111d3624..a2bf0c0ef 100644 --- a/Modules/FindLua51.cmake +++ b/Modules/FindLua51.cmake @@ -1,6 +1,6 @@ # Locate Lua library # This module defines -# LUA51_FOUND, if false, do not try to link to Lua +# LUA51_FOUND, if false, do not try to link to Lua # LUA_LIBRARIES # LUA_INCLUDE_DIR, where to find lua.h # LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8) @@ -25,10 +25,10 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(LUA_INCLUDE_DIR lua.h +find_path(LUA_INCLUDE_DIR lua.h HINTS - $ENV{LUA_DIR} - PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include + ENV LUA_DIR + PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include PATHS ~/Library/Frameworks /Library/Frameworks @@ -38,11 +38,11 @@ FIND_PATH(LUA_INCLUDE_DIR lua.h /opt ) -FIND_LIBRARY(LUA_LIBRARY +find_library(LUA_LIBRARY NAMES lua51 lua5.1 lua-5.1 lua HINTS - $ENV{LUA_DIR} - PATH_SUFFIXES lib64 lib + ENV LUA_DIR + PATH_SUFFIXES lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -52,30 +52,30 @@ FIND_LIBRARY(LUA_LIBRARY /opt ) -IF(LUA_LIBRARY) +if(LUA_LIBRARY) # include the math library for Unix - IF(UNIX AND NOT APPLE) - FIND_LIBRARY(LUA_MATH_LIBRARY m) - SET( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries") + if(UNIX AND NOT APPLE AND NOT BEOS) + find_library(LUA_MATH_LIBRARY m) + set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries") # For Windows and Mac, don't need to explicitly include the math library - ELSE(UNIX AND NOT APPLE) - SET( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries") - ENDIF(UNIX AND NOT APPLE) -ENDIF(LUA_LIBRARY) + else() + set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries") + endif() +endif() -IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") - FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"") +if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") + file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"") - STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}") - UNSET(lua_version_str) -ENDIF() + string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}") + unset(lua_version_str) +endif() -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if # all listed variables are TRUE FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51 REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR VERSION_VAR LUA_VERSION_STRING) -MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) +mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) diff --git a/Modules/FindMFC.cmake b/Modules/FindMFC.cmake index 3df284241..4ff7586dc 100644 --- a/Modules/FindMFC.cmake +++ b/Modules/FindMFC.cmake @@ -18,43 +18,43 @@ # License text for the above reference.) # Assume no MFC support -SET(MFC_FOUND "NO") +set(MFC_FOUND "NO") # Only attempt the try_compile call if it has a chance to succeed: -SET(MFC_ATTEMPT_TRY_COMPILE 0) -IF(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW) - SET(MFC_ATTEMPT_TRY_COMPILE 1) -ENDIF(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW) +set(MFC_ATTEMPT_TRY_COMPILE 0) +if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW) + set(MFC_ATTEMPT_TRY_COMPILE 1) +endif() -IF(MFC_ATTEMPT_TRY_COMPILE) - IF("MFC_HAVE_MFC" MATCHES "^MFC_HAVE_MFC$") - SET(CHECK_INCLUDE_FILE_VAR "afxwin.h") - CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in +if(MFC_ATTEMPT_TRY_COMPILE) + if("MFC_HAVE_MFC" MATCHES "^MFC_HAVE_MFC$") + set(CHECK_INCLUDE_FILE_VAR "afxwin.h") + configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx) - MESSAGE(STATUS "Looking for MFC") - TRY_COMPILE(MFC_HAVE_MFC + message(STATUS "Looking for MFC") + try_compile(MFC_HAVE_MFC ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx CMAKE_FLAGS -DCMAKE_MFC_FLAG:STRING=2 -DCOMPILE_DEFINITIONS:STRING=-D_AFXDLL OUTPUT_VARIABLE OUTPUT) - IF(MFC_HAVE_MFC) - MESSAGE(STATUS "Looking for MFC - found") - SET(MFC_HAVE_MFC 1 CACHE INTERNAL "Have MFC?") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if(MFC_HAVE_MFC) + message(STATUS "Looking for MFC - found") + set(MFC_HAVE_MFC 1 CACHE INTERNAL "Have MFC?") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if MFC exists passed with the following output:\n" "${OUTPUT}\n\n") - ELSE(MFC_HAVE_MFC) - MESSAGE(STATUS "Looking for MFC - not found") - SET(MFC_HAVE_MFC 0 CACHE INTERNAL "Have MFC?") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + else() + message(STATUS "Looking for MFC - not found") + set(MFC_HAVE_MFC 0 CACHE INTERNAL "Have MFC?") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if MFC exists failed with the following output:\n" "${OUTPUT}\n\n") - ENDIF(MFC_HAVE_MFC) - ENDIF("MFC_HAVE_MFC" MATCHES "^MFC_HAVE_MFC$") + endif() + endif() - IF(MFC_HAVE_MFC) - SET(MFC_FOUND "YES") - ENDIF(MFC_HAVE_MFC) -ENDIF(MFC_ATTEMPT_TRY_COMPILE) + if(MFC_HAVE_MFC) + set(MFC_FOUND "YES") + endif() +endif() diff --git a/Modules/FindMPEG.cmake b/Modules/FindMPEG.cmake index cf4ef58f8..f99f87b87 100644 --- a/Modules/FindMPEG.cmake +++ b/Modules/FindMPEG.cmake @@ -20,25 +20,25 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(MPEG_INCLUDE_DIR mpeg2dec/include/video_out.h +find_path(MPEG_INCLUDE_DIR mpeg2dec/include/video_out.h /usr/local/livid ) -FIND_LIBRARY(MPEG_mpeg2_LIBRARY mpeg2 +find_library(MPEG_mpeg2_LIBRARY mpeg2 /usr/local/livid/mpeg2dec/libmpeg2/.libs ) -FIND_LIBRARY( MPEG_vo_LIBRARY vo +find_library( MPEG_vo_LIBRARY vo /usr/local/livid/mpeg2dec/libvo/.libs ) -# handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY) -IF(MPEG_FOUND) - SET( MPEG_LIBRARIES ${MPEG_mpeg2_LIBRARY} ${MPEG_vo_LIBRARY} ) -ENDIF(MPEG_FOUND) +if(MPEG_FOUND) + set( MPEG_LIBRARIES ${MPEG_mpeg2_LIBRARY} ${MPEG_vo_LIBRARY} ) +endif() -MARK_AS_ADVANCED(MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY) +mark_as_advanced(MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY) diff --git a/Modules/FindMPEG2.cmake b/Modules/FindMPEG2.cmake index fab37cf54..fc01c4c1d 100644 --- a/Modules/FindMPEG2.cmake +++ b/Modules/FindMPEG2.cmake @@ -20,35 +20,35 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(MPEG2_INCLUDE_DIR +find_path(MPEG2_INCLUDE_DIR NAMES mpeg2.h mpeg2dec/mpeg2.h PATHS /usr/local/livid ) -FIND_LIBRARY(MPEG2_mpeg2_LIBRARY mpeg2 +find_library(MPEG2_mpeg2_LIBRARY mpeg2 /usr/local/livid/mpeg2dec/libmpeg2/.libs ) -FIND_LIBRARY( MPEG2_vo_LIBRARY vo +find_library( MPEG2_vo_LIBRARY vo /usr/local/livid/mpeg2dec/libvo/.libs ) -# handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG2 DEFAULT_MSG MPEG2_mpeg2_LIBRARY MPEG2_INCLUDE_DIR) -IF(MPEG2_FOUND) - SET( MPEG2_LIBRARIES ${MPEG2_mpeg2_LIBRARY} +if(MPEG2_FOUND) + set( MPEG2_LIBRARIES ${MPEG2_mpeg2_LIBRARY} ${MPEG2_vo_LIBRARY}) #some native mpeg2 installations will depend #on libSDL, if found, add it in. - INCLUDE( FindSDL ) - IF(SDL_FOUND) - SET( MPEG2_LIBRARIES ${MPEG2_LIBRARIES} ${SDL_LIBRARY}) - ENDIF(SDL_FOUND) -ENDIF(MPEG2_FOUND) + include(${CMAKE_CURRENT_LIST_DIR}/FindSDL.cmake) + if(SDL_FOUND) + set( MPEG2_LIBRARIES ${MPEG2_LIBRARIES} ${SDL_LIBRARY}) + endif() +endif() -MARK_AS_ADVANCED(MPEG2_INCLUDE_DIR MPEG2_mpeg2_LIBRARY MPEG2_vo_LIBRARY) +mark_as_advanced(MPEG2_INCLUDE_DIR MPEG2_mpeg2_LIBRARY MPEG2_vo_LIBRARY) diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index ae50ca7b9..143d10af0 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -78,7 +78,7 @@ # include this to handle the QUIETLY and REQUIRED arguments include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -include(GetPrerequisites) +include(${CMAKE_CURRENT_LIST_DIR}/GetPrerequisites.cmake) # # This part detects MPI compilers, attempting to wade through the mess of compiler names in @@ -576,6 +576,11 @@ foreach (lang C CXX Fortran) try_regular_compiler(${lang} regular_compiler_worked) endif() + set(MPI_${lang}_FIND_QUIETLY ${MPI_FIND_QUIETLY}) + set(MPI_${lang}_FIND_REQUIRED ${MPI_FIND_REQUIRED}) + set(MPI_${lang}_FIND_VERSION ${MPI_FIND_VERSION}) + set(MPI_${lang}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT}) + if (regular_compiler_worked) find_package_handle_standard_args(MPI_${lang} DEFAULT_MSG MPI_${lang}_COMPILER) else() diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 1cdb07174..803848806 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -19,75 +19,75 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET(MATLAB_FOUND 0) -IF(WIN32) - IF(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") - SET(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/msvc60") - ELSE(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") - IF(${CMAKE_GENERATOR} MATCHES "Visual Studio 7") +set(MATLAB_FOUND 0) +if(WIN32) + if(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") + set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/msvc60") + else() + if(${CMAKE_GENERATOR} MATCHES "Visual Studio 7") # Assume people are generally using 7.1, # if using 7.0 need to link to: ../extern/lib/win32/microsoft/msvc70 - SET(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/msvc71") - ELSE(${CMAKE_GENERATOR} MATCHES "Visual Studio 7") - IF(${CMAKE_GENERATOR} MATCHES "Borland") + set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/msvc71") + else() + if(${CMAKE_GENERATOR} MATCHES "Borland") # Same here, there are also: bcc50 and bcc51 directories - SET(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/bcc54") - ELSE(${CMAKE_GENERATOR} MATCHES "Borland") - IF(MATLAB_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Generator not compatible: ${CMAKE_GENERATOR}") - ENDIF(MATLAB_FIND_REQUIRED) - ENDIF(${CMAKE_GENERATOR} MATCHES "Borland") - ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 7") - ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") - FIND_LIBRARY(MATLAB_MEX_LIBRARY + set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/bcc54") + else() + if(MATLAB_FIND_REQUIRED) + message(FATAL_ERROR "Generator not compatible: ${CMAKE_GENERATOR}") + endif() + endif() + endif() + endif() + find_library(MATLAB_MEX_LIBRARY libmex ${MATLAB_ROOT} ) - FIND_LIBRARY(MATLAB_MX_LIBRARY + find_library(MATLAB_MX_LIBRARY libmx ${MATLAB_ROOT} ) - FIND_LIBRARY(MATLAB_ENG_LIBRARY + find_library(MATLAB_ENG_LIBRARY libeng ${MATLAB_ROOT} ) - FIND_PATH(MATLAB_INCLUDE_DIR + find_path(MATLAB_INCLUDE_DIR "mex.h" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/include" ) -ELSE( WIN32 ) - IF(CMAKE_SIZEOF_VOID_P EQUAL 4) +else() + if(CMAKE_SIZEOF_VOID_P EQUAL 4) # Regular x86 - SET(MATLAB_ROOT + set(MATLAB_ROOT /usr/local/matlab-7sp1/bin/glnx86/ /opt/matlab-7sp1/bin/glnx86/ $ENV{HOME}/matlab-7sp1/bin/glnx86/ $ENV{HOME}/redhat-matlab/bin/glnx86/ ) - ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4) + else() # AMD64: - SET(MATLAB_ROOT + set(MATLAB_ROOT /usr/local/matlab-7sp1/bin/glnxa64/ /opt/matlab-7sp1/bin/glnxa64/ $ENV{HOME}/matlab7_64/bin/glnxa64/ $ENV{HOME}/matlab-7sp1/bin/glnxa64/ $ENV{HOME}/redhat-matlab/bin/glnxa64/ ) - ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4) - FIND_LIBRARY(MATLAB_MEX_LIBRARY + endif() + find_library(MATLAB_MEX_LIBRARY mex ${MATLAB_ROOT} ) - FIND_LIBRARY(MATLAB_MX_LIBRARY + find_library(MATLAB_MX_LIBRARY mx ${MATLAB_ROOT} ) - FIND_LIBRARY(MATLAB_ENG_LIBRARY + find_library(MATLAB_ENG_LIBRARY eng ${MATLAB_ROOT} ) - FIND_PATH(MATLAB_INCLUDE_DIR + find_path(MATLAB_INCLUDE_DIR "mex.h" "/usr/local/matlab-7sp1/extern/include/" "/opt/matlab-7sp1/extern/include/" @@ -95,20 +95,20 @@ ELSE( WIN32 ) "$ENV{HOME}/redhat-matlab/extern/include/" ) -ENDIF(WIN32) +endif() # This is common to UNIX and Win32: -SET(MATLAB_LIBRARIES +set(MATLAB_LIBRARIES ${MATLAB_MEX_LIBRARY} ${MATLAB_MX_LIBRARY} ${MATLAB_ENG_LIBRARY} ) -IF(MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES) - SET(MATLAB_FOUND 1) -ENDIF(MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES) +if(MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES) + set(MATLAB_FOUND 1) +endif() -MARK_AS_ADVANCED( +mark_as_advanced( MATLAB_LIBRARIES MATLAB_MEX_LIBRARY MATLAB_MX_LIBRARY diff --git a/Modules/FindMotif.cmake b/Modules/FindMotif.cmake index e35411272..5065e3a2d 100644 --- a/Modules/FindMotif.cmake +++ b/Modules/FindMotif.cmake @@ -17,28 +17,28 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET(MOTIF_FOUND 0) +set(MOTIF_FOUND 0) -IF(UNIX) - FIND_PATH(MOTIF_INCLUDE_DIR +if(UNIX) + find_path(MOTIF_INCLUDE_DIR Xm/Xm.h /usr/openwin/include ) - FIND_LIBRARY(MOTIF_LIBRARIES + find_library(MOTIF_LIBRARIES Xm /usr/openwin/lib ) -ENDIF(UNIX) +endif() -# handle the QUIETLY and REQUIRED arguments and set MOTIF_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set MOTIF_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Motif DEFAULT_MSG MOTIF_LIBRARIES MOTIF_INCLUDE_DIR) -MARK_AS_ADVANCED( +mark_as_advanced( MOTIF_INCLUDE_DIR MOTIF_LIBRARIES ) diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index cb3ce4813..78fd632a5 100644 --- a/Modules/FindOpenAL.cmake +++ b/Modules/FindOpenAL.cmake @@ -1,7 +1,7 @@ # Locate OpenAL # This module defines # OPENAL_LIBRARY -# OPENAL_FOUND, if false, do not try to link to OpenAL +# OPENAL_FOUND, if false, do not try to link to OpenAL # OPENAL_INCLUDE_DIR, where to find the headers # # $OPENALDIR is an environment variable that would @@ -25,31 +25,31 @@ # This makes the presumption that you are include al.h like # #include "al.h" -# and not +# and not # #include # The reason for this is that the latter is not entirely portable. -# Windows/Creative Labs does not by default put their headers in AL/ and +# Windows/Creative Labs does not by default put their headers in AL/ and # OS X uses the convention . -# -# For Windows, Creative Labs seems to have added a registry key for their +# +# For Windows, Creative Labs seems to have added a registry key for their # OpenAL 1.1 installer. I have added that key to the list of search paths, -# however, the key looks like it could be a little fragile depending on +# however, the key looks like it could be a little fragile depending on # if they decide to change the 1.00.0000 number for bug fix releases. # Also, they seem to have laid down groundwork for multiple library platforms # which puts the library in an extra subdirectory. Currently there is only -# Win32 and I have hardcoded that here. This may need to be adjusted as +# Win32 and I have hardcoded that here. This may need to be adjusted as # platforms are introduced. # The OpenAL 1.0 installer doesn't seem to have a useful key I can use. # I do not know if the Nvidia OpenAL SDK has a registry key. -# -# For OS X, remember that OpenAL was added by Apple in 10.4 (Tiger). -# To support the framework, I originally wrote special framework detection +# +# For OS X, remember that OpenAL was added by Apple in 10.4 (Tiger). +# To support the framework, I originally wrote special framework detection # code in this module which I have now removed with CMake's introduction # of native support for frameworks. -# In addition, OpenAL is open source, and it is possible to compile on Panther. -# Furthermore, due to bugs in the initial OpenAL release, and the +# In addition, OpenAL is open source, and it is possible to compile on Panther. +# Furthermore, due to bugs in the initial OpenAL release, and the # transition to OpenAL 1.1, it is common to need to override the built-in -# framework. +# framework. # Per my request, CMake should search for frameworks first in # the following order: # ~/Library/Frameworks/OpenAL.framework/Headers @@ -57,13 +57,13 @@ # /System/Library/Frameworks/OpenAL.framework/Headers # # On OS X, this will prefer the Framework version (if found) over others. -# People will have to manually change the cache values of +# People will have to manually change the cache values of # OPENAL_LIBRARY to override this selection or set the CMake environment # CMAKE_INCLUDE_PATH to modify the search paths. -FIND_PATH(OPENAL_INCLUDE_DIR al.h +find_path(OPENAL_INCLUDE_DIR al.h HINTS - $ENV{OPENALDIR} + ENV OPENALDIR PATH_SUFFIXES include/AL include/OpenAL include PATHS ~/Library/Frameworks @@ -75,10 +75,10 @@ FIND_PATH(OPENAL_INCLUDE_DIR al.h [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] ) -FIND_LIBRARY(OPENAL_LIBRARY +find_library(OPENAL_LIBRARY NAMES OpenAL al openal OpenAL32 HINTS - $ENV{OPENALDIR} + ENV OPENALDIR PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 PATHS ~/Library/Frameworks @@ -93,7 +93,7 @@ FIND_LIBRARY(OPENAL_LIBRARY # handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR) -MARK_AS_ADVANCED(OPENAL_LIBRARY OPENAL_INCLUDE_DIR) +mark_as_advanced(OPENAL_LIBRARY OPENAL_INCLUDE_DIR) diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 98d8808c0..96c4d8db5 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -1,18 +1,18 @@ # - Try to find OpenGL # Once done this will define -# +# # OPENGL_FOUND - system has OpenGL # OPENGL_XMESA_FOUND - system has XMESA # OPENGL_GLU_FOUND - system has GLU # OPENGL_INCLUDE_DIR - the GL include directory # OPENGL_LIBRARIES - Link these to use OpenGL and GLU -# +# # If you want to use just GL you can use these values # OPENGL_gl_LIBRARY - Path to OpenGL Library # OPENGL_glu_LIBRARY - Path to GLU Library -# +# # On OSX default to using the framework version of opengl -# People will have to change the cache values of OPENGL_glu_LIBRARY +# People will have to change the cache values of OPENGL_glu_LIBRARY # and OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX #============================================================================= @@ -28,45 +28,53 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF (WIN32) - IF (CYGWIN) +if (WIN32) + if (CYGWIN) - FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h ) + find_path(OPENGL_INCLUDE_DIR GL/gl.h ) - FIND_LIBRARY(OPENGL_gl_LIBRARY opengl32 ) + find_library(OPENGL_gl_LIBRARY opengl32 ) - FIND_LIBRARY(OPENGL_glu_LIBRARY glu32 ) + find_library(OPENGL_glu_LIBRARY glu32 ) - ELSE (CYGWIN) + else () - IF(BORLAND) - SET (OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL library for win32") - SET (OPENGL_glu_LIBRARY import32 CACHE STRING "GLU library for win32") - ELSE(BORLAND) - SET (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32") - SET (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32") - ENDIF(BORLAND) + if(BORLAND) + set (OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL library for win32") + set (OPENGL_glu_LIBRARY import32 CACHE STRING "GLU library for win32") + else() + set (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32") + set (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32") + endif() - ENDIF (CYGWIN) + endif () -ELSE (WIN32) +else () - IF (APPLE) + if (APPLE) - FIND_LIBRARY(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX") - FIND_LIBRARY(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX") - FIND_PATH(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX") + find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX") + find_library(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX") + find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX") - ELSE(APPLE) - # Handle HP-UX cases where we only want to find OpenGL in either hpux64 - # or hpux32 depending on if we're doing a 64 bit build. - IF(CMAKE_SIZEOF_VOID_P EQUAL 4) - SET(HPUX_IA_OPENGL_LIB_PATH /opt/graphics/OpenGL/lib/hpux32/) - ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4) - SET(HPUX_IA_OPENGL_LIB_PATH - /opt/graphics/OpenGL/lib/hpux64/ - /opt/graphics/OpenGL/lib/pa20_64) - ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4) + else() + if (CMAKE_SYSTEM_NAME MATCHES "HP-UX") + # Handle HP-UX cases where we only want to find OpenGL in either hpux64 + # or hpux32 depending on if we're doing a 64 bit build. + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(_OPENGL_LIB_PATH + /opt/graphics/OpenGL/lib/hpux32/) + else() + set(_OPENGL_LIB_PATH + /opt/graphics/OpenGL/lib/hpux64/ + /opt/graphics/OpenGL/lib/pa20_64) + endif() + elseif(CMAKE_SYSTEM_NAME STREQUAL Haiku) + set(_OPENGL_LIB_PATH + /boot/develop/lib/x86) + set(_OPENGL_INCLUDE_PATH + /boot/develop/headers/os/opengl) + endif() # The first line below is to make sure that the proper headers # are used on a Linux machine with the NVidia drivers installed. @@ -76,43 +84,47 @@ ELSE (WIN32) # Make sure the NVIDIA directory comes BEFORE the others. # - Atanas Georgiev - FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h + find_path(OPENGL_INCLUDE_DIR GL/gl.h /usr/share/doc/NVIDIA_GLX-1.0/include /usr/openwin/share/include /opt/graphics/OpenGL/include /usr/X11R6/include + ${_OPENGL_INCLUDE_PATH} ) - FIND_PATH(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h + find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h /usr/share/doc/NVIDIA_GLX-1.0/include /usr/openwin/share/include /opt/graphics/OpenGL/include /usr/X11R6/include ) - FIND_LIBRARY(OPENGL_gl_LIBRARY + find_library(OPENGL_gl_LIBRARY NAMES GL MesaGL PATHS /opt/graphics/OpenGL/lib /usr/openwin/lib /usr/shlib /usr/X11R6/lib - ${HPUX_IA_OPENGL_LIB_PATH} + ${_OPENGL_LIB_PATH} ) + unset(_OPENGL_INCLUDE_PATH) + unset(_OPENGL_LIB_PATH) + # On Unix OpenGL most certainly always requires X11. - # Feel free to tighten up these conditions if you don't + # Feel free to tighten up these conditions if you don't # think this is always true. # It's not true on OSX. - IF (OPENGL_gl_LIBRARY) - IF(NOT X11_FOUND) - INCLUDE(FindX11) - ENDIF(NOT X11_FOUND) - IF (X11_FOUND) - IF (NOT APPLE) - SET (OPENGL_LIBRARIES ${X11_LIBRARIES}) - ENDIF (NOT APPLE) - ENDIF (X11_FOUND) - ENDIF (OPENGL_gl_LIBRARY) - - FIND_LIBRARY(OPENGL_glu_LIBRARY + if (OPENGL_gl_LIBRARY) + if(NOT X11_FOUND) + include(${CMAKE_CURRENT_LIST_DIR}/FindX11.cmake) + endif() + if (X11_FOUND) + if (NOT APPLE) + set (OPENGL_LIBRARIES ${X11_LIBRARIES}) + endif () + endif () + endif () + + find_library(OPENGL_glu_LIBRARY NAMES GLU MesaGLU PATHS ${OPENGL_gl_LIBRARY} /opt/graphics/OpenGL/lib @@ -120,39 +132,39 @@ ELSE (WIN32) /usr/shlib /usr/X11R6/lib ) - ENDIF(APPLE) -ENDIF (WIN32) + endif() +endif () -IF(OPENGL_gl_LIBRARY) +if(OPENGL_gl_LIBRARY) - IF(OPENGL_xmesa_INCLUDE_DIR) - SET( OPENGL_XMESA_FOUND "YES" ) - ELSE(OPENGL_xmesa_INCLUDE_DIR) - SET( OPENGL_XMESA_FOUND "NO" ) - ENDIF(OPENGL_xmesa_INCLUDE_DIR) + if(OPENGL_xmesa_INCLUDE_DIR) + set( OPENGL_XMESA_FOUND "YES" ) + else() + set( OPENGL_XMESA_FOUND "NO" ) + endif() - SET( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES}) - IF(OPENGL_glu_LIBRARY) - SET( OPENGL_GLU_FOUND "YES" ) - SET( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} ) - ELSE(OPENGL_glu_LIBRARY) - SET( OPENGL_GLU_FOUND "NO" ) - ENDIF(OPENGL_glu_LIBRARY) + set( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES}) + if(OPENGL_glu_LIBRARY) + set( OPENGL_GLU_FOUND "YES" ) + set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} ) + else() + set( OPENGL_GLU_FOUND "NO" ) + endif() # This deprecated setting is for backward compatibility with CMake1.4 - SET (OPENGL_LIBRARY ${OPENGL_LIBRARIES}) + set (OPENGL_LIBRARY ${OPENGL_LIBRARIES}) -ENDIF(OPENGL_gl_LIBRARY) +endif() # This deprecated setting is for backward compatibility with CMake1.4 -SET(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR}) +set(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR}) # handle the QUIETLY and REQUIRED arguments and set OPENGL_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL DEFAULT_MSG OPENGL_gl_LIBRARY) -MARK_AS_ADVANCED( +mark_as_advanced( OPENGL_INCLUDE_DIR OPENGL_xmesa_INCLUDE_DIR OPENGL_glu_LIBRARY diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index b96a2ecfb..f4a9f44c6 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -1,7 +1,9 @@ # - Finds OpenMP support # This module can be used to detect OpenMP support in a compiler. # If the compiler supports OpenMP, the flags required to compile with -# openmp support are set. +# OpenMP support are returned in variables for the different languages. +# The variables may be empty if the compiler does not need a special +# flag to support OpenMP. # # The following variables are set: # OpenMP_C_FLAGS - flags to add to the C compiler for OpenMP support @@ -72,15 +74,15 @@ function(_OPENMP_FLAG_CANDIDATES LANG) endif() set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_FLAG_CANDIDATES}" PARENT_SCOPE) -endfunction(_OPENMP_FLAG_CANDIDATES) +endfunction() # sample openmp source code to test -set(OpenMP_C_TEST_SOURCE +set(OpenMP_C_TEST_SOURCE " #include -int main() { +int main() { #ifdef _OPENMP - return 0; + return 0; #else breaks_on_purpose #endif @@ -95,7 +97,7 @@ if(CMAKE_C_COMPILER_LOADED) unset(OpenMP_C_FLAG_CANDIDATES) else() _OPENMP_FLAG_CANDIDATES("C") - include(CheckCSourceCompiles) + include(${CMAKE_CURRENT_LIST_DIR}/CheckCSourceCompiles.cmake) endif() foreach(FLAG ${OpenMP_C_FLAG_CANDIDATES}) @@ -108,8 +110,8 @@ if(CMAKE_C_COMPILER_LOADED) if(OpenMP_FLAG_DETECTED) set(OpenMP_C_FLAGS_INTERNAL "${FLAG}") break() - endif(OpenMP_FLAG_DETECTED) - endforeach(FLAG ${OpenMP_C_FLAG_CANDIDATES}) + endif() + endforeach() set(OpenMP_C_FLAGS "${OpenMP_C_FLAGS_INTERNAL}" CACHE STRING "C compiler flags for OpenMP parallization") @@ -126,7 +128,7 @@ if(CMAKE_CXX_COMPILER_LOADED) unset(OpenMP_CXX_FLAG_CANDIDATES) else() _OPENMP_FLAG_CANDIDATES("CXX") - include(CheckCXXSourceCompiles) + include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSourceCompiles.cmake) # use the same source for CXX as C for now set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE}) @@ -142,8 +144,8 @@ if(CMAKE_CXX_COMPILER_LOADED) if(OpenMP_FLAG_DETECTED) set(OpenMP_CXX_FLAGS_INTERNAL "${FLAG}") break() - endif(OpenMP_FLAG_DETECTED) - endforeach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES}) + endif() + endforeach() set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS_INTERNAL}" CACHE STRING "C++ compiler flags for OpenMP parallization") diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index d1fc2d259..224c88e0e 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -27,29 +27,38 @@ if (UNIX) find_package(PkgConfig QUIET) pkg_check_modules(_OPENSSL QUIET openssl) -endif (UNIX) - -# http://www.slproweb.com/products/Win32OpenSSL.html -SET(_OPENSSL_ROOT_HINTS - $ENV{OPENSSL_ROOT_DIR} - ${OPENSSL_ROOT_DIR} - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]" - ) -SET(_OPENSSL_ROOT_PATHS - "$ENV{PROGRAMFILES}/OpenSSL" - "$ENV{PROGRAMFILES}/OpenSSL-Win32" - "$ENV{PROGRAMFILES}/OpenSSL-Win64" - "C:/OpenSSL/" - "C:/OpenSSL-Win32/" - "C:/OpenSSL-Win64/" - ) -SET(_OPENSSL_ROOT_HINTS_AND_PATHS - HINTS ${_OPENSSL_ROOT_HINTS} - PATHS ${_OPENSSL_ROOT_PATHS} - ) +endif () + +if (WIN32) + # http://www.slproweb.com/products/Win32OpenSSL.html + set(_OPENSSL_ROOT_HINTS + ${OPENSSL_ROOT_DIR} + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]" + ENV OPENSSL_ROOT_DIR + ) + file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles) + set(_OPENSSL_ROOT_PATHS + "${_programfiles}/OpenSSL" + "${_programfiles}/OpenSSL-Win32" + "${_programfiles}/OpenSSL-Win64" + "C:/OpenSSL/" + "C:/OpenSSL-Win32/" + "C:/OpenSSL-Win64/" + ) + unset(_programfiles) + set(_OPENSSL_ROOT_HINTS_AND_PATHS + HINTS ${_OPENSSL_ROOT_HINTS} + PATHS ${_OPENSSL_ROOT_PATHS} + ) +else () + set(_OPENSSL_ROOT_HINTS + ${OPENSSL_ROOT_DIR} + ENV OPENSSL_ROOT_DIR + ) +endif () -FIND_PATH(OPENSSL_INCLUDE_DIR +find_path(OPENSSL_INCLUDE_DIR NAMES openssl/ssl.h HINTS @@ -59,9 +68,8 @@ FIND_PATH(OPENSSL_INCLUDE_DIR include ) -IF(WIN32 AND NOT CYGWIN) - # MINGW should go here too - IF(MSVC) +if(WIN32 AND NOT CYGWIN) + if(MSVC) # /MD and /MDd are the standard values - if someone wants to use # others, the libnames have to change here too # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b @@ -76,10 +84,10 @@ IF(WIN32 AND NOT CYGWIN) # We are using the libraries located in the VC subdir instead of the parent directory eventhough : # libeay32MD.lib is identical to ../libeay32.lib, and # ssleay32MD.lib is identical to ../ssleay32.lib - FIND_LIBRARY(LIB_EAY_DEBUG + find_library(LIB_EAY_DEBUG NAMES libeay32MDd - libeay32 + libeay32d ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib" @@ -87,7 +95,7 @@ IF(WIN32 AND NOT CYGWIN) "lib/VC" ) - FIND_LIBRARY(LIB_EAY_RELEASE + find_library(LIB_EAY_RELEASE NAMES libeay32MD libeay32 @@ -98,11 +106,10 @@ IF(WIN32 AND NOT CYGWIN) "lib/VC" ) - FIND_LIBRARY(SSL_EAY_DEBUG + find_library(SSL_EAY_DEBUG NAMES ssleay32MDd - ssleay32 - ssl + ssleay32d ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib" @@ -110,7 +117,7 @@ IF(WIN32 AND NOT CYGWIN) "lib/VC" ) - FIND_LIBRARY(SSL_EAY_RELEASE + find_library(SSL_EAY_RELEASE NAMES ssleay32MD ssleay32 @@ -122,41 +129,49 @@ IF(WIN32 AND NOT CYGWIN) "lib/VC" ) - if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) - set( OPENSSL_LIBRARIES - optimized ${SSL_EAY_RELEASE} debug ${SSL_EAY_DEBUG} - optimized ${LIB_EAY_RELEASE} debug ${LIB_EAY_DEBUG} - ) - else() - set( OPENSSL_LIBRARIES ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} ) - endif() - MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE) - MARK_AS_ADVANCED(LIB_EAY_DEBUG LIB_EAY_RELEASE) - ELSEIF(MINGW) + set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}") + set(LIB_EAY_LIBRARY_RELEASE "${LIB_EAY_RELEASE}") + set(SSL_EAY_LIBRARY_DEBUG "${SSL_EAY_DEBUG}") + set(SSL_EAY_LIBRARY_RELEASE "${SSL_EAY_RELEASE}") + + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(LIB_EAY) + select_library_configurations(SSL_EAY) + + set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} ) + elseif(MINGW) # same player, for MingW - FIND_LIBRARY(LIB_EAY + set(LIB_EAY_NAMES libeay32) + set(SSL_EAY_NAMES ssleay32) + if(CMAKE_CROSS_COMPILING) + list(APPEND LIB_EAY_NAMES crypto) + list(APPEND SSL_EAY_NAMES ssl) + endif() + find_library(LIB_EAY NAMES - libeay32 + ${LIB_EAY_NAMES} ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib" "lib/MinGW" ) - FIND_LIBRARY(SSL_EAY + find_library(SSL_EAY NAMES - ssleay32 + ${SSL_EAY_NAMES} ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib" "lib/MinGW" ) - MARK_AS_ADVANCED(SSL_EAY LIB_EAY) + mark_as_advanced(SSL_EAY LIB_EAY) set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) - ELSE(MSVC) + unset(LIB_EAY_NAMES) + unset(SSL_EAY_NAMES) + else() # Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues: - FIND_LIBRARY(LIB_EAY + find_library(LIB_EAY NAMES libeay32 HINTS @@ -166,7 +181,7 @@ IF(WIN32 AND NOT CYGWIN) lib ) - FIND_LIBRARY(SSL_EAY + find_library(SSL_EAY NAMES ssleay32 HINTS @@ -176,12 +191,12 @@ IF(WIN32 AND NOT CYGWIN) lib ) - MARK_AS_ADVANCED(SSL_EAY LIB_EAY) + mark_as_advanced(SSL_EAY LIB_EAY) set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) - ENDIF(MSVC) -ELSE(WIN32 AND NOT CYGWIN) + endif() +else() - FIND_LIBRARY(OPENSSL_SSL_LIBRARY + find_library(OPENSSL_SSL_LIBRARY NAMES ssl ssleay32 @@ -193,7 +208,7 @@ ELSE(WIN32 AND NOT CYGWIN) lib ) - FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARY + find_library(OPENSSL_CRYPTO_LIBRARY NAMES crypto HINTS @@ -203,15 +218,15 @@ ELSE(WIN32 AND NOT CYGWIN) lib ) - MARK_AS_ADVANCED(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY) + mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY) # compat defines - SET(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY}) - SET(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) + set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY}) + set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) - SET(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}) + set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}) -ENDIF(WIN32 AND NOT CYGWIN) +endif() function(from_hex HEX DEC) string(TOUPPER "${HEX}" HEX) @@ -242,7 +257,7 @@ function(from_hex HEX DEC) endwhile() set(${DEC} ${_res} PARENT_SCOPE) -endfunction(from_hex) +endfunction() if (OPENSSL_INCLUDE_DIR) if (_OPENSSL_VERSION) @@ -276,11 +291,11 @@ if (OPENSSL_INCLUDE_DIR) # this should be updated to handle that, too. This has not happened yet # so it is simply ignored here for now. string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING) - endif (NOT OPENSSL_VERSION_PATCH STREQUAL "00") + endif () set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}") - endif (_OPENSSL_VERSION) -endif (OPENSSL_INCLUDE_DIR) + endif () +endif () include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) @@ -294,11 +309,11 @@ if (OPENSSL_VERSION) FAIL_MESSAGE "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR" ) -else (OPENSSL_VERSION) +else () find_package_handle_standard_args(OpenSSL "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR" OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR ) -endif (OPENSSL_VERSION) +endif () -MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES) +mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES) diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake index 52f931689..7affca8a2 100644 --- a/Modules/FindOpenSceneGraph.cmake +++ b/Modules/FindOpenSceneGraph.cmake @@ -14,7 +14,7 @@ # # OpenSceneGraph_DEBUG - Enable debugging output # -# OpenSceneGraph_MARK_AS_ADVANCED - Mark cache variables as advanced +# OpenSceneGraph_MARK_AS_ADVANCED - Mark cache variables as advanced # automatically # # The following environment variables are also respected for finding the OSG @@ -26,6 +26,10 @@ # OSGDIR # OSG_ROOT # +# [CMake 2.8.10]: +# The CMake variable OSG_DIR can now be used as well to influence detection, instead of needing +# to specify an environment variable. +# # This module defines the following output variables: # # OPENSCENEGRAPH_FOUND - Was the OSG and all of the specified components found? @@ -49,7 +53,7 @@ #============================================================================= # Copyright 2009 Kitware, Inc. -# Copyright 2009 Philip Lowman +# Copyright 2009-2012 Philip Lowman # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -68,7 +72,7 @@ # Output variables of the form OPENSCENEGRAPH_FOO # -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) set(_osg_modules_to_process) foreach(_osg_component ${OpenSceneGraph_FIND_COMPONENTS}) @@ -96,14 +100,15 @@ if(OSG_INCLUDE_DIR) message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " "Detected OSG_INCLUDE_DIR = ${OSG_INCLUDE_DIR}") endif() - + set(_osg_Version_file "${OSG_INCLUDE_DIR}/osg/Version") if("${OSG_INCLUDE_DIR}" MATCHES "\\.framework$" AND NOT EXISTS "${_osg_Version_file}") set(_osg_Version_file "${OSG_INCLUDE_DIR}/Headers/Version") endif() - + if(EXISTS "${_osg_Version_file}") - file(READ "${_osg_Version_file}" _osg_Version_contents) + file(STRINGS "${_osg_Version_file}" _osg_Version_contents + REGEX "#define (OSG_VERSION_[A-Z]+|OPENSCENEGRAPH_[A-Z]+_VERSION)[ \t]+[0-9]+") else() set(_osg_Version_contents "unknown") endif() @@ -130,6 +135,7 @@ if(OSG_INCLUDE_DIR) message(WARNING "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " "Failed to parse version number, please report this as a bug") endif() + unset(_osg_Version_contents) set(OPENSCENEGRAPH_VERSION "${_osg_VERSION_MAJOR}.${_osg_VERSION_MINOR}.${_osg_VERSION_PATCH}" CACHE INTERNAL "The version of OSG which was detected") @@ -139,29 +145,12 @@ if(OSG_INCLUDE_DIR) endif() endif() -# -# Version checking -# -if(OpenSceneGraph_FIND_VERSION AND OPENSCENEGRAPH_VERSION) - if(OpenSceneGraph_FIND_VERSION_EXACT) - if(NOT OPENSCENEGRAPH_VERSION VERSION_EQUAL ${OpenSceneGraph_FIND_VERSION}) - set(_osg_version_not_exact TRUE) - endif() - else() - # version is too low - if(NOT OPENSCENEGRAPH_VERSION VERSION_EQUAL ${OpenSceneGraph_FIND_VERSION} AND - NOT OPENSCENEGRAPH_VERSION VERSION_GREATER ${OpenSceneGraph_FIND_VERSION}) - set(_osg_version_not_high_enough TRUE) - endif() - endif() -endif() - set(_osg_quiet) if(OpenSceneGraph_FIND_QUIETLY) set(_osg_quiet "QUIET") endif() # -# Here we call FIND_PACKAGE() on all of the components +# Here we call find_package() on all of the components # foreach(_osg_module ${_osg_modules_to_process}) if(OpenSceneGraph_DEBUG) @@ -182,65 +171,24 @@ endforeach() if(OPENSCENEGRAPH_INCLUDE_DIR) list(REMOVE_DUPLICATES OPENSCENEGRAPH_INCLUDE_DIR) endif() - + # -# Inform the users with an error message based on -# what version they have vs. what version was -# required. +# Check each module to see if it's found # +set(_osg_component_founds) if(OpenSceneGraph_FIND_REQUIRED) - set(_osg_version_output_type FATAL_ERROR) -else() - set(_osg_version_output_type STATUS) + foreach(_osg_module ${_osg_modules_to_process}) + string(TOUPPER ${_osg_module} _osg_module_UC) + list(APPEND _osg_component_founds ${_osg_module_UC}_FOUND) + endforeach() endif() -if(_osg_version_not_high_enough) - set(_osg_EPIC_FAIL TRUE) - if(NOT OpenSceneGraph_FIND_QUIETLY) - message(${_osg_version_output_type} - "ERROR: Version ${OpenSceneGraph_FIND_VERSION} or higher of the OSG " - "is required. Version ${OPENSCENEGRAPH_VERSION} was found.") - endif() -elseif(_osg_version_not_exact) - set(_osg_EPIC_FAIL TRUE) - if(NOT OpenSceneGraph_FIND_QUIETLY) - message(${_osg_version_output_type} - "ERROR: Version ${OpenSceneGraph_FIND_VERSION} of the OSG is required " - "(exactly), version ${OPENSCENEGRAPH_VERSION} was found.") - endif() -else() - - # - # Check each module to see if it's found - # - if(OpenSceneGraph_FIND_REQUIRED) - set(_osg_missing_message) - foreach(_osg_module ${_osg_modules_to_process}) - string(TOUPPER ${_osg_module} _osg_module_UC) - if(NOT ${_osg_module_UC}_FOUND) - set(_osg_missing_nodekit_fail true) - set(_osg_missing_message "${_osg_missing_message} ${_osg_module}") - endif() - endforeach() - - if(_osg_missing_nodekit_fail) - message(FATAL_ERROR "ERROR: Missing the following osg " - "libraries: ${_osg_missing_message}.\n" - "Consider using CMAKE_PREFIX_PATH or the OSG_DIR " - "environment variable. See the " - "${CMAKE_CURRENT_LIST_FILE} for more details.") - endif() - endif() - include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph DEFAULT_MSG OPENSCENEGRAPH_LIBRARIES OPENSCENEGRAPH_INCLUDE_DIR) -endif() +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph + REQUIRED_VARS OPENSCENEGRAPH_LIBRARIES OPENSCENEGRAPH_INCLUDE_DIR ${_osg_component_founds} + VERSION_VAR OPENSCENEGRAPH_VERSION) -if(_osg_EPIC_FAIL) - # Zero out everything, we didn't meet version requirements - set(OPENSCENEGRAPH_FOUND FALSE) - set(OPENSCENEGRAPH_LIBRARIES) - set(OPENSCENEGRAPH_INCLUDE_DIR) -endif() +unset(_osg_component_founds) set(OPENSCENEGRAPH_INCLUDE_DIRS ${OPENSCENEGRAPH_INCLUDE_DIR}) diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake index 6b81fbe3a..e0599604a 100644 --- a/Modules/FindOpenThreads.cmake +++ b/Modules/FindOpenThreads.cmake @@ -1,10 +1,10 @@ -# OpenThreads is a C++ based threading library. Its largest userbase +# OpenThreads is a C++ based threading library. Its largest userbase # seems to OpenSceneGraph so you might notice I accept OSGDIR as an # environment path. -# I consider this part of the Findosg* suite used to find OpenSceneGraph +# I consider this part of the Findosg* suite used to find OpenSceneGraph # components. # Each component is separate and you must opt in to each module. -# +# # Locate OpenThreads # This module defines # OPENTHREADS_LIBRARY @@ -15,10 +15,15 @@ # correspond to the ./configure --prefix=$OPENTHREADS_DIR # used in building osg. # +# [CMake 2.8.10]: +# The CMake variables OPENTHREADS_DIR or OSG_DIR can now be used as well to influence +# detection, instead of needing to specify an environment variable. +# # Created by Eric Wing. #============================================================================= # Copyright 2007-2009 Kitware, Inc. +# Copyright 2012 Philip Lowman # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -34,8 +39,8 @@ # #include # To make it easier for one-step automated configuration/builds, -# we leverage environmental paths. This is preferable -# to the -DVAR=value switches because it insulates the +# we leverage environmental paths. This is preferable +# to the -DVAR=value switches because it insulates the # users from changes we may make in this script. # It also offers a little more flexibility than setting # the CMAKE_*_PATH since we can target specific components. @@ -53,14 +58,15 @@ find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread HINTS - # enough environment variables? - $ENV{OPENTHREADS_INCLUDE_DIR} - $ENV{OPENTHREADS_DIR} - $ENV{OSG_INCLUDE_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - $ENV{OpenThreads_ROOT} - $ENV{OSG_ROOT} + ENV OPENTHREADS_INCLUDE_DIR + ENV OPENTHREADS_DIR + ENV OSG_INCLUDE_DIR + ENV OSG_DIR + ENV OSGDIR + ENV OpenThreads_ROOT + ENV OSG_ROOT + ${OPENTHREADS_DIR} + ${OSG_DIR} PATHS /sw # Fink /opt/local # DarwinPorts @@ -71,43 +77,47 @@ find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread ) -find_library(OPENTHREADS_LIBRARY - NAMES OpenThreads OpenThreadsWin32 +find_library(OPENTHREADS_LIBRARY + NAMES OpenThreads OpenThreadsWin32 HINTS - $ENV{OPENTHREADS_LIBRARY_DIR} - $ENV{OPENTHREADS_DIR} - $ENV{OSG_LIBRARY_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - $ENV{OpenThreads_ROOT} - $ENV{OSG_ROOT} + ENV OPENTHREADS_LIBRARY_DIR + ENV OPENTHREADS_DIR + ENV OSG_LIBRARY_DIR + ENV OSG_DIR + ENV OSGDIR + ENV OpenThreads_ROOT + ENV OSG_ROOT + ${OPENTHREADS_DIR} + ${OSG_DIR} PATHS /sw /opt/local /opt/csw /opt /usr/freeware - PATH_SUFFIXES lib64 lib + PATH_SUFFIXES lib ) -find_library(OPENTHREADS_LIBRARY_DEBUG +find_library(OPENTHREADS_LIBRARY_DEBUG NAMES OpenThreadsd OpenThreadsWin32d HINTS - $ENV{OPENTHREADS_DEBUG_LIBRARY_DIR} - $ENV{OPENTHREADS_LIBRARY_DIR} - $ENV{OPENTHREADS_DIR} - $ENV{OSG_LIBRARY_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - $ENV{OpenThreads_ROOT} - $ENV{OSG_ROOT} + ENV OPENTHREADS_DEBUG_LIBRARY_DIR + ENV OPENTHREADS_LIBRARY_DIR + ENV OPENTHREADS_DIR + ENV OSG_LIBRARY_DIR + ENV OSG_DIR + ENV OSGDIR + ENV OpenThreads_ROOT + ENV OSG_ROOT + ${OPENTHREADS_DIR} + ${OSG_DIR} PATHS /sw /opt/local /opt/csw /opt /usr/freeware - PATH_SUFFIXES lib64 lib + PATH_SUFFIXES lib ) if(OPENTHREADS_LIBRARY_DEBUG) diff --git a/Modules/FindPHP4.cmake b/Modules/FindPHP4.cmake index 6c2965a7a..4267ac155 100644 --- a/Modules/FindPHP4.cmake +++ b/Modules/FindPHP4.cmake @@ -20,7 +20,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET(PHP4_POSSIBLE_INCLUDE_PATHS +set(PHP4_POSSIBLE_INCLUDE_PATHS /usr/include/php4 /usr/local/include/php4 /usr/include/php @@ -28,33 +28,33 @@ SET(PHP4_POSSIBLE_INCLUDE_PATHS /usr/local/apache/php ) -SET(PHP4_POSSIBLE_LIB_PATHS +set(PHP4_POSSIBLE_LIB_PATHS /usr/lib ) -FIND_PATH(PHP4_FOUND_INCLUDE_PATH main/php.h +find_path(PHP4_FOUND_INCLUDE_PATH main/php.h ${PHP4_POSSIBLE_INCLUDE_PATHS}) -IF(PHP4_FOUND_INCLUDE_PATH) - SET(php4_paths "${PHP4_POSSIBLE_INCLUDE_PATHS}") - FOREACH(php4_path Zend main TSRM) - SET(php4_paths ${php4_paths} "${PHP4_FOUND_INCLUDE_PATH}/${php4_path}") - ENDFOREACH(php4_path Zend main TSRM) - SET(PHP4_INCLUDE_PATH "${php4_paths}" INTERNAL "PHP4 include paths") -ENDIF(PHP4_FOUND_INCLUDE_PATH) +if(PHP4_FOUND_INCLUDE_PATH) + set(php4_paths "${PHP4_POSSIBLE_INCLUDE_PATHS}") + foreach(php4_path Zend main TSRM) + set(php4_paths ${php4_paths} "${PHP4_FOUND_INCLUDE_PATH}/${php4_path}") + endforeach() + set(PHP4_INCLUDE_PATH "${php4_paths}" INTERNAL "PHP4 include paths") +endif() -FIND_PROGRAM(PHP4_EXECUTABLE NAMES php4 php ) +find_program(PHP4_EXECUTABLE NAMES php4 php ) -MARK_AS_ADVANCED( +mark_as_advanced( PHP4_EXECUTABLE PHP4_FOUND_INCLUDE_PATH ) -IF(APPLE) +if(APPLE) # this is a hack for now - SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS + set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -Wl,-flat_namespace") - FOREACH(symbol + foreach(symbol __efree __emalloc __estrdup @@ -76,10 +76,10 @@ IF(APPLE) _zend_wrong_param_count _zval_used_for_init ) - SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS + set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS},-U,${symbol}") - ENDFOREACH(symbol) -ENDIF(APPLE) + endforeach() +endif() -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PHP4 DEFAULT_MSG PHP4_EXECUTABLE PHP4_INCLUDE_PATH) diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index a6c181cb1..d96d2ccf9 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -30,7 +30,7 @@ if(PNG_FIND_QUIETLY) set(_FIND_ZLIB_ARG QUIET) -endif(PNG_FIND_QUIETLY) +endif() find_package(ZLIB ${_FIND_ZLIB_ARG}) if(ZLIB_FOUND) @@ -43,27 +43,27 @@ if(ZLIB_FOUND) if (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR) # png.h includes zlib.h. Sigh. - SET(PNG_INCLUDE_DIRS ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ) - SET(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIRS} ) # for backward compatiblity - SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY}) + set(PNG_INCLUDE_DIRS ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ) + set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIRS} ) # for backward compatiblity + set(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY}) if (CYGWIN) if(BUILD_SHARED_LIBS) # No need to define PNG_USE_DLL here, because it's default for Cygwin. - else(BUILD_SHARED_LIBS) - SET (PNG_DEFINITIONS -DPNG_STATIC) - endif(BUILD_SHARED_LIBS) - endif (CYGWIN) + else() + set (PNG_DEFINITIONS -DPNG_STATIC) + endif() + endif () - endif (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR) + endif () if (PNG_PNG_INCLUDE_DIR AND EXISTS "${PNG_PNG_INCLUDE_DIR}/png.h") file(STRINGS "${PNG_PNG_INCLUDE_DIR}/png.h" png_version_str REGEX "^#define[ \t]+PNG_LIBPNG_VER_STRING[ \t]+\".+\"") string(REGEX REPLACE "^#define[ \t]+PNG_LIBPNG_VER_STRING[ \t]+\"([^\"]+)\".*" "\\1" PNG_VERSION_STRING "${png_version_str}") unset(png_version_str) - endif (PNG_PNG_INCLUDE_DIR AND EXISTS "${PNG_PNG_INCLUDE_DIR}/png.h") -endif(ZLIB_FOUND) + endif () +endif() # handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if # all listed variables are TRUE diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index cdcf9ca7c..5f92a8642 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -1,8 +1,8 @@ # FIND_PACKAGE_HANDLE_STANDARD_ARGS( ... ) # # This function is intended to be used in FindXXX.cmake modules files. -# It handles the REQUIRED, QUIET and version-related arguments to FIND_PACKAGE(). -# It also sets the _FOUND variable. +# It handles the REQUIRED, QUIET and version-related arguments to find_package(). +# It also sets the _FOUND variable. # The package is considered found if all variables ... listed contain # valid results, e.g. valid filepaths. # @@ -18,14 +18,22 @@ # for the failure case. This is not recommended. # # The second mode is more powerful and also supports version checking: -# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [REQUIRED_VARS ...] +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [FOUND_VAR ] +# [REQUIRED_VARS ...] # [VERSION_VAR ] # [HANDLE_COMPONENTS] # [CONFIG_MODE] # [FAIL_MESSAGE "Custom failure message"] ) # -# As above, if through are all valid, _FOUND -# will be set to TRUE. +# In this mode, the name of the result-variable can be set either to either +# _FOUND or _FOUND using the FOUND_VAR option. +# Other names for the result-variable are not allowed. +# So for a Find-module named FindFooBar.cmake, the two possible names are +# FooBar_FOUND and FOOBAR_FOUND. It is recommended to use the original case version. +# If the FOUND_VAR option is not used, the default is _FOUND. +# +# As in the simple mode, if through are all valid, +# _FOUND will be set to TRUE. # After REQUIRED_VARS the variables which are required for this package are listed. # Following VERSION_VAR the name of the variable can be specified which holds # the version of the package which has been found. If this is done, this version @@ -35,7 +43,7 @@ # which has been actually found, both if the version is ok or not. # If the package supports components, use the HANDLE_COMPONENTS option to enable # handling them. In this case, find_package_handle_standard_args() will report -# which components have been found and which are missing, and the _FOUND +# which components have been found and which are missing, and the _FOUND # variable will be set to FALSE if any of the required components (i.e. not the # ones listed after OPTIONAL_COMPONENTS) are missing. # Use the option CONFIG_MODE if your FindXXX.cmake module is a wrapper for @@ -47,7 +55,7 @@ # # Example for mode 1: # -# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) +# find_package_handle_standard_args(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) # # LibXml2 is considered to be found, if both LIBXML2_LIBRARY and # LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE. @@ -58,20 +66,23 @@ # # Example for mode 2: # -# FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE -# VERSION_VAR BISON_VERSION) -# In this case, BISON is considered to be found if the variable(s) listed -# after REQUIRED_VAR are all valid, i.e. BISON_EXECUTABLE in this case. -# Also the version of BISON will be checked by using the version contained -# in BISON_VERSION. +# find_package_handle_standard_args(LibXslt FOUND_VAR LibXslt_FOUND +# REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS +# VERSION_VAR LibXslt_VERSION_STRING) +# In this case, LibXslt is considered to be found if the variable(s) listed +# after REQUIRED_VAR are all valid, i.e. LibXslt_LIBRARIES and LibXslt_INCLUDE_DIRS +# in this case. The result will then be stored in LibXslt_FOUND . +# Also the version of LibXslt will be checked by using the version contained +# in LibXslt_VERSION_STRING. # Since no FAIL_MESSAGE is given, the default messages will be printed. # # Another example for mode 2: # -# FIND_PACKAGE(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) -# FIND_PACKAGE_HANDLE_STANDARD_ARGS(Automoc4 CONFIG_MODE) -# In this case, FindAutmoc4.cmake wraps a call to FIND_PACKAGE(Automoc4 NO_MODULE) +# find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) +# find_package_handle_standard_args(Automoc4 CONFIG_MODE) +# In this case, FindAutmoc4.cmake wraps a call to find_package(Automoc4 NO_MODULE) # and adds an additional search directory for automoc4. +# Here the result will be stored in AUTOMOC4_FOUND. # The following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper # success/error message. @@ -88,209 +99,225 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(FindPackageMessage) -INCLUDE(CMakeParseArguments) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) # internal helper macro -MACRO(_FPHSA_FAILURE_MESSAGE _msg) - IF (${_NAME}_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "${_msg}") - ELSE (${_NAME}_FIND_REQUIRED) - IF (NOT ${_NAME}_FIND_QUIETLY) - MESSAGE(STATUS "${_msg}") - ENDIF (NOT ${_NAME}_FIND_QUIETLY) - ENDIF (${_NAME}_FIND_REQUIRED) -ENDMACRO(_FPHSA_FAILURE_MESSAGE _msg) +macro(_FPHSA_FAILURE_MESSAGE _msg) + if (${_NAME}_FIND_REQUIRED) + message(FATAL_ERROR "${_msg}") + else () + if (NOT ${_NAME}_FIND_QUIETLY) + message(STATUS "${_msg}") + endif () + endif () +endmacro() # internal helper macro to generate the failure message when used in CONFIG_MODE: -MACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) +macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) # _CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: - IF(${_NAME}_CONFIG) + if(${_NAME}_CONFIG) _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") - ELSE(${_NAME}_CONFIG) + else() # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. # List them all in the error message: - IF(${_NAME}_CONSIDERED_CONFIGS) - SET(configsText "") - LIST(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) - MATH(EXPR configsCount "${configsCount} - 1") - FOREACH(currentConfigIndex RANGE ${configsCount}) - LIST(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) - LIST(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) - SET(configsText "${configsText} ${filename} (version ${version})\n") - ENDFOREACH(currentConfigIndex) + if(${_NAME}_CONSIDERED_CONFIGS) + set(configsText "") + list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) + math(EXPR configsCount "${configsCount} - 1") + foreach(currentConfigIndex RANGE ${configsCount}) + list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) + list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) + set(configsText "${configsText} ${filename} (version ${version})\n") + endforeach() + if (${_NAME}_NOT_FOUND_MESSAGE) + set(configsText "${configsText} Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n") + endif() _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") - ELSE(${_NAME}_CONSIDERED_CONFIGS) + else() # Simple case: No Config-file was found at all: _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") - ENDIF(${_NAME}_CONSIDERED_CONFIGS) - ENDIF(${_NAME}_CONFIG) -ENDMACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + endif() + endif() +endmacro() -FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) +function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) # set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in # new extended or in the "old" mode: - SET(options CONFIG_MODE HANDLE_COMPONENTS) - SET(oneValueArgs FAIL_MESSAGE VERSION_VAR) - SET(multiValueArgs REQUIRED_VARS) - SET(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) - LIST(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) - - IF(${INDEX} EQUAL -1) - SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) - SET(FPHSA_REQUIRED_VARS ${ARGN}) - SET(FPHSA_VERSION_VAR) - ELSE(${INDEX} EQUAL -1) + set(options CONFIG_MODE HANDLE_COMPONENTS) + set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR) + set(multiValueArgs REQUIRED_VARS) + set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) + list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) + + if(${INDEX} EQUAL -1) + set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) + set(FPHSA_REQUIRED_VARS ${ARGN}) + set(FPHSA_VERSION_VAR) + else() CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) - IF(FPHSA_UNPARSED_ARGUMENTS) - MESSAGE(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") - ENDIF(FPHSA_UNPARSED_ARGUMENTS) + if(FPHSA_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") + endif() - IF(NOT FPHSA_FAIL_MESSAGE) - SET(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") - ENDIF(NOT FPHSA_FAIL_MESSAGE) - ENDIF(${INDEX} EQUAL -1) + if(NOT FPHSA_FAIL_MESSAGE) + set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") + endif() + endif() # now that we collected all arguments, process them - IF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") - SET(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") - ENDIF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") + if("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") + set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") + endif() # In config-mode, we rely on the variable _CONFIG, which is set by find_package() # when it successfully found the config-file, including version checking: - IF(FPHSA_CONFIG_MODE) - LIST(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) - LIST(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) - SET(FPHSA_VERSION_VAR ${_NAME}_VERSION) - ENDIF(FPHSA_CONFIG_MODE) - - IF(NOT FPHSA_REQUIRED_VARS) - MESSAGE(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") - ENDIF(NOT FPHSA_REQUIRED_VARS) - - LIST(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) - - STRING(TOUPPER ${_NAME} _NAME_UPPER) - STRING(TOLOWER ${_NAME} _NAME_LOWER) + if(FPHSA_CONFIG_MODE) + list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) + list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) + set(FPHSA_VERSION_VAR ${_NAME}_VERSION) + endif() + + if(NOT FPHSA_REQUIRED_VARS) + message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") + endif() + + list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) + + string(TOUPPER ${_NAME} _NAME_UPPER) + string(TOLOWER ${_NAME} _NAME_LOWER) + + if(FPHSA_FOUND_VAR) + if("${FPHSA_FOUND_VAR}" MATCHES "^${_NAME}_FOUND$" OR "${FPHSA_FOUND_VAR}" MATCHES "^${_NAME_UPPER}_FOUND$") + set(_FOUND_VAR ${FPHSA_FOUND_VAR}) + else() + message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") + endif() + else() + set(_FOUND_VAR ${_NAME_UPPER}_FOUND) + endif() # collect all variables which were not found, so they can be printed, so the # user knows better what went wrong (#6375) - SET(MISSING_VARS "") - SET(DETAILS "") - SET(${_NAME_UPPER}_FOUND TRUE) + set(MISSING_VARS "") + set(DETAILS "") # check if all passed variables are valid - FOREACH(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) - IF(NOT ${_CURRENT_VAR}) - SET(${_NAME_UPPER}_FOUND FALSE) - SET(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") - ELSE(NOT ${_CURRENT_VAR}) - SET(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") - ENDIF(NOT ${_CURRENT_VAR}) - ENDFOREACH(_CURRENT_VAR) + unset(${_FOUND_VAR}) + foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) + if(NOT ${_CURRENT_VAR}) + set(${_FOUND_VAR} FALSE) + set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") + else() + set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") + endif() + endforeach() + if(NOT "${${_FOUND_VAR}}" STREQUAL "FALSE") + set(${_FOUND_VAR} TRUE) + endif() # component handling - UNSET(FOUND_COMPONENTS_MSG) - UNSET(MISSING_COMPONENTS_MSG) + unset(FOUND_COMPONENTS_MSG) + unset(MISSING_COMPONENTS_MSG) - IF(FPHSA_HANDLE_COMPONENTS) - FOREACH(comp ${${_NAME}_FIND_COMPONENTS}) - IF(${_NAME}_${comp}_FOUND) + if(FPHSA_HANDLE_COMPONENTS) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(${_NAME}_${comp}_FOUND) - IF(NOT DEFINED FOUND_COMPONENTS_MSG) - SET(FOUND_COMPONENTS_MSG "found components: ") - ENDIF() - SET(FOUND_COMPONENTS_MSG "${FOUND_COMPONENTS_MSG} ${comp}") + if(NOT DEFINED FOUND_COMPONENTS_MSG) + set(FOUND_COMPONENTS_MSG "found components: ") + endif() + set(FOUND_COMPONENTS_MSG "${FOUND_COMPONENTS_MSG} ${comp}") - ELSE() + else() - IF(NOT DEFINED MISSING_COMPONENTS_MSG) - SET(MISSING_COMPONENTS_MSG "missing components: ") - ENDIF() - SET(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}") + if(NOT DEFINED MISSING_COMPONENTS_MSG) + set(MISSING_COMPONENTS_MSG "missing components: ") + endif() + set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}") - IF(${_NAME}_FIND_REQUIRED_${comp}) - SET(${_NAME_UPPER}_FOUND FALSE) - SET(MISSING_VARS "${MISSING_VARS} ${comp}") - ENDIF() + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_FOUND_VAR} FALSE) + set(MISSING_VARS "${MISSING_VARS} ${comp}") + endif() - ENDIF() - ENDFOREACH(comp) - SET(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") - SET(DETAILS "${DETAILS}[c${COMPONENT_MSG}]") - ENDIF(FPHSA_HANDLE_COMPONENTS) + endif() + endforeach() + set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") + set(DETAILS "${DETAILS}[c${COMPONENT_MSG}]") + endif() # version handling: - SET(VERSION_MSG "") - SET(VERSION_OK TRUE) - SET(VERSION ${${FPHSA_VERSION_VAR}} ) - IF (${_NAME}_FIND_VERSION) - - IF(VERSION) - - IF(${_NAME}_FIND_VERSION_EXACT) # exact version required - IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") - SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") - SET(VERSION_OK FALSE) - ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") - SET(VERSION_MSG "(found suitable exact version \"${VERSION}\")") - ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") - - ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified: - IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") - SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") - SET(VERSION_OK FALSE) - ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") - SET(VERSION_MSG "(found suitable version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")") - ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") - ENDIF(${_NAME}_FIND_VERSION_EXACT) - - ELSE(VERSION) + set(VERSION_MSG "") + set(VERSION_OK TRUE) + set(VERSION ${${FPHSA_VERSION_VAR}} ) + if (${_NAME}_FIND_VERSION) + + if(VERSION) + + if(${_NAME}_FIND_VERSION_EXACT) # exact version required + if (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable exact version \"${VERSION}\")") + endif () + + else() # minimum version specified: + if ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable version \"${VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")") + endif () + endif() + + else() # if the package was not found, but a version was given, add that to the output: - IF(${_NAME}_FIND_VERSION_EXACT) - SET(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") - ELSE(${_NAME}_FIND_VERSION_EXACT) - SET(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") - ENDIF(${_NAME}_FIND_VERSION_EXACT) - - ENDIF(VERSION) - ELSE (${_NAME}_FIND_VERSION) - IF(VERSION) - SET(VERSION_MSG "(found version \"${VERSION}\")") - ENDIF(VERSION) - ENDIF (${_NAME}_FIND_VERSION) - - IF(VERSION_OK) - SET(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]") - ELSE(VERSION_OK) - SET(${_NAME_UPPER}_FOUND FALSE) - ENDIF(VERSION_OK) + if(${_NAME}_FIND_VERSION_EXACT) + set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") + else() + set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") + endif() + + endif() + else () + if(VERSION) + set(VERSION_MSG "(found version \"${VERSION}\")") + endif() + endif () + + if(VERSION_OK) + set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]") + else() + set(${_FOUND_VAR} FALSE) + endif() # print the result: - IF (${_NAME_UPPER}_FOUND) + if (${_FOUND_VAR}) FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") - ELSE (${_NAME_UPPER}_FOUND) + else () - IF(FPHSA_CONFIG_MODE) + if(FPHSA_CONFIG_MODE) _FPHSA_HANDLE_FAILURE_CONFIG_MODE() - ELSE(FPHSA_CONFIG_MODE) - IF(NOT VERSION_OK) + else() + if(NOT VERSION_OK) _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") - ELSE(NOT VERSION_OK) + else() _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") - ENDIF(NOT VERSION_OK) - ENDIF(FPHSA_CONFIG_MODE) + endif() + endif() - ENDIF (${_NAME_UPPER}_FOUND) + endif () - SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE) + set(${_FOUND_VAR} ${${_FOUND_VAR}} PARENT_SCOPE) -ENDFUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _FIRST_ARG) +endfunction() diff --git a/Modules/FindPackageMessage.cmake b/Modules/FindPackageMessage.cmake index 48d3472b5..5cea43e35 100644 --- a/Modules/FindPackageMessage.cmake +++ b/Modules/FindPackageMessage.cmake @@ -11,12 +11,12 @@ # # Example: # -# IF(X11_FOUND) +# if(X11_FOUND) # FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" # "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") -# ELSE(X11_FOUND) +# else() # ... -# ENDIF(X11_FOUND) +# endif() #============================================================================= # Copyright 2008-2009 Kitware, Inc. @@ -31,19 +31,19 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FUNCTION(FIND_PACKAGE_MESSAGE pkg msg details) +function(FIND_PACKAGE_MESSAGE pkg msg details) # Avoid printing a message repeatedly for the same find result. - IF(NOT ${pkg}_FIND_QUIETLY) - STRING(REGEX REPLACE "[\n]" "" details "${details}") - SET(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) - IF(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") + if(NOT ${pkg}_FIND_QUIETLY) + string(REGEX REPLACE "[\n]" "" details "${details}") + set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) + if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") # The message has not yet been printed. - MESSAGE(STATUS "${msg}") + message(STATUS "${msg}") # Save the find details in the cache to avoid printing the same # message again. - SET("${DETAILS_VAR}" "${details}" + set("${DETAILS_VAR}" "${details}" CACHE INTERNAL "Details about finding ${pkg}") - ENDIF(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") - ENDIF(NOT ${pkg}_FIND_QUIETLY) -ENDFUNCTION(FIND_PACKAGE_MESSAGE) + endif() + endif() +endfunction() diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake index ae686df75..5eaf20768 100644 --- a/Modules/FindPerl.cmake +++ b/Modules/FindPerl.cmake @@ -18,31 +18,31 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(FindCygwin) +include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) -SET(PERL_POSSIBLE_BIN_PATHS +set(PERL_POSSIBLE_BIN_PATHS ${CYGWIN_INSTALL_PATH}/bin ) -IF(WIN32) - GET_FILENAME_COMPONENT( - ActivePerl_CurrentVersion - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActivePerl;CurrentVersion]" +if(WIN32) + get_filename_component( + ActivePerl_CurrentVersion + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActivePerl;CurrentVersion]" NAME) - SET(PERL_POSSIBLE_BIN_PATHS ${PERL_POSSIBLE_BIN_PATHS} - "C:/Perl/bin" + set(PERL_POSSIBLE_BIN_PATHS ${PERL_POSSIBLE_BIN_PATHS} + "C:/Perl/bin" [HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActivePerl\\${ActivePerl_CurrentVersion}]/bin ) -ENDIF(WIN32) +endif() -FIND_PROGRAM(PERL_EXECUTABLE +find_program(PERL_EXECUTABLE NAMES perl PATHS ${PERL_POSSIBLE_BIN_PATHS} ) -IF(PERL_EXECUTABLE) +if(PERL_EXECUTABLE) ### PERL_VERSION - EXECUTE_PROCESS( + execute_process( COMMAND ${PERL_EXECUTABLE} -V:version OUTPUT_VARIABLE @@ -52,32 +52,32 @@ IF(PERL_EXECUTABLE) ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ) - IF(NOT PERL_VERSION_RESULT_VARIABLE AND NOT PERL_VERSION_OUTPUT_VARIABLE MATCHES "^version='UNKNOWN'") - STRING(REGEX REPLACE "version='([^']+)'.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) - ELSE() - EXECUTE_PROCESS( + if(NOT PERL_VERSION_RESULT_VARIABLE AND NOT PERL_VERSION_OUTPUT_VARIABLE MATCHES "^version='UNKNOWN'") + string(REGEX REPLACE "version='([^']+)'.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) + else() + execute_process( COMMAND ${PERL_EXECUTABLE} -v OUTPUT_VARIABLE PERL_VERSION_OUTPUT_VARIABLE RESULT_VARIABLE PERL_VERSION_RESULT_VARIABLE ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ) - IF(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl.*[ \\(]v([0-9\\._]+)[ \\)]") - STRING(REGEX REPLACE ".*This is perl.*[ \\(]v([0-9\\._]+)[ \\)].*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) - ELSEIF(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl, version ([0-9\\._]+) +") - STRING(REGEX REPLACE ".*This is perl, version ([0-9\\._]+) +.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) - ENDIF() - ENDIF() -ENDIF(PERL_EXECUTABLE) + if(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl.*[ \\(]v([0-9\\._]+)[ \\)]") + string(REGEX REPLACE ".*This is perl.*[ \\(]v([0-9\\._]+)[ \\)].*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) + elseif(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl, version ([0-9\\._]+) +") + string(REGEX REPLACE ".*This is perl, version ([0-9\\._]+) +.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) + endif() + endif() +endif() # Deprecated settings for compatibility with CMake1.4 -SET(PERL ${PERL_EXECUTABLE}) +set(PERL ${PERL_EXECUTABLE}) -# handle the QUIETLY and REQUIRED arguments and set PERL_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set PERL_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Perl REQUIRED_VARS PERL_EXECUTABLE VERSION_VAR PERL_VERSION_STRING) -MARK_AS_ADVANCED(PERL_EXECUTABLE) +mark_as_advanced(PERL_EXECUTABLE) diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake index b2ffd3cf6..492f04770 100644 --- a/Modules/FindPerlLibs.cmake +++ b/Modules/FindPerlLibs.cmake @@ -9,7 +9,7 @@ # PERL_EXECUTABLE = full path to the perl binary # # The minimum required version of Perl can be specified using the -# standard syntax, e.g. FIND_PACKAGE(PerlLibs 6.0) +# standard syntax, e.g. find_package(PerlLibs 6.0) # # The following variables are also available if needed # (introduced after CMake 2.6.4) @@ -38,7 +38,7 @@ # License text for the above reference.) # find the perl executable -include(FindPerl) +include(${CMAKE_CURRENT_LIST_DIR}/FindPerl.cmake) if (PERL_EXECUTABLE) ### PERL_PREFIX @@ -53,7 +53,7 @@ if (PERL_EXECUTABLE) if (NOT PERL_PREFIX_RESULT_VARIABLE) string(REGEX REPLACE "prefix='([^']+)'.*" "\\1" PERL_PREFIX ${PERL_PREFIX_OUTPUT_VARIABLE}) - endif (NOT PERL_PREFIX_RESULT_VARIABLE) + endif () ### PERL_ARCHNAME execute_process( @@ -66,7 +66,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_ARCHNAME_RESULT_VARIABLE) string(REGEX REPLACE "archname='([^']+)'.*" "\\1" PERL_ARCHNAME ${PERL_ARCHNAME_OUTPUT_VARIABLE}) - endif (NOT PERL_ARCHNAME_RESULT_VARIABLE) + endif () @@ -81,7 +81,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_CPPFLAGS_RESULT_VARIABLE) string(REGEX REPLACE "cppflags='([^']+)'.*" "\\1" PERL_EXTRA_C_FLAGS ${PERL_CPPFLAGS_OUTPUT_VARIABLE}) - endif (NOT PERL_CPPFLAGS_RESULT_VARIABLE) + endif () ### PERL_SITESEARCH execute_process( @@ -95,7 +95,7 @@ if (PERL_EXECUTABLE) if (NOT PERL_SITESEARCH_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITESEARCH ${PERL_SITESEARCH_OUTPUT_VARIABLE}) file(TO_CMAKE_PATH "${PERL_SITESEARCH}" PERL_SITESEARCH) - endif (NOT PERL_SITESEARCH_RESULT_VARIABLE) + endif () ### PERL_SITELIB execute_process( @@ -109,7 +109,7 @@ if (PERL_EXECUTABLE) if (NOT PERL_SITELIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITELIB ${PERL_SITELIB_OUTPUT_VARIABLE}) file(TO_CMAKE_PATH "${PERL_SITELIB}" PERL_SITELIB) - endif (NOT PERL_SITELIB_RESULT_VARIABLE) + endif () ### PERL_VENDORARCH execute_process( @@ -123,7 +123,7 @@ if (PERL_EXECUTABLE) if (NOT PERL_VENDORARCH_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORARCH ${PERL_VENDORARCH_OUTPUT_VARIABLE}) file(TO_CMAKE_PATH "${PERL_VENDORARCH}" PERL_VENDORARCH) - endif (NOT PERL_VENDORARCH_RESULT_VARIABLE) + endif () ### PERL_VENDORLIB execute_process( @@ -137,7 +137,7 @@ if (PERL_EXECUTABLE) if (NOT PERL_VENDORLIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORLIB ${PERL_VENDORLIB_OUTPUT_VARIABLE}) file(TO_CMAKE_PATH "${PERL_VENDORLIB}" PERL_VENDORLIB) - endif (NOT PERL_VENDORLIB_RESULT_VARIABLE) + endif () macro(perl_adjust_darwin_lib_variable varname) string( TOUPPER PERL_${varname} FINDPERL_VARNAME ) @@ -160,9 +160,9 @@ if (PERL_EXECUTABLE) if (PERL_NEEDS_ADJUSTMENT) string(REGEX REPLACE "(.*)/Updates/" "/System/\\1/" ${FINDPERL_VARNAME} ${${FINDPERL_VARNAME}}) - endif (PERL_NEEDS_ADJUSTMENT) + endif () - endif (NOT PERL_MINUSV_RESULT_VARIABLE) + endif () endmacro() ### PERL_ARCHLIB @@ -178,7 +178,7 @@ if (PERL_EXECUTABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_ARCHLIB ${PERL_ARCHLIB_OUTPUT_VARIABLE}) perl_adjust_darwin_lib_variable( ARCHLIB ) file(TO_CMAKE_PATH "${PERL_ARCHLIB}" PERL_ARCHLIB) - endif (NOT PERL_ARCHLIB_RESULT_VARIABLE) + endif () ### PERL_PRIVLIB execute_process( @@ -193,7 +193,7 @@ if (PERL_EXECUTABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_PRIVLIB ${PERL_PRIVLIB_OUTPUT_VARIABLE}) perl_adjust_darwin_lib_variable( PRIVLIB ) file(TO_CMAKE_PATH "${PERL_PRIVLIB}" PERL_PRIVLIB) - endif (NOT PERL_PRIVLIB_RESULT_VARIABLE) + endif () ### PERL_POSSIBLE_LIBRARY_NAMES execute_process( @@ -206,9 +206,9 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_LIBRARY_RESULT_VARIABLE) string(REGEX REPLACE "libperl='([^']+)'.*" "\\1" PERL_POSSIBLE_LIBRARY_NAMES ${PERL_LIBRARY_OUTPUT_VARIABLE}) - else (NOT PERL_LIBRARY_RESULT_VARIABLE) + else () set(PERL_POSSIBLE_LIBRARY_NAMES perl${PERL_VERSION_STRING} perl) - endif (NOT PERL_LIBRARY_RESULT_VARIABLE) + endif () ### PERL_INCLUDE_PATH find_path(PERL_INCLUDE_PATH @@ -234,9 +234,9 @@ if (PERL_EXECUTABLE) /usr/lib/perl/${PERL_VERSION_STRING}/CORE ) -endif (PERL_EXECUTABLE) +endif () -# handle the QUIETLY and REQUIRED arguments and set PERLLIBS_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set PERLLIBS_FOUND to TRUE if # all listed variables are TRUE include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(PerlLibs REQUIRED_VARS PERL_LIBRARY PERL_INCLUDE_PATH diff --git a/Modules/FindPhysFS.cmake b/Modules/FindPhysFS.cmake index 2e3ac1400..a2d6abf9b 100644 --- a/Modules/FindPhysFS.cmake +++ b/Modules/FindPhysFS.cmake @@ -8,7 +8,7 @@ # correspond to the ./configure --prefix=$PHYSFSDIR # used in building PHYSFS. # -# Created by Eric Wing. +# Created by Eric Wing. #============================================================================= # Copyright 2005-2009 Kitware, Inc. @@ -23,9 +23,9 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h +find_path(PHYSFS_INCLUDE_DIR physfs.h HINTS - $ENV{PHYSFSDIR} + ENV PHYSFSDIR PATH_SUFFIXES include/physfs include PATHS ~/Library/Frameworks @@ -36,11 +36,11 @@ FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h /opt ) -FIND_LIBRARY(PHYSFS_LIBRARY +find_library(PHYSFS_LIBRARY NAMES physfs HINTS - $ENV{PHYSFSDIR} - PATH_SUFFIXES lib64 lib + ENV PHYSFSDIR + PATH_SUFFIXES lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -52,6 +52,6 @@ FIND_LIBRARY(PHYSFS_LIBRARY # handle the QUIETLY and REQUIRED arguments and set PHYSFS_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PhysFS DEFAULT_MSG PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR) diff --git a/Modules/FindPike.cmake b/Modules/FindPike.cmake index 125e42832..5b48ab4e7 100644 --- a/Modules/FindPike.cmake +++ b/Modules/FindPike.cmake @@ -20,18 +20,18 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FILE(GLOB PIKE_POSSIBLE_INCLUDE_PATHS +file(GLOB PIKE_POSSIBLE_INCLUDE_PATHS /usr/include/pike/* /usr/local/include/pike/*) -FIND_PATH(PIKE_INCLUDE_PATH program.h +find_path(PIKE_INCLUDE_PATH program.h ${PIKE_POSSIBLE_INCLUDE_PATHS}) -FIND_PROGRAM(PIKE_EXECUTABLE +find_program(PIKE_EXECUTABLE NAMES pike7.4 ) -MARK_AS_ADVANCED( +mark_as_advanced( PIKE_EXECUTABLE PIKE_INCLUDE_PATH ) diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 39d3a76ab..2766f9780 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -96,7 +96,7 @@ if (PKG_CONFIG_EXECUTABLE) OUTPUT_VARIABLE PKG_CONFIG_VERSION_STRING ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) -endif (PKG_CONFIG_EXECUTABLE) +endif () include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(PkgConfig @@ -111,11 +111,11 @@ set(PKG_CONFIG_FOUND "${PKGCONFIG_FOUND}") # Unsets the given variables macro(_pkgconfig_unset var) set(${var} "" CACHE INTERNAL "") -endmacro(_pkgconfig_unset) +endmacro() macro(_pkgconfig_set var value) set(${var} ${value} CACHE INTERNAL "") -endmacro(_pkgconfig_set) +endmacro() # Invokes pkgconfig, cleans up the result and sets variables macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp) @@ -129,47 +129,47 @@ macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp) if (_pkgconfig_failed) set(_pkgconfig_${_varname} "") _pkgconfig_unset(${_prefix}_${_varname}) - else(_pkgconfig_failed) + else() string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") if (NOT ${_regexp} STREQUAL "") string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") - endif(NOT ${_regexp} STREQUAL "") + endif() separate_arguments(_pkgconfig_invoke_result) #message(STATUS " ${_varname} ... ${_pkgconfig_invoke_result}") set(_pkgconfig_${_varname} ${_pkgconfig_invoke_result}) _pkgconfig_set(${_prefix}_${_varname} "${_pkgconfig_invoke_result}") - endif(_pkgconfig_failed) -endmacro(_pkgconfig_invoke) + endif() +endmacro() # Invokes pkgconfig two times; once without '--static' and once with # '--static' macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp) _pkgconfig_invoke("${_pkglist}" ${_prefix} ${_varname} "${cleanup_regexp}" ${ARGN}) _pkgconfig_invoke("${_pkglist}" ${_prefix} STATIC_${_varname} "${cleanup_regexp}" --static ${ARGN}) -endmacro(_pkgconfig_invoke_dyn) +endmacro() # Splits given arguments into options and a package list macro(_pkgconfig_parse_options _result _is_req _is_silent) set(${_is_req} 0) set(${_is_silent} 0) - + foreach(_pkg ${ARGN}) if (_pkg STREQUAL "REQUIRED") set(${_is_req} 1) - endif (_pkg STREQUAL "REQUIRED") + endif () if (_pkg STREQUAL "QUIET") set(${_is_silent} 1) - endif (_pkg STREQUAL "QUIET") - endforeach(_pkg ${ARGN}) + endif () + endforeach() set(${_result} ${ARGN}) list(REMOVE_ITEM ${_result} "REQUIRED") list(REMOVE_ITEM ${_result} "QUIET") -endmacro(_pkgconfig_parse_options) +endmacro() ### macro(_pkg_check_modules_internal _is_required _is_silent _prefix) @@ -203,11 +203,11 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix) if (NOT ${_is_silent}) if (_pkg_check_modules_cnt EQUAL 1) message(STATUS "checking for module '${_pkg_check_modules_list}'") - else(_pkg_check_modules_cnt EQUAL 1) + else() message(STATUS "checking for modules '${_pkg_check_modules_list}'") - endif(_pkg_check_modules_cnt EQUAL 1) - endif(NOT ${_is_silent}) - + endif() + endif() + set(_pkg_check_modules_packages) set(_pkg_check_modules_failed) @@ -220,35 +220,35 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix) string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\1" _pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}") string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\2" _pkg_check_modules_pkg_op "${_pkg_check_modules_pkg}") string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\3" _pkg_check_modules_pkg_ver "${_pkg_check_modules_pkg}") - else(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") + else() set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}") set(_pkg_check_modules_pkg_op) set(_pkg_check_modules_pkg_ver) - endif(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") + endif() # handle the operands if (_pkg_check_modules_pkg_op STREQUAL ">=") list(APPEND _pkg_check_modules_exist_query --atleast-version) - endif(_pkg_check_modules_pkg_op STREQUAL ">=") + endif() if (_pkg_check_modules_pkg_op STREQUAL "=") list(APPEND _pkg_check_modules_exist_query --exact-version) - endif(_pkg_check_modules_pkg_op STREQUAL "=") - + endif() + if (_pkg_check_modules_pkg_op STREQUAL "<=") list(APPEND _pkg_check_modules_exist_query --max-version) - endif(_pkg_check_modules_pkg_op STREQUAL "<=") + endif() # create the final query which is of the format: # * --atleast-version - # * --exact-version + # * --exact-version # * --max-version # * --exists if (_pkg_check_modules_pkg_op) list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}") - else(_pkg_check_modules_pkg_op) + else() list(APPEND _pkg_check_modules_exist_query --exists) - endif(_pkg_check_modules_pkg_op) + endif() _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION) _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX) @@ -267,21 +267,21 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix) if (_pkgconfig_retval) if(NOT ${_is_silent}) message(STATUS " package '${_pkg_check_modules_pkg}' not found") - endif(NOT ${_is_silent}) + endif() set(_pkg_check_modules_failed 1) - endif(_pkgconfig_retval) - endforeach(_pkg_check_modules_pkg) + endif() + endforeach() if(_pkg_check_modules_failed) # fail when requested if (${_is_required}) message(SEND_ERROR "A required package was not found") - endif (${_is_required}) - else(_pkg_check_modules_failed) + endif () + else() # when we are here, we checked whether requested modules # exist. Now, go through them and set variables - + _pkgconfig_set(${_prefix}_FOUND 1) list(LENGTH _pkg_check_modules_packages pkg_count) @@ -290,10 +290,10 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix) # handle case when there is only one package required if (pkg_count EQUAL 1) set(_pkg_check_prefix "${_prefix}") - else(pkg_count EQUAL 1) + else() set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}") - endif(pkg_count EQUAL 1) - + endif() + _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion ) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix ) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir ) @@ -301,8 +301,8 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix) if (NOT ${_is_silent}) message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") - endif (NOT ${_is_silent}) - endforeach(_pkg_check_modules_pkg) + endif () + endforeach() # set variables which are combined for multiple modules _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l ) @@ -313,13 +313,13 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other ) - endif(_pkg_check_modules_failed) - else(PKG_CONFIG_EXECUTABLE) + endif() + else() if (${_is_required}) message(SEND_ERROR "pkg-config tool not found") - endif (${_is_required}) - endif(PKG_CONFIG_EXECUTABLE) -endmacro(_pkg_check_modules_internal) + endif () + endif() +endmacro() ### ### User visible macros start here @@ -333,8 +333,8 @@ macro(pkg_check_modules _prefix _module0) _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" "${_prefix}" ${_pkg_modules}) _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) - endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) -endmacro(pkg_check_modules) + endif() +endmacro() ### macro(pkg_search_module _prefix _module0) @@ -345,28 +345,28 @@ macro(pkg_search_module _prefix _module0) if (NOT ${_pkg_is_silent}) message(STATUS "checking for one of the modules '${_pkg_modules_alt}'") - endif (NOT ${_pkg_is_silent}) + endif () # iterate through all modules and stop at the first working one. foreach(_pkg_alt ${_pkg_modules_alt}) if(NOT _pkg_modules_found) _pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}") - endif(NOT _pkg_modules_found) + endif() if (${_prefix}_FOUND) set(_pkg_modules_found 1) - endif(${_prefix}_FOUND) - endforeach(_pkg_alt) + endif() + endforeach() if (NOT ${_prefix}_FOUND) if(${_pkg_is_required}) message(SEND_ERROR "None of the required '${_pkg_modules_alt}' found") - endif(${_pkg_is_required}) - endif(NOT ${_prefix}_FOUND) - + endif() + endif() + _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) - endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) -endmacro(pkg_search_module) + endif() +endmacro() ### Local Variables: ### mode: cmake diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index 94e5676fe..e3c898b98 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -35,7 +35,7 @@ # # To use this variable just do something like this: # set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4") -# before calling FIND_PACKAGE(PostgreSQL) in your CMakeLists.txt file. +# before calling find_package(PostgreSQL) in your CMakeLists.txt file. # This will mean that the versions you set here will be found first in the order # specified before the default ones are searched. # @@ -61,7 +61,7 @@ # PostgreSQL_LIBRARY_DIR to wherever the library pq (or libpq in windows) is # 2) Use CMAKE_INCLUDE_PATH to set a path to /PostgreSQL<-version>. This will allow find_path() # to locate PostgreSQL_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g. In your CMakeLists.txt file -# SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "/include") +# set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "/include") # 3) Set an environment variable called ${PostgreSQL_ROOT} that points to the root of where you have # installed PostgreSQL, e.g. . # @@ -74,11 +74,6 @@ set(PostgreSQL_LIBRARY_DIR_MESSAGE "Set the PostgreSQL_LIBRARY_DIR cmake cache e set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to where PostgreSQL is found on the machine E.g C:/Program Files/PostgreSQL/8.4") -set(PostgreSQL_ROOT_DIRECTORIES $ENV{PostgreSQL_ROOT}) -if(PostgreSQL_ROOT_DIRECTORIES) - file(TO_CMAKE_PATH ${PostgreSQL_ROOT_DIRECTORIES} PostgreSQL_ROOT_DIRECTORIES) -endif(PostgreSQL_ROOT_DIRECTORIES) - set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") @@ -86,10 +81,10 @@ set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} if ( WIN32 ) foreach (suffix ${PostgreSQL_KNOWN_VERSIONS} ) set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} "C:/Program Files/PostgreSQL/${suffix}" ) - endforeach(suffix) -endif( WIN32 ) + endforeach() +endif() set( PostgreSQL_ROOT_DIRECTORIES - ${PostgreSQL_ROOT_DIRECTORIES} + ENV PostgreSQL_ROOT ${PostgreSQL_ROOT} ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} ) @@ -116,6 +111,7 @@ find_path(PostgreSQL_TYPE_INCLUDE_DIR # Look in other places. ${PostgreSQL_ROOT_DIRECTORIES} PATH_SUFFIXES + postgresql pgsql/server postgresql/server include/server @@ -151,7 +147,7 @@ if (PostgreSQL_INCLUDE_DIR AND EXISTS "${PostgreSQL_INCLUDE_DIR}/pg_config.h") endif() # Did we find anything? -include(FindPackageHandleStandardArgs) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(PostgreSQL REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR VERSION_VAR PostgreSQL_VERSION_STRING) @@ -167,6 +163,6 @@ if(PostgreSQL_FOUND) #message("Final PostgreSQL include dir: ${PostgreSQL_INCLUDE_DIRS}") #message("Final PostgreSQL library dir: ${PostgreSQL_LIBRARY_DIRS}") #message("Final PostgreSQL libraries: ${PostgreSQL_LIBRARIES}") -endif(PostgreSQL_FOUND) +endif() mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR PostgreSQL_LIBRARY ) diff --git a/Modules/FindProducer.cmake b/Modules/FindProducer.cmake index 26c804ac1..30990629b 100644 --- a/Modules/FindProducer.cmake +++ b/Modules/FindProducer.cmake @@ -1,18 +1,18 @@ # Though Producer isn't directly part of OpenSceneGraph, its primary user -# is OSG so I consider this part of the Findosg* suite used to find +# is OSG so I consider this part of the Findosg* suite used to find # OpenSceneGraph components. You'll notice that I accept OSGDIR as an # environment path. -# -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL (and OpenThreads?) as these -# modules won't do it for you. This is to allow you control over your own +# +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL (and OpenThreads?) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate Producer # This module defines # PRODUCER_LIBRARY @@ -42,11 +42,11 @@ # #include # Try the user's environment request before anything else. -FIND_PATH(PRODUCER_INCLUDE_DIR Producer/CameraGroup +find_path(PRODUCER_INCLUDE_DIR Producer/CameraGroup HINTS - $ENV{PRODUCER_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} + ENV PRODUCER_DIR + ENV OSG_DIR + ENV OSGDIR PATH_SUFFIXES include PATHS ~/Library/Frameworks @@ -59,13 +59,13 @@ FIND_PATH(PRODUCER_INCLUDE_DIR Producer/CameraGroup [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include ) -FIND_LIBRARY(PRODUCER_LIBRARY +find_library(PRODUCER_LIBRARY NAMES Producer HINTS - $ENV{PRODUCER_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - PATH_SUFFIXES lib64 lib + ENV PRODUCER_DIR + ENV OSG_DIR + ENV OSGDIR + PATH_SUFFIXES lib PATHS /sw /opt/local diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 1e1e49301..af0c2ddf0 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -78,7 +78,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) if(NOT ARGN) message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") return() - endif(NOT ARGN) + endif() if(PROTOBUF_GENERATE_CPP_APPEND_PATH) # Create an include path for each file specified @@ -109,7 +109,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) foreach(FIL ${ARGN}) get_filename_component(ABS_FIL ${FIL} ABSOLUTE) get_filename_component(FIL_WE ${FIL} NAME_WE) - + list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc") list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h") diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index a131c5fde..7fb65b869 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -47,16 +47,16 @@ if(PythonInterp_FIND_VERSION) list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) endif() endforeach() - endif(NOT PythonInterp_FIND_VERSION_EXACT) + endif() unset(_PYTHON_FIND_MAJ_MIN) unset(_PYTHON_FIND_MAJ) - else(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") + else() list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION}) set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS}) - endif(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") -else(PythonInterp_FIND_VERSION) + endif() +else() set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) -endif(PythonInterp_FIND_VERSION) +endif() list(APPEND _Python_NAMES python) @@ -131,7 +131,7 @@ if(PYTHON_EXECUTABLE) endif() unset(_PYTHON_VERSION_RESULT) unset(_VERSION) -endif(PYTHON_EXECUTABLE) +endif() # handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if # all listed variables are TRUE diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 11ff19623..bffa9fb4f 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -32,57 +32,57 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(CMakeFindFrameworks) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake) # Search for the python framework on Apple. CMAKE_FIND_FRAMEWORKS(Python) -SET(_PYTHON1_VERSIONS 1.6 1.5) -SET(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) -SET(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0) - -IF(PythonLibs_FIND_VERSION) - IF(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") - STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}") - STRING(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}") - UNSET(_PYTHON_FIND_OTHER_VERSIONS) - IF(PythonLibs_FIND_VERSION_EXACT) - IF(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION) - SET(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}") - ELSE(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION) - SET(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}") - ENDIF(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION) - ELSE(PythonLibs_FIND_VERSION_EXACT) - FOREACH(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS}) - IF(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN) - LIST(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) - ENDIF() - ENDFOREACH() - ENDIF(PythonLibs_FIND_VERSION_EXACT) - UNSET(_PYTHON_FIND_MAJ_MIN) - UNSET(_PYTHON_FIND_MAJ) - ELSE(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") - SET(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION}_VERSIONS}) - ENDIF(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") -ELSE(PythonLibs_FIND_VERSION) - SET(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) -ENDIF(PythonLibs_FIND_VERSION) +set(_PYTHON1_VERSIONS 1.6 1.5) +set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) +set(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0) + +if(PythonLibs_FIND_VERSION) + if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") + string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}") + string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}") + unset(_PYTHON_FIND_OTHER_VERSIONS) + if(PythonLibs_FIND_VERSION_EXACT) + if(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION) + set(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}") + else() + set(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}") + endif() + else() + foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS}) + if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN) + list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) + endif() + endforeach() + endif() + unset(_PYTHON_FIND_MAJ_MIN) + unset(_PYTHON_FIND_MAJ) + else() + set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION}_VERSIONS}) + endif() +else() + set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) +endif() # Set up the versions we know about, in the order we will search. Always add # the user supplied additional versions to the front. -SET(_Python_VERSIONS +set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS} ${_PYTHON_FIND_OTHER_VERSIONS} ) -UNSET(_PYTHON_FIND_OTHER_VERSIONS) -UNSET(_PYTHON1_VERSIONS) -UNSET(_PYTHON2_VERSIONS) -UNSET(_PYTHON3_VERSIONS) +unset(_PYTHON_FIND_OTHER_VERSIONS) +unset(_PYTHON1_VERSIONS) +unset(_PYTHON2_VERSIONS) +unset(_PYTHON3_VERSIONS) -FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) - STRING(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION}) - IF(WIN32) - FIND_LIBRARY(PYTHON_DEBUG_LIBRARY +foreach(_CURRENT_VERSION ${_Python_VERSIONS}) + string(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION}) + if(WIN32) + find_library(PYTHON_DEBUG_LIBRARY NAMES python${_CURRENT_VERSION_NO_DOTS}_d python PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug @@ -90,9 +90,9 @@ FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs ) - ENDIF(WIN32) + endif() - FIND_LIBRARY(PYTHON_LIBRARY + find_library(PYTHON_LIBRARY NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION}mu @@ -106,7 +106,7 @@ FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) NO_SYSTEM_ENVIRONMENT_PATH ) # Look for the static library in the Python config directory - FIND_LIBRARY(PYTHON_LIBRARY + find_library(PYTHON_LIBRARY NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION} # Avoid finding the .dll in the PATH. We want the .lib. NO_SYSTEM_ENVIRONMENT_PATH @@ -116,20 +116,20 @@ FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) # For backward compatibility, honour value of PYTHON_INCLUDE_PATH, if # PYTHON_INCLUDE_DIR is not set. - IF(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR) - SET(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_PATH}" CACHE PATH + if(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR) + set(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_PATH}" CACHE PATH "Path to where Python.h is found" FORCE) - ENDIF(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR) + endif() - SET(PYTHON_FRAMEWORK_INCLUDES) - IF(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR) - FOREACH(dir ${Python_FRAMEWORKS}) - SET(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES} + set(PYTHON_FRAMEWORK_INCLUDES) + if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR) + foreach(dir ${Python_FRAMEWORKS}) + set(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES} ${dir}/Versions/${_CURRENT_VERSION}/include/python${_CURRENT_VERSION}) - ENDFOREACH(dir) - ENDIF(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR) + endforeach() + endif() - FIND_PATH(PYTHON_INCLUDE_DIR + find_path(PYTHON_INCLUDE_DIR NAMES Python.h PATHS ${PYTHON_FRAMEWORK_INCLUDES} @@ -143,22 +143,22 @@ FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) ) # For backward compatibility, set PYTHON_INCLUDE_PATH. - SET(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}") + set(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}") - IF(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h") - FILE(STRINGS "${PYTHON_INCLUDE_DIR}/patchlevel.h" python_version_str + if(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h") + file(STRINGS "${PYTHON_INCLUDE_DIR}/patchlevel.h" python_version_str REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"") - STRING(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1" + string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1" PYTHONLIBS_VERSION_STRING "${python_version_str}") - UNSET(python_version_str) - ENDIF(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h") + unset(python_version_str) + endif() - IF(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR) - BREAK() - ENDIF(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR) -ENDFOREACH(_CURRENT_VERSION) + if(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR) + break() + endif() +endforeach() -MARK_AS_ADVANCED( +mark_as_advanced( PYTHON_DEBUG_LIBRARY PYTHON_LIBRARY PYTHON_INCLUDE_DIR @@ -168,21 +168,21 @@ MARK_AS_ADVANCED( # cache entries because they are meant to specify the location of a single # library. We now set the variables listed by the documentation for this # module. -SET(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") -SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") +set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") +set(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") # These variables have been historically named in this module different from # what SELECT_LIBRARY_CONFIGURATIONS() expects. -SET(PYTHON_LIBRARY_DEBUG "${PYTHON_DEBUG_LIBRARY}") -SET(PYTHON_LIBRARY_RELEASE "${PYTHON_LIBRARY}") -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) +set(PYTHON_LIBRARY_DEBUG "${PYTHON_DEBUG_LIBRARY}") +set(PYTHON_LIBRARY_RELEASE "${PYTHON_LIBRARY}") +include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) SELECT_LIBRARY_CONFIGURATIONS(PYTHON) # SELECT_LIBRARY_CONFIGURATIONS() sets ${PREFIX}_FOUND if it has a library. # Unset this, this prefix doesn't match the module prefix, they are different # for historical reasons. -UNSET(PYTHON_FOUND) +unset(PYTHON_FOUND) -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS VERSION_VAR PYTHONLIBS_VERSION_STRING) @@ -190,51 +190,51 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs # PYTHON_ADD_MODULE( src1 src2 ... srcN) is used to build modules for python. # PYTHON_WRITE_MODULES_HEADER() writes a header file you can include # in your sources to initialize the static python modules -FUNCTION(PYTHON_ADD_MODULE _NAME ) - GET_PROPERTY(_TARGET_SUPPORTS_SHARED_LIBS +function(PYTHON_ADD_MODULE _NAME ) + get_property(_TARGET_SUPPORTS_SHARED_LIBS GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS) - OPTION(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE) - OPTION(PYTHON_MODULE_${_NAME}_BUILD_SHARED + option(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE) + option(PYTHON_MODULE_${_NAME}_BUILD_SHARED "Add module ${_NAME} shared" ${_TARGET_SUPPORTS_SHARED_LIBS}) # Mark these options as advanced - MARK_AS_ADVANCED(PYTHON_ENABLE_MODULE_${_NAME} + mark_as_advanced(PYTHON_ENABLE_MODULE_${_NAME} PYTHON_MODULE_${_NAME}_BUILD_SHARED) - IF(PYTHON_ENABLE_MODULE_${_NAME}) - IF(PYTHON_MODULE_${_NAME}_BUILD_SHARED) - SET(PY_MODULE_TYPE MODULE) - ELSE(PYTHON_MODULE_${_NAME}_BUILD_SHARED) - SET(PY_MODULE_TYPE STATIC) - SET_PROPERTY(GLOBAL APPEND PROPERTY PY_STATIC_MODULES_LIST ${_NAME}) - ENDIF(PYTHON_MODULE_${_NAME}_BUILD_SHARED) + if(PYTHON_ENABLE_MODULE_${_NAME}) + if(PYTHON_MODULE_${_NAME}_BUILD_SHARED) + set(PY_MODULE_TYPE MODULE) + else() + set(PY_MODULE_TYPE STATIC) + set_property(GLOBAL APPEND PROPERTY PY_STATIC_MODULES_LIST ${_NAME}) + endif() - SET_PROPERTY(GLOBAL APPEND PROPERTY PY_MODULES_LIST ${_NAME}) - ADD_LIBRARY(${_NAME} ${PY_MODULE_TYPE} ${ARGN}) -# TARGET_LINK_LIBRARIES(${_NAME} ${PYTHON_LIBRARIES}) + set_property(GLOBAL APPEND PROPERTY PY_MODULES_LIST ${_NAME}) + add_library(${_NAME} ${PY_MODULE_TYPE} ${ARGN}) +# target_link_libraries(${_NAME} ${PYTHON_LIBRARIES}) - IF(PYTHON_MODULE_${_NAME}_BUILD_SHARED) - SET_TARGET_PROPERTIES(${_NAME} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}") - IF(WIN32 AND NOT CYGWIN) - SET_TARGET_PROPERTIES(${_NAME} PROPERTIES SUFFIX ".pyd") - ENDIF(WIN32 AND NOT CYGWIN) - ENDIF(PYTHON_MODULE_${_NAME}_BUILD_SHARED) + if(PYTHON_MODULE_${_NAME}_BUILD_SHARED) + set_target_properties(${_NAME} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}") + if(WIN32 AND NOT CYGWIN) + set_target_properties(${_NAME} PROPERTIES SUFFIX ".pyd") + endif() + endif() - ENDIF(PYTHON_ENABLE_MODULE_${_NAME}) -ENDFUNCTION(PYTHON_ADD_MODULE) + endif() +endfunction() -FUNCTION(PYTHON_WRITE_MODULES_HEADER _filename) +function(PYTHON_WRITE_MODULES_HEADER _filename) - GET_PROPERTY(PY_STATIC_MODULES_LIST GLOBAL PROPERTY PY_STATIC_MODULES_LIST) + get_property(PY_STATIC_MODULES_LIST GLOBAL PROPERTY PY_STATIC_MODULES_LIST) - GET_FILENAME_COMPONENT(_name "${_filename}" NAME) - STRING(REPLACE "." "_" _name "${_name}") - STRING(TOUPPER ${_name} _nameUpper) - SET(_filename ${CMAKE_CURRENT_BINARY_DIR}/${_filename}) + get_filename_component(_name "${_filename}" NAME) + string(REPLACE "." "_" _name "${_name}") + string(TOUPPER ${_name} _nameUpper) + set(_filename ${CMAKE_CURRENT_BINARY_DIR}/${_filename}) - SET(_filenameTmp "${_filename}.in") - FILE(WRITE ${_filenameTmp} "/*Created by cmake, do not edit, changes will be lost*/\n") - FILE(APPEND ${_filenameTmp} + set(_filenameTmp "${_filename}.in") + file(WRITE ${_filenameTmp} "/*Created by cmake, do not edit, changes will be lost*/\n") + file(APPEND ${_filenameTmp} "#ifndef ${_nameUpper} #define ${_nameUpper} @@ -246,11 +246,11 @@ extern \"C\" { ") - FOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) - FILE(APPEND ${_filenameTmp} "extern void init${PYTHON_MODULE_PREFIX}${_currentModule}(void);\n\n") - ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) + foreach(_currentModule ${PY_STATIC_MODULES_LIST}) + file(APPEND ${_filenameTmp} "extern void init${PYTHON_MODULE_PREFIX}${_currentModule}(void);\n\n") + endforeach() - FILE(APPEND ${_filenameTmp} + file(APPEND ${_filenameTmp} "#ifdef __cplusplus } #endif /* __cplusplus */ @@ -258,18 +258,18 @@ extern \"C\" { ") - FOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) - FILE(APPEND ${_filenameTmp} "int ${_name}_${_currentModule}(void) \n{\n static char name[]=\"${PYTHON_MODULE_PREFIX}${_currentModule}\"; return PyImport_AppendInittab(name, init${PYTHON_MODULE_PREFIX}${_currentModule});\n}\n\n") - ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) + foreach(_currentModule ${PY_STATIC_MODULES_LIST}) + file(APPEND ${_filenameTmp} "int ${_name}_${_currentModule}(void) \n{\n static char name[]=\"${PYTHON_MODULE_PREFIX}${_currentModule}\"; return PyImport_AppendInittab(name, init${PYTHON_MODULE_PREFIX}${_currentModule});\n}\n\n") + endforeach() - FILE(APPEND ${_filenameTmp} "void ${_name}_LoadAllPythonModules(void)\n{\n") - FOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) - FILE(APPEND ${_filenameTmp} " ${_name}_${_currentModule}();\n") - ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) - FILE(APPEND ${_filenameTmp} "}\n\n") - FILE(APPEND ${_filenameTmp} "#ifndef EXCLUDE_LOAD_ALL_FUNCTION\nvoid CMakeLoadAllPythonModules(void)\n{\n ${_name}_LoadAllPythonModules();\n}\n#endif\n\n#endif\n") + file(APPEND ${_filenameTmp} "void ${_name}_LoadAllPythonModules(void)\n{\n") + foreach(_currentModule ${PY_STATIC_MODULES_LIST}) + file(APPEND ${_filenameTmp} " ${_name}_${_currentModule}();\n") + endforeach() + file(APPEND ${_filenameTmp} "}\n\n") + file(APPEND ${_filenameTmp} "#ifndef EXCLUDE_LOAD_ALL_FUNCTION\nvoid CMakeLoadAllPythonModules(void)\n{\n ${_name}_LoadAllPythonModules();\n}\n#endif\n\n#endif\n") -# with CONFIGURE_FILE() cmake complains that you may not use a file created using FILE(WRITE) as input file for CONFIGURE_FILE() - EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_filenameTmp}" "${_filename}" OUTPUT_QUIET ERROR_QUIET) +# with configure_file() cmake complains that you may not use a file created using file(WRITE) as input file for configure_file() + execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_filenameTmp}" "${_filename}" OUTPUT_QUIET ERROR_QUIET) -ENDFUNCTION(PYTHON_WRITE_MODULES_HEADER) +endfunction() diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index 2b8dfd7fb..54b7c6f97 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -1,16 +1,16 @@ -# - Searches for all installed versions of QT. +# - Searches for all installed versions of Qt. # This should only be used if your project can work with multiple -# versions of QT. If not, you should just directly use FindQt4 or FindQt3. -# If multiple versions of QT are found on the machine, then +# versions of Qt. If not, you should just directly use FindQt4 or FindQt3. +# If multiple versions of Qt are found on the machine, then # The user must set the option DESIRED_QT_VERSION to the version # they want to use. If only one version of qt is found on the machine, -# then the DESIRED_QT_VERSION is set to that version and the +# then the DESIRED_QT_VERSION is set to that version and the # matching FindQt3 or FindQt4 module is included. # Once the user sets DESIRED_QT_VERSION, then the FindQt3 or FindQt4 module # is included. # -# QT_REQUIRED if this is set to TRUE then if CMake can -# not find QT4 or QT3 an error is raised +# QT_REQUIRED if this is set to TRUE then if CMake can +# not find Qt4 or Qt3 an error is raised # and a message is sent to the user. # # DESIRED_QT_VERSION OPTION is created @@ -31,52 +31,68 @@ # License text for the above reference.) # look for signs of qt3 installations -FILE(GLOB GLOB_TEMP_VAR /usr/lib/qt-3*/bin/qmake) -IF(GLOB_TEMP_VAR) - SET(QT3_INSTALLED TRUE) -ENDIF(GLOB_TEMP_VAR) -SET(GLOB_TEMP_VAR) - -FILE(GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-3*/bin/qmake) -IF(GLOB_TEMP_VAR) - SET(QT3_INSTALLED TRUE) -ENDIF(GLOB_TEMP_VAR) -SET(GLOB_TEMP_VAR) +file(GLOB GLOB_TEMP_VAR /usr/lib*/qt-3*/bin/qmake /usr/lib*/qt3*/bin/qmake) +if(GLOB_TEMP_VAR) + set(QT3_INSTALLED TRUE) +endif() +set(GLOB_TEMP_VAR) + +file(GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-3*/bin/qmake) +if(GLOB_TEMP_VAR) + set(QT3_INSTALLED TRUE) +endif() +set(GLOB_TEMP_VAR) + +file(GLOB GLOB_TEMP_VAR /usr/local/lib/qt3/bin/qmake) +if(GLOB_TEMP_VAR) + set(QT3_INSTALLED TRUE) +endif() +set(GLOB_TEMP_VAR) # look for qt4 installations -FILE(GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-4*/bin/qmake) -IF(GLOB_TEMP_VAR) - SET(QT4_INSTALLED TRUE) -ENDIF(GLOB_TEMP_VAR) -SET(GLOB_TEMP_VAR) - -FILE(GLOB GLOB_TEMP_VAR /usr/local/Trolltech/Qt-4*/bin/qmake) -IF(GLOB_TEMP_VAR) - SET(QT4_INSTALLED TRUE) -ENDIF(GLOB_TEMP_VAR) -SET(GLOB_TEMP_VAR) +file(GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-4*/bin/qmake) +if(GLOB_TEMP_VAR) + set(QT4_INSTALLED TRUE) +endif() +set(GLOB_TEMP_VAR) + +file(GLOB GLOB_TEMP_VAR /usr/local/Trolltech/Qt-4*/bin/qmake) +if(GLOB_TEMP_VAR) + set(QT4_INSTALLED TRUE) +endif() +set(GLOB_TEMP_VAR) + +file(GLOB GLOB_TEMP_VAR /usr/local/lib/qt4/bin/qmake) +if(GLOB_TEMP_VAR) + set(QT4_INSTALLED TRUE) +endif() +set(GLOB_TEMP_VAR) + +if (Qt_FIND_VERSION) + set(DESIRED_QT_VERSION "${Qt_FIND_VERSION}") +endif () # now find qmake -FIND_PROGRAM(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin") -IF(QT_QMAKE_EXECUTABLE_FINDQT) - EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE_FINDQT} ARGS "-query QT_VERSION" +find_program(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin") +if(QT_QMAKE_EXECUTABLE_FINDQT) + exec_program(${QT_QMAKE_EXECUTABLE_FINDQT} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) - IF(QTVERSION MATCHES "4.*") - SET(QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE_FINDQT} CACHE PATH "QT4 qmake program.") - SET(QT4_INSTALLED TRUE) - ENDIF(QTVERSION MATCHES "4.*") - IF(QTVERSION MATCHES "Unknown") - SET(QT3_INSTALLED TRUE) - ENDIF(QTVERSION MATCHES "Unknown") -ENDIF(QT_QMAKE_EXECUTABLE_FINDQT) - -IF(QT_QMAKE_EXECUTABLE_FINDQT) - EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE_FINDQT} - ARGS "-query QT_INSTALL_HEADERS" + if(QTVERSION MATCHES "4.*") + set(QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE_FINDQT} CACHE PATH "Qt4 qmake program.") + set(QT4_INSTALLED TRUE) + endif() + if(QTVERSION MATCHES "Unknown") + set(QT3_INSTALLED TRUE) + endif() +endif() + +if(QT_QMAKE_EXECUTABLE_FINDQT) + exec_program( ${QT_QMAKE_EXECUTABLE_FINDQT} + ARGS "-query QT_INSTALL_HEADERS" OUTPUT_VARIABLE qt_headers ) -ENDIF(QT_QMAKE_EXECUTABLE_FINDQT) +endif() -FIND_FILE( QT4_QGLOBAL_H_FILE qglobal.h +find_file( QT4_QGLOBAL_H_FILE qglobal.h "${QT_SEARCH_PATH}/Qt/include" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/include/Qt" @@ -87,14 +103,15 @@ FIND_FILE( QT4_QGLOBAL_H_FILE qglobal.h /usr/lib/qt/include/Qt /usr/include/Qt /usr/share/qt4/include/Qt + /usr/local/include/X11/qt4/Qt C:/Progra~1/qt/include/Qt ) -IF(QT4_QGLOBAL_H_FILE) - SET(QT4_INSTALLED TRUE) -ENDIF(QT4_QGLOBAL_H_FILE) +if(QT4_QGLOBAL_H_FILE) + set(QT4_INSTALLED TRUE) +endif() -FIND_FILE( QT3_QGLOBAL_H_FILE qglobal.h - "${QT_SEARCH_PATH}/Qt/include" +find_file( QT3_QGLOBAL_H_FILE qglobal.h + "${QT_SEARCH_PATH}/Qt/include" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" @@ -106,55 +123,56 @@ FIND_FILE( QT3_QGLOBAL_H_FILE qglobal.h /usr/lib/qt/include /usr/include /usr/share/qt3/include + /usr/local/include/X11/qt3 C:/Progra~1/qt/include /usr/include/qt3 ) -IF(QT3_QGLOBAL_H_FILE) - SET(QT3_INSTALLED TRUE) -ENDIF(QT3_QGLOBAL_H_FILE) +if(QT3_QGLOBAL_H_FILE) + set(QT3_INSTALLED TRUE) +endif() -IF(QT3_INSTALLED AND QT4_INSTALLED ) +if(QT3_INSTALLED AND QT4_INSTALLED AND NOT DESIRED_QT_VERSION) # force user to pick if we have both - SET(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of QT to use: 3 or 4") -ELSE(QT3_INSTALLED AND QT4_INSTALLED ) + set(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of Qt to use: 3 or 4") +else() # if only one found then pick that one - IF(QT3_INSTALLED) - SET(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of QT to use: 3 or 4") - ENDIF(QT3_INSTALLED) - IF(QT4_INSTALLED) - SET(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of QT to use: 3 or 4") - ENDIF(QT4_INSTALLED) -ENDIF(QT3_INSTALLED AND QT4_INSTALLED ) - -IF(DESIRED_QT_VERSION MATCHES 3) - SET(Qt3_FIND_REQUIRED ${Qt_FIND_REQUIRED}) - SET(Qt3_FIND_QUIETLY ${Qt_FIND_QUIETLY}) - INCLUDE(FindQt3) -ENDIF(DESIRED_QT_VERSION MATCHES 3) -IF(DESIRED_QT_VERSION MATCHES 4) - SET(Qt4_FIND_REQUIRED ${Qt_FIND_REQUIRED}) - SET(Qt4_FIND_QUIETLY ${Qt_FIND_QUIETLY}) - INCLUDE(FindQt4) -ENDIF(DESIRED_QT_VERSION MATCHES 4) - -IF(NOT QT3_INSTALLED AND NOT QT4_INSTALLED) - IF(QT_REQUIRED) - MESSAGE(SEND_ERROR "CMake was unable to find any QT versions, put qmake in your path, or set QT_QMAKE_EXECUTABLE.") - ENDIF(QT_REQUIRED) -ELSE(NOT QT3_INSTALLED AND NOT QT4_INSTALLED) - IF(NOT QT_FOUND AND NOT DESIRED_QT_VERSION) - IF(QT_REQUIRED) - MESSAGE(SEND_ERROR "Multiple versions of QT found please set DESIRED_QT_VERSION") - ELSE(QT_REQUIRED) - MESSAGE("Multiple versions of QT found please set DESIRED_QT_VERSION") - ENDIF(QT_REQUIRED) - ENDIF(NOT QT_FOUND AND NOT DESIRED_QT_VERSION) - IF(NOT QT_FOUND AND DESIRED_QT_VERSION) - IF(QT_REQUIRED) - MESSAGE(FATAL_ERROR "CMake was unable to find QT version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE, if those are set then QT_QT_LIBRARY or QT_LIBRARY_DIR.") - ELSE(QT_REQUIRED) - MESSAGE( "CMake was unable to find desired QT version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE.") - ENDIF(QT_REQUIRED) - ENDIF(NOT QT_FOUND AND DESIRED_QT_VERSION) -ENDIF(NOT QT3_INSTALLED AND NOT QT4_INSTALLED) -MARK_AS_ADVANCED(QT3_QGLOBAL_H_FILE QT4_QGLOBAL_H_FILE QT_QMAKE_EXECUTABLE_FINDQT) + if(QT3_INSTALLED AND NOT DESIRED_QT_VERSION EQUAL 4) + set(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of Qt to use: 3 or 4") + endif() + if(QT4_INSTALLED AND NOT DESIRED_QT_VERSION EQUAL 3) + set(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of Qt to use: 3 or 4") + endif() +endif() + +if(DESIRED_QT_VERSION MATCHES 3) + set(Qt3_FIND_REQUIRED ${Qt_FIND_REQUIRED}) + set(Qt3_FIND_QUIETLY ${Qt_FIND_QUIETLY}) + include(${CMAKE_CURRENT_LIST_DIR}/FindQt3.cmake) +endif() +if(DESIRED_QT_VERSION MATCHES 4) + set(Qt4_FIND_REQUIRED ${Qt_FIND_REQUIRED}) + set(Qt4_FIND_QUIETLY ${Qt_FIND_QUIETLY}) + include(${CMAKE_CURRENT_LIST_DIR}/FindQt4.cmake) +endif() + +if(NOT QT3_INSTALLED AND NOT QT4_INSTALLED) + if(QT_REQUIRED) + message(SEND_ERROR "CMake was unable to find any Qt versions, put qmake in your path, or set QT_QMAKE_EXECUTABLE.") + endif() +else() + if(NOT QT_FOUND AND NOT DESIRED_QT_VERSION) + if(QT_REQUIRED) + message(SEND_ERROR "Multiple versions of Qt found please set DESIRED_QT_VERSION") + else() + message("Multiple versions of Qt found please set DESIRED_QT_VERSION") + endif() + endif() + if(NOT QT_FOUND AND DESIRED_QT_VERSION) + if(QT_REQUIRED) + message(FATAL_ERROR "CMake was unable to find Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE, if those are set then QT_QT_LIBRARY or QT_LIBRARY_DIR.") + else() + message( "CMake was unable to find desired Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE.") + endif() + endif() +endif() +mark_as_advanced(QT3_QGLOBAL_H_FILE QT4_QGLOBAL_H_FILE QT_QMAKE_EXECUTABLE_FINDQT) diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index 2d8dbde22..4fc8e406c 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -35,23 +35,23 @@ # License text for the above reference.) # If Qt4 has already been found, fail. -IF(QT4_FOUND) - IF(Qt3_FIND_REQUIRED) - MESSAGE( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project.") - ELSE(Qt3_FIND_REQUIRED) - IF(NOT Qt3_FIND_QUIETLY) - MESSAGE( STATUS "Qt3 and Qt4 cannot be used together in one project.") - ENDIF(NOT Qt3_FIND_QUIETLY) - RETURN() - ENDIF(Qt3_FIND_REQUIRED) -ENDIF(QT4_FOUND) +if(QT4_FOUND) + if(Qt3_FIND_REQUIRED) + message( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project.") + else() + if(NOT Qt3_FIND_QUIETLY) + message( STATUS "Qt3 and Qt4 cannot be used together in one project.") + endif() + return() + endif() +endif() -FILE(GLOB GLOB_PATHS /usr/lib/qt-3*) -FOREACH(GLOB_PATH ${GLOB_PATHS}) - LIST(APPEND GLOB_PATHS_BIN "${GLOB_PATH}/bin") -ENDFOREACH(GLOB_PATH) -FIND_PATH(QT_INCLUDE_DIR qt.h +file(GLOB GLOB_PATHS /usr/lib/qt-3*) +foreach(GLOB_PATH ${GLOB_PATHS}) + list(APPEND GLOB_PATHS_BIN "${GLOB_PATH}/bin") +endforeach() +find_path(QT_INCLUDE_DIR qt.h "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" @@ -64,233 +64,243 @@ FIND_PATH(QT_INCLUDE_DIR qt.h /usr/share/qt3/include C:/Progra~1/qt/include /usr/include/qt3 + /usr/local/include/X11/qt3 ) # if qglobal.h is not in the qt_include_dir then set # QT_INCLUDE_DIR to NOTFOUND -IF(NOT EXISTS ${QT_INCLUDE_DIR}/qglobal.h) - SET(QT_INCLUDE_DIR QT_INCLUDE_DIR-NOTFOUND CACHE PATH "path to Qt3 include directory" FORCE) -ENDIF(NOT EXISTS ${QT_INCLUDE_DIR}/qglobal.h) +if(NOT EXISTS ${QT_INCLUDE_DIR}/qglobal.h) + set(QT_INCLUDE_DIR QT_INCLUDE_DIR-NOTFOUND CACHE PATH "path to Qt3 include directory" FORCE) +endif() -IF(QT_INCLUDE_DIR) +if(QT_INCLUDE_DIR) #extract the version string from qglobal.h - FILE(READ ${QT_INCLUDE_DIR}/qglobal.h QGLOBAL_H) - STRING(REGEX MATCH "#define[\t ]+QT_VERSION_STR[\t ]+\"[0-9]+.[0-9]+.[0-9]+[a-z]*\"" QGLOBAL_H "${QGLOBAL_H}") - STRING(REGEX REPLACE ".*\"([0-9]+.[0-9]+.[0-9]+[a-z]*)\".*" "\\1" qt_version_str "${QGLOBAL_H}") + file(STRINGS ${QT_INCLUDE_DIR}/qglobal.h QGLOBAL_H REGEX "#define[\t ]+QT_VERSION_STR[\t ]+\"[0-9]+.[0-9]+.[0-9]+[a-z]*\"") + string(REGEX REPLACE ".*\"([0-9]+.[0-9]+.[0-9]+[a-z]*)\".*" "\\1" qt_version_str "${QGLOBAL_H}") + unset(QGLOBAL_H) # Under windows the qt library (MSVC) has the format qt-mtXYZ where XYZ is the # version X.Y.Z, so we need to remove the dots from version - STRING(REGEX REPLACE "\\." "" qt_version_str_lib "${qt_version_str}") - SET(QT_VERSION_STRING "${qt_version_str}") -ENDIF(QT_INCLUDE_DIR) + string(REGEX REPLACE "\\." "" qt_version_str_lib "${qt_version_str}") + set(QT_VERSION_STRING "${qt_version_str}") +endif() -FILE(GLOB GLOB_PATHS_LIB /usr/lib/qt-3*/lib/) -IF (QT_MT_REQUIRED) - FIND_LIBRARY(QT_QT_LIBRARY +file(GLOB GLOB_PATHS_LIB /usr/lib/qt-3*/lib/) +if (QT_MT_REQUIRED) + find_library(QT_QT_LIBRARY NAMES qt-mt qt-mt${qt_version_str_lib} qt-mtnc${qt_version_str_lib} qt-mtedu${qt_version_str_lib} qt-mt230nc qt-mtnc321 qt-mt3 PATHS - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib" - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib" - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib" - $ENV{QTDIR}/lib - ${GLOB_PATHS_LIB} - /usr/local/qt/lib - /usr/lib/qt/lib - /usr/lib/qt3/lib - /usr/lib/qt3/lib64 - /usr/share/qt3/lib - C:/Progra~1/qt/lib + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]" + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]" + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]" + ENV QTDIR + ${GLOB_PATHS_LIB} + /usr/local/qt + /usr/lib/qt + /usr/lib/qt3 + /usr/share/qt3 + C:/Progra~1/qt + PATH_SUFFIXES + lib ) -ELSE (QT_MT_REQUIRED) - FIND_LIBRARY(QT_QT_LIBRARY +else () + find_library(QT_QT_LIBRARY NAMES qt qt-${qt_version_str_lib} qt-edu${qt_version_str_lib} qt-mt qt-mt${qt_version_str_lib} qt-mtnc${qt_version_str_lib} qt-mtedu${qt_version_str_lib} qt-mt230nc qt-mtnc321 qt-mt3 PATHS - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib" - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib" - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib" - $ENV{QTDIR}/lib - ${GLOB_PATHS_LIB} - /usr/local/qt/lib - /usr/lib/qt/lib - /usr/lib/qt3/lib - /usr/lib/qt3/lib64 - /usr/share/qt3/lib - C:/Progra~1/qt/lib + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]" + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]" + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]" + ENV QTDIR + ${GLOB_PATHS_LIB} + /usr/local/qt + /usr/lib/qt + /usr/lib/qt3 + /usr/share/qt3 + C:/Progra~1/qt/lib + PATH_SUFFIXES + lib ) -ENDIF (QT_MT_REQUIRED) +endif () -FIND_LIBRARY(QT_QASSISTANTCLIENT_LIBRARY +find_library(QT_QASSISTANTCLIENT_LIBRARY NAMES qassistantclient PATHS - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib" - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib" - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib" - $ENV{QTDIR}/lib - ${GLOB_PATHS_LIB} - /usr/local/qt/lib - /usr/lib/qt3/lib - /usr/lib/qt3/lib64 - /usr/share/qt3/lib - C:/Progra~1/qt/lib + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]" + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]" + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]" + ENV QTDIR + ${GLOB_PATHS_LIB} + /usr/local/qt + /usr/lib/qt3 + /usr/share/qt3 + C:/Progra~1/qt + PATH_SUFFIXES + lib ) -# qt 3 should prefer QTDIR over the PATH -FIND_PROGRAM(QT_MOC_EXECUTABLE - NAMES moc-qt3 moc +# Qt 3 should prefer QTDIR over the PATH +find_program(QT_MOC_EXECUTABLE + NAMES moc-qt3 moc moc3 moc3-mt HINTS - $ENV{QTDIR}/bin + ENV QTDIR PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" - $ENV{QTDIR}/bin ${GLOB_PATHS_BIN} - /usr/local/qt/bin - /usr/lib/qt/bin - /usr/lib/qt3/bin - /usr/share/qt3/bin - C:/Progra~1/qt/bin - /usr/X11R6/bin + /usr/local/lib/qt3 + /usr/local/qt + /usr/lib/qt + /usr/lib/qt3 + /usr/share/qt3 + C:/Progra~1/qt + /usr/X11R6 + PATH_SUFFIXES + bin ) -IF(QT_MOC_EXECUTABLE) - SET ( QT_WRAP_CPP "YES") -ENDIF(QT_MOC_EXECUTABLE) +if(QT_MOC_EXECUTABLE) + set ( QT_WRAP_CPP "YES") +endif() -# qt 3 should prefer QTDIR over the PATH -FIND_PROGRAM(QT_UIC_EXECUTABLE - NAMES uic-qt3 uic +# Qt 3 should prefer QTDIR over the PATH +find_program(QT_UIC_EXECUTABLE + NAMES uic-qt3 uic uic3 uic3-mt HINTS - $ENV{QTDIR}/bin + ENV QTDIR PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" ${GLOB_PATHS_BIN} - /usr/local/qt/bin - /usr/lib/qt/bin - /usr/lib/qt3/bin - /usr/share/qt3/bin - C:/Progra~1/qt/bin - /usr/X11R6/bin + /usr/local/qt + /usr/lib/qt + /usr/lib/qt3 + /usr/share/qt3 + C:/Progra~1/qt + /usr/X11R6 + PATH_SUFFIXES + bin ) -IF(QT_UIC_EXECUTABLE) - SET ( QT_WRAP_UI "YES") -ENDIF(QT_UIC_EXECUTABLE) +if(QT_UIC_EXECUTABLE) + set ( QT_WRAP_UI "YES") +endif() -IF (WIN32) - FIND_LIBRARY(QT_QTMAIN_LIBRARY qtmain +if (WIN32) + find_library(QT_QTMAIN_LIBRARY qtmain HINTS - $ENV{QTDIR}/lib - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib" - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib" - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib" + ENV QTDIR + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]" + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]" + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]" PATHS - "$ENV{ProgramFiles}/qt/lib" - "C:/Program Files/qt/lib" + "$ENV{ProgramFiles}/qt" + "C:/Program Files/qt" + PATH_SUFFIXES + lib DOC "This Library is only needed by and included with Qt3 on MSWindows. It should be NOTFOUND, undefined or IGNORE otherwise." ) -ENDIF (WIN32) +endif () #support old QT_MIN_VERSION if set, but not if version is supplied by find_package() -IF(NOT Qt3_FIND_VERSION AND QT_MIN_VERSION) - SET(Qt3_FIND_VERSION ${QT_MIN_VERSION}) -ENDIF(NOT Qt3_FIND_VERSION AND QT_MIN_VERSION) +if(NOT Qt3_FIND_VERSION AND QT_MIN_VERSION) + set(Qt3_FIND_VERSION ${QT_MIN_VERSION}) +endif() # if the include a library are found then we have it -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt3 REQUIRED_VARS QT_QT_LIBRARY QT_INCLUDE_DIR QT_MOC_EXECUTABLE VERSION_VAR QT_VERSION_STRING) -SET(QT_FOUND ${QT3_FOUND} ) +set(QT_FOUND ${QT3_FOUND} ) -IF(QT_FOUND) - SET( QT_LIBRARIES ${QT_LIBRARIES} ${QT_QT_LIBRARY} ) - SET( QT_DEFINITIONS "") +if(QT_FOUND) + set( QT_LIBRARIES ${QT_LIBRARIES} ${QT_QT_LIBRARY} ) + set( QT_DEFINITIONS "") - IF (WIN32 AND NOT CYGWIN) - IF (QT_QTMAIN_LIBRARY) + if (WIN32 AND NOT CYGWIN) + if (QT_QTMAIN_LIBRARY) # for version 3 - SET (QT_DEFINITIONS -DQT_DLL -DQT_THREAD_SUPPORT -DNO_DEBUG) - SET (QT_LIBRARIES imm32.lib ${QT_QT_LIBRARY} ${QT_QTMAIN_LIBRARY} ) - SET (QT_LIBRARIES ${QT_LIBRARIES} winmm wsock32) - ELSE (QT_QTMAIN_LIBRARY) + set (QT_DEFINITIONS -DQT_DLL -DQT_THREAD_SUPPORT -DNO_DEBUG) + set (QT_LIBRARIES imm32.lib ${QT_QT_LIBRARY} ${QT_QTMAIN_LIBRARY} ) + set (QT_LIBRARIES ${QT_LIBRARIES} winmm wsock32) + else () # for version 2 - SET (QT_LIBRARIES imm32.lib ws2_32.lib ${QT_QT_LIBRARY} ) - ENDIF (QT_QTMAIN_LIBRARY) - ELSE (WIN32 AND NOT CYGWIN) - SET (QT_LIBRARIES ${QT_QT_LIBRARY} ) + set (QT_LIBRARIES imm32.lib ws2_32.lib ${QT_QT_LIBRARY} ) + endif () + else () + set (QT_LIBRARIES ${QT_QT_LIBRARY} ) - SET (QT_DEFINITIONS -DQT_SHARED -DQT_NO_DEBUG) - IF(QT_QT_LIBRARY MATCHES "qt-mt") - SET (QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_THREAD_SUPPORT -D_REENTRANT) - ENDIF(QT_QT_LIBRARY MATCHES "qt-mt") + set (QT_DEFINITIONS -DQT_SHARED -DQT_NO_DEBUG) + if(QT_QT_LIBRARY MATCHES "qt-mt") + set (QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_THREAD_SUPPORT -D_REENTRANT) + endif() - ENDIF (WIN32 AND NOT CYGWIN) + endif () - IF (QT_QASSISTANTCLIENT_LIBRARY) - SET (QT_LIBRARIES ${QT_QASSISTANTCLIENT_LIBRARY} ${QT_LIBRARIES}) - ENDIF (QT_QASSISTANTCLIENT_LIBRARY) + if (QT_QASSISTANTCLIENT_LIBRARY) + set (QT_LIBRARIES ${QT_QASSISTANTCLIENT_LIBRARY} ${QT_LIBRARIES}) + endif () # Backwards compatibility for CMake1.4 and 1.2 - SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} ) - SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} ) + set (QT_MOC_EXE ${QT_MOC_EXECUTABLE} ) + set (QT_UIC_EXE ${QT_UIC_EXECUTABLE} ) # for unix add X11 stuff - IF(UNIX) - FIND_PACKAGE(X11) - IF (X11_FOUND) - SET (QT_LIBRARIES ${QT_LIBRARIES} ${X11_LIBRARIES}) - ENDIF (X11_FOUND) - IF (CMAKE_DL_LIBS) - SET (QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_DL_LIBS}) - ENDIF (CMAKE_DL_LIBS) - ENDIF(UNIX) - IF(QT_QT_LIBRARY MATCHES "qt-mt") - FIND_PACKAGE(Threads) - SET(QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) - ENDIF(QT_QT_LIBRARY MATCHES "qt-mt") -ENDIF(QT_FOUND) + if(UNIX) + find_package(X11) + if (X11_FOUND) + set (QT_LIBRARIES ${QT_LIBRARIES} ${X11_LIBRARIES}) + endif () + if (CMAKE_DL_LIBS) + set (QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_DL_LIBS}) + endif () + endif() + if(QT_QT_LIBRARY MATCHES "qt-mt") + find_package(Threads) + set(QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) + endif() +endif() -IF(QT_MOC_EXECUTABLE) - EXECUTE_PROCESS(COMMAND ${QT_MOC_EXECUTABLE} "-v" +if(QT_MOC_EXECUTABLE) + execute_process(COMMAND ${QT_MOC_EXECUTABLE} "-v" OUTPUT_VARIABLE QTVERSION_MOC ERROR_QUIET) -ENDIF(QT_MOC_EXECUTABLE) -IF(QT_UIC_EXECUTABLE) - EXECUTE_PROCESS(COMMAND ${QT_UIC_EXECUTABLE} "-version" +endif() +if(QT_UIC_EXECUTABLE) + execute_process(COMMAND ${QT_UIC_EXECUTABLE} "-version" OUTPUT_VARIABLE QTVERSION_UIC ERROR_QUIET) -ENDIF(QT_UIC_EXECUTABLE) +endif() -SET(_QT_UIC_VERSION_3 FALSE) -IF("${QTVERSION_UIC}" MATCHES ".* 3..*") - SET(_QT_UIC_VERSION_3 TRUE) -ENDIF("${QTVERSION_UIC}" MATCHES ".* 3..*") +set(_QT_UIC_VERSION_3 FALSE) +if("${QTVERSION_UIC}" MATCHES ".* 3..*") + set(_QT_UIC_VERSION_3 TRUE) +endif() -SET(_QT_MOC_VERSION_3 FALSE) -IF("${QTVERSION_MOC}" MATCHES ".* 3..*") - SET(_QT_MOC_VERSION_3 TRUE) -ENDIF("${QTVERSION_MOC}" MATCHES ".* 3..*") +set(_QT_MOC_VERSION_3 FALSE) +if("${QTVERSION_MOC}" MATCHES ".* 3..*") + set(_QT_MOC_VERSION_3 TRUE) +endif() -SET(QT_WRAP_CPP FALSE) -IF (QT_MOC_EXECUTABLE AND _QT_MOC_VERSION_3) - SET ( QT_WRAP_CPP TRUE) -ENDIF (QT_MOC_EXECUTABLE AND _QT_MOC_VERSION_3) +set(QT_WRAP_CPP FALSE) +if (QT_MOC_EXECUTABLE AND _QT_MOC_VERSION_3) + set ( QT_WRAP_CPP TRUE) +endif () -SET(QT_WRAP_UI FALSE) -IF (QT_UIC_EXECUTABLE AND _QT_UIC_VERSION_3) - SET ( QT_WRAP_UI TRUE) -ENDIF (QT_UIC_EXECUTABLE AND _QT_UIC_VERSION_3) +set(QT_WRAP_UI FALSE) +if (QT_UIC_EXECUTABLE AND _QT_UIC_VERSION_3) + set ( QT_WRAP_UI TRUE) +endif () -MARK_AS_ADVANCED( +mark_as_advanced( QT_INCLUDE_DIR QT_QT_LIBRARY QT_QTMAIN_LIBRARY diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 2f1708d70..1dd2782ed 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -1,9 +1,9 @@ -# - Find QT 4 +# - Find Qt 4 # This module can be used to find Qt4. # The most important issue is that the Qt4 qmake is available via the system path. # This qmake is then used to detect basically everything else. -# This module defines a number of key variables and macros. -# The variable QT_USE_FILE is set which is the path to a CMake file that can be included +# This module defines a number of key variables and macros. +# The variable QT_USE_FILE is set which is the path to a CMake file that can be included # to compile Qt 4 applications and libraries. It sets up the compilation # environment for include directories, preprocessor defines and populates a # QT_LIBRARIES variable. @@ -15,10 +15,10 @@ # target_link_libraries(myexe ${QT_LIBRARIES}) # # The minimum required version can be specified using the standard find_package()-syntax -# (see example above). +# (see example above). # For compatibility with older versions of FindQt4.cmake it is also possible to -# set the variable QT_MIN_VERSION to the minimum required version of Qt4 before the -# find_package(Qt4) command. +# set the variable QT_MIN_VERSION to the minimum required version of Qt4 before the +# find_package(Qt4) command. # If both are used, the version used in the find_package() command overrides the # one from QT_MIN_VERSION. # @@ -53,26 +53,36 @@ # QT_USE_QTSCRIPTTOOLS # QT_USE_QTDECLARATIVE # -# QT_USE_IMPORTED_TARGETS +# QT_USE_IMPORTED_TARGETS # If this variable is set to TRUE, FindQt4.cmake will create imported -# library targets for the various Qt libraries and set the +# library targets for the various Qt libraries and set the # library variables like QT_QTCORE_LIBRARY to point at these imported -# targets instead of the library file on disk. This provides much better -# handling of the release and debug versions of the Qt libraries and is +# targets instead of the library file on disk. This provides much better +# handling of the release and debug versions of the Qt libraries and is # also always backwards compatible, except for the case that dependencies -# of libraries are exported, these will then also list the names of the +# of libraries are exported, these will then also list the names of the # imported targets as dependency and not the file location on disk. This # is much more flexible, but requires that FindQt4.cmake is executed before # such an exported dependency file is processed. # +# Note that if using IMPORTED targets, the qtmain.lib static library is +# automatically linked on Windows. To disable that globally, set the +# QT4_NO_LINK_QTMAIN variable before finding Qt4. To disable that for a +# particular executable, set the QT4_NO_LINK_QTMAIN target property to +# True on the executable. +# +# QT_INCLUDE_DIRS_NO_SYSTEM +# If this variable is set to TRUE, the Qt include directories +# in the QT_USE_FILE will NOT have the SYSTEM keyword set. +# # There are also some files that need processing by some Qt tools such as moc # and uic. Listed below are macros that may be used to process those files. -# +# # macro QT4_WRAP_CPP(outfiles inputfile ... OPTIONS ...) # create moc code from a list of files containing Qt class with -# the Q_OBJECT declaration. Per-direcotry preprocessor definitions +# the Q_OBJECT declaration. Per-directory preprocessor definitions # are also added. Options may be given to moc, such as those found -# when executing "moc -help". +# when executing "moc -help". # # macro QT4_WRAP_UI(outfiles inputfile ... OPTIONS ...) # create code from a list of Qt designer ui files. @@ -92,13 +102,13 @@ # macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... ) # This macro is still experimental. # It can be used to have moc automatically handled. -# So if you have the files foo.h and foo.cpp, and in foo.h a +# So if you have the files foo.h and foo.cpp, and in foo.h a # a class uses the Q_OBJECT macro, moc has to run on it. If you don't # want to use QT4_WRAP_CPP() (which is reliable and mature), you can insert # #include "foo.moc" # in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will the # scan all listed files at cmake-time for such included moc files and if it finds -# them cause a rule to be generated to run moc at build time on the +# them cause a rule to be generated to run moc at build time on the # accompanying header file foo.h. # If a source file has the SKIP_AUTOMOC property set it will be ignored by this macro. # @@ -106,7 +116,7 @@ # # macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename) # Create a the interface header and implementation files with the -# given basename from the given interface xml file and add it to +# given basename from the given interface xml file and add it to # the list of sources. # # You can pass additional parameters to the qdbusxml2cpp call by setting @@ -136,19 +146,19 @@ # # macro QT4_GENERATE_DBUS_INTERFACE( header [interfacename] OPTIONS ...) # generate the xml interface file from the given header. -# If the optional argument interfacename is omitted, the name of the +# If the optional argument interfacename is omitted, the name of the # interface file is constructed from the basename of the header with # the suffix .xml appended. # Options may be given to qdbuscpp2xml, such as those found when executing "qdbuscpp2xml --help" # -# macro QT4_CREATE_TRANSLATION( qm_files directories ... sources ... +# macro QT4_CREATE_TRANSLATION( qm_files directories ... sources ... # ts_files ... OPTIONS ...) # out: qm_files # in: directories sources ts_files # options: flags to pass to lupdate, such as -extensions to specify # extensions for a directory scan. # generates commands to create .ts (vie lupdate) and .qm -# (via lrelease) - files from directories and/or sources. The ts files are +# (via lrelease) - files from directories and/or sources. The ts files are # created and/or updated in the source tree (unless given with full paths). # The qm files are generated in the build tree. # Updating the translations can be done by adding the qm_files @@ -163,6 +173,17 @@ # filenames can be found in qm_files. The ts_files # must exists and are not updated in any way. # +# function QT4_USE_MODULES( target [link_type] modules...) +# Make use the from Qt. Using a Qt module means +# to link to the library, add the relevant include directories for the module, +# and add the relevant compiler defines for using the module. +# Modules are roughly equivalent to components of Qt4, so usage would be +# something like: +# qt4_use_modules(myexe Core Gui Declarative) +# to use QtCore, QtGui and QtDeclarative. The optional argument can +# be specified as either LINK_PUBLIC or LINK_PRIVATE to specify the same argument +# to the target_link_libraries call. +# # # Below is a detailed list of variables that FindQt4.cmake sets. # QT_FOUND If false, don't try to use Qt. @@ -211,41 +232,41 @@ # The QT_USE_FILE will also define QT_DEBUG and QT_NO_DEBUG # to fit your current build type. Those are not contained # in QT_DEFINITIONS. -# -# QT_INCLUDES List of paths to all include directories of +# +# QT_INCLUDES List of paths to all include directories of # Qt4 QT_INCLUDE_DIR and QT_QTCORE_INCLUDE_DIR are # always in this variable even if NOTFOUND, # all other INCLUDE_DIRS are # only added if they are found. # You do not need to use this if you include QT_USE_FILE. -# +# # # Include directories for the Qt modules are listed here. # You do not need to use these variables if you include QT_USE_FILE. # # QT_INCLUDE_DIR Path to "include" of Qt4 -# QT_QT3SUPPORT_INCLUDE_DIR Path to "include/Qt3Support" -# QT_QTASSISTANT_INCLUDE_DIR Path to "include/QtAssistant" +# QT_QT3SUPPORT_INCLUDE_DIR Path to "include/Qt3Support" +# QT_QTASSISTANT_INCLUDE_DIR Path to "include/QtAssistant" # QT_QTASSISTANTCLIENT_INCLUDE_DIR Path to "include/QtAssistant" # QT_QAXCONTAINER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only) # QT_QAXSERVER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only) -# QT_QTCORE_INCLUDE_DIR Path to "include/QtCore" +# QT_QTCORE_INCLUDE_DIR Path to "include/QtCore" # QT_QTDBUS_INCLUDE_DIR Path to "include/QtDBus" -# QT_QTDESIGNER_INCLUDE_DIR Path to "include/QtDesigner" +# QT_QTDESIGNER_INCLUDE_DIR Path to "include/QtDesigner" # QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR Path to "include/QtDesigner" -# QT_QTGUI_INCLUDE_DIR Path to "include/QtGui" +# QT_QTGUI_INCLUDE_DIR Path to "include/QtGui" # QT_QTHELP_INCLUDE_DIR Path to "include/QtHelp" -# QT_QTMOTIF_INCLUDE_DIR Path to "include/QtMotif" -# QT_QTMULTIMEDIA_INCLUDE_DIR Path to "include/QtMultimedia" -# QT_QTNETWORK_INCLUDE_DIR Path to "include/QtNetwork" -# QT_QTNSPLUGIN_INCLUDE_DIR Path to "include/QtNsPlugin" -# QT_QTOPENGL_INCLUDE_DIR Path to "include/QtOpenGL" +# QT_QTMOTIF_INCLUDE_DIR Path to "include/QtMotif" +# QT_QTMULTIMEDIA_INCLUDE_DIR Path to "include/QtMultimedia" +# QT_QTNETWORK_INCLUDE_DIR Path to "include/QtNetwork" +# QT_QTNSPLUGIN_INCLUDE_DIR Path to "include/QtNsPlugin" +# QT_QTOPENGL_INCLUDE_DIR Path to "include/QtOpenGL" # QT_QTSCRIPT_INCLUDE_DIR Path to "include/QtScript" -# QT_QTSQL_INCLUDE_DIR Path to "include/QtSql" +# QT_QTSQL_INCLUDE_DIR Path to "include/QtSql" # QT_QTSVG_INCLUDE_DIR Path to "include/QtSvg" # QT_QTTEST_INCLUDE_DIR Path to "include/QtTest" # QT_QTWEBKIT_INCLUDE_DIR Path to "include/QtWebKit" -# QT_QTXML_INCLUDE_DIR Path to "include/QtXml" +# QT_QTXML_INCLUDE_DIR Path to "include/QtXml" # QT_QTXMLPATTERNS_INCLUDE_DIR Path to "include/QtXmlPatterns" # QT_PHONON_INCLUDE_DIR Path to "include/phonon" # QT_QTSCRIPTTOOLS_INCLUDE_DIR Path to "include/QtScriptTools" @@ -292,7 +313,7 @@ # QT_QTMAIN_LIBRARY The qtmain library for Windows # QT_PHONON_LIBRARY The phonon library # QT_QTSCRIPTTOOLS_LIBRARY The QtScriptTools library -# +# # The QtDeclarative library: QT_QTDECLARATIVE_LIBRARY # # also defined, but NOT for general use are @@ -307,17 +328,17 @@ # QT_QCOLLECTIONGENERATOR_EXECUTABLE Where to find the qcollectiongenerator tool. # QT_DESIGNER_EXECUTABLE Where to find the Qt designer tool. # QT_LINGUIST_EXECUTABLE Where to find the Qt linguist tool. -# # -# These are around for backwards compatibility +# +# These are around for backwards compatibility # they will be set # QT_WRAP_CPP Set true if QT_MOC_EXECUTABLE is found # QT_WRAP_UI Set true if QT_UIC_EXECUTABLE is found -# +# # These variables do _NOT_ have any effect anymore (compared to FindQt.cmake) # QT_MT_REQUIRED Qt4 is now always multithreaded -# -# These variables are set to "" Because Qt structure changed +# +# These variables are set to "" Because Qt structure changed # (They make no sense in Qt4) # QT_QT_LIBRARY Qt-Library is now split @@ -334,385 +355,416 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -# Use FIND_PACKAGE( Qt4 COMPONENTS ... ) to enable modules -IF( Qt4_FIND_COMPONENTS ) - FOREACH( component ${Qt4_FIND_COMPONENTS} ) - STRING( TOUPPER ${component} _COMPONENT ) - SET( QT_USE_${_COMPONENT} 1 ) - ENDFOREACH( component ) - +# Use find_package( Qt4 COMPONENTS ... ) to enable modules +if( Qt4_FIND_COMPONENTS ) + foreach( component ${Qt4_FIND_COMPONENTS} ) + string( TOUPPER ${component} _COMPONENT ) + set( QT_USE_${_COMPONENT} 1 ) + endforeach() + # To make sure we don't use QtCore or QtGui when not in COMPONENTS - IF(NOT QT_USE_QTCORE) - SET( QT_DONT_USE_QTCORE 1 ) - ENDIF(NOT QT_USE_QTCORE) - - IF(NOT QT_USE_QTGUI) - SET( QT_DONT_USE_QTGUI 1 ) - ENDIF(NOT QT_USE_QTGUI) + if(NOT QT_USE_QTCORE) + set( QT_DONT_USE_QTCORE 1 ) + endif() -ENDIF( Qt4_FIND_COMPONENTS ) + if(NOT QT_USE_QTGUI) + set( QT_DONT_USE_QTGUI 1 ) + endif() + +endif() # If Qt3 has already been found, fail. -IF(QT_QT_LIBRARY) - IF(Qt4_FIND_REQUIRED) - MESSAGE( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned.") - ELSE(Qt4_FIND_REQUIRED) - IF(NOT Qt4_FIND_QUIETLY) - MESSAGE( STATUS "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned.") - ENDIF(NOT Qt4_FIND_QUIETLY) - RETURN() - ENDIF(Qt4_FIND_REQUIRED) -ENDIF(QT_QT_LIBRARY) +if(QT_QT_LIBRARY) + if(Qt4_FIND_REQUIRED) + message( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned.") + else() + if(NOT Qt4_FIND_QUIETLY) + message( STATUS "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned.") + endif() + return() + endif() +endif() -INCLUDE(CheckCXXSymbolExists) -INCLUDE(MacroAddFileDependencies) -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSymbolExists.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/MacroAddFileDependencies.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake) +set(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake) -SET( QT_DEFINITIONS "") +set( QT_DEFINITIONS "") # convenience macro for dealing with debug/release library names -MACRO (_QT4_ADJUST_LIB_VARS _camelCaseBasename) +macro (_QT4_ADJUST_LIB_VARS _camelCaseBasename) - STRING(TOUPPER "${_camelCaseBasename}" basename) + string(TOUPPER "${_camelCaseBasename}" basename) # The name of the imported targets, i.e. the prefix "Qt4::" must not change, # since it is stored in EXPORT-files as name of a required library. If the name would change # here, this would lead to the imported Qt4-library targets not being resolved by cmake anymore. - IF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG) + if (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG) - IF(NOT TARGET Qt4::${_camelCaseBasename}) - ADD_LIBRARY(Qt4::${_camelCaseBasename} UNKNOWN IMPORTED ) + if(NOT TARGET Qt4::${_camelCaseBasename}) + add_library(Qt4::${_camelCaseBasename} UNKNOWN IMPORTED ) - IF (QT_${basename}_LIBRARY_RELEASE) - SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + if (QT_${basename}_LIBRARY_RELEASE) + set_property(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) if(QT_USE_FRAMEWORKS) - SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}/${_camelCaseBasename}" ) + set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}/${_camelCaseBasename}" ) else() - SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" ) + set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" ) endif() - ENDIF (QT_${basename}_LIBRARY_RELEASE) + endif () - IF (QT_${basename}_LIBRARY_DEBUG) - SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + if (QT_${basename}_LIBRARY_DEBUG) + set_property(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) if(QT_USE_FRAMEWORKS) - SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}/${_camelCaseBasename}" ) + set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}/${_camelCaseBasename}" ) else() - SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" ) + set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" ) endif() - ENDIF (QT_${basename}_LIBRARY_DEBUG) - ENDIF(NOT TARGET Qt4::${_camelCaseBasename}) + endif () + set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY + INTERFACE_INCLUDE_DIRECTORIES + "${QT_${basename}_INCLUDE_DIR}" + ) + string(REGEX REPLACE "^QT" "" _stemname ${basename}) + set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY + INTERFACE_COMPILE_DEFINITIONS + "QT_${_stemname}_LIB" + ) + endif() # If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these # imported targets. This works better in general, and is also in almost all cases fully # backward compatible. The only issue is when a project A which had this enabled then exports its - # libraries via export or EXPORT_LIBRARY_DEPENDENCIES(). In this case the libraries from project + # libraries via export or export_library_dependencies(). In this case the libraries from project # A will depend on the imported Qt targets, and the names of these imported targets will be stored # in the dependency files on disk. This means when a project B then uses project A, these imported # targets must be created again, otherwise e.g. "Qt4__QtCore" will be interpreted as name of a # library file on disk, and not as a target, and linking will fail: - IF(QT_USE_IMPORTED_TARGETS) - SET(QT_${basename}_LIBRARY Qt4::${_camelCaseBasename} ) - SET(QT_${basename}_LIBRARIES Qt4::${_camelCaseBasename} ) - ELSE(QT_USE_IMPORTED_TARGETS) + if(QT_USE_IMPORTED_TARGETS) + set(QT_${basename}_LIBRARY Qt4::${_camelCaseBasename} ) + set(QT_${basename}_LIBRARIES Qt4::${_camelCaseBasename} ) + else() # if the release- as well as the debug-version of the library have been found: - IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) + if (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) # if the generator supports configuration types then set # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) - ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + set(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) + else() # if there are no configuration types and CMAKE_BUILD_TYPE has no value # then just use the release libraries - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} ) - ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) - ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) + set(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} ) + endif() + set(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) + endif () # if only the release version was found, set the debug variable also to the release version - IF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) - SET(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE}) - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE}) - SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_RELEASE}) - ENDIF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) + if (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) + set(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE}) + set(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE}) + set(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_RELEASE}) + endif () # if only the debug version was found, set the release variable also to the debug version - IF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) - SET(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG}) - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG}) - SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_DEBUG}) - ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) + if (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) + set(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG}) + set(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG}) + set(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_DEBUG}) + endif () # put the value in the cache: - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE) + set(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE) - ENDIF(QT_USE_IMPORTED_TARGETS) + endif() - SET(QT_${basename}_FOUND 1) + set(QT_${basename}_FOUND 1) - ELSE (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG) + else () - SET(QT_${basename}_LIBRARY "" CACHE STRING "The Qt ${basename} library" FORCE) + set(QT_${basename}_LIBRARY "" CACHE STRING "The Qt ${basename} library" FORCE) - ENDIF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG) + endif () - IF (QT_${basename}_INCLUDE_DIR) + if (QT_${basename}_INCLUDE_DIR) #add the include directory to QT_INCLUDES - SET(QT_INCLUDES "${QT_${basename}_INCLUDE_DIR}" ${QT_INCLUDES}) - ENDIF (QT_${basename}_INCLUDE_DIR) + set(QT_INCLUDES "${QT_${basename}_INCLUDE_DIR}" ${QT_INCLUDES}) + endif () # Make variables changeble to the advanced user - MARK_AS_ADVANCED(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR) -ENDMACRO (_QT4_ADJUST_LIB_VARS) + mark_as_advanced(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR) +endmacro () function(_QT4_QUERY_QMAKE VAR RESULT) execute_process(COMMAND "${QT_QMAKE_EXECUTABLE}" -query ${VAR} RESULT_VARIABLE return_code - OUTPUT_VARIABLE output ERROR_VARIABLE output + OUTPUT_VARIABLE output OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE) if(NOT return_code) file(TO_CMAKE_PATH "${output}" output) set(${RESULT} ${output} PARENT_SCOPE) - endif(NOT return_code) -endfunction(_QT4_QUERY_QMAKE) - - -SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE) - -GET_FILENAME_COMPONENT(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME) -# check for qmake -# Debian uses qmake-qt4 -# macports' Qt uses qmake-mac -FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 qmake-mac PATHS - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin" - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin" - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]/bin" - $ENV{QTDIR}/bin - DOC "The qmake executable for the Qt installation to use" -) - -# double check that it was a Qt4 qmake, if not, re-find with different names -IF (QT_QMAKE_EXECUTABLE) - - IF(QT_QMAKE_EXECUTABLE_LAST) - STRING(COMPARE NOTEQUAL "${QT_QMAKE_EXECUTABLE_LAST}" "${QT_QMAKE_EXECUTABLE}" QT_QMAKE_CHANGED) - ENDIF(QT_QMAKE_EXECUTABLE_LAST) - - SET(QT_QMAKE_EXECUTABLE_LAST "${QT_QMAKE_EXECUTABLE}" CACHE INTERNAL "" FORCE) - - _qt4_query_qmake(QT_VERSION QTVERSION) - - # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path - IF(NOT QTVERSION) - SET(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE) - FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 PATHS - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin" - "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin" - $ENV{QTDIR}/bin - DOC "The qmake executable for the Qt installation to use" - ) - IF(QT_QMAKE_EXECUTABLE) - _qt4_query_qmake(QT_VERSION QTVERSION) - ENDIF(QT_QMAKE_EXECUTABLE) - ENDIF(NOT QTVERSION) + endif() +endfunction() + +function(_QT4_GET_VERSION_COMPONENTS VERSION RESULT_MAJOR RESULT_MINOR RESULT_PATCH) + string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}") + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}") + + set(${RESULT_MAJOR} ${QT_VERSION_MAJOR} PARENT_SCOPE) + set(${RESULT_MINOR} ${QT_VERSION_MINOR} PARENT_SCOPE) + set(${RESULT_PATCH} ${QT_VERSION_PATCH} PARENT_SCOPE) +endfunction() + +function(_QT4_FIND_QMAKE QMAKE_NAMES QMAKE_RESULT VERSION_RESULT) + list(LENGTH QMAKE_NAMES QMAKE_NAMES_LEN) + if(${QMAKE_NAMES_LEN} EQUAL 0) + return() + endif() + list(GET QMAKE_NAMES 0 QMAKE_NAME) + + get_filename_component(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME) + + find_program(QT_QMAKE_EXECUTABLE NAMES ${QMAKE_NAME} + PATHS + ENV QTDIR + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]" + PATH_SUFFIXES bin + DOC "The qmake executable for the Qt installation to use" + ) + + set(major 0) + if (QT_QMAKE_EXECUTABLE) + _qt4_query_qmake(QT_VERSION QTVERSION) + _qt4_get_version_components("${QTVERSION}" major minor patch) + endif() + + if (NOT QT_QMAKE_EXECUTABLE OR NOT "${major}" EQUAL 4) + set(curr_qmake "${QT_QMAKE_EXECUTABLE}") + set(curr_qt_version "${QTVERSION}") + + set(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE) + list(REMOVE_AT QMAKE_NAMES 0) + _qt4_find_qmake("${QMAKE_NAMES}" QMAKE QTVERSION) + + _qt4_get_version_components("${QTVERSION}" major minor patch) + if (NOT ${major} EQUAL 4) + # Restore possibly found qmake and it's version; these are used later + # in error message if incorrect version is found + set(QT_QMAKE_EXECUTABLE "${curr_qmake}" CACHE FILEPATH "" FORCE) + set(QTVERSION "${curr_qt_version}") + endif() + + endif() -ENDIF (QT_QMAKE_EXECUTABLE) -IF (QT_QMAKE_EXECUTABLE AND QTVERSION) + set(${QMAKE_RESULT} "${QT_QMAKE_EXECUTABLE}" PARENT_SCOPE) + set(${VERSION_RESULT} "${QTVERSION}" PARENT_SCOPE) +endfunction() + + +set(QT4_INSTALLED_VERSION_TOO_OLD FALSE) + +set(_QT4_QMAKE_NAMES qmake qmake4 qmake-qt4 qmake-mac) +_qt4_find_qmake("${_QT4_QMAKE_NAMES}" QT_QMAKE_EXECUTABLE QTVERSION) + +if (QT_QMAKE_EXECUTABLE AND QTVERSION) + + _qt4_get_version_components("${QTVERSION}" QT_VERSION_MAJOR QT_VERSION_MINOR QT_VERSION_PATCH) # ask qmake for the mkspecs directory # we do this first because QT_LIBINFIX might be set - IF (NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED) + if (NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QMAKE_MKSPECS qt_mkspecs_dirs) # do not replace : on windows as it might be a drive letter # and windows should already use ; as a separator - IF(NOT WIN32) - STRING(REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}") - ENDIF(NOT WIN32) + if(NOT WIN32) + string(REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}") + endif() set(qt_cross_paths) foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/mkspecs") - endforeach(qt_cross_path) - SET(QT_MKSPECS_DIR NOTFOUND) - FIND_PATH(QT_MKSPECS_DIR NAMES qconfig.pri + endforeach() + set(QT_MKSPECS_DIR NOTFOUND) + find_path(QT_MKSPECS_DIR NAMES qconfig.pri HINTS ${qt_cross_paths} ${qt_mkspecs_dirs} DOC "The location of the Qt mkspecs containing qconfig.pri") - ENDIF() - - IF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri") - FILE(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents) - STRING(REGEX MATCH "QT_CONFIG[^\n]+" QT_QCONFIG "${_qconfig_FILE_contents}") - STRING(REGEX MATCH "CONFIG[^\n]+" QT_CONFIG "${_qconfig_FILE_contents}") - STRING(REGEX MATCH "EDITION[^\n]+" QT_EDITION "${_qconfig_FILE_contents}") - STRING(REGEX MATCH "QT_LIBINFIX[^\n]+" _qconfig_qt_libinfix "${_qconfig_FILE_contents}") - STRING(REGEX REPLACE "QT_LIBINFIX *= *([^\n]*)" "\\1" QT_LIBINFIX "${_qconfig_qt_libinfix}") - ENDIF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri") - IF("${QT_EDITION}" MATCHES "DesktopLight") - SET(QT_EDITION_DESKTOPLIGHT 1) - ENDIF("${QT_EDITION}" MATCHES "DesktopLight") + endif() + + if(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri") + file(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents) + string(REGEX MATCH "QT_CONFIG[^\n]+" QT_QCONFIG "${_qconfig_FILE_contents}") + string(REGEX MATCH "CONFIG[^\n]+" QT_CONFIG "${_qconfig_FILE_contents}") + string(REGEX MATCH "EDITION[^\n]+" QT_EDITION "${_qconfig_FILE_contents}") + string(REGEX MATCH "QT_LIBINFIX[^\n]+" _qconfig_qt_libinfix "${_qconfig_FILE_contents}") + string(REGEX REPLACE "QT_LIBINFIX *= *([^\n]*)" "\\1" QT_LIBINFIX "${_qconfig_qt_libinfix}") + endif() + if("${QT_EDITION}" MATCHES "DesktopLight") + set(QT_EDITION_DESKTOPLIGHT 1) + endif() # ask qmake for the library dir as a hint, then search for QtCore library and use that as a reference for finding the # others and for setting QT_LIBRARY_DIR - IF (NOT (QT_QTCORE_LIBRARY_RELEASE OR QT_QTCORE_LIBRARY_DEBUG) OR QT_QMAKE_CHANGED) + if (NOT (QT_QTCORE_LIBRARY_RELEASE OR QT_QTCORE_LIBRARY_DEBUG) OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_LIBS QT_LIBRARY_DIR_TMP) - SET(QT_QTCORE_LIBRARY_RELEASE NOTFOUND) - SET(QT_QTCORE_LIBRARY_DEBUG NOTFOUND) - FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE + set(QT_QTCORE_LIBRARY_RELEASE NOTFOUND) + set(QT_QTCORE_LIBRARY_DEBUG NOTFOUND) + find_library(QT_QTCORE_LIBRARY_RELEASE NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4 HINTS ${QT_LIBRARY_DIR_TMP} NO_DEFAULT_PATH ) - FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG + find_library(QT_QTCORE_LIBRARY_DEBUG NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d QtCore${QT_LIBINFIX}d4 HINTS ${QT_LIBRARY_DIR_TMP} NO_DEFAULT_PATH ) - IF(NOT QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCORE_LIBRARY_DEBUG) - FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE + if(NOT QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCORE_LIBRARY_DEBUG) + find_library(QT_QTCORE_LIBRARY_RELEASE NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4 HINTS ${QT_LIBRARY_DIR_TMP} ) - FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG + find_library(QT_QTCORE_LIBRARY_DEBUG NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d QtCore${QT_LIBINFIX}d4 HINTS ${QT_LIBRARY_DIR_TMP} ) - ENDIF(NOT QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCORE_LIBRARY_DEBUG) + endif() # try dropping a hint if trying to use Visual Studio with Qt built by mingw - IF(NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC) - IF(EXISTS ${QT_LIBRARY_DIR_TMP}/libqtmain.a) - MESSAGE( FATAL_ERROR "It appears you're trying to use Visual Studio with Qt built by mingw. Those compilers do not produce code compatible with each other.") - ENDIF(EXISTS ${QT_LIBRARY_DIR_TMP}/libqtmain.a) - ENDIF(NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC) + if(NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC) + if(EXISTS ${QT_LIBRARY_DIR_TMP}/libqtmain.a) + message( FATAL_ERROR "It appears you're trying to use Visual Studio with Qt built by mingw. Those compilers do not produce code compatible with each other.") + endif() + endif() - ENDIF () + endif () # set QT_LIBRARY_DIR based on location of QtCore found. - IF(QT_QTCORE_LIBRARY_RELEASE) - GET_FILENAME_COMPONENT(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_RELEASE}" PATH) - SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE) - SET(QT_QTCORE_FOUND 1) - ELSEIF(QT_QTCORE_LIBRARY_DEBUG) - GET_FILENAME_COMPONENT(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_DEBUG}" PATH) - SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE) - SET(QT_QTCORE_FOUND 1) - ELSE() - MESSAGE(WARNING "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as \"${QT_LIBRARY_DIR_TMP}\" " + if(QT_QTCORE_LIBRARY_RELEASE) + get_filename_component(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_RELEASE}" PATH) + set(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE) + set(QT_QTCORE_FOUND 1) + elseif(QT_QTCORE_LIBRARY_DEBUG) + get_filename_component(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_DEBUG}" PATH) + set(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE) + set(QT_QTCORE_FOUND 1) + else() + message(WARNING "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as \"${QT_LIBRARY_DIR_TMP}\" " "but QtCore could not be found there. " "Qt is NOT installed correctly for the target build environment.") - IF(Qt4_FIND_REQUIRED) - MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.") - ENDIF(Qt4_FIND_REQUIRED) - ENDIF() + if(Qt4_FIND_REQUIRED) + message( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.") + endif() + endif() # ask qmake for the binary dir - IF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) + if (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_BINS qt_bins) - SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE) - ENDIF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) - - IF (APPLE) - SET(CMAKE_FIND_FRAMEWORK_OLD ${CMAKE_FIND_FRAMEWORK}) - IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) - SET(QT_USE_FRAMEWORKS ON CACHE INTERNAL "" FORCE) - SET(CMAKE_FIND_FRAMEWORK FIRST) - ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) - SET(QT_USE_FRAMEWORKS OFF CACHE INTERNAL "" FORCE) - SET(CMAKE_FIND_FRAMEWORK LAST) - ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) - ENDIF (APPLE) + set(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE) + endif () + + if (APPLE) + set(CMAKE_FIND_FRAMEWORK_OLD ${CMAKE_FIND_FRAMEWORK}) + if (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) + set(QT_USE_FRAMEWORKS ON CACHE INTERNAL "" FORCE) + set(CMAKE_FIND_FRAMEWORK FIRST) + else () + set(QT_USE_FRAMEWORKS OFF CACHE INTERNAL "" FORCE) + set(CMAKE_FIND_FRAMEWORK LAST) + endif () + endif () # ask qmake for the include dir - IF (QT_LIBRARY_DIR AND (NOT QT_QTCORE_INCLUDE_DIR OR NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED)) + if (QT_LIBRARY_DIR AND (NOT QT_QTCORE_INCLUDE_DIR OR NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED)) _qt4_query_qmake(QT_INSTALL_HEADERS qt_headers) - SET(QT_QTCORE_INCLUDE_DIR NOTFOUND) - FIND_PATH(QT_QTCORE_INCLUDE_DIR QtCore + set(QT_QTCORE_INCLUDE_DIR NOTFOUND) + find_path(QT_QTCORE_INCLUDE_DIR QtCore HINTS ${qt_headers} ${QT_LIBRARY_DIR} PATH_SUFFIXES QtCore qt4/QtCore ) # Set QT_HEADERS_DIR based on finding QtCore header - IF(QT_QTCORE_INCLUDE_DIR) - IF(QT_USE_FRAMEWORKS) - SET(QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE) - ELSE(QT_USE_FRAMEWORKS) - GET_FILENAME_COMPONENT(qt_headers "${QT_QTCORE_INCLUDE_DIR}/../" ABSOLUTE) - SET(QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE) - ENDIF(QT_USE_FRAMEWORKS) - ELSEIF() - MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_HEADERS as ${qt_headers}") - MESSAGE("Warning: But QtCore couldn't be found. Qt must NOT be installed correctly.") - ENDIF() - ENDIF() - - IF(APPLE) - SET(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_OLD}) - ENDIF(APPLE) + if(QT_QTCORE_INCLUDE_DIR) + if(QT_USE_FRAMEWORKS) + set(QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE) + else() + get_filename_component(qt_headers "${QT_QTCORE_INCLUDE_DIR}/../" ABSOLUTE) + set(QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE) + endif() + elseif() + message("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_HEADERS as ${qt_headers}") + message("Warning: But QtCore couldn't be found. Qt must NOT be installed correctly.") + endif() + endif() + + if(APPLE) + set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_OLD}) + endif() # Set QT_INCLUDE_DIR based on QT_HEADERS_DIR - IF(QT_HEADERS_DIR) - IF(QT_USE_FRAMEWORKS) + if(QT_HEADERS_DIR) + if(QT_USE_FRAMEWORKS) # Qt/Mac frameworks has two include dirs. # One is the framework include for which CMake will add a -F flag # and the other is an include dir for non-framework Qt modules - SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR} ${QT_QTCORE_LIBRARY_RELEASE} ) - ELSE(QT_USE_FRAMEWORKS) - SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR}) - ENDIF(QT_USE_FRAMEWORKS) - ENDIF(QT_HEADERS_DIR) + set(QT_INCLUDE_DIR ${QT_HEADERS_DIR} ${QT_QTCORE_LIBRARY_RELEASE} ) + else() + set(QT_INCLUDE_DIR ${QT_HEADERS_DIR}) + endif() + endif() # Set QT_INCLUDES - SET( QT_INCLUDES ${QT_MKSPECS_DIR}/default ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}) + set( QT_INCLUDES ${QT_MKSPECS_DIR}/default ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}) # ask qmake for the documentation directory - IF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED) + if (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_DOCS qt_doc_dir) - SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs" FORCE) - ENDIF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED) + set(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs" FORCE) + endif () # ask qmake for the plugins directory - IF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED) + if (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_PLUGINS qt_plugins_dir) - SET(QT_PLUGINS_DIR NOTFOUND) + set(QT_PLUGINS_DIR NOTFOUND) foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/plugins") - endforeach(qt_cross_path) - FIND_PATH(QT_PLUGINS_DIR NAMES accessible imageformats sqldrivers codecs designer + endforeach() + find_path(QT_PLUGINS_DIR NAMES accessible imageformats sqldrivers codecs designer HINTS ${qt_cross_paths} ${qt_plugins_dir} DOC "The location of the Qt plugins") - ENDIF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED) + endif () # ask qmake for the translations directory - IF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED) + if (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_TRANSLATIONS qt_translations_dir) - SET(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The location of the Qt translations" FORCE) - ENDIF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED) + set(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The location of the Qt translations" FORCE) + endif () # ask qmake for the imports directory - IF (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED) + if (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_IMPORTS qt_imports_dir) if(qt_imports_dir) - SET(QT_IMPORTS_DIR NOTFOUND) + set(QT_IMPORTS_DIR NOTFOUND) foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/imports") - endforeach(qt_cross_path) - FIND_PATH(QT_IMPORTS_DIR NAMES Qt + endforeach() + find_path(QT_IMPORTS_DIR NAMES Qt HINTS ${qt_cross_paths} ${qt_imports_dir} DOC "The location of the Qt imports" NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) mark_as_advanced(QT_IMPORTS_DIR) - endif(qt_imports_dir) - ENDIF (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED) + endif() + endif () # Make variables changeble to the advanced user - MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_DOC_DIR QT_MKSPECS_DIR + mark_as_advanced( QT_LIBRARY_DIR QT_DOC_DIR QT_MKSPECS_DIR QT_PLUGINS_DIR QT_TRANSLATIONS_DIR) @@ -724,32 +776,32 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) # ############################################# # Save required variable - SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) - SET(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) + set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES - SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}") # Check for Window system symbols (note: only one should end up being set) CHECK_CXX_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11) CHECK_CXX_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN) CHECK_CXX_SYMBOL_EXISTS(Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS) CHECK_CXX_SYMBOL_EXISTS(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC) - IF(Q_WS_MAC) - IF(QT_QMAKE_CHANGED) - UNSET(QT_MAC_USE_COCOA CACHE) - ENDIF(QT_QMAKE_CHANGED) + if(Q_WS_MAC) + if(QT_QMAKE_CHANGED) + unset(QT_MAC_USE_COCOA CACHE) + endif() CHECK_CXX_SYMBOL_EXISTS(QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA) - ENDIF(Q_WS_MAC) + endif() - IF (QT_QTCOPY_REQUIRED) + if (QT_QTCOPY_REQUIRED) CHECK_CXX_SYMBOL_EXISTS(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY) - IF (NOT QT_IS_QTCOPY) - MESSAGE(FATAL_ERROR "qt-copy is required, but hasn't been found") - ENDIF (NOT QT_IS_QTCOPY) - ENDIF (QT_QTCOPY_REQUIRED) + if (NOT QT_IS_QTCOPY) + message(FATAL_ERROR "qt-copy is required, but hasn't been found") + endif () + endif () # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables - SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) - SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) # ############################################# @@ -761,48 +813,48 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) # ######################################## - SET(QT_MODULES QtGui Qt3Support QtSvg QtScript QtTest QtUiTools + set(QT_MODULES QtGui Qt3Support QtSvg QtScript QtTest QtUiTools QtHelp QtWebKit QtXmlPatterns phonon QtNetwork QtMultimedia QtNsPlugin QtOpenGL QtSql QtXml QtDesigner QtDBus QtScriptTools QtDeclarative) - - IF(Q_WS_X11) - SET(QT_MODULES ${QT_MODULES} QtMotif) - ENDIF(Q_WS_X11) - - IF(QT_QMAKE_CHANGED) - FOREACH(QT_MODULE ${QT_MODULES}) - STRING(TOUPPER ${QT_MODULE} _upper_qt_module) - SET(QT_${_upper_qt_module}_INCLUDE_DIR NOTFOUND) - SET(QT_${_upper_qt_module}_LIBRARY_RELEASE NOTFOUND) - SET(QT_${_upper_qt_module}_LIBRARY_DEBUG NOTFOUND) - ENDFOREACH(QT_MODULE) - SET(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR NOTFOUND) - SET(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NOTFOUND) - SET(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NOTFOUND) - SET(QT_QTASSISTANTCLIENT_INCLUDE_DIR NOTFOUND) - SET(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NOTFOUND) - SET(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NOTFOUND) - SET(QT_QTASSISTANT_INCLUDE_DIR NOTFOUND) - SET(QT_QTASSISTANT_LIBRARY_RELEASE NOTFOUND) - SET(QT_QTASSISTANT_LIBRARY_DEBUG NOTFOUND) - SET(QT_QTCLUCENE_LIBRARY_RELEASE NOTFOUND) - SET(QT_QTCLUCENE_LIBRARY_DEBUG NOTFOUND) - SET(QT_QAXCONTAINER_INCLUDE_DIR NOTFOUND) - SET(QT_QAXCONTAINER_LIBRARY_RELEASE NOTFOUND) - SET(QT_QAXCONTAINER_LIBRARY_DEBUG NOTFOUND) - SET(QT_QAXSERVER_INCLUDE_DIR NOTFOUND) - SET(QT_QAXSERVER_LIBRARY_RELEASE NOTFOUND) - SET(QT_QAXSERVER_LIBRARY_DEBUG NOTFOUND) - IF(Q_WS_WIN) - SET(QT_QTMAIN_LIBRARY_DEBUG NOTFOUND) - SET(QT_QTMAIN_LIBRARY_RELEASE NOTFOUND) - ENDIF(Q_WS_WIN) - ENDIF(QT_QMAKE_CHANGED) - - FOREACH(QT_MODULE ${QT_MODULES}) - STRING(TOUPPER ${QT_MODULE} _upper_qt_module) - FIND_PATH(QT_${_upper_qt_module}_INCLUDE_DIR ${QT_MODULE} + + if(Q_WS_X11) + set(QT_MODULES ${QT_MODULES} QtMotif) + endif() + + if(QT_QMAKE_CHANGED) + foreach(QT_MODULE ${QT_MODULES}) + string(TOUPPER ${QT_MODULE} _upper_qt_module) + set(QT_${_upper_qt_module}_INCLUDE_DIR NOTFOUND) + set(QT_${_upper_qt_module}_LIBRARY_RELEASE NOTFOUND) + set(QT_${_upper_qt_module}_LIBRARY_DEBUG NOTFOUND) + endforeach() + set(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR NOTFOUND) + set(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NOTFOUND) + set(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NOTFOUND) + set(QT_QTASSISTANTCLIENT_INCLUDE_DIR NOTFOUND) + set(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NOTFOUND) + set(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NOTFOUND) + set(QT_QTASSISTANT_INCLUDE_DIR NOTFOUND) + set(QT_QTASSISTANT_LIBRARY_RELEASE NOTFOUND) + set(QT_QTASSISTANT_LIBRARY_DEBUG NOTFOUND) + set(QT_QTCLUCENE_LIBRARY_RELEASE NOTFOUND) + set(QT_QTCLUCENE_LIBRARY_DEBUG NOTFOUND) + set(QT_QAXCONTAINER_INCLUDE_DIR NOTFOUND) + set(QT_QAXCONTAINER_LIBRARY_RELEASE NOTFOUND) + set(QT_QAXCONTAINER_LIBRARY_DEBUG NOTFOUND) + set(QT_QAXSERVER_INCLUDE_DIR NOTFOUND) + set(QT_QAXSERVER_LIBRARY_RELEASE NOTFOUND) + set(QT_QAXSERVER_LIBRARY_DEBUG NOTFOUND) + if(Q_WS_WIN) + set(QT_QTMAIN_LIBRARY_DEBUG NOTFOUND) + set(QT_QTMAIN_LIBRARY_RELEASE NOTFOUND) + endif() + endif() + + foreach(QT_MODULE ${QT_MODULES}) + string(TOUPPER ${QT_MODULE} _upper_qt_module) + find_path(QT_${_upper_qt_module}_INCLUDE_DIR ${QT_MODULE} PATHS ${QT_HEADERS_DIR}/${QT_MODULE} ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers @@ -810,47 +862,47 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) ) # phonon doesn't seem consistent, let's try phonondefs.h for some # installations - IF(${QT_MODULE} STREQUAL "phonon") - FIND_PATH(QT_${_upper_qt_module}_INCLUDE_DIR phonondefs.h + if(${QT_MODULE} STREQUAL "phonon") + find_path(QT_${_upper_qt_module}_INCLUDE_DIR phonondefs.h PATHS ${QT_HEADERS_DIR}/${QT_MODULE} ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - ENDIF(${QT_MODULE} STREQUAL "phonon") - ENDFOREACH(QT_MODULE) + endif() + endforeach() - IF(Q_WS_WIN) - SET(QT_MODULES ${QT_MODULES} QAxContainer QAxServer) + if(Q_WS_WIN) + set(QT_MODULES ${QT_MODULES} QAxContainer QAxServer) # Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR - FIND_PATH(QT_QAXCONTAINER_INCLUDE_DIR ActiveQt + find_path(QT_QAXCONTAINER_INCLUDE_DIR ActiveQt PATHS ${QT_HEADERS_DIR}/ActiveQt NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - FIND_PATH(QT_QAXSERVER_INCLUDE_DIR ActiveQt + find_path(QT_QAXSERVER_INCLUDE_DIR ActiveQt PATHS ${QT_HEADERS_DIR}/ActiveQt NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - ENDIF(Q_WS_WIN) + endif() # Set QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR - FIND_PATH(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR QDesignerComponents + find_path(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR QDesignerComponents PATHS ${QT_HEADERS_DIR}/QtDesigner ${QT_LIBRARY_DIR}/QtDesigner.framework/Headers NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - + # Set QT_QTASSISTANT_INCLUDE_DIR - FIND_PATH(QT_QTASSISTANT_INCLUDE_DIR QtAssistant + find_path(QT_QTASSISTANT_INCLUDE_DIR QtAssistant PATHS ${QT_HEADERS_DIR}/QtAssistant ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - + # Set QT_QTASSISTANTCLIENT_INCLUDE_DIR - FIND_PATH(QT_QTASSISTANTCLIENT_INCLUDE_DIR QAssistantClient + find_path(QT_QTASSISTANTCLIENT_INCLUDE_DIR QAssistantClient PATHS ${QT_HEADERS_DIR}/QtAssistant ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers @@ -864,48 +916,60 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) ######################################## # find the libraries - FOREACH(QT_MODULE ${QT_MODULES}) - STRING(TOUPPER ${QT_MODULE} _upper_qt_module) - FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_RELEASE + foreach(QT_MODULE ${QT_MODULES}) + string(TOUPPER ${QT_MODULE} _upper_qt_module) + find_library(QT_${_upper_qt_module}_LIBRARY_RELEASE NAMES ${QT_MODULE}${QT_LIBINFIX} ${QT_MODULE}${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_DEBUG + find_library(QT_${_upper_qt_module}_LIBRARY_DEBUG NAMES ${QT_MODULE}${QT_LIBINFIX}_debug ${QT_MODULE}${QT_LIBINFIX}d ${QT_MODULE}${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - ENDFOREACH(QT_MODULE) + if(QT_${_upper_qt_module}_LIBRARY_RELEASE MATCHES "/${QT_MODULE}\\.framework$") + if(NOT EXISTS "${QT_${_upper_qt_module}_LIBRARY_RELEASE}/${QT_MODULE}") + # Release framework library file does not exist... Force to NOTFOUND: + set(QT_${_upper_qt_module}_LIBRARY_RELEASE "QT_${_upper_qt_module}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library." FORCE) + endif() + endif() + if(QT_${_upper_qt_module}_LIBRARY_DEBUG MATCHES "/${QT_MODULE}\\.framework$") + if(NOT EXISTS "${QT_${_upper_qt_module}_LIBRARY_DEBUG}/${QT_MODULE}") + # Debug framework library file does not exist... Force to NOTFOUND: + set(QT_${_upper_qt_module}_LIBRARY_DEBUG "QT_${_upper_qt_module}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library." FORCE) + endif() + endif() + endforeach() # QtUiTools is sometimes not in the same directory as the other found libraries # e.g. on Mac, its never a framework like the others are - IF(QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE) - FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR}) - ENDIF(QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE) + if(QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE) + find_library(QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR}) + endif() # Set QT_QTDESIGNERCOMPONENTS_LIBRARY - FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents${QT_LIBINFIX} QtDesignerComponents${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NAMES QtDesignerComponents${QT_LIBINFIX}_debug QtDesignerComponents${QT_LIBINFIX}d QtDesignerComponents${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + find_library(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents${QT_LIBINFIX} QtDesignerComponents${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + find_library(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NAMES QtDesignerComponents${QT_LIBINFIX}_debug QtDesignerComponents${QT_LIBINFIX}d QtDesignerComponents${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) # Set QT_QTMAIN_LIBRARY - IF(Q_WS_WIN) - FIND_LIBRARY(QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - FIND_LIBRARY(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain${QT_LIBINFIX}d PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - ENDIF(Q_WS_WIN) - + if(Q_WS_WIN) + find_library(QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + find_library(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain${QT_LIBINFIX}d PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + endif() + # Set QT_QTASSISTANTCLIENT_LIBRARY - FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - + find_library(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + find_library(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + # Set QT_QTASSISTANT_LIBRARY - FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 QtAssistant${QT_LIBINFIX} QtAssistant${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 QtAssistant${QT_LIBINFIX}_debug QtAssistant${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + find_library(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 QtAssistant${QT_LIBINFIX} QtAssistant${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + find_library(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 QtAssistant${QT_LIBINFIX}_debug QtAssistant${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) # Set QT_QTHELP_LIBRARY - FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} QtCLucene${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_DEBUG NAMES QtCLucene${QT_LIBINFIX}_debug QtCLucene${QT_LIBINFIX}d QtCLucene${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - IF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE) - FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR}) - ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE) + find_library(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} QtCLucene${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + find_library(QT_QTCLUCENE_LIBRARY_DEBUG NAMES QtCLucene${QT_LIBINFIX}_debug QtCLucene${QT_LIBINFIX}d QtCLucene${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + if(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE) + find_library(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR}) + endif() ############################################ @@ -915,13 +979,54 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) ############################################ - # Set QT_xyz_LIBRARY variable and add + macro(_qt4_add_target_depends_internal _QT_MODULE _PROPERTY) + if (TARGET Qt4::${_QT_MODULE}) + foreach(_DEPEND ${ARGN}) + set(_VALID_DEPENDS) + if (TARGET Qt4::Qt${_DEPEND}) + list(APPEND _VALID_DEPENDS Qt4::Qt${_DEPEND}) + endif() + if (_VALID_DEPENDS) + set_property(TARGET Qt4::${_QT_MODULE} APPEND PROPERTY + ${_PROPERTY} + "${_VALID_DEPENDS}" + ) + endif() + set(_VALID_DEPENDS) + endforeach() + endif() + endmacro() + + macro(_qt4_add_target_depends _QT_MODULE) + get_target_property(_configs Qt4::${_QT_MODULE} IMPORTED_CONFIGURATIONS) + foreach(_config ${_configs}) + _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN}) + endforeach() + set(_configs) + endmacro() + + macro(_qt4_add_target_private_depends _QT_MODULE) + get_target_property(_configs ${_QT_MODULE} IMPORTED_CONFIGURATIONS) + foreach(_config ${_configs}) + _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_DEPENDENT_LIBRARIES_${_config} ${ARGN}) + endforeach() + set(_configs) + endmacro() + + + # Set QT_xyz_LIBRARY variable and add # library include path to QT_INCLUDES _QT4_ADJUST_LIB_VARS(QtCore) + set_property(TARGET Qt4::QtCore APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES + "${QT_MKSPECS_DIR}/default" + ${QT_INCLUDE_DIR} + ) - FOREACH(QT_MODULE ${QT_MODULES}) + foreach(QT_MODULE ${QT_MODULES}) _QT4_ADJUST_LIB_VARS(${QT_MODULE}) - ENDFOREACH(QT_MODULE) + _qt4_add_target_depends(${QT_MODULE} Core) + endforeach() _QT4_ADJUST_LIB_VARS(QtAssistant) _QT4_ADJUST_LIB_VARS(QtAssistantClient) @@ -929,128 +1034,189 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) _QT4_ADJUST_LIB_VARS(QtDesignerComponents) # platform dependent libraries - IF(Q_WS_WIN) + if(Q_WS_WIN) _QT4_ADJUST_LIB_VARS(qtmain) + _QT4_ADJUST_LIB_VARS(QAxServer) - _QT4_ADJUST_LIB_VARS(QAxContainer) - ENDIF(Q_WS_WIN) + set_property(TARGET Qt4::QAxServer PROPERTY + INTERFACE_QT4_NO_LINK_QTMAIN ON + ) + set_property(TARGET Qt4::QAxServer APPEND PROPERTY + COMPATIBLE_INTERFACE_BOOL QT4_NO_LINK_QTMAIN) + _QT4_ADJUST_LIB_VARS(QAxContainer) + endif() + + # Only public dependencies are listed here. + # Eg, QtDBus links to QtXml, but users of QtDBus do not need to + # link to QtXml because QtDBus only uses it internally, not in public + # headers. + # Everything depends on QtCore, but that is covered above already + _qt4_add_target_depends(Qt3Support Sql Gui Network) + if (TARGET Qt4::Qt3Support) + # An additional define is required for QT3_SUPPORT + set_property(TARGET Qt4::Qt3Support APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT3_SUPPORT) + endif() + _qt4_add_target_depends(QtDeclarative Script Gui) + _qt4_add_target_depends(QtDesigner Gui) + _qt4_add_target_depends(QtHelp Gui) + _qt4_add_target_depends(QtMultimedia Gui) + _qt4_add_target_depends(QtOpenGL Gui) + _qt4_add_target_depends(QtSvg Gui) + _qt4_add_target_depends(QtWebKit Gui Network) + + _qt4_add_target_private_depends(Qt3Support Xml) + _qt4_add_target_private_depends(QtSvg Xml) + _qt4_add_target_private_depends(QtDBus Xml) + _qt4_add_target_private_depends(QtUiTools Xml Gui) + _qt4_add_target_private_depends(QtHelp Sql Xml Network) + _qt4_add_target_private_depends(QtXmlPatterns Network) + _qt4_add_target_private_depends(QtScriptTools Gui) + _qt4_add_target_private_depends(QtWebKit XmlPatterns) + _qt4_add_target_private_depends(QtDeclarative XmlPatterns Svg Sql Gui) + _qt4_add_target_private_depends(QtMultimedia Gui) + _qt4_add_target_private_depends(QtOpenGL Gui) + _qt4_add_target_private_depends(QAxServer Gui) + _qt4_add_target_private_depends(QAxContainer Gui) + _qt4_add_target_private_depends(phonon Gui) + if(QT_QTDBUS_FOUND) + _qt4_add_target_private_depends(phonon DBus) + endif() + + if (WIN32 AND NOT QT4_NO_LINK_QTMAIN) + set(_isExe $,EXECUTABLE>) + set(_isWin32 $>) + set(_isNotExcluded $>>) + set(_isPolicyNEW $) + get_target_property(_configs Qt4::QtCore IMPORTED_CONFIGURATIONS) + foreach(_config ${_configs}) + set_property(TARGET Qt4::QtCore APPEND PROPERTY + IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} + $<$:Qt4::qtmain> + ) + endforeach() + unset(_configs) + unset(_isExe) + unset(_isWin32) + unset(_isNotExcluded) + unset(_isPolicyNEW) + endif() ####################################### # - # Check the executables of Qt + # Check the executables of Qt # ( moc, uic, rcc ) # ####################################### - IF(QT_QMAKE_CHANGED) - SET(QT_UIC_EXECUTABLE NOTFOUND) - SET(QT_MOC_EXECUTABLE NOTFOUND) - SET(QT_UIC3_EXECUTABLE NOTFOUND) - SET(QT_RCC_EXECUTABLE NOTFOUND) - SET(QT_DBUSCPP2XML_EXECUTABLE NOTFOUND) - SET(QT_DBUSXML2CPP_EXECUTABLE NOTFOUND) - SET(QT_LUPDATE_EXECUTABLE NOTFOUND) - SET(QT_LRELEASE_EXECUTABLE NOTFOUND) - SET(QT_QCOLLECTIONGENERATOR_EXECUTABLE NOTFOUND) - SET(QT_DESIGNER_EXECUTABLE NOTFOUND) - SET(QT_LINGUIST_EXECUTABLE NOTFOUND) - ENDIF(QT_QMAKE_CHANGED) - - FIND_PROGRAM(QT_MOC_EXECUTABLE - NAMES moc-qt4 moc + if(QT_QMAKE_CHANGED) + set(QT_UIC_EXECUTABLE NOTFOUND) + set(QT_MOC_EXECUTABLE NOTFOUND) + set(QT_UIC3_EXECUTABLE NOTFOUND) + set(QT_RCC_EXECUTABLE NOTFOUND) + set(QT_DBUSCPP2XML_EXECUTABLE NOTFOUND) + set(QT_DBUSXML2CPP_EXECUTABLE NOTFOUND) + set(QT_LUPDATE_EXECUTABLE NOTFOUND) + set(QT_LRELEASE_EXECUTABLE NOTFOUND) + set(QT_QCOLLECTIONGENERATOR_EXECUTABLE NOTFOUND) + set(QT_DESIGNER_EXECUTABLE NOTFOUND) + set(QT_LINGUIST_EXECUTABLE NOTFOUND) + endif() + + find_program(QT_MOC_EXECUTABLE + NAMES moc-qt4 moc moc4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - FIND_PROGRAM(QT_UIC_EXECUTABLE - NAMES uic-qt4 uic + find_program(QT_UIC_EXECUTABLE + NAMES uic-qt4 uic uic4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - FIND_PROGRAM(QT_UIC3_EXECUTABLE + find_program(QT_UIC3_EXECUTABLE NAMES uic3 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - FIND_PROGRAM(QT_RCC_EXECUTABLE + find_program(QT_RCC_EXECUTABLE NAMES rcc PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - FIND_PROGRAM(QT_DBUSCPP2XML_EXECUTABLE + find_program(QT_DBUSCPP2XML_EXECUTABLE NAMES qdbuscpp2xml PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - FIND_PROGRAM(QT_DBUSXML2CPP_EXECUTABLE + find_program(QT_DBUSXML2CPP_EXECUTABLE NAMES qdbusxml2cpp PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - FIND_PROGRAM(QT_LUPDATE_EXECUTABLE - NAMES lupdate-qt4 lupdate + find_program(QT_LUPDATE_EXECUTABLE + NAMES lupdate-qt4 lupdate lupdate4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - FIND_PROGRAM(QT_LRELEASE_EXECUTABLE - NAMES lrelease-qt4 lrelease + find_program(QT_LRELEASE_EXECUTABLE + NAMES lrelease-qt4 lrelease lrelease4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - FIND_PROGRAM(QT_QCOLLECTIONGENERATOR_EXECUTABLE + find_program(QT_QCOLLECTIONGENERATOR_EXECUTABLE NAMES qcollectiongenerator-qt4 qcollectiongenerator PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - FIND_PROGRAM(QT_DESIGNER_EXECUTABLE - NAMES designer-qt4 designer + find_program(QT_DESIGNER_EXECUTABLE + NAMES designer-qt4 designer designer4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - FIND_PROGRAM(QT_LINGUIST_EXECUTABLE - NAMES linguist-qt4 linguist + find_program(QT_LINGUIST_EXECUTABLE + NAMES linguist-qt4 linguist linguist4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - IF (QT_MOC_EXECUTABLE) - SET(QT_WRAP_CPP "YES") - ENDIF (QT_MOC_EXECUTABLE) + if (QT_MOC_EXECUTABLE) + set(QT_WRAP_CPP "YES") + endif () - IF (QT_UIC_EXECUTABLE) - SET(QT_WRAP_UI "YES") - ENDIF (QT_UIC_EXECUTABLE) + if (QT_UIC_EXECUTABLE) + set(QT_WRAP_UI "YES") + endif () - MARK_AS_ADVANCED( QT_UIC_EXECUTABLE QT_UIC3_EXECUTABLE QT_MOC_EXECUTABLE + mark_as_advanced( QT_UIC_EXECUTABLE QT_UIC3_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_DBUSXML2CPP_EXECUTABLE QT_DBUSCPP2XML_EXECUTABLE QT_LUPDATE_EXECUTABLE QT_LRELEASE_EXECUTABLE QT_QCOLLECTIONGENERATOR_EXECUTABLE QT_DESIGNER_EXECUTABLE QT_LINGUIST_EXECUTABLE) # get the directory of the current file, used later on in the file - GET_FILENAME_COMPONENT( _qt4_current_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) + get_filename_component( _qt4_current_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) + - ############################################### # - # configuration/system dependent settings + # configuration/system dependent settings # ############################################### - INCLUDE("${_qt4_current_dir}/Qt4ConfigDependentSettings.cmake") + include("${_qt4_current_dir}/Qt4ConfigDependentSettings.cmake") ####################################### @@ -1059,84 +1225,84 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) # ####################################### - SET( QT_PLUGIN_TYPES accessible bearer codecs decorations designer gfxdrivers graphicssystems iconengines imageformats inputmethods mousedrivers phonon_backend script sqldrivers ) - - SET( QT_ACCESSIBLE_PLUGINS qtaccessiblecompatwidgets qtaccessiblewidgets ) - SET( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer ) - SET( QT_CODECS_PLUGINS qcncodecs qjpcodecs qkrcodecs qtwcodecs ) - SET( QT_DECORATIONS_PLUGINS qdecorationdefault qdecorationwindows ) - SET( QT_DESIGNER_PLUGINS arthurplugin containerextension customwidgetplugin phononwidgets qdeclarativeview qt3supportwidgets qwebview taskmenuextension worldtimeclockplugin ) - SET( QT_GRAPHICSDRIVERS_PLUGINS qgfxtransformed qgfxvnc qscreenvfb ) - SET( QT_GRAPHICSSYSTEMS_PLUGINS qglgraphicssystem qtracegraphicssystem ) - SET( QT_ICONENGINES_PLUGINS qsvgicon ) - SET( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff ) - SET( QT_INPUTMETHODS_PLUGINS qimsw_multi ) - SET( QT_MOUSEDRIVERS_PLUGINS qwstslibmousehandler ) - IF(APPLE) - SET( QT_PHONON_BACKEND_PLUGINS phonon_qt7 ) - ELSEIF(WIN32) - SET( QT_PHONON_BACKEND_PLUGINS phonon_ds9 ) - ENDIF() - SET( QT_SCRIPT_PLUGINS qtscriptdbus ) - SET( QT_SQLDRIVERS_PLUGINS qsqldb2 qsqlibase qsqlite qsqlite2 qsqlmysql qsqloci qsqlodbc qsqlpsql qsqltds ) - - SET( QT_PHONON_PLUGINS ${QT_PHONON_BACKEND_PLUGINS} ) - SET( QT_QT3SUPPORT_PLUGINS qtaccessiblecompatwidgets ) - SET( QT_QTCORE_PLUGINS ${QT_BEARER_PLUGINS} ${QT_CODECS_PLUGINS} ) - SET( QT_QTGUI_PLUGINS qtaccessiblewidgets qgif qjpeg qmng qico qtiff ${QT_DECORATIONS_PLUGINS} ${QT_GRAPHICSDRIVERS_PLUGINS} ${QT_GRAPHICSSYSTEMS_PLUGINS} ${QT_INPUTMETHODS_PLUGINS} ${QT_MOUSEDRIVERS_PLUGINS} ) - SET( QT_QTSCRIPT_PLUGINS ${QT_SCRIPT_PLUGINS} ) - SET( QT_QTSQL_PLUGINS ${QT_SQLDRIVERS_PLUGINS} ) - SET( QT_QTSVG_PLUGINS qsvg qsvgicon ) - - IF(QT_QMAKE_CHANGED) - FOREACH(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES}) - STRING(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type) - SET(QT_${_upper_qt_plugin_type}_PLUGINS_DIR ${QT_PLUGINS_DIR}/${QT_PLUGIN_TYPE}) - FOREACH(QT_PLUGIN ${QT_${_upper_qt_plugin_type}_PLUGINS}) - STRING(TOUPPER ${QT_PLUGIN} _upper_qt_plugin) - UNSET(QT_${_upper_qt_plugin}_LIBRARY_RELEASE CACHE) - UNSET(QT_${_upper_qt_plugin}_LIBRARY_DEBUG CACHE) - UNSET(QT_${_upper_qt_plugin}_LIBRARY CACHE) - UNSET(QT_${_upper_qt_plugin}_PLUGIN_RELEASE CACHE) - UNSET(QT_${_upper_qt_plugin}_PLUGIN_DEBUG CACHE) - UNSET(QT_${_upper_qt_plugin}_PLUGIN CACHE) - ENDFOREACH(QT_PLUGIN) - ENDFOREACH(QT_PLUGIN_TYPE) - ENDIF(QT_QMAKE_CHANGED) + set( QT_PLUGIN_TYPES accessible bearer codecs decorations designer gfxdrivers graphicssystems iconengines imageformats inputmethods mousedrivers phonon_backend script sqldrivers ) + + set( QT_ACCESSIBLE_PLUGINS qtaccessiblecompatwidgets qtaccessiblewidgets ) + set( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer ) + set( QT_CODECS_PLUGINS qcncodecs qjpcodecs qkrcodecs qtwcodecs ) + set( QT_DECORATIONS_PLUGINS qdecorationdefault qdecorationwindows ) + set( QT_DESIGNER_PLUGINS arthurplugin containerextension customwidgetplugin phononwidgets qdeclarativeview qt3supportwidgets qwebview taskmenuextension worldtimeclockplugin ) + set( QT_GRAPHICSDRIVERS_PLUGINS qgfxtransformed qgfxvnc qscreenvfb ) + set( QT_GRAPHICSSYSTEMS_PLUGINS qglgraphicssystem qtracegraphicssystem ) + set( QT_ICONENGINES_PLUGINS qsvgicon ) + set( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff ) + set( QT_INPUTMETHODS_PLUGINS qimsw_multi ) + set( QT_MOUSEDRIVERS_PLUGINS qwstslibmousehandler ) + if(APPLE) + set( QT_PHONON_BACKEND_PLUGINS phonon_qt7 ) + elseif(WIN32) + set( QT_PHONON_BACKEND_PLUGINS phonon_ds9 ) + endif() + set( QT_SCRIPT_PLUGINS qtscriptdbus ) + set( QT_SQLDRIVERS_PLUGINS qsqldb2 qsqlibase qsqlite qsqlite2 qsqlmysql qsqloci qsqlodbc qsqlpsql qsqltds ) + + set( QT_PHONON_PLUGINS ${QT_PHONON_BACKEND_PLUGINS} ) + set( QT_QT3SUPPORT_PLUGINS qtaccessiblecompatwidgets ) + set( QT_QTCORE_PLUGINS ${QT_BEARER_PLUGINS} ${QT_CODECS_PLUGINS} ) + set( QT_QTGUI_PLUGINS qtaccessiblewidgets qgif qjpeg qmng qico qtiff ${QT_DECORATIONS_PLUGINS} ${QT_GRAPHICSDRIVERS_PLUGINS} ${QT_GRAPHICSSYSTEMS_PLUGINS} ${QT_INPUTMETHODS_PLUGINS} ${QT_MOUSEDRIVERS_PLUGINS} ) + set( QT_QTSCRIPT_PLUGINS ${QT_SCRIPT_PLUGINS} ) + set( QT_QTSQL_PLUGINS ${QT_SQLDRIVERS_PLUGINS} ) + set( QT_QTSVG_PLUGINS qsvg qsvgicon ) + + if(QT_QMAKE_CHANGED) + foreach(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES}) + string(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type) + set(QT_${_upper_qt_plugin_type}_PLUGINS_DIR ${QT_PLUGINS_DIR}/${QT_PLUGIN_TYPE}) + foreach(QT_PLUGIN ${QT_${_upper_qt_plugin_type}_PLUGINS}) + string(TOUPPER ${QT_PLUGIN} _upper_qt_plugin) + unset(QT_${_upper_qt_plugin}_LIBRARY_RELEASE CACHE) + unset(QT_${_upper_qt_plugin}_LIBRARY_DEBUG CACHE) + unset(QT_${_upper_qt_plugin}_LIBRARY CACHE) + unset(QT_${_upper_qt_plugin}_PLUGIN_RELEASE CACHE) + unset(QT_${_upper_qt_plugin}_PLUGIN_DEBUG CACHE) + unset(QT_${_upper_qt_plugin}_PLUGIN CACHE) + endforeach() + endforeach() + endif() # find_library works better than find_file but we need to set prefixes to only match plugins - FOREACH(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES}) - STRING(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type) - SET(QT_${_upper_qt_plugin_type}_PLUGINS_DIR ${QT_PLUGINS_DIR}/${QT_PLUGIN_TYPE}) - FOREACH(QT_PLUGIN ${QT_${_upper_qt_plugin_type}_PLUGINS}) - STRING(TOUPPER ${QT_PLUGIN} _upper_qt_plugin) - IF(QT_IS_STATIC) - FIND_LIBRARY(QT_${_upper_qt_plugin}_LIBRARY_RELEASE + foreach(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES}) + string(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type) + set(QT_${_upper_qt_plugin_type}_PLUGINS_DIR ${QT_PLUGINS_DIR}/${QT_PLUGIN_TYPE}) + foreach(QT_PLUGIN ${QT_${_upper_qt_plugin_type}_PLUGINS}) + string(TOUPPER ${QT_PLUGIN} _upper_qt_plugin) + if(QT_IS_STATIC) + find_library(QT_${_upper_qt_plugin}_LIBRARY_RELEASE NAMES ${QT_PLUGIN}${QT_LIBINFIX} ${QT_PLUGIN}${QT_LIBINFIX}4 PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - FIND_LIBRARY(QT_${_upper_qt_plugin}_LIBRARY_DEBUG + find_library(QT_${_upper_qt_plugin}_LIBRARY_DEBUG NAMES ${QT_PLUGIN}${QT_LIBINFIX}_debug ${QT_PLUGIN}${QT_LIBINFIX}d ${QT_PLUGIN}${QT_LIBINFIX}d4 PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) _QT4_ADJUST_LIB_VARS(${QT_PLUGIN}) - ELSE(QT_IS_STATIC) + else() # find_library works easier/better than find_file but we need to set suffixes to only match plugins - SET(CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT ${CMAKE_FIND_LIBRARY_SUFFIXES}) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_MODULE_SUFFIX} ${CMAKE_SHARED_LIBRARY_SUFFIX}) - FIND_LIBRARY(QT_${_upper_qt_plugin}_PLUGIN_RELEASE + set(CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT ${CMAKE_FIND_LIBRARY_SUFFIXES}) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_MODULE_SUFFIX} ${CMAKE_SHARED_LIBRARY_SUFFIX}) + find_library(QT_${_upper_qt_plugin}_PLUGIN_RELEASE NAMES ${QT_PLUGIN}${QT_LIBINFIX} ${QT_PLUGIN}${QT_LIBINFIX}4 PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - FIND_LIBRARY(QT_${_upper_qt_plugin}_PLUGIN_DEBUG + find_library(QT_${_upper_qt_plugin}_PLUGIN_DEBUG NAMES ${QT_PLUGIN}${QT_LIBINFIX}_debug ${QT_PLUGIN}${QT_LIBINFIX}d ${QT_PLUGIN}${QT_LIBINFIX}d4 PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - MARK_AS_ADVANCED(QT_${_upper_qt_plugin}_PLUGIN_RELEASE QT_${_upper_qt_plugin}_PLUGIN_DEBUG) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT}) - ENDIF(QT_IS_STATIC) - ENDFOREACH(QT_PLUGIN) - ENDFOREACH(QT_PLUGIN_TYPE) + mark_as_advanced(QT_${_upper_qt_plugin}_PLUGIN_RELEASE QT_${_upper_qt_plugin}_PLUGIN_DEBUG) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT}) + endif() + endforeach() + endforeach() ###################################### @@ -1145,57 +1311,52 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) # ###################################### - INCLUDE("${_qt4_current_dir}/Qt4Macros.cmake") - - # set version variables - STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}") - STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}") - STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}") + include("${_qt4_current_dir}/Qt4Macros.cmake") -ENDIF(QT_QMAKE_EXECUTABLE AND QTVERSION) +endif() #support old QT_MIN_VERSION if set, but not if version is supplied by find_package() -IF(NOT Qt4_FIND_VERSION AND QT_MIN_VERSION) - SET(Qt4_FIND_VERSION ${QT_MIN_VERSION}) -ENDIF(NOT Qt4_FIND_VERSION AND QT_MIN_VERSION) +if(NOT Qt4_FIND_VERSION AND QT_MIN_VERSION) + set(Qt4_FIND_VERSION ${QT_MIN_VERSION}) +endif() -IF( Qt4_FIND_COMPONENTS ) +if( Qt4_FIND_COMPONENTS ) # if components specified in find_package(), make sure each of those pieces were found - SET(_QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR) - FOREACH( component ${Qt4_FIND_COMPONENTS} ) - STRING( TOUPPER ${component} _COMPONENT ) + set(_QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR) + foreach( component ${Qt4_FIND_COMPONENTS} ) + string( TOUPPER ${component} _COMPONENT ) if(${_COMPONENT} STREQUAL "QTMAIN") - IF(Q_WS_WIN) - SET(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_${_COMPONENT}_LIBRARY) - ENDIF(Q_WS_WIN) - else(${_COMPONENT} STREQUAL "QTMAIN") - SET(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_${_COMPONENT}_INCLUDE_DIR QT_${_COMPONENT}_LIBRARY) - endif(${_COMPONENT} STREQUAL "QTMAIN") - ENDFOREACH( component ) + if(Q_WS_WIN) + set(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_${_COMPONENT}_LIBRARY) + endif() + else() + set(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_${_COMPONENT}_INCLUDE_DIR QT_${_COMPONENT}_LIBRARY) + endif() + endforeach() if(Qt4_FIND_COMPONENTS MATCHES QtGui) - SET(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_UIC_EXECUTABLE) - endif(Qt4_FIND_COMPONENTS MATCHES QtGui) + set(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_UIC_EXECUTABLE) + endif() -ELSE( Qt4_FIND_COMPONENTS ) +else() # if no components specified, we'll make a default set of required variables to say Qt is found - SET(_QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR + set(_QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR QT_QTCORE_LIBRARY) -ENDIF( Qt4_FIND_COMPONENTS ) - -if (QT_VERSION_MAJOR GREATER 4) - SET(VERSION_MSG "Found unsuitable Qt version \"${QTVERSION}\" from ${QT_QMAKE_EXECUTABLE}") - SET(QT4_FOUND FALSE) - IF(Qt4_FIND_REQUIRED) - MESSAGE( FATAL_ERROR "${VERSION_MSG}, this code requires Qt 4.x") - ELSE(Qt4_FIND_REQUIRED) - IF(NOT Qt4_FIND_QUIETLY) - MESSAGE( STATUS "${VERSION_MSG}") - ENDIF(NOT Qt4_FIND_QUIETLY) - ENDIF(Qt4_FIND_REQUIRED) +endif() + +if (NOT QT_VERSION_MAJOR EQUAL 4) + set(VERSION_MSG "Found unsuitable Qt version \"${QTVERSION}\" from ${QT_QMAKE_EXECUTABLE}") + set(QT4_FOUND FALSE) + if(Qt4_FIND_REQUIRED) + message( FATAL_ERROR "${VERSION_MSG}, this code requires Qt 4.x") + else() + if(NOT Qt4_FIND_QUIETLY) + message( STATUS "${VERSION_MSG}") + endif() + endif() else() FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt4 REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} @@ -1209,8 +1370,8 @@ endif() # ####################################### # Backwards compatibility for CMake1.4 and 1.2 -SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} ) -SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} ) -SET( QT_QT_LIBRARY "") -SET(QT_FOUND ${QT4_FOUND}) +set (QT_MOC_EXE ${QT_MOC_EXECUTABLE} ) +set (QT_UIC_EXE ${QT_UIC_EXECUTABLE} ) +set( QT_QT_LIBRARY "") +set(QT_FOUND ${QT4_FOUND}) diff --git a/Modules/FindQuickTime.cmake b/Modules/FindQuickTime.cmake index 038c2dd65..42a0dce77 100644 --- a/Modules/FindQuickTime.cmake +++ b/Modules/FindQuickTime.cmake @@ -1,13 +1,13 @@ # Locate QuickTime # This module defines # QUICKTIME_LIBRARY -# QUICKTIME_FOUND, if false, do not try to link to gdal +# QUICKTIME_FOUND, if false, do not try to link to gdal # QUICKTIME_INCLUDE_DIR, where to find the headers # # $QUICKTIME_DIR is an environment variable that would # correspond to the ./configure --prefix=$QUICKTIME_DIR # -# Created by Eric Wing. +# Created by Eric Wing. #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -22,26 +22,20 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -# QuickTime on OS X looks different than QuickTime for Windows, -# so I am going to case the two. - -IF(APPLE) - FIND_PATH(QUICKTIME_INCLUDE_DIR QuickTime/QuickTime.h) - FIND_LIBRARY(QUICKTIME_LIBRARY QuickTime) -ELSE(APPLE) - FIND_PATH(QUICKTIME_INCLUDE_DIR QuickTime.h - HINTS - $ENV{QUICKTIME_DIR}/include - $ENV{QUICKTIME_DIR} - ) - FIND_LIBRARY(QUICKTIME_LIBRARY QuickTime - HINTS - $ENV{QUICKTIME_DIR}/lib - $ENV{QUICKTIME_DIR} - ) -ENDIF(APPLE) +find_path(QUICKTIME_INCLUDE_DIR QuickTime/QuickTime.h QuickTime.h + HINTS + ENV QUICKTIME_DIR + PATH_SUFFIXES + include +) +find_library(QUICKTIME_LIBRARY QuickTime + HINTS + ENV QUICKTIME_DIR + PATH_SUFFIXES + lib +) # handle the QUIETLY and REQUIRED arguments and set QUICKTIME_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(QuickTime DEFAULT_MSG QUICKTIME_LIBRARY QUICKTIME_INCLUDE_DIR) diff --git a/Modules/FindRTI.cmake b/Modules/FindRTI.cmake index 031c13854..60990b767 100644 --- a/Modules/FindRTI.cmake +++ b/Modules/FindRTI.cmake @@ -29,73 +29,68 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -MACRO(RTI_MESSAGE_QUIETLY QUIET TYPE MSG) - IF(NOT ${QUIET}) - MESSAGE(${TYPE} "${MSG}") - ENDIF(NOT ${QUIET}) -ENDMACRO(RTI_MESSAGE_QUIETLY QUIET TYPE MSG) +macro(RTI_MESSAGE_QUIETLY QUIET TYPE MSG) + if(NOT ${QUIET}) + message(${TYPE} "${MSG}") + endif() +endmacro() -# Detect the CERTI installation, http://www.cert.fr/CERTI -IF ("$ENV{CERTI_HOME}" STRGREATER "") - FILE(TO_CMAKE_PATH "$ENV{CERTI_HOME}" CERTI_HOME) - RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "Using environment defined CERTI_HOME: ${CERTI_HOME}") -ENDIF ("$ENV{CERTI_HOME}" STRGREATER "") - -SET(RTI_DEFINITIONS "-DRTI_USES_STD_FSTREAM") +set(RTI_DEFINITIONS "-DRTI_USES_STD_FSTREAM") +# Detect the CERTI installation, http://www.cert.fr/CERTI # Detect the MAK Technologies RTI installation, http://www.mak.com/products/rti.php # note: the following list is ordered to find the most recent version first -SET(RTI_POSSIBLE_DIRS - ${CERTI_HOME} +set(RTI_POSSIBLE_DIRS + ENV CERTI_HOME "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MAK Technologies\\MAK RTI 3.2 MSVC++ 8.0;Location]" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MAK RTI 3.2-win32-msvc++8.0;InstallLocation]" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MAK Technologies\\MAK RTI 2.2;Location]" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MAK RTI 2.2;InstallLocation]") -SET(RTI_OLD_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}") +set(RTI_OLD_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}") # The MAK RTI has the "lib" prefix even on Windows. -SET(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") +set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") -FIND_LIBRARY(RTI_LIBRARY +find_library(RTI_LIBRARY NAMES RTI RTI-NG PATHS ${RTI_POSSIBLE_DIRS} PATH_SUFFIXES lib DOC "The RTI Library") -IF (RTI_LIBRARY) - SET(RTI_LIBRARIES ${RTI_LIBRARY}) +if (RTI_LIBRARY) + set(RTI_LIBRARIES ${RTI_LIBRARY}) RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI library found: ${RTI_LIBRARY}") -ELSE (RTI_LIBRARY) +else () RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI library NOT found") -ENDIF (RTI_LIBRARY) +endif () -FIND_LIBRARY(RTI_FEDTIME_LIBRARY +find_library(RTI_FEDTIME_LIBRARY NAMES FedTime PATHS ${RTI_POSSIBLE_DIRS} PATH_SUFFIXES lib DOC "The FedTime Library") -IF (RTI_FEDTIME_LIBRARY) - SET(RTI_LIBRARIES ${RTI_LIBRARIES} ${RTI_FEDTIME_LIBRARY}) +if (RTI_FEDTIME_LIBRARY) + set(RTI_LIBRARIES ${RTI_LIBRARIES} ${RTI_FEDTIME_LIBRARY}) RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI FedTime found: ${RTI_FEDTIME_LIBRARY}") -ENDIF (RTI_FEDTIME_LIBRARY) +endif () -FIND_PATH(RTI_INCLUDE_DIR +find_path(RTI_INCLUDE_DIR NAMES RTI.hh PATHS ${RTI_POSSIBLE_DIRS} PATH_SUFFIXES include DOC "The RTI Include Files") -IF (RTI_INCLUDE_DIR) +if (RTI_INCLUDE_DIR) RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI headers found: ${RTI_INCLUDE_DIR}") -ELSE (RTI_INCLUDE_DIR) +else () RTI_MESSAGE_QUIETLY(RTI_FIND_QUIETLY STATUS "RTI headers NOT found") -ENDIF (RTI_INCLUDE_DIR) +endif () # Set the modified system variables back to the original value. -SET(CMAKE_FIND_LIBRARY_PREFIXES "${RTI_OLD_FIND_LIBRARY_PREFIXES}") +set(CMAKE_FIND_LIBRARY_PREFIXES "${RTI_OLD_FIND_LIBRARY_PREFIXES}") -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(RTI DEFAULT_MSG RTI_LIBRARY RTI_INCLUDE_DIR) diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index 5e973e485..119cb63dd 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -3,7 +3,7 @@ # and libraries are. Ruby 1.8 and 1.9 are supported. # # The minimum required version of Ruby can be specified using the -# standard syntax, e.g. FIND_PACKAGE(Ruby 1.8) +# standard syntax, e.g. find_package(Ruby 1.8) # # It also determines what the name of the library is. This # code sets the following variables: @@ -37,43 +37,43 @@ # RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'` # uncomment the following line to get debug output for this file -# SET(_RUBY_DEBUG_OUTPUT TRUE) +# set(_RUBY_DEBUG_OUTPUT TRUE) # Determine the list of possible names of the ruby executable depending # on which version of ruby is required -SET(_RUBY_POSSIBLE_EXECUTABLE_NAMES ruby) +set(_RUBY_POSSIBLE_EXECUTABLE_NAMES ruby) # if 1.9 is required, don't look for ruby18 and ruby1.8, default to version 1.8 -IF(Ruby_FIND_VERSION_MAJOR AND Ruby_FIND_VERSION_MINOR) - SET(Ruby_FIND_VERSION_SHORT_NODOT "${Ruby_FIND_VERSION_MAJOR}${RUBY_FIND_VERSION_MINOR}") -ELSE(Ruby_FIND_VERSION_MAJOR AND Ruby_FIND_VERSION_MINOR) - SET(Ruby_FIND_VERSION_SHORT_NODOT "18") -ENDIF(Ruby_FIND_VERSION_MAJOR AND Ruby_FIND_VERSION_MINOR) +if(Ruby_FIND_VERSION_MAJOR AND Ruby_FIND_VERSION_MINOR) + set(Ruby_FIND_VERSION_SHORT_NODOT "${Ruby_FIND_VERSION_MAJOR}${RUBY_FIND_VERSION_MINOR}") +else() + set(Ruby_FIND_VERSION_SHORT_NODOT "18") +endif() -SET(_RUBY_POSSIBLE_EXECUTABLE_NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES} ruby1.9 ruby19) +set(_RUBY_POSSIBLE_EXECUTABLE_NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES} ruby1.9 ruby19) # if we want a version below 1.9, also look for ruby 1.8 -IF("${Ruby_FIND_VERSION_SHORT_NODOT}" VERSION_LESS "19") - SET(_RUBY_POSSIBLE_EXECUTABLE_NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES} ruby1.8 ruby18) -ENDIF("${Ruby_FIND_VERSION_SHORT_NODOT}" VERSION_LESS "19") +if("${Ruby_FIND_VERSION_SHORT_NODOT}" VERSION_LESS "19") + set(_RUBY_POSSIBLE_EXECUTABLE_NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES} ruby1.8 ruby18) +endif() -FIND_PROGRAM(RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}) +find_program(RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}) -IF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) - FUNCTION(_RUBY_CONFIG_VAR RBVAR OUTVAR) - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['${RBVAR}']" +if(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) + function(_RUBY_CONFIG_VAR RBVAR OUTVAR) + execute_process(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['${RBVAR}']" RESULT_VARIABLE _RUBY_SUCCESS OUTPUT_VARIABLE _RUBY_OUTPUT ERROR_QUIET) - IF(_RUBY_SUCCESS OR NOT _RUBY_OUTPUT) - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['${RBVAR}']" + if(_RUBY_SUCCESS OR NOT _RUBY_OUTPUT) + execute_process(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['${RBVAR}']" RESULT_VARIABLE _RUBY_SUCCESS OUTPUT_VARIABLE _RUBY_OUTPUT ERROR_QUIET) - ENDIF(_RUBY_SUCCESS OR NOT _RUBY_OUTPUT) - SET(${OUTVAR} "${_RUBY_OUTPUT}" PARENT_SCOPE) - ENDFUNCTION(_RUBY_CONFIG_VAR) + endif() + set(${OUTVAR} "${_RUBY_OUTPUT}" PARENT_SCOPE) + endfunction() # query the ruby version @@ -93,29 +93,29 @@ IF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) _RUBY_CONFIG_VAR("sitelibdir" RUBY_SITELIB_DIR) # vendor_ruby available ? - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r vendor-specific -e "print 'true'" + execute_process(COMMAND ${RUBY_EXECUTABLE} -r vendor-specific -e "print 'true'" OUTPUT_VARIABLE RUBY_HAS_VENDOR_RUBY ERROR_QUIET) - IF(RUBY_HAS_VENDOR_RUBY) + if(RUBY_HAS_VENDOR_RUBY) _RUBY_CONFIG_VAR("vendorlibdir" RUBY_VENDORLIB_DIR) _RUBY_CONFIG_VAR("vendorarchdir" RUBY_VENDORARCH_DIR) - ENDIF(RUBY_HAS_VENDOR_RUBY) + endif() # save the results in the cache so we don't have to run ruby the next time again - SET(RUBY_VERSION_MAJOR ${RUBY_VERSION_MAJOR} CACHE PATH "The Ruby major version" FORCE) - SET(RUBY_VERSION_MINOR ${RUBY_VERSION_MINOR} CACHE PATH "The Ruby minor version" FORCE) - SET(RUBY_VERSION_PATCH ${RUBY_VERSION_PATCH} CACHE PATH "The Ruby patch version" FORCE) - SET(RUBY_ARCH_DIR ${RUBY_ARCH_DIR} CACHE PATH "The Ruby arch dir" FORCE) - SET(RUBY_HDR_DIR ${RUBY_HDR_DIR} CACHE PATH "The Ruby header dir (1.9)" FORCE) - SET(RUBY_POSSIBLE_LIB_DIR ${RUBY_POSSIBLE_LIB_DIR} CACHE PATH "The Ruby lib dir" FORCE) - SET(RUBY_RUBY_LIB_DIR ${RUBY_RUBY_LIB_DIR} CACHE PATH "The Ruby ruby-lib dir" FORCE) - SET(RUBY_SITEARCH_DIR ${RUBY_SITEARCH_DIR} CACHE PATH "The Ruby site arch dir" FORCE) - SET(RUBY_SITELIB_DIR ${RUBY_SITELIB_DIR} CACHE PATH "The Ruby site lib dir" FORCE) - SET(RUBY_HAS_VENDOR_RUBY ${RUBY_HAS_VENDOR_RUBY} CACHE BOOL "Vendor Ruby is available" FORCE) - SET(RUBY_VENDORARCH_DIR ${RUBY_VENDORARCH_DIR} CACHE PATH "The Ruby vendor arch dir" FORCE) - SET(RUBY_VENDORLIB_DIR ${RUBY_VENDORLIB_DIR} CACHE PATH "The Ruby vendor lib dir" FORCE) - - MARK_AS_ADVANCED( + set(RUBY_VERSION_MAJOR ${RUBY_VERSION_MAJOR} CACHE PATH "The Ruby major version" FORCE) + set(RUBY_VERSION_MINOR ${RUBY_VERSION_MINOR} CACHE PATH "The Ruby minor version" FORCE) + set(RUBY_VERSION_PATCH ${RUBY_VERSION_PATCH} CACHE PATH "The Ruby patch version" FORCE) + set(RUBY_ARCH_DIR ${RUBY_ARCH_DIR} CACHE PATH "The Ruby arch dir" FORCE) + set(RUBY_HDR_DIR ${RUBY_HDR_DIR} CACHE PATH "The Ruby header dir (1.9)" FORCE) + set(RUBY_POSSIBLE_LIB_DIR ${RUBY_POSSIBLE_LIB_DIR} CACHE PATH "The Ruby lib dir" FORCE) + set(RUBY_RUBY_LIB_DIR ${RUBY_RUBY_LIB_DIR} CACHE PATH "The Ruby ruby-lib dir" FORCE) + set(RUBY_SITEARCH_DIR ${RUBY_SITEARCH_DIR} CACHE PATH "The Ruby site arch dir" FORCE) + set(RUBY_SITELIB_DIR ${RUBY_SITELIB_DIR} CACHE PATH "The Ruby site lib dir" FORCE) + set(RUBY_HAS_VENDOR_RUBY ${RUBY_HAS_VENDOR_RUBY} CACHE BOOL "Vendor Ruby is available" FORCE) + set(RUBY_VENDORARCH_DIR ${RUBY_VENDORARCH_DIR} CACHE PATH "The Ruby vendor arch dir" FORCE) + set(RUBY_VENDORLIB_DIR ${RUBY_VENDORLIB_DIR} CACHE PATH "The Ruby vendor lib dir" FORCE) + + mark_as_advanced( RUBY_ARCH_DIR RUBY_ARCH RUBY_HDR_DIR @@ -130,107 +130,107 @@ IF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) RUBY_VERSION_MINOR RUBY_VERSION_PATCH ) -ENDIF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) +endif() # In case RUBY_EXECUTABLE could not be executed (e.g. cross compiling) # try to detect which version we found. This is not too good. -IF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) +if(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) # by default assume 1.8.0 - SET(RUBY_VERSION_MAJOR 1) - SET(RUBY_VERSION_MINOR 8) - SET(RUBY_VERSION_PATCH 0) + set(RUBY_VERSION_MAJOR 1) + set(RUBY_VERSION_MINOR 8) + set(RUBY_VERSION_PATCH 0) # check whether we found 1.9.x - IF(${RUBY_EXECUTABLE} MATCHES "ruby1.?9" OR RUBY_HDR_DIR) - SET(RUBY_VERSION_MAJOR 1) - SET(RUBY_VERSION_MINOR 9) - ENDIF(${RUBY_EXECUTABLE} MATCHES "ruby1.?9" OR RUBY_HDR_DIR) -ENDIF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) - -IF(RUBY_VERSION_MAJOR) - SET(RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}") - SET(_RUBY_VERSION_SHORT "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}") - SET(_RUBY_VERSION_SHORT_NODOT "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}") - SET(_RUBY_NODOT_VERSION "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}") -ENDIF(RUBY_VERSION_MAJOR) - -FIND_PATH(RUBY_INCLUDE_DIR + if(${RUBY_EXECUTABLE} MATCHES "ruby1.?9" OR RUBY_HDR_DIR) + set(RUBY_VERSION_MAJOR 1) + set(RUBY_VERSION_MINOR 9) + endif() +endif() + +if(RUBY_VERSION_MAJOR) + set(RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}") + set(_RUBY_VERSION_SHORT "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}") + set(_RUBY_VERSION_SHORT_NODOT "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}") + set(_RUBY_NODOT_VERSION "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}") +endif() + +find_path(RUBY_INCLUDE_DIR NAMES ruby.h HINTS ${RUBY_HDR_DIR} ${RUBY_ARCH_DIR} /usr/lib/ruby/${_RUBY_VERSION_SHORT}/i586-linux-gnu/ ) -SET(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIR} ) +set(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIR} ) # if ruby > 1.8 is required or if ruby > 1.8 was found, search for the config.h dir -IF( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_RUBY_VERSION_SHORT_NODOT}" GREATER 18 OR RUBY_HDR_DIR) - FIND_PATH(RUBY_CONFIG_INCLUDE_DIR +if( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_RUBY_VERSION_SHORT_NODOT}" GREATER 18 OR RUBY_HDR_DIR) + find_path(RUBY_CONFIG_INCLUDE_DIR NAMES ruby/config.h config.h HINTS ${RUBY_HDR_DIR}/${RUBY_ARCH} ${RUBY_ARCH_DIR} ) - SET(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIRS} ${RUBY_CONFIG_INCLUDE_DIR} ) -ENDIF( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_RUBY_VERSION_SHORT_NODOT}" GREATER 18 OR RUBY_HDR_DIR) + set(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIRS} ${RUBY_CONFIG_INCLUDE_DIR} ) +endif() # Determine the list of possible names for the ruby library -SET(_RUBY_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_RUBY_VERSION_SHORT} ruby${_RUBY_VERSION_SHORT_NODOT} ruby-${_RUBY_VERSION_SHORT} ruby-${RUBY_VERSION}) - -IF(WIN32) - SET( _RUBY_MSVC_RUNTIME "" ) - IF( MSVC60 ) - SET( _RUBY_MSVC_RUNTIME "60" ) - ENDIF( MSVC60 ) - IF( MSVC70 ) - SET( _RUBY_MSVC_RUNTIME "70" ) - ENDIF( MSVC70 ) - IF( MSVC71 ) - SET( _RUBY_MSVC_RUNTIME "71" ) - ENDIF( MSVC71 ) - IF( MSVC80 ) - SET( _RUBY_MSVC_RUNTIME "80" ) - ENDIF( MSVC80 ) - IF( MSVC90 ) - SET( _RUBY_MSVC_RUNTIME "90" ) - ENDIF( MSVC90 ) - - LIST(APPEND _RUBY_POSSIBLE_LIB_NAMES +set(_RUBY_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_RUBY_VERSION_SHORT} ruby${_RUBY_VERSION_SHORT_NODOT} ruby-${_RUBY_VERSION_SHORT} ruby-${RUBY_VERSION}) + +if(WIN32) + set( _RUBY_MSVC_RUNTIME "" ) + if( MSVC60 ) + set( _RUBY_MSVC_RUNTIME "60" ) + endif() + if( MSVC70 ) + set( _RUBY_MSVC_RUNTIME "70" ) + endif() + if( MSVC71 ) + set( _RUBY_MSVC_RUNTIME "71" ) + endif() + if( MSVC80 ) + set( _RUBY_MSVC_RUNTIME "80" ) + endif() + if( MSVC90 ) + set( _RUBY_MSVC_RUNTIME "90" ) + endif() + + list(APPEND _RUBY_POSSIBLE_LIB_NAMES "msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}" "msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}-static" "msvcrt-ruby${_RUBY_NODOT_VERSION}" "msvcrt-ruby${_RUBY_NODOT_VERSION}-static" ) -ENDIF(WIN32) - -FIND_LIBRARY(RUBY_LIBRARY NAMES ${_RUBY_POSSIBLE_LIB_NAMES} HINTS ${RUBY_POSSIBLE_LIB_DIR} ) - -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -SET(_RUBY_REQUIRED_VARS RUBY_EXECUTABLE RUBY_INCLUDE_DIR RUBY_LIBRARY) -IF(_RUBY_VERSION_SHORT_NODOT GREATER 18) - LIST(APPEND _RUBY_REQUIRED_VARS RUBY_CONFIG_INCLUDE_DIR) -ENDIF(_RUBY_VERSION_SHORT_NODOT GREATER 18) - -IF(_RUBY_DEBUG_OUTPUT) - MESSAGE(STATUS "--------FindRuby.cmake debug------------") - MESSAGE(STATUS "_RUBY_POSSIBLE_EXECUTABLE_NAMES: ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}") - MESSAGE(STATUS "_RUBY_POSSIBLE_LIB_NAMES: ${_RUBY_POSSIBLE_LIB_NAMES}") - MESSAGE(STATUS "RUBY_ARCH_DIR: ${RUBY_ARCH_DIR}") - MESSAGE(STATUS "RUBY_HDR_DIR: ${RUBY_HDR_DIR}") - MESSAGE(STATUS "RUBY_POSSIBLE_LIB_DIR: ${RUBY_POSSIBLE_LIB_DIR}") - MESSAGE(STATUS "Found RUBY_VERSION: \"${RUBY_VERSION}\" , short: \"${_RUBY_VERSION_SHORT}\", nodot: \"${_RUBY_VERSION_SHORT_NODOT}\"") - MESSAGE(STATUS "_RUBY_REQUIRED_VARS: ${_RUBY_REQUIRED_VARS}") - MESSAGE(STATUS "RUBY_EXECUTABLE: ${RUBY_EXECUTABLE}") - MESSAGE(STATUS "RUBY_LIBRARY: ${RUBY_LIBRARY}") - MESSAGE(STATUS "RUBY_INCLUDE_DIR: ${RUBY_INCLUDE_DIR}") - MESSAGE(STATUS "RUBY_CONFIG_INCLUDE_DIR: ${RUBY_CONFIG_INCLUDE_DIR}") - MESSAGE(STATUS "--------------------") -ENDIF(_RUBY_DEBUG_OUTPUT) +endif() + +find_library(RUBY_LIBRARY NAMES ${_RUBY_POSSIBLE_LIB_NAMES} HINTS ${RUBY_POSSIBLE_LIB_DIR} ) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +set(_RUBY_REQUIRED_VARS RUBY_EXECUTABLE RUBY_INCLUDE_DIR RUBY_LIBRARY) +if(_RUBY_VERSION_SHORT_NODOT GREATER 18) + list(APPEND _RUBY_REQUIRED_VARS RUBY_CONFIG_INCLUDE_DIR) +endif() + +if(_RUBY_DEBUG_OUTPUT) + message(STATUS "--------FindRuby.cmake debug------------") + message(STATUS "_RUBY_POSSIBLE_EXECUTABLE_NAMES: ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}") + message(STATUS "_RUBY_POSSIBLE_LIB_NAMES: ${_RUBY_POSSIBLE_LIB_NAMES}") + message(STATUS "RUBY_ARCH_DIR: ${RUBY_ARCH_DIR}") + message(STATUS "RUBY_HDR_DIR: ${RUBY_HDR_DIR}") + message(STATUS "RUBY_POSSIBLE_LIB_DIR: ${RUBY_POSSIBLE_LIB_DIR}") + message(STATUS "Found RUBY_VERSION: \"${RUBY_VERSION}\" , short: \"${_RUBY_VERSION_SHORT}\", nodot: \"${_RUBY_VERSION_SHORT_NODOT}\"") + message(STATUS "_RUBY_REQUIRED_VARS: ${_RUBY_REQUIRED_VARS}") + message(STATUS "RUBY_EXECUTABLE: ${RUBY_EXECUTABLE}") + message(STATUS "RUBY_LIBRARY: ${RUBY_LIBRARY}") + message(STATUS "RUBY_INCLUDE_DIR: ${RUBY_INCLUDE_DIR}") + message(STATUS "RUBY_CONFIG_INCLUDE_DIR: ${RUBY_CONFIG_INCLUDE_DIR}") + message(STATUS "--------------------") +endif() FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ruby REQUIRED_VARS ${_RUBY_REQUIRED_VARS} VERSION_VAR RUBY_VERSION ) -MARK_AS_ADVANCED( +mark_as_advanced( RUBY_EXECUTABLE RUBY_LIBRARY RUBY_INCLUDE_DIR @@ -238,6 +238,6 @@ MARK_AS_ADVANCED( ) # Set some variables for compatibility with previous version of this file -SET(RUBY_POSSIBLE_LIB_PATH ${RUBY_POSSIBLE_LIB_DIR}) -SET(RUBY_RUBY_LIB_PATH ${RUBY_RUBY_LIB_DIR}) -SET(RUBY_INCLUDE_PATH ${RUBY_INCLUDE_DIRS}) +set(RUBY_POSSIBLE_LIB_PATH ${RUBY_POSSIBLE_LIB_DIR}) +set(RUBY_RUBY_LIB_PATH ${RUBY_RUBY_LIB_DIR}) +set(RUBY_INCLUDE_PATH ${RUBY_INCLUDE_DIRS}) diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index 1c04726ea..fec142ed5 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -1,27 +1,28 @@ -# Locate SDL library +# - Locate SDL library # This module defines -# SDL_LIBRARY, the name of the library to link against -# SDL_FOUND, if false, do not try to link to SDL -# SDL_INCLUDE_DIR, where to find SDL.h +# SDL_LIBRARY, the name of the library to link against +# SDL_FOUND, if false, do not try to link to SDL +# SDL_INCLUDE_DIR, where to find SDL.h +# SDL_VERSION_STRING, human-readable string containing the version of SDL # # This module responds to the the flag: -# SDL_BUILDING_LIBRARY -# If this is defined, then no SDL_main will be linked in because -# only applications need main(). -# Otherwise, it is assumed you are building an application and this -# module will attempt to locate and set the the proper link flags -# as part of the returned SDL_LIBRARY variable. +# SDL_BUILDING_LIBRARY +# If this is defined, then no SDL_main will be linked in because +# only applications need main(). +# Otherwise, it is assumed you are building an application and this +# module will attempt to locate and set the the proper link flags +# as part of the returned SDL_LIBRARY variable. # -# Don't forget to include SDLmain.h and SDLmain.m your project for the +# Don't forget to include SDLmain.h and SDLmain.m your project for the # OS X framework based version. (Other versions link to -lSDLmain which -# this module will try to find on your behalf.) Also for OS X, this +# this module will try to find on your behalf.) Also for OS X, this # module will automatically add the -framework Cocoa on your behalf. # # # Additional Note: If you see an empty SDL_LIBRARY_TEMP in your configuration -# and no SDL_LIBRARY, it means CMake did not find your SDL library -# (SDL.dll, libsdl.so, SDL.framework, etc). -# Set SDL_LIBRARY_TEMP to point to your SDL library, and configure again. +# and no SDL_LIBRARY, it means CMake did not find your SDL library +# (SDL.dll, libsdl.so, SDL.framework, etc). +# Set SDL_LIBRARY_TEMP to point to your SDL library, and configure again. # Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this value # as appropriate. These values are used to generate the final SDL_LIBRARY # variable, but when these values are unset, SDL_LIBRARY does not get created. @@ -32,18 +33,18 @@ # used in building SDL. # l.e.galup 9-20-02 # -# Modified by Eric Wing. +# Modified by Eric Wing. # Added code to assist with automated building by using environmental variables # and providing a more controlled/consistent search behavior. -# Added new modifications to recognize OS X frameworks and -# additional Unix paths (FreeBSD, etc). +# Added new modifications to recognize OS X frameworks and +# additional Unix paths (FreeBSD, etc). # Also corrected the header search path to follow "proper" SDL guidelines. # Added a search for SDLmain which is needed by some platforms. # Added a search for threads which is needed by some platforms. # Added needed compile switches for MinGW. # # On OSX, this will prefer the Framework version (if found) over others. -# People will have to manually change the cache values of +# People will have to manually change the cache values of # SDL_LIBRARY to override this selection or set the CMake environment # CMAKE_INCLUDE_PATH to modify the search paths. # @@ -54,6 +55,7 @@ #============================================================================= # Copyright 2003-2009 Kitware, Inc. +# Copyright 2012 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -65,109 +67,112 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(SDL_INCLUDE_DIR SDL.h +find_path(SDL_INCLUDE_DIR SDL.h HINTS - $ENV{SDLDIR} - PATH_SUFFIXES include/SDL include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include/SDL12 - /usr/local/include/SDL11 # FreeBSD ports - /usr/include/SDL12 - /usr/include/SDL11 - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt + ENV SDLDIR + PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include ) # SDL-1.1 is the name used by FreeBSD ports... # don't confuse it for the version number. -FIND_LIBRARY(SDL_LIBRARY_TEMP +find_library(SDL_LIBRARY_TEMP NAMES SDL SDL-1.1 HINTS - $ENV{SDLDIR} - PATH_SUFFIXES lib64 lib - PATHS - /sw - /opt/local - /opt/csw - /opt + ENV SDLDIR + PATH_SUFFIXES lib ) -IF(NOT SDL_BUILDING_LIBRARY) - IF(NOT ${SDL_INCLUDE_DIR} MATCHES ".framework") - # Non-OS X framework versions expect you to also dynamically link to - # SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms +if(NOT SDL_BUILDING_LIBRARY) + if(NOT ${SDL_INCLUDE_DIR} MATCHES ".framework") + # Non-OS X framework versions expect you to also dynamically link to + # SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms # seem to provide SDLmain for compatibility even though they don't # necessarily need it. - FIND_LIBRARY(SDLMAIN_LIBRARY + find_library(SDLMAIN_LIBRARY NAMES SDLmain SDLmain-1.1 HINTS - $ENV{SDLDIR} - PATH_SUFFIXES lib64 lib + ENV SDLDIR + PATH_SUFFIXES lib PATHS /sw /opt/local /opt/csw /opt ) - ENDIF(NOT ${SDL_INCLUDE_DIR} MATCHES ".framework") -ENDIF(NOT SDL_BUILDING_LIBRARY) + endif() +endif() # SDL may require threads on your system. -# The Apple build may not need an explicit flag because one of the -# frameworks may already provide it. +# The Apple build may not need an explicit flag because one of the +# frameworks may already provide it. # But for non-OSX systems, I will use the CMake Threads package. -IF(NOT APPLE) - FIND_PACKAGE(Threads) -ENDIF(NOT APPLE) +if(NOT APPLE) + find_package(Threads) +endif() # MinGW needs an additional library, mwindows # It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows # (Actually on second look, I think it only needs one of the m* libraries.) -IF(MINGW) - SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW") -ENDIF(MINGW) +if(MINGW) + set(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW") +endif() -IF(SDL_LIBRARY_TEMP) +if(SDL_LIBRARY_TEMP) # For SDLmain - IF(NOT SDL_BUILDING_LIBRARY) - IF(SDLMAIN_LIBRARY) - SET(SDL_LIBRARY_TEMP ${SDLMAIN_LIBRARY} ${SDL_LIBRARY_TEMP}) - ENDIF(SDLMAIN_LIBRARY) - ENDIF(NOT SDL_BUILDING_LIBRARY) + if(SDLMAIN_LIBRARY AND NOT SDL_BUILDING_LIBRARY) + list(FIND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" _SDL_MAIN_INDEX) + if(_SDL_MAIN_INDEX EQUAL -1) + set(SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" ${SDL_LIBRARY_TEMP}) + endif() + unset(_SDL_MAIN_INDEX) + endif() # For OS X, SDL uses Cocoa as a backend so it must link to Cocoa. - # CMake doesn't display the -framework Cocoa string in the UI even + # CMake doesn't display the -framework Cocoa string in the UI even # though it actually is there if I modify a pre-used variable. # I think it has something to do with the CACHE STRING. - # So I use a temporary variable until the end so I can set the + # So I use a temporary variable until the end so I can set the # "real" variable in one-shot. - IF(APPLE) - SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} "-framework Cocoa") - ENDIF(APPLE) - + if(APPLE) + set(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} "-framework Cocoa") + endif() + # For threads, as mentioned Apple doesn't need this. # In fact, there seems to be a problem if I used the Threads package # and try using this line, so I'm just skipping it entirely for OS X. - IF(NOT APPLE) - SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT}) - ENDIF(NOT APPLE) + if(NOT APPLE) + set(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT}) + endif() # For MinGW library - IF(MINGW) - SET(SDL_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL_LIBRARY_TEMP}) - ENDIF(MINGW) + if(MINGW) + set(SDL_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL_LIBRARY_TEMP}) + endif() # Set the final string here so the GUI reflects the final state. - SET(SDL_LIBRARY ${SDL_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found") + set(SDL_LIBRARY ${SDL_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found") # Set the temp variable to INTERNAL so it is not seen in the CMake GUI - SET(SDL_LIBRARY_TEMP "${SDL_LIBRARY_TEMP}" CACHE INTERNAL "") -ENDIF(SDL_LIBRARY_TEMP) + set(SDL_LIBRARY_TEMP "${SDL_LIBRARY_TEMP}" CACHE INTERNAL "") +endif() + +if(SDL_INCLUDE_DIR AND EXISTS "${SDL_INCLUDE_DIR}/SDL_version.h") + file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MINOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_PATCHLEVEL[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_VERSION_MAJOR "${SDL_VERSION_MAJOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_VERSION_MINOR "${SDL_VERSION_MINOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_VERSION_PATCH "${SDL_VERSION_PATCH_LINE}") + set(SDL_VERSION_STRING ${SDL_VERSION_MAJOR}.${SDL_VERSION_MINOR}.${SDL_VERSION_PATCH}) + unset(SDL_VERSION_MAJOR_LINE) + unset(SDL_VERSION_MINOR_LINE) + unset(SDL_VERSION_PATCH_LINE) + unset(SDL_VERSION_MAJOR) + unset(SDL_VERSION_MINOR) + unset(SDL_VERSION_PATCH) +endif() -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL - REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR) + REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR + VERSION_VAR SDL_VERSION_STRING) diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake index f215bda47..30d74acfb 100644 --- a/Modules/FindSDL_image.cmake +++ b/Modules/FindSDL_image.cmake @@ -1,19 +1,26 @@ -# Locate SDL_image library -# This module defines -# SDLIMAGE_LIBRARY, the name of the library to link against -# SDLIMAGE_FOUND, if false, do not try to link to SDL -# SDLIMAGE_INCLUDE_DIR, where to find SDL/SDL.h +# - Locate SDL_image library +# This module defines: +# SDL_IMAGE_LIBRARIES, the name of the library to link against +# SDL_IMAGE_INCLUDE_DIRS, where to find the headers +# SDL_IMAGE_FOUND, if false, do not try to link against +# SDL_IMAGE_VERSION_STRING - human-readable string containing the version of SDL_image +# +# For backward compatiblity the following variables are also set: +# SDLIMAGE_LIBRARY (same value as SDL_IMAGE_LIBRARIES) +# SDLIMAGE_INCLUDE_DIR (same value as SDL_IMAGE_INCLUDE_DIRS) +# SDLIMAGE_FOUND (same value as SDL_IMAGE_FOUND) # # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR # used in building SDL. # -# Created by Eric Wing. This was influenced by the FindSDL.cmake -# module, but with modifications to recognize OS X frameworks and +# Created by Eric Wing. This was influenced by the FindSDL.cmake +# module, but with modifications to recognize OS X frameworks and # additional Unix paths (FreeBSD, etc). #============================================================================= # Copyright 2005-2009 Kitware, Inc. +# Copyright 2012 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -25,46 +32,57 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(SDLIMAGE_INCLUDE_DIR SDL_image.h +if(NOT SDL_IMAGE_INCLUDE_DIR AND SDLIMAGE_INCLUDE_DIR) + set(SDL_IMAGE_INCLUDE_DIR ${SDLIMAGE_INCLUDE_DIR} CACHE PATH "directory cache +entry initialized from old variable name") +endif() +find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h HINTS - $ENV{SDLIMAGEDIR} - $ENV{SDLDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include/SDL - /usr/include/SDL - /usr/local/include/SDL12 - /usr/local/include/SDL11 # FreeBSD ports - /usr/include/SDL12 - /usr/include/SDL11 - /sw/include/SDL # Fink - /sw/include - /opt/local/include/SDL # DarwinPorts - /opt/local/include - /opt/csw/include/SDL # Blastwave - /opt/csw/include - /opt/include/SDL - /opt/include + ENV SDLIMAGEDIR + ENV SDLDIR + PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include ) -FIND_LIBRARY(SDLIMAGE_LIBRARY +if(NOT SDL_IMAGE_LIBRARY AND SDLIMAGE_LIBRARY) + set(SDL_IMAGE_LIBRARY ${SDLIMAGE_LIBRARY} CACHE FILEPATH "file cache entry +initialized from old variable name") +endif() +find_library(SDL_IMAGE_LIBRARY NAMES SDL_image HINTS - $ENV{SDLIMAGEDIR} - $ENV{SDLDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt + ENV SDLIMAGEDIR + ENV SDLDIR + PATH_SUFFIXES lib ) -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +if(SDL_IMAGE_INCLUDE_DIR AND EXISTS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h") + file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_MAJOR "${SDL_IMAGE_VERSION_MAJOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_MINOR "${SDL_IMAGE_VERSION_MINOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_PATCH "${SDL_IMAGE_VERSION_PATCH_LINE}") + set(SDL_IMAGE_VERSION_STRING ${SDL_IMAGE_VERSION_MAJOR}.${SDL_IMAGE_VERSION_MINOR}.${SDL_IMAGE_VERSION_PATCH}) + unset(SDL_IMAGE_VERSION_MAJOR_LINE) + unset(SDL_IMAGE_VERSION_MINOR_LINE) + unset(SDL_IMAGE_VERSION_PATCH_LINE) + unset(SDL_IMAGE_VERSION_MAJOR) + unset(SDL_IMAGE_VERSION_MINOR) + unset(SDL_IMAGE_VERSION_PATCH) +endif() + +set(SDL_IMAGE_LIBRARIES ${SDL_IMAGE_LIBRARY}) +set(SDL_IMAGE_INCLUDE_DIRS ${SDL_IMAGE_INCLUDE_DIR}) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_image + REQUIRED_VARS SDL_IMAGE_LIBRARIES SDL_IMAGE_INCLUDE_DIRS + VERSION_VAR SDL_IMAGE_VERSION_STRING) + +# for backward compatiblity +set(SDLIMAGE_LIBRARY ${SDL_IMAGE_LIBRARIES}) +set(SDLIMAGE_INCLUDE_DIR ${SDL_IMAGE_INCLUDE_DIRS}) +set(SDLIMAGE_FOUND ${SDL_IMAGE_FOUND}) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLIMAGE - REQUIRED_VARS SDLIMAGE_LIBRARY SDLIMAGE_INCLUDE_DIR) +mark_as_advanced(SDL_IMAGE_LIBRARY SDL_IMAGE_INCLUDE_DIR) diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake index 7cc1a6b09..8ca7cc33c 100644 --- a/Modules/FindSDL_mixer.cmake +++ b/Modules/FindSDL_mixer.cmake @@ -1,19 +1,26 @@ -# Locate SDL_mixer library -# This module defines -# SDLMIXER_LIBRARY, the name of the library to link against -# SDLMIXER_FOUND, if false, do not try to link to SDL -# SDLMIXER_INCLUDE_DIR, where to find SDL/SDL.h +# - Locate SDL_mixer library +# This module defines: +# SDL_MIXER_LIBRARIES, the name of the library to link against +# SDL_MIXER_INCLUDE_DIRS, where to find the headers +# SDL_MIXER_FOUND, if false, do not try to link against +# SDL_MIXER_VERSION_STRING - human-readable string containing the version of SDL_mixer +# +# For backward compatiblity the following variables are also set: +# SDLMIXER_LIBRARY (same value as SDL_MIXER_LIBRARIES) +# SDLMIXER_INCLUDE_DIR (same value as SDL_MIXER_INCLUDE_DIRS) +# SDLMIXER_FOUND (same value as SDL_MIXER_FOUND) # # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR # used in building SDL. # -# Created by Eric Wing. This was influenced by the FindSDL.cmake -# module, but with modifications to recognize OS X frameworks and +# Created by Eric Wing. This was influenced by the FindSDL.cmake +# module, but with modifications to recognize OS X frameworks and # additional Unix paths (FreeBSD, etc). #============================================================================= # Copyright 2005-2009 Kitware, Inc. +# Copyright 2012 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -25,46 +32,57 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(SDLMIXER_INCLUDE_DIR SDL_mixer.h +if(NOT SDL_MIXER_INCLUDE_DIR AND SDLMIXER_INCLUDE_DIR) + set(SDL_MIXER_INCLUDE_DIR ${SDLMIXER_INCLUDE_DIR} CACHE PATH "directory cache +entry initialized from old variable name") +endif() +find_path(SDL_MIXER_INCLUDE_DIR SDL_mixer.h HINTS - $ENV{SDLMIXERDIR} - $ENV{SDLDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include/SDL - /usr/include/SDL - /usr/local/include/SDL12 - /usr/local/include/SDL11 # FreeBSD ports - /usr/include/SDL12 - /usr/include/SDL11 - /sw/include/SDL # Fink - /sw/include - /opt/local/include/SDL # DarwinPorts - /opt/local/include - /opt/csw/include/SDL # Blastwave - /opt/csw/include - /opt/include/SDL - /opt/include + ENV SDLMIXERDIR + ENV SDLDIR + PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include ) -FIND_LIBRARY(SDLMIXER_LIBRARY +if(NOT SDL_MIXER_LIBRARY AND SDLMIXER_LIBRARY) + set(SDL_MIXER_LIBRARY ${SDLMIXER_LIBRARY} CACHE FILEPATH "file cache entry +initialized from old variable name") +endif() +find_library(SDL_MIXER_LIBRARY NAMES SDL_mixer HINTS - $ENV{SDLMIXERDIR} - $ENV{SDLDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt + ENV SDLMIXERDIR + ENV SDLDIR + PATH_SUFFIXES lib ) -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +if(SDL_MIXER_INCLUDE_DIR AND EXISTS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h") + file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_MAJOR "${SDL_MIXER_VERSION_MAJOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_MINOR "${SDL_MIXER_VERSION_MINOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_PATCH "${SDL_MIXER_VERSION_PATCH_LINE}") + set(SDL_MIXER_VERSION_STRING ${SDL_MIXER_VERSION_MAJOR}.${SDL_MIXER_VERSION_MINOR}.${SDL_MIXER_VERSION_PATCH}) + unset(SDL_MIXER_VERSION_MAJOR_LINE) + unset(SDL_MIXER_VERSION_MINOR_LINE) + unset(SDL_MIXER_VERSION_PATCH_LINE) + unset(SDL_MIXER_VERSION_MAJOR) + unset(SDL_MIXER_VERSION_MINOR) + unset(SDL_MIXER_VERSION_PATCH) +endif() + +set(SDL_MIXER_LIBRARIES ${SDL_MIXER_LIBRARY}) +set(SDL_MIXER_INCLUDE_DIRS ${SDL_MIXER_INCLUDE_DIR}) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_mixer + REQUIRED_VARS SDL_MIXER_LIBRARIES SDL_MIXER_INCLUDE_DIRS + VERSION_VAR SDL_MIXER_VERSION_STRING) + +# for backward compatiblity +set(SDLMIXER_LIBRARY ${SDL_MIXER_LIBRARIES}) +set(SDLMIXER_INCLUDE_DIR ${SDL_MIXER_INCLUDE_DIRS}) +set(SDLMIXER_FOUND ${SDL_MIXER_FOUND}) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLMIXER - REQUIRED_VARS SDLMIXER_LIBRARY SDLMIXER_INCLUDE_DIR) +mark_as_advanced(SDL_MIXER_LIBRARY SDL_MIXER_INCLUDE_DIR) diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake index ca1de7977..ca707af8d 100644 --- a/Modules/FindSDL_net.cmake +++ b/Modules/FindSDL_net.cmake @@ -1,19 +1,26 @@ -# Locate SDL_net library -# This module defines -# SDLNET_LIBRARY, the name of the library to link against -# SDLNET_FOUND, if false, do not try to link against -# SDLNET_INCLUDE_DIR, where to find the headers +# - Locate SDL_net library +# This module defines: +# SDL_NET_LIBRARIES, the name of the library to link against +# SDL_NET_INCLUDE_DIRS, where to find the headers +# SDL_NET_FOUND, if false, do not try to link against +# SDL_NET_VERSION_STRING - human-readable string containing the version of SDL_net +# +# For backward compatiblity the following variables are also set: +# SDLNET_LIBRARY (same value as SDL_NET_LIBRARIES) +# SDLNET_INCLUDE_DIR (same value as SDL_NET_INCLUDE_DIRS) +# SDLNET_FOUND (same value as SDL_NET_FOUND) # # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR # used in building SDL. # -# Created by Eric Wing. This was influenced by the FindSDL.cmake -# module, but with modifications to recognize OS X frameworks and +# Created by Eric Wing. This was influenced by the FindSDL.cmake +# module, but with modifications to recognize OS X frameworks and # additional Unix paths (FreeBSD, etc). #============================================================================= # Copyright 2005-2009 Kitware, Inc. +# Copyright 2012 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -25,45 +32,57 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(SDLNET_INCLUDE_DIR SDL_net.h +if(NOT SDL_NET_INCLUDE_DIR AND SDLNET_INCLUDE_DIR) + set(SDL_NET_INCLUDE_DIR ${SDLNET_INCLUDE_DIR} CACHE PATH "directory cache +entry initialized from old variable name") +endif() +find_path(SDL_NET_INCLUDE_DIR SDL_net.h HINTS - $ENV{SDLNETDIR} - $ENV{SDLDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include/SDL - /usr/include/SDL - /usr/local/include/SDL12 - /usr/local/include/SDL11 # FreeBSD ports - /usr/include/SDL12 - /usr/include/SDL11 - /sw/include/SDL # Fink - /sw/include - /opt/local/include/SDL # DarwinPorts - /opt/local/include - /opt/csw/include/SDL # Blastwave - /opt/csw/include - /opt/include/SDL - /opt/include + ENV SDLNETDIR + ENV SDLDIR + PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include ) -FIND_LIBRARY(SDLNET_LIBRARY + +if(NOT SDL_NET_LIBRARY AND SDLNET_LIBRARY) + set(SDL_NET_LIBRARY ${SDLNET_LIBRARY} CACHE FILEPATH "file cache entry +initialized from old variable name") +endif() +find_library(SDL_NET_LIBRARY NAMES SDL_net HINTS - $ENV{SDLNETDIR} - $ENV{SDLDIR} - PATH_SUFFIXES lib64 lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt + ENV SDLNETDIR + ENV SDLDIR + PATH_SUFFIXES lib ) -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +if(SDL_NET_INCLUDE_DIR AND EXISTS "${SDL_NET_INCLUDE_DIR}/SDL_net.h") + file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_MAJOR "${SDL_NET_VERSION_MAJOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_MINOR "${SDL_NET_VERSION_MINOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_PATCH "${SDL_NET_VERSION_PATCH_LINE}") + set(SDL_NET_VERSION_STRING ${SDL_NET_VERSION_MAJOR}.${SDL_NET_VERSION_MINOR}.${SDL_NET_VERSION_PATCH}) + unset(SDL_NET_VERSION_MAJOR_LINE) + unset(SDL_NET_VERSION_MINOR_LINE) + unset(SDL_NET_VERSION_PATCH_LINE) + unset(SDL_NET_VERSION_MAJOR) + unset(SDL_NET_VERSION_MINOR) + unset(SDL_NET_VERSION_PATCH) +endif() + +set(SDL_NET_LIBRARIES ${SDL_NET_LIBRARY}) +set(SDL_NET_INCLUDE_DIRS ${SDL_NET_INCLUDE_DIR}) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_net + REQUIRED_VARS SDL_NET_LIBRARIES SDL_NET_INCLUDE_DIRS + VERSION_VAR SDL_NET_VERSION_STRING) + +# for backward compatiblity +set(SDLNET_LIBRARY ${SDL_NET_LIBRARIES}) +set(SDLNET_INCLUDE_DIR ${SDL_NET_INCLUDE_DIRS}) +set(SDLNET_FOUND ${SDL_NET_FOUND}) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLNET - REQUIRED_VARS SDLNET_LIBRARY SDLNET_INCLUDE_DIR) +mark_as_advanced(SDL_NET_LIBRARY SDL_NET_INCLUDE_DIR) diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake index 35294a5e4..efd26580b 100644 --- a/Modules/FindSDL_sound.cmake +++ b/Modules/FindSDL_sound.cmake @@ -1,63 +1,63 @@ -# Locates the SDL_sound library - -# This module depends on SDL being found and +# - Locates the SDL_sound library +# +# This module depends on SDL being found and # must be called AFTER FindSDL.cmake is called. - +# # This module defines -# SDL_SOUND_INCLUDE_DIR, where to find SDL_sound.h -# SDL_SOUND_FOUND, if false, do not try to link to SDL -# SDL_SOUND_LIBRARIES, this contains the list of libraries that you need -# to link against. This is a read-only variable and is marked INTERNAL. -# SDL_SOUND_EXTRAS, this is an optional variable for you to add your own -# flags to SDL_SOUND_LIBRARIES. This is prepended to SDL_SOUND_LIBRARIES. -# This is available mostly for cases this module failed to anticipate for -# and you must add additional flags. This is marked as ADVANCED. - +# SDL_SOUND_INCLUDE_DIR, where to find SDL_sound.h +# SDL_SOUND_FOUND, if false, do not try to link to SDL_sound +# SDL_SOUND_LIBRARIES, this contains the list of libraries that you need +# to link against. This is a read-only variable and is marked INTERNAL. +# SDL_SOUND_EXTRAS, this is an optional variable for you to add your own +# flags to SDL_SOUND_LIBRARIES. This is prepended to SDL_SOUND_LIBRARIES. +# This is available mostly for cases this module failed to anticipate for +# and you must add additional flags. This is marked as ADVANCED. +# SDL_SOUND_VERSION_STRING, human-readable string containing the version of SDL_sound # # This module also defines (but you shouldn't need to use directly) -# SDL_SOUND_LIBRARY, the name of just the SDL_sound library you would link -# against. Use SDL_SOUND_LIBRARIES for you link instructions and not this one. +# SDL_SOUND_LIBRARY, the name of just the SDL_sound library you would link +# against. Use SDL_SOUND_LIBRARIES for you link instructions and not this one. # And might define the following as needed -# MIKMOD_LIBRARY -# MODPLUG_LIBRARY -# OGG_LIBRARY -# VORBIS_LIBRARY -# SMPEG_LIBRARY -# FLAC_LIBRARY -# SPEEX_LIBRARY +# MIKMOD_LIBRARY +# MODPLUG_LIBRARY +# OGG_LIBRARY +# VORBIS_LIBRARY +# SMPEG_LIBRARY +# FLAC_LIBRARY +# SPEEX_LIBRARY # -# Typically, you should not use these variables directly, and you should use -# SDL_SOUND_LIBRARIES which contains SDL_SOUND_LIBRARY and the other audio libraries -# (if needed) to successfully compile on your system . +# Typically, you should not use these variables directly, and you should use +# SDL_SOUND_LIBRARIES which contains SDL_SOUND_LIBRARY and the other audio libraries +# (if needed) to successfully compile on your system. # -# Created by Eric Wing. +# Created by Eric Wing. # This module is a bit more complicated than the other FindSDL* family modules. # The reason is that SDL_sound can be compiled in a large variety of different ways # which are independent of platform. SDL_sound may dynamically link against other 3rd # party libraries to get additional codec support, such as Ogg Vorbis, SMPEG, ModPlug, -# MikMod, FLAC, Speex, and potentially others. -# Under some circumstances which I don't fully understand, +# MikMod, FLAC, Speex, and potentially others. +# Under some circumstances which I don't fully understand, # there seems to be a requirement -# that dependent libraries of libraries you use must also be explicitly -# linked against in order to successfully compile. SDL_sound does not currently +# that dependent libraries of libraries you use must also be explicitly +# linked against in order to successfully compile. SDL_sound does not currently # have any system in place to know how it was compiled. -# So this CMake module does the hard work in trying to discover which 3rd party +# So this CMake module does the hard work in trying to discover which 3rd party # libraries are required for building (if any). # This module uses a brute force approach to create a test program that uses SDL_sound, -# and then tries to build it. If the build fails, it parses the error output for +# and then tries to build it. If the build fails, it parses the error output for # known symbol names to figure out which libraries are needed. # # Responds to the $SDLDIR and $SDLSOUNDDIR environmental variable that would # correspond to the ./configure --prefix=$SDLDIR used in building SDL. # # On OSX, this will prefer the Framework version (if found) over others. -# People will have to manually change the cache values of +# People will have to manually change the cache values of # SDL_LIBRARY to override this selectionor set the CMake environment # CMAKE_INCLUDE_PATH to modify the search paths. -# #============================================================================= # Copyright 2005-2009 Kitware, Inc. +# Copyright 2012 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -69,68 +69,46 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET(SDL_SOUND_EXTRAS "" CACHE STRING "SDL_sound extra flags") -MARK_AS_ADVANCED(SDL_SOUND_EXTRAS) +set(SDL_SOUND_EXTRAS "" CACHE STRING "SDL_sound extra flags") +mark_as_advanced(SDL_SOUND_EXTRAS) # Find SDL_sound.h -FIND_PATH(SDL_SOUND_INCLUDE_DIR SDL_sound.h +find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h HINTS - $ENV{SDLSOUNDDIR}/include - $ENV{SDLSOUNDDIR} - $ENV{SDLDIR}/include - $ENV{SDLDIR} - PATHS - /usr/local/include/SDL - /usr/include/SDL - /usr/local/include/SDL12 - /usr/local/include/SDL11 # FreeBSD ports - /usr/include/SDL12 - /usr/include/SDL11 - /sw/include/SDL # Fink - /sw/include - /opt/local/include/SDL # DarwinPorts - /opt/local/include - /opt/csw/include/SDL # Blastwave - /opt/csw/include - /opt/include/SDL - /opt/include + ENV SDLSOUNDDIR + ENV SDLDIR + PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include ) -FIND_LIBRARY(SDL_SOUND_LIBRARY +find_library(SDL_SOUND_LIBRARY NAMES SDL_sound HINTS - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLSOUNDDIR} - $ENV{SDLDIR}/lib - $ENV{SDLDIR} - PATHS - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib + ENV SDLSOUNDDIR + ENV SDLDIR + PATH_SUFFIXES lib ) -IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) +if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) # CMake is giving me problems using TRY_COMPILE with the CMAKE_FLAGS # for the :STRING syntax if I have multiple values contained in a # single variable. This is a problem for the SDL_LIBRARY variable # because it does just that. When I feed this variable to the command, - # only the first value gets the appropriate modifier (e.g. -I) and + # only the first value gets the appropriate modifier (e.g. -I) and # the rest get dropped. # To get multiple single variables to work, I must separate them with a "\;" # I could go back and modify the FindSDL.cmake module, but that's kind of painful. # The solution would be to try something like: - # SET(SDL_TRY_COMPILE_LIBRARY_LIST "${SDL_TRY_COMPILE_LIBRARY_LIST}\;${CMAKE_THREAD_LIBS_INIT}") + # set(SDL_TRY_COMPILE_LIBRARY_LIST "${SDL_TRY_COMPILE_LIBRARY_LIST}\;${CMAKE_THREAD_LIBS_INIT}") # Instead, it was suggested on the mailing list to write a temporary CMakeLists.txt # with a temporary test project and invoke that with TRY_COMPILE. # See message thread "Figuring out dependencies for a library in order to build" - # 2005-07-16 - # TRY_COMPILE( + # 2005-07-16 + # try_compile( # MY_RESULT # ${CMAKE_BINARY_DIR} # ${PROJECT_SOURCE_DIR}/DetermineSoundLibs.c - # CMAKE_FLAGS + # CMAKE_FLAGS # -DINCLUDE_DIRECTORIES:STRING=${SDL_INCLUDE_DIR}\;${SDL_SOUND_INCLUDE_DIR} # -DLINK_LIBRARIES:STRING=${SDL_SOUND_LIBRARY}\;${SDL_LIBRARY} # OUTPUT_VARIABLE MY_OUTPUT @@ -139,7 +117,7 @@ IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) # To minimize external dependencies, create a sdlsound test program # which will be used to figure out if additional link dependencies are # required for the link phase. - FILE(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/DetermineSoundLibs.c + file(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/DetermineSoundLibs.c "#include \"SDL_sound.h\" #include \"SDL.h\" int main(int argc, char* argv[]) @@ -149,253 +127,258 @@ IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) SDL_Init(0); Sound_Init(); - + /* This doesn't actually have to work, but Init() is a no-op * for some of the decoders, so this should force more symbols * to be pulled in. */ sample = Sound_NewSampleFromFile(argv[1], &desired, 4096); - + Sound_Quit(); SDL_Quit(); return 0; }" ) - # Calling - # TARGET_LINK_LIBRARIES(DetermineSoundLibs "${SDL_SOUND_LIBRARY} ${SDL_LIBRARY}) + # Calling + # target_link_libraries(DetermineSoundLibs "${SDL_SOUND_LIBRARY} ${SDL_LIBRARY}) # causes problems when SDL_LIBRARY looks like # /Library/Frameworks/SDL.framework;-framework Cocoa # The ;-framework Cocoa seems to be confusing CMake once the OS X - # framework support was added. I was told that breaking up the list + # framework support was added. I was told that breaking up the list # would fix the problem. - SET(TMP_TRY_LIBS) - FOREACH(lib ${SDL_SOUND_LIBRARY} ${SDL_LIBRARY}) - SET(TMP_TRY_LIBS "${TMP_TRY_LIBS} \"${lib}\"") - ENDFOREACH(lib) + set(TMP_TRY_LIBS) + foreach(lib ${SDL_SOUND_LIBRARY} ${SDL_LIBRARY}) + set(TMP_TRY_LIBS "${TMP_TRY_LIBS} \"${lib}\"") + endforeach() + + # message("TMP_TRY_LIBS ${TMP_TRY_LIBS}") - # MESSAGE("TMP_TRY_LIBS ${TMP_TRY_LIBS}") - # Write the CMakeLists.txt and test project # Weird, this is still sketchy. If I don't quote the variables - # in the TARGET_LINK_LIBRARIES, I seem to loose everything + # in the TARGET_LINK_LIBRARIES, I seem to loose everything # in the SDL_LIBRARY string after the "-framework". # But if I quote the stuff in INCLUDE_DIRECTORIES, it doesn't work. - FILE(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/CMakeLists.txt - "PROJECT(DetermineSoundLibs) - INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) - ADD_EXECUTABLE(DetermineSoundLibs DetermineSoundLibs.c) - TARGET_LINK_LIBRARIES(DetermineSoundLibs ${TMP_TRY_LIBS})" + file(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/CMakeLists.txt + "cmake_minimum_required(VERSION 2.8) + project(DetermineSoundLibs) + include_directories(${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + add_executable(DetermineSoundLibs DetermineSoundLibs.c) + target_link_libraries(DetermineSoundLibs ${TMP_TRY_LIBS})" ) - TRY_COMPILE( + try_compile( MY_RESULT ${PROJECT_BINARY_DIR}/CMakeTmp ${PROJECT_BINARY_DIR}/CMakeTmp DetermineSoundLibs OUTPUT_VARIABLE MY_OUTPUT ) - - # MESSAGE("${MY_RESULT}") - # MESSAGE(${MY_OUTPUT}) - - IF(NOT MY_RESULT) - + + # message("${MY_RESULT}") + # message(${MY_OUTPUT}) + + if(NOT MY_RESULT) + # I expect that MPGLIB, VOC, WAV, AIFF, and SHN are compiled in statically. # I think Timidity is also compiled in statically. # I've never had to explcitly link against Quicktime, so I'll skip that for now. - - SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARY}) - + + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARY}) + # Find MikMod - IF("${MY_OUTPUT}" MATCHES "MikMod_") - FIND_LIBRARY(MIKMOD_LIBRARY + if("${MY_OUTPUT}" MATCHES "MikMod_") + find_library(MIKMOD_LIBRARY NAMES libmikmod-coreaudio mikmod PATHS - $ENV{MIKMODDIR}/lib - $ENV{MIKMODDIR} - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLSOUNDDIR} - $ENV{SDLDIR}/lib - $ENV{SDLDIR} - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - ) - IF(MIKMOD_LIBRARY) - SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MIKMOD_LIBRARY}) - ENDIF(MIKMOD_LIBRARY) - ENDIF("${MY_OUTPUT}" MATCHES "MikMod_") - + ENV MIKMODDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES + lib + ) + if(MIKMOD_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MIKMOD_LIBRARY}) + endif(MIKMOD_LIBRARY) + endif("${MY_OUTPUT}" MATCHES "MikMod_") + # Find ModPlug - IF("${MY_OUTPUT}" MATCHES "MODPLUG_") - FIND_LIBRARY(MODPLUG_LIBRARY + if("${MY_OUTPUT}" MATCHES "MODPLUG_") + find_library(MODPLUG_LIBRARY NAMES modplug PATHS - $ENV{MODPLUGDIR}/lib - $ENV{MODPLUGDIR} - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLSOUNDDIR} - $ENV{SDLDIR}/lib - $ENV{SDLDIR} - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib + ENV MODPLUGDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES + lib ) - IF(MODPLUG_LIBRARY) - SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MODPLUG_LIBRARY}) - ENDIF(MODPLUG_LIBRARY) - ENDIF("${MY_OUTPUT}" MATCHES "MODPLUG_") + if(MODPLUG_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MODPLUG_LIBRARY}) + endif() + endif() + - # Find Ogg and Vorbis - IF("${MY_OUTPUT}" MATCHES "ov_") - FIND_LIBRARY(VORBIS_LIBRARY + if("${MY_OUTPUT}" MATCHES "ov_") + find_library(VORBIS_LIBRARY NAMES vorbis Vorbis VORBIS PATHS - $ENV{VORBISDIR}/lib - $ENV{VORBISDIR} - $ENV{OGGDIR}/lib - $ENV{OGGDIR} - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLSOUNDDIR} - $ENV{SDLDIR}/lib - $ENV{SDLDIR} - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib + ENV VORBISDIR + ENV OGGDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES + lib ) - IF(VORBIS_LIBRARY) - SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${VORBIS_LIBRARY}) - ENDIF(VORBIS_LIBRARY) - - FIND_LIBRARY(OGG_LIBRARY + if(VORBIS_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${VORBIS_LIBRARY}) + endif() + + find_library(OGG_LIBRARY NAMES ogg Ogg OGG PATHS - $ENV{OGGDIR}/lib - $ENV{OGGDIR} - $ENV{VORBISDIR}/lib - $ENV{VORBISDIR} - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLSOUNDDIR} - $ENV{SDLDIR}/lib - $ENV{SDLDIR} - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib + ENV OGGDIR + ENV VORBISDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES + lib ) - IF(OGG_LIBRARY) - SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY}) - ENDIF(OGG_LIBRARY) - ENDIF("${MY_OUTPUT}" MATCHES "ov_") - - + if(OGG_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY}) + endif() + endif() + + # Find SMPEG - IF("${MY_OUTPUT}" MATCHES "SMPEG_") - FIND_LIBRARY(SMPEG_LIBRARY + if("${MY_OUTPUT}" MATCHES "SMPEG_") + find_library(SMPEG_LIBRARY NAMES smpeg SMPEG Smpeg SMpeg PATHS - $ENV{SMPEGDIR}/lib - $ENV{SMPEGDIR} - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLSOUNDDIR} - $ENV{SDLDIR}/lib - $ENV{SDLDIR} - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib + ENV SMPEGDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES + lib ) - IF(SMPEG_LIBRARY) - SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SMPEG_LIBRARY}) - ENDIF(SMPEG_LIBRARY) - ENDIF("${MY_OUTPUT}" MATCHES "SMPEG_") - - + if(SMPEG_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SMPEG_LIBRARY}) + endif() + endif() + + # Find FLAC - IF("${MY_OUTPUT}" MATCHES "FLAC_") - FIND_LIBRARY(FLAC_LIBRARY + if("${MY_OUTPUT}" MATCHES "FLAC_") + find_library(FLAC_LIBRARY NAMES flac FLAC PATHS - $ENV{FLACDIR}/lib - $ENV{FLACDIR} - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLSOUNDDIR} - $ENV{SDLDIR}/lib - $ENV{SDLDIR} - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib + ENV FLACDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES + lib ) - IF(FLAC_LIBRARY) - SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${FLAC_LIBRARY}) - ENDIF(FLAC_LIBRARY) - ENDIF("${MY_OUTPUT}" MATCHES "FLAC_") - - + if(FLAC_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${FLAC_LIBRARY}) + endif() + endif() + + # Hmmm...Speex seems to depend on Ogg. This might be a problem if # the TRY_COMPILE attempt gets blocked at SPEEX before it can pull # in the Ogg symbols. I'm not sure if I should duplicate the ogg stuff # above for here or if two ogg entries will screw up things. - IF("${MY_OUTPUT}" MATCHES "speex_") - FIND_LIBRARY(SPEEX_LIBRARY + if("${MY_OUTPUT}" MATCHES "speex_") + find_library(SPEEX_LIBRARY NAMES speex SPEEX PATHS - $ENV{SPEEXDIR}/lib - $ENV{SPEEXDIR} - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLSOUNDDIR} - $ENV{SDLDIR}/lib - $ENV{SDLDIR} - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib + ENV SPEEXDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES + lib ) - IF(SPEEX_LIBRARY) - SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SPEEX_LIBRARY}) - ENDIF(SPEEX_LIBRARY) - + if(SPEEX_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SPEEX_LIBRARY}) + endif() + # Find OGG (needed for Speex) # We might have already found Ogg for Vorbis, so skip it if so. - IF(NOT OGG_LIBRARY) - FIND_LIBRARY(OGG_LIBRARY + if(NOT OGG_LIBRARY) + find_library(OGG_LIBRARY NAMES ogg Ogg OGG PATHS - $ENV{OGGDIR}/lib - $ENV{OGGDIR} - $ENV{VORBISDIR}/lib - $ENV{VORBISDIR} - $ENV{SPEEXDIR}/lib - $ENV{SPEEXDIR} - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLSOUNDDIR} - $ENV{SDLDIR}/lib - $ENV{SDLDIR} - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib + ENV OGGDIR + ENV VORBISDIR + ENV SPEEXDIR + ENV SDLSOUNDDIR + ENV SDLDIR + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib ) - IF(OGG_LIBRARY) - SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY}) - ENDIF(OGG_LIBRARY) - ENDIF(NOT OGG_LIBRARY) - ENDIF("${MY_OUTPUT}" MATCHES "speex_") - - ELSE(NOT MY_RESULT) - SET(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARY}" CACHE INTERNAL "SDL_sound and dependent libraries") - ENDIF(NOT MY_RESULT) - - SET(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARIES_TMP}" CACHE INTERNAL "SDL_sound and dependent libraries") - ENDIF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) - -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_SOUND - REQUIRED_VARS SDL_SOUND_LIBRARIES SDL_SOUND_INCLUDE_DIR) + if(OGG_LIBRARY) + set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY}) + endif() + endif() + endif() + + else() + set(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARY}" CACHE INTERNAL "SDL_sound and dependent libraries") + endif() + + set(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARIES_TMP}" CACHE INTERNAL "SDL_sound and dependent libraries") + endif() + +if(SDL_SOUND_INCLUDE_DIR AND EXISTS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h") + file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SOUND_VER_MAJOR[ \t]+[0-9]+$") + file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_MINOR_LINE REGEX "^#define[ \t]+SOUND_VER_MINOR[ \t]+[0-9]+$") + file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_PATCH_LINE REGEX "^#define[ \t]+SOUND_VER_PATCH[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+SOUND_VER_MAJOR[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_MAJOR "${SDL_SOUND_VERSION_MAJOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SOUND_VER_MINOR[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_MINOR "${SDL_SOUND_VERSION_MINOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SOUND_VER_PATCH[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_PATCH "${SDL_SOUND_VERSION_PATCH_LINE}") + set(SDL_SOUND_VERSION_STRING ${SDL_SOUND_VERSION_MAJOR}.${SDL_SOUND_VERSION_MINOR}.${SDL_SOUND_VERSION_PATCH}) + unset(SDL_SOUND_VERSION_MAJOR_LINE) + unset(SDL_SOUND_VERSION_MINOR_LINE) + unset(SDL_SOUND_VERSION_PATCH_LINE) + unset(SDL_SOUND_VERSION_MAJOR) + unset(SDL_SOUND_VERSION_MINOR) + unset(SDL_SOUND_VERSION_PATCH) +endif() + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_sound + REQUIRED_VARS SDL_SOUND_LIBRARY SDL_SOUND_INCLUDE_DIR + VERSION_VAR SDL_SOUND_VERSION_STRING) diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake index 184b6c3f5..bb0ca9147 100644 --- a/Modules/FindSDL_ttf.cmake +++ b/Modules/FindSDL_ttf.cmake @@ -1,19 +1,26 @@ -# Locate SDL_ttf library -# This module defines -# SDLTTF_LIBRARY, the name of the library to link against -# SDLTTF_FOUND, if false, do not try to link to SDL -# SDLTTF_INCLUDE_DIR, where to find SDL/SDL.h +# - Locate SDL_ttf library +# This module defines: +# SDL_TTF_LIBRARIES, the name of the library to link against +# SDL_TTF_INCLUDE_DIRS, where to find the headers +# SDL_TTF_FOUND, if false, do not try to link against +# SDL_TTF_VERSION_STRING - human-readable string containing the version of SDL_ttf +# +# For backward compatiblity the following variables are also set: +# SDLTTF_LIBRARY (same value as SDL_TTF_LIBRARIES) +# SDLTTF_INCLUDE_DIR (same value as SDL_TTF_INCLUDE_DIRS) +# SDLTTF_FOUND (same value as SDL_TTF_FOUND) # # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR # used in building SDL. # -# Created by Eric Wing. This was influenced by the FindSDL.cmake -# module, but with modifications to recognize OS X frameworks and +# Created by Eric Wing. This was influenced by the FindSDL.cmake +# module, but with modifications to recognize OS X frameworks and # additional Unix paths (FreeBSD, etc). #============================================================================= # Copyright 2005-2009 Kitware, Inc. +# Copyright 2012 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -25,46 +32,57 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(SDLTTF_INCLUDE_DIR SDL_ttf.h +if(NOT SDL_TTF_INCLUDE_DIR AND SDLTTF_INCLUDE_DIR) + set(SDL_TTF_INCLUDE_DIR ${SDLTTF_INCLUDE_DIR} CACHE PATH "directory cache +entry initialized from old variable name") +endif() +find_path(SDL_TTF_INCLUDE_DIR SDL_ttf.h HINTS - $ENV{SDLTTFDIR} - $ENV{SDLDIR} - PATH_SUFFIXES include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include/SDL - /usr/include/SDL - /usr/local/include/SDL12 - /usr/local/include/SDL11 # FreeBSD ports - /usr/include/SDL12 - /usr/include/SDL11 - /sw/include/SDL # Fink - /sw/include - /opt/local/include/SDL # DarwinPorts - /opt/local/include - /opt/csw/include/SDL # Blastwave - /opt/csw/include - /opt/include/SDL - /opt/include + ENV SDLTTFDIR + ENV SDLDIR + PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include ) -FIND_LIBRARY(SDLTTF_LIBRARY +if(NOT SDL_TTF_LIBRARY AND SDLTTF_LIBRARY) + set(SDL_TTF_LIBRARY ${SDLTTF_LIBRARY} CACHE FILEPATH "file cache entry +initialized from old variable name") +endif() +find_library(SDL_TTF_LIBRARY NAMES SDL_ttf HINTS - $ENV{SDLTTFDIR} - $ENV{SDLDIR} - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt - PATH_SUFFIXES lib64 lib + ENV SDLTTFDIR + ENV SDLDIR + PATH_SUFFIXES lib ) -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +if(SDL_TTF_INCLUDE_DIR AND EXISTS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h") + file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_TTF_PATCHLEVEL[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_MAJOR "${SDL_TTF_VERSION_MAJOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_MINOR "${SDL_TTF_VERSION_MINOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_TTF_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_PATCH "${SDL_TTF_VERSION_PATCH_LINE}") + set(SDL_TTF_VERSION_STRING ${SDL_TTF_VERSION_MAJOR}.${SDL_TTF_VERSION_MINOR}.${SDL_TTF_VERSION_PATCH}) + unset(SDL_TTF_VERSION_MAJOR_LINE) + unset(SDL_TTF_VERSION_MINOR_LINE) + unset(SDL_TTF_VERSION_PATCH_LINE) + unset(SDL_TTF_VERSION_MAJOR) + unset(SDL_TTF_VERSION_MINOR) + unset(SDL_TTF_VERSION_PATCH) +endif() + +set(SDL_TTF_LIBRARIES ${SDL_TTF_LIBRARY}) +set(SDL_TTF_INCLUDE_DIRS ${SDL_TTF_INCLUDE_DIR}) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_ttf + REQUIRED_VARS SDL_TTF_LIBRARIES SDL_TTF_INCLUDE_DIRS + VERSION_VAR SDL_TTF_VERSION_STRING) + +# for backward compatiblity +set(SDLTTF_LIBRARY ${SDL_TTF_LIBRARIES}) +set(SDLTTF_INCLUDE_DIR ${SDL_TTF_INCLUDE_DIRS}) +set(SDLTTF_FOUND ${SDL_TTF_FOUND}) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLTTF - REQUIRED_VARS SDLTTF_LIBRARY SDLTTF_INCLUDE_DIR) +mark_as_advanced(SDL_TTF_LIBRARY SDL_TTF_INCLUDE_DIR) diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake index 2e34eb1b4..db60b888c 100644 --- a/Modules/FindSWIG.cmake +++ b/Modules/FindSWIG.cmake @@ -6,7 +6,7 @@ # SWIG_VERSION - the version number of the swig executable # # The minimum required version of SWIG can be specified using the -# standard syntax, e.g. FIND_PACKAGE(SWIG 1.1) +# standard syntax, e.g. find_package(SWIG 1.1) # # All information is collected from the SWIG_EXECUTABLE so the # version to be found can be changed from the command line by @@ -27,42 +27,42 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(SWIG_EXECUTABLE NAMES swig2.0 swig) +find_program(SWIG_EXECUTABLE NAMES swig2.0 swig) -IF(SWIG_EXECUTABLE) - EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -swiglib +if(SWIG_EXECUTABLE) + execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib OUTPUT_VARIABLE SWIG_swiglib_output ERROR_VARIABLE SWIG_swiglib_error RESULT_VARIABLE SWIG_swiglib_result) - IF(SWIG_swiglib_result) - IF(SWIG_FIND_REQUIRED) - MESSAGE(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}") - ELSE(SWIG_FIND_REQUIRED) - MESSAGE(STATUS "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}") - ENDIF(SWIG_FIND_REQUIRED) - ELSE(SWIG_swiglib_result) - STRING(REGEX REPLACE "[\n\r]+" ";" SWIG_swiglib_output ${SWIG_swiglib_output}) + if(SWIG_swiglib_result) + if(SWIG_FIND_REQUIRED) + message(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}") + else() + message(STATUS "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}") + endif() + else() + string(REGEX REPLACE "[\n\r]+" ";" SWIG_swiglib_output ${SWIG_swiglib_output}) # force the path to be computed each time in case SWIG_EXECUTABLE has changed. - SET(SWIG_DIR SWIG_DIR-NOTFOUND) - FIND_PATH(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output}) - IF(SWIG_DIR) - SET(SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake) - EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -version + set(SWIG_DIR SWIG_DIR-NOTFOUND) + find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output}) + if(SWIG_DIR) + set(SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake) + execute_process(COMMAND ${SWIG_EXECUTABLE} -version OUTPUT_VARIABLE SWIG_version_output ERROR_VARIABLE SWIG_version_output RESULT_VARIABLE SWIG_version_result) - IF(SWIG_version_result) - MESSAGE(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -version\" failed with output:\n${SWIG_version_output}") - ELSE(SWIG_version_result) - STRING(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1" + if(SWIG_version_result) + message(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -version\" failed with output:\n${SWIG_version_output}") + else() + string(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1" SWIG_version_output "${SWIG_version_output}") - SET(SWIG_VERSION ${SWIG_version_output} CACHE STRING "Swig version" FORCE) - ENDIF(SWIG_version_result) - ENDIF(SWIG_DIR) - ENDIF(SWIG_swiglib_result) -ENDIF(SWIG_EXECUTABLE) + set(SWIG_VERSION ${SWIG_version_output} CACHE STRING "Swig version" FORCE) + endif() + endif() + endif() +endif() -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWIG REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR VERSION_VAR SWIG_VERSION ) diff --git a/Modules/FindSelfPackers.cmake b/Modules/FindSelfPackers.cmake index ffca84200..fd2864251 100644 --- a/Modules/FindSelfPackers.cmake +++ b/Modules/FindSelfPackers.cmake @@ -1,5 +1,5 @@ # - Find upx -# This module looks for some executable packers (i.e. softwares that +# This module looks for some executable packers (i.e. software that # compress executables or shared libs into on-the-fly self-extracting # executables or shared libs. # Examples: @@ -18,27 +18,27 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(FindCygwin) +include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) -FIND_PROGRAM(SELF_PACKER_FOR_EXECUTABLE +find_program(SELF_PACKER_FOR_EXECUTABLE upx ${CYGWIN_INSTALL_PATH}/bin /bin - /usr/bin + /usr/bin /usr/local/bin /sbin ) -FIND_PROGRAM(SELF_PACKER_FOR_SHARED_LIB +find_program(SELF_PACKER_FOR_SHARED_LIB upx ${CYGWIN_INSTALL_PATH}/bin /bin - /usr/bin + /usr/bin /usr/local/bin /sbin ) -MARK_AS_ADVANCED( +mark_as_advanced( SELF_PACKER_FOR_EXECUTABLE SELF_PACKER_FOR_SHARED_LIB ) @@ -46,23 +46,23 @@ MARK_AS_ADVANCED( # # Set flags # -IF (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx") - SET (SELF_PACKER_FOR_EXECUTABLE_FLAGS "-q" CACHE STRING +if (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx") + set (SELF_PACKER_FOR_EXECUTABLE_FLAGS "-q" CACHE STRING "Flags for the executable self-packer.") -ELSE (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx") - SET (SELF_PACKER_FOR_EXECUTABLE_FLAGS "" CACHE STRING +else () + set (SELF_PACKER_FOR_EXECUTABLE_FLAGS "" CACHE STRING "Flags for the executable self-packer.") -ENDIF (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx") +endif () -IF (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx") - SET (SELF_PACKER_FOR_SHARED_LIB_FLAGS "-q" CACHE STRING +if (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx") + set (SELF_PACKER_FOR_SHARED_LIB_FLAGS "-q" CACHE STRING "Flags for the shared lib self-packer.") -ELSE (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx") - SET (SELF_PACKER_FOR_SHARED_LIB_FLAGS "" CACHE STRING +else () + set (SELF_PACKER_FOR_SHARED_LIB_FLAGS "" CACHE STRING "Flags for the shared lib self-packer.") -ENDIF (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx") +endif () -MARK_AS_ADVANCED( +mark_as_advanced( SELF_PACKER_FOR_EXECUTABLE_FLAGS SELF_PACKER_FOR_SHARED_LIB_FLAGS ) diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake index 48d195a1e..b79780577 100644 --- a/Modules/FindSquish.cmake +++ b/Modules/FindSquish.cmake @@ -1,9 +1,13 @@ # # ---- Find Squish -# This module can be used to find Squish (currently support is aimed at version 3). +# This module can be used to find Squish. Currently Squish versions 3 and 4 are supported. # # ---- Variables and Macros # SQUISH_FOUND If false, don't try to use Squish +# SQUISH_VERSION The full version of Squish found +# SQUISH_VERSION_MAJOR The major version of Squish found +# SQUISH_VERSION_MINOR The minor version of Squish found +# SQUISH_VERSION_PATCH The patch version of Squish found # # SQUISH_INSTALL_DIR The Squish installation directory (containing bin, lib, etc) # SQUISH_SERVER_EXECUTABLE The squishserver executable @@ -13,18 +17,52 @@ # SQUISH_SERVER_EXECUTABLE_FOUND Was the server executable found? # SQUISH_CLIENT_EXECUTABLE_FOUND Was the client executable found? # -# macro SQUISH_ADD_TEST(testName applicationUnderTest testSuite testCase) +# It provides the function squish_v4_add_test() for adding a squish test to cmake using Squish 4.x: +# +# squish_v4_add_test(cmakeTestName AUT targetName SUITE suiteName TEST squishTestName +# [SETTINGSGROUP group] [PRE_COMMAND command] [POST_COMMAND command] ) +# +# The arguments have the following meaning: +# cmakeTestName: this will be used as the first argument for add_test() +# AUT targetName: the name of the cmake target which will be used as AUT, i.e. the +# executable which will be tested. +# SUITE suiteName: this is either the full path to the squish suite, or just the +# last directory of the suite, i.e. the suite name. In this case +# the CMakeLists.txt which calls squish_add_test() must be located +# in the parent directory of the suite directory. +# TEST squishTestName: the name of the squish test, i.e. the name of the subdirectory +# of the test inside the suite directory. +# SETTINGSGROUP group: if specified, the given settings group will be used for executing the test. +# If not specified, the groupname will be "CTest_" +# PRE_COMMAND command: if specified, the given command will be executed before starting the squish test. +# POST_COMMAND command: same as PRE_COMMAND, but after the squish test has been executed. +# +# ---- Typical Use +# enable_testing() +# find_package(Squish 4.0) +# if (SQUISH_FOUND) +# squish_v4_add_test(myTestName AUT myApp SUITE ${CMAKE_SOURCE_DIR}/tests/mySuite TEST someSquishTest SETTINGSGROUP myGroup ) +# endif () +# +# +# For users of Squish version 3.x the macro squish_v3_add_test() is provided: +# squish_v3_add_test(testName applicationUnderTest testCase envVars testWrapper) +# Use this macro to add a test using Squish 3.x. # # ---- Typical Use -# ENABLE_TESTING() -# FIND_PACKAGE(Squish) -# IF (SQUISH_FOUND) -# SQUISH_ADD_TEST(myTestName myApplication testSuiteName testCaseName) -# ENDIF (SQUISH_FOUND) +# enable_testing() +# find_package(Squish) +# if (SQUISH_FOUND) +# squish_v3_add_test(myTestName myApplication testCase envVars testWrapper) +# endif () # +# macro SQUISH_ADD_TEST(testName applicationUnderTest testCase envVars testWrapper) +# This is deprecated. Use SQUISH_V3_ADD_TEST() if you are using Squish 3.x instead. + #============================================================================= # Copyright 2008-2009 Kitware, Inc. +# Copyright 2012 Alexander Neundorf # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -36,26 +74,30 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET(SQUISH_INSTALL_DIR_STRING "Directory containing the bin, doc, and lib directories for Squish; this should be the root of the installation directory.") -SET(SQUISH_SERVER_EXECUTABLE_STRING "The squishserver executable program.") -SET(SQUISH_CLIENT_EXECUTABLE_STRING "The squishclient executable program.") + +include(CMakeParseArguments) + +set(SQUISH_INSTALL_DIR_STRING "Directory containing the bin, doc, and lib directories for Squish; this should be the root of the installation directory.") +set(SQUISH_SERVER_EXECUTABLE_STRING "The squishserver executable program.") +set(SQUISH_CLIENT_EXECUTABLE_STRING "The squishclient executable program.") # Search only if the location is not already known. -IF(NOT SQUISH_INSTALL_DIR) +if(NOT SQUISH_INSTALL_DIR) # Get the system search path as a list. - FILE(TO_CMAKE_PATH "$ENV{PATH}" SQUISH_INSTALL_DIR_SEARCH2) + file(TO_CMAKE_PATH "$ENV{PATH}" SQUISH_INSTALL_DIR_SEARCH2) # Construct a set of paths relative to the system search path. - SET(SQUISH_INSTALL_DIR_SEARCH "") - FOREACH(dir ${SQUISH_INSTALL_DIR_SEARCH2}) - SET(SQUISH_INSTALL_DIR_SEARCH ${SQUISH_INSTALL_DIR_SEARCH} "${dir}/../lib/fltk") - ENDFOREACH(dir) - STRING(REPLACE "//" "/" SQUISH_INSTALL_DIR_SEARCH "${SQUISH_INSTALL_DIR_SEARCH}") + set(SQUISH_INSTALL_DIR_SEARCH "") + foreach(dir ${SQUISH_INSTALL_DIR_SEARCH2}) + set(SQUISH_INSTALL_DIR_SEARCH ${SQUISH_INSTALL_DIR_SEARCH} "${dir}/../lib/fltk") + endforeach() + string(REPLACE "//" "/" SQUISH_INSTALL_DIR_SEARCH "${SQUISH_INSTALL_DIR_SEARCH}") # Look for an installation - FIND_PATH(SQUISH_INSTALL_DIR bin/squishrunner + find_path(SQUISH_INSTALL_DIR bin/squishrunner + HINTS # Look for an environment variable SQUISH_INSTALL_DIR. - $ENV{SQUISH_INSTALL_DIR} + ENV SQUISH_INSTALL_DIR # Look in places relative to the system executable search path. ${SQUISH_INSTALL_DIR_SEARCH} @@ -65,50 +107,70 @@ IF(NOT SQUISH_INSTALL_DIR) DOC "The ${SQUISH_INSTALL_DIR_STRING}" ) -ENDIF(NOT SQUISH_INSTALL_DIR) +endif() # search for the executables -IF(SQUISH_INSTALL_DIR) - SET(SQUISH_INSTALL_DIR_FOUND 1) +if(SQUISH_INSTALL_DIR) + set(SQUISH_INSTALL_DIR_FOUND 1) # find the client program - IF(NOT SQUISH_CLIENT_EXECUTABLE) - FIND_PROGRAM(SQUISH_CLIENT_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishrunner DOC "The ${SQUISH_CLIENT_EXECUTABLE_STRING}") - ENDIF(NOT SQUISH_CLIENT_EXECUTABLE) + if(NOT SQUISH_CLIENT_EXECUTABLE) + find_program(SQUISH_CLIENT_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishrunner${CMAKE_EXECUTABLE_SUFFIX} DOC "The ${SQUISH_CLIENT_EXECUTABLE_STRING}") + endif() # find the server program - IF(NOT SQUISH_SERVER_EXECUTABLE) - FIND_PROGRAM(SQUISH_SERVER_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishserver DOC "The ${SQUISH_SERVER_EXECUTABLE_STRING}") - ENDIF(NOT SQUISH_SERVER_EXECUTABLE) + if(NOT SQUISH_SERVER_EXECUTABLE) + find_program(SQUISH_SERVER_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishserver${CMAKE_EXECUTABLE_SUFFIX} DOC "The ${SQUISH_SERVER_EXECUTABLE_STRING}") + endif() + +else() + set(SQUISH_INSTALL_DIR_FOUND 0) +endif() -ELSE(SQUISH_INSTALL_DIR) - SET(SQUISH_INSTALL_DIR_FOUND 0) -ENDIF(SQUISH_INSTALL_DIR) + +set(SQUISH_VERSION) +set(SQUISH_VERSION_MAJOR ) +set(SQUISH_VERSION_MINOR ) +set(SQUISH_VERSION_PATCH ) # record if executables are set -IF(SQUISH_CLIENT_EXECUTABLE) - SET(SQUISH_CLIENT_EXECUTABLE_FOUND 1) -ELSE(SQUISH_CLIENT_EXECUTABLE) - SET(SQUISH_CLIENT_EXECUTABLE_FOUND 0) -ENDIF(SQUISH_CLIENT_EXECUTABLE) - -IF(SQUISH_SERVER_EXECUTABLE) - SET(SQUISH_SERVER_EXECUTABLE_FOUND 1) -ELSE(SQUISH_SERVER_EXECUTABLE) - SET(SQUISH_SERVER_EXECUTABLE_FOUND 0) -ENDIF(SQUISH_SERVER_EXECUTABLE) +if(SQUISH_CLIENT_EXECUTABLE) + set(SQUISH_CLIENT_EXECUTABLE_FOUND 1) + execute_process(COMMAND "${SQUISH_CLIENT_EXECUTABLE}" --version + OUTPUT_VARIABLE _squishVersionOutput + ERROR_QUIET ) + if("${_squishVersionOutput}" MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+).*$") + set(SQUISH_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(SQUISH_VERSION_MINOR "${CMAKE_MATCH_2}") + set(SQUISH_VERSION_PATCH "${CMAKE_MATCH_3}") + set(SQUISH_VERSION "${SQUISH_VERSION_MAJOR}.${SQUISH_VERSION_MINOR}.${SQUISH_VERSION_PATCH}" ) + endif() +else() + set(SQUISH_CLIENT_EXECUTABLE_FOUND 0) +endif() + +if(SQUISH_SERVER_EXECUTABLE) + set(SQUISH_SERVER_EXECUTABLE_FOUND 1) +else() + set(SQUISH_SERVER_EXECUTABLE_FOUND 0) +endif() # record if Squish was found -SET(SQUISH_FOUND 1) -FOREACH(var SQUISH_INSTALL_DIR_FOUND SQUISH_CLIENT_EXECUTABLE_FOUND SQUISH_SERVER_EXECUTABLE_FOUND) - IF(NOT ${var}) - SET(SQUISH_FOUND 0) - ENDIF(NOT ${var}) -ENDFOREACH(var) - -MACRO(SQUISH_ADD_TEST testName testAUT testCase envVars testWraper) - ADD_TEST(${testName} +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Squish REQUIRED_VARS SQUISH_INSTALL_DIR SQUISH_CLIENT_EXECUTABLE SQUISH_SERVER_EXECUTABLE + VERSION_VAR SQUISH_VERSION ) + + +set(_SQUISH_MODULE_DIR "${CMAKE_CURRENT_LIST_DIR}") + +macro(SQUISH_V3_ADD_TEST testName testAUT testCase envVars testWraper) + if("${SQUISH_VERSION_MAJOR}" STREQUAL "4") + message(STATUS "Using squish_v3_add_test(), but SQUISH_VERSION_MAJOR is ${SQUISH_VERSION_MAJOR}.\nThis may not work.") + endif() + + add_test(${testName} ${CMAKE_COMMAND} -V -VV + "-Dsquish_version:STRING=3" "-Dsquish_aut:STRING=${testAUT}" "-Dsquish_server_executable:STRING=${SQUISH_SERVER_EXECUTABLE}" "-Dsquish_client_executable:STRING=${SQUISH_CLIENT_EXECUTABLE}" @@ -116,10 +178,84 @@ MACRO(SQUISH_ADD_TEST testName testAUT testCase envVars testWraper) "-Dsquish_test_case:STRING=${testCase}" "-Dsquish_env_vars:STRING=${envVars}" "-Dsquish_wrapper:STRING=${testWraper}" - -P "${CMAKE_ROOT}/Modules/SquishTestScript.cmake" + "-Dsquish_module_dir:STRING=${_SQUISH_MODULE_DIR}" + -P "${_SQUISH_MODULE_DIR}/SquishTestScript.cmake" ) - SET_TESTS_PROPERTIES(${testName} + set_tests_properties(${testName} PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED;ERROR;FATAL" ) -ENDMACRO(SQUISH_ADD_TEST) - +endmacro() + + +macro(SQUISH_ADD_TEST) + message(STATUS "Using squish_add_test() is deprecated, use squish_v3_add_test() instead.") + squish_v3_add_test(${ARGV}) +endmacro() + + +function(SQUISH_V4_ADD_TEST testName) + + if(NOT "${SQUISH_VERSION_MAJOR}" STREQUAL "4") + message(STATUS "Using squish_v4_add_test(), but SQUISH_VERSION_MAJOR is ${SQUISH_VERSION_MAJOR}.\nThis may not work.") + endif() + + set(oneValueArgs AUT SUITE TEST SETTINGSGROUP PRE_COMMAND POST_COMMAND) + + cmake_parse_arguments(_SQUISH "" "${oneValueArgs}" "" ${ARGN} ) + + if(_SQUISH_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to SQUISH_ADD_TEST(): \"${_SQUISH_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT _SQUISH_AUT) + message(FATAL_ERROR "Required argument AUT not given for SQUISH_ADD_TEST()") + endif() + + if(NOT _SQUISH_SUITE) + message(FATAL_ERROR "Required argument SUITE not given for SQUISH_ADD_TEST()") + endif() + + if(NOT _SQUISH_TEST) + message(FATAL_ERROR "Required argument TEST not given for SQUISH_ADD_TEST()") + endif() + + get_target_property(testAUTLocation ${_SQUISH_AUT} LOCATION) + get_filename_component(testAUTDir ${testAUTLocation} PATH) + get_filename_component(testAUTName ${testAUTLocation} NAME) + + get_filename_component(absTestSuite "${_SQUISH_SUITE}" ABSOLUTE) + if(NOT EXISTS "${absTestSuite}") + message(FATAL_ERROR "Could not find squish test suite ${_SQUISH_SUITE} (checked ${absTestSuite})") + endif() + + set(absTestCase "${absTestSuite}/${_SQUISH_TEST}") + if(NOT EXISTS "${absTestCase}") + message(FATAL_ERROR "Could not find squish testcase ${_SQUISH_TEST} (checked ${absTestCase})") + endif() + + if(NOT _SQUISH_SETTINGSGROUP) + set(_SQUISH_SETTINGSGROUP "CTest_$ENV{LOGNAME}") + endif() + + add_test(${testName} + ${CMAKE_COMMAND} -V -VV + "-Dsquish_version:STRING=4" + "-Dsquish_aut:STRING=${testAUTName}" + "-Dsquish_aut_dir:STRING=${testAUTDir}" + "-Dsquish_server_executable:STRING=${SQUISH_SERVER_EXECUTABLE}" + "-Dsquish_client_executable:STRING=${SQUISH_CLIENT_EXECUTABLE}" + "-Dsquish_libqtdir:STRING=${QT_LIBRARY_DIR}" + "-Dsquish_test_suite:STRING=${absTestSuite}" + "-Dsquish_test_case:STRING=${_SQUISH_TEST}" + "-Dsquish_env_vars:STRING=${envVars}" + "-Dsquish_wrapper:STRING=${testWraper}" + "-Dsquish_module_dir:STRING=${_SQUISH_MODULE_DIR}" + "-Dsquish_settingsgroup:STRING=${_SQUISH_SETTINGSGROUP}" + "-Dsquish_pre_command:STRING=${_SQUISH_PRE_COMMAND}" + "-Dsquish_post_command:STRING=${_SQUISH_POST_COMMAND}" + -P "${_SQUISH_MODULE_DIR}/SquishTestScript.cmake" + ) + set_tests_properties(${testName} + PROPERTIES FAIL_REGULAR_EXPRESSION "FAIL;FAILED;ERROR;FATAL" + ) +endfunction() diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake index 4166d99ab..f1bfc75bc 100644 --- a/Modules/FindSubversion.cmake +++ b/Modules/FindSubversion.cmake @@ -6,7 +6,7 @@ # SUBVERSION_FOUND - same as Subversion_FOUND, set for compatiblity reasons # # The minimum required version of Subversion can be specified using the -# standard syntax, e.g. FIND_PACKAGE(Subversion 1.4) +# standard syntax, e.g. find_package(Subversion 1.4) # # If the command line client executable is found two macros are defined: # Subversion_WC_INFO( ) @@ -25,13 +25,13 @@ # variable: # _LAST_CHANGED_LOG - last log of base revision # Example usage: -# FIND_PACKAGE(Subversion) -# IF(SUBVERSION_FOUND) +# find_package(Subversion) +# if(SUBVERSION_FOUND) # Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project) -# MESSAGE("Current revision is ${Project_WC_REVISION}") +# message("Current revision is ${Project_WC_REVISION}") # Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project) -# MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}") -# ENDIF(SUBVERSION_FOUND) +# message("Last changed log is ${Project_LAST_CHANGED_LOG}") +# endif() #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -47,85 +47,85 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(Subversion_SVN_EXECUTABLE svn +find_program(Subversion_SVN_EXECUTABLE svn DOC "subversion command line client") -MARK_AS_ADVANCED(Subversion_SVN_EXECUTABLE) +mark_as_advanced(Subversion_SVN_EXECUTABLE) -IF(Subversion_SVN_EXECUTABLE) +if(Subversion_SVN_EXECUTABLE) # the subversion commands should be executed with the C locale, otherwise # the message (which are parsed) may be translated, Alex - SET(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}") - SET(ENV{LC_ALL} C) + set(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}") + set(ENV{LC_ALL} C) - EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} --version + execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} --version OUTPUT_VARIABLE Subversion_VERSION_SVN OUTPUT_STRIP_TRAILING_WHITESPACE) # restore the previous LC_ALL - SET(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL}) + set(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL}) - STRING(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*" + string(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*" "\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}") - MACRO(Subversion_WC_INFO dir prefix) + macro(Subversion_WC_INFO dir prefix) # the subversion commands should be executed with the C locale, otherwise # the message (which are parsed) may be translated, Alex - SET(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}") - SET(ENV{LC_ALL} C) + set(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}") + set(ENV{LC_ALL} C) - EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} info ${dir} + execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} info ${dir} OUTPUT_VARIABLE ${prefix}_WC_INFO ERROR_VARIABLE Subversion_svn_info_error RESULT_VARIABLE Subversion_svn_info_result OUTPUT_STRIP_TRAILING_WHITESPACE) - IF(NOT ${Subversion_svn_info_result} EQUAL 0) - MESSAGE(SEND_ERROR "Command \"${Subversion_SVN_EXECUTABLE} info ${dir}\" failed with output:\n${Subversion_svn_info_error}") - ELSE(NOT ${Subversion_svn_info_result} EQUAL 0) + if(NOT ${Subversion_svn_info_result} EQUAL 0) + message(SEND_ERROR "Command \"${Subversion_SVN_EXECUTABLE} info ${dir}\" failed with output:\n${Subversion_svn_info_error}") + else() - STRING(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*" + string(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*" "\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}") - STRING(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*" + string(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*" "\\2" ${prefix}_WC_ROOT "${${prefix}_WC_INFO}") - STRING(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*" + string(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*" "\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}") - STRING(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*" + string(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*" "\\2" ${prefix}_WC_LAST_CHANGED_AUTHOR "${${prefix}_WC_INFO}") - STRING(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*" + string(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*" "\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}") - STRING(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*" + string(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*" "\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}") - ENDIF(NOT ${Subversion_svn_info_result} EQUAL 0) + endif() # restore the previous LC_ALL - SET(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL}) + set(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL}) - ENDMACRO(Subversion_WC_INFO) + endmacro() - MACRO(Subversion_WC_LOG dir prefix) + macro(Subversion_WC_LOG dir prefix) # This macro can block if the certificate is not signed: # svn ask you to accept the certificate and wait for your answer # This macro requires a svn server network access (Internet most of the time) # and can also be slow since it access the svn server - EXECUTE_PROCESS(COMMAND + execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} --non-interactive log -r BASE ${dir} OUTPUT_VARIABLE ${prefix}_LAST_CHANGED_LOG ERROR_VARIABLE Subversion_svn_log_error RESULT_VARIABLE Subversion_svn_log_result OUTPUT_STRIP_TRAILING_WHITESPACE) - IF(NOT ${Subversion_svn_log_result} EQUAL 0) - MESSAGE(SEND_ERROR "Command \"${Subversion_SVN_EXECUTABLE} log -r BASE ${dir}\" failed with output:\n${Subversion_svn_log_error}") - ENDIF(NOT ${Subversion_svn_log_result} EQUAL 0) - ENDMACRO(Subversion_WC_LOG) + if(NOT ${Subversion_svn_log_result} EQUAL 0) + message(SEND_ERROR "Command \"${Subversion_SVN_EXECUTABLE} log -r BASE ${dir}\" failed with output:\n${Subversion_svn_log_error}") + endif() + endmacro() -ENDIF(Subversion_SVN_EXECUTABLE) +endif() -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Subversion REQUIRED_VARS Subversion_SVN_EXECUTABLE VERSION_VAR Subversion_VERSION_SVN ) # for compatibility -SET(Subversion_FOUND ${SUBVERSION_FOUND}) -SET(Subversion_SVN_FOUND ${SUBVERSION_FOUND}) +set(Subversion_FOUND ${SUBVERSION_FOUND}) +set(Subversion_SVN_FOUND ${SUBVERSION_FOUND}) diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake index 7f6d3a7ee..f649ddc56 100644 --- a/Modules/FindTCL.cmake +++ b/Modules/FindTCL.cmake @@ -18,11 +18,11 @@ # - The stub libraries are now found in FindTclStub.cmake # => they were only useful for people writing Tcl/Tk extensions. # - TCL_LIBRARY_DEBUG and TK_LIBRARY_DEBUG were removed. -# => these libs are not packaged by default with Tcl/Tk distributions. +# => these libs are not packaged by default with Tcl/Tk distributions. # Even when Tcl/Tk is built from source, several flavors of debug libs # are created and there is no real reason to pick a single one -# specifically (say, amongst tcl84g, tcl84gs, or tcl84sgx). -# Let's leave that choice to the user by allowing him to assign +# specifically (say, amongst tcl84g, tcl84gs, or tcl84sgx). +# Let's leave that choice to the user by allowing him to assign # TCL_LIBRARY to any Tcl library, debug or not. # - TK_INTERNAL_PATH was removed. # => this ended up being only a Win32 variable, and there is a lot of @@ -44,52 +44,56 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(CMakeFindFrameworks) -INCLUDE(FindTclsh) -INCLUDE(FindWish) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindTclsh.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindWish.cmake) -IF(TCLSH_VERSION_STRING) - SET(TCL_TCLSH_VERSION "${TCLSH_VERSION_STRING}") -ELSE(TCLSH_VERSION_STRING) - GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH) - GET_FILENAME_COMPONENT(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH) - STRING(REGEX REPLACE +if(TCLSH_VERSION_STRING) + set(TCL_TCLSH_VERSION "${TCLSH_VERSION_STRING}") +else() + get_filename_component(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH) + get_filename_component(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH) + string(REGEX REPLACE "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}") -ENDIF(TCLSH_VERSION_STRING) +endif() -GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH) -GET_FILENAME_COMPONENT(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TK_WISH_PATH "${TK_WISH}" PATH) +get_filename_component(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH) +string(REGEX REPLACE "^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}") -GET_FILENAME_COMPONENT(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH) -GET_FILENAME_COMPONENT(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH) +get_filename_component(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH) +get_filename_component(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH) -GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH) -GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH) +get_filename_component(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH) +string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY}") -GET_FILENAME_COMPONENT(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH) -GET_FILENAME_COMPONENT(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH) +get_filename_component(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH) +string(REGEX REPLACE "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY}") -SET(TCLTK_POSSIBLE_LIB_PATHS +set(TCLTK_POSSIBLE_LIB_PATHS "${TCL_INCLUDE_PATH_PARENT}/lib" "${TK_INCLUDE_PATH_PARENT}/lib" "${TCL_LIBRARY_PATH}" "${TK_LIBRARY_PATH}" "${TCL_TCLSH_PATH_PARENT}/lib" "${TK_WISH_PATH_PARENT}/lib" + /usr/local/lib/tcl/tcl8.5 + /usr/local/lib/tcl/tk8.5 + /usr/local/lib/tcl/tcl8.4 + /usr/local/lib/tcl/tk8.4 ) -IF(WIN32) - GET_FILENAME_COMPONENT( - ActiveTcl_CurrentVersion - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]" +if(WIN32) + get_filename_component( + ActiveTcl_CurrentVersion + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]" NAME) - SET(TCLTK_POSSIBLE_LIB_PATHS ${TCLTK_POSSIBLE_LIB_PATHS} + set(TCLTK_POSSIBLE_LIB_PATHS ${TCLTK_POSSIBLE_LIB_PATHS} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/lib" @@ -98,33 +102,33 @@ IF(WIN32) "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib" "$ENV{ProgramFiles}/Tcl/Lib" - "C:/Program Files/Tcl/lib" - "C:/Tcl/lib" + "C:/Program Files/Tcl/lib" + "C:/Tcl/lib" ) -ENDIF(WIN32) +endif() -FIND_LIBRARY(TCL_LIBRARY - NAMES - tcl +find_library(TCL_LIBRARY + NAMES + tcl tcl${TCL_LIBRARY_VERSION} tcl${TCL_TCLSH_VERSION} tcl${TK_WISH_VERSION} - tcl86 tcl8.6 - tcl85 tcl8.5 - tcl84 tcl8.4 - tcl83 tcl8.3 - tcl82 tcl8.2 + tcl86 tcl8.6 + tcl85 tcl8.5 + tcl84 tcl8.4 + tcl83 tcl8.3 + tcl82 tcl8.2 tcl80 tcl8.0 PATHS ${TCLTK_POSSIBLE_LIB_PATHS} ) -FIND_LIBRARY(TK_LIBRARY - NAMES +find_library(TK_LIBRARY + NAMES tk tk${TK_LIBRARY_VERSION} tk${TCL_TCLSH_VERSION} tk${TK_WISH_VERSION} tk86 tk8.6 - tk85 tk8.5 - tk84 tk8.4 - tk83 tk8.3 - tk82 tk8.2 + tk85 tk8.5 + tk84 tk8.4 + tk83 tk8.3 + tk82 tk8.2 tk80 tk8.0 PATHS ${TCLTK_POSSIBLE_LIB_PATHS} ) @@ -132,32 +136,32 @@ FIND_LIBRARY(TK_LIBRARY CMAKE_FIND_FRAMEWORKS(Tcl) CMAKE_FIND_FRAMEWORKS(Tk) -SET(TCL_FRAMEWORK_INCLUDES) -IF(Tcl_FRAMEWORKS) - IF(NOT TCL_INCLUDE_PATH) - FOREACH(dir ${Tcl_FRAMEWORKS}) - SET(TCL_FRAMEWORK_INCLUDES ${TCL_FRAMEWORK_INCLUDES} ${dir}/Headers) - ENDFOREACH(dir) - ENDIF(NOT TCL_INCLUDE_PATH) -ENDIF(Tcl_FRAMEWORKS) - -SET(TK_FRAMEWORK_INCLUDES) -IF(Tk_FRAMEWORKS) - IF(NOT TK_INCLUDE_PATH) - FOREACH(dir ${Tk_FRAMEWORKS}) - SET(TK_FRAMEWORK_INCLUDES ${TK_FRAMEWORK_INCLUDES} +set(TCL_FRAMEWORK_INCLUDES) +if(Tcl_FRAMEWORKS) + if(NOT TCL_INCLUDE_PATH) + foreach(dir ${Tcl_FRAMEWORKS}) + set(TCL_FRAMEWORK_INCLUDES ${TCL_FRAMEWORK_INCLUDES} ${dir}/Headers) + endforeach() + endif() +endif() + +set(TK_FRAMEWORK_INCLUDES) +if(Tk_FRAMEWORKS) + if(NOT TK_INCLUDE_PATH) + foreach(dir ${Tk_FRAMEWORKS}) + set(TK_FRAMEWORK_INCLUDES ${TK_FRAMEWORK_INCLUDES} ${dir}/Headers ${dir}/PrivateHeaders) - ENDFOREACH(dir) - ENDIF(NOT TK_INCLUDE_PATH) -ENDIF(Tk_FRAMEWORKS) + endforeach() + endif() +endif() -SET(TCLTK_POSSIBLE_INCLUDE_PATHS +set(TCLTK_POSSIBLE_INCLUDE_PATHS "${TCL_LIBRARY_PATH_PARENT}/include" "${TK_LIBRARY_PATH_PARENT}/include" "${TCL_INCLUDE_PATH}" "${TK_INCLUDE_PATH}" - ${TCL_FRAMEWORK_INCLUDES} - ${TK_FRAMEWORK_INCLUDES} + ${TCL_FRAMEWORK_INCLUDES} + ${TK_FRAMEWORK_INCLUDES} "${TCL_TCLSH_PATH_PARENT}/include" "${TK_WISH_PATH_PARENT}/include" /usr/include/tcl${TK_LIBRARY_VERSION} @@ -168,10 +172,14 @@ SET(TCLTK_POSSIBLE_INCLUDE_PATHS /usr/include/tcl8.3 /usr/include/tcl8.2 /usr/include/tcl8.0 + /usr/local/include/tcl8.5 + /usr/local/include/tk8.5 + /usr/local/include/tcl8.4 + /usr/local/include/tk8.4 ) -IF(WIN32) - SET(TCLTK_POSSIBLE_INCLUDE_PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS} +if(WIN32) + set(TCLTK_POSSIBLE_INCLUDE_PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/include" @@ -183,31 +191,31 @@ IF(WIN32) "C:/Program Files/Tcl/include" "C:/Tcl/include" ) -ENDIF(WIN32) +endif() -FIND_PATH(TCL_INCLUDE_PATH +find_path(TCL_INCLUDE_PATH NAMES tcl.h HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS} ) -FIND_PATH(TK_INCLUDE_PATH +find_path(TK_INCLUDE_PATH NAMES tk.h HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS} ) -# handle the QUIETLY and REQUIRED arguments and set TCL_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set TCL_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH) -SET(TCLTK_FIND_REQUIRED ${TCL_FIND_REQUIRED}) -SET(TCLTK_FIND_QUIETLY ${TCL_FIND_QUIETLY}) +set(TCLTK_FIND_REQUIRED ${TCL_FIND_REQUIRED}) +set(TCLTK_FIND_QUIETLY ${TCL_FIND_QUIETLY}) FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCLTK DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH TK_LIBRARY TK_INCLUDE_PATH) -SET(TK_FIND_REQUIRED ${TCL_FIND_REQUIRED}) -SET(TK_FIND_QUIETLY ${TCL_FIND_QUIETLY}) +set(TK_FIND_REQUIRED ${TCL_FIND_REQUIRED}) +set(TK_FIND_QUIETLY ${TCL_FIND_QUIETLY}) FIND_PACKAGE_HANDLE_STANDARD_ARGS(TK DEFAULT_MSG TK_LIBRARY TK_INCLUDE_PATH) -MARK_AS_ADVANCED( +mark_as_advanced( TCL_INCLUDE_PATH TK_INCLUDE_PATH TCL_LIBRARY diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake index 16f9e238a..b48fb0e1d 100644 --- a/Modules/FindTIFF.cmake +++ b/Modules/FindTIFF.cmake @@ -20,29 +20,29 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(TIFF_INCLUDE_DIR tiff.h) +find_path(TIFF_INCLUDE_DIR tiff.h) -SET(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3) -FIND_LIBRARY(TIFF_LIBRARY NAMES ${TIFF_NAMES} ) +set(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3) +find_library(TIFF_LIBRARY NAMES ${TIFF_NAMES} ) -IF(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h") - FILE(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str +if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h") + file(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str REGEX "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version .*") - STRING(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*" + string(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*" "\\1" TIFF_VERSION_STRING "${tiff_version_str}") - UNSET(tiff_version_str) -ENDIF() + unset(tiff_version_str) +endif() -# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF REQUIRED_VARS TIFF_LIBRARY TIFF_INCLUDE_DIR VERSION_VAR TIFF_VERSION_STRING) -IF(TIFF_FOUND) - SET( TIFF_LIBRARIES ${TIFF_LIBRARY} ) -ENDIF(TIFF_FOUND) +if(TIFF_FOUND) + set( TIFF_LIBRARIES ${TIFF_LIBRARY} ) +endif() -MARK_AS_ADVANCED(TIFF_INCLUDE_DIR TIFF_LIBRARY) +mark_as_advanced(TIFF_INCLUDE_DIR TIFF_LIBRARY) diff --git a/Modules/FindTclStub.cmake b/Modules/FindTclStub.cmake index 79d14aeb4..8dda94a79 100644 --- a/Modules/FindTclStub.cmake +++ b/Modules/FindTclStub.cmake @@ -14,11 +14,11 @@ # who are not necessarily Tcl/Tk gurus/developpers, some variables were # moved or removed. Changes compared to CMake 2.4 are: # - TCL_STUB_LIBRARY_DEBUG and TK_STUB_LIBRARY_DEBUG were removed. -# => these libs are not packaged by default with Tcl/Tk distributions. +# => these libs are not packaged by default with Tcl/Tk distributions. # Even when Tcl/Tk is built from source, several flavors of debug libs # are created and there is no real reason to pick a single one -# specifically (say, amongst tclstub84g, tclstub84gs, or tclstub84sgx). -# Let's leave that choice to the user by allowing him to assign +# specifically (say, amongst tclstub84g, tclstub84gs, or tclstub84sgx). +# Let's leave that choice to the user by allowing him to assign # TCL_STUB_LIBRARY to any Tcl library, debug or not. #============================================================================= @@ -34,32 +34,32 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(FindTCL) +include(${CMAKE_CURRENT_LIST_DIR}/FindTCL.cmake) -GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH) -GET_FILENAME_COMPONENT(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH) +get_filename_component(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH) +string(REGEX REPLACE "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}") -GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH) -GET_FILENAME_COMPONENT(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TK_WISH_PATH "${TK_WISH}" PATH) +get_filename_component(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH) +string(REGEX REPLACE "^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}") -GET_FILENAME_COMPONENT(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH) -GET_FILENAME_COMPONENT(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH) +get_filename_component(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH) +get_filename_component(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH) -GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH) -GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH) +get_filename_component(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH) +string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY}") -GET_FILENAME_COMPONENT(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH) -GET_FILENAME_COMPONENT(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH) +get_filename_component(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH) +string(REGEX REPLACE "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY}") -SET(TCLTK_POSSIBLE_LIB_PATHS +set(TCLTK_POSSIBLE_LIB_PATHS "${TCL_INCLUDE_PATH_PARENT}/lib" "${TK_INCLUDE_PATH_PARENT}/lib" "${TCL_LIBRARY_PATH}" @@ -68,12 +68,12 @@ SET(TCLTK_POSSIBLE_LIB_PATHS "${TK_WISH_PATH_PARENT}/lib" ) -IF(WIN32) - GET_FILENAME_COMPONENT( - ActiveTcl_CurrentVersion - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]" +if(WIN32) + get_filename_component( + ActiveTcl_CurrentVersion + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]" NAME) - SET(TCLTK_POSSIBLE_LIB_PATHS ${TCLTK_POSSIBLE_LIB_PATHS} + set(TCLTK_POSSIBLE_LIB_PATHS ${TCLTK_POSSIBLE_LIB_PATHS} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/lib" @@ -82,49 +82,49 @@ IF(WIN32) "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib" "$ENV{ProgramFiles}/Tcl/Lib" - "C:/Program Files/Tcl/lib" - "C:/Tcl/lib" + "C:/Program Files/Tcl/lib" + "C:/Tcl/lib" ) -ENDIF(WIN32) +endif() -FIND_LIBRARY(TCL_STUB_LIBRARY - NAMES - tclstub +find_library(TCL_STUB_LIBRARY + NAMES + tclstub tclstub${TK_LIBRARY_VERSION} tclstub${TCL_TCLSH_VERSION} tclstub${TK_WISH_VERSION} tclstub86 tclstub8.6 - tclstub85 tclstub8.5 - tclstub84 tclstub8.4 - tclstub83 tclstub8.3 - tclstub82 tclstub8.2 + tclstub85 tclstub8.5 + tclstub84 tclstub8.4 + tclstub83 tclstub8.3 + tclstub82 tclstub8.2 tclstub80 tclstub8.0 PATHS ${TCLTK_POSSIBLE_LIB_PATHS} ) -FIND_LIBRARY(TK_STUB_LIBRARY - NAMES - tkstub +find_library(TK_STUB_LIBRARY + NAMES + tkstub tkstub${TCL_LIBRARY_VERSION} tkstub${TCL_TCLSH_VERSION} tkstub${TK_WISH_VERSION} tkstub86 tkstub8.6 - tkstub85 tkstub8.5 - tkstub84 tkstub8.4 - tkstub83 tkstub8.3 - tkstub82 tkstub8.2 + tkstub85 tkstub8.5 + tkstub84 tkstub8.4 + tkstub83 tkstub8.3 + tkstub82 tkstub8.2 tkstub80 tkstub8.0 PATHS ${TCLTK_POSSIBLE_LIB_PATHS} ) -FIND_LIBRARY(TTK_STUB_LIBRARY - NAMES - ttkstub +find_library(TTK_STUB_LIBRARY + NAMES + ttkstub ttkstub${TCL_LIBRARY_VERSION} ttkstub${TCL_TCLSH_VERSION} ttkstub${TK_WISH_VERSION} ttkstub88 ttkstub8.8 ttkstub87 ttkstub8.7 ttkstub86 ttkstub8.6 - ttkstub85 ttkstub8.5 + ttkstub85 ttkstub8.5 PATHS ${TCLTK_POSSIBLE_LIB_PATHS} ) -MARK_AS_ADVANCED( +mark_as_advanced( TCL_STUB_LIBRARY TK_STUB_LIBRARY ) diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake index a45f28528..0f091e60d 100644 --- a/Modules/FindTclsh.cmake +++ b/Modules/FindTclsh.cmake @@ -20,29 +20,29 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF(CYGWIN) - FIND_PROGRAM(TCL_TCLSH NAMES cygtclsh83 cygtclsh80) -ENDIF(CYGWIN) +if(CYGWIN) + find_program(TCL_TCLSH NAMES cygtclsh83 cygtclsh80) +endif() -GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH) -GET_FILENAME_COMPONENT(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TK_WISH_PATH "${TK_WISH}" PATH) +get_filename_component(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH) +string(REGEX REPLACE "^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}") -GET_FILENAME_COMPONENT(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH) -GET_FILENAME_COMPONENT(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH) +get_filename_component(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH) +get_filename_component(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH) -GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH) -GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH) +get_filename_component(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH) +string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY}") -GET_FILENAME_COMPONENT(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH) -GET_FILENAME_COMPONENT(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH) +get_filename_component(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH) +string(REGEX REPLACE "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY}") -SET(TCLTK_POSSIBLE_BIN_PATHS +set(TCLTK_POSSIBLE_BIN_PATHS "${TCL_INCLUDE_PATH_PARENT}/bin" "${TK_INCLUDE_PATH_PARENT}/bin" "${TCL_LIBRARY_PATH_PARENT}/bin" @@ -50,12 +50,12 @@ SET(TCLTK_POSSIBLE_BIN_PATHS "${TK_WISH_PATH_PARENT}/bin" ) -IF(WIN32) - GET_FILENAME_COMPONENT( - ActiveTcl_CurrentVersion - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]" +if(WIN32) + get_filename_component( + ActiveTcl_CurrentVersion + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]" NAME) - SET(TCLTK_POSSIBLE_BIN_PATHS ${TCLTK_POSSIBLE_BIN_PATHS} + set(TCLTK_POSSIBLE_BIN_PATHS ${TCLTK_POSSIBLE_BIN_PATHS} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/bin" @@ -64,9 +64,9 @@ IF(WIN32) "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/bin" ) -ENDIF(WIN32) +endif() -SET(TCL_TCLSH_NAMES +set(TCL_TCLSH_NAMES tclsh tclsh${TCL_LIBRARY_VERSION} tclsh${TK_LIBRARY_VERSION} tclsh${TK_WISH_VERSION} tclsh86 tclsh8.6 @@ -77,24 +77,24 @@ SET(TCL_TCLSH_NAMES tclsh80 tclsh8.0 ) -FIND_PROGRAM(TCL_TCLSH +find_program(TCL_TCLSH NAMES ${TCL_TCLSH_NAMES} HINTS ${TCLTK_POSSIBLE_BIN_PATHS} ) -IF(TCL_TCLSH) - EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -E echo puts "\$tcl_version" +if(TCL_TCLSH) + execute_process(COMMAND "${CMAKE_COMMAND}" -E echo puts "\$tcl_version" COMMAND "${TCL_TCLSH}" OUTPUT_VARIABLE TCLSH_VERSION_STRING ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) -ENDIF(TCL_TCLSH) +endif() -# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tclsh REQUIRED_VARS TCL_TCLSH VERSION_VAR TCLSH_VERSION_STRING) -MARK_AS_ADVANCED(TCL_TCLSH) +mark_as_advanced(TCL_TCLSH) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 21614fb66..5d7677791 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -21,117 +21,117 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE (CheckIncludeFiles) -INCLUDE (CheckLibraryExists) -INCLUDE (CheckSymbolExists) -SET(Threads_FOUND FALSE) +include (CheckIncludeFiles) +include (CheckLibraryExists) +include (CheckSymbolExists) +set(Threads_FOUND FALSE) # Do we have sproc? -IF(CMAKE_SYSTEM MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD) +if(CMAKE_SYSTEM MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD) CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H) -ENDIF() +endif() -IF(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD) +if(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD) # We have sproc - SET(CMAKE_USE_SPROC_INIT 1) -ELSE() + set(CMAKE_USE_SPROC_INIT 1) +else() # Do we have pthreads? CHECK_INCLUDE_FILES("pthread.h" CMAKE_HAVE_PTHREAD_H) - IF(CMAKE_HAVE_PTHREAD_H) + if(CMAKE_HAVE_PTHREAD_H) # # We have pthread.h # Let's check for the library now. # - SET(CMAKE_HAVE_THREADS_LIBRARY) - IF(NOT THREADS_HAVE_PTHREAD_ARG) + set(CMAKE_HAVE_THREADS_LIBRARY) + if(NOT THREADS_HAVE_PTHREAD_ARG) # Check if pthread functions are in normal C library CHECK_SYMBOL_EXISTS(pthread_create pthread.h CMAKE_HAVE_LIBC_CREATE) - IF(CMAKE_HAVE_LIBC_CREATE) - SET(CMAKE_THREAD_LIBS_INIT "") - SET(CMAKE_HAVE_THREADS_LIBRARY 1) - SET(Threads_FOUND TRUE) - ENDIF() + if(CMAKE_HAVE_LIBC_CREATE) + set(CMAKE_THREAD_LIBS_INIT "") + set(CMAKE_HAVE_THREADS_LIBRARY 1) + set(Threads_FOUND TRUE) + endif() - IF(NOT CMAKE_HAVE_THREADS_LIBRARY) + if(NOT CMAKE_HAVE_THREADS_LIBRARY) # Do we have -lpthreads CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE) - IF(CMAKE_HAVE_PTHREADS_CREATE) - SET(CMAKE_THREAD_LIBS_INIT "-lpthreads") - SET(CMAKE_HAVE_THREADS_LIBRARY 1) - SET(Threads_FOUND TRUE) - ENDIF() + if(CMAKE_HAVE_PTHREADS_CREATE) + set(CMAKE_THREAD_LIBS_INIT "-lpthreads") + set(CMAKE_HAVE_THREADS_LIBRARY 1) + set(Threads_FOUND TRUE) + endif() # Ok, how about -lpthread CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE) - IF(CMAKE_HAVE_PTHREAD_CREATE) - SET(CMAKE_THREAD_LIBS_INIT "-lpthread") - SET(CMAKE_HAVE_THREADS_LIBRARY 1) - SET(Threads_FOUND TRUE) - ENDIF() + if(CMAKE_HAVE_PTHREAD_CREATE) + set(CMAKE_THREAD_LIBS_INIT "-lpthread") + set(CMAKE_HAVE_THREADS_LIBRARY 1) + set(Threads_FOUND TRUE) + endif() - IF(CMAKE_SYSTEM MATCHES "SunOS.*") + if(CMAKE_SYSTEM MATCHES "SunOS.*") # On sun also check for -lthread CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE) - IF(CMAKE_HAVE_THR_CREATE) - SET(CMAKE_THREAD_LIBS_INIT "-lthread") - SET(CMAKE_HAVE_THREADS_LIBRARY 1) - SET(Threads_FOUND TRUE) - ENDIF() - ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*") - ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY) - ENDIF(NOT THREADS_HAVE_PTHREAD_ARG) - - IF(NOT CMAKE_HAVE_THREADS_LIBRARY) + if(CMAKE_HAVE_THR_CREATE) + set(CMAKE_THREAD_LIBS_INIT "-lthread") + set(CMAKE_HAVE_THREADS_LIBRARY 1) + set(Threads_FOUND TRUE) + endif() + endif() + endif() + endif() + + if(NOT CMAKE_HAVE_THREADS_LIBRARY) # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread - IF("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG") - MESSAGE(STATUS "Check if compiler accepts -pthread") - TRY_RUN(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG + if("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG") + message(STATUS "Check if compiler accepts -pthread") + try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG ${CMAKE_BINARY_DIR} ${CMAKE_ROOT}/Modules/CheckForPthreads.c CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread COMPILE_OUTPUT_VARIABLE OUTPUT) - IF(THREADS_HAVE_PTHREAD_ARG) - IF(THREADS_PTHREAD_ARG MATCHES "^2$") - SET(Threads_FOUND TRUE) - MESSAGE(STATUS "Check if compiler accepts -pthread - yes") - ELSE() - MESSAGE(STATUS "Check if compiler accepts -pthread - no") - FILE(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + if(THREADS_HAVE_PTHREAD_ARG) + if(THREADS_PTHREAD_ARG MATCHES "^2$") + set(Threads_FOUND TRUE) + message(STATUS "Check if compiler accepts -pthread - yes") + else() + message(STATUS "Check if compiler accepts -pthread - no") + file(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if compiler accepts -pthread returned ${THREADS_PTHREAD_ARG} instead of 2. The compiler had the following output:\n${OUTPUT}\n\n") - ENDIF() - ELSE() - MESSAGE(STATUS "Check if compiler accepts -pthread - no") - FILE(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + endif() + else() + message(STATUS "Check if compiler accepts -pthread - no") + file(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if compiler accepts -pthread failed with the following output:\n${OUTPUT}\n\n") - ENDIF() + endif() - ENDIF("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG") + endif() - IF(THREADS_HAVE_PTHREAD_ARG) - SET(Threads_FOUND TRUE) - SET(CMAKE_THREAD_LIBS_INIT "-pthread") - ENDIF() + if(THREADS_HAVE_PTHREAD_ARG) + set(Threads_FOUND TRUE) + set(CMAKE_THREAD_LIBS_INIT "-pthread") + endif() - ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY) - ENDIF(CMAKE_HAVE_PTHREAD_H) -ENDIF() + endif() + endif() +endif() -IF(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_CREATE) - SET(CMAKE_USE_PTHREADS_INIT 1) - SET(Threads_FOUND TRUE) -ENDIF() +if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_CREATE) + set(CMAKE_USE_PTHREADS_INIT 1) + set(Threads_FOUND TRUE) +endif() -IF(CMAKE_SYSTEM MATCHES "Windows") - SET(CMAKE_USE_WIN32_THREADS_INIT 1) - SET(Threads_FOUND TRUE) -ENDIF() +if(CMAKE_SYSTEM MATCHES "Windows") + set(CMAKE_USE_WIN32_THREADS_INIT 1) + set(Threads_FOUND TRUE) +endif() -IF(CMAKE_USE_PTHREADS_INIT) - IF(CMAKE_SYSTEM MATCHES "HP-UX-*") +if(CMAKE_USE_PTHREADS_INIT) + if(CMAKE_SYSTEM MATCHES "HP-UX-*") # Use libcma if it exists and can be used. It provides more # symbols than the plain pthread library. CMA threads # have actually been deprecated: @@ -141,26 +141,26 @@ IF(CMAKE_USE_PTHREADS_INIT) # The CMAKE_HP_PTHREADS setting actually indicates whether CMA threads # are available. CHECK_LIBRARY_EXISTS(cma pthread_attr_create "" CMAKE_HAVE_HP_CMA) - IF(CMAKE_HAVE_HP_CMA) - SET(CMAKE_THREAD_LIBS_INIT "-lcma") - SET(CMAKE_HP_PTHREADS_INIT 1) - SET(Threads_FOUND TRUE) - ENDIF(CMAKE_HAVE_HP_CMA) - SET(CMAKE_USE_PTHREADS_INIT 1) - ENDIF() - - IF(CMAKE_SYSTEM MATCHES "OSF1-V*") - SET(CMAKE_USE_PTHREADS_INIT 0) - SET(CMAKE_THREAD_LIBS_INIT ) - ENDIF() - - IF(CMAKE_SYSTEM MATCHES "CYGWIN_NT*") - SET(CMAKE_USE_PTHREADS_INIT 1) - SET(Threads_FOUND TRUE) - SET(CMAKE_THREAD_LIBS_INIT ) - SET(CMAKE_USE_WIN32_THREADS_INIT 0) - ENDIF() -ENDIF(CMAKE_USE_PTHREADS_INIT) - -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + if(CMAKE_HAVE_HP_CMA) + set(CMAKE_THREAD_LIBS_INIT "-lcma") + set(CMAKE_HP_PTHREADS_INIT 1) + set(Threads_FOUND TRUE) + endif() + set(CMAKE_USE_PTHREADS_INIT 1) + endif() + + if(CMAKE_SYSTEM MATCHES "OSF1-V*") + set(CMAKE_USE_PTHREADS_INIT 0) + set(CMAKE_THREAD_LIBS_INIT ) + endif() + + if(CMAKE_SYSTEM MATCHES "CYGWIN_NT*") + set(CMAKE_USE_PTHREADS_INIT 1) + set(Threads_FOUND TRUE) + set(CMAKE_THREAD_LIBS_INIT ) + set(CMAKE_USE_WIN32_THREADS_INIT 0) + endif() +endif() + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND) diff --git a/Modules/FindUnixCommands.cmake b/Modules/FindUnixCommands.cmake index 9c0264d22..87caadc09 100644 --- a/Modules/FindUnixCommands.cmake +++ b/Modules/FindUnixCommands.cmake @@ -15,79 +15,79 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(FindCygwin) +include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) -FIND_PROGRAM(BASH +find_program(BASH bash ${CYGWIN_INSTALL_PATH}/bin /bin - /usr/bin + /usr/bin /usr/local/bin /sbin ) -MARK_AS_ADVANCED( +mark_as_advanced( BASH ) -FIND_PROGRAM(CP +find_program(CP cp ${CYGWIN_INSTALL_PATH}/bin /bin - /usr/bin + /usr/bin /usr/local/bin /sbin ) -MARK_AS_ADVANCED( +mark_as_advanced( CP ) -FIND_PROGRAM(GZIP +find_program(GZIP gzip ${CYGWIN_INSTALL_PATH}/bin /bin - /usr/bin + /usr/bin /usr/local/bin /sbin ) -MARK_AS_ADVANCED( +mark_as_advanced( GZIP ) -FIND_PROGRAM(MV +find_program(MV mv ${CYGWIN_INSTALL_PATH}/bin /bin - /usr/bin + /usr/bin /usr/local/bin /sbin ) -MARK_AS_ADVANCED( +mark_as_advanced( MV ) -FIND_PROGRAM(RM +find_program(RM rm ${CYGWIN_INSTALL_PATH}/bin /bin - /usr/bin + /usr/bin /usr/local/bin /sbin ) -MARK_AS_ADVANCED( +mark_as_advanced( RM ) -FIND_PROGRAM(TAR - NAMES - tar +find_program(TAR + NAMES + tar gtar PATH ${CYGWIN_INSTALL_PATH}/bin /bin - /usr/bin + /usr/bin /usr/local/bin /sbin ) -MARK_AS_ADVANCED( +mark_as_advanced( TAR ) diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake index 6b1772fa4..0dede2d8b 100644 --- a/Modules/FindVTK.cmake +++ b/Modules/FindVTK.cmake @@ -4,26 +4,26 @@ # VTK_FOUND - Set to true when VTK is found. # VTK_USE_FILE - CMake file to use VTK. # VTK_MAJOR_VERSION - The VTK major version number. -# VTK_MINOR_VERSION - The VTK minor version number +# VTK_MINOR_VERSION - The VTK minor version number # (odd non-release). -# VTK_BUILD_VERSION - The VTK patch level +# VTK_BUILD_VERSION - The VTK patch level # (meaningless for odd minor). # VTK_INCLUDE_DIRS - Include directories for VTK # VTK_LIBRARY_DIRS - Link directories for VTK libraries -# VTK_KITS - List of VTK kits, in CAPS +# VTK_KITS - List of VTK kits, in CAPS # (COMMON,IO,) etc. # VTK_LANGUAGES - List of wrapped languages, in CAPS # (TCL, PYHTON,) etc. # The following cache entries must be set by the user to locate VTK: -# VTK_DIR - The directory containing VTKConfig.cmake. +# VTK_DIR - The directory containing VTKConfig.cmake. # This is either the root of the build tree, -# or the lib/vtk directory. This is the +# or the lib/vtk directory. This is the # only cache entry. # The following variables are set for backward compatibility and # should not be used in new code: # USE_VTK_FILE - The full path to the UseVTK.cmake file. -# This is provided for backward -# compatibility. Use VTK_USE_FILE +# This is provided for backward +# compatibility. Use VTK_USE_FILE # instead. # @@ -41,56 +41,56 @@ # License text for the above reference.) # Assume not found. -SET(VTK_FOUND 0) +set(VTK_FOUND 0) # VTK 4.0 did not provide VTKConfig.cmake. -IF("${VTK_FIND_VERSION}" VERSION_LESS 4.1) - SET(_VTK_40_ALLOW 1) - IF(VTK_FIND_VERSION) - SET(_VTK_40_ONLY 1) - ENDIF() -ENDIF() +if("${VTK_FIND_VERSION}" VERSION_LESS 4.1) + set(_VTK_40_ALLOW 1) + if(VTK_FIND_VERSION) + set(_VTK_40_ONLY 1) + endif() +endif() # Construct consitent error messages for use below. -SET(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/vtk for an installation.") -IF(_VTK_40_ALLOW) - SET(VTK_DIR_DESCRIPTION "${VTK_DIR_DESCRIPTION} For VTK 4.0, this is the location of UseVTK.cmake. This is either the root of the build tree or PREFIX/include/vtk for an installation.") -ENDIF() -SET(VTK_DIR_MESSAGE "VTK not found. Set the VTK_DIR cmake cache entry to the ${VTK_DIR_DESCRIPTION}") +set(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/vtk for an installation.") +if(_VTK_40_ALLOW) + set(VTK_DIR_DESCRIPTION "${VTK_DIR_DESCRIPTION} For VTK 4.0, this is the location of UseVTK.cmake. This is either the root of the build tree or PREFIX/include/vtk for an installation.") +endif() +set(VTK_DIR_MESSAGE "VTK not found. Set the VTK_DIR cmake cache entry to the ${VTK_DIR_DESCRIPTION}") # Check whether VTK 4.0 has already been found. -IF(_VTK_40_ALLOW AND VTK_DIR) - IF(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) - SET(VTK_FOUND 1) - INCLUDE(UseVTKConfig40) # No VTKConfig; load VTK 4.0 settings. - ENDIF() -ENDIF() +if(_VTK_40_ALLOW AND VTK_DIR) + if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) + set(VTK_FOUND 1) + include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings. + endif() +endif() # Use the Config mode of the find_package() command to find VTKConfig. # If this succeeds (possibly because VTK_DIR is already set), the # command will have already loaded VTKConfig.cmake and set VTK_FOUND. -IF(NOT _VTK_40_ONLY AND NOT VTK_FOUND) - FIND_PACKAGE(VTK QUIET NO_MODULE) -ENDIF() +if(NOT _VTK_40_ONLY AND NOT VTK_FOUND) + find_package(VTK QUIET NO_MODULE) +endif() # Special search for VTK 4.0. -IF(_VTK_40_ALLOW AND NOT VTK_DIR) +if(_VTK_40_ALLOW AND NOT VTK_DIR) # Old scripts may set these directories in the CMakeCache.txt file. # They can tell us where to find VTKConfig.cmake. - SET(VTK_DIR_SEARCH_LEGACY "") - IF(VTK_BINARY_PATH AND USE_BUILT_VTK) - SET(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} ${VTK_BINARY_PATH}) - ENDIF(VTK_BINARY_PATH AND USE_BUILT_VTK) - IF(VTK_INSTALL_PATH AND USE_INSTALLED_VTK) - SET(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} + set(VTK_DIR_SEARCH_LEGACY "") + if(VTK_BINARY_PATH AND USE_BUILT_VTK) + set(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} ${VTK_BINARY_PATH}) + endif() + if(VTK_INSTALL_PATH AND USE_INSTALLED_VTK) + set(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} ${VTK_INSTALL_PATH}/lib/vtk) - ENDIF(VTK_INSTALL_PATH AND USE_INSTALLED_VTK) + endif() # Look for UseVTK.cmake in build trees or under /include/vtk. - FIND_PATH(VTK_DIR + find_path(VTK_DIR NAMES UseVTK.cmake PATH_SUFFIXES vtk-4.0 vtk - HINTS $ENV{VTK_DIR} + HINTS ENV VTK_DIR PATHS @@ -114,28 +114,28 @@ IF(_VTK_40_ALLOW AND NOT VTK_DIR) DOC "The ${VTK_DIR_DESCRIPTION}" ) - IF(VTK_DIR) - IF(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) - SET(VTK_FOUND 1) - INCLUDE(UseVTKConfig40) # No VTKConfig; load VTK 4.0 settings. - ELSE() + if(VTK_DIR) + if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) + set(VTK_FOUND 1) + include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings. + else() # We found the wrong version. Pretend we did not find it. - SET(VTK_DIR "VTK_DIR-NOTFOUND" CACHE PATH "The ${VTK_DIR_DESCRIPTION}" FORCE) - ENDIF() - ENDIF() -ENDIF() + set(VTK_DIR "VTK_DIR-NOTFOUND" CACHE PATH "The ${VTK_DIR_DESCRIPTION}" FORCE) + endif() + endif() +endif() #----------------------------------------------------------------------------- -IF(VTK_FOUND) +if(VTK_FOUND) # Set USE_VTK_FILE for backward-compatability. - SET(USE_VTK_FILE ${VTK_USE_FILE}) -ELSE(VTK_FOUND) + set(USE_VTK_FILE ${VTK_USE_FILE}) +else() # VTK not found, explain to the user how to specify its location. - IF(VTK_FIND_REQUIRED) - MESSAGE(FATAL_ERROR ${VTK_DIR_MESSAGE}) - ELSE(VTK_FIND_REQUIRED) - IF(NOT VTK_FIND_QUIETLY) - MESSAGE(STATUS ${VTK_DIR_MESSAGE}) - ENDIF(NOT VTK_FIND_QUIETLY) - ENDIF(VTK_FIND_REQUIRED) -ENDIF(VTK_FOUND) + if(VTK_FIND_REQUIRED) + message(FATAL_ERROR ${VTK_DIR_MESSAGE}) + else() + if(NOT VTK_FIND_QUIETLY) + message(STATUS ${VTK_DIR_MESSAGE}) + endif() + endif() +endif() diff --git a/Modules/FindWget.cmake b/Modules/FindWget.cmake index c94132c27..4da98b149 100644 --- a/Modules/FindWget.cmake +++ b/Modules/FindWget.cmake @@ -1,5 +1,5 @@ # - Find wget -# This module looks for wget. This module defines the +# This module looks for wget. This module defines the # following values: # WGET_EXECUTABLE: the full path to the wget tool. # WGET_FOUND: True if wget has been found. @@ -17,20 +17,20 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(FindCygwin) +include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) -FIND_PROGRAM(WGET_EXECUTABLE +find_program(WGET_EXECUTABLE wget ${CYGWIN_INSTALL_PATH}/bin ) -# handle the QUIETLY and REQUIRED arguments and set WGET_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set WGET_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Wget DEFAULT_MSG WGET_EXECUTABLE) -MARK_AS_ADVANCED( WGET_EXECUTABLE ) +mark_as_advanced( WGET_EXECUTABLE ) # WGET option is deprecated. # use WGET_EXECUTABLE instead. -SET (WGET ${WGET_EXECUTABLE} ) +set (WGET ${WGET_EXECUTABLE} ) diff --git a/Modules/FindWish.cmake b/Modules/FindWish.cmake index a4960cd17..11b29f249 100644 --- a/Modules/FindWish.cmake +++ b/Modules/FindWish.cmake @@ -20,29 +20,29 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF(UNIX) - FIND_PROGRAM(TK_WISH cygwish80 ) -ENDIF(UNIX) +if(UNIX) + find_program(TK_WISH cygwish80 ) +endif() -GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH) -GET_FILENAME_COMPONENT(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH) +get_filename_component(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH) +string(REGEX REPLACE "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}") -GET_FILENAME_COMPONENT(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH) -GET_FILENAME_COMPONENT(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH) +get_filename_component(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH) +get_filename_component(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH) -GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH) -GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH) +get_filename_component(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH) +string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY}") -GET_FILENAME_COMPONENT(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH) -GET_FILENAME_COMPONENT(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH) +get_filename_component(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH) +string(REGEX REPLACE "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY}") -SET(TCLTK_POSSIBLE_BIN_PATHS +set(TCLTK_POSSIBLE_BIN_PATHS "${TCL_INCLUDE_PATH_PARENT}/bin" "${TK_INCLUDE_PATH_PARENT}/bin" "${TCL_LIBRARY_PATH_PARENT}/bin" @@ -50,12 +50,12 @@ SET(TCLTK_POSSIBLE_BIN_PATHS "${TCL_TCLSH_PATH_PARENT}/bin" ) -IF(WIN32) - GET_FILENAME_COMPONENT( - ActiveTcl_CurrentVersion - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]" +if(WIN32) + get_filename_component( + ActiveTcl_CurrentVersion + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]" NAME) - SET(TCLTK_POSSIBLE_BIN_PATHS ${TCLTK_POSSIBLE_BIN_PATHS} + set(TCLTK_POSSIBLE_BIN_PATHS ${TCLTK_POSSIBLE_BIN_PATHS} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/bin" @@ -64,22 +64,22 @@ IF(WIN32) "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/bin" ) -ENDIF(WIN32) +endif() -SET(TK_WISH_NAMES - wish +set(TK_WISH_NAMES + wish wish${TCL_LIBRARY_VERSION} wish${TK_LIBRARY_VERSION} wish${TCL_TCLSH_VERSION} wish86 wish8.6 - wish85 wish8.5 - wish84 wish8.4 - wish83 wish8.3 - wish82 wish8.2 + wish85 wish8.5 + wish84 wish8.4 + wish83 wish8.3 + wish82 wish8.2 wish80 wish8.0 ) -FIND_PROGRAM(TK_WISH +find_program(TK_WISH NAMES ${TK_WISH_NAMES} HINTS ${TCLTK_POSSIBLE_BIN_PATHS} ) -MARK_AS_ADVANCED(TK_WISH) +mark_as_advanced(TK_WISH) diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 76fb3c911..3cd3cefeb 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -54,13 +54,13 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF (UNIX) - SET(X11_FOUND 0) +if (UNIX) + set(X11_FOUND 0) # X11 is never a framework and some header files may be # found in tcl on the mac - SET(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK}) - SET(CMAKE_FIND_FRAMEWORK NEVER) - SET(X11_INC_SEARCH_PATH + set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK}) + set(CMAKE_FIND_FRAMEWORK NEVER) + set(X11_INC_SEARCH_PATH /usr/pkg/xorg/include /usr/X11R6/include /usr/X11R7/include @@ -70,358 +70,363 @@ IF (UNIX) /opt/graphics/OpenGL/include ) - SET(X11_LIB_SEARCH_PATH + set(X11_LIB_SEARCH_PATH /usr/pkg/xorg/lib /usr/X11R6/lib /usr/X11R7/lib /usr/openwin/lib ) - FIND_PATH(X11_X11_INCLUDE_PATH X11/X.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xlib_INCLUDE_PATH X11/Xlib.h ${X11_INC_SEARCH_PATH}) + find_path(X11_X11_INCLUDE_PATH X11/X.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xlib_INCLUDE_PATH X11/Xlib.h ${X11_INC_SEARCH_PATH}) # Look for includes; keep the list sorted by name of the cmake *_INCLUDE_PATH # variable (which doesn't need to match the include file name). # Solaris lacks XKBrules.h, so we should skip kxkbd there. - FIND_PATH(X11_ICE_INCLUDE_PATH X11/ICE/ICE.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_SM_INCLUDE_PATH X11/SM/SM.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xaccessrules_INCLUDE_PATH X11/extensions/XKBrules.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xaccessstr_INCLUDE_PATH X11/extensions/XKBstr.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xau_INCLUDE_PATH X11/Xauth.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xcomposite_INCLUDE_PATH X11/extensions/Xcomposite.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xdmcp_INCLUDE_PATH X11/Xdmcp.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_dpms_INCLUDE_PATH X11/extensions/dpms.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_xf86misc_INCLUDE_PATH X11/extensions/xf86misc.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_xf86vmode_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xfixes_INCLUDE_PATH X11/extensions/Xfixes.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xft_INCLUDE_PATH X11/Xft/Xft.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xi_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xinerama_INCLUDE_PATH X11/extensions/Xinerama.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xinput_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xkblib_INCLUDE_PATH X11/XKBlib.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xkbfile_INCLUDE_PATH X11/extensions/XKBfile.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xmu_INCLUDE_PATH X11/Xmu/Xmu.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xpm_INCLUDE_PATH X11/xpm.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_XTest_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_XShm_INCLUDE_PATH X11/extensions/XShm.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xrender_INCLUDE_PATH X11/extensions/Xrender.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_XRes_INCLUDE_PATH X11/extensions/XRes.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xscreensaver_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xshape_INCLUDE_PATH X11/extensions/shape.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xt_INCLUDE_PATH X11/Intrinsic.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_Xv_INCLUDE_PATH X11/extensions/Xvlib.h ${X11_INC_SEARCH_PATH}) - FIND_PATH(X11_XSync_INCLUDE_PATH X11/extensions/sync.h ${X11_INC_SEARCH_PATH}) - - - FIND_LIBRARY(X11_X11_LIB X11 ${X11_LIB_SEARCH_PATH}) + find_path(X11_ICE_INCLUDE_PATH X11/ICE/ICE.h ${X11_INC_SEARCH_PATH}) + find_path(X11_SM_INCLUDE_PATH X11/SM/SM.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xaccessrules_INCLUDE_PATH X11/extensions/XKBrules.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xaccessstr_INCLUDE_PATH X11/extensions/XKBstr.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xau_INCLUDE_PATH X11/Xauth.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xcomposite_INCLUDE_PATH X11/extensions/Xcomposite.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xdmcp_INCLUDE_PATH X11/Xdmcp.h ${X11_INC_SEARCH_PATH}) + find_path(X11_dpms_INCLUDE_PATH X11/extensions/dpms.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xf86misc_INCLUDE_PATH X11/extensions/xf86misc.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xf86vmode_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xfixes_INCLUDE_PATH X11/extensions/Xfixes.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xft_INCLUDE_PATH X11/Xft/Xft.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xi_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xinerama_INCLUDE_PATH X11/extensions/Xinerama.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xinput_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xkblib_INCLUDE_PATH X11/XKBlib.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xkbfile_INCLUDE_PATH X11/extensions/XKBfile.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xmu_INCLUDE_PATH X11/Xmu/Xmu.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xpm_INCLUDE_PATH X11/xpm.h ${X11_INC_SEARCH_PATH}) + find_path(X11_XTest_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH}) + find_path(X11_XShm_INCLUDE_PATH X11/extensions/XShm.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xrender_INCLUDE_PATH X11/extensions/Xrender.h ${X11_INC_SEARCH_PATH}) + find_path(X11_XRes_INCLUDE_PATH X11/extensions/XRes.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xscreensaver_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xshape_INCLUDE_PATH X11/extensions/shape.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xt_INCLUDE_PATH X11/Intrinsic.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xv_INCLUDE_PATH X11/extensions/Xvlib.h ${X11_INC_SEARCH_PATH}) + find_path(X11_XSync_INCLUDE_PATH X11/extensions/sync.h ${X11_INC_SEARCH_PATH}) + + + find_library(X11_X11_LIB X11 ${X11_LIB_SEARCH_PATH}) # Find additional X libraries. Keep list sorted by library name. - FIND_LIBRARY(X11_ICE_LIB ICE ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_SM_LIB SM ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xau_LIB Xau ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xcomposite_LIB Xcomposite ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xcursor_LIB Xcursor ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xdamage_LIB Xdamage ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xdmcp_LIB Xdmcp ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xfixes_LIB Xfixes ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xi_LIB Xi ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xkbfile_LIB xkbfile ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xmu_LIB Xmu ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_XRes_LIB XRes ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xscreensaver_LIB Xss ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH}) - FIND_LIBRARY(X11_Xxf86vm_LIB Xxf86vm ${X11_LIB_SEARCH_PATH}) - - SET(X11_LIBRARY_DIR "") - IF(X11_X11_LIB) - GET_FILENAME_COMPONENT(X11_LIBRARY_DIR ${X11_X11_LIB} PATH) - ENDIF(X11_X11_LIB) - - SET(X11_INCLUDE_DIR) # start with empty list - IF(X11_X11_INCLUDE_PATH) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH}) - ENDIF(X11_X11_INCLUDE_PATH) - - IF(X11_Xlib_INCLUDE_PATH) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xlib_INCLUDE_PATH}) - ENDIF(X11_Xlib_INCLUDE_PATH) - - IF(X11_Xutil_INCLUDE_PATH) - SET(X11_Xutil_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xutil_INCLUDE_PATH}) - ENDIF(X11_Xutil_INCLUDE_PATH) - - IF(X11_Xshape_INCLUDE_PATH) - SET(X11_Xshape_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xshape_INCLUDE_PATH}) - ENDIF(X11_Xshape_INCLUDE_PATH) - - SET(X11_LIBRARIES) # start with empty list - IF(X11_X11_LIB) - SET(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB}) - ENDIF(X11_X11_LIB) - - IF(X11_Xext_LIB) - SET(X11_Xext_FOUND TRUE) - SET(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xext_LIB}) - ENDIF(X11_Xext_LIB) - - IF(X11_Xt_LIB AND X11_Xt_INCLUDE_PATH) - SET(X11_Xt_FOUND TRUE) - ENDIF(X11_Xt_LIB AND X11_Xt_INCLUDE_PATH) - - IF(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH) - SET(X11_Xft_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xft_INCLUDE_PATH}) - ENDIF(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH) - - IF(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH) - SET(X11_Xv_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xv_INCLUDE_PATH}) - ENDIF(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH) - - IF (X11_Xau_LIB AND X11_Xau_INCLUDE_PATH) - SET(X11_Xau_FOUND TRUE) - ENDIF (X11_Xau_LIB AND X11_Xau_INCLUDE_PATH) - - IF (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB) - SET(X11_Xdmcp_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdmcp_INCLUDE_PATH}) - ENDIF (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB) - - IF (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH) - SET(X11_Xaccess_FOUND TRUE) - SET(X11_Xaccess_INCLUDE_PATH ${X11_Xaccessstr_INCLUDE_PATH}) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xaccess_INCLUDE_PATH}) - ENDIF (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH) - - IF (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB) - SET(X11_Xpm_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xpm_INCLUDE_PATH}) - ENDIF (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB) - - IF (X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB) - SET(X11_Xcomposite_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcomposite_INCLUDE_PATH}) - ENDIF (X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB) - - IF (X11_Xdamage_INCLUDE_PATH AND X11_Xdamage_LIB) - SET(X11_Xdamage_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdamage_INCLUDE_PATH}) - ENDIF (X11_Xdamage_INCLUDE_PATH AND X11_Xdamage_LIB) - - IF (X11_XShm_INCLUDE_PATH) - SET(X11_XShm_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XShm_INCLUDE_PATH}) - ENDIF (X11_XShm_INCLUDE_PATH) - - IF (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB) - SET(X11_XTest_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XTest_INCLUDE_PATH}) - ENDIF (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB) - - IF (X11_Xi_INCLUDE_PATH AND X11_Xi_LIB) - SET(X11_Xi_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xi_INCLUDE_PATH}) - ENDIF (X11_Xi_INCLUDE_PATH AND X11_Xi_LIB) - - IF (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB) - SET(X11_Xinerama_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH}) - ENDIF (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB) - - IF (X11_Xfixes_INCLUDE_PATH AND X11_Xfixes_LIB) - SET(X11_Xfixes_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xfixes_INCLUDE_PATH}) - ENDIF (X11_Xfixes_INCLUDE_PATH AND X11_Xfixes_LIB) - - IF (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB) - SET(X11_Xrender_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrender_INCLUDE_PATH}) - ENDIF (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB) - - IF (X11_XRes_INCLUDE_PATH AND X11_XRes_LIB) - SET(X11_XRes_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XRes_INCLUDE_PATH}) - ENDIF (X11_XRes_INCLUDE_PATH AND X11_XRes_LIB) - - IF (X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB) - SET(X11_Xrandr_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH}) - ENDIF (X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB) - - IF (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB) - SET(X11_xf86misc_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86misc_INCLUDE_PATH}) - ENDIF (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB) - - IF (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB) - SET(X11_xf86vmode_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH}) - ENDIF (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB) - - IF (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB) - SET(X11_Xcursor_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcursor_INCLUDE_PATH}) - ENDIF (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB) - - IF (X11_Xscreensaver_INCLUDE_PATH AND X11_Xscreensaver_LIB) - SET(X11_Xscreensaver_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xscreensaver_INCLUDE_PATH}) - ENDIF (X11_Xscreensaver_INCLUDE_PATH AND X11_Xscreensaver_LIB) - - IF (X11_dpms_INCLUDE_PATH) - SET(X11_dpms_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_dpms_INCLUDE_PATH}) - ENDIF (X11_dpms_INCLUDE_PATH) - - IF (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH) - SET(X11_Xkb_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkb_INCLUDE_PATH} ) - ENDIF (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH) - - IF (X11_Xkbfile_INCLUDE_PATH AND X11_Xkbfile_LIB AND X11_Xlib_INCLUDE_PATH) - SET(X11_Xkbfile_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkbfile_INCLUDE_PATH} ) - ENDIF (X11_Xkbfile_INCLUDE_PATH AND X11_Xkbfile_LIB AND X11_Xlib_INCLUDE_PATH) - - IF (X11_Xmu_INCLUDE_PATH AND X11_Xmu_LIB) - SET(X11_Xmu_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xmu_INCLUDE_PATH}) - ENDIF (X11_Xmu_INCLUDE_PATH AND X11_Xmu_LIB) - - IF (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB) - SET(X11_Xinput_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinput_INCLUDE_PATH}) - ENDIF (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB) - - IF (X11_XSync_INCLUDE_PATH) - SET(X11_XSync_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XSync_INCLUDE_PATH}) - ENDIF (X11_XSync_INCLUDE_PATH) - - IF(X11_ICE_LIB AND X11_ICE_INCLUDE_PATH) - SET(X11_ICE_FOUND TRUE) - ENDIF(X11_ICE_LIB AND X11_ICE_INCLUDE_PATH) - - IF(X11_SM_LIB AND X11_SM_INCLUDE_PATH) - SET(X11_SM_FOUND TRUE) - ENDIF(X11_SM_LIB AND X11_SM_INCLUDE_PATH) - + find_library(X11_ICE_LIB ICE ${X11_LIB_SEARCH_PATH}) + find_library(X11_SM_LIB SM ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xau_LIB Xau ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xcomposite_LIB Xcomposite ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xcursor_LIB Xcursor ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xdamage_LIB Xdamage ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xdmcp_LIB Xdmcp ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xfixes_LIB Xfixes ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xi_LIB Xi ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xkbfile_LIB xkbfile ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xmu_LIB Xmu ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH}) + find_library(X11_XRes_LIB XRes ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xscreensaver_LIB Xss ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH}) + find_library(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xxf86vm_LIB Xxf86vm ${X11_LIB_SEARCH_PATH}) + + set(X11_LIBRARY_DIR "") + if(X11_X11_LIB) + get_filename_component(X11_LIBRARY_DIR ${X11_X11_LIB} PATH) + endif() + + set(X11_INCLUDE_DIR) # start with empty list + if(X11_X11_INCLUDE_PATH) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH}) + endif() + + if(X11_Xlib_INCLUDE_PATH) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xlib_INCLUDE_PATH}) + endif() + + if(X11_Xutil_INCLUDE_PATH) + set(X11_Xutil_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xutil_INCLUDE_PATH}) + endif() + + if(X11_Xshape_INCLUDE_PATH) + set(X11_Xshape_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xshape_INCLUDE_PATH}) + endif() + + set(X11_LIBRARIES) # start with empty list + if(X11_X11_LIB) + set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB}) + endif() + + if(X11_Xext_LIB) + set(X11_Xext_FOUND TRUE) + set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xext_LIB}) + endif() + + if(X11_Xt_LIB AND X11_Xt_INCLUDE_PATH) + set(X11_Xt_FOUND TRUE) + endif() + + if(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH) + set(X11_Xft_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xft_INCLUDE_PATH}) + endif() + + if(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH) + set(X11_Xv_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xv_INCLUDE_PATH}) + endif() + + if (X11_Xau_LIB AND X11_Xau_INCLUDE_PATH) + set(X11_Xau_FOUND TRUE) + endif () + + if (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB) + set(X11_Xdmcp_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdmcp_INCLUDE_PATH}) + endif () + + if (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH) + set(X11_Xaccess_FOUND TRUE) + set(X11_Xaccess_INCLUDE_PATH ${X11_Xaccessstr_INCLUDE_PATH}) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xaccess_INCLUDE_PATH}) + endif () + + if (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB) + set(X11_Xpm_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xpm_INCLUDE_PATH}) + endif () + + if (X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB) + set(X11_Xcomposite_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcomposite_INCLUDE_PATH}) + endif () + + if (X11_Xdamage_INCLUDE_PATH AND X11_Xdamage_LIB) + set(X11_Xdamage_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdamage_INCLUDE_PATH}) + endif () + + if (X11_XShm_INCLUDE_PATH) + set(X11_XShm_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XShm_INCLUDE_PATH}) + endif () + + if (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB) + set(X11_XTest_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XTest_INCLUDE_PATH}) + endif () + + if (X11_Xi_INCLUDE_PATH AND X11_Xi_LIB) + set(X11_Xi_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xi_INCLUDE_PATH}) + endif () + + if (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB) + set(X11_Xinerama_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH}) + endif () + + if (X11_Xfixes_INCLUDE_PATH AND X11_Xfixes_LIB) + set(X11_Xfixes_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xfixes_INCLUDE_PATH}) + endif () + + if (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB) + set(X11_Xrender_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrender_INCLUDE_PATH}) + endif () + + if (X11_XRes_INCLUDE_PATH AND X11_XRes_LIB) + set(X11_XRes_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XRes_INCLUDE_PATH}) + endif () + + if (X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB) + set(X11_Xrandr_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH}) + endif () + + if (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB) + set(X11_xf86misc_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86misc_INCLUDE_PATH}) + endif () + + if (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB) + set(X11_xf86vmode_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH}) + endif () + + if (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB) + set(X11_Xcursor_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcursor_INCLUDE_PATH}) + endif () + + if (X11_Xscreensaver_INCLUDE_PATH AND X11_Xscreensaver_LIB) + set(X11_Xscreensaver_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xscreensaver_INCLUDE_PATH}) + endif () + + if (X11_dpms_INCLUDE_PATH) + set(X11_dpms_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_dpms_INCLUDE_PATH}) + endif () + + if (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH) + set(X11_Xkb_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkb_INCLUDE_PATH} ) + endif () + + if (X11_Xkbfile_INCLUDE_PATH AND X11_Xkbfile_LIB AND X11_Xlib_INCLUDE_PATH) + set(X11_Xkbfile_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkbfile_INCLUDE_PATH} ) + endif () + + if (X11_Xmu_INCLUDE_PATH AND X11_Xmu_LIB) + set(X11_Xmu_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xmu_INCLUDE_PATH}) + endif () + + if (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB) + set(X11_Xinput_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinput_INCLUDE_PATH}) + endif () + + if (X11_XSync_INCLUDE_PATH) + set(X11_XSync_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XSync_INCLUDE_PATH}) + endif () + + if(X11_ICE_LIB AND X11_ICE_INCLUDE_PATH) + set(X11_ICE_FOUND TRUE) + endif() + + if(X11_SM_LIB AND X11_SM_INCLUDE_PATH) + set(X11_SM_FOUND TRUE) + endif() + + # Most of the X11 headers will be in the same directories, avoid + # creating a huge list of duplicates. + if (X11_INCLUDE_DIR) + list(REMOVE_DUPLICATES X11_INCLUDE_DIR) + endif () # Deprecated variable for backwards compatibility with CMake 1.4 - IF (X11_X11_INCLUDE_PATH AND X11_LIBRARIES) - SET(X11_FOUND 1) - ENDIF (X11_X11_INCLUDE_PATH AND X11_LIBRARIES) + if (X11_X11_INCLUDE_PATH AND X11_LIBRARIES) + set(X11_FOUND 1) + endif () - IF(X11_FOUND) - INCLUDE(CheckFunctionExists) - INCLUDE(CheckLibraryExists) + if(X11_FOUND) + include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) # Translated from an autoconf-generated configure script. # See libs.m4 in autoconf's m4 directory. - IF($ENV{ISC} MATCHES "^yes$") - SET(X11_X_EXTRA_LIBS -lnsl_s -linet) - ELSE($ENV{ISC} MATCHES "^yes$") - SET(X11_X_EXTRA_LIBS "") + if($ENV{ISC} MATCHES "^yes$") + set(X11_X_EXTRA_LIBS -lnsl_s -linet) + else() + set(X11_X_EXTRA_LIBS "") # See if XOpenDisplay in X11 works by itself. CHECK_LIBRARY_EXISTS("${X11_LIBRARIES}" "XOpenDisplay" "${X11_LIBRARY_DIR}" X11_LIB_X11_SOLO) - IF(NOT X11_LIB_X11_SOLO) + if(NOT X11_LIB_X11_SOLO) # Find library needed for dnet_ntoa. CHECK_LIBRARY_EXISTS("dnet" "dnet_ntoa" "" X11_LIB_DNET_HAS_DNET_NTOA) - IF (X11_LIB_DNET_HAS_DNET_NTOA) - SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet) - ELSE (X11_LIB_DNET_HAS_DNET_NTOA) + if (X11_LIB_DNET_HAS_DNET_NTOA) + set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet) + else () CHECK_LIBRARY_EXISTS("dnet_stub" "dnet_ntoa" "" X11_LIB_DNET_STUB_HAS_DNET_NTOA) - IF (X11_LIB_DNET_STUB_HAS_DNET_NTOA) - SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet_stub) - ENDIF (X11_LIB_DNET_STUB_HAS_DNET_NTOA) - ENDIF (X11_LIB_DNET_HAS_DNET_NTOA) - ENDIF(NOT X11_LIB_X11_SOLO) + if (X11_LIB_DNET_STUB_HAS_DNET_NTOA) + set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet_stub) + endif () + endif () + endif() # Find library needed for gethostbyname. CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME) - IF(NOT CMAKE_HAVE_GETHOSTBYNAME) + if(NOT CMAKE_HAVE_GETHOSTBYNAME) CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) - IF (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) - SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lnsl) - ELSE (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) + if (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) + set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lnsl) + else () CHECK_LIBRARY_EXISTS("bsd" "gethostbyname" "" CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) - IF (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) - SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lbsd) - ENDIF (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) - ENDIF (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) - ENDIF(NOT CMAKE_HAVE_GETHOSTBYNAME) + if (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) + set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lbsd) + endif () + endif () + endif() # Find library needed for connect. CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT) - IF(NOT CMAKE_HAVE_CONNECT) + if(NOT CMAKE_HAVE_CONNECT) CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT) - IF (CMAKE_LIB_SOCKET_HAS_CONNECT) - SET (X11_X_EXTRA_LIBS -lsocket ${X11_X_EXTRA_LIBS}) - ENDIF (CMAKE_LIB_SOCKET_HAS_CONNECT) - ENDIF(NOT CMAKE_HAVE_CONNECT) + if (CMAKE_LIB_SOCKET_HAS_CONNECT) + set (X11_X_EXTRA_LIBS -lsocket ${X11_X_EXTRA_LIBS}) + endif () + endif() # Find library needed for remove. CHECK_FUNCTION_EXISTS("remove" CMAKE_HAVE_REMOVE) - IF(NOT CMAKE_HAVE_REMOVE) + if(NOT CMAKE_HAVE_REMOVE) CHECK_LIBRARY_EXISTS("posix" "remove" "" CMAKE_LIB_POSIX_HAS_REMOVE) - IF (CMAKE_LIB_POSIX_HAS_REMOVE) - SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lposix) - ENDIF (CMAKE_LIB_POSIX_HAS_REMOVE) - ENDIF(NOT CMAKE_HAVE_REMOVE) + if (CMAKE_LIB_POSIX_HAS_REMOVE) + set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lposix) + endif () + endif() # Find library needed for shmat. CHECK_FUNCTION_EXISTS("shmat" CMAKE_HAVE_SHMAT) - IF(NOT CMAKE_HAVE_SHMAT) + if(NOT CMAKE_HAVE_SHMAT) CHECK_LIBRARY_EXISTS("ipc" "shmat" "" CMAKE_LIB_IPS_HAS_SHMAT) - IF (CMAKE_LIB_IPS_HAS_SHMAT) - SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lipc) - ENDIF (CMAKE_LIB_IPS_HAS_SHMAT) - ENDIF(NOT CMAKE_HAVE_SHMAT) - ENDIF($ENV{ISC} MATCHES "^yes$") + if (CMAKE_LIB_IPS_HAS_SHMAT) + set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lipc) + endif () + endif() + endif() - IF (X11_ICE_FOUND) + if (X11_ICE_FOUND) CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}" CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) - IF(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) - SET (X11_X_PRE_LIBS ${X11_ICE_LIB}) - IF(X11_SM_LIB) - SET (X11_X_PRE_LIBS ${X11_SM_LIB} ${X11_X_PRE_LIBS}) - ENDIF(X11_SM_LIB) - ENDIF(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) - ENDIF (X11_ICE_FOUND) + if(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) + set (X11_X_PRE_LIBS ${X11_ICE_LIB}) + if(X11_SM_LIB) + set (X11_X_PRE_LIBS ${X11_SM_LIB} ${X11_X_PRE_LIBS}) + endif() + endif() + endif () # Build the final list of libraries. - SET(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS}) + set(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS}) - INCLUDE(FindPackageMessage) + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake) FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") - ELSE (X11_FOUND) - IF (X11_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find X11") - ENDIF (X11_FIND_REQUIRED) - ENDIF (X11_FOUND) + else () + if (X11_FIND_REQUIRED) + message(FATAL_ERROR "Could not find X11") + endif () + endif () - MARK_AS_ADVANCED( + mark_as_advanced( X11_X11_INCLUDE_PATH X11_X11_LIB X11_Xext_LIB @@ -486,7 +491,7 @@ IF (UNIX) X11_SM_INCLUDE_PATH X11_XSync_INCLUDE_PATH ) - SET(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE}) -ENDIF (UNIX) + set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE}) +endif () # X11_FIND_REQUIRED_ could be checked too diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake index eccfb487a..6bb578b46 100644 --- a/Modules/FindXMLRPC.cmake +++ b/Modules/FindXMLRPC.cmake @@ -10,7 +10,7 @@ # cgi-server CGI-based server # abyss-server ABYSS-based server # Typical usage: -# FIND_PACKAGE(XMLRPC REQUIRED libwww-client) +# find_package(XMLRPC REQUIRED libwww-client) #============================================================================= # Copyright 2001-2009 Kitware, Inc. @@ -26,121 +26,121 @@ # License text for the above reference.) # First find the config script from which to obtain other values. -FIND_PROGRAM(XMLRPC_C_CONFIG NAMES xmlrpc-c-config) +find_program(XMLRPC_C_CONFIG NAMES xmlrpc-c-config) # Check whether we found anything. -IF(XMLRPC_C_CONFIG) - SET(XMLRPC_FOUND 1) -ELSE(XMLRPC_C_CONFIG) - SET(XMLRPC_FOUND 0) -ENDIF(XMLRPC_C_CONFIG) +if(XMLRPC_C_CONFIG) + set(XMLRPC_FOUND 1) +else() + set(XMLRPC_FOUND 0) +endif() # Lookup the include directories needed for the components requested. -IF(XMLRPC_FOUND) +if(XMLRPC_FOUND) # Use the newer EXECUTE_PROCESS command if it is available. - IF(COMMAND EXECUTE_PROCESS) - EXECUTE_PROCESS( + if(COMMAND EXECUTE_PROCESS) + execute_process( COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --cflags OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT ) - ELSE(COMMAND EXECUTE_PROCESS) - EXEC_PROGRAM(${XMLRPC_C_CONFIG} ARGS "${XMLRPC_FIND_COMPONENTS} --cflags" + else() + exec_program(${XMLRPC_C_CONFIG} ARGS "${XMLRPC_FIND_COMPONENTS} --cflags" OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS RETURN_VALUE XMLRPC_C_CONFIG_RESULT ) - ENDIF(COMMAND EXECUTE_PROCESS) + endif() # Parse the include flags. - IF("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") + if("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") # Convert the compile flags to a CMake list. - STRING(REGEX REPLACE " +" ";" + string(REGEX REPLACE " +" ";" XMLRPC_C_CONFIG_CFLAGS "${XMLRPC_C_CONFIG_CFLAGS}") # Look for -I options. - SET(XMLRPC_INCLUDE_DIRS) - FOREACH(flag ${XMLRPC_C_CONFIG_CFLAGS}) - IF("${flag}" MATCHES "^-I") - STRING(REGEX REPLACE "^-I" "" DIR "${flag}") - FILE(TO_CMAKE_PATH "${DIR}" DIR) - SET(XMLRPC_INCLUDE_DIRS ${XMLRPC_INCLUDE_DIRS} "${DIR}") - ENDIF("${flag}" MATCHES "^-I") - ENDFOREACH(flag) - ELSE("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") - MESSAGE("Error running ${XMLRPC_C_CONFIG}: [${XMLRPC_C_CONFIG_RESULT}]") - SET(XMLRPC_FOUND 0) - ENDIF("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") -ENDIF(XMLRPC_FOUND) + set(XMLRPC_INCLUDE_DIRS) + foreach(flag ${XMLRPC_C_CONFIG_CFLAGS}) + if("${flag}" MATCHES "^-I") + string(REGEX REPLACE "^-I" "" DIR "${flag}") + file(TO_CMAKE_PATH "${DIR}" DIR) + set(XMLRPC_INCLUDE_DIRS ${XMLRPC_INCLUDE_DIRS} "${DIR}") + endif() + endforeach() + else() + message("Error running ${XMLRPC_C_CONFIG}: [${XMLRPC_C_CONFIG_RESULT}]") + set(XMLRPC_FOUND 0) + endif() +endif() # Lookup the libraries needed for the components requested. -IF(XMLRPC_FOUND) +if(XMLRPC_FOUND) # Use the newer EXECUTE_PROCESS command if it is available. - IF(COMMAND EXECUTE_PROCESS) - EXECUTE_PROCESS( + if(COMMAND EXECUTE_PROCESS) + execute_process( COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --libs OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT ) - ELSE(COMMAND EXECUTE_PROCESS) - EXEC_PROGRAM(${XMLRPC_C_CONFIG} ARGS "${XMLRPC_FIND_COMPONENTS} --libs" + else() + exec_program(${XMLRPC_C_CONFIG} ARGS "${XMLRPC_FIND_COMPONENTS} --libs" OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS RETURN_VALUE XMLRPC_C_CONFIG_RESULT ) - ENDIF(COMMAND EXECUTE_PROCESS) + endif() # Parse the library names and directories. - IF("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") - STRING(REGEX REPLACE " +" ";" + if("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") + string(REGEX REPLACE " +" ";" XMLRPC_C_CONFIG_LIBS "${XMLRPC_C_CONFIG_LIBS}") # Look for -L flags for directories and -l flags for library names. - SET(XMLRPC_LIBRARY_DIRS) - SET(XMLRPC_LIBRARY_NAMES) - FOREACH(flag ${XMLRPC_C_CONFIG_LIBS}) - IF("${flag}" MATCHES "^-L") - STRING(REGEX REPLACE "^-L" "" DIR "${flag}") - FILE(TO_CMAKE_PATH "${DIR}" DIR) - SET(XMLRPC_LIBRARY_DIRS ${XMLRPC_LIBRARY_DIRS} "${DIR}") - ELSEIF("${flag}" MATCHES "^-l") - STRING(REGEX REPLACE "^-l" "" NAME "${flag}") - SET(XMLRPC_LIBRARY_NAMES ${XMLRPC_LIBRARY_NAMES} "${NAME}") - ENDIF("${flag}" MATCHES "^-L") - ENDFOREACH(flag) + set(XMLRPC_LIBRARY_DIRS) + set(XMLRPC_LIBRARY_NAMES) + foreach(flag ${XMLRPC_C_CONFIG_LIBS}) + if("${flag}" MATCHES "^-L") + string(REGEX REPLACE "^-L" "" DIR "${flag}") + file(TO_CMAKE_PATH "${DIR}" DIR) + set(XMLRPC_LIBRARY_DIRS ${XMLRPC_LIBRARY_DIRS} "${DIR}") + elseif("${flag}" MATCHES "^-l") + string(REGEX REPLACE "^-l" "" NAME "${flag}") + set(XMLRPC_LIBRARY_NAMES ${XMLRPC_LIBRARY_NAMES} "${NAME}") + endif() + endforeach() # Search for each library needed using the directories given. - FOREACH(name ${XMLRPC_LIBRARY_NAMES}) + foreach(name ${XMLRPC_LIBRARY_NAMES}) # Look for this library. - FIND_LIBRARY(XMLRPC_${name}_LIBRARY + find_library(XMLRPC_${name}_LIBRARY NAMES ${name} HINTS ${XMLRPC_LIBRARY_DIRS} ) - MARK_AS_ADVANCED(XMLRPC_${name}_LIBRARY) + mark_as_advanced(XMLRPC_${name}_LIBRARY) # If any library is not found then the whole package is not found. - IF(NOT XMLRPC_${name}_LIBRARY) - SET(XMLRPC_FOUND 0) - ENDIF(NOT XMLRPC_${name}_LIBRARY) + if(NOT XMLRPC_${name}_LIBRARY) + set(XMLRPC_FOUND 0) + endif() # Build an ordered list of all the libraries needed. - SET(XMLRPC_LIBRARIES ${XMLRPC_LIBRARIES} "${XMLRPC_${name}_LIBRARY}") - ENDFOREACH(name) - ELSE("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") - MESSAGE("Error running ${XMLRPC_C_CONFIG}: [${XMLRPC_C_CONFIG_RESULT}]") - SET(XMLRPC_FOUND 0) - ENDIF("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") -ENDIF(XMLRPC_FOUND) + set(XMLRPC_LIBRARIES ${XMLRPC_LIBRARIES} "${XMLRPC_${name}_LIBRARY}") + endforeach() + else() + message("Error running ${XMLRPC_C_CONFIG}: [${XMLRPC_C_CONFIG_RESULT}]") + set(XMLRPC_FOUND 0) + endif() +endif() # Report the results. -IF(NOT XMLRPC_FOUND) - SET(XMLRPC_DIR_MESSAGE +if(NOT XMLRPC_FOUND) + set(XMLRPC_DIR_MESSAGE "XMLRPC was not found. Make sure the entries XMLRPC_* are set.") - IF(NOT XMLRPC_FIND_QUIETLY) - MESSAGE(STATUS "${XMLRPC_DIR_MESSAGE}") - ELSE(NOT XMLRPC_FIND_QUIETLY) - IF(XMLRPC_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "${XMLRPC_DIR_MESSAGE}") - ENDIF(XMLRPC_FIND_REQUIRED) - ENDIF(NOT XMLRPC_FIND_QUIETLY) -ENDIF(NOT XMLRPC_FOUND) + if(NOT XMLRPC_FIND_QUIETLY) + message(STATUS "${XMLRPC_DIR_MESSAGE}") + else() + if(XMLRPC_FIND_REQUIRED) + message(FATAL_ERROR "${XMLRPC_DIR_MESSAGE}") + endif() + endif() +endif() diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index 166e29181..00b9c64da 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -34,59 +34,59 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET(_ZLIB_SEARCHES) +set(_ZLIB_SEARCHES) # Search ZLIB_ROOT first if it is set. -IF(ZLIB_ROOT) - SET(_ZLIB_SEARCH_ROOT PATHS ${ZLIB_ROOT} NO_DEFAULT_PATH) - LIST(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT) -ENDIF() +if(ZLIB_ROOT) + set(_ZLIB_SEARCH_ROOT PATHS ${ZLIB_ROOT} NO_DEFAULT_PATH) + list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT) +endif() # Normal search. -SET(_ZLIB_SEARCH_NORMAL +set(_ZLIB_SEARCH_NORMAL PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]" "$ENV{PROGRAMFILES}/zlib" ) -LIST(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL) +list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL) -SET(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1) +set(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1) # Try each search configuration. -FOREACH(search ${_ZLIB_SEARCHES}) - FIND_PATH(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include) - FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib) -ENDFOREACH() +foreach(search ${_ZLIB_SEARCHES}) + find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include) + find_library(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib) +endforeach() -MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) +mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) -IF(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") - FILE(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$") +if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") + file(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$") - STRING(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}") - STRING(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}") - STRING(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}") - SET(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}") + string(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}") + string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}") + string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}") + set(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}") # only append a TWEAK version if it exists: - SET(ZLIB_VERSION_TWEAK "") - IF( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$") - SET(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}") - SET(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}") - ENDIF( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$") + set(ZLIB_VERSION_TWEAK "") + if( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$") + set(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}") + set(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}") + endif() - SET(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}") - SET(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}") - SET(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}") -ENDIF() + set(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}") + set(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}") + set(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}") +endif() -# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR VERSION_VAR ZLIB_VERSION_STRING) -IF(ZLIB_FOUND) - SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) - SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) -ENDIF() +if(ZLIB_FOUND) + set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) + set(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) +endif() diff --git a/Modules/Findosg.cmake b/Modules/Findosg.cmake index 0106372e3..bc1e48a6e 100644 --- a/Modules/Findosg.cmake +++ b/Modules/Findosg.cmake @@ -3,16 +3,16 @@ # introduced in CMake 2.6.3 and not use this Find module directly. # # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osg # This module defines # @@ -46,7 +46,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSG osg/PositionAttitudeTransform) OSG_FIND_LIBRARY(OSG osg) diff --git a/Modules/FindosgAnimation.cmake b/Modules/FindosgAnimation.cmake index b9b44a081..121aefcec 100644 --- a/Modules/FindosgAnimation.cmake +++ b/Modules/FindosgAnimation.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgAnimation # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGANIMATION osgAnimation/Animation) OSG_FIND_LIBRARY(OSGANIMATION osgAnimation) diff --git a/Modules/FindosgDB.cmake b/Modules/FindosgDB.cmake index eabdde72d..1ed94a108 100644 --- a/Modules/FindosgDB.cmake +++ b/Modules/FindosgDB.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgDB # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGDB osgDB/DatabasePager) OSG_FIND_LIBRARY(OSGDB osgDB) diff --git a/Modules/FindosgFX.cmake b/Modules/FindosgFX.cmake index 81d5af5a2..1f1d59f46 100644 --- a/Modules/FindosgFX.cmake +++ b/Modules/FindosgFX.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgFX # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGFX osgFX/BumpMapping) OSG_FIND_LIBRARY(OSGFX osgFX) diff --git a/Modules/FindosgGA.cmake b/Modules/FindosgGA.cmake index a4fe79b0d..e60f7f5a7 100644 --- a/Modules/FindosgGA.cmake +++ b/Modules/FindosgGA.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgGA # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGGA osgGA/FlightManipulator) OSG_FIND_LIBRARY(OSGGA osgGA) diff --git a/Modules/FindosgIntrospection.cmake b/Modules/FindosgIntrospection.cmake index 24e6ed585..a430ad6e9 100644 --- a/Modules/FindosgIntrospection.cmake +++ b/Modules/FindosgIntrospection.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgINTROSPECTION # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGINTROSPECTION osgIntrospection/Reflection) OSG_FIND_LIBRARY(OSGINTROSPECTION osgIntrospection) diff --git a/Modules/FindosgManipulator.cmake b/Modules/FindosgManipulator.cmake index f71b5fd5c..32d6def7b 100644 --- a/Modules/FindosgManipulator.cmake +++ b/Modules/FindosgManipulator.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgManipulator # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGMANIPULATOR osgManipulator/TrackballDragger) OSG_FIND_LIBRARY(OSGMANIPULATOR osgManipulator) diff --git a/Modules/FindosgParticle.cmake b/Modules/FindosgParticle.cmake index f23a83fdd..1a6ae0b93 100644 --- a/Modules/FindosgParticle.cmake +++ b/Modules/FindosgParticle.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgParticle # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGPARTICLE osgParticle/FireEffect) OSG_FIND_LIBRARY(OSGPARTICLE osgParticle) diff --git a/Modules/FindosgPresentation.cmake b/Modules/FindosgPresentation.cmake index f89e25f9c..412502a8c 100644 --- a/Modules/FindosgPresentation.cmake +++ b/Modules/FindosgPresentation.cmake @@ -43,7 +43,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGPRESENTATION osgPresentation/SlideEventHandler) OSG_FIND_LIBRARY(OSGPRESENTATION osgPresentation) diff --git a/Modules/FindosgProducer.cmake b/Modules/FindosgProducer.cmake index 51f609064..ea561a036 100644 --- a/Modules/FindosgProducer.cmake +++ b/Modules/FindosgProducer.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgProducer # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGPRODUCER osgProducer/OsgSceneHandler) OSG_FIND_LIBRARY(OSGPRODUCER osgProducer) diff --git a/Modules/FindosgQt.cmake b/Modules/FindosgQt.cmake index ddc91287b..c7e8fee64 100644 --- a/Modules/FindosgQt.cmake +++ b/Modules/FindosgQt.cmake @@ -43,7 +43,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGQT osgQt/GraphicsWindowQt) OSG_FIND_LIBRARY(OSGQT osgQt) diff --git a/Modules/FindosgShadow.cmake b/Modules/FindosgShadow.cmake index 278f8ae9e..f3be0bfdf 100644 --- a/Modules/FindosgShadow.cmake +++ b/Modules/FindosgShadow.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgShadow # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGSHADOW osgShadow/ShadowTexture) OSG_FIND_LIBRARY(OSGSHADOW osgShadow) diff --git a/Modules/FindosgSim.cmake b/Modules/FindosgSim.cmake index 15daf64fe..19cd17582 100644 --- a/Modules/FindosgSim.cmake +++ b/Modules/FindosgSim.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgSim # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGSIM osgSim/ImpostorSprite) OSG_FIND_LIBRARY(OSGSIM osgSim) diff --git a/Modules/FindosgTerrain.cmake b/Modules/FindosgTerrain.cmake index fbf373e59..4b7249e62 100644 --- a/Modules/FindosgTerrain.cmake +++ b/Modules/FindosgTerrain.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgTerrain # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGTERRAIN osgTerrain/Terrain) OSG_FIND_LIBRARY(OSGTERRAIN osgTerrain) diff --git a/Modules/FindosgText.cmake b/Modules/FindosgText.cmake index 22f825f54..41683c728 100644 --- a/Modules/FindosgText.cmake +++ b/Modules/FindosgText.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgText # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGTEXT osgText/Text) OSG_FIND_LIBRARY(OSGTEXT osgText) diff --git a/Modules/FindosgUtil.cmake b/Modules/FindosgUtil.cmake index 05a74df84..85c117723 100644 --- a/Modules/FindosgUtil.cmake +++ b/Modules/FindosgUtil.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgUtil # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGUTIL osgUtil/SceneView) OSG_FIND_LIBRARY(OSGUTIL osgUtil) diff --git a/Modules/FindosgViewer.cmake b/Modules/FindosgViewer.cmake index 650dbd7ef..d2252f4df 100644 --- a/Modules/FindosgViewer.cmake +++ b/Modules/FindosgViewer.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgViewer # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGVIEWER osgViewer/Viewer) OSG_FIND_LIBRARY(OSGVIEWER osgViewer) diff --git a/Modules/FindosgVolume.cmake b/Modules/FindosgVolume.cmake index 3ad7edc24..ae2d95c39 100644 --- a/Modules/FindosgVolume.cmake +++ b/Modules/FindosgVolume.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgVolume # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGVOLUME osgVolume/Volume) OSG_FIND_LIBRARY(OSGVOLUME osgVolume) diff --git a/Modules/FindosgWidget.cmake b/Modules/FindosgWidget.cmake index 206a8b7f5..cb2e12fca 100644 --- a/Modules/FindosgWidget.cmake +++ b/Modules/FindosgWidget.cmake @@ -1,14 +1,14 @@ # This is part of the Findosg* suite used to find OpenSceneGraph components. -# Each component is separate and you must opt in to each module. You must -# also opt into OpenGL and OpenThreads (and Producer if needed) as these -# modules won't do it for you. This is to allow you control over your own +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own # system piece by piece in case you need to opt out of certain components # or change the Find behavior for a particular module (perhaps because the # default FindOpenGL.cmake module doesn't work with your system as an # example). # If you want to use a more convenient module that includes everything, # use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. -# +# # Locate osgWidget # This module defines # @@ -42,7 +42,7 @@ # #include # #include -include(Findosg_functions) +include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake) OSG_FIND_PATH (OSGWIDGET osgWidget/Widget) OSG_FIND_LIBRARY(OSGWIDGET osgWidget) diff --git a/Modules/Findosg_functions.cmake b/Modules/Findosg_functions.cmake index ab836ff9f..2e908379f 100644 --- a/Modules/Findosg_functions.cmake +++ b/Modules/Findosg_functions.cmake @@ -1,11 +1,12 @@ # # This CMake file contains two macros to assist with searching for OSG -# libraries and nodekits. +# libraries and nodekits. Please see FindOpenSceneGraph.cmake for full +# documentation. # #============================================================================= # Copyright 2009 Kitware, Inc. -# Copyright 2009 Philip Lowman +# Copyright 2009-2012 Philip Lowman # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -26,10 +27,12 @@ function(OSG_FIND_PATH module header) # Try the user's environment request before anything else. find_path(${module_uc}_INCLUDE_DIR ${header} HINTS - $ENV{${module_uc}_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - $ENV{OSG_ROOT} + ENV ${module_uc}_DIR + ENV OSG_DIR + ENV OSGDIR + ENV OSG_ROOT + ${${module_uc}_DIR} + ${OSG_DIR} PATH_SUFFIXES include PATHS /sw # Fink @@ -38,7 +41,7 @@ function(OSG_FIND_PATH module header) /opt /usr/freeware ) -endfunction(OSG_FIND_PATH module header) +endfunction() # @@ -50,11 +53,13 @@ function(OSG_FIND_LIBRARY module library) find_library(${module_uc}_LIBRARY NAMES ${library} HINTS - $ENV{${module_uc}_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - $ENV{OSG_ROOT} - PATH_SUFFIXES lib64 lib + ENV ${module_uc}_DIR + ENV OSG_DIR + ENV OSGDIR + ENV OSG_ROOT + ${${module_uc}_DIR} + ${OSG_DIR} + PATH_SUFFIXES lib PATHS /sw # Fink /opt/local # DarwinPorts @@ -66,11 +71,13 @@ function(OSG_FIND_LIBRARY module library) find_library(${module_uc}_LIBRARY_DEBUG NAMES ${library}d HINTS - $ENV{${module_uc}_DIR} - $ENV{OSG_DIR} - $ENV{OSGDIR} - $ENV{OSG_ROOT} - PATH_SUFFIXES lib64 lib + ENV ${module_uc}_DIR + ENV OSG_DIR + ENV OSGDIR + ENV OSG_ROOT + ${${module_uc}_DIR} + ${OSG_DIR} + PATH_SUFFIXES lib PATHS /sw # Fink /opt/local # DarwinPorts @@ -85,13 +92,13 @@ function(OSG_FIND_LIBRARY module library) set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARY} PARENT_SCOPE) else() # They really have a FOO_LIBRARY_DEBUG - set(${module_uc}_LIBRARIES + set(${module_uc}_LIBRARIES optimized ${${module_uc}_LIBRARY} debug ${${module_uc}_LIBRARY_DEBUG} PARENT_SCOPE ) endif() -endfunction(OSG_FIND_LIBRARY module library) +endfunction() # # OSG_MARK_AS_ADVANCED diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 865a6c5d1..218d47613 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -3,9 +3,9 @@ # configuration to use. wxWidgets is a modular library. To specify the # modules that you will use, you need to name them as components to # the package: -# -# FIND_PACKAGE(wxWidgets COMPONENTS core base ...) -# +# +# find_package(wxWidgets COMPONENTS core base ...) +# # There are two search branches: a windows style and a unix style. For # windows, the following variables are searched for and set to # defaults in case of multiple choices. Change them if the defaults @@ -22,7 +22,7 @@ # - Set to TRUE to exclude linking of # commonly required libs (e.g., png tiff # jpeg zlib regex expat). -# +# # For unix style it uses the wx-config utility. You can select between # debug/release, unicode/ansi, universal/non-universal, and # static/shared in the QtDialog or ccmake interfaces by turning ON/OFF @@ -38,7 +38,7 @@ # example, to use the base toolkit found in the /usr/local path, set # the variable (before calling the FIND_PACKAGE command) as such: # -# SET(wxWidgets_CONFIG_OPTIONS --toolkit=base --prefix=/usr) +# set(wxWidgets_CONFIG_OPTIONS --toolkit=base --prefix=/usr) # # The following are set after the configuration is done for both # windows and unix style: @@ -62,18 +62,18 @@ # # Sample usage: # # Note that for MinGW users the order of libs is important! -# FIND_PACKAGE(wxWidgets COMPONENTS net gl core base) -# IF(wxWidgets_FOUND) -# INCLUDE(${wxWidgets_USE_FILE}) +# find_package(wxWidgets COMPONENTS net gl core base) +# if(wxWidgets_FOUND) +# include(${wxWidgets_USE_FILE}) # # and for each of your dependent executable/library targets: -# TARGET_LINK_LIBRARIES( ${wxWidgets_LIBRARIES}) -# ENDIF(wxWidgets_FOUND) +# target_link_libraries( ${wxWidgets_LIBRARIES}) +# endif() # # If wxWidgets is required (i.e., not an optional part): -# FIND_PACKAGE(wxWidgets REQUIRED net gl core base) -# INCLUDE(${wxWidgets_USE_FILE}) +# find_package(wxWidgets REQUIRED net gl core base) +# include(${wxWidgets_USE_FILE}) # # and for each of your dependent executable/library targets: -# TARGET_LINK_LIBRARIES( ${wxWidgets_LIBRARIES}) +# target_link_libraries( ${wxWidgets_LIBRARIES}) #============================================================================= # Copyright 2004-2009 Kitware, Inc. @@ -94,7 +94,7 @@ # Remember to connect back to the upper text. # Sample usage with monolithic wx build: # -# FIND_PACKAGE(wxWidgets COMPONENTS mono) +# find_package(wxWidgets COMPONENTS mono) # ... # NOTES @@ -140,24 +140,24 @@ # FIXME: This and all the DBG_MSG calls should be removed after the # module stabilizes. -# +# # Helper macro to control the debugging output globally. There are # two versions for controlling how verbose your output should be. -MACRO(DBG_MSG _MSG) -# MESSAGE(STATUS +macro(DBG_MSG _MSG) +# message(STATUS # "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}") -ENDMACRO(DBG_MSG) -MACRO(DBG_MSG_V _MSG) -# MESSAGE(STATUS +endmacro() +macro(DBG_MSG_V _MSG) +# message(STATUS # "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}") -ENDMACRO(DBG_MSG_V) +endmacro() # Clear return values in case the module is loaded more than once. -SET(wxWidgets_FOUND FALSE) -SET(wxWidgets_INCLUDE_DIRS "") -SET(wxWidgets_LIBRARIES "") -SET(wxWidgets_LIBRARY_DIRS "") -SET(wxWidgets_CXX_FLAGS "") +set(wxWidgets_FOUND FALSE) +set(wxWidgets_INCLUDE_DIRS "") +set(wxWidgets_LIBRARIES "") +set(wxWidgets_LIBRARY_DIRS "") +set(wxWidgets_CXX_FLAGS "") # Using SYSTEM with INCLUDE_DIRECTORIES in conjunction with wxWidgets on # the Mac produces compiler errors. Set wxWidgets_INCLUDE_DIRS_NO_SYSTEM @@ -167,9 +167,9 @@ SET(wxWidgets_CXX_FLAGS "") # http://www.cmake.org/pipermail/cmake/2008-April/021115.html # http://www.cmake.org/pipermail/cmake/2008-April/021146.html # -IF(APPLE OR CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") - SET(wxWidgets_INCLUDE_DIRS_NO_SYSTEM 1) -ENDIF() +if(APPLE OR CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") + set(wxWidgets_INCLUDE_DIRS_NO_SYSTEM 1) +endif() # DEPRECATED: This is a patch to support the DEPRECATED use of # wxWidgets_USE_LIBS. @@ -177,9 +177,9 @@ ENDIF() # If wxWidgets_USE_LIBS is set: # - if using , then override wxWidgets_USE_LIBS # - else set wxWidgets_FIND_COMPONENTS to wxWidgets_USE_LIBS -IF(wxWidgets_USE_LIBS AND NOT wxWidgets_FIND_COMPONENTS) - SET(wxWidgets_FIND_COMPONENTS ${wxWidgets_USE_LIBS}) -ENDIF(wxWidgets_USE_LIBS AND NOT wxWidgets_FIND_COMPONENTS) +if(wxWidgets_USE_LIBS AND NOT wxWidgets_FIND_COMPONENTS) + set(wxWidgets_FIND_COMPONENTS ${wxWidgets_USE_LIBS}) +endif() DBG_MSG("wxWidgets_FIND_COMPONENTS : ${wxWidgets_FIND_COMPONENTS}") # Add the convenience use file if available. @@ -187,50 +187,50 @@ DBG_MSG("wxWidgets_FIND_COMPONENTS : ${wxWidgets_FIND_COMPONENTS}") # Get dir of this file which may reside in: # - CMAKE_MAKE_ROOT/Modules on CMake installation # - CMAKE_MODULE_PATH if user prefers his own specialized version -SET(wxWidgets_USE_FILE "") -GET_FILENAME_COMPONENT( +set(wxWidgets_USE_FILE "") +get_filename_component( wxWidgets_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) # Prefer an existing customized version, but the user might override # the FindwxWidgets module and not the UsewxWidgets one. -IF(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") - SET(wxWidgets_USE_FILE +if(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") + set(wxWidgets_USE_FILE "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") -ELSE(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") - SET(wxWidgets_USE_FILE UsewxWidgets) -ENDIF(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") +else() + set(wxWidgets_USE_FILE UsewxWidgets) +endif() #===================================================================== #===================================================================== -IF(WIN32 AND NOT CYGWIN AND NOT MSYS) - SET(wxWidgets_FIND_STYLE "win32") -ELSE(WIN32 AND NOT CYGWIN AND NOT MSYS) - IF(UNIX OR MSYS) - SET(wxWidgets_FIND_STYLE "unix") - ENDIF(UNIX OR MSYS) -ENDIF(WIN32 AND NOT CYGWIN AND NOT MSYS) +if(WIN32 AND NOT CYGWIN AND NOT MSYS) + set(wxWidgets_FIND_STYLE "win32") +else() + if(UNIX OR MSYS) + set(wxWidgets_FIND_STYLE "unix") + endif() +endif() #===================================================================== # WIN32_FIND_STYLE #===================================================================== -IF(wxWidgets_FIND_STYLE STREQUAL "win32") +if(wxWidgets_FIND_STYLE STREQUAL "win32") # Useful common wx libs needed by almost all components. - SET(wxWidgets_COMMON_LIBRARIES png tiff jpeg zlib regex expat) + set(wxWidgets_COMMON_LIBRARIES png tiff jpeg zlib regex expat) - # DEPRECATED: Use FIND_PACKAGE(wxWidgets COMPONENTS mono) instead. - IF(NOT wxWidgets_FIND_COMPONENTS) - IF(wxWidgets_USE_MONOLITHIC) - SET(wxWidgets_FIND_COMPONENTS mono) - ELSE(wxWidgets_USE_MONOLITHIC) - SET(wxWidgets_FIND_COMPONENTS core base) # this is default - ENDIF(wxWidgets_USE_MONOLITHIC) - ENDIF(NOT wxWidgets_FIND_COMPONENTS) + # DEPRECATED: Use find_package(wxWidgets COMPONENTS mono) instead. + if(NOT wxWidgets_FIND_COMPONENTS) + if(wxWidgets_USE_MONOLITHIC) + set(wxWidgets_FIND_COMPONENTS mono) + else() + set(wxWidgets_FIND_COMPONENTS core base) # this is default + endif() + endif() # Add the common (usually required libs) unless # wxWidgets_EXCLUDE_COMMON_LIBRARIES has been set. - IF(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES) - LIST(APPEND wxWidgets_FIND_COMPONENTS + if(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES) + list(APPEND wxWidgets_FIND_COMPONENTS ${wxWidgets_COMMON_LIBRARIES}) - ENDIF(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES) + endif() #------------------------------------------------------------------- # WIN32: Helper MACROS @@ -240,19 +240,19 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") # if _CONFIGURATION = mswunivud, then _UNV=univ, _UCD=u _DBG=d # if _CONFIGURATION = mswu, then _UNV="", _UCD=u _DBG="" # - MACRO(WX_GET_NAME_COMPONENTS _CONFIGURATION _UNV _UCD _DBG) - STRING(REGEX MATCH "univ" ${_UNV} "${_CONFIGURATION}") - STRING(REGEX REPLACE "msw.*(u)[d]*$" "u" ${_UCD} "${_CONFIGURATION}") - IF(${_UCD} STREQUAL ${_CONFIGURATION}) - SET(${_UCD} "") - ENDIF(${_UCD} STREQUAL ${_CONFIGURATION}) - STRING(REGEX MATCH "d$" ${_DBG} "${_CONFIGURATION}") - ENDMACRO(WX_GET_NAME_COMPONENTS) + macro(WX_GET_NAME_COMPONENTS _CONFIGURATION _UNV _UCD _DBG) + string(REGEX MATCH "univ" ${_UNV} "${_CONFIGURATION}") + string(REGEX REPLACE "msw.*(u)[d]*$" "u" ${_UCD} "${_CONFIGURATION}") + if(${_UCD} STREQUAL ${_CONFIGURATION}) + set(${_UCD} "") + endif() + string(REGEX MATCH "d$" ${_DBG} "${_CONFIGURATION}") + endmacro() # # Find libraries associated to a configuration. # - MACRO(WX_FIND_LIBS _UNV _UCD _DBG) + macro(WX_FIND_LIBS _UNV _UCD _DBG) DBG_MSG_V("m_unv = ${_UNV}") DBG_MSG_V("m_ucd = ${_UCD}") DBG_MSG_V("m_dbg = ${_DBG}") @@ -260,19 +260,19 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") # FIXME: What if both regex libs are available. regex should be # found outside the loop and only wx${LIB}${_UCD}${_DBG}. # Find wxWidgets common libraries. - FOREACH(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla) - FIND_LIBRARY(WX_${LIB}${_DBG} + foreach(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla) + find_library(WX_${LIB}${_DBG} NAMES wx${LIB}${_UCD}${_DBG} # for regex wx${LIB}${_DBG} PATHS ${WX_LIB_DIR} NO_DEFAULT_PATH ) - MARK_AS_ADVANCED(WX_${LIB}${_DBG}) - ENDFOREACH(LIB) + mark_as_advanced(WX_${LIB}${_DBG}) + endforeach() # Find wxWidgets multilib base libraries. - FIND_LIBRARY(WX_base${_DBG} + find_library(WX_base${_DBG} NAMES wxbase29${_UCD}${_DBG} wxbase28${_UCD}${_DBG} @@ -282,9 +282,9 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") PATHS ${WX_LIB_DIR} NO_DEFAULT_PATH ) - MARK_AS_ADVANCED(WX_base${_DBG}) - FOREACH(LIB net odbc xml) - FIND_LIBRARY(WX_${LIB}${_DBG} + mark_as_advanced(WX_base${_DBG}) + foreach(LIB net odbc xml) + find_library(WX_${LIB}${_DBG} NAMES wxbase29${_UCD}${_DBG}_${LIB} wxbase28${_UCD}${_DBG}_${LIB} @@ -294,11 +294,11 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") PATHS ${WX_LIB_DIR} NO_DEFAULT_PATH ) - MARK_AS_ADVANCED(WX_${LIB}${_DBG}) - ENDFOREACH(LIB) + mark_as_advanced(WX_${LIB}${_DBG}) + endforeach() # Find wxWidgets monolithic library. - FIND_LIBRARY(WX_mono${_DBG} + find_library(WX_mono${_DBG} NAMES wxmsw${_UNV}29${_UCD}${_DBG} wxmsw${_UNV}28${_UCD}${_DBG} @@ -308,12 +308,12 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") PATHS ${WX_LIB_DIR} NO_DEFAULT_PATH ) - MARK_AS_ADVANCED(WX_mono${_DBG}) + mark_as_advanced(WX_mono${_DBG}) # Find wxWidgets multilib libraries. - FOREACH(LIB core adv aui html media xrc dbgrid gl qa richtext + foreach(LIB core adv aui html media xrc dbgrid gl qa richtext stc ribbon propgrid webview) - FIND_LIBRARY(WX_${LIB}${_DBG} + find_library(WX_${LIB}${_DBG} NAMES wxmsw${_UNV}29${_UCD}${_DBG}_${LIB} wxmsw${_UNV}28${_UCD}${_DBG}_${LIB} @@ -323,111 +323,111 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") PATHS ${WX_LIB_DIR} NO_DEFAULT_PATH ) - MARK_AS_ADVANCED(WX_${LIB}${_DBG}) - ENDFOREACH(LIB) - ENDMACRO(WX_FIND_LIBS) + mark_as_advanced(WX_${LIB}${_DBG}) + endforeach() + endmacro() # # Clear all library paths, so that FIND_LIBRARY refinds them. # # Clear a lib, reset its found flag, and mark as advanced. - MACRO(WX_CLEAR_LIB _LIB) - SET(${_LIB} "${_LIB}-NOTFOUND" CACHE FILEPATH "Cleared." FORCE) - SET(${_LIB}_FOUND FALSE) - MARK_AS_ADVANCED(${_LIB}) - ENDMACRO(WX_CLEAR_LIB) + macro(WX_CLEAR_LIB _LIB) + set(${_LIB} "${_LIB}-NOTFOUND" CACHE FILEPATH "Cleared." FORCE) + set(${_LIB}_FOUND FALSE) + mark_as_advanced(${_LIB}) + endmacro() # Clear all debug or release library paths (arguments are "d" or ""). - MACRO(WX_CLEAR_ALL_LIBS _DBG) + macro(WX_CLEAR_ALL_LIBS _DBG) # Clear wxWidgets common libraries. - FOREACH(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla) + foreach(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla) WX_CLEAR_LIB(WX_${LIB}${_DBG}) - ENDFOREACH(LIB) + endforeach() # Clear wxWidgets multilib base libraries. WX_CLEAR_LIB(WX_base${_DBG}) - FOREACH(LIB net odbc xml) + foreach(LIB net odbc xml) WX_CLEAR_LIB(WX_${LIB}${_DBG}) - ENDFOREACH(LIB) + endforeach() # Clear wxWidgets monolithic library. WX_CLEAR_LIB(WX_mono${_DBG}) # Clear wxWidgets multilib libraries. - FOREACH(LIB core adv aui html media xrc dbgrid gl qa richtext + foreach(LIB core adv aui html media xrc dbgrid gl qa richtext stc ribbon propgrid) WX_CLEAR_LIB(WX_${LIB}${_DBG}) - ENDFOREACH(LIB) - ENDMACRO(WX_CLEAR_ALL_LIBS) + endforeach() + endmacro() # Clear all wxWidgets debug libraries. - MACRO(WX_CLEAR_ALL_DBG_LIBS) + macro(WX_CLEAR_ALL_DBG_LIBS) WX_CLEAR_ALL_LIBS("d") - ENDMACRO(WX_CLEAR_ALL_DBG_LIBS) + endmacro() # Clear all wxWidgets release libraries. - MACRO(WX_CLEAR_ALL_REL_LIBS) + macro(WX_CLEAR_ALL_REL_LIBS) WX_CLEAR_ALL_LIBS("") - ENDMACRO(WX_CLEAR_ALL_REL_LIBS) + endmacro() # # Set the wxWidgets_LIBRARIES variable. # Also, Sets output variable wxWidgets_FOUND to FALSE if it fails. # - MACRO(WX_SET_LIBRARIES _LIBS _DBG) + macro(WX_SET_LIBRARIES _LIBS _DBG) DBG_MSG_V("Looking for ${${_LIBS}}") - IF(WX_USE_REL_AND_DBG) - FOREACH(LIB ${${_LIBS}}) + if(WX_USE_REL_AND_DBG) + foreach(LIB ${${_LIBS}}) DBG_MSG_V("Searching for ${LIB} and ${LIB}d") DBG_MSG_V("WX_${LIB} : ${WX_${LIB}}") DBG_MSG_V("WX_${LIB}d : ${WX_${LIB}d}") - IF(WX_${LIB} AND WX_${LIB}d) + if(WX_${LIB} AND WX_${LIB}d) DBG_MSG_V("Found ${LIB} and ${LIB}d") - LIST(APPEND wxWidgets_LIBRARIES + list(APPEND wxWidgets_LIBRARIES debug ${WX_${LIB}d} optimized ${WX_${LIB}} ) - ELSE(WX_${LIB} AND WX_${LIB}d) + else() DBG_MSG_V("- not found due to missing WX_${LIB}=${WX_${LIB}} or WX_${LIB}d=${WX_${LIB}d}") - SET(wxWidgets_FOUND FALSE) - ENDIF(WX_${LIB} AND WX_${LIB}d) - ENDFOREACH(LIB) - ELSE(WX_USE_REL_AND_DBG) - FOREACH(LIB ${${_LIBS}}) + set(wxWidgets_FOUND FALSE) + endif() + endforeach() + else() + foreach(LIB ${${_LIBS}}) DBG_MSG_V("Searching for ${LIB}${_DBG}") DBG_MSG_V("WX_${LIB}${_DBG} : ${WX_${LIB}${_DBG}}") - IF(WX_${LIB}${_DBG}) + if(WX_${LIB}${_DBG}) DBG_MSG_V("Found ${LIB}${_DBG}") - LIST(APPEND wxWidgets_LIBRARIES ${WX_${LIB}${_DBG}}) - ELSE(WX_${LIB}${_DBG}) + list(APPEND wxWidgets_LIBRARIES ${WX_${LIB}${_DBG}}) + else() DBG_MSG_V( "- not found due to missing WX_${LIB}${_DBG}=${WX_${LIB}${_DBG}}") - SET(wxWidgets_FOUND FALSE) - ENDIF(WX_${LIB}${_DBG}) - ENDFOREACH(LIB) - ENDIF(WX_USE_REL_AND_DBG) + set(wxWidgets_FOUND FALSE) + endif() + endforeach() + endif() DBG_MSG_V("OpenGL") - LIST(FIND ${_LIBS} gl WX_USE_GL) - IF(NOT WX_USE_GL EQUAL -1) + list(FIND ${_LIBS} gl WX_USE_GL) + if(NOT WX_USE_GL EQUAL -1) DBG_MSG_V("- is required.") - LIST(APPEND wxWidgets_LIBRARIES opengl32 glu32) - ENDIF(NOT WX_USE_GL EQUAL -1) + list(APPEND wxWidgets_LIBRARIES opengl32 glu32) + endif() - LIST(APPEND wxWidgets_LIBRARIES winmm comctl32 rpcrt4 wsock32) - ENDMACRO(WX_SET_LIBRARIES) + list(APPEND wxWidgets_LIBRARIES winmm comctl32 rpcrt4 wsock32) + endmacro() #------------------------------------------------------------------- # WIN32: Start actual work. #------------------------------------------------------------------- # Look for an installation tree. - FIND_PATH(wxWidgets_ROOT_DIR + find_path(wxWidgets_ROOT_DIR NAMES include/wx/wx.h PATHS - $ENV{wxWidgets_ROOT_DIR} - $ENV{WXWIN} + ENV wxWidgets_ROOT_DIR + ENV WXWIN "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]" # WX 2.6.x C:/ D:/ - $ENV{ProgramFiles} - PATH_SUFFIXES + ENV ProgramFiles + PATH_SUFFIXES wxWidgets-2.9.4 wxWidgets-2.9.3 wxWidgets-2.9.2 @@ -462,24 +462,24 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") ) # If wxWidgets_ROOT_DIR changed, clear lib dir. - IF(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR) - SET(WX_ROOT_DIR ${wxWidgets_ROOT_DIR} + if(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR) + set(WX_ROOT_DIR ${wxWidgets_ROOT_DIR} CACHE INTERNAL "wxWidgets_ROOT_DIR") - SET(wxWidgets_LIB_DIR "wxWidgets_LIB_DIR-NOTFOUND" + set(wxWidgets_LIB_DIR "wxWidgets_LIB_DIR-NOTFOUND" CACHE PATH "Cleared." FORCE) - ENDIF(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR) + endif() - IF(WX_ROOT_DIR) + if(WX_ROOT_DIR) # Select one default tree inside the already determined wx tree. # Prefer static/shared order usually consistent with build # settings. - IF(MINGW) - SET(WX_LIB_DIR_PREFIX gcc) - ELSE(MINGW) - SET(WX_LIB_DIR_PREFIX vc) - ENDIF(MINGW) - IF(BUILD_SHARED_LIBS) - FIND_PATH(wxWidgets_LIB_DIR + if(MINGW) + set(WX_LIB_DIR_PREFIX gcc) + else() + set(WX_LIB_DIR_PREFIX vc) + endif() + if(BUILD_SHARED_LIBS) + find_path(wxWidgets_LIB_DIR NAMES msw/wx/setup.h mswd/wx/setup.h @@ -495,8 +495,8 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") DOC "Path to wxWidgets libraries?" NO_DEFAULT_PATH ) - ELSE(BUILD_SHARED_LIBS) - FIND_PATH(wxWidgets_LIB_DIR + else() + find_path(wxWidgets_LIB_DIR NAMES msw/wx/setup.h mswd/wx/setup.h @@ -512,202 +512,202 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") DOC "Path to wxWidgets libraries?" NO_DEFAULT_PATH ) - ENDIF(BUILD_SHARED_LIBS) + endif() # If wxWidgets_LIB_DIR changed, clear all libraries. - IF(NOT WX_LIB_DIR STREQUAL wxWidgets_LIB_DIR) - SET(WX_LIB_DIR ${wxWidgets_LIB_DIR} CACHE INTERNAL "wxWidgets_LIB_DIR") + if(NOT WX_LIB_DIR STREQUAL wxWidgets_LIB_DIR) + set(WX_LIB_DIR ${wxWidgets_LIB_DIR} CACHE INTERNAL "wxWidgets_LIB_DIR") WX_CLEAR_ALL_DBG_LIBS() WX_CLEAR_ALL_REL_LIBS() - ENDIF(NOT WX_LIB_DIR STREQUAL wxWidgets_LIB_DIR) + endif() - IF(WX_LIB_DIR) + if(WX_LIB_DIR) # If building shared libs, define WXUSINGDLL to use dllimport. - IF(WX_LIB_DIR MATCHES ".*[dD][lL][lL].*") - SET(wxWidgets_DEFINITIONS WXUSINGDLL) + if(WX_LIB_DIR MATCHES ".*[dD][lL][lL].*") + set(wxWidgets_DEFINITIONS WXUSINGDLL) DBG_MSG_V("detected SHARED/DLL tree WX_LIB_DIR=${WX_LIB_DIR}") - ENDIF(WX_LIB_DIR MATCHES ".*[dD][lL][lL].*") + endif() # Search for available configuration types. - FOREACH(CFG mswunivud mswunivd mswud mswd mswunivu mswuniv mswu msw) - SET(WX_${CFG}_FOUND FALSE) - IF(EXISTS ${WX_LIB_DIR}/${CFG}) - LIST(APPEND WX_CONFIGURATION_LIST ${CFG}) - SET(WX_${CFG}_FOUND TRUE) - SET(WX_CONFIGURATION ${CFG}) - ENDIF(EXISTS ${WX_LIB_DIR}/${CFG}) - ENDFOREACH(CFG) + foreach(CFG mswunivud mswunivd mswud mswd mswunivu mswuniv mswu msw) + set(WX_${CFG}_FOUND FALSE) + if(EXISTS ${WX_LIB_DIR}/${CFG}) + list(APPEND WX_CONFIGURATION_LIST ${CFG}) + set(WX_${CFG}_FOUND TRUE) + set(WX_CONFIGURATION ${CFG}) + endif() + endforeach() DBG_MSG_V("WX_CONFIGURATION_LIST=${WX_CONFIGURATION_LIST}") - IF(WX_CONFIGURATION) - SET(wxWidgets_FOUND TRUE) + if(WX_CONFIGURATION) + set(wxWidgets_FOUND TRUE) # If the selected configuration wasn't found force the default # one. Otherwise, use it but still force a refresh for # updating the doc string with the current list of available # configurations. - IF(NOT WX_${wxWidgets_CONFIGURATION}_FOUND) - SET(wxWidgets_CONFIGURATION ${WX_CONFIGURATION} CACHE STRING + if(NOT WX_${wxWidgets_CONFIGURATION}_FOUND) + set(wxWidgets_CONFIGURATION ${WX_CONFIGURATION} CACHE STRING "Set wxWidgets configuration (${WX_CONFIGURATION_LIST})" FORCE) - ELSE(NOT WX_${wxWidgets_CONFIGURATION}_FOUND) - SET(wxWidgets_CONFIGURATION ${wxWidgets_CONFIGURATION} CACHE STRING + else() + set(wxWidgets_CONFIGURATION ${wxWidgets_CONFIGURATION} CACHE STRING "Set wxWidgets configuration (${WX_CONFIGURATION_LIST})" FORCE) - ENDIF(NOT WX_${wxWidgets_CONFIGURATION}_FOUND) + endif() # If release config selected, and both release/debug exist. - IF(WX_${wxWidgets_CONFIGURATION}d_FOUND) - OPTION(wxWidgets_USE_REL_AND_DBG + if(WX_${wxWidgets_CONFIGURATION}d_FOUND) + option(wxWidgets_USE_REL_AND_DBG "Use release and debug configurations?" TRUE) - SET(WX_USE_REL_AND_DBG ${wxWidgets_USE_REL_AND_DBG}) - ELSE(WX_${wxWidgets_CONFIGURATION}d_FOUND) + set(WX_USE_REL_AND_DBG ${wxWidgets_USE_REL_AND_DBG}) + else() # If the option exists (already in cache), force it false. - IF(wxWidgets_USE_REL_AND_DBG) - SET(wxWidgets_USE_REL_AND_DBG FALSE CACHE BOOL + if(wxWidgets_USE_REL_AND_DBG) + set(wxWidgets_USE_REL_AND_DBG FALSE CACHE BOOL "No ${wxWidgets_CONFIGURATION}d found." FORCE) - ENDIF(wxWidgets_USE_REL_AND_DBG) - SET(WX_USE_REL_AND_DBG FALSE) - ENDIF(WX_${wxWidgets_CONFIGURATION}d_FOUND) + endif() + set(WX_USE_REL_AND_DBG FALSE) + endif() # Get configuration parameters from the name. WX_GET_NAME_COMPONENTS(${wxWidgets_CONFIGURATION} UNV UCD DBG) # Set wxWidgets lib setup include directory. - IF(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h) - SET(wxWidgets_INCLUDE_DIRS + if(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h) + set(wxWidgets_INCLUDE_DIRS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}) - ELSE(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h) + else() DBG_MSG("wxWidgets_FOUND FALSE because ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h does not exists.") - SET(wxWidgets_FOUND FALSE) - ENDIF(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h) + set(wxWidgets_FOUND FALSE) + endif() # Set wxWidgets main include directory. - IF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) - LIST(APPEND wxWidgets_INCLUDE_DIRS ${WX_ROOT_DIR}/include) - ELSE(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) + if(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) + list(APPEND wxWidgets_INCLUDE_DIRS ${WX_ROOT_DIR}/include) + else() DBG_MSG("wxWidgets_FOUND FALSE because WX_ROOT_DIR=${WX_ROOT_DIR} has no ${WX_ROOT_DIR}/include/wx/wx.h") - SET(wxWidgets_FOUND FALSE) - ENDIF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) + set(wxWidgets_FOUND FALSE) + endif() # Find wxWidgets libraries. WX_FIND_LIBS("${UNV}" "${UCD}" "${DBG}") - IF(WX_USE_REL_AND_DBG) + if(WX_USE_REL_AND_DBG) WX_FIND_LIBS("${UNV}" "${UCD}" "d") - ENDIF(WX_USE_REL_AND_DBG) + endif() # Settings for requested libs (i.e., include dir, libraries, etc.). WX_SET_LIBRARIES(wxWidgets_FIND_COMPONENTS "${DBG}") # Add necessary definitions for unicode builds - IF("${UCD}" STREQUAL "u") - LIST(APPEND wxWidgets_DEFINITIONS UNICODE _UNICODE) - ENDIF("${UCD}" STREQUAL "u") + if("${UCD}" STREQUAL "u") + list(APPEND wxWidgets_DEFINITIONS UNICODE _UNICODE) + endif() # Add necessary definitions for debug builds - SET(wxWidgets_DEFINITIONS_DEBUG _DEBUG __WXDEBUG__) + set(wxWidgets_DEFINITIONS_DEBUG _DEBUG __WXDEBUG__) - ENDIF(WX_CONFIGURATION) - ENDIF(WX_LIB_DIR) - ENDIF(WX_ROOT_DIR) + endif() + endif() + endif() #===================================================================== # UNIX_FIND_STYLE #===================================================================== -ELSE(wxWidgets_FIND_STYLE STREQUAL "win32") - IF(wxWidgets_FIND_STYLE STREQUAL "unix") +else() + if(wxWidgets_FIND_STYLE STREQUAL "unix") #----------------------------------------------------------------- # UNIX: Helper MACROS #----------------------------------------------------------------- # # Set the default values based on "wx-config --selected-config". # - MACRO(WX_CONFIG_SELECT_GET_DEFAULT) - EXECUTE_PROCESS( + macro(WX_CONFIG_SELECT_GET_DEFAULT) + execute_process( COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" ${wxWidgets_CONFIG_OPTIONS} --selected-config OUTPUT_VARIABLE _wx_selected_config RESULT_VARIABLE _wx_result ERROR_QUIET ) - IF(_wx_result EQUAL 0) - FOREACH(_opt_name debug static unicode universal) - STRING(TOUPPER ${_opt_name} _upper_opt_name) - IF(_wx_selected_config MATCHES ".*${_opt_name}.*") - SET(wxWidgets_DEFAULT_${_upper_opt_name} ON) - ELSE(_wx_selected_config MATCHES ".*${_opt_name}.*") - SET(wxWidgets_DEFAULT_${_upper_opt_name} OFF) - ENDIF(_wx_selected_config MATCHES ".*${_opt_name}.*") - ENDFOREACH(_opt_name) - ELSE(_wx_result EQUAL 0) - FOREACH(_upper_opt_name DEBUG STATIC UNICODE UNIVERSAL) - SET(wxWidgets_DEFAULT_${_upper_opt_name} OFF) - ENDFOREACH(_upper_opt_name) - ENDIF(_wx_result EQUAL 0) - ENDMACRO(WX_CONFIG_SELECT_GET_DEFAULT) + if(_wx_result EQUAL 0) + foreach(_opt_name debug static unicode universal) + string(TOUPPER ${_opt_name} _upper_opt_name) + if(_wx_selected_config MATCHES ".*${_opt_name}.*") + set(wxWidgets_DEFAULT_${_upper_opt_name} ON) + else() + set(wxWidgets_DEFAULT_${_upper_opt_name} OFF) + endif() + endforeach() + else() + foreach(_upper_opt_name DEBUG STATIC UNICODE UNIVERSAL) + set(wxWidgets_DEFAULT_${_upper_opt_name} OFF) + endforeach() + endif() + endmacro() # # Query a boolean configuration option to determine if the system # has both builds available. If so, provide the selection option # to the user. # - MACRO(WX_CONFIG_SELECT_QUERY_BOOL _OPT_NAME _OPT_HELP) - EXECUTE_PROCESS( + macro(WX_CONFIG_SELECT_QUERY_BOOL _OPT_NAME _OPT_HELP) + execute_process( COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" ${wxWidgets_CONFIG_OPTIONS} --${_OPT_NAME}=yes RESULT_VARIABLE _wx_result_yes OUTPUT_QUIET ERROR_QUIET ) - EXECUTE_PROCESS( + execute_process( COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" ${wxWidgets_CONFIG_OPTIONS} --${_OPT_NAME}=no RESULT_VARIABLE _wx_result_no OUTPUT_QUIET ERROR_QUIET ) - STRING(TOUPPER ${_OPT_NAME} _UPPER_OPT_NAME) - IF(_wx_result_yes EQUAL 0 AND _wx_result_no EQUAL 0) - OPTION(wxWidgets_USE_${_UPPER_OPT_NAME} + string(TOUPPER ${_OPT_NAME} _UPPER_OPT_NAME) + if(_wx_result_yes EQUAL 0 AND _wx_result_no EQUAL 0) + option(wxWidgets_USE_${_UPPER_OPT_NAME} ${_OPT_HELP} ${wxWidgets_DEFAULT_${_UPPER_OPT_NAME}}) - ELSE(_wx_result_yes EQUAL 0 AND _wx_result_no EQUAL 0) + else() # If option exists (already in cache), force to available one. - IF(DEFINED wxWidgets_USE_${_UPPER_OPT_NAME}) - IF(_wx_result_yes EQUAL 0) - SET(wxWidgets_USE_${_UPPER_OPT_NAME} ON CACHE BOOL ${_OPT_HELP} FORCE) - ELSE(_wx_result_yes EQUAL 0) - SET(wxWidgets_USE_${_UPPER_OPT_NAME} OFF CACHE BOOL ${_OPT_HELP} FORCE) - ENDIF(_wx_result_yes EQUAL 0) - ENDIF(DEFINED wxWidgets_USE_${_UPPER_OPT_NAME}) - ENDIF(_wx_result_yes EQUAL 0 AND _wx_result_no EQUAL 0) - ENDMACRO(WX_CONFIG_SELECT_QUERY_BOOL) - - # + if(DEFINED wxWidgets_USE_${_UPPER_OPT_NAME}) + if(_wx_result_yes EQUAL 0) + set(wxWidgets_USE_${_UPPER_OPT_NAME} ON CACHE BOOL ${_OPT_HELP} FORCE) + else() + set(wxWidgets_USE_${_UPPER_OPT_NAME} OFF CACHE BOOL ${_OPT_HELP} FORCE) + endif() + endif() + endif() + endmacro() + + # # Set wxWidgets_SELECT_OPTIONS to wx-config options for selecting # among multiple builds. # - MACRO(WX_CONFIG_SELECT_SET_OPTIONS) - SET(wxWidgets_SELECT_OPTIONS ${wxWidgets_CONFIG_OPTIONS}) - FOREACH(_opt_name debug static unicode universal) - STRING(TOUPPER ${_opt_name} _upper_opt_name) - IF(DEFINED wxWidgets_USE_${_upper_opt_name}) - IF(wxWidgets_USE_${_upper_opt_name}) - LIST(APPEND wxWidgets_SELECT_OPTIONS --${_opt_name}=yes) - ELSE(wxWidgets_USE_${_upper_opt_name}) - LIST(APPEND wxWidgets_SELECT_OPTIONS --${_opt_name}=no) - ENDIF(wxWidgets_USE_${_upper_opt_name}) - ENDIF(DEFINED wxWidgets_USE_${_upper_opt_name}) - ENDFOREACH(_opt_name) - ENDMACRO(WX_CONFIG_SELECT_SET_OPTIONS) + macro(WX_CONFIG_SELECT_SET_OPTIONS) + set(wxWidgets_SELECT_OPTIONS ${wxWidgets_CONFIG_OPTIONS}) + foreach(_opt_name debug static unicode universal) + string(TOUPPER ${_opt_name} _upper_opt_name) + if(DEFINED wxWidgets_USE_${_upper_opt_name}) + if(wxWidgets_USE_${_upper_opt_name}) + list(APPEND wxWidgets_SELECT_OPTIONS --${_opt_name}=yes) + else() + list(APPEND wxWidgets_SELECT_OPTIONS --${_opt_name}=no) + endif() + endif() + endforeach() + endmacro() #----------------------------------------------------------------- # UNIX: Start actual work. #----------------------------------------------------------------- # Support cross-compiling, only search in the target platform. - FIND_PROGRAM(wxWidgets_CONFIG_EXECUTABLE wx-config + find_program(wxWidgets_CONFIG_EXECUTABLE wx-config ONLY_CMAKE_FIND_ROOT_PATH ) - IF(wxWidgets_CONFIG_EXECUTABLE) - SET(wxWidgets_FOUND TRUE) + if(wxWidgets_CONFIG_EXECUTABLE) + set(wxWidgets_FOUND TRUE) # get defaults based on "wx-config --selected-config" WX_CONFIG_SELECT_GET_DEFAULT() @@ -723,99 +723,99 @@ ELSE(wxWidgets_FIND_STYLE STREQUAL "win32") DBG_MSG("wxWidgets_SELECT_OPTIONS=${wxWidgets_SELECT_OPTIONS}") # run the wx-config program to get cxxflags - EXECUTE_PROCESS( + execute_process( COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" ${wxWidgets_SELECT_OPTIONS} --cxxflags OUTPUT_VARIABLE wxWidgets_CXX_FLAGS RESULT_VARIABLE RET ERROR_QUIET ) - IF(RET EQUAL 0) - STRING(STRIP "${wxWidgets_CXX_FLAGS}" wxWidgets_CXX_FLAGS) - SEPARATE_ARGUMENTS(wxWidgets_CXX_FLAGS) + if(RET EQUAL 0) + string(STRIP "${wxWidgets_CXX_FLAGS}" wxWidgets_CXX_FLAGS) + separate_arguments(wxWidgets_CXX_FLAGS) DBG_MSG_V("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}") # parse definitions from cxxflags; # drop -D* from CXXFLAGS and the -D prefix - STRING(REGEX MATCHALL "-D[^;]+" + string(REGEX MATCHALL "-D[^;]+" wxWidgets_DEFINITIONS "${wxWidgets_CXX_FLAGS}") - STRING(REGEX REPLACE "-D[^;]+(;|$)" "" + string(REGEX REPLACE "-D[^;]+(;|$)" "" wxWidgets_CXX_FLAGS "${wxWidgets_CXX_FLAGS}") - STRING(REGEX REPLACE ";$" "" + string(REGEX REPLACE ";$" "" wxWidgets_CXX_FLAGS "${wxWidgets_CXX_FLAGS}") - STRING(REPLACE "-D" "" + string(REPLACE "-D" "" wxWidgets_DEFINITIONS "${wxWidgets_DEFINITIONS}") # parse include dirs from cxxflags; drop -I prefix - STRING(REGEX MATCHALL "-I[^;]+" + string(REGEX MATCHALL "-I[^;]+" wxWidgets_INCLUDE_DIRS "${wxWidgets_CXX_FLAGS}") - STRING(REGEX REPLACE "-I[^;]+;" "" + string(REGEX REPLACE "-I[^;]+;" "" wxWidgets_CXX_FLAGS "${wxWidgets_CXX_FLAGS}") - STRING(REPLACE "-I" "" + string(REPLACE "-I" "" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}") DBG_MSG_V("wxWidgets_DEFINITIONS=${wxWidgets_DEFINITIONS}") DBG_MSG_V("wxWidgets_INCLUDE_DIRS=${wxWidgets_INCLUDE_DIRS}") DBG_MSG_V("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}") - ELSE(RET EQUAL 0) - SET(wxWidgets_FOUND FALSE) + else() + set(wxWidgets_FOUND FALSE) DBG_MSG_V( "${wxWidgets_CONFIG_EXECUTABLE} --cxxflags FAILED with RET=${RET}") - ENDIF(RET EQUAL 0) + endif() # run the wx-config program to get the libs # - NOTE: wx-config doesn't verify that the libs requested exist # it just produces the names. Maybe a TRY_COMPILE would # be useful here... - STRING(REPLACE ";" "," + string(REPLACE ";" "," wxWidgets_FIND_COMPONENTS "${wxWidgets_FIND_COMPONENTS}") - EXECUTE_PROCESS( + execute_process( COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" ${wxWidgets_SELECT_OPTIONS} --libs ${wxWidgets_FIND_COMPONENTS} OUTPUT_VARIABLE wxWidgets_LIBRARIES RESULT_VARIABLE RET ERROR_QUIET ) - IF(RET EQUAL 0) - STRING(STRIP "${wxWidgets_LIBRARIES}" wxWidgets_LIBRARIES) - SEPARATE_ARGUMENTS(wxWidgets_LIBRARIES) - STRING(REPLACE "-framework;" "-framework " + if(RET EQUAL 0) + string(STRIP "${wxWidgets_LIBRARIES}" wxWidgets_LIBRARIES) + separate_arguments(wxWidgets_LIBRARIES) + string(REPLACE "-framework;" "-framework " wxWidgets_LIBRARIES "${wxWidgets_LIBRARIES}") - STRING(REPLACE "-arch;" "-arch " + string(REPLACE "-arch;" "-arch " wxWidgets_LIBRARIES "${wxWidgets_LIBRARIES}") - STRING(REPLACE "-isysroot;" "-isysroot " + string(REPLACE "-isysroot;" "-isysroot " wxWidgets_LIBRARIES "${wxWidgets_LIBRARIES}") # extract linkdirs (-L) for rpath (i.e., LINK_DIRECTORIES) - STRING(REGEX MATCHALL "-L[^;]+" + string(REGEX MATCHALL "-L[^;]+" wxWidgets_LIBRARY_DIRS "${wxWidgets_LIBRARIES}") - STRING(REPLACE "-L" "" + string(REPLACE "-L" "" wxWidgets_LIBRARY_DIRS "${wxWidgets_LIBRARY_DIRS}") DBG_MSG_V("wxWidgets_LIBRARIES=${wxWidgets_LIBRARIES}") DBG_MSG_V("wxWidgets_LIBRARY_DIRS=${wxWidgets_LIBRARY_DIRS}") - ELSE(RET EQUAL 0) - SET(wxWidgets_FOUND FALSE) + else() + set(wxWidgets_FOUND FALSE) DBG_MSG("${wxWidgets_CONFIG_EXECUTABLE} --libs ${wxWidgets_FIND_COMPONENTS} FAILED with RET=${RET}") - ENDIF(RET EQUAL 0) - ENDIF(wxWidgets_CONFIG_EXECUTABLE) + endif() + endif() #===================================================================== # Neither UNIX_FIND_STYLE, nor WIN32_FIND_STYLE #===================================================================== - ELSE(wxWidgets_FIND_STYLE STREQUAL "unix") - IF(NOT wxWidgets_FIND_QUIETLY) - MESSAGE(STATUS + else() + if(NOT wxWidgets_FIND_QUIETLY) + message(STATUS "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): \n" " Platform unknown/unsupported. It's neither WIN32 nor UNIX " "find style." ) - ENDIF(NOT wxWidgets_FIND_QUIETLY) - ENDIF(wxWidgets_FIND_STYLE STREQUAL "unix") -ENDIF(wxWidgets_FIND_STYLE STREQUAL "win32") + endif() + endif() +endif() # Debug output: DBG_MSG("wxWidgets_FOUND : ${wxWidgets_FOUND}") @@ -827,10 +827,10 @@ DBG_MSG("wxWidgets_USE_FILE : ${wxWidgets_USE_FILE}") #===================================================================== #===================================================================== -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(wxWidgets DEFAULT_MSG wxWidgets_FOUND) # Maintain consistency with all other variables. -SET(wxWidgets_FOUND ${WXWIDGETS_FOUND}) +set(wxWidgets_FOUND ${WXWIDGETS_FOUND}) #===================================================================== # Macros for use in wxWidgets apps. @@ -841,24 +841,24 @@ SET(wxWidgets_FOUND ${WXWIDGETS_FOUND}) #===================================================================== # Resource file compiler. -FIND_PROGRAM(wxWidgets_wxrc_EXECUTABLE wxrc +find_program(wxWidgets_wxrc_EXECUTABLE wxrc ${wxWidgets_ROOT_DIR}/utils/wxrc/vc_msw ) -# +# # WX_SPLIT_ARGUMENTS_ON( ...) -# +# # Sets and to contain arguments to the left and right, # respectively, of . -# +# # Example usage: -# FUNCTION(WXWIDGETS_ADD_RESOURCES outfiles) +# function(WXWIDGETS_ADD_RESOURCES outfiles) # WX_SPLIT_ARGUMENTS_ON(OPTIONS wxrc_files wxrc_options ${ARGN}) # ... -# ENDFUNCTION(WXWIDGETS_ADD_RESOURCES) +# endfunction() # # WXWIDGETS_ADD_RESOURCES(sources ${xrc_files} OPTIONS -e -o file.C) -# +# # NOTE: This is a generic piece of code that should be renamed to # SPLIT_ARGUMENTS_ON and put in a file serving the same purpose as # FindPackageStandardArgs.cmake. At the time of this writing @@ -866,29 +866,29 @@ FIND_PROGRAM(wxWidgets_wxrc_EXECUTABLE wxrc # here a bit more generalized. So, there are already two find modules # using this approach. # -FUNCTION(WX_SPLIT_ARGUMENTS_ON _keyword _leftvar _rightvar) +function(WX_SPLIT_ARGUMENTS_ON _keyword _leftvar _rightvar) # FIXME: Document that the input variables will be cleared. - #LIST(APPEND ${_leftvar} "") - #LIST(APPEND ${_rightvar} "") - SET(${_leftvar} "") - SET(${_rightvar} "") - - SET(_doing_right FALSE) - FOREACH(element ${ARGN}) - IF("${element}" STREQUAL "${_keyword}") - SET(_doing_right TRUE) - ELSE("${element}" STREQUAL "${_keyword}") - IF(_doing_right) - LIST(APPEND ${_rightvar} "${element}") - ELSE(_doing_right) - LIST(APPEND ${_leftvar} "${element}") - ENDIF(_doing_right) - ENDIF("${element}" STREQUAL "${_keyword}") - ENDFOREACH(element) - - SET(${_leftvar} ${${_leftvar}} PARENT_SCOPE) - SET(${_rightvar} ${${_rightvar}} PARENT_SCOPE) -ENDFUNCTION(WX_SPLIT_ARGUMENTS_ON) + #list(APPEND ${_leftvar} "") + #list(APPEND ${_rightvar} "") + set(${_leftvar} "") + set(${_rightvar} "") + + set(_doing_right FALSE) + foreach(element ${ARGN}) + if("${element}" STREQUAL "${_keyword}") + set(_doing_right TRUE) + else() + if(_doing_right) + list(APPEND ${_rightvar} "${element}") + else() + list(APPEND ${_leftvar} "${element}") + endif() + endif() + endforeach() + + set(${_leftvar} ${${_leftvar}} PARENT_SCOPE) + set(${_rightvar} ${${_rightvar}} PARENT_SCOPE) +endfunction() # # WX_GET_DEPENDENCIES_FROM_XML( @@ -901,7 +901,7 @@ ENDFUNCTION(WX_SPLIT_ARGUMENTS_ON) # # FIXME: Add documentation here... # -FUNCTION(WX_GET_DEPENDENCIES_FROM_XML +function(WX_GET_DEPENDENCIES_FROM_XML _depends _match_patt _clean_patt @@ -909,52 +909,52 @@ FUNCTION(WX_GET_DEPENDENCIES_FROM_XML _depends_path ) - STRING(REGEX MATCHALL + string(REGEX MATCHALL ${_match_patt} dep_file_list "${${_xml_contents}}" ) - FOREACH(dep_file ${dep_file_list}) - STRING(REGEX REPLACE ${_clean_patt} "" dep_file "${dep_file}") + foreach(dep_file ${dep_file_list}) + string(REGEX REPLACE ${_clean_patt} "" dep_file "${dep_file}") # make the file have an absolute path - IF(NOT IS_ABSOLUTE "${dep_file}") - SET(dep_file "${${_depends_path}}/${dep_file}") - ENDIF(NOT IS_ABSOLUTE "${dep_file}") + if(NOT IS_ABSOLUTE "${dep_file}") + set(dep_file "${${_depends_path}}/${dep_file}") + endif() # append file to dependency list - LIST(APPEND ${_depends} "${dep_file}") - ENDFOREACH(dep_file) + list(APPEND ${_depends} "${dep_file}") + endforeach() - SET(${_depends} ${${_depends}} PARENT_SCOPE) -ENDFUNCTION(WX_GET_DEPENDENCIES_FROM_XML) + set(${_depends} ${${_depends}} PARENT_SCOPE) +endfunction() -# +# # WXWIDGETS_ADD_RESOURCES( # OPTIONS [NO_CPP_CODE]) -# +# # Adds a custom command for resource file compilation of the # and appends the output files to . -# +# # Example usages: # WXWIDGETS_ADD_RESOURCES(sources xrc/main_frame.xrc) # WXWIDGETS_ADD_RESOURCES(sources ${xrc_files} OPTIONS -e -o altname.cxx) # -FUNCTION(WXWIDGETS_ADD_RESOURCES _outfiles) +function(WXWIDGETS_ADD_RESOURCES _outfiles) WX_SPLIT_ARGUMENTS_ON(OPTIONS rc_file_list rc_options ${ARGN}) # Parse files for dependencies. - SET(rc_file_list_abs "") - SET(rc_depends "") - FOREACH(rc_file ${rc_file_list}) - GET_FILENAME_COMPONENT(depends_path ${rc_file} PATH) + set(rc_file_list_abs "") + set(rc_depends "") + foreach(rc_file ${rc_file_list}) + get_filename_component(depends_path ${rc_file} PATH) - GET_FILENAME_COMPONENT(rc_file_abs ${rc_file} ABSOLUTE) - LIST(APPEND rc_file_list_abs "${rc_file_abs}") + get_filename_component(rc_file_abs ${rc_file} ABSOLUTE) + list(APPEND rc_file_list_abs "${rc_file_abs}") # All files have absolute paths or paths relative to the location # of the rc file. - FILE(READ "${rc_file_abs}" rc_file_contents) + file(READ "${rc_file_abs}" rc_file_contents) # get bitmap/bitmap2 files WX_GET_DEPENDENCIES_FROM_XML( @@ -982,63 +982,63 @@ FUNCTION(WXWIDGETS_ADD_RESOURCES _outfiles) rc_file_contents depends_path ) - ENDFOREACH(rc_file) + endforeach() # # Parse options. - # + # # If NO_CPP_CODE option specified, then produce .xrs file rather # than a .cpp file (i.e., don't add the default --cpp-code option). - LIST(FIND rc_options NO_CPP_CODE index) - IF(index EQUAL -1) - LIST(APPEND rc_options --cpp-code) + list(FIND rc_options NO_CPP_CODE index) + if(index EQUAL -1) + list(APPEND rc_options --cpp-code) # wxrc's default output filename for cpp code. - SET(outfile resource.cpp) - ELSE(index EQUAL -1) - LIST(REMOVE_AT rc_options ${index}) + set(outfile resource.cpp) + else() + list(REMOVE_AT rc_options ${index}) # wxrc's default output filename for xrs file. - SET(outfile resource.xrs) - ENDIF(index EQUAL -1) + set(outfile resource.xrs) + endif() # Get output name for use in ADD_CUSTOM_COMMAND. # - short option scanning - LIST(FIND rc_options -o index) - IF(NOT index EQUAL -1) - MATH(EXPR filename_index "${index} + 1") - LIST(GET rc_options ${filename_index} outfile) - #LIST(REMOVE_AT rc_options ${index} ${filename_index}) - ENDIF(NOT index EQUAL -1) + list(FIND rc_options -o index) + if(NOT index EQUAL -1) + math(EXPR filename_index "${index} + 1") + list(GET rc_options ${filename_index} outfile) + #list(REMOVE_AT rc_options ${index} ${filename_index}) + endif() # - long option scanning - STRING(REGEX MATCH "--output=[^;]*" outfile_opt "${rc_options}") - IF(outfile_opt) - STRING(REPLACE "--output=" "" outfile "${outfile_opt}") - ENDIF(outfile_opt) - #STRING(REGEX REPLACE "--output=[^;]*;?" "" rc_options "${rc_options}") - #STRING(REGEX REPLACE ";$" "" rc_options "${rc_options}") - - IF(NOT IS_ABSOLUTE "${outfile}") - SET(outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") - ENDIF(NOT IS_ABSOLUTE "${outfile}") - ADD_CUSTOM_COMMAND( + string(REGEX MATCH "--output=[^;]*" outfile_opt "${rc_options}") + if(outfile_opt) + string(REPLACE "--output=" "" outfile "${outfile_opt}") + endif() + #string(REGEX REPLACE "--output=[^;]*;?" "" rc_options "${rc_options}") + #string(REGEX REPLACE ";$" "" rc_options "${rc_options}") + + if(NOT IS_ABSOLUTE "${outfile}") + set(outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") + endif() + add_custom_command( OUTPUT "${outfile}" COMMAND ${wxWidgets_wxrc_EXECUTABLE} ${rc_options} ${rc_file_list_abs} DEPENDS ${rc_file_list_abs} ${rc_depends} ) # Add generated header to output file list. - LIST(FIND rc_options -e short_index) - LIST(FIND rc_options --extra-cpp-code long_index) - IF(NOT short_index EQUAL -1 OR NOT long_index EQUAL -1) - GET_FILENAME_COMPONENT(outfile_ext ${outfile} EXT) - STRING(REPLACE "${outfile_ext}" ".h" outfile_header "${outfile}") - LIST(APPEND ${_outfiles} "${outfile_header}") - SET_SOURCE_FILES_PROPERTIES( + list(FIND rc_options -e short_index) + list(FIND rc_options --extra-cpp-code long_index) + if(NOT short_index EQUAL -1 OR NOT long_index EQUAL -1) + get_filename_component(outfile_ext ${outfile} EXT) + string(REPLACE "${outfile_ext}" ".h" outfile_header "${outfile}") + list(APPEND ${_outfiles} "${outfile_header}") + set_source_files_properties( "${outfile_header}" PROPERTIES GENERATED TRUE ) - ENDIF(NOT short_index EQUAL -1 OR NOT long_index EQUAL -1) + endif() # Add generated file to output file list. - LIST(APPEND ${_outfiles} "${outfile}") + list(APPEND ${_outfiles} "${outfile}") - SET(${_outfiles} ${${_outfiles}} PARENT_SCOPE) -ENDFUNCTION(WXWIDGETS_ADD_RESOURCES) + set(${_outfiles} ${${_outfiles}} PARENT_SCOPE) +endfunction() diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake index dfb28ff90..4179f7bb2 100644 --- a/Modules/FindwxWindows.cmake +++ b/Modules/FindwxWindows.cmake @@ -20,17 +20,17 @@ # # OPTIONS # If you need OpenGL support please -# SET(WXWINDOWS_USE_GL 1) +# set(WXWINDOWS_USE_GL 1) # in your CMakeLists.txt *before* you include this file. # # HAVE_ISYSTEM - true required to replace -I by -isystem on g++ # # For convenience include Use_wxWindows.cmake in your project's -# CMakeLists.txt using INCLUDE(Use_wxWindows). +# CMakeLists.txt using include(${CMAKE_CURRENT_LIST_DIR}/Use_wxWindows.cmake). # # USAGE -# SET(WXWINDOWS_USE_GL 1) -# FIND_PACKAGE(wxWindows) +# set(WXWINDOWS_USE_GL 1) +# find_package(wxWindows) # # NOTES # wxWidgets 2.6.x is supported for monolithic builds @@ -83,19 +83,19 @@ # -IF(WIN32) - SET(WIN32_STYLE_FIND 1) -ENDIF(WIN32) -IF(MINGW) - SET(WIN32_STYLE_FIND 0) - SET(UNIX_STYLE_FIND 1) -ENDIF(MINGW) -IF(UNIX) - SET(UNIX_STYLE_FIND 1) -ENDIF(UNIX) +if(WIN32) + set(WIN32_STYLE_FIND 1) +endif() +if(MINGW) + set(WIN32_STYLE_FIND 0) + set(UNIX_STYLE_FIND 1) +endif() +if(UNIX) + set(UNIX_STYLE_FIND 1) +endif() -IF(WIN32_STYLE_FIND) +if(WIN32_STYLE_FIND) ## ###################################################################### ## @@ -106,69 +106,68 @@ IF(WIN32_STYLE_FIND) ## fix the root dir to avoid mixing of headers/libs from different ## versions/builds: - SET (WXWINDOWS_POSSIBLE_ROOT_PATHS - $ENV{WXWIN} - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]" ## WX 2.6.x - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWindows_is1;Inno Setup: App Path]" ## WX 2.4.x - C:\\wxWidgets-2.6.2 - D:\\wxWidgets-2.6.2 - C:\\wxWidgets-2.6.1 - D:\\wxWidgets-2.6.1 - C:\\wxWindows-2.4.2 - D:\\wxWindows-2.4.2 - ) - ## WX supports monolithic and multiple smaller libs (since 2.5.x), we prefer monolithic for now. ## monolithic = WX is built as a single big library ## e.g. compile on WIN32 as "nmake -f makefile.vc MONOLITHIC=1 BUILD=debug SHARED=0 USE_OPENGL=1" (JW) - OPTION(WXWINDOWS_USE_MONOLITHIC "Use monolithic build of WX??" ON) - MARK_AS_ADVANCED(WXWINDOWS_USE_MONOLITHIC) + option(WXWINDOWS_USE_MONOLITHIC "Use monolithic build of WX??" ON) + mark_as_advanced(WXWINDOWS_USE_MONOLITHIC) ## GL libs used? - OPTION(WXWINDOWS_USE_GL "Use Wx with GL support(glcanvas)?" ON) - MARK_AS_ADVANCED(WXWINDOWS_USE_GL) + option(WXWINDOWS_USE_GL "Use Wx with GL support(glcanvas)?" ON) + mark_as_advanced(WXWINDOWS_USE_GL) ## avoid mixing of headers and libs between multiple installed WX versions, ## select just one tree here: - FIND_PATH(WXWINDOWS_ROOT_DIR include/wx/wx.h - ${WXWINDOWS_POSSIBLE_ROOT_PATHS} ) - # MESSAGE("DBG found WXWINDOWS_ROOT_DIR: ${WXWINDOWS_ROOT_DIR}") + find_path(WXWINDOWS_ROOT_DIR include/wx/wx.h + HINTS + ENV WXWIN + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]" ## WX 2.6.x + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWindows_is1;Inno Setup: App Path]" ## WX 2.4.x + PATHS + C:/wxWidgets-2.6.2 + D:/wxWidgets-2.6.2 + C:/wxWidgets-2.6.1 + D:/wxWidgets-2.6.1 + C:/wxWindows-2.4.2 + D:/wxWindows-2.4.2 + ) + # message("DBG found WXWINDOWS_ROOT_DIR: ${WXWINDOWS_ROOT_DIR}") ## find libs for combination of static/shared with release/debug ## be careful if you add something here, ## avoid mixing of headers and libs of different wx versions, ## there may be multiple WX versions installed. - SET (WXWINDOWS_POSSIBLE_LIB_PATHS + set (WXWINDOWS_POSSIBLE_LIB_PATHS "${WXWINDOWS_ROOT_DIR}/lib" ) ## monolithic? - IF (WXWINDOWS_USE_MONOLITHIC) + if (WXWINDOWS_USE_MONOLITHIC) - FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY + find_library(WXWINDOWS_STATIC_LIBRARY NAMES wx wxmsw wxmsw26 PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" ${WXWINDOWS_POSSIBLE_LIB_PATHS} DOC "wxWindows static release build library" ) - FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY + find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY NAMES wxd wxmswd wxmsw26d PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" ${WXWINDOWS_POSSIBLE_LIB_PATHS} DOC "wxWindows static debug build library" ) - FIND_LIBRARY(WXWINDOWS_SHARED_LIBRARY + find_library(WXWINDOWS_SHARED_LIBRARY NAMES wxmsw26 wxmsw262 wxmsw24 wxmsw242 wxmsw241 wxmsw240 wx23_2 wx22_9 PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_dll" ${WXWINDOWS_POSSIBLE_LIB_PATHS} DOC "wxWindows shared release build library" ) - FIND_LIBRARY(WXWINDOWS_SHARED_DEBUG_LIBRARY + find_library(WXWINDOWS_SHARED_DEBUG_LIBRARY NAMES wxmsw26d wxmsw262d wxmsw24d wxmsw241d wxmsw240d wx23_2d wx22_9d PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_dll" @@ -180,14 +179,14 @@ IF(WIN32_STYLE_FIND) ## required for WXWINDOWS_USE_GL ## gl lib is always build separate: ## - FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_GL + find_library(WXWINDOWS_STATIC_LIBRARY_GL NAMES wx_gl wxmsw_gl wxmsw26_gl PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" ${WXWINDOWS_POSSIBLE_LIB_PATHS} DOC "wxWindows static release build GL library" ) - FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_GL + find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_GL NAMES wxd_gl wxmswd_gl wxmsw26d_gl PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" @@ -195,70 +194,70 @@ IF(WIN32_STYLE_FIND) DOC "wxWindows static debug build GL library" ) - FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG + find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG NAMES wxpngd PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" ${WXWINDOWS_POSSIBLE_LIB_PATHS} DOC "wxWindows static debug png library" ) - FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_PNG + find_library(WXWINDOWS_STATIC_LIBRARY_PNG NAMES wxpng PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" ${WXWINDOWS_POSSIBLE_LIB_PATHS} DOC "wxWindows static png library" ) - FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF + find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF NAMES wxtiffd PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" ${WXWINDOWS_POSSIBLE_LIB_PATHS} DOC "wxWindows static debug tiff library" ) - FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_TIFF + find_library(WXWINDOWS_STATIC_LIBRARY_TIFF NAMES wxtiff PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" ${WXWINDOWS_POSSIBLE_LIB_PATHS} DOC "wxWindows static tiff library" ) - FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG + find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG NAMES wxjpegd wxjpgd PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" ${WXWINDOWS_POSSIBLE_LIB_PATHS} DOC "wxWindows static debug jpeg library" ) - FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_JPEG + find_library(WXWINDOWS_STATIC_LIBRARY_JPEG NAMES wxjpeg wxjpg PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" ${WXWINDOWS_POSSIBLE_LIB_PATHS} DOC "wxWindows static jpeg library" ) - FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB + find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB NAMES wxzlibd PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" ${WXWINDOWS_POSSIBLE_LIB_PATHS} DOC "wxWindows static debug zlib library" ) - FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_ZLIB + find_library(WXWINDOWS_STATIC_LIBRARY_ZLIB NAMES wxzlib PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" ${WXWINDOWS_POSSIBLE_LIB_PATHS} DOC "wxWindows static zib library" ) - FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX + find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX NAMES wxregexd PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" ${WXWINDOWS_POSSIBLE_LIB_PATHS} DOC "wxWindows static debug regex library" ) - FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_REGEX + find_library(WXWINDOWS_STATIC_LIBRARY_REGEX NAMES wxregex PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" @@ -268,14 +267,14 @@ IF(WIN32_STYLE_FIND) ## untested: - FIND_LIBRARY(WXWINDOWS_SHARED_LIBRARY_GL + find_library(WXWINDOWS_SHARED_LIBRARY_GL NAMES wx_gl wxmsw_gl wxmsw26_gl PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_dll" ${WXWINDOWS_POSSIBLE_LIB_PATHS} DOC "wxWindows shared release build GL library" ) - FIND_LIBRARY(WXWINDOWS_SHARED_DEBUG_LIBRARY_GL + find_library(WXWINDOWS_SHARED_DEBUG_LIBRARY_GL NAMES wxd_gl wxmswd_gl wxmsw26d_gl PATHS "${WXWINDOWS_ROOT_DIR}/lib/vc_dll" @@ -283,11 +282,11 @@ IF(WIN32_STYLE_FIND) DOC "wxWindows shared debug build GL library" ) - ELSE (WXWINDOWS_USE_MONOLITHIC) + else () ## WX is built as multiple small pieces libraries instead of monolithic ## DEPECATED (jw) replaced by more general WXWINDOWS_USE_MONOLITHIC ON/OFF - # OPTION(WXWINDOWS_SEPARATE_LIBS_BUILD "Is wxWindows build with separate libs?" OFF) + # option(WXWINDOWS_SEPARATE_LIBS_BUILD "Is wxWindows build with separate libs?" OFF) ## HACK: This is very dirty. ## because the libs of a particular version are explicitly listed @@ -297,9 +296,9 @@ IF(WIN32_STYLE_FIND) ## --> about 288 combinations ## thus we need a different approach so solve this correctly ... - MESSAGE(STATUS "Warning: You are trying to use wxWidgets without monolithic build (WXWINDOWS_SEPARATE_LIBS_BUILD). This is a HACK, libraries are not verified! (JW).") + message(STATUS "Warning: You are trying to use wxWidgets without monolithic build (WXWINDOWS_SEPARATE_LIBS_BUILD). This is a HACK, libraries are not verified! (JW).") - SET(WXWINDOWS_STATIC_LIBS ${WXWINDOWS_STATIC_LIBS} + set(WXWINDOWS_STATIC_LIBS ${WXWINDOWS_STATIC_LIBS} wxbase26 wxbase26_net wxbase26_odbc @@ -323,7 +322,7 @@ IF(WIN32_STYLE_FIND) wsock32 ) ## HACK: feed in to optimized / debug libaries if both were FOUND. - SET(WXWINDOWS_STATIC_DEBUG_LIBS ${WXWINDOWS_STATIC_DEBUG_LIBS} + set(WXWINDOWS_STATIC_DEBUG_LIBS ${WXWINDOWS_STATIC_DEBUG_LIBS} wxbase26d wxbase26d_net wxbase26d_odbc @@ -346,7 +345,7 @@ IF(WIN32_STYLE_FIND) rpcrt4 wsock32 ) - ENDIF (WXWINDOWS_USE_MONOLITHIC) + endif () ## @@ -356,22 +355,22 @@ IF(WIN32_STYLE_FIND) ## if there is at least one shared lib available ## let user choose wether to use shared or static wxwindows libs - IF(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY) + if(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY) ## default value OFF because wxWindows MSVS default build is static - OPTION(WXWINDOWS_USE_SHARED_LIBS + option(WXWINDOWS_USE_SHARED_LIBS "Use shared versions (dll) of wxWindows libraries?" OFF) - MARK_AS_ADVANCED(WXWINDOWS_USE_SHARED_LIBS) - ENDIF(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY) + mark_as_advanced(WXWINDOWS_USE_SHARED_LIBS) + endif() ## add system libraries wxwindows always seems to depend on - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} comctl32 rpcrt4 wsock32 ) - IF (NOT WXWINDOWS_USE_SHARED_LIBS) - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + if (NOT WXWINDOWS_USE_SHARED_LIBS) + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} ## these ones dont seem required, in particular ctl3d32 is not neccesary (Jan Woetzel 07/2003) # ctl3d32 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB} optimized ${WXWINDOWS_STATIC_LIBRARY_ZLIB} @@ -380,15 +379,15 @@ IF(WIN32_STYLE_FIND) debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG} optimized ${WXWINDOWS_STATIC_LIBRARY_JPEG} debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF} optimized ${WXWINDOWS_STATIC_LIBRARY_TIFF} ) - ENDIF (NOT WXWINDOWS_USE_SHARED_LIBS) + endif () ## opengl/glu: TODO/FIXME: better use FindOpenGL.cmake here ## assume release versions of glu an dopengl, here. - IF (WXWINDOWS_USE_GL) - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + if (WXWINDOWS_USE_GL) + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} opengl32 glu32 ) - ENDIF (WXWINDOWS_USE_GL) + endif () ## ## select between use of shared or static wxWindows lib then set libs to use @@ -399,162 +398,162 @@ IF(WIN32_STYLE_FIND) ## then add the build specific include dir for wx/setup.h ## - IF(WXWINDOWS_USE_SHARED_LIBS) - ##MESSAGE("DBG wxWindows use shared lib selected.") + if(WXWINDOWS_USE_SHARED_LIBS) + ##message("DBG wxWindows use shared lib selected.") ## assume that both builds use the same setup(.h) for simplicity ## shared: both wx (debug and release) found? ## assume that both builds use the same setup(.h) for simplicity - IF(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY) - ##MESSAGE("DBG wx shared: debug and optimized found.") - FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h + if(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY) + ##message("DBG wx shared: debug and optimized found.") + find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h ${WXWINDOWS_ROOT_DIR}/lib/mswdlld ${WXWINDOWS_ROOT_DIR}/lib/mswdll ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/mswd ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/msw ) - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} debug ${WXWINDOWS_SHARED_DEBUG_LIBRARY} optimized ${WXWINDOWS_SHARED_LIBRARY} ) - IF (WXWINDOWS_USE_GL) - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + if (WXWINDOWS_USE_GL) + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} debug ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} optimized ${WXWINDOWS_SHARED_LIBRARY_GL} ) - ENDIF (WXWINDOWS_USE_GL) - ENDIF(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY) + endif () + endif() ## shared: only debug wx lib found? - IF(WXWINDOWS_SHARED_DEBUG_LIBRARY) - IF(NOT WXWINDOWS_SHARED_LIBRARY) - ##MESSAGE("DBG wx shared: debug (but no optimized) found.") - FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h + if(WXWINDOWS_SHARED_DEBUG_LIBRARY) + if(NOT WXWINDOWS_SHARED_LIBRARY) + ##message("DBG wx shared: debug (but no optimized) found.") + find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h ${WXWINDOWS_ROOT_DIR}/lib/mswdlld ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/mswd ) - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} ${WXWINDOWS_SHARED_DEBUG_LIBRARY} ) - IF (WXWINDOWS_USE_GL) - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + if (WXWINDOWS_USE_GL) + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} ) - ENDIF (WXWINDOWS_USE_GL) - ENDIF(NOT WXWINDOWS_SHARED_LIBRARY) - ENDIF(WXWINDOWS_SHARED_DEBUG_LIBRARY) + endif () + endif() + endif() ## shared: only release wx lib found? - IF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY) - IF(WXWINDOWS_SHARED_LIBRARY) - ##MESSAGE("DBG wx shared: optimized (but no debug) found.") - FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h + if(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY) + if(WXWINDOWS_SHARED_LIBRARY) + ##message("DBG wx shared: optimized (but no debug) found.") + find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h ${WXWINDOWS_ROOT_DIR}/lib/mswdll ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/msw ) - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} ${WXWINDOWS_SHARED_DEBUG_LIBRARY} ) - IF (WXWINDOWS_USE_GL) - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + if (WXWINDOWS_USE_GL) + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} ) - ENDIF (WXWINDOWS_USE_GL) - ENDIF(WXWINDOWS_SHARED_LIBRARY) - ENDIF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY) + endif () + endif() + endif() ## shared: none found? - IF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY) - IF(NOT WXWINDOWS_SHARED_LIBRARY) - MESSAGE(STATUS + if(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY) + if(NOT WXWINDOWS_SHARED_LIBRARY) + message(STATUS "No shared wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.") - ENDIF(NOT WXWINDOWS_SHARED_LIBRARY) - ENDIF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY) + endif() + endif() ######################################################################################### - ELSE(WXWINDOWS_USE_SHARED_LIBS) + else() - ##jw: DEPRECATED IF(NOT WXWINDOWS_SEPARATE_LIBS_BUILD) + ##jw: DEPRECATED if(NOT WXWINDOWS_SEPARATE_LIBS_BUILD) ## static: both wx (debug and release) found? ## assume that both builds use the same setup(.h) for simplicity - IF(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY) - ##MESSAGE("DBG wx static: debug and optimized found.") - FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h + if(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY) + ##message("DBG wx static: debug and optimized found.") + find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h ${WXWINDOWS_ROOT_DIR}/lib/mswd ${WXWINDOWS_ROOT_DIR}/lib/msw ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/mswd ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/msw ) - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY} optimized ${WXWINDOWS_STATIC_LIBRARY} ) - IF (WXWINDOWS_USE_GL) - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + if (WXWINDOWS_USE_GL) + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_GL} optimized ${WXWINDOWS_STATIC_LIBRARY_GL} ) - ENDIF (WXWINDOWS_USE_GL) - ENDIF(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY) + endif () + endif() ## static: only debug wx lib found? - IF(WXWINDOWS_STATIC_DEBUG_LIBRARY) - IF(NOT WXWINDOWS_STATIC_LIBRARY) - ##MESSAGE("DBG wx static: debug (but no optimized) found.") - FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h + if(WXWINDOWS_STATIC_DEBUG_LIBRARY) + if(NOT WXWINDOWS_STATIC_LIBRARY) + ##message("DBG wx static: debug (but no optimized) found.") + find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h ${WXWINDOWS_ROOT_DIR}/lib/mswd ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/mswd ) - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} ${WXWINDOWS_STATIC_DEBUG_LIBRARY} ) - IF (WXWINDOWS_USE_GL) - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + if (WXWINDOWS_USE_GL) + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} ${WXWINDOWS_STATIC_DEBUG_LIBRARY_GL} ) - ENDIF (WXWINDOWS_USE_GL) - ENDIF(NOT WXWINDOWS_STATIC_LIBRARY) - ENDIF(WXWINDOWS_STATIC_DEBUG_LIBRARY) + endif () + endif() + endif() ## static: only release wx lib found? - IF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY) - IF(WXWINDOWS_STATIC_LIBRARY) - ##MESSAGE("DBG wx static: optimized (but no debug) found.") - FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h + if(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY) + if(WXWINDOWS_STATIC_LIBRARY) + ##message("DBG wx static: optimized (but no debug) found.") + find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h ${WXWINDOWS_ROOT_DIR}/lib/msw ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/msw ) - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} ${WXWINDOWS_STATIC_LIBRARY} ) - IF (WXWINDOWS_USE_GL) - SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} + if (WXWINDOWS_USE_GL) + set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} ${WXWINDOWS_STATIC_LIBRARY_GL} ) - ENDIF (WXWINDOWS_USE_GL) - ENDIF(WXWINDOWS_STATIC_LIBRARY) - ENDIF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY) + endif () + endif() + endif() ## static: none found? - IF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY AND NOT WXWINDOWS_SEPARATE_LIBS_BUILD) - IF(NOT WXWINDOWS_STATIC_LIBRARY) - MESSAGE(STATUS + if(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY AND NOT WXWINDOWS_SEPARATE_LIBS_BUILD) + if(NOT WXWINDOWS_STATIC_LIBRARY) + message(STATUS "No static wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.") - ENDIF(NOT WXWINDOWS_STATIC_LIBRARY) - ENDIF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY AND NOT WXWINDOWS_SEPARATE_LIBS_BUILD) - ENDIF(WXWINDOWS_USE_SHARED_LIBS) + endif() + endif() + endif() ## not neccessary in wxWindows 2.4.1 and 2.6.2 ## but it may fix a previous bug, see ## http://lists.wxwindows.org/cgi-bin/ezmlm-cgi?8:mss:37574:200305:mpdioeneabobmgjenoap - OPTION(WXWINDOWS_SET_DEFINITIONS "Set additional defines for wxWindows" OFF) - MARK_AS_ADVANCED(WXWINDOWS_SET_DEFINITIONS) - IF (WXWINDOWS_SET_DEFINITIONS) - SET(WXWINDOWS_DEFINITIONS "-DWINVER=0x400") - ELSE (WXWINDOWS_SET_DEFINITIONS) + option(WXWINDOWS_SET_DEFINITIONS "Set additional defines for wxWindows" OFF) + mark_as_advanced(WXWINDOWS_SET_DEFINITIONS) + if (WXWINDOWS_SET_DEFINITIONS) + set(WXWINDOWS_DEFINITIONS "-DWINVER=0x400") + else () # clear: - SET(WXWINDOWS_DEFINITIONS "") - ENDIF (WXWINDOWS_SET_DEFINITIONS) + set(WXWINDOWS_DEFINITIONS "") + endif () ## Find the include directories for wxwindows ## the first, build specific for wx/setup.h was determined before. ## add inc dir for general for "wx/wx.h" - FIND_PATH(WXWINDOWS_INCLUDE_DIR wx/wx.h + find_path(WXWINDOWS_INCLUDE_DIR wx/wx.h "${WXWINDOWS_ROOT_DIR}/include" ) ## append the build specific include dir for wx/setup.h: - IF (WXWINDOWS_INCLUDE_DIR_SETUPH) - SET(WXWINDOWS_INCLUDE_DIR ${WXWINDOWS_INCLUDE_DIR} ${WXWINDOWS_INCLUDE_DIR_SETUPH} ) - ENDIF (WXWINDOWS_INCLUDE_DIR_SETUPH) + if (WXWINDOWS_INCLUDE_DIR_SETUPH) + set(WXWINDOWS_INCLUDE_DIR ${WXWINDOWS_INCLUDE_DIR} ${WXWINDOWS_INCLUDE_DIR_SETUPH} ) + endif () - MARK_AS_ADVANCED( + mark_as_advanced( WXWINDOWS_ROOT_DIR WXWINDOWS_INCLUDE_DIR WXWINDOWS_INCLUDE_DIR_SETUPH @@ -579,9 +578,9 @@ IF(WIN32_STYLE_FIND) ) -ELSE(WIN32_STYLE_FIND) +else() - IF (UNIX_STYLE_FIND) + if (UNIX_STYLE_FIND) ## ###################################################################### ## ## UNIX/Linux specific: @@ -590,85 +589,87 @@ ELSE(WIN32_STYLE_FIND) ## 06/2003 Jan Woetzel ## - OPTION(WXWINDOWS_USE_SHARED_LIBS "Use shared versions (.so) of wxWindows libraries" ON) - MARK_AS_ADVANCED(WXWINDOWS_USE_SHARED_LIBS) + option(WXWINDOWS_USE_SHARED_LIBS "Use shared versions (.so) of wxWindows libraries" ON) + mark_as_advanced(WXWINDOWS_USE_SHARED_LIBS) # JW removed option and force the develper th SET it. - # OPTION(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional + # option(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional # --gl-libs for wx-config)?" OFF) # wx-config should be in your path anyhow, usually no need to set WXWIN or # search in ../wx or ../../wx - FIND_PROGRAM(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE wx-config - $ENV{WXWIN} - $ENV{WXWIN}/bin + find_program(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE wx-config + HINTS + ENV WXWIN + $ENV{WXWIN}/bin + PATHS ../wx/bin ../../wx/bin ) # check wether wx-config was found: - IF(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE) + if(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE) # use shared/static wx lib? # remember: always link shared to use systems GL etc. libs (no static # linking, just link *against* static .a libs) - IF(WXWINDOWS_USE_SHARED_LIBS) - SET(WX_CONFIG_ARGS_LIBS "--libs") - ELSE(WXWINDOWS_USE_SHARED_LIBS) - SET(WX_CONFIG_ARGS_LIBS "--static --libs") - ENDIF(WXWINDOWS_USE_SHARED_LIBS) + if(WXWINDOWS_USE_SHARED_LIBS) + set(WX_CONFIG_ARGS_LIBS "--libs") + else() + set(WX_CONFIG_ARGS_LIBS "--static --libs") + endif() # do we need additionial wx GL stuff like GLCanvas ? - IF(WXWINDOWS_USE_GL) - SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --gl-libs" ) - ENDIF(WXWINDOWS_USE_GL) - ##MESSAGE("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===") + if(WXWINDOWS_USE_GL) + set(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --gl-libs" ) + endif() + ##message("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===") # set CXXFLAGS to be fed into CMAKE_CXX_FLAGS by the user: - IF (HAVE_ISYSTEM) # does the compiler support -isystem ? - IF (NOT APPLE) # -isystem seem sto be unsuppored on Mac - IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX ) - IF (CMAKE_CXX_COMPILER MATCHES g\\+\\+) - SET(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags|sed -e s/-I/-isystem/g`") - ELSE(CMAKE_CXX_COMPILER MATCHES g\\+\\+) - SET(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags`") - ENDIF(CMAKE_CXX_COMPILER MATCHES g\\+\\+) - ENDIF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX ) - ENDIF (NOT APPLE) - ENDIF (HAVE_ISYSTEM) - ##MESSAGE("DBG: for compilation: + if (HAVE_ISYSTEM) # does the compiler support -isystem ? + if (NOT APPLE) # -isystem seem sto be unsuppored on Mac + if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX ) + if (CMAKE_CXX_COMPILER MATCHES g\\+\\+) + set(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags|sed -e s/-I/-isystem/g`") + else() + set(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags`") + endif() + endif() + endif () + endif () + ##message("DBG: for compilation: ##CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS}===") # keep the back-quoted string for clarity - SET(WXWINDOWS_LIBRARIES "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ${WX_CONFIG_ARGS_LIBS}`") - ##MESSAGE("DBG2: for linking: + set(WXWINDOWS_LIBRARIES "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ${WX_CONFIG_ARGS_LIBS}`") + ##message("DBG2: for linking: ##WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES}===") # evaluate wx-config output to separate linker flags and linkdirs for # rpath: - EXEC_PROGRAM(${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} + exec_program(${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ARGS ${WX_CONFIG_ARGS_LIBS} OUTPUT_VARIABLE WX_CONFIG_LIBS ) ## extract linkdirs (-L) for rpath ## use regular expression to match wildcard equivalent "-L*" ## with is a space or a semicolon - STRING(REGEX MATCHALL "[-][L]([^ ;])+" WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX "${WX_CONFIG_LIBS}" ) - # MESSAGE("DBG WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX=${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX}") + string(REGEX MATCHALL "[-][L]([^ ;])+" WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX "${WX_CONFIG_LIBS}" ) + # message("DBG WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX=${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX}") ## remove prefix -L because we need the pure directory for LINK_DIRECTORIES ## replace -L by ; because the separator seems to be lost otherwise (bug or ## feature?) - IF(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX) - STRING(REGEX REPLACE "[-][L]" ";" WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX} ) - # MESSAGE("DBG WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES}") - ENDIF(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX) + if(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX) + string(REGEX REPLACE "[-][L]" ";" WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX} ) + # message("DBG WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES}") + endif() ## replace space separated string by semicolon separated vector to make it ## work with LINK_DIRECTORIES - SEPARATE_ARGUMENTS(WXWINDOWS_LINK_DIRECTORIES) + separate_arguments(WXWINDOWS_LINK_DIRECTORIES) - MARK_AS_ADVANCED( + mark_as_advanced( CMAKE_WXWINDOWS_CXX_FLAGS WXWINDOWS_INCLUDE_DIR WXWINDOWS_LIBRARIES @@ -677,30 +678,30 @@ ELSE(WIN32_STYLE_FIND) ## we really need wx-config... - ELSE(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE) - MESSAGE(STATUS "Cannot find wx-config anywhere on the system. Please put the file into your path or specify it in CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE.") - MARK_AS_ADVANCED(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE) - ENDIF(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE) + else() + message(STATUS "Cannot find wx-config anywhere on the system. Please put the file into your path or specify it in CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE.") + mark_as_advanced(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE) + endif() - ELSE(UNIX_STYLE_FIND) - MESSAGE(STATUS "FindwxWindows.cmake: Platform unknown/unsupported by FindwxWindows.cmake. It's neither WIN32 nor UNIX") - ENDIF(UNIX_STYLE_FIND) -ENDIF(WIN32_STYLE_FIND) + else() + message(STATUS "FindwxWindows.cmake: Platform unknown/unsupported by FindwxWindows.cmake. It's neither WIN32 nor UNIX") + endif() +endif() -IF(WXWINDOWS_LIBRARIES) - IF(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS) +if(WXWINDOWS_LIBRARIES) + if(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS) ## found all we need. - SET(WXWINDOWS_FOUND 1) + set(WXWINDOWS_FOUND 1) ## set deprecated variables for backward compatibility: - SET(CMAKE_WX_CAN_COMPILE ${WXWINDOWS_FOUND}) - SET(WXWINDOWS_LIBRARY ${WXWINDOWS_LIBRARIES}) - SET(WXWINDOWS_INCLUDE_PATH ${WXWINDOWS_INCLUDE_DIR}) - SET(WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES}) - SET(CMAKE_WX_CXX_FLAGS ${CMAKE_WXWINDOWS_CXX_FLAGS}) - - ENDIF(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS) -ENDIF(WXWINDOWS_LIBRARIES) + set(CMAKE_WX_CAN_COMPILE ${WXWINDOWS_FOUND}) + set(WXWINDOWS_LIBRARY ${WXWINDOWS_LIBRARIES}) + set(WXWINDOWS_INCLUDE_PATH ${WXWINDOWS_INCLUDE_DIR}) + set(WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES}) + set(CMAKE_WX_CXX_FLAGS ${CMAKE_WXWINDOWS_CXX_FLAGS}) + + endif() +endif() diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake index 2455c5f8b..c59e1f839 100644 --- a/Modules/FortranCInterface.cmake +++ b/Modules/FortranCInterface.cmake @@ -61,7 +61,7 @@ # If the check fails and QUIET is not given the function terminates # with a FATAL_ERROR message describing the problem. The purpose of # this check is to stop a build early for incompatible compiler -# combinations. +# combinations. The test is built in the Release configuration. # # FortranCInterface is aware of possible GLOBAL and MODULE manglings # for many Fortran compilers, but it also provides an interface to @@ -215,7 +215,7 @@ ${_desc_${macro}} message(AUTHOR_WARNING "No FortranCInterface mangling known for ${f}") endif() endif() - endforeach(f) + endforeach() # Store the content. configure_file(${FortranCInterface_SOURCE_DIR}/Macro.h.in ${FILE} @ONLY) @@ -250,6 +250,7 @@ function(FortranCInterface_VERIFY) message(STATUS "${_desc}") # Build a sample project which reports symbols. + set(CMAKE_TRY_COMPILE_CONFIGURATION Release) try_compile(FortranCInterface_VERIFY_${lang}_COMPILED ${FortranCInterface_BINARY_DIR}/Verify${lang} ${FortranCInterface_SOURCE_DIR}/Verify @@ -259,6 +260,9 @@ function(FortranCInterface_VERIFY) "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}" "-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}" "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}" + "-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}" + "-DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}" + "-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}" OUTPUT_VARIABLE _output) file(WRITE "${FortranCInterface_BINARY_DIR}/Verify${lang}/output.txt" "${_output}") diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index 2ea43d132..798c44caa 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -174,7 +174,7 @@ file(APPEND ${FortranCInterface_BINARY_DIR}/Output.cmake "\n") if(FortranCInterface_GLOBAL_FOUND) if(FortranCInterface_MODULE_FOUND) set(_result "Found GLOBAL and MODULE mangling") - else(FortranCInterface_MODULE_FOUND) + else() set(_result "Found GLOBAL but not MODULE mangling") endif() elseif(NOT _result) diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index ce23d5d25..892ebc6dd 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -47,7 +47,7 @@ # ... # }; # -# The CMake fragment will generate a file in the ${CMAKE_CURRENT_BUILD_DIR} +# The CMake fragment will generate a file in the ${CMAKE_CURRENT_BINARY_DIR} # called somelib_export.h containing the macros SOMELIB_EXPORT, SOMELIB_NO_EXPORT, # SOMELIB_DEPRECATED, SOMELIB_DEPRECATED_EXPORT and SOMELIB_DEPRECATED_NO_EXPORT. # The resulting file should be installed with other headers in the library. @@ -156,16 +156,12 @@ macro(_test_compiler_hidden_visibility) if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2") set(GCC_TOO_OLD TRUE) - message(WARNING "GCC version older than 4.2") elseif(CMAKE_COMPILER_IS_GNUC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.2") set(GCC_TOO_OLD TRUE) - message(WARNING "GCC version older than 4.2") elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0") set(_INTEL_TOO_OLD TRUE) - message(WARNING "Intel compiler older than 12.0") endif() - # Exclude XL here because it misinterprets -fvisibility=hidden even though # the check_cxx_compiler_flag passes # http://www.cdash.org/CDash/testDetails.php?test=109109951&build=1419259 diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index d215685dd..18f449dda 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -5,6 +5,7 @@ # # It uses various tools to obtain the list of required shared library files: # dumpbin (Windows) +# objdump (MinGW on Windows) # ldd (Linux/Unix) # otool (Mac OSX) # The following functions are provided by this module: @@ -126,13 +127,13 @@ function(gp_append_unique list_var value) if("${item}" STREQUAL "${value}") set(contains 1) break() - endif("${item}" STREQUAL "${value}") - endforeach(item) + endif() + endforeach() if(NOT contains) set(${list_var} ${${list_var}} "${value}" PARENT_SCOPE) - endif(NOT contains) -endfunction(gp_append_unique) + endif() +endfunction() function(is_file_executable file result_var) @@ -150,13 +151,13 @@ function(is_file_executable file result_var) if("${file_full_lower}" MATCHES "\\.exe$") set(${result_var} 1 PARENT_SCOPE) return() - endif("${file_full_lower}" MATCHES "\\.exe$") + endif() # A clause could be added here that uses output or return value of dumpbin # to determine ${result_var}. In 99%+? practical cases, the exe name # match will be sufficient... # - endif(WIN32 AND NOT UNIX) + endif() # Use the information returned from the Unix shell command "file" to # determine if ${file_full} should be considered an executable file... @@ -168,7 +169,8 @@ function(is_file_executable file result_var) if(UNIX) if(NOT file_cmd) find_program(file_cmd "file") - endif(NOT file_cmd) + mark_as_advanced(file_cmd) + endif() if(file_cmd) execute_process(COMMAND "${file_cmd}" "${file_full}" @@ -190,11 +192,11 @@ function(is_file_executable file result_var) #message(STATUS "executable!") if("${file_ov}" MATCHES "text") #message(STATUS "but text, so *not* a binary executable!") - else("${file_ov}" MATCHES "text") + else() set(${result_var} 1 PARENT_SCOPE) return() - endif("${file_ov}" MATCHES "text") - endif("${file_ov}" MATCHES "executable") + endif() + endif() # Also detect position independent executables on Linux, # where "file" gives "shared object ... (uses shared libraries)" @@ -203,11 +205,11 @@ function(is_file_executable file result_var) return() endif() - else(file_cmd) + else() message(STATUS "warning: No 'file' command, skipping execute_process...") - endif(file_cmd) - endif(UNIX) -endfunction(is_file_executable) + endif() + endif() +endfunction() function(gp_item_default_embedded_path item default_embedded_path_var) @@ -240,7 +242,7 @@ function(gp_item_default_embedded_path item default_embedded_path_var) if(item MATCHES "\\.dylib$") set(path "@executable_path/../MacOS") set(overridden 1) - endif(item MATCHES "\\.dylib$") + endif() # Embed frameworks in the embedded "Frameworks" directory (sibling of MacOS): # @@ -248,8 +250,8 @@ function(gp_item_default_embedded_path item default_embedded_path_var) if(item MATCHES "[^/]+\\.framework/") set(path "@executable_path/../Frameworks") set(overridden 1) - endif(item MATCHES "[^/]+\\.framework/") - endif(NOT overridden) + endif() + endif() endif() # Provide a hook so that projects can override the default embedded location @@ -257,10 +259,10 @@ function(gp_item_default_embedded_path item default_embedded_path_var) # if(COMMAND gp_item_default_embedded_path_override) gp_item_default_embedded_path_override("${item}" path) - endif(COMMAND gp_item_default_embedded_path_override) + endif() set(${default_embedded_path_var} "${path}" PARENT_SCOPE) -endfunction(gp_item_default_embedded_path) +endfunction() function(gp_resolve_item context item exepath dirs resolved_item_var) @@ -271,7 +273,7 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) # if(IS_ABSOLUTE "${resolved_item}" AND EXISTS "${resolved_item}") set(resolved 1) - endif(IS_ABSOLUTE "${resolved_item}" AND EXISTS "${resolved_item}") + endif() if(NOT resolved) if(item MATCHES "@executable_path") @@ -285,11 +287,11 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) #message(STATUS "info: embedded item exists (${ri})") set(resolved 1) set(resolved_item "${ri}") - else(EXISTS "${ri}") + else() message(STATUS "warning: embedded item does not exist '${ri}'") - endif(EXISTS "${ri}") - endif(item MATCHES "@executable_path") - endif(NOT resolved) + endif() + endif() + endif() if(NOT resolved) if(item MATCHES "@loader_path") @@ -305,11 +307,11 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) #message(STATUS "info: embedded item exists (${ri})") set(resolved 1) set(resolved_item "${ri}") - else(EXISTS "${ri}") + else() message(STATUS "warning: embedded item does not exist '${ri}'") - endif(EXISTS "${ri}") - endif(item MATCHES "@loader_path") - endif(NOT resolved) + endif() + endif() + endif() if(NOT resolved) if(item MATCHES "@rpath") @@ -326,10 +328,10 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) set(resolved 1) set(resolved_item "${ri}") set(ri "ri-NOTFOUND") - endif(ri) + endif() - endif(item MATCHES "@rpath") - endif(NOT resolved) + endif() + endif() if(NOT resolved) set(ri "ri-NOTFOUND") @@ -340,8 +342,8 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) set(resolved 1) set(resolved_item "${ri}") set(ri "ri-NOTFOUND") - endif(ri) - endif(NOT resolved) + endif() + endif() if(NOT resolved) if(item MATCHES "[^/]+\\.framework/") @@ -356,9 +358,9 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) set(resolved 1) set(resolved_item "${fw}") set(fw "fw-NOTFOUND") - endif(fw) - endif(item MATCHES "[^/]+\\.framework/") - endif(NOT resolved) + endif() + endif() + endif() # Using find_program on Windows will find dll files that are in the PATH. # (Converting simple file names into full path names if found.) @@ -373,16 +375,16 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) set(resolved 1) set(resolved_item "${ri}") set(ri "ri-NOTFOUND") - endif(ri) - endif(NOT resolved) - endif(WIN32 AND NOT UNIX) + endif() + endif() + endif() # Provide a hook so that projects can override item resolution # by whatever logic they choose: # if(COMMAND gp_resolve_item_override) gp_resolve_item_override("${context}" "${item}" "${exepath}" "${dirs}" resolved_item resolved) - endif(COMMAND gp_resolve_item_override) + endif() if(NOT resolved) message(STATUS " @@ -409,10 +411,10 @@ warning: cannot resolve item '${item}' # resolved_item_var='${resolved_item_var}' #****************************************************************************** #") - endif(NOT resolved) + endif() set(${resolved_item_var} "${resolved_item}" PARENT_SCOPE) -endfunction(gp_resolve_item) +endfunction() function(gp_resolved_file_type original_file file exepath dirs type_var) @@ -480,9 +482,9 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") set(is_system 1) endif() - endif(CYGPATH_EXECUTABLE) - endif(UNIX) - endif(WIN32) + endif() + endif() + endif() if(NOT is_system) get_filename_component(original_path "${original_lower}" PATH) @@ -551,7 +553,7 @@ function(gp_file_type original_file file type_var) gp_resolved_file_type("${original_file}" "${file}" "${exepath}" "" type) set(${type_var} "${type}" PARENT_SCOPE) -endfunction(gp_file_type) +endfunction() function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs) @@ -560,11 +562,22 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if(NOT IS_ABSOLUTE "${target}") message("warning: target '${target}' is not absolute...") - endif(NOT IS_ABSOLUTE "${target}") + endif() if(NOT EXISTS "${target}") message("warning: target '${target}' does not exist...") - endif(NOT EXISTS "${target}") + endif() + + set(gp_cmd_paths ${gp_cmd_paths} + "C:/Program Files/Microsoft Visual Studio 9.0/VC/bin" + "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin" + "C:/Program Files/Microsoft Visual Studio 8/VC/BIN" + "C:/Program Files (x86)/Microsoft Visual Studio 8/VC/BIN" + "C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN" + "C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN" + "/usr/local/bin" + "/usr/bin" + ) # # @@ -573,13 +586,27 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa # if("${gp_tool}" STREQUAL "") set(gp_tool "ldd") + if(APPLE) set(gp_tool "otool") - endif(APPLE) + endif() + if(WIN32 AND NOT UNIX) # This is how to check for cygwin, har! - set(gp_tool "dumpbin") - endif(WIN32 AND NOT UNIX) - endif("${gp_tool}" STREQUAL "") + find_program(gp_dumpbin "dumpbin" PATHS ${gp_cmd_paths}) + if(gp_dumpbin) + set(gp_tool "dumpbin") + else() # Try harder. Maybe we're on MinGW + set(gp_tool "objdump") + endif() + endif() + endif() + + find_program(gp_cmd ${gp_tool} PATHS ${gp_cmd_paths}) + + if(NOT gp_cmd) + message(STATUS "warning: could not find '${gp_tool}' - cannot analyze prerequisites...") + return() + endif() set(gp_tool_known 0) @@ -590,7 +617,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$") set(gp_regex_cmp_count 1) set(gp_tool_known 1) - endif("${gp_tool}" STREQUAL "ldd") + endif() if("${gp_tool}" STREQUAL "otool") set(gp_cmd_args "-L") @@ -599,7 +626,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(gp_regex_fallback "") set(gp_regex_cmp_count 3) set(gp_tool_known 1) - endif("${gp_tool}" STREQUAL "otool") + endif() if("${gp_tool}" STREQUAL "dumpbin") set(gp_cmd_args "/dependents") @@ -609,32 +636,24 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(gp_regex_cmp_count 1) set(gp_tool_known 1) set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE. - endif("${gp_tool}" STREQUAL "dumpbin") + endif() + + if("${gp_tool}" STREQUAL "objdump") + set(gp_cmd_args "-p") + set(gp_regex "^\t*DLL Name: (.*\\.[Dd][Ll][Ll])${eol_char}$") + set(gp_regex_error "") + set(gp_regex_fallback "") + set(gp_regex_cmp_count 1) + set(gp_tool_known 1) + endif() if(NOT gp_tool_known) message(STATUS "warning: gp_tool='${gp_tool}' is an unknown tool...") message(STATUS "CMake function get_prerequisites needs more code to handle '${gp_tool}'") - message(STATUS "Valid gp_tool values are dumpbin, ldd and otool.") + message(STATUS "Valid gp_tool values are dumpbin, ldd, objdump and otool.") return() - endif(NOT gp_tool_known) - - set(gp_cmd_paths ${gp_cmd_paths} - "C:/Program Files/Microsoft Visual Studio 9.0/VC/bin" - "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin" - "C:/Program Files/Microsoft Visual Studio 8/VC/BIN" - "C:/Program Files (x86)/Microsoft Visual Studio 8/VC/BIN" - "C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN" - "C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN" - "/usr/local/bin" - "/usr/bin" - ) - - find_program(gp_cmd ${gp_tool} PATHS ${gp_cmd_paths}) + endif() - if(NOT gp_cmd) - message(STATUS "warning: could not find '${gp_tool}' - cannot analyze prerequisites...") - return() - endif(NOT gp_cmd) if("${gp_tool}" STREQUAL "dumpbin") # When running dumpbin, it also needs the "Common7/IDE" directory in the @@ -654,14 +673,14 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if("${gp_env_path_element}" STREQUAL "${gp_cmd_dlls_dir}") set(gp_found_cmd_dlls_dir 1) endif() - endforeach(gp_env_path_element) + endforeach() if(NOT gp_found_cmd_dlls_dir) file(TO_NATIVE_PATH "${gp_cmd_dlls_dir}" gp_cmd_dlls_dir) set(ENV{PATH} "$ENV{PATH};${gp_cmd_dlls_dir}") endif() - endif(EXISTS "${gp_cmd_dlls_dir}") - endif("${gp_tool}" STREQUAL "dumpbin") + endif() + endif() # # @@ -669,8 +688,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(old_ld_env "$ENV{LD_LIBRARY_PATH}") foreach(dir ${exepath} ${dirs}) set(ENV{LD_LIBRARY_PATH} "${dir}:$ENV{LD_LIBRARY_PATH}") - endforeach(dir) - endif("${gp_tool}" STREQUAL "ldd") + endforeach() + endif() # Track new prerequisites at each new level of recursion. Start with an @@ -687,13 +706,13 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if("${gp_tool}" STREQUAL "ldd") set(ENV{LD_LIBRARY_PATH} "${old_ld_env}") - endif("${gp_tool}" STREQUAL "ldd") + endif() if(verbose) message(STATUS "") message(STATUS "gp_cmd_ov='${gp_cmd_ov}'") message(STATUS "") - endif(verbose) + endif() get_filename_component(target_dir "${target}" PATH) @@ -716,8 +735,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa # trim string(REGEX MATCH "[^\n ].*[^\n ]" gp_install_id "${gp_install_id}") #message("INSTALL ID is \"${gp_install_id}\"") - endif(gp_install_id) - endif("${gp_tool}" STREQUAL "otool") + endif() + endif() # Analyze each line for file names that match the regular expression: # @@ -727,23 +746,23 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa # Extract information from each candidate: if(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}") string(REGEX REPLACE "${gp_regex_fallback}" "\\1" raw_item "${candidate}") - else(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}") + else() string(REGEX REPLACE "${gp_regex}" "\\1" raw_item "${candidate}") - endif(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}") + endif() if(gp_regex_cmp_count GREATER 1) string(REGEX REPLACE "${gp_regex}" "\\2" raw_compat_version "${candidate}") string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" compat_major_version "${raw_compat_version}") string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" compat_minor_version "${raw_compat_version}") string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" compat_patch_version "${raw_compat_version}") - endif(gp_regex_cmp_count GREATER 1) + endif() if(gp_regex_cmp_count GREATER 2) string(REGEX REPLACE "${gp_regex}" "\\3" raw_current_version "${candidate}") string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" current_major_version "${raw_current_version}") string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" current_minor_version "${raw_current_version}") string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" current_patch_version "${raw_current_version}") - endif(gp_regex_cmp_count GREATER 2) + endif() # Use the raw_item as the list entries returned by this function. Use the # gp_resolve_item function to resolve it to an actual full path file if @@ -757,7 +776,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if("${item}" STREQUAL "${gp_install_id}") set(add_item 0) - endif("${item}" STREQUAL "${gp_install_id}") + endif() if(add_item AND ${exclude_system}) set(type "") @@ -765,8 +784,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if("${type}" STREQUAL "system") set(add_item 0) - endif("${type}" STREQUAL "system") - endif(add_item AND ${exclude_system}) + endif() + endif() if(add_item) list(LENGTH ${prerequisites_var} list_length_before_append) @@ -784,49 +803,49 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if(NOT list_length_before_append EQUAL list_length_after_append) gp_resolve_item("${target}" "${item}" "${exepath}" "${dirs}" resolved_item) set(unseen_prereqs ${unseen_prereqs} "${resolved_item}") - endif(NOT list_length_before_append EQUAL list_length_after_append) - endif(${recurse}) - endif(add_item) - else("${candidate}" MATCHES "${gp_regex}") + endif() + endif() + endif() + else() if(verbose) message(STATUS "ignoring non-matching line: '${candidate}'") - endif(verbose) - endif("${candidate}" MATCHES "${gp_regex}") - endforeach(candidate) + endif() + endif() + endforeach() list(LENGTH ${prerequisites_var} prerequisites_var_length) if(prerequisites_var_length GREATER 0) list(SORT ${prerequisites_var}) - endif(prerequisites_var_length GREATER 0) + endif() if(${recurse}) set(more_inputs ${unseen_prereqs}) foreach(input ${more_inputs}) get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse} "${exepath}" "${dirs}") - endforeach(input) - endif(${recurse}) + endforeach() + endif() set(${prerequisites_var} ${${prerequisites_var}} PARENT_SCOPE) -endfunction(get_prerequisites) +endfunction() function(list_prerequisites target) if("${ARGV1}" STREQUAL "") set(all 1) - else("${ARGV1}" STREQUAL "") + else() set(all "${ARGV1}") - endif("${ARGV1}" STREQUAL "") + endif() if("${ARGV2}" STREQUAL "") set(exclude_system 0) - else("${ARGV2}" STREQUAL "") + else() set(exclude_system "${ARGV2}") - endif("${ARGV2}" STREQUAL "") + endif() if("${ARGV3}" STREQUAL "") set(verbose 0) - else("${ARGV3}" STREQUAL "") + else() set(verbose "${ARGV3}") - endif("${ARGV3}" STREQUAL "") + endif() set(count 0) set(count_str "") @@ -842,23 +861,23 @@ function(list_prerequisites target) if(print_target) message(STATUS "File '${target}' depends on:") - endif(print_target) + endif() foreach(d ${prereqs}) math(EXPR count "${count} + 1") if(print_count) set(count_str "${count}. ") - endif(print_count) + endif() if(print_prerequisite_type) gp_file_type("${target}" "${d}" type) set(type_str " (${type})") - endif(print_prerequisite_type) + endif() message(STATUS "${count_str}${d}${type_str}") - endforeach(d) -endfunction(list_prerequisites) + endforeach() +endfunction() function(list_prerequisites_by_glob glob_arg glob_exp) @@ -872,6 +891,6 @@ function(list_prerequisites_by_glob glob_arg glob_exp) message(STATUS "=============================================================================") list_prerequisites("${f}" ${ARGN}) message(STATUS "") - endif(is_f_executable) - endforeach(f) -endfunction(list_prerequisites_by_glob) + endif() + endforeach() +endfunction() diff --git a/Modules/ITKCompatibility.cmake b/Modules/ITKCompatibility.cmake index efd9c284e..ca2d69bfb 100644 --- a/Modules/ITKCompatibility.cmake +++ b/Modules/ITKCompatibility.cmake @@ -13,5 +13,5 @@ # License text for the above reference.) # work around an old bug in ITK prior to verison 3.0 -SET(TIFF_RIGHT_VERSION 1) +set(TIFF_RIGHT_VERSION 1) diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 65d254a4a..bd9750185 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -1,6 +1,6 @@ # By including this file, all library files listed in the variable # CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS will be installed with -# INSTALL(PROGRAMS ...) into bin for WIN32 and lib +# install(PROGRAMS ...) into bin for WIN32 and lib # for non-WIN32. If CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP is set to TRUE # before including this file, then the INSTALL command is not called. # The user can use the variable CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS to use a @@ -36,196 +36,196 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF(MSVC) - FILE(TO_CMAKE_PATH "$ENV{SYSTEMROOT}" SYSTEMROOT) +if(MSVC) + file(TO_CMAKE_PATH "$ENV{SYSTEMROOT}" SYSTEMROOT) - IF(CMAKE_CL_64) - IF(MSVC_VERSION GREATER 1599) + if(CMAKE_CL_64) + if(MSVC_VERSION GREATER 1599) # VS 10 and later: - SET(CMAKE_MSVC_ARCH x64) - ELSE() + set(CMAKE_MSVC_ARCH x64) + else() # VS 9 and earlier: - SET(CMAKE_MSVC_ARCH amd64) - ENDIF() - ELSE(CMAKE_CL_64) - SET(CMAKE_MSVC_ARCH x86) - ENDIF(CMAKE_CL_64) + set(CMAKE_MSVC_ARCH amd64) + endif() + else() + set(CMAKE_MSVC_ARCH x86) + endif() - GET_FILENAME_COMPONENT(devenv_dir "${CMAKE_MAKE_PROGRAM}" PATH) - GET_FILENAME_COMPONENT(base_dir "${devenv_dir}/../.." ABSOLUTE) + get_filename_component(devenv_dir "${CMAKE_MAKE_PROGRAM}" PATH) + get_filename_component(base_dir "${devenv_dir}/../.." ABSOLUTE) - IF(MSVC70) - SET(__install__libs + if(MSVC70) + set(__install__libs "${SYSTEMROOT}/system32/msvcp70.dll" "${SYSTEMROOT}/system32/msvcr70.dll" ) - ENDIF(MSVC70) + endif() - IF(MSVC71) - SET(__install__libs + if(MSVC71) + set(__install__libs "${SYSTEMROOT}/system32/msvcp71.dll" "${SYSTEMROOT}/system32/msvcr71.dll" ) - ENDIF(MSVC71) + endif() - IF(MSVC80) + if(MSVC80) # Find the runtime library redistribution directory. - GET_FILENAME_COMPONENT(msvc_install_dir + get_filename_component(msvc_install_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]" ABSOLUTE) - FIND_PATH(MSVC80_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest + find_path(MSVC80_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest PATHS "${msvc_install_dir}/../../VC/redist" "${base_dir}/VC/redist" ) - MARK_AS_ADVANCED(MSVC80_REDIST_DIR) - SET(MSVC80_CRT_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT") + mark_as_advanced(MSVC80_REDIST_DIR) + set(MSVC80_CRT_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT") # Install the manifest that allows DLLs to be loaded from the # directory containing the executable. - IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) - SET(__install__libs + if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + set(__install__libs "${MSVC80_CRT_DIR}/Microsoft.VC80.CRT.manifest" "${MSVC80_CRT_DIR}/msvcm80.dll" "${MSVC80_CRT_DIR}/msvcp80.dll" "${MSVC80_CRT_DIR}/msvcr80.dll" ) - ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + endif() - IF(CMAKE_INSTALL_DEBUG_LIBRARIES) - SET(MSVC80_CRT_DIR + if(CMAKE_INSTALL_DEBUG_LIBRARIES) + set(MSVC80_CRT_DIR "${MSVC80_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugCRT") - SET(__install__libs ${__install__libs} + set(__install__libs ${__install__libs} "${MSVC80_CRT_DIR}/Microsoft.VC80.DebugCRT.manifest" "${MSVC80_CRT_DIR}/msvcm80d.dll" "${MSVC80_CRT_DIR}/msvcp80d.dll" "${MSVC80_CRT_DIR}/msvcr80d.dll" ) - ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) - ENDIF(MSVC80) + endif() + endif() - IF(MSVC90) + if(MSVC90) # Find the runtime library redistribution directory. - GET_FILENAME_COMPONENT(msvc_install_dir + get_filename_component(msvc_install_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]" ABSOLUTE) - GET_FILENAME_COMPONENT(msvc_express_install_dir + get_filename_component(msvc_express_install_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0;InstallDir]" ABSOLUTE) - FIND_PATH(MSVC90_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest + find_path(MSVC90_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest PATHS "${msvc_install_dir}/../../VC/redist" "${msvc_express_install_dir}/../../VC/redist" "${base_dir}/VC/redist" ) - MARK_AS_ADVANCED(MSVC90_REDIST_DIR) - SET(MSVC90_CRT_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT") + mark_as_advanced(MSVC90_REDIST_DIR) + set(MSVC90_CRT_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT") # Install the manifest that allows DLLs to be loaded from the # directory containing the executable. - IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) - SET(__install__libs + if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + set(__install__libs "${MSVC90_CRT_DIR}/Microsoft.VC90.CRT.manifest" "${MSVC90_CRT_DIR}/msvcm90.dll" "${MSVC90_CRT_DIR}/msvcp90.dll" "${MSVC90_CRT_DIR}/msvcr90.dll" ) - ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + endif() - IF(CMAKE_INSTALL_DEBUG_LIBRARIES) - SET(MSVC90_CRT_DIR + if(CMAKE_INSTALL_DEBUG_LIBRARIES) + set(MSVC90_CRT_DIR "${MSVC90_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugCRT") - SET(__install__libs ${__install__libs} + set(__install__libs ${__install__libs} "${MSVC90_CRT_DIR}/Microsoft.VC90.DebugCRT.manifest" "${MSVC90_CRT_DIR}/msvcm90d.dll" "${MSVC90_CRT_DIR}/msvcp90d.dll" "${MSVC90_CRT_DIR}/msvcr90d.dll" ) - ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) - ENDIF(MSVC90) + endif() + endif() - MACRO(MSVCRT_FILES_FOR_VERSION version) - SET(v "${version}") + macro(MSVCRT_FILES_FOR_VERSION version) + set(v "${version}") # Find the runtime library redistribution directory. - GET_FILENAME_COMPONENT(msvc_install_dir + get_filename_component(msvc_install_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\${v}.0;InstallDir]" ABSOLUTE) - FIND_PATH(MSVC${v}_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT + find_path(MSVC${v}_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT PATHS "${msvc_install_dir}/../../VC/redist" "${base_dir}/VC/redist" "$ENV{ProgramFiles}/Microsoft Visual Studio ${v}.0/VC/redist" "$ENV{ProgramFiles(x86)}/Microsoft Visual Studio ${v}.0/VC/redist" ) - MARK_AS_ADVANCED(MSVC${v}_REDIST_DIR) - SET(MSVC${v}_CRT_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT") + mark_as_advanced(MSVC${v}_REDIST_DIR) + set(MSVC${v}_CRT_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT") - IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) - SET(__install__libs + if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + set(__install__libs "${MSVC${v}_CRT_DIR}/msvcp${v}0.dll" "${MSVC${v}_CRT_DIR}/msvcr${v}0.dll" ) - ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + endif() - IF(CMAKE_INSTALL_DEBUG_LIBRARIES) - SET(MSVC${v}_CRT_DIR + if(CMAKE_INSTALL_DEBUG_LIBRARIES) + set(MSVC${v}_CRT_DIR "${MSVC${v}_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.DebugCRT") - SET(__install__libs ${__install__libs} + set(__install__libs ${__install__libs} "${MSVC${v}_CRT_DIR}/msvcp${v}0d.dll" "${MSVC${v}_CRT_DIR}/msvcr${v}0d.dll" ) - ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) - ENDMACRO() + endif() + endmacro() - IF(MSVC10) + if(MSVC10) MSVCRT_FILES_FOR_VERSION(10) - ENDIF() + endif() - IF(MSVC11) + if(MSVC11) MSVCRT_FILES_FOR_VERSION(11) - ENDIF() + endif() - IF(CMAKE_INSTALL_MFC_LIBRARIES) - IF(MSVC70) - SET(__install__libs ${__install__libs} + if(CMAKE_INSTALL_MFC_LIBRARIES) + if(MSVC70) + set(__install__libs ${__install__libs} "${SYSTEMROOT}/system32/mfc70.dll" ) - ENDIF(MSVC70) + endif() - IF(MSVC71) - SET(__install__libs ${__install__libs} + if(MSVC71) + set(__install__libs ${__install__libs} "${SYSTEMROOT}/system32/mfc71.dll" ) - ENDIF(MSVC71) + endif() - IF(MSVC80) - IF(CMAKE_INSTALL_DEBUG_LIBRARIES) - SET(MSVC80_MFC_DIR + if(MSVC80) + if(CMAKE_INSTALL_DEBUG_LIBRARIES) + set(MSVC80_MFC_DIR "${MSVC80_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugMFC") - SET(__install__libs ${__install__libs} + set(__install__libs ${__install__libs} "${MSVC80_MFC_DIR}/Microsoft.VC80.DebugMFC.manifest" "${MSVC80_MFC_DIR}/mfc80d.dll" "${MSVC80_MFC_DIR}/mfc80ud.dll" "${MSVC80_MFC_DIR}/mfcm80d.dll" "${MSVC80_MFC_DIR}/mfcm80ud.dll" ) - ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) + endif() - SET(MSVC80_MFC_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFC") + set(MSVC80_MFC_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFC") # Install the manifest that allows DLLs to be loaded from the # directory containing the executable. - IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) - SET(__install__libs ${__install__libs} + if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + set(__install__libs ${__install__libs} "${MSVC80_MFC_DIR}/Microsoft.VC80.MFC.manifest" "${MSVC80_MFC_DIR}/mfc80.dll" "${MSVC80_MFC_DIR}/mfc80u.dll" "${MSVC80_MFC_DIR}/mfcm80.dll" "${MSVC80_MFC_DIR}/mfcm80u.dll" ) - ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + endif() # include the language dll's for vs8 as well as the actuall dll's - SET(MSVC80_MFCLOC_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFCLOC") + set(MSVC80_MFCLOC_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFCLOC") # Install the manifest that allows DLLs to be loaded from the # directory containing the executable. - SET(__install__libs ${__install__libs} + set(__install__libs ${__install__libs} "${MSVC80_MFCLOC_DIR}/Microsoft.VC80.MFCLOC.manifest" "${MSVC80_MFCLOC_DIR}/mfc80chs.dll" "${MSVC80_MFCLOC_DIR}/mfc80cht.dll" @@ -237,39 +237,39 @@ IF(MSVC) "${MSVC80_MFCLOC_DIR}/mfc80jpn.dll" "${MSVC80_MFCLOC_DIR}/mfc80kor.dll" ) - ENDIF(MSVC80) + endif() - IF(MSVC90) - IF(CMAKE_INSTALL_DEBUG_LIBRARIES) - SET(MSVC90_MFC_DIR + if(MSVC90) + if(CMAKE_INSTALL_DEBUG_LIBRARIES) + set(MSVC90_MFC_DIR "${MSVC90_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugMFC") - SET(__install__libs ${__install__libs} + set(__install__libs ${__install__libs} "${MSVC90_MFC_DIR}/Microsoft.VC90.DebugMFC.manifest" "${MSVC90_MFC_DIR}/mfc90d.dll" "${MSVC90_MFC_DIR}/mfc90ud.dll" "${MSVC90_MFC_DIR}/mfcm90d.dll" "${MSVC90_MFC_DIR}/mfcm90ud.dll" ) - ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) + endif() - SET(MSVC90_MFC_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFC") + set(MSVC90_MFC_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFC") # Install the manifest that allows DLLs to be loaded from the # directory containing the executable. - IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) - SET(__install__libs ${__install__libs} + if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + set(__install__libs ${__install__libs} "${MSVC90_MFC_DIR}/Microsoft.VC90.MFC.manifest" "${MSVC90_MFC_DIR}/mfc90.dll" "${MSVC90_MFC_DIR}/mfc90u.dll" "${MSVC90_MFC_DIR}/mfcm90.dll" "${MSVC90_MFC_DIR}/mfcm90u.dll" ) - ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + endif() # include the language dll's for vs9 as well as the actuall dll's - SET(MSVC90_MFCLOC_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFCLOC") + set(MSVC90_MFCLOC_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFCLOC") # Install the manifest that allows DLLs to be loaded from the # directory containing the executable. - SET(__install__libs ${__install__libs} + set(__install__libs ${__install__libs} "${MSVC90_MFCLOC_DIR}/Microsoft.VC90.MFCLOC.manifest" "${MSVC90_MFCLOC_DIR}/mfc90chs.dll" "${MSVC90_MFCLOC_DIR}/mfc90cht.dll" @@ -281,121 +281,122 @@ IF(MSVC) "${MSVC90_MFCLOC_DIR}/mfc90jpn.dll" "${MSVC90_MFCLOC_DIR}/mfc90kor.dll" ) - ENDIF(MSVC90) + endif() - MACRO(MFC_FILES_FOR_VERSION version) - SET(v "${version}") + macro(MFC_FILES_FOR_VERSION version) + set(v "${version}") - IF(CMAKE_INSTALL_DEBUG_LIBRARIES) - SET(MSVC${v}_MFC_DIR + if(CMAKE_INSTALL_DEBUG_LIBRARIES) + set(MSVC${v}_MFC_DIR "${MSVC${v}_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.DebugMFC") - SET(__install__libs ${__install__libs} + set(__install__libs ${__install__libs} "${MSVC${v}_MFC_DIR}/mfc${v}0d.dll" "${MSVC${v}_MFC_DIR}/mfc${v}0ud.dll" "${MSVC${v}_MFC_DIR}/mfcm${v}0d.dll" "${MSVC${v}_MFC_DIR}/mfcm${v}0ud.dll" ) - ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) + endif() - SET(MSVC${v}_MFC_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.MFC") - IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) - SET(__install__libs ${__install__libs} + set(MSVC${v}_MFC_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.MFC") + if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + set(__install__libs ${__install__libs} "${MSVC${v}_MFC_DIR}/mfc${v}0.dll" "${MSVC${v}_MFC_DIR}/mfc${v}0u.dll" "${MSVC${v}_MFC_DIR}/mfcm${v}0.dll" "${MSVC${v}_MFC_DIR}/mfcm${v}0u.dll" ) - ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + endif() # include the language dll's as well as the actuall dll's - SET(MSVC${v}_MFCLOC_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.MFCLOC") - SET(__install__libs ${__install__libs} + set(MSVC${v}_MFCLOC_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.MFCLOC") + set(__install__libs ${__install__libs} "${MSVC${v}_MFCLOC_DIR}/mfc${v}0chs.dll" "${MSVC${v}_MFCLOC_DIR}/mfc${v}0cht.dll" - "${MSVC${v}_MFCLOC_DIR}/mfc${v}0enu.dll" - "${MSVC${v}_MFCLOC_DIR}/mfc${v}0esp.dll" "${MSVC${v}_MFCLOC_DIR}/mfc${v}0deu.dll" + "${MSVC${v}_MFCLOC_DIR}/mfc${v}0enu.dll" + "${MSVC${v}_MFCLOC_DIR}/mfc${v}0esn.dll" "${MSVC${v}_MFCLOC_DIR}/mfc${v}0fra.dll" "${MSVC${v}_MFCLOC_DIR}/mfc${v}0ita.dll" "${MSVC${v}_MFCLOC_DIR}/mfc${v}0jpn.dll" "${MSVC${v}_MFCLOC_DIR}/mfc${v}0kor.dll" + "${MSVC${v}_MFCLOC_DIR}/mfc${v}0rus.dll" ) - ENDMACRO() + endmacro() - IF(MSVC10) + if(MSVC10) MFC_FILES_FOR_VERSION(10) - ENDIF() + endif() - IF(MSVC11) + if(MSVC11) MFC_FILES_FOR_VERSION(11) - ENDIF() - ENDIF(CMAKE_INSTALL_MFC_LIBRARIES) + endif() + endif() - FOREACH(lib + foreach(lib ${__install__libs} ) - IF(EXISTS ${lib}) - SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS + if(EXISTS ${lib}) + set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib}) - ELSE(EXISTS ${lib}) - IF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) - MESSAGE(WARNING "system runtime library file does not exist: '${lib}'") + else() + if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) + message(WARNING "system runtime library file does not exist: '${lib}'") # This warning indicates an incomplete Visual Studio installation # or a bug somewhere above here in this file. # If you would like to avoid this warning, fix the real problem, or # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including # this file. - ENDIF() - ENDIF(EXISTS ${lib}) - ENDFOREACH(lib) -ENDIF(MSVC) - -IF(WATCOM) - GET_FILENAME_COMPONENT( CompilerPath ${CMAKE_C_COMPILER} PATH ) - IF(WATCOM17) - SET( __install__libs ${CompilerPath}/clbr17.dll + endif() + endif() + endforeach() +endif() + +if(WATCOM) + get_filename_component( CompilerPath ${CMAKE_C_COMPILER} PATH ) + if(WATCOM17) + set( __install__libs ${CompilerPath}/clbr17.dll ${CompilerPath}/mt7r17.dll ${CompilerPath}/plbr17.dll ) - ENDIF() - IF(WATCOM18) - SET( __install__libs ${CompilerPath}/clbr18.dll + endif() + if(WATCOM18) + set( __install__libs ${CompilerPath}/clbr18.dll ${CompilerPath}/mt7r18.dll ${CompilerPath}/plbr18.dll ) - ENDIF() - IF(WATCOM19) - SET( __install__libs ${CompilerPath}/clbr19.dll + endif() + if(WATCOM19) + set( __install__libs ${CompilerPath}/clbr19.dll ${CompilerPath}/mt7r19.dll ${CompilerPath}/plbr19.dll ) - ENDIF() - FOREACH(lib + endif() + foreach(lib ${__install__libs} ) - IF(EXISTS ${lib}) - SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS + if(EXISTS ${lib}) + set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib}) - ELSE() - IF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) - MESSAGE(WARNING "system runtime library file does not exist: '${lib}'") + else() + if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) + message(WARNING "system runtime library file does not exist: '${lib}'") # This warning indicates an incomplete Watcom installation # or a bug somewhere above here in this file. # If you would like to avoid this warning, fix the real problem, or # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including # this file. - ENDIF() - ENDIF() - ENDFOREACH() -ENDIF() + endif() + endif() + endforeach() +endif() # Include system runtime libraries in the installation if any are # specified by CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS. -IF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) - IF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP) - IF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION) - IF(WIN32) - SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION bin) - ELSE(WIN32) - SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib) - ENDIF(WIN32) - ENDIF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION) - INSTALL(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} +if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) + if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP) + if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION) + if(WIN32) + set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION bin) + else() + set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib) + endif() + endif() + install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}) - ENDIF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP) -ENDIF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) + endif() +endif() diff --git a/Modules/KDE3Macros.cmake b/Modules/KDE3Macros.cmake index 5b76000e8..07864f5d8 100644 --- a/Modules/KDE3Macros.cmake +++ b/Modules/KDE3Macros.cmake @@ -32,157 +32,157 @@ #neundorf@kde.org -INCLUDE(AddFileDependencies) +include(AddFileDependencies) #create the kidl and skeletion file for dcop stuff #usage: KDE_ADD_COP_SKELS(foo_SRCS ${dcop_headers}) -MACRO(KDE3_ADD_DCOP_SKELS _sources) - FOREACH (_current_FILE ${ARGN}) +macro(KDE3_ADD_DCOP_SKELS _sources) + foreach (_current_FILE ${ARGN}) - GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE) - GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE) + get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(_basename ${_tmp_FILE} NAME_WE) - SET(_skel ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_skel.cpp) - SET(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl) + set(_skel ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_skel.cpp) + set(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl) - IF (NOT HAVE_${_basename}_KIDL_RULE) - SET(HAVE_${_basename}_KIDL_RULE ON) + if (NOT HAVE_${_basename}_KIDL_RULE) + set(HAVE_${_basename}_KIDL_RULE ON) - ADD_CUSTOM_COMMAND(OUTPUT ${_kidl} + add_custom_command(OUTPUT ${_kidl} COMMAND ${KDE3_DCOPIDL_EXECUTABLE} ARGS ${_tmp_FILE} > ${_kidl} DEPENDS ${_tmp_FILE} ) - ENDIF (NOT HAVE_${_basename}_KIDL_RULE) + endif () - IF (NOT HAVE_${_basename}_SKEL_RULE) - SET(HAVE_${_basename}_SKEL_RULE ON) + if (NOT HAVE_${_basename}_SKEL_RULE) + set(HAVE_${_basename}_SKEL_RULE ON) - ADD_CUSTOM_COMMAND(OUTPUT ${_skel} + add_custom_command(OUTPUT ${_skel} COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE} ARGS --c++-suffix cpp --no-signals --no-stub ${_kidl} DEPENDS ${_kidl} ) - ENDIF (NOT HAVE_${_basename}_SKEL_RULE) + endif () - SET(${_sources} ${${_sources}} ${_skel}) + set(${_sources} ${${_sources}} ${_skel}) - ENDFOREACH (_current_FILE) + endforeach () -ENDMACRO(KDE3_ADD_DCOP_SKELS) +endmacro() -MACRO(KDE3_ADD_DCOP_STUBS _sources) - FOREACH (_current_FILE ${ARGN}) +macro(KDE3_ADD_DCOP_STUBS _sources) + foreach (_current_FILE ${ARGN}) - GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) - GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE) + get_filename_component(_basename ${_tmp_FILE} NAME_WE) - SET(_stub_CPP ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.cpp) - SET(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl) + set(_stub_CPP ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.cpp) + set(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl) - IF (NOT HAVE_${_basename}_KIDL_RULE) - SET(HAVE_${_basename}_KIDL_RULE ON) + if (NOT HAVE_${_basename}_KIDL_RULE) + set(HAVE_${_basename}_KIDL_RULE ON) - ADD_CUSTOM_COMMAND(OUTPUT ${_kidl} + add_custom_command(OUTPUT ${_kidl} COMMAND ${KDE3_DCOPIDL_EXECUTABLE} ARGS ${_tmp_FILE} > ${_kidl} DEPENDS ${_tmp_FILE} ) - ENDIF (NOT HAVE_${_basename}_KIDL_RULE) + endif () - IF (NOT HAVE_${_basename}_STUB_RULE) - SET(HAVE_${_basename}_STUB_RULE ON) + if (NOT HAVE_${_basename}_STUB_RULE) + set(HAVE_${_basename}_STUB_RULE ON) - ADD_CUSTOM_COMMAND(OUTPUT ${_stub_CPP} + add_custom_command(OUTPUT ${_stub_CPP} COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE} ARGS --c++-suffix cpp --no-signals --no-skel ${_kidl} DEPENDS ${_kidl} ) - ENDIF (NOT HAVE_${_basename}_STUB_RULE) + endif () - SET(${_sources} ${${_sources}} ${_stub_CPP}) + set(${_sources} ${${_sources}} ${_stub_CPP}) - ENDFOREACH (_current_FILE) + endforeach () -ENDMACRO(KDE3_ADD_DCOP_STUBS) +endmacro() -MACRO(KDE3_ADD_KCFG_FILES _sources) - FOREACH (_current_FILE ${ARGN}) +macro(KDE3_ADD_KCFG_FILES _sources) + foreach (_current_FILE ${ARGN}) - GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) - GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE) + get_filename_component(_basename ${_tmp_FILE} NAME_WE) - FILE(READ ${_tmp_FILE} _contents) - STRING(REGEX REPLACE "^(.*\n)?File=([^\n]+)\n.*$" "\\2" _kcfg_FILE "${_contents}") + file(READ ${_tmp_FILE} _contents) + string(REGEX REPLACE "^(.*\n)?File=([^\n]+)\n.*$" "\\2" _kcfg_FILE "${_contents}") - SET(_src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) - SET(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) + set(_src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) + set(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) - ADD_CUSTOM_COMMAND(OUTPUT ${_src_FILE} + add_custom_command(OUTPUT ${_src_FILE} COMMAND ${KDE3_KCFGC_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ${_tmp_FILE} DEPENDS ${_tmp_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ) - SET(${_sources} ${${_sources}} ${_src_FILE}) + set(${_sources} ${${_sources}} ${_src_FILE}) - ENDFOREACH (_current_FILE) + endforeach () -ENDMACRO(KDE3_ADD_KCFG_FILES) +endmacro() #create the moc files and add them to the list of sources #usage: KDE_ADD_MOC_FILES(foo_SRCS ${moc_headers}) -MACRO(KDE3_ADD_MOC_FILES _sources) - FOREACH (_current_FILE ${ARGN}) +macro(KDE3_ADD_MOC_FILES _sources) + foreach (_current_FILE ${ARGN}) - GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) - GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE) - SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp) + get_filename_component(_basename ${_tmp_FILE} NAME_WE) + set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp) - ADD_CUSTOM_COMMAND(OUTPUT ${_moc} + add_custom_command(OUTPUT ${_moc} COMMAND ${QT_MOC_EXECUTABLE} ARGS ${_tmp_FILE} -o ${_moc} DEPENDS ${_tmp_FILE} ) - SET(${_sources} ${${_sources}} ${_moc}) + set(${_sources} ${${_sources}} ${_moc}) - ENDFOREACH (_current_FILE) -ENDMACRO(KDE3_ADD_MOC_FILES) + endforeach () +endmacro() -GET_FILENAME_COMPONENT( KDE3_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) +get_filename_component( KDE3_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) #create the implementation files from the ui files and add them to the list of sources #usage: KDE_ADD_UI_FILES(foo_SRCS ${ui_files}) -MACRO(KDE3_ADD_UI_FILES _sources ) - FOREACH (_current_FILE ${ARGN}) +macro(KDE3_ADD_UI_FILES _sources ) + foreach (_current_FILE ${ARGN}) - GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) - GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE) - SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) - SET(_src ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) - SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp) + get_filename_component(_basename ${_tmp_FILE} NAME_WE) + set(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) + set(_src ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) + set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp) - ADD_CUSTOM_COMMAND(OUTPUT ${_header} + add_custom_command(OUTPUT ${_header} COMMAND ${QT_UIC_EXECUTABLE} ARGS -L ${KDE3_LIB_DIR}/kde3/plugins/designer -nounload -o ${_header} ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} DEPENDS ${_tmp_FILE} ) - ADD_CUSTOM_COMMAND(OUTPUT ${_src} + add_custom_command(OUTPUT ${_src} COMMAND ${CMAKE_COMMAND} ARGS -DKDE_UIC_PLUGIN_DIR:FILEPATH=${KDE3_LIB_DIR}/kde3/plugins/designer @@ -194,23 +194,23 @@ MACRO(KDE3_ADD_UI_FILES _sources ) DEPENDS ${_header} ) - ADD_CUSTOM_COMMAND(OUTPUT ${_moc} + add_custom_command(OUTPUT ${_moc} COMMAND ${QT_MOC_EXECUTABLE} ARGS ${_header} -o ${_moc} DEPENDS ${_header} ) - SET(${_sources} ${${_sources}} ${_src} ${_moc} ) + set(${_sources} ${${_sources}} ${_src} ${_moc} ) - ENDFOREACH (_current_FILE) -ENDMACRO(KDE3_ADD_UI_FILES) + endforeach () +endmacro() -MACRO(KDE3_AUTOMOC) - SET(_matching_FILES ) - FOREACH (_current_FILE ${ARGN}) +macro(KDE3_AUTOMOC) + set(_matching_FILES ) + foreach (_current_FILE ${ARGN}) - GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. # here. this is required to make bouic work correctly: @@ -219,193 +219,192 @@ MACRO(KDE3_AUTOMOC) # cmake is run for the very first time on them -> however the .cpp files might # exist at a later run. at that time we need to skip them, so that we don't add two # different rules for the same moc file - GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC) + get_source_file_property(_skip ${_abs_FILE} SKIP_AUTOMOC) - IF (EXISTS ${_abs_FILE} AND NOT _skip) + if (EXISTS ${_abs_FILE} AND NOT _skip) - FILE(READ ${_abs_FILE} _contents) + file(STRINGS ${_abs_FILE} _match REGEX "#include +[^ ]+\\.moc[\">]") - GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH) + get_filename_component(_abs_PATH ${_abs_FILE} PATH) - STRING(REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _match "${_contents}") - IF(_match) - FOREACH (_current_MOC_INC ${_match}) - STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}") + foreach (_current_MOC_INC IN LISTS _match) + string(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}") - GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE) -# SET(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h) - SET(_header ${_abs_PATH}/${_basename}.h) - SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) + get_filename_component(_basename ${_current_MOC} NAME_WE) +# set(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h) + set(_header ${_abs_PATH}/${_basename}.h) + set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) - ADD_CUSTOM_COMMAND(OUTPUT ${_moc} - COMMAND ${QT_MOC_EXECUTABLE} - ARGS ${_header} -o ${_moc} - DEPENDS ${_header} - ) + add_custom_command(OUTPUT ${_moc} + COMMAND ${QT_MOC_EXECUTABLE} + ARGS ${_header} -o ${_moc} + DEPENDS ${_header} + ) - ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) + ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) - ENDFOREACH (_current_MOC_INC) - ENDIF(_match) - - ENDIF (EXISTS ${_abs_FILE} AND NOT _skip) - ENDFOREACH (_current_FILE) -ENDMACRO(KDE3_AUTOMOC) + endforeach () + unset(_match) + unset(_header) + unset(_moc) + endif () + endforeach () +endmacro() # only used internally by KDE3_INSTALL_ICONS -MACRO (_KDE3_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME) +macro (_KDE3_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME) # if the string doesn't match the pattern, the result is the full string, so all three have the same content - IF (NOT ${_group} STREQUAL ${_install_NAME} ) - SET(_icon_GROUP "actions") + if (NOT ${_group} STREQUAL ${_install_NAME} ) + set(_icon_GROUP "actions") - IF (${_group} STREQUAL "mime") - SET(_icon_GROUP "mimetypes") - ENDIF (${_group} STREQUAL "mime") + if (${_group} STREQUAL "mime") + set(_icon_GROUP "mimetypes") + endif () - IF (${_group} STREQUAL "filesys") - SET(_icon_GROUP "filesystems") - ENDIF (${_group} STREQUAL "filesys") + if (${_group} STREQUAL "filesys") + set(_icon_GROUP "filesystems") + endif () - IF (${_group} STREQUAL "device") - SET(_icon_GROUP "devices") - ENDIF (${_group} STREQUAL "device") + if (${_group} STREQUAL "device") + set(_icon_GROUP "devices") + endif () - IF (${_group} STREQUAL "app") - SET(_icon_GROUP "apps") - ENDIF (${_group} STREQUAL "app") + if (${_group} STREQUAL "app") + set(_icon_GROUP "apps") + endif () - IF (${_group} STREQUAL "action") - SET(_icon_GROUP "actions") - ENDIF (${_group} STREQUAL "action") + if (${_group} STREQUAL "action") + set(_icon_GROUP "actions") + endif () # message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name}" ) - INSTALL(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/ RENAME ${_install_NAME} ) - ENDIF (NOT ${_group} STREQUAL ${_install_NAME} ) + install(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/ RENAME ${_install_NAME} ) + endif () -ENDMACRO (_KDE3_ADD_ICON_INSTALL_RULE) +endmacro () -MACRO (KDE3_INSTALL_ICONS _theme ) - SET(_defaultpath "${CMAKE_INSTALL_PREFIX}/share/icons") +macro (KDE3_INSTALL_ICONS _theme ) + set(_defaultpath "${CMAKE_INSTALL_PREFIX}/share/icons") # first the png icons - FILE(GLOB _icons *.png) - FOREACH (_current_ICON ${_icons} ) - STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}") - STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}") - STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}") + file(GLOB _icons *.png) + foreach (_current_ICON ${_icons} ) + string(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}") + string(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}") + string(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}") _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake ${_defaultpath}/${_theme}/${_size}x${_size} ${_group} ${_current_ICON} ${_name}) - ENDFOREACH (_current_ICON) + endforeach () # and now the svg icons - FILE(GLOB _icons *.svgz) - FOREACH (_current_ICON ${_icons} ) - STRING(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _group "${_current_ICON}") - STRING(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _name "${_current_ICON}") + file(GLOB _icons *.svgz) + foreach (_current_ICON ${_icons} ) + string(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _group "${_current_ICON}") + string(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _name "${_current_ICON}") _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake ${_defaultpath}/${_theme}/scalable ${_group} ${_current_ICON} ${_name}) - ENDFOREACH (_current_ICON) + endforeach () -ENDMACRO (KDE3_INSTALL_ICONS) +endmacro () -MACRO(KDE3_INSTALL_LIBTOOL_FILE _target) - GET_TARGET_PROPERTY(_target_location ${_target} LOCATION) +macro(KDE3_INSTALL_LIBTOOL_FILE _target) + get_target_property(_target_location ${_target} LOCATION) - GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE) - GET_FILENAME_COMPONENT(_soname ${_target_location} NAME) - SET(_laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la) + get_filename_component(_laname ${_target_location} NAME_WE) + get_filename_component(_soname ${_target_location} NAME) + set(_laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la) - FILE(WRITE ${_laname} "# ${_laname} - a libtool library file, generated by cmake \n") - FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n") - FILE(APPEND ${_laname} "dlname='${_soname}'\n") - FILE(APPEND ${_laname} "# Names of this library\n") - IF(CYGWIN) - FILE(APPEND ${_laname} "library_names='${_soname}'\n") - ELSE(CYGWIN) - FILE(APPEND ${_laname} "library_names='${_soname} ${_soname} ${_soname}'\n") - ENDIF(CYGWIN) - FILE(APPEND ${_laname} "# The name of the static archive\n") - FILE(APPEND ${_laname} "old_library=''\n") - FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n") - FILE(APPEND ${_laname} "dependency_libs=''\n") -# FILE(APPEND ${_laname} "dependency_libs='${${_target}_LIB_DEPENDS}'\n") - FILE(APPEND ${_laname} "# Version information.\ncurrent=0\nage=0\nrevision=0\n") - FILE(APPEND ${_laname} "# Is this an already installed library?\ninstalled=yes\n") - FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\nshouldnotlink=yes\n") - FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''\n") - FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n") - FILE(APPEND ${_laname} "libdir='${CMAKE_INSTALL_PREFIX}/lib/kde3'\n") + file(WRITE ${_laname} "# ${_laname} - a libtool library file, generated by cmake \n") + file(APPEND ${_laname} "# The name that we can dlopen(3).\n") + file(APPEND ${_laname} "dlname='${_soname}'\n") + file(APPEND ${_laname} "# Names of this library\n") + if(CYGWIN) + file(APPEND ${_laname} "library_names='${_soname}'\n") + else() + file(APPEND ${_laname} "library_names='${_soname} ${_soname} ${_soname}'\n") + endif() + file(APPEND ${_laname} "# The name of the static archive\n") + file(APPEND ${_laname} "old_library=''\n") + file(APPEND ${_laname} "# Libraries that this one depends upon.\n") + file(APPEND ${_laname} "dependency_libs=''\n") +# file(APPEND ${_laname} "dependency_libs='${${_target}_LIB_DEPENDS}'\n") + file(APPEND ${_laname} "# Version information.\ncurrent=0\nage=0\nrevision=0\n") + file(APPEND ${_laname} "# Is this an already installed library?\ninstalled=yes\n") + file(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\nshouldnotlink=yes\n") + file(APPEND ${_laname} "# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''\n") + file(APPEND ${_laname} "# Directory that this library needs to be installed in:\n") + file(APPEND ${_laname} "libdir='${CMAKE_INSTALL_PREFIX}/lib/kde3'\n") - INSTALL_FILES(${KDE3_LIBTOOL_DIR} FILES ${_laname}) -ENDMACRO(KDE3_INSTALL_LIBTOOL_FILE) + install_files(${KDE3_LIBTOOL_DIR} FILES ${_laname}) +endmacro() -MACRO(KDE3_CREATE_FINAL_FILE _filename) - FILE(WRITE ${_filename} "//autogenerated file\n") - FOREACH (_current_FILE ${ARGN}) - FILE(APPEND ${_filename} "#include \"${_current_FILE}\"\n") - ENDFOREACH (_current_FILE) +macro(KDE3_CREATE_FINAL_FILE _filename) + file(WRITE ${_filename} "//autogenerated file\n") + foreach (_current_FILE ${ARGN}) + file(APPEND ${_filename} "#include \"${_current_FILE}\"\n") + endforeach () -ENDMACRO(KDE3_CREATE_FINAL_FILE) +endmacro() -# OPTION(KDE3_ENABLE_FINAL "Enable final all-in-one compilation") -OPTION(KDE3_BUILD_TESTS "Build the tests") +# option(KDE3_ENABLE_FINAL "Enable final all-in-one compilation") +option(KDE3_BUILD_TESTS "Build the tests") -MACRO(KDE3_ADD_KPART _target_NAME _with_PREFIX) +macro(KDE3_ADD_KPART _target_NAME _with_PREFIX) #is the first argument is "WITH_PREFIX" then keep the standard "lib" prefix, otherwise SET the prefix empty - IF (${_with_PREFIX} STREQUAL "WITH_PREFIX") - SET(_first_SRC) - ELSE (${_with_PREFIX} STREQUAL "WITH_PREFIX") - SET(_first_SRC ${_with_PREFIX}) - ENDIF (${_with_PREFIX} STREQUAL "WITH_PREFIX") + if (${_with_PREFIX} STREQUAL "WITH_PREFIX") + set(_first_SRC) + else () + set(_first_SRC ${_with_PREFIX}) + endif () -# IF (KDE3_ENABLE_FINAL) +# if (KDE3_ENABLE_FINAL) # KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${_first_SRC} ${ARGN}) -# ADD_LIBRARY(${_target_NAME} MODULE ${_target_NAME}_final.cpp) -# ELSE (KDE3_ENABLE_FINAL) - ADD_LIBRARY(${_target_NAME} MODULE ${_first_SRC} ${ARGN}) -# ENDIF (KDE3_ENABLE_FINAL) +# add_library(${_target_NAME} MODULE ${_target_NAME}_final.cpp) +# else () + add_library(${_target_NAME} MODULE ${_first_SRC} ${ARGN}) +# endif () - IF(_first_SRC) - SET_TARGET_PROPERTIES(${_target_NAME} PROPERTIES PREFIX "") - ENDIF(_first_SRC) + if(_first_SRC) + set_target_properties(${_target_NAME} PROPERTIES PREFIX "") + endif() KDE3_INSTALL_LIBTOOL_FILE(${_target_NAME}) -ENDMACRO(KDE3_ADD_KPART) +endmacro() -MACRO(KDE3_ADD_KDEINIT_EXECUTABLE _target_NAME ) +macro(KDE3_ADD_KDEINIT_EXECUTABLE _target_NAME ) -# IF (KDE3_ENABLE_FINAL) +# if (KDE3_ENABLE_FINAL) # KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${ARGN}) -# ADD_LIBRARY(kdeinit_${_target_NAME} SHARED ${_target_NAME}_final.cpp) -# ELSE (KDE3_ENABLE_FINAL) - ADD_LIBRARY(kdeinit_${_target_NAME} SHARED ${ARGN} ) -# ENDIF (KDE3_ENABLE_FINAL) +# add_library(kdeinit_${_target_NAME} SHARED ${_target_NAME}_final.cpp) +# else () + add_library(kdeinit_${_target_NAME} SHARED ${ARGN} ) +# endif () - CONFIGURE_FILE(${KDE3_MODULE_DIR}/kde3init_dummy.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp) + configure_file(${KDE3_MODULE_DIR}/kde3init_dummy.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp) - ADD_EXECUTABLE( ${_target_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp ) - TARGET_LINK_LIBRARIES( ${_target_NAME} kdeinit_${_target_NAME} ) + add_executable( ${_target_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp ) + target_link_libraries( ${_target_NAME} kdeinit_${_target_NAME} ) -ENDMACRO(KDE3_ADD_KDEINIT_EXECUTABLE) +endmacro() -MACRO(KDE3_ADD_EXECUTABLE _target_NAME ) +macro(KDE3_ADD_EXECUTABLE _target_NAME ) -# IF (KDE3_ENABLE_FINAL) +# if (KDE3_ENABLE_FINAL) # KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${ARGN}) -# ADD_EXECUTABLE(${_target_NAME} ${_target_NAME}_final.cpp) -# ELSE (KDE3_ENABLE_FINAL) - ADD_EXECUTABLE(${_target_NAME} ${ARGN} ) -# ENDIF (KDE3_ENABLE_FINAL) +# add_executable(${_target_NAME} ${_target_NAME}_final.cpp) +# else () + add_executable(${_target_NAME} ${ARGN} ) +# endif () -ENDMACRO(KDE3_ADD_EXECUTABLE) +endmacro() diff --git a/Modules/MacroAddFileDependencies.cmake b/Modules/MacroAddFileDependencies.cmake index 527447b80..d0605a114 100644 --- a/Modules/MacroAddFileDependencies.cmake +++ b/Modules/MacroAddFileDependencies.cmake @@ -2,9 +2,9 @@ # Using the macro MACRO_ADD_FILE_DEPENDENCIES() is discouraged. There are usually # better ways to specify the correct dependencies. # -# MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...) is just a convenience +# MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...) is just a convenience # wrapper around the OBJECT_DEPENDS source file property. You can just -# use SET_PROPERTY(SOURCE APPEND PROPERTY OBJECT_DEPENDS depend_files) instead. +# use set_property(SOURCE APPEND PROPERTY OBJECT_DEPENDS depend_files) instead. #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -19,15 +19,15 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -MACRO (MACRO_ADD_FILE_DEPENDENCIES _file) +macro (MACRO_ADD_FILE_DEPENDENCIES _file) - GET_SOURCE_FILE_PROPERTY(_deps ${_file} OBJECT_DEPENDS) - IF (_deps) - SET(_deps ${_deps} ${ARGN}) - ELSE (_deps) - SET(_deps ${ARGN}) - ENDIF (_deps) + get_source_file_property(_deps ${_file} OBJECT_DEPENDS) + if (_deps) + set(_deps ${_deps} ${ARGN}) + else () + set(_deps ${ARGN}) + endif () - SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}") + set_source_files_properties(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}") -ENDMACRO (MACRO_ADD_FILE_DEPENDENCIES) +endmacro () diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 43f72f6aa..59a444bde 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -37,7 +37,10 @@ ;Set compression SetCompressor @CPACK_NSIS_COMPRESSOR@ -@CPACK_NSIS_DEFINES@ + ;Require administrator access + RequestExecutionLevel admin + +@CPACK_NSIS_DEFINES@ !include Sections.nsh @@ -71,7 +74,7 @@ Var AR_RegFlags ; This macro reads component installed flag from the registry and ;changes checked state of the section on the components page. ;Input: section index constant name specified in Section command. - + ClearErrors ;Reading component status from registry ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed" @@ -86,20 +89,20 @@ Var AR_RegFlags ; Note whether this component was installed before !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags IntOp $R0 $AR_RegFlags & $AR_RegFlags - + ;Writing modified flags SectionSetFlags ${${SecName}} $AR_SecFlags - + "default_${SecName}:" !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected !macroend - + !macro FinishSection SecName ; This macro reads section flag set by user and removes the section ;if it is not selected. ;Then it writes component installed flag to registry ;Input: section index constant name specified in Section command. - + SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags ;Checking lowest bit: IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED} @@ -110,20 +113,20 @@ Var AR_RegFlags WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \ "Installed" 0 Goto "exit_${SecName}" - + "leave_${SecName}:" ;Section is selected: WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \ "Installed" 1 - + "exit_${SecName}:" !macroend - -!macro RemoveSection SecName + +!macro RemoveSection_CPack SecName ; This macro is used to call section's Remove_... macro ;from the uninstaller. ;Input: section index constant name specified in Section command. - + !insertmacro "Remove_${${SecName}}" !macroend @@ -132,18 +135,18 @@ Var AR_RegFlags !insertmacro LoadVar ${SecName}_selected SectionGetFlags ${${SecName}} $R1 IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits - + ; See if the status has changed: IntCmp $R0 $R1 "${SecName}_unchanged" !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected - + IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected" !insertmacro "Deselect_required_by_${SecName}" goto "${SecName}_unchanged" - + "${SecName}_was_selected:" !insertmacro "Select_${SecName}_depends" - + "${SecName}_unchanged:" !macroend ;--- End of Add/Remove macros --- @@ -153,7 +156,7 @@ Var AR_RegFlags !define MUI_HEADERIMAGE !define MUI_ABORTWARNING - + ;-------------------------------- ; path functions @@ -168,7 +171,7 @@ Var AR_RegFlags !include "WinMessages.NSH" !verbose 4 ;==================================================== -; get_NT_environment +; get_NT_environment ; Returns: the selected environment ; Output : head of the stack ;==================================================== @@ -198,22 +201,22 @@ FunctionEnd !define WriteEnvStr_RegKey 'HKCU "Environment"' !endif !endif - + ; AddToPath - Adds the given dir to the search path. ; Input - head of the stack ; Note - Win9x systems requires reboot - + Function AddToPath Exch $0 Push $1 Push $2 Push $3 - + # don't add if the path doesn't exist IfFileExists "$0\*.*" "" AddToPath_done - + ReadEnvStr $1 PATH - ; if the path is too long for a NSIS variable NSIS will return a 0 + ; if the path is too long for a NSIS variable NSIS will return a 0 ; length string. If we find that, then warn and skip any path ; modification as it will trash the existing path. StrLen $2 $1 @@ -243,7 +246,7 @@ Function AddToPath Call StrStr Pop $2 StrCmp $2 "" "" AddToPath_done - + Call IsNT Pop $1 StrCmp $1 1 AddToPath_NT @@ -258,7 +261,7 @@ Function AddToPath FileClose $1 SetRebootFlag true Goto AddToPath_done - + AddToPath_NT: StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey ReadRegStr $1 ${NT_current_env} "PATH" @@ -279,7 +282,7 @@ Function AddToPath WriteRegExpandStr ${NT_all_env} "PATH" $0 DoSend: SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - + AddToPath_done: Pop $3 Pop $2 @@ -287,10 +290,10 @@ Function AddToPath Pop $0 FunctionEnd - + ; RemoveFromPath - Remove a given dir from the path ; Input: head of the stack - + Function un.RemoveFromPath Exch $0 Push $1 @@ -299,9 +302,9 @@ Function un.RemoveFromPath Push $4 Push $5 Push $6 - + IntFmt $6 "%c" 26 # DOS EOF - + Call un.IsNT Pop $1 StrCmp $1 1 unRemoveFromPath_NT @@ -313,7 +316,7 @@ Function un.RemoveFromPath GetFullPathName /SHORT $0 $0 StrCpy $0 "SET PATH=%PATH%;$0" Goto unRemoveFromPath_dosLoop - + unRemoveFromPath_dosLoop: FileRead $1 $3 StrCpy $5 $3 1 -1 # read last char @@ -328,7 +331,7 @@ Function un.RemoveFromPath unRemoveFromPath_dosLoopRemoveLine: SetRebootFlag true Goto unRemoveFromPath_dosLoop - + unRemoveFromPath_dosLoopEnd: FileClose $2 FileClose $1 @@ -337,7 +340,7 @@ Function un.RemoveFromPath CopyFiles /SILENT $4 "$1\autoexec.bat" Delete $4 Goto unRemoveFromPath_done - + unRemoveFromPath_NT: StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey ReadRegStr $1 ${NT_current_env} "PATH" @@ -361,11 +364,11 @@ Function un.RemoveFromPath StrCpy $5 $1 -$4 # $5 is now the part before the path to remove StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove StrCpy $3 $5$6 - + StrCpy $5 $3 1 -1 # copy last char StrCmp $5 ";" 0 +2 # if last char == ; StrCpy $3 $3 -1 # remove last char - + StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey WriteRegExpandStr ${NT_current_env} "PATH" $3 Goto unDoSend @@ -373,7 +376,7 @@ Function un.RemoveFromPath WriteRegExpandStr ${NT_all_env} "PATH" $3 unDoSend: SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - + unRemoveFromPath_done: Pop $6 Pop $5 @@ -383,7 +386,7 @@ Function un.RemoveFromPath Pop $1 Pop $0 FunctionEnd - + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Uninstall sutff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -391,7 +394,7 @@ FunctionEnd ########################################### # Utility Functions # ########################################### - + ;==================================================== ; IsNT - Returns 1 if the current system is NT, 0 ; otherwise. @@ -405,7 +408,7 @@ FunctionEnd ; Call IsNT ; Pop $R0 ; ($R0 at this point is 1 or 0) - + !macro IsNT un Function ${un}IsNT Push $0 @@ -415,7 +418,7 @@ Function ${un}IsNT Pop $0 Push 0 Return - + IsNT_yes: ; NT!!! Pop $0 @@ -424,7 +427,7 @@ FunctionEnd !macroend !insertmacro IsNT "" !insertmacro IsNT "un." - + ; StrStr ; input, top of stack = string to search for ; top of stack-1 = string to search in @@ -437,7 +440,7 @@ FunctionEnd ; Call StrStr ; Pop $R0 ; ($R0 at this point is "ass string") - + !macro StrStr un Function ${un}StrStr Exch $R1 ; st=haystack,old$R1, $R1=needle @@ -481,7 +484,7 @@ Loop: StrCmp "$R2" "$\r" RTrim StrCmp "$R2" ";" RTrim GoTo Done -RTrim: +RTrim: StrCpy $R1 "$R1" -1 Goto Loop Done: @@ -516,7 +519,7 @@ Function DownloadFile try_again: NSISdl::download "$1/$0" "$INSTDIR\$0" - + Pop $1 StrCmp $1 "success" success StrCmp $1 "Cancelled" cancel @@ -549,10 +552,10 @@ FunctionEnd !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@" Page custom InstallOptionsPage !insertmacro MUI_PAGE_DIRECTORY - + ;Start Menu Folder Page Configuration - !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX" - !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" + !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX" + !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER @@ -639,10 +642,10 @@ Section "-Core installation" SetOutPath "$INSTDIR" @CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@ @CPACK_NSIS_FULL_INSTALL@ - + ;Store installation folder WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR - + ;Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" Push "DisplayName" @@ -660,7 +663,7 @@ Section "-Core installation" Push "NoRepair" Push "1" Call ConditionalAddToRegisty - + !ifdef CPACK_NSIS_ADD_REMOVE ;Create add/remove functionality Push "ModifyPath" @@ -671,7 +674,7 @@ Section "-Core installation" Push "1" Call ConditionalAddToRegisty !endif - + ; Optional registration Push "DisplayIcon" Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@" @@ -687,7 +690,7 @@ Section "-Core installation" Call ConditionalAddToRegisty !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State" !insertmacro MUI_STARTMENU_WRITE_BEGIN Application - + ;Create shortcuts CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" @CPACK_NSIS_CREATE_ICONS@ @@ -725,7 +728,7 @@ SectionEnd Section "-Add to path" Push $INSTDIR\bin StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath - StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0 + StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0 Call AddToPath doNotAddToPath: SectionEnd @@ -756,12 +759,12 @@ Function un.onInit SetShellVarContext all ;MessageBox MB_OK 'User "$0" is in the Power Users group' Goto done - + noLM: ;Get installation folder from registry if available done: - + FunctionEnd ;--- Add/Remove callback functions: --- @@ -770,25 +773,25 @@ FunctionEnd ;List all of your components in following manner here. @CPACK_NSIS_COMPONENT_SECTION_LIST@ !macroend - + Section -FinishComponents ;Removes unselected components and writes component status to registry !insertmacro SectionList "FinishSection" - -!ifdef CPACK_NSIS_ADD_REMOVE + +!ifdef CPACK_NSIS_ADD_REMOVE ; Get the name of the installer executable System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1' StrCpy $R3 $R0 - + ; Strip off the last 13 characters, to see if we have AddRemove.exe StrLen $R1 $R0 IntOp $R1 $R0 - 13 StrCpy $R2 $R0 13 $R1 StrCmp $R2 "AddRemove.exe" addremove_installed - + ; We're not running AddRemove.exe, so install it CopyFiles $R3 $INSTDIR\AddRemove.exe - + addremove_installed: !endif SectionEnd @@ -825,7 +828,7 @@ Section "Uninstall" @CPACK_NSIS_DELETE_FILES@ @CPACK_NSIS_DELETE_DIRECTORIES@ -!ifdef CPACK_NSIS_ADD_REMOVE +!ifdef CPACK_NSIS_ADD_REMOVE ;Remove the add/remove program Delete "$INSTDIR\AddRemove.exe" !endif @@ -841,24 +844,24 @@ Section "Uninstall" DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" ; Removes all optional components - !insertmacro SectionList "RemoveSection" - + !insertmacro SectionList "RemoveSection_CPack" + !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP - + Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" @CPACK_NSIS_DELETE_ICONS@ @CPACK_NSIS_DELETE_ICONS_EXTRA@ - + ;Delete empty start menu parent diretories StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" - + startMenuDeleteLoop: ClearErrors RMDir $MUI_TEMP GetFullPathName $MUI_TEMP "$MUI_TEMP\.." - + IfErrors startMenuDeleteLoopDone - + StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop startMenuDeleteLoopDone: @@ -867,17 +870,17 @@ Section "Uninstall" StrCpy $MUI_TEMP "$START_MENU" Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" @CPACK_NSIS_DELETE_ICONS_EXTRA@ - + ;Delete empty start menu parent diretories StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" - + secondStartMenuDeleteLoop: ClearErrors RMDir $MUI_TEMP GetFullPathName $MUI_TEMP "$MUI_TEMP\.." - + IfErrors secondStartMenuDeleteLoopDone - + StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop secondStartMenuDeleteLoopDone: @@ -902,7 +905,7 @@ SectionEnd Function .onInit StrCmp "@CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL@" "ON" 0 inst - ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "UninstallString" + ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "UninstallString" StrCmp $0 "" inst MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \ @@ -925,14 +928,14 @@ inst: ; Reads components status for registry !insertmacro SectionList "InitSection" - ; check to see if /D has been used to change - ; the install directory by comparing it to the + ; check to see if /D has been used to change + ; the install directory by comparing it to the ; install directory that is expected to be the ; default StrCpy $IS_DEFAULT_INSTALLDIR 0 StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2 StrCpy $IS_DEFAULT_INSTALLDIR 1 - + StrCpy $SV_ALLUSERS "JustMe" ; if default install dir then change the default ; if it is installed for JustMe @@ -955,7 +958,7 @@ inst: ;MessageBox MB_OK 'User "$0" is in the Power Users group' StrCpy $SV_ALLUSERS "AllUsers" Goto done - + noLM: StrCpy $SV_ALLUSERS "AllUsers" ;Get installation folder from registry if available diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake index 81ba3657f..e5d9434b5 100644 --- a/Modules/Platform/AIX-GNU.cmake +++ b/Modules/Platform/AIX-GNU.cmake @@ -21,6 +21,7 @@ set(__AIX_COMPILER_GNU 1) macro(__aix_compiler_gnu lang) set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") - set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G,-brtl,-bnoipath") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G,-bnoipath") set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib + set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1) endmacro() diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake index 1f9415219..abf385569 100644 --- a/Modules/Platform/AIX-XL.cmake +++ b/Modules/Platform/AIX-XL.cmake @@ -21,7 +21,7 @@ set(__AIX_COMPILER_XL 1) macro(__aix_compiler_xl lang) set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") - set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-G -Wl,-brtl,-bnoipath") # -shared + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-G -Wl,-bnoipath") # -shared set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS " ") set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ") diff --git a/Modules/Platform/AIX.cmake b/Modules/Platform/AIX.cmake index a9f773ed1..58c648319 100644 --- a/Modules/Platform/AIX.cmake +++ b/Modules/Platform/AIX.cmake @@ -1,6 +1,6 @@ -SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so -SET(CMAKE_DL_LIBS "-lld") +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so +set(CMAKE_DL_LIBS "-lld") # RPATH support on AIX is called libpath. By default the runtime # libpath is paths specified by -L followed by /usr/lib and /lib. In @@ -8,10 +8,10 @@ SET(CMAKE_DL_LIBS "-lld") # -Wl,-blibpath:/usr/lib:/lib whether RPATH support is on or not. # When our own RPATH is to be added it may be inserted before the # "always" paths. -SET(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib /lib) +set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib /lib) # Files named "libfoo.a" may actually be shared libraries. -SET_PROPERTY(GLOBAL PROPERTY TARGET_ARCHIVES_MAY_BE_SHARED_LIBS 1) +set_property(GLOBAL PROPERTY TARGET_ARCHIVES_MAY_BE_SHARED_LIBS 1) # since .a can be a static or shared library on AIX, we can not do this. # at some point if we wanted it, we would have to figure out if a .a is @@ -21,9 +21,9 @@ SET_PROPERTY(GLOBAL PROPERTY TARGET_ARCHIVES_MAY_BE_SHARED_LIBS 1) # building a shared library, shared module, or executable that links # to other libraries to select whether to use the static or shared # versions of the libraries. -#FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) -# SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-bstatic") -# SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-bdynamic") -#ENDFOREACH(type) +#foreach(type SHARED_LIBRARY SHARED_MODULE EXE) +# set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-bstatic") +# set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-bdynamic") +#endforeach() -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) diff --git a/Modules/Platform/BSDOS.cmake b/Modules/Platform/BSDOS.cmake index cf9d17bfd..47852f8e1 100644 --- a/Modules/Platform/BSDOS.cmake +++ b/Modules/Platform/BSDOS.cmake @@ -1,2 +1,2 @@ -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) diff --git a/Modules/Platform/BeOS.cmake b/Modules/Platform/BeOS.cmake index 3ffb67cb8..ef811bd9c 100644 --- a/Modules/Platform/BeOS.cmake +++ b/Modules/Platform/BeOS.cmake @@ -1,12 +1,12 @@ -SET(BEOS 1) +set(BEOS 1) -SET(CMAKE_DL_LIBS root be) -SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") -SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") -SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_DL_LIBS root be) +set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") +set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) diff --git a/Modules/Platform/BlueGeneL.cmake b/Modules/Platform/BlueGeneL.cmake index 7794a26cf..082e46cae 100644 --- a/Modules/Platform/BlueGeneL.cmake +++ b/Modules/Platform/BlueGeneL.cmake @@ -1,40 +1,40 @@ -#the compute nodes on BlueGene/L don't support shared libs -SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) +#the compute nodes on BlueGene/L don't support shared libs +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty +set(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty -SET(CMAKE_LINK_LIBRARY_SUFFIX "") -SET(CMAKE_STATIC_LIBRARY_PREFIX "lib") -SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a") -SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a -SET(CMAKE_EXECUTABLE_SUFFIX "") # .exe -SET(CMAKE_DL_LIBS "" ) +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a +set(CMAKE_EXECUTABLE_SUFFIX "") # .exe +set(CMAKE_DL_LIBS "" ) -SET(CMAKE_FIND_LIBRARY_PREFIXES "lib") -SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) -IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_C_LINK_EXECUTABLE +if(CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_C_LINK_EXECUTABLE " -Wl,-relax -o -Wl,-lgcc,-lc -lnss_files -lnss_dns -lresolv") -ELSE(CMAKE_COMPILER_IS_GNUCC) +else() # when using IBM xlc we probably don't want to link to -lgcc - SET(CMAKE_C_LINK_EXECUTABLE + set(CMAKE_C_LINK_EXECUTABLE " -Wl,-relax -o -Wl,-lc -lnss_files -lnss_dns -lresolv") -ENDIF(CMAKE_COMPILER_IS_GNUCC) +endif() -IF(CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_CXX_LINK_EXECUTABLE +if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_LINK_EXECUTABLE " -Wl,-relax -o -Wl,-lstdc++,-lgcc,-lc -lnss_files -lnss_dns -lresolv") -ELSE(CMAKE_COMPILER_IS_GNUCXX) +else() # when using the IBM xlC we probably don't want to link to -lgcc - SET(CMAKE_CXX_LINK_EXECUTABLE + set(CMAKE_CXX_LINK_EXECUTABLE " -Wl,-relax -o -Wl,-lstdc++,-lc -lnss_files -lnss_dns -lresolv") -ENDIF(CMAKE_COMPILER_IS_GNUCXX) +endif() diff --git a/Modules/Platform/CYGWIN-CXX.cmake b/Modules/Platform/CYGWIN-CXX.cmake new file mode 100644 index 000000000..bf37f7903 --- /dev/null +++ b/Modules/Platform/CYGWIN-CXX.cmake @@ -0,0 +1,7 @@ +if(NOT CMAKE_CXX_COMPILER_NAMES) + set(CMAKE_CXX_COMPILER_NAMES c++) +endif() + +# Exclude C++ compilers differing from C compiler only by case +# because this platform may have a case-insensitive filesystem. +set(CMAKE_CXX_COMPILER_EXCLUDE CC aCC xlC) diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake index eae313a50..fe25ab214 100644 --- a/Modules/Platform/CYGWIN-GNU.cmake +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -44,10 +44,10 @@ macro(__cygwin_compiler_gnu lang) # building a shared library, shared module, or executable that links # to other libraries to select whether to use the static or shared # versions of the libraries. - FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic") - ENDFOREACH(type) + foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic") + endforeach() set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-all-symbols") # TODO: Is -Wl,--enable-auto-import now always default? diff --git a/Modules/Platform/CYGWIN-windres.cmake b/Modules/Platform/CYGWIN-windres.cmake index 8bc1b15e9..01d6be3df 100644 --- a/Modules/Platform/CYGWIN-windres.cmake +++ b/Modules/Platform/CYGWIN-windres.cmake @@ -1 +1 @@ -SET(CMAKE_RC_COMPILE_OBJECT " -O coff ") +set(CMAKE_RC_COMPILE_OBJECT " -O coff ") diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index b7ad2cee1..22816e77a 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -43,22 +43,22 @@ if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32) unset(__USE_CMAKE_LEGACY_CYGWIN_WIN32) endif() -SET(CYGWIN 1) +set(CYGWIN 1) -SET(CMAKE_SHARED_LIBRARY_PREFIX "cyg") -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") -SET(CMAKE_SHARED_MODULE_PREFIX "cyg") -SET(CMAKE_SHARED_MODULE_SUFFIX ".dll") -SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib") -SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a") -SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe +set(CMAKE_SHARED_LIBRARY_PREFIX "cyg") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") +set(CMAKE_SHARED_MODULE_PREFIX "cyg") +set(CMAKE_SHARED_MODULE_SUFFIX ".dll") +set(CMAKE_IMPORT_LIBRARY_PREFIX "lib") +set(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a") +set(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe # Modules have a different default prefix that shared libs. -SET(CMAKE_MODULE_EXISTS 1) +set(CMAKE_MODULE_EXISTS 1) -SET(CMAKE_FIND_LIBRARY_PREFIXES "lib") -SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a") +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a") # Shared libraries on cygwin can be named with their version number. -SET(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 1) +set(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 1) -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) diff --git a/Modules/Platform/Catamount.cmake b/Modules/Platform/Catamount.cmake index 01493fc21..7e9e02171 100644 --- a/Modules/Platform/Catamount.cmake +++ b/Modules/Platform/Catamount.cmake @@ -1,26 +1,26 @@ -#Catamount, which runs on the compute nodes of Cray machines, e.g. RedStorm, doesn't support shared libs -SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) +#Catamount, which runs on the compute nodes of Cray machines, e.g. RedStorm, doesn't support shared libs +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty +set(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty -SET(CMAKE_LINK_LIBRARY_SUFFIX "") -SET(CMAKE_STATIC_LIBRARY_PREFIX "lib") -SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a") -SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a -SET(CMAKE_EXECUTABLE_SUFFIX "") # .exe -SET(CMAKE_DL_LIBS "" ) +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a +set(CMAKE_EXECUTABLE_SUFFIX "") # .exe +set(CMAKE_DL_LIBS "" ) -SET(CMAKE_FIND_LIBRARY_PREFIXES "lib") -SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) -SET(CMAKE_CXX_LINK_SHARED_LIBRARY) -SET(CMAKE_CXX_LINK_MODULE_LIBRARY) -SET(CMAKE_C_LINK_SHARED_LIBRARY) -SET(CMAKE_C_LINK_MODULE_LIBRARY) +set(CMAKE_CXX_LINK_SHARED_LIBRARY) +set(CMAKE_CXX_LINK_MODULE_LIBRARY) +set(CMAKE_C_LINK_SHARED_LIBRARY) +set(CMAKE_C_LINK_MODULE_LIBRARY) diff --git a/Modules/Platform/Darwin-CXX.cmake b/Modules/Platform/Darwin-CXX.cmake new file mode 100644 index 000000000..bf37f7903 --- /dev/null +++ b/Modules/Platform/Darwin-CXX.cmake @@ -0,0 +1,7 @@ +if(NOT CMAKE_CXX_COMPILER_NAMES) + set(CMAKE_CXX_COMPILER_NAMES c++) +endif() + +# Exclude C++ compilers differing from C compiler only by case +# because this platform may have a case-insensitive filesystem. +set(CMAKE_CXX_COMPILER_EXCLUDE CC aCC xlC) diff --git a/Modules/Platform/Darwin-Clang-C.cmake b/Modules/Platform/Darwin-Clang-C.cmake new file mode 100644 index 000000000..0a1502ea9 --- /dev/null +++ b/Modules/Platform/Darwin-Clang-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Darwin-Clang) +__darwin_compiler_clang(C) diff --git a/Modules/Platform/Darwin-Clang-CXX.cmake b/Modules/Platform/Darwin-Clang-CXX.cmake new file mode 100644 index 000000000..f8e8d888e --- /dev/null +++ b/Modules/Platform/Darwin-Clang-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Darwin-Clang) +__darwin_compiler_clang(CXX) diff --git a/Modules/Platform/Darwin-Clang.cmake b/Modules/Platform/Darwin-Clang.cmake new file mode 100644 index 000000000..528873cfd --- /dev/null +++ b/Modules/Platform/Darwin-Clang.cmake @@ -0,0 +1,27 @@ + +#============================================================================= +# Copyright 2002-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__DARWIN_COMPILER_CLANG) + return() +endif() +set(__DARWIN_COMPILER_CLANG 1) + +macro(__darwin_compiler_clang lang) + set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") + set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") + set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=") +endmacro() diff --git a/Modules/Platform/Darwin-GNU-C.cmake b/Modules/Platform/Darwin-GNU-C.cmake index 4e326c4ca..efdfd0014 100644 --- a/Modules/Platform/Darwin-GNU-C.cmake +++ b/Modules/Platform/Darwin-GNU-C.cmake @@ -1,4 +1,4 @@ include(Platform/Darwin-GNU) __darwin_compiler_gnu(C) -cmake_gnu_has_isysroot(C) +cmake_gnu_set_sysroot_flag(C) cmake_gnu_set_osx_deployment_target_flag(C) diff --git a/Modules/Platform/Darwin-GNU-CXX.cmake b/Modules/Platform/Darwin-GNU-CXX.cmake index b39487e58..e3c2ea7c5 100644 --- a/Modules/Platform/Darwin-GNU-CXX.cmake +++ b/Modules/Platform/Darwin-GNU-CXX.cmake @@ -1,4 +1,4 @@ include(Platform/Darwin-GNU) __darwin_compiler_gnu(CXX) -cmake_gnu_has_isysroot(CXX) +cmake_gnu_set_sysroot_flag(CXX) cmake_gnu_set_osx_deployment_target_flag(CXX) diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake index 8a50a6ab9..5fee7e3ae 100644 --- a/Modules/Platform/Darwin-GNU.cmake +++ b/Modules/Platform/Darwin-GNU.cmake @@ -19,13 +19,14 @@ endif() set(__DARWIN_COMPILER_GNU 1) macro(__darwin_compiler_gnu lang) + set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output # GNU does not have -shared on OS X set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") endmacro() -macro(cmake_gnu_has_isysroot lang) - if("x${CMAKE_${lang}_HAS_ISYSROOT}" STREQUAL "x") +macro(cmake_gnu_set_sysroot_flag lang) + if(NOT DEFINED CMAKE_${lang}_SYSROOT_FLAG) set(_doc "${lang} compiler has -isysroot") message(STATUS "Checking whether ${_doc}") execute_process( @@ -35,11 +36,12 @@ macro(cmake_gnu_has_isysroot lang) ) if("${_gcc_help}" MATCHES "isysroot") message(STATUS "Checking whether ${_doc} - yes") - set(CMAKE_${lang}_HAS_ISYSROOT 1) + set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot") else() message(STATUS "Checking whether ${_doc} - no") - set(CMAKE_${lang}_HAS_ISYSROOT 0) + set(CMAKE_${lang}_SYSROOT_FLAG "") endif() + set(CMAKE_${lang}_SYSROOT_FLAG_CODE "set(CMAKE_${lang}_SYSROOT_FLAG \"${CMAKE_${lang}_SYSROOT_FLAG}\")") endif() endmacro() @@ -59,6 +61,6 @@ macro(cmake_gnu_set_osx_deployment_target_flag lang) message(STATUS "Checking whether ${_doc} - no") set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "") endif() - set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG_CODE "SET(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG \"${CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG}\")") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG_CODE "set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG \"${CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG}\")") endif() endmacro() diff --git a/Modules/Platform/Darwin-XL-C.cmake b/Modules/Platform/Darwin-XL-C.cmake index 934ebcc8c..42e94a9d6 100644 --- a/Modules/Platform/Darwin-XL-C.cmake +++ b/Modules/Platform/Darwin-XL-C.cmake @@ -1,5 +1,5 @@ -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-qmkshrobj") -SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-qmkshrobj") +set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle") # Enable shared library versioning. -SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-install_name") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-install_name") diff --git a/Modules/Platform/Darwin-XL-CXX.cmake b/Modules/Platform/Darwin-XL-CXX.cmake index 22ae0183a..65c76f8b7 100644 --- a/Modules/Platform/Darwin-XL-CXX.cmake +++ b/Modules/Platform/Darwin-XL-CXX.cmake @@ -1,5 +1,5 @@ -SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-qmkshrobj") -SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "-bundle") +set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-qmkshrobj") +set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "-bundle") # Enable shared library versioning. -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-install_name") +set(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-install_name") diff --git a/Modules/Platform/Darwin-icc.cmake b/Modules/Platform/Darwin-icc.cmake index b592e5f55..6a46f8e02 100644 --- a/Modules/Platform/Darwin-icc.cmake +++ b/Modules/Platform/Darwin-icc.cmake @@ -1,131 +1,131 @@ -SET(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS "" ) -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS "") +set(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS "" ) +set(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS "") # Setup for Leopard Compatibility -EXEC_PROGRAM(sw_vers ARGS -productVersion OUTPUT_VARIABLE _OSX_VERSION) -# MESSAGE (STATUS "_OSX_VERSION: ${_OSX_VERSION}") -IF ( _OSX_VERSION MATCHES "^10.4" ) - #IF(CMAKE_COMPILER_IS_GNUCC) - SET (CMAKE_C_FLAGS_INIT "") - SET (CMAKE_C_FLAGS_DEBUG_INIT "-gdwarf-2") - SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") - SET (CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") - SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -gdwarf-2") - SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") - SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") - # ENDIF(CMAKE_COMPILER_IS_GNUCC) - -# IF(CMAKE_COMPILER_IS_GNUCXX) - SET (CMAKE_CXX_FLAGS_INIT "") - SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-gdwarf-2") - SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") - SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -gdwarf-2") - SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") - SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") -# ENDIF(CMAKE_COMPILER_IS_GNUCXX) -ENDIF ( _OSX_VERSION MATCHES "^10.4" ) - - -SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") -SET(CMAKE_SHARED_MODULE_PREFIX "lib") -SET(CMAKE_SHARED_MODULE_SUFFIX ".so") -SET(CMAKE_MODULE_EXISTS 1) -SET(CMAKE_DL_LIBS "") -SET(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names") -SET(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names") -SET(CMAKE_PLATFORM_HAS_INSTALLNAME 1) -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") -SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") -SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") +exec_program(sw_vers ARGS -productVersion OUTPUT_VARIABLE _OSX_VERSION) +# message (STATUS "_OSX_VERSION: ${_OSX_VERSION}") +if ( _OSX_VERSION MATCHES "^10.4" ) + #if(CMAKE_COMPILER_IS_GNUCC) + set (CMAKE_C_FLAGS_INIT "") + set (CMAKE_C_FLAGS_DEBUG_INIT "-gdwarf-2") + set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") + set (CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") + set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -gdwarf-2") + set (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") + set (CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") + # endif() + +# if(CMAKE_COMPILER_IS_GNUCXX) + set (CMAKE_CXX_FLAGS_INIT "") + set (CMAKE_CXX_FLAGS_DEBUG_INIT "-gdwarf-2") + set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") + set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") + set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -gdwarf-2") + set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") + set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") +# endif() +endif () + + +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") +set(CMAKE_SHARED_MODULE_PREFIX "lib") +set(CMAKE_SHARED_MODULE_SUFFIX ".so") +set(CMAKE_MODULE_EXISTS 1) +set(CMAKE_DL_LIBS "") +set(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names") +set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names") +set(CMAKE_PLATFORM_HAS_INSTALLNAME 1) +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") +set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") # setup for universal binaries if sysroot exists -IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) +if(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) # set the sysroot to be used if CMAKE_OSX_ARCHITECTURES # has more than one value - SET(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk CACHE STRING + set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk CACHE STRING "isysroot used for universal binary support") # set _CMAKE_OSX_MACHINE to umame -m - EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE) + exec_program(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE) # check for environment variable CMAKE_OSX_ARCHITECTURES # if it is set. - IF(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "") - SET(_CMAKE_OSX_MACHINE "$ENV{CMAKE_OSX_ARCHITECTURES}") - ENDIF(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "") + if(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "") + set(_CMAKE_OSX_MACHINE "$ENV{CMAKE_OSX_ARCHITECTURES}") + endif() # now put _CMAKE_OSX_MACHINE into the cache - SET(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE} + set(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE} CACHE STRING "Build architectures for OSX") -ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) +endif() -IF("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$") - SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS +if("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$") + set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress") -ENDIF("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$") +endif() -IF(NOT XCODE) +if(NOT XCODE) # Enable shared library versioning. This flag is not actually referenced # but the fact that the setting exists will cause the generators to support # soname computation. - SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") - SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-install_name") - SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-install_name") -ENDIF(NOT XCODE) + set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") + set(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-install_name") + set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-install_name") +endif() # Xcode does not support -isystem yet. -IF(XCODE) - SET(CMAKE_INCLUDE_SYSTEM_FLAG_C) - SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) -ENDIF(XCODE) +if(XCODE) + set(CMAKE_INCLUDE_SYSTEM_FLAG_C) + set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) +endif() -SET(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different ") +set(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different ") -SET(CMAKE_C_CREATE_SHARED_LIBRARY +set(CMAKE_C_CREATE_SHARED_LIBRARY " -o ") -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY +set(CMAKE_CXX_CREATE_SHARED_LIBRARY " -o ") -SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY +set(CMAKE_Fortran_CREATE_SHARED_LIBRARY " -o ") -SET(CMAKE_CXX_CREATE_SHARED_MODULE +set(CMAKE_CXX_CREATE_SHARED_MODULE " -o ") -SET(CMAKE_C_CREATE_SHARED_MODULE +set(CMAKE_C_CREATE_SHARED_MODULE " -o ") -SET(CMAKE_Fortran_CREATE_SHARED_MODULE +set(CMAKE_Fortran_CREATE_SHARED_MODULE " -o ") -# We can use $ENV{INTEL_LICENSE_FILE} to try and get at the installation location for ICC. +# We can use $ENV{INTEL_LICENSE_FILE} to try and get at the installation location for ICC. # We also need to consider to use cce (which is the 64bit compiler) and not JUST the 32bit compiler. # I have no idea what the best way to do that would be. # default to searching for frameworks first -IF(NOT DEFINED CMAKE_FIND_FRAMEWORK) - SET(CMAKE_FIND_FRAMEWORK FIRST) -ENDIF() +if(NOT DEFINED CMAKE_FIND_FRAMEWORK) + set(CMAKE_FIND_FRAMEWORK FIRST) +endif() # set up the default search directories for frameworks -SET(CMAKE_SYSTEM_FRAMEWORK_PATH +set(CMAKE_SYSTEM_FRAMEWORK_PATH ~/Library/Frameworks /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks) # default to searching for application bundles first -IF(NOT DEFINED CMAKE_FIND_APPBUNDLE) - SET(CMAKE_FIND_APPBUNDLE FIRST) -ENDIF() +if(NOT DEFINED CMAKE_FIND_APPBUNDLE) + set(CMAKE_FIND_APPBUNDLE FIRST) +endif() # set up the default search directories for application bundles -SET(CMAKE_SYSTEM_APPBUNDLE_PATH +set(CMAKE_SYSTEM_APPBUNDLE_PATH ~/Applications /Applications /Developer/Applications) -INCLUDE(Platform/UnixPaths) -SET(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} /sw/include) -SET(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} /sw/lib) +include(Platform/UnixPaths) +set(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} /sw/include) +set(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} /sw/lib) diff --git a/Modules/Platform/Darwin-icpc.cmake b/Modules/Platform/Darwin-icpc.cmake index e247bae28..549feb7f5 100644 --- a/Modules/Platform/Darwin-icpc.cmake +++ b/Modules/Platform/Darwin-icpc.cmake @@ -1,3 +1,3 @@ -GET_FILENAME_COMPONENT(CURRENT_SOURCE_PARENT ${CMAKE_CURRENT_LIST_FILE} PATH) -#MESSAGE (STATUS "CURRENT_SOURCE_PARENT: ${CURRENT_SOURCE_PARENT}") -INCLUDE ( ${CURRENT_SOURCE_PARENT}/Darwin-icc.cmake) +get_filename_component(CURRENT_SOURCE_PARENT ${CMAKE_CURRENT_LIST_FILE} PATH) +#message (STATUS "CURRENT_SOURCE_PARENT: ${CURRENT_SOURCE_PARENT}") +include ( ${CURRENT_SOURCE_PARENT}/Darwin-icc.cmake) diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index eff07b295..2e6b71e36 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -1,4 +1,4 @@ -SET(APPLE 1) +set(APPLE 1) # Darwin versions: # 6.x == Mac OSX 10.2 (Jaguar) @@ -8,261 +8,320 @@ SET(APPLE 1) # 10.x == Mac OSX 10.6 (Snow Leopard) # 11.x == Mac OSX 10.7 (Lion) # 12.x == Mac OSX 10.8 (Mountain Lion) -STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_SYSTEM_VERSION}") -STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\2" DARWIN_MINOR_VERSION "${CMAKE_SYSTEM_VERSION}") +string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_SYSTEM_VERSION}") +string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\2" DARWIN_MINOR_VERSION "${CMAKE_SYSTEM_VERSION}") # Do not use the "-Wl,-search_paths_first" flag with the OSX 10.2 compiler. # Done this way because it is too early to do a TRY_COMPILE. -IF(NOT DEFINED HAVE_FLAG_SEARCH_PATHS_FIRST) - SET(HAVE_FLAG_SEARCH_PATHS_FIRST 0) - IF("${DARWIN_MAJOR_VERSION}" GREATER 6) - SET(HAVE_FLAG_SEARCH_PATHS_FIRST 1) - ENDIF("${DARWIN_MAJOR_VERSION}" GREATER 6) -ENDIF(NOT DEFINED HAVE_FLAG_SEARCH_PATHS_FIRST) +if(NOT DEFINED HAVE_FLAG_SEARCH_PATHS_FIRST) + set(HAVE_FLAG_SEARCH_PATHS_FIRST 0) + if("${DARWIN_MAJOR_VERSION}" GREATER 6) + set(HAVE_FLAG_SEARCH_PATHS_FIRST 1) + endif() +endif() # More desirable, but does not work: - #INCLUDE(CheckCXXCompilerFlag) + #include(CheckCXXCompilerFlag) #CHECK_CXX_COMPILER_FLAG("-Wl,-search_paths_first" HAVE_FLAG_SEARCH_PATHS_FIRST) -SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") -SET(CMAKE_SHARED_MODULE_PREFIX "lib") -SET(CMAKE_SHARED_MODULE_SUFFIX ".so") -SET(CMAKE_MODULE_EXISTS 1) -SET(CMAKE_DL_LIBS "") - -SET(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") -SET(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ") -SET(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}") -SET(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}") - -SET(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names") -SET(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names") - -IF(HAVE_FLAG_SEARCH_PATHS_FIRST) - SET(CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}") - SET(CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}") -ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST) - -SET(CMAKE_PLATFORM_HAS_INSTALLNAME 1) -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") -SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") -SET(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,") -SET(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,") -SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") +set(CMAKE_SHARED_MODULE_PREFIX "lib") +set(CMAKE_SHARED_MODULE_SUFFIX ".so") +set(CMAKE_MODULE_EXISTS 1) +set(CMAKE_DL_LIBS "") + +set(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") +set(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ") +set(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}") +set(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}") + +set(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names") +set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names") + +if(HAVE_FLAG_SEARCH_PATHS_FIRST) + set(CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}") + set(CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}") +endif() + +set(CMAKE_PLATFORM_HAS_INSTALLNAME 1) +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") +set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") +set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,") +set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") # hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old build tree # (where install_name_tool was hardcoded) and where CMAKE_INSTALL_NAME_TOOL isn't in the cache # and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun) # hardcode CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did before, Alex -IF(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) - FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL install_name_tool) - MARK_AS_ADVANCED(CMAKE_INSTALL_NAME_TOOL) -ENDIF(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) - -# Set the assumed (Pre 10.5 or Default) location of the developer tools -SET(OSX_DEVELOPER_ROOT "/Developer") - -# Use the xcode-select tool if it's available (Xcode >= 3.0 installations) -FIND_PROGRAM(CMAKE_XCODE_SELECT xcode-select) -MARK_AS_ADVANCED(CMAKE_XCODE_SELECT) -IF(CMAKE_XCODE_SELECT) - EXECUTE_PROCESS(COMMAND ${CMAKE_XCODE_SELECT} "-print-path" - OUTPUT_VARIABLE OSX_DEVELOPER_ROOT - OUTPUT_STRIP_TRAILING_WHITESPACE) -ENDIF(CMAKE_XCODE_SELECT) - -# Find installed SDKs -# Start with Xcode-4.3+ default SDKs directory -SET(_CMAKE_OSX_SDKS_DIR - "${OSX_DEVELOPER_ROOT}/Platforms/MacOSX.platform/Developer/SDKs") -FILE(GLOB _CMAKE_OSX_SDKS "${_CMAKE_OSX_SDKS_DIR}/*") - -# If not present, try pre-4.3 SDKs directory -IF(NOT _CMAKE_OSX_SDKS) -SET(_CMAKE_OSX_SDKS_DIR "${OSX_DEVELOPER_ROOT}/SDKs") - FILE(GLOB _CMAKE_OSX_SDKS "${_CMAKE_OSX_SDKS_DIR}/*") -ENDIF(NOT _CMAKE_OSX_SDKS) - -EXECUTE_PROCESS(COMMAND sw_vers -productVersion +if(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) + find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool) + mark_as_advanced(CMAKE_INSTALL_NAME_TOOL) +endif() + +# Ask xcode-select where to find /Developer or fall back to ancient location. +execute_process(COMMAND xcode-select -print-path + OUTPUT_VARIABLE _stdout + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _stderr + RESULT_VARIABLE _failed) +if(NOT _failed AND IS_DIRECTORY ${_stdout}) + set(OSX_DEVELOPER_ROOT ${_stdout}) +elseif(IS_DIRECTORY "/Developer") + set(OSX_DEVELOPER_ROOT "/Developer") +else() + set(OSX_DEVELOPER_ROOT "") +endif() + +execute_process(COMMAND sw_vers -productVersion OUTPUT_VARIABLE CURRENT_OSX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) +# Save CMAKE_OSX_ARCHITECTURES from the environment. +set(CMAKE_OSX_ARCHITECTURES "$ENV{CMAKE_OSX_ARCHITECTURES}" CACHE STRING + "Build architectures for OSX") + #---------------------------------------------------------------------------- # _CURRENT_OSX_VERSION - as a two-component string: 10.5, 10.6, ... # -STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1" +string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1" _CURRENT_OSX_VERSION "${CURRENT_OSX_VERSION}") #---------------------------------------------------------------------------- # CMAKE_OSX_DEPLOYMENT_TARGET # Set cache variable - end user may change this during ccmake or cmake-gui configure. -IF(_CURRENT_OSX_VERSION VERSION_GREATER 10.3) - SET(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING +if(_CURRENT_OSX_VERSION VERSION_GREATER 10.3) + set(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.") -ENDIF(_CURRENT_OSX_VERSION VERSION_GREATER 10.3) +endif() #---------------------------------------------------------------------------- # CMAKE_OSX_SYSROOT -# Environment variable set by the user overrides our default. -# Use the same environment variable that Xcode uses. -SET(ENV_SDKROOT "$ENV{SDKROOT}") - -# Set CMAKE_OSX_SYSROOT_DEFAULT based on _CURRENT_OSX_VERSION, -# accounting for the known specially named SDKs. -SET(CMAKE_OSX_SYSROOT_DEFAULT - "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CURRENT_OSX_VERSION}.sdk") - -IF(_CURRENT_OSX_VERSION STREQUAL "10.4") - SET(CMAKE_OSX_SYSROOT_DEFAULT - "${_CMAKE_OSX_SDKS_DIR}/MacOSX10.4u.sdk") -ENDIF(_CURRENT_OSX_VERSION STREQUAL "10.4") - -IF(_CURRENT_OSX_VERSION STREQUAL "10.3") - SET(CMAKE_OSX_SYSROOT_DEFAULT - "${_CMAKE_OSX_SDKS_DIR}/MacOSX10.3.9.sdk") -ENDIF(_CURRENT_OSX_VERSION STREQUAL "10.3") +if(CMAKE_OSX_SYSROOT) + # Use the existing value without further computation to choose a default. + set(_CMAKE_OSX_SYSROOT_DEFAULT "${CMAKE_OSX_SYSROOT}") +elseif(NOT "x$ENV{SDKROOT}" STREQUAL "x" AND + (NOT "x$ENV{SDKROOT}" MATCHES "/" OR IS_DIRECTORY "$ENV{SDKROOT}")) + # Use the value of SDKROOT from the environment. + set(_CMAKE_OSX_SYSROOT_DEFAULT "$ENV{SDKROOT}") +elseif("${CMAKE_GENERATOR}" MATCHES Xcode + OR CMAKE_OSX_DEPLOYMENT_TARGET + OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]" + OR NOT EXISTS "/usr/include/sys/types.h") + # Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs directory. + set(_CMAKE_OSX_SDKS_DIR "") + if(OSX_DEVELOPER_ROOT) + foreach(d Platforms/MacOSX.platform/Developer/SDKs SDKs) + file(GLOB _CMAKE_OSX_SDKS ${OSX_DEVELOPER_ROOT}/${d}/*) + if(_CMAKE_OSX_SDKS) + set(_CMAKE_OSX_SDKS_DIR ${OSX_DEVELOPER_ROOT}/${d}) + break() + endif() + endforeach() + endif() -# Use environment or default as initial cache value: -IF(NOT ENV_SDKROOT STREQUAL "") - SET(CMAKE_OSX_SYSROOT_VALUE ${ENV_SDKROOT}) -ELSE(NOT ENV_SDKROOT STREQUAL "") - SET(CMAKE_OSX_SYSROOT_VALUE ${CMAKE_OSX_SYSROOT_DEFAULT}) -ENDIF(NOT ENV_SDKROOT STREQUAL "") + if(_CMAKE_OSX_SDKS_DIR) + # Select SDK for current OSX version accounting for the known + # specially named SDKs. + set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.4 "u") + set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.3 ".9") + set(_CMAKE_OSX_SDKS_VER ${_CURRENT_OSX_VERSION}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CURRENT_OSX_VERSION}}) + set(_CMAKE_OSX_SYSROOT_DEFAULT + "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk") + else() + # Assume developer files are in root (such as Xcode 4.5 command-line tools). + set(_CMAKE_OSX_SYSROOT_DEFAULT "") + endif() +endif() # Set cache variable - end user may change this during ccmake or cmake-gui configure. -SET(CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT_VALUE} CACHE PATH +# Choose the type based on the current value. +set(_CMAKE_OSX_SYSROOT_TYPE STRING) +foreach(v CMAKE_OSX_SYSROOT _CMAKE_OSX_SYSROOT_DEFAULT) + if("x${${v}}" MATCHES "/") + set(_CMAKE_OSX_SYSROOT_TYPE PATH) + break() + endif() +endforeach() +set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_DEFAULT}" CACHE ${_CMAKE_OSX_SYSROOT_TYPE} "The product will be built against the headers and libraries located inside the indicated SDK.") -#---------------------------------------------------------------------------- -function(SanityCheckSDKAndDeployTarget _sdk_path _deploy) - if(_deploy STREQUAL "") - return() +# Transform the cached value to something we can use. +set(_CMAKE_OSX_SYSROOT_ORIG "${CMAKE_OSX_SYSROOT}") +set(_CMAKE_OSX_SYSROOT_PATH "") +if(CMAKE_OSX_SYSROOT) + if("x${CMAKE_OSX_SYSROOT}" MATCHES "/") + # This is a path to the SDK. Make sure it exists. + if(NOT IS_DIRECTORY "${CMAKE_OSX_SYSROOT}") + message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n" + "because the directory does not exist.") + set(CMAKE_OSX_SYSROOT "") + set(_CMAKE_OSX_SYSROOT_ORIG "") + endif() + set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}") + else() + # Transform the sdk name into a path. + execute_process( + COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path + OUTPUT_VARIABLE _stdout + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _stderr + RESULT_VARIABLE _failed + ) + if(NOT _failed AND IS_DIRECTORY "${_stdout}") + set(_CMAKE_OSX_SYSROOT_PATH "${_stdout}") + # For non-Xcode generators use the path. + if(NOT "${CMAKE_GENERATOR}" MATCHES "Xcode") + set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}") + endif() + endif() endif() +endif() - if(_sdk_path STREQUAL "") - message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET='${_deploy}' but CMAKE_OSX_SYSROOT is empty... - either set CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to empty") +# Make sure the combination of SDK and Deployment Target are allowed +if(CMAKE_OSX_DEPLOYMENT_TARGET) + if("${_CMAKE_OSX_SYSROOT_PATH}" MATCHES "^.*/MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk") + set(_sdk_ver "${CMAKE_MATCH_1}") + elseif("${_CMAKE_OSX_SYSROOT_ORIG}" MATCHES "^macosx([0-9]+\\.[0-9]+)$") + set(_sdk_ver "${CMAKE_MATCH_1}") + else() + message(FATAL_ERROR + "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' " + "but CMAKE_OSX_SYSROOT:\n \"${_CMAKE_OSX_SYSROOT_ORIG}\"\n" + "is not set to a MacOSX SDK with a recognized version. " + "Either set CMAKE_OSX_SYSROOT to a valid SDK or set " + "CMAKE_OSX_DEPLOYMENT_TARGET to empty.") endif() - - string(REGEX REPLACE "(.*MacOSX*)(....)(.*\\.sdk)" "\\2" SDK "${_sdk_path}") - if(_deploy GREATER "${SDK}") - message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET (${_deploy}) is greater than CMAKE_OSX_SYSROOT SDK (${_sdk_path}). Please set CMAKE_OSX_DEPLOYMENT_TARGET to ${SDK} or lower") + if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER "${_sdk_ver}") + message(FATAL_ERROR + "CMAKE_OSX_DEPLOYMENT_TARGET (${CMAKE_OSX_DEPLOYMENT_TARGET}) " + "is greater than CMAKE_OSX_SYSROOT SDK:\n ${_CMAKE_OSX_SYSROOT_ORIG}\n" + "Please set CMAKE_OSX_DEPLOYMENT_TARGET to ${_sdk_ver} or lower.") endif() -endfunction(SanityCheckSDKAndDeployTarget) -#---------------------------------------------------------------------------- - -# Make sure the combination of SDK and Deployment Target are allowed -SanityCheckSDKAndDeployTarget("${CMAKE_OSX_SYSROOT}" "${CMAKE_OSX_DEPLOYMENT_TARGET}") - -# set _CMAKE_OSX_MACHINE to uname -m -EXECUTE_PROCESS(COMMAND uname -m - OUTPUT_STRIP_TRAILING_WHITESPACE - OUTPUT_VARIABLE _CMAKE_OSX_MACHINE) - -# check for Power PC and change to ppc -IF(_CMAKE_OSX_MACHINE MATCHES "Power") - SET(_CMAKE_OSX_MACHINE ppc) -ENDIF(_CMAKE_OSX_MACHINE MATCHES "Power") - -# check for environment variable CMAKE_OSX_ARCHITECTURES -# if it is set. -IF(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "") - SET(CMAKE_OSX_ARCHITECTURES_VALUE "$ENV{CMAKE_OSX_ARCHITECTURES}") -ELSE(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "") - SET(CMAKE_OSX_ARCHITECTURES_VALUE "") -ENDIF(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "") - -# now put _CMAKE_OSX_MACHINE into the cache -SET(CMAKE_OSX_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES_VALUE} CACHE STRING - "Build architectures for OSX") +endif() - -IF("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$") - SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS +if("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$") + set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress") -ENDIF("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$") +endif() -IF(NOT XCODE) +if(NOT XCODE) # Enable shared library versioning. This flag is not actually referenced # but the fact that the setting exists will cause the generators to support # soname computation. - SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") -ENDIF(NOT XCODE) + set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") +endif() # Xcode does not support -isystem yet. -IF(XCODE) - SET(CMAKE_INCLUDE_SYSTEM_FLAG_C) - SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) -ENDIF(XCODE) +if(XCODE) + set(CMAKE_INCLUDE_SYSTEM_FLAG_C) + set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) +endif() -IF("${_CURRENT_OSX_VERSION}" VERSION_LESS "10.5") +if("${_CURRENT_OSX_VERSION}" VERSION_LESS "10.5") # Need to list dependent shared libraries on link line. When building # with -isysroot (for universal binaries), the linker always looks for # dependent libraries under the sysroot. Listing them on the link # line works around the problem. - SET(CMAKE_LINK_DEPENDENT_LIBRARY_FILES 1) -ENDIF() + set(CMAKE_LINK_DEPENDENT_LIBRARY_FILES 1) +endif() -SET(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w) -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w) -SET(CMAKE_C_CREATE_SHARED_LIBRARY +set(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w) +set(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w) +set(CMAKE_C_CREATE_SHARED_LIBRARY " -o ") -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY +set(CMAKE_CXX_CREATE_SHARED_LIBRARY " -o ") -SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY +set(CMAKE_Fortran_CREATE_SHARED_LIBRARY " -o ") -SET(CMAKE_CXX_CREATE_SHARED_MODULE +set(CMAKE_CXX_CREATE_SHARED_MODULE " -o ") -SET(CMAKE_C_CREATE_SHARED_MODULE +set(CMAKE_C_CREATE_SHARED_MODULE " -o ") -SET(CMAKE_Fortran_CREATE_SHARED_MODULE +set(CMAKE_Fortran_CREATE_SHARED_MODULE " -o ") -SET(CMAKE_C_CREATE_MACOSX_FRAMEWORK +set(CMAKE_C_CREATE_MACOSX_FRAMEWORK " -o ") -SET(CMAKE_CXX_CREATE_MACOSX_FRAMEWORK +set(CMAKE_CXX_CREATE_MACOSX_FRAMEWORK " -o ") # default to searching for frameworks first -IF(NOT DEFINED CMAKE_FIND_FRAMEWORK) - SET(CMAKE_FIND_FRAMEWORK FIRST) -ENDIF() +if(NOT DEFINED CMAKE_FIND_FRAMEWORK) + set(CMAKE_FIND_FRAMEWORK FIRST) +endif() + +# Older OS X linkers do not report their framework search path +# with -v but "man ld" documents the following locations. +set(CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + ${_CMAKE_OSX_SYSROOT_PATH}/Library/Frameworks + ${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks + ) +if(_CMAKE_OSX_SYSROOT_PATH) + # Treat some paths as implicit so we do not override the SDK versions. + list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + /System/Library/Frameworks) +endif() +if("${_CURRENT_OSX_VERSION}" VERSION_LESS "10.5") + # Older OS X tools had more implicit paths. + list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + ${_CMAKE_OSX_SYSROOT_PATH}/Network/Library/Frameworks) +endif() + # set up the default search directories for frameworks -SET(CMAKE_SYSTEM_FRAMEWORK_PATH +set(CMAKE_SYSTEM_FRAMEWORK_PATH ~/Library/Frameworks /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks) +# Warn about known system mis-configuration case. +if(CMAKE_OSX_SYSROOT) + get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE) + if(NOT _IN_TC AND + NOT IS_SYMLINK "${CMAKE_OSX_SYSROOT}/Library/Frameworks" + AND IS_SYMLINK "${CMAKE_OSX_SYSROOT}/Library/Frameworks/Frameworks") + message(WARNING "The SDK Library/Frameworks path\n" + " ${CMAKE_OSX_SYSROOT}/Library/Frameworks\n" + "is not set up correctly on this system. " + "This is known to occur when installing Xcode 3.2.6:\n" + " http://bugs.python.org/issue14018\n" + "The problem may cause build errors that report missing system frameworks. " + "Fix your SDK symlinks to resolve this issue and avoid this warning." + ) + endif() +endif() + # default to searching for application bundles first -IF(NOT DEFINED CMAKE_FIND_APPBUNDLE) - SET(CMAKE_FIND_APPBUNDLE FIRST) -ENDIF() +if(NOT DEFINED CMAKE_FIND_APPBUNDLE) + set(CMAKE_FIND_APPBUNDLE FIRST) +endif() # set up the default search directories for application bundles -SET(_apps_paths) -FOREACH(_path +set(_apps_paths) +foreach(_path "~/Applications" "/Applications" "${OSX_DEVELOPER_ROOT}/../Applications" # Xcode 4.3+ "${OSX_DEVELOPER_ROOT}/Applications" # pre-4.3 ) - GET_FILENAME_COMPONENT(_apps "${_path}" ABSOLUTE) - IF(EXISTS "${_apps}") - LIST(APPEND _apps_paths "${_apps}") - ENDIF() -ENDFOREACH() -LIST(REMOVE_DUPLICATES _apps_paths) -SET(CMAKE_SYSTEM_APPBUNDLE_PATH + get_filename_component(_apps "${_path}" ABSOLUTE) + if(EXISTS "${_apps}") + list(APPEND _apps_paths "${_apps}") + endif() +endforeach() +list(REMOVE_DUPLICATES _apps_paths) +set(CMAKE_SYSTEM_APPBUNDLE_PATH ${_apps_paths}) -UNSET(_apps_paths) +unset(_apps_paths) -INCLUDE(Platform/UnixPaths) -LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH +include(Platform/UnixPaths) +list(APPEND CMAKE_SYSTEM_PREFIX_PATH /sw # Fink /opt/local # MacPorts ) diff --git a/Modules/Platform/DragonFly.cmake b/Modules/Platform/DragonFly.cmake index f6e0f810f..c22677b9d 100644 --- a/Modules/Platform/DragonFly.cmake +++ b/Modules/Platform/DragonFly.cmake @@ -2,4 +2,4 @@ # http://www.dragonflybsd.org # see http://archive.netbsd.se/?ml=dfbsd-users&a=2007-07&m=4678361 -INCLUDE(Platform/FreeBSD) +include(Platform/FreeBSD) diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake index 82fe961fb..ce4d3ce49 100644 --- a/Modules/Platform/FreeBSD.cmake +++ b/Modules/Platform/FreeBSD.cmake @@ -1,28 +1,26 @@ -IF(EXISTS /usr/include/dlfcn.h) - SET(CMAKE_DL_LIBS "") - SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") - SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") - SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic - SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared - SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty - SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") - SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") - SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -ENDIF(EXISTS /usr/include/dlfcn.h) +set(CMAKE_DL_LIBS "") +set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") +set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") # Shared libraries with no builtin soname may not be linked safely by # specifying the file path. -SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) +set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) # Initialize C link type selection flags. These flags are used when # building a shared library, shared module, or executable that links # to other libraries to select whether to use the static or shared # versions of the libraries. -FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") -ENDFOREACH(type) +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +endforeach() -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) diff --git a/Modules/Platform/GNU.cmake b/Modules/Platform/GNU.cmake index 4bcfd51ce..e8c3b657b 100644 --- a/Modules/Platform/GNU.cmake +++ b/Modules/Platform/GNU.cmake @@ -1,13 +1,13 @@ # GCC is the default compiler on GNU/Hurd. -SET(CMAKE_DL_LIBS "dl") -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") -SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") -SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") +set(CMAKE_DL_LIBS "dl") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -SET(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-gnu[a-z0-9_]*") +set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-gnu[a-z0-9_]*") -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) diff --git a/Modules/Platform/Generic-ADSP-ASM.cmake b/Modules/Platform/Generic-ADSP-ASM.cmake index cec4c2f68..63a1388ce 100644 --- a/Modules/Platform/Generic-ADSP-ASM.cmake +++ b/Modules/Platform/Generic-ADSP-ASM.cmake @@ -1,7 +1,7 @@ -INCLUDE(Platform/Generic-ADSP-Common) +include(Platform/Generic-ADSP-Common) -SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm) -SET(CMAKE_ASM_OUTPUT_EXTENSION ".doj" ) -SET(CMAKE_ASM_COMPILE_OBJECT +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm) +set(CMAKE_ASM_OUTPUT_EXTENSION ".doj" ) +set(CMAKE_ASM_COMPILE_OBJECT " -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o ") diff --git a/Modules/Platform/Generic-ADSP-C.cmake b/Modules/Platform/Generic-ADSP-C.cmake index f0644687f..4b9ed9d07 100644 --- a/Modules/Platform/Generic-ADSP-C.cmake +++ b/Modules/Platform/Generic-ADSP-C.cmake @@ -1,20 +1,20 @@ -INCLUDE(Platform/Generic-ADSP-Common) +include(Platform/Generic-ADSP-Common) -SET(CMAKE_C_OUTPUT_EXTENSION ".doj") +set(CMAKE_C_OUTPUT_EXTENSION ".doj") -SET(CMAKE_C_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "") -SET(CMAKE_C_FLAGS_RELEASE_INIT "") -SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "") +set(CMAKE_C_FLAGS_DEBUG_INIT "-g") +set(CMAKE_C_FLAGS_MINSIZEREL_INIT "") +set(CMAKE_C_FLAGS_RELEASE_INIT "") +set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "") -SET(CMAKE_C_CREATE_STATIC_LIBRARY +set(CMAKE_C_CREATE_STATIC_LIBRARY " -build-lib -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o ") -SET(CMAKE_C_LINK_EXECUTABLE +set(CMAKE_C_LINK_EXECUTABLE " -o ") -SET(CMAKE_C_CREATE_SHARED_LIBRARY) -SET(CMAKE_C_CREATE_MODULE_LIBRARY) +set(CMAKE_C_CREATE_SHARED_LIBRARY) +set(CMAKE_C_CREATE_MODULE_LIBRARY) diff --git a/Modules/Platform/Generic-ADSP-CXX.cmake b/Modules/Platform/Generic-ADSP-CXX.cmake index 21daa81c9..9673aef40 100644 --- a/Modules/Platform/Generic-ADSP-CXX.cmake +++ b/Modules/Platform/Generic-ADSP-CXX.cmake @@ -1,18 +1,18 @@ -INCLUDE(Platform/Generic-ADSP-Common) +include(Platform/Generic-ADSP-Common) -SET(CMAKE_CXX_OUTPUT_EXTENSION ".doj") +set(CMAKE_CXX_OUTPUT_EXTENSION ".doj") -SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") -SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "") -SET(CMAKE_CXX_FLAGS_RELEASE_INIT "") -SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "") +set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") +set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "") +set(CMAKE_CXX_FLAGS_RELEASE_INIT "") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "") -SET(CMAKE_CXX_CREATE_STATIC_LIBRARY +set(CMAKE_CXX_CREATE_STATIC_LIBRARY " -build-lib -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o ") -SET(CMAKE_CXX_LINK_EXECUTABLE +set(CMAKE_CXX_LINK_EXECUTABLE " -o ") -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY) -SET(CMAKE_CXX_CREATE_MODULE_LIBRARY) +set(CMAKE_CXX_CREATE_SHARED_LIBRARY) +set(CMAKE_CXX_CREATE_MODULE_LIBRARY) diff --git a/Modules/Platform/Generic-ADSP-Common.cmake b/Modules/Platform/Generic-ADSP-Common.cmake index 10fb34e00..026f83c48 100644 --- a/Modules/Platform/Generic-ADSP-Common.cmake +++ b/Modules/Platform/Generic-ADSP-Common.cmake @@ -6,115 +6,115 @@ # TS (TigerShark) # 21k (Sharc 21xxx) -IF(NOT ADSP) +if(NOT ADSP) - SET(ADSP TRUE) + set(ADSP TRUE) - SET(CMAKE_STATIC_LIBRARY_SUFFIX ".dlb") - SET(CMAKE_SHARED_LIBRARY_SUFFIX "") - SET(CMAKE_EXECUTABLE_SUFFIX ".dxe") + set(CMAKE_STATIC_LIBRARY_SUFFIX ".dlb") + set(CMAKE_SHARED_LIBRARY_SUFFIX "") + set(CMAKE_EXECUTABLE_SUFFIX ".dxe") - # if ADSP_PROCESSOR has not been set, but CMAKE_SYSTEM_PROCESSOR has, + # if ADSP_PROCESSOR has not been set, but CMAKE_SYSTEM_PROCESSOR has, # assume that this is the processor name to use for the compiler - IF(CMAKE_SYSTEM_PROCESSOR AND NOT ADSP_PROCESSOR) - SET(ADSP_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}) - ENDIF(CMAKE_SYSTEM_PROCESSOR AND NOT ADSP_PROCESSOR) + if(CMAKE_SYSTEM_PROCESSOR AND NOT ADSP_PROCESSOR) + set(ADSP_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}) + endif() # if ADSP_PROCESSOR_SILICIUM_REVISION has not been set, use "none" - IF(NOT ADSP_PROCESSOR_SILICIUM_REVISION) - SET(ADSP_PROCESSOR_SILICIUM_REVISION "none") - ENDIF(NOT ADSP_PROCESSOR_SILICIUM_REVISION) + if(NOT ADSP_PROCESSOR_SILICIUM_REVISION) + set(ADSP_PROCESSOR_SILICIUM_REVISION "none") + endif() # this file is included from the C and CXX files, so handle both here - GET_FILENAME_COMPONENT(_ADSP_DIR "${CMAKE_C_COMPILER}" PATH) - IF(NOT _ADSP_DIR) - GET_FILENAME_COMPONENT(_ADSP_DIR "${CMAKE_CXX_COMPILER}" PATH) - ENDIF(NOT _ADSP_DIR) - IF(NOT _ADSP_DIR) - GET_FILENAME_COMPONENT(_ADSP_DIR "${CMAKE_ASM_COMPILER}" PATH) - ENDIF(NOT _ADSP_DIR) + get_filename_component(_ADSP_DIR "${CMAKE_C_COMPILER}" PATH) + if(NOT _ADSP_DIR) + get_filename_component(_ADSP_DIR "${CMAKE_CXX_COMPILER}" PATH) + endif() + if(NOT _ADSP_DIR) + get_filename_component(_ADSP_DIR "${CMAKE_ASM_COMPILER}" PATH) + endif() # detect architecture - IF(CMAKE_C_COMPILER MATCHES ccblkfn OR CMAKE_CXX_COMPILER MATCHES ccblkfn OR CMAKE_ASM_COMPILER MATCHES easmBLKFN) - IF(NOT ADSP_PROCESSOR) - SET(ADSP_PROCESSOR "ADSP-BF561") - ENDIF(NOT ADSP_PROCESSOR) - SET(ADSP_BLACKFIN TRUE) - SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/Blackfin") - ENDIF(CMAKE_C_COMPILER MATCHES ccblkfn OR CMAKE_CXX_COMPILER MATCHES ccblkfn OR CMAKE_ASM_COMPILER MATCHES easmBLKFN) + if(CMAKE_C_COMPILER MATCHES ccblkfn OR CMAKE_CXX_COMPILER MATCHES ccblkfn OR CMAKE_ASM_COMPILER MATCHES easmBLKFN) + if(NOT ADSP_PROCESSOR) + set(ADSP_PROCESSOR "ADSP-BF561") + endif() + set(ADSP_BLACKFIN TRUE) + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/Blackfin") + endif() - IF(CMAKE_C_COMPILER MATCHES ccts OR CMAKE_CXX_COMPILER MATCHES ccts OR CMAKE_ASM_COMPILER MATCHES easmTS) - IF(NOT ADSP_PROCESSOR) - SET(ADSP_PROCESSOR "ADSP-TS101") - ENDIF(NOT ADSP_PROCESSOR) - SET(ADSP_TS TRUE) - SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/TS") - ENDIF(CMAKE_C_COMPILER MATCHES ccts OR CMAKE_CXX_COMPILER MATCHES ccts OR CMAKE_ASM_COMPILER MATCHES easmTS) + if(CMAKE_C_COMPILER MATCHES ccts OR CMAKE_CXX_COMPILER MATCHES ccts OR CMAKE_ASM_COMPILER MATCHES easmTS) + if(NOT ADSP_PROCESSOR) + set(ADSP_PROCESSOR "ADSP-TS101") + endif() + set(ADSP_TS TRUE) + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/TS") + endif() - IF(CMAKE_C_COMPILER MATCHES cc21k OR CMAKE_CXX_COMPILER MATCHES cc21k OR CMAKE_ASM_COMPILER MATCHES easm21k) - IF(NOT ADSP_PROCESSOR) - SET(ADSP_PROCESSOR "ADSP-21060") - ENDIF(NOT ADSP_PROCESSOR) - SET(ADSP_21K TRUE) + if(CMAKE_C_COMPILER MATCHES cc21k OR CMAKE_CXX_COMPILER MATCHES cc21k OR CMAKE_ASM_COMPILER MATCHES easm21k) + if(NOT ADSP_PROCESSOR) + set(ADSP_PROCESSOR "ADSP-21060") + endif() + set(ADSP_21K TRUE) - SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") # default if nothing matches - IF (ADSP_PROCESSOR MATCHES "210..$") - SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") - ENDIF(ADSP_PROCESSOR MATCHES "210..$") + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") # default if nothing matches + if (ADSP_PROCESSOR MATCHES "210..$") + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") + endif() - IF (ADSP_PROCESSOR MATCHES "211..$") - SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/211k") - ENDIF(ADSP_PROCESSOR MATCHES "211..$") + if (ADSP_PROCESSOR MATCHES "211..$") + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/211k") + endif() - IF (ADSP_PROCESSOR MATCHES "212..$") - SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/212k") - ENDIF(ADSP_PROCESSOR MATCHES "212..$") + if (ADSP_PROCESSOR MATCHES "212..$") + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/212k") + endif() - IF (ADSP_PROCESSOR MATCHES "213..$") - SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/213k") - ENDIF(ADSP_PROCESSOR MATCHES "213..$") + if (ADSP_PROCESSOR MATCHES "213..$") + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/213k") + endif() - SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") - ENDIF(CMAKE_C_COMPILER MATCHES cc21k OR CMAKE_CXX_COMPILER MATCHES cc21k OR CMAKE_ASM_COMPILER MATCHES easm21k) + set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") + endif() - LINK_DIRECTORIES("${_ADSP_FAMILY_DIR}/lib") + link_directories("${_ADSP_FAMILY_DIR}/lib") # vdk support - FIND_PROGRAM( ADSP_VDKGEN_EXECUTABLE vdkgen "${_ADSP_FAMILY_DIR}/vdk" ) + find_program( ADSP_VDKGEN_EXECUTABLE vdkgen "${_ADSP_FAMILY_DIR}/vdk" ) - MACRO(ADSP_GENERATE_VDK VDK_GENERATED_HEADER VDK_GENERATED_SOURCE VDK_KERNEL_SUPPORT_FILE) - ADD_CUSTOM_COMMAND( + macro(ADSP_GENERATE_VDK VDK_GENERATED_HEADER VDK_GENERATED_SOURCE VDK_KERNEL_SUPPORT_FILE) + add_custom_command( OUTPUT ${VDK_GENERATED_HEADER} ${VDK_GENERATED_SOURCE} COMMAND ${ADSP_VDKGEN_EXECUTABLE} ${VDK_KERNEL_SUPPORT_FILE} -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -MM DEPENDS ${VDK_KERNEL_SUPPORT_FILE} ) - ENDMACRO(ADSP_GENERATE_VDK VDK_GENERATED_HEADER VDK_GENERATED_SOURCE VDK_KERNEL_SUPPORT_FILE) + endmacro() # loader support - FIND_PROGRAM( ADSP_ELFLOADER_EXECUTABLE elfloader "${_ADSP_FAMILY_DIR}" ) + find_program( ADSP_ELFLOADER_EXECUTABLE elfloader "${_ADSP_FAMILY_DIR}" ) # BOOT_MODE: prom, flash, spi, spislave, UART, TWI, FIFO # FORMAT: hex, ASCII, binary, include # WIDTH: 8, 16 - MACRO(ADSP_CREATE_LOADER_FILE TARGET_NAME BOOT_MODE FORMAT WIDTH) - ADD_CUSTOM_COMMAND( + macro(ADSP_CREATE_LOADER_FILE TARGET_NAME BOOT_MODE FORMAT WIDTH) + add_custom_command( TARGET ${TARGET_NAME} POST_BUILD COMMAND ${ADSP_ELFLOADER_EXECUTABLE} ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.dxe -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -b ${BOOT_MODE} -f ${FORMAT} -width ${WIDTH} -o ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.ldr COMMENT "Building the loader file" ) - ENDMACRO(ADSP_CREATE_LOADER_FILE TARGET_NAME BOOT_MODE FORMAT WIDTH) + endmacro() - MACRO(ADSP_CREATE_LOADER_FILE_INIT TARGET_NAME BOOT_MODE FORMAT WIDTH INITIALIZATION_FILE) - ADD_CUSTOM_COMMAND( + macro(ADSP_CREATE_LOADER_FILE_INIT TARGET_NAME BOOT_MODE FORMAT WIDTH INITIALIZATION_FILE) + add_custom_command( TARGET ${TARGET_NAME} POST_BUILD COMMAND ${ADSP_ELFLOADER_EXECUTABLE} ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.dxe -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -b ${BOOT_MODE} -f ${FORMAT} -width ${WIDTH} -o ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.ldr -init ${INITIALIZATION_FILE} COMMENT "Building the loader file" ) - ENDMACRO(ADSP_CREATE_LOADER_FILE_INIT TARGET_NAME BOOT_MODE FORMAT WIDTH INITIALIZATION_FILE) + endmacro() -ENDIF(NOT ADSP) +endif() diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake index ac81c3560..588bf32d9 100644 --- a/Modules/Platform/Generic-SDCC-C.cmake +++ b/Modules/Platform/Generic-SDCC-C.cmake @@ -4,51 +4,51 @@ # To use it either a toolchain file is required or cmake has to be run like this: # cmake -DCMAKE_C_COMPILER=sdcc -DCMAKE_SYSTEM_NAME=Generic # Since sdcc doesn't support C++, C++ support should be disabled in the -# CMakeLists.txt using the PROJECT() command: -# PROJECT(my_project C) +# CMakeLists.txt using the project() command: +# project(my_project C) -SET(CMAKE_STATIC_LIBRARY_PREFIX "") -SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") -SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".lib") # .so -SET(CMAKE_IMPORT_LIBRARY_PREFIX ) -SET(CMAKE_IMPORT_LIBRARY_SUFFIX ) -SET(CMAKE_EXECUTABLE_SUFFIX ".ihx") # intel hex file -SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib") -SET(CMAKE_DL_LIBS "") +set(CMAKE_STATIC_LIBRARY_PREFIX "") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +set(CMAKE_SHARED_LIBRARY_PREFIX "") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".lib") # .so +set(CMAKE_IMPORT_LIBRARY_PREFIX ) +set(CMAKE_IMPORT_LIBRARY_SUFFIX ) +set(CMAKE_EXECUTABLE_SUFFIX ".ihx") # intel hex file +set(CMAKE_LINK_LIBRARY_SUFFIX ".lib") +set(CMAKE_DL_LIBS "") -SET(CMAKE_C_OUTPUT_EXTENSION ".rel") +set(CMAKE_C_OUTPUT_EXTENSION ".rel") # find sdcclib as CMAKE_AR -# since cmake may already have searched for "ar", sdcclib has to -# be searched with a different variable name (SDCCLIB_EXECUTABLE) +# since cmake may already have searched for "ar", sdcclib has to +# be searched with a different variable name (SDCCLIB_EXECUTABLE) # and must then be forced into the cache -GET_FILENAME_COMPONENT(SDCC_LOCATION "${CMAKE_C_COMPILER}" PATH) -FIND_PROGRAM(SDCCLIB_EXECUTABLE sdcclib PATHS "${SDCC_LOCATION}" NO_DEFAULT_PATH) -FIND_PROGRAM(SDCCLIB_EXECUTABLE sdcclib) -SET(CMAKE_AR "${SDCCLIB_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE) +get_filename_component(SDCC_LOCATION "${CMAKE_C_COMPILER}" PATH) +find_program(SDCCLIB_EXECUTABLE sdcclib PATHS "${SDCC_LOCATION}" NO_DEFAULT_PATH) +find_program(SDCCLIB_EXECUTABLE sdcclib) +set(CMAKE_AR "${SDCCLIB_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE) # CMAKE_C_FLAGS_INIT and CMAKE_EXE_LINKER_FLAGS_INIT should be set in a CMAKE_SYSTEM_PROCESSOR file -IF(NOT DEFINED CMAKE_C_FLAGS_INIT) - SET(CMAKE_C_FLAGS_INIT "-mmcs51 --model-small") -ENDIF(NOT DEFINED CMAKE_C_FLAGS_INIT) +if(NOT DEFINED CMAKE_C_FLAGS_INIT) + set(CMAKE_C_FLAGS_INIT "-mmcs51 --model-small") +endif() -IF(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT) - SET (CMAKE_EXE_LINKER_FLAGS_INIT --model-small) -ENDIF(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT) +if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT) + set (CMAKE_EXE_LINKER_FLAGS_INIT --model-small) +endif() # compile a C file into an object file -SET(CMAKE_C_COMPILE_OBJECT " -o -c ") +set(CMAKE_C_COMPILE_OBJECT " -o -c ") # link object files to an executable -SET(CMAKE_C_LINK_EXECUTABLE " --out-fmt-ihx -o ") +set(CMAKE_C_LINK_EXECUTABLE " --out-fmt-ihx -o ") # needs sdcc 2.7.0 + sddclib from cvs -SET(CMAKE_C_CREATE_STATIC_LIBRARY +set(CMAKE_C_CREATE_STATIC_LIBRARY "\"${CMAKE_COMMAND}\" -E remove " " -a ") # not supported by sdcc -SET(CMAKE_C_CREATE_SHARED_LIBRARY "") -SET(CMAKE_C_CREATE_MODULE_LIBRARY "") +set(CMAKE_C_CREATE_SHARED_LIBRARY "") +set(CMAKE_C_CREATE_MODULE_LIBRARY "") diff --git a/Modules/Platform/Generic.cmake b/Modules/Platform/Generic.cmake index a4e2ec6c1..fcb2699d6 100644 --- a/Modules/Platform/Generic.cmake +++ b/Modules/Platform/Generic.cmake @@ -2,16 +2,16 @@ # operating system, typically embedded platforms. # It is used when CMAKE_SYSTEM_NAME is set to "Generic" # -# It is intentionally empty, since nothing is known +# It is intentionally empty, since nothing is known # about the platform. So everything has to be specified # in the system/compiler files ${CMAKE_SYSTEM_NAME}-.cmake # and/or ${CMAKE_SYSTEM_NAME}--${CMAKE_SYSTEM_PROCESSOR}.cmake # (embedded) targets without operating system usually don't support shared libraries -SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) # To help the find_xxx() commands, set at least the following so CMAKE_FIND_ROOT_PATH # works at least for some simple cases: -SET(CMAKE_SYSTEM_INCLUDE_PATH /include ) -SET(CMAKE_SYSTEM_LIBRARY_PATH /lib ) -SET(CMAKE_SYSTEM_PROGRAM_PATH /bin ) +set(CMAKE_SYSTEM_INCLUDE_PATH /include ) +set(CMAKE_SYSTEM_LIBRARY_PATH /lib ) +set(CMAKE_SYSTEM_PROGRAM_PATH /bin ) diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake index ab3dc2266..65cc7310d 100644 --- a/Modules/Platform/HP-UX.cmake +++ b/Modules/Platform/HP-UX.cmake @@ -1,22 +1,22 @@ -SET(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib) +set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib) -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so -SET(CMAKE_DL_LIBS "dld") -SET(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a") -SET(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".so") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so +set(CMAKE_DL_LIBS "dld") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a") +set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".so") # The HP linker needs to find transitive shared library dependencies # in the -L path. Therefore the runtime path must be added to the # link line with -L flags. -SET(CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH 1) -SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) +set(CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH 1) +set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) # Shared libraries with no builtin soname may not be linked safely by # specifying the file path. -SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) +set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) # set flags for gcc support -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) # Look in both 32-bit and 64-bit implict link directories, but tell # CMake not to pass the paths to the linker. The linker will find the @@ -25,9 +25,9 @@ INCLUDE(Platform/UnixPaths) # CMAKE_SIZEOF_VOID_P is not set until after this file executes, we # would need to append to CMAKE_SYSTEM_LIBRARY_PATH at a later point # (after CMakeTest(LANG)Compiler.cmake runs for at least one language). -LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux32) -LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux64) -LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES +list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux32) +list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux64) +list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /usr/lib/hpux32 /usr/lib/hpux64) # Initialize C and CXX link type selection flags. These flags are @@ -35,16 +35,16 @@ LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES # that links to other libraries to select whether to use the static or # shared versions of the libraries. Note that C modules and shared # libs are built using ld directly so we leave off the "-Wl," portion. -FOREACH(type SHARED_LIBRARY SHARED_MODULE) - SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-a archive") - SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-a default") -ENDFOREACH(type) -FOREACH(type EXE) - SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive") - SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default") -ENDFOREACH(type) -FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-a,archive") - SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-a,default") -ENDFOREACH(type) +foreach(type SHARED_LIBRARY SHARED_MODULE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-a archive") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-a default") +endforeach() +foreach(type EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default") +endforeach() +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-a,archive") + set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-a,default") +endforeach() diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake index 9dda3c528..8987783ff 100644 --- a/Modules/Platform/Haiku.cmake +++ b/Modules/Platform/Haiku.cmake @@ -1,24 +1,24 @@ -SET(BEOS 1) +set(BEOS 1) -SET(CMAKE_DL_LIBS root be) -SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") -SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") -SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_DL_LIBS root be) +set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") +set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -INCLUDE(Platform/UnixPaths) -LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH /boot/common) -LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/common/include) -LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/common/lib) -LIST(APPEND CMAKE_SYSTEM_PROGRAM_PATH /boot/common/bin) -LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /boot/common/lib) -LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/develop/headers/3rdparty) -LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/develop/lib/x86) +include(Platform/UnixPaths) +list(APPEND CMAKE_SYSTEM_PREFIX_PATH /boot/common) +list(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/common/include) +list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/common/lib) +list(APPEND CMAKE_SYSTEM_PROGRAM_PATH /boot/common/bin) +list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /boot/common/lib) +list(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/develop/headers/3rdparty) +list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/develop/lib/x86) -IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - SET(CMAKE_INSTALL_PREFIX "/boot/common" CACHE PATH +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "/boot/common" CACHE PATH "Install path prefix, prepended onto install directories." FORCE) -ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) +endif() diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake index fac941f3b..03e98ccfd 100644 --- a/Modules/Platform/IRIX.cmake +++ b/Modules/Platform/IRIX.cmake @@ -1,45 +1,45 @@ -SET(CMAKE_DL_LIBS "") -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty -IF(NOT CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_CXX_CREATE_STATIC_LIBRARY +set(CMAKE_DL_LIBS "") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty +if(NOT CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_CREATE_STATIC_LIBRARY " -ar -o ") - SET (CMAKE_CXX_FLAGS_INIT "") - SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") - SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG") - SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") - SET (CMAKE_C_FLAGS_INIT "") -ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) + set (CMAKE_CXX_FLAGS_INIT "") + set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") + set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG") + set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") + set (CMAKE_C_FLAGS_INIT "") +endif() # set flags for gcc support -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) -IF(NOT CMAKE_COMPILER_IS_GNUCC) - SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") - SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE +if(NOT CMAKE_COMPILER_IS_GNUCC) + set (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") + set (CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S " "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " ) -ENDIF(NOT CMAKE_COMPILER_IS_GNUCC) +endif() -IF(NOT CMAKE_COMPILER_IS_GNUCXX) - SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") - SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE +if(NOT CMAKE_COMPILER_IS_GNUCXX) + set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") + set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S " "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " ) -ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) +endif() # Initialize C link type selection flags. These flags are used when # building a shared library, shared module, or executable that links # to other libraries to select whether to use the static or shared # versions of the libraries. -FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") -ENDFOREACH(type) +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +endforeach() # The IRIX linker needs to find transitive shared library dependencies # in the -L path. -SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) +set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake index b60a7f297..5acbd81fa 100644 --- a/Modules/Platform/IRIX64.cmake +++ b/Modules/Platform/IRIX64.cmake @@ -1,73 +1,73 @@ -SET(CMAKE_DL_LIBS "") -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty -SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -IF(NOT CMAKE_COMPILER_IS_GNUCC) +set(CMAKE_DL_LIBS "") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +if(NOT CMAKE_COMPILER_IS_GNUCC) # Set default flags init. - SET(CMAKE_C_FLAGS_INIT "") - SET(CMAKE_CXX_FLAGS_INIT "") - SET(CMAKE_Fortran_FLAGS_INIT "") - SET(CMAKE_EXE_LINKER_FLAGS_INIT "") - SET(CMAKE_SHARED_LINKER_FLAGS_INIT "") - SET(CMAKE_MODULE_LINKER_FLAGS_INIT "") - + set(CMAKE_C_FLAGS_INIT "") + set(CMAKE_CXX_FLAGS_INIT "") + set(CMAKE_Fortran_FLAGS_INIT "") + set(CMAKE_EXE_LINKER_FLAGS_INIT "") + set(CMAKE_SHARED_LINKER_FLAGS_INIT "") + set(CMAKE_MODULE_LINKER_FLAGS_INIT "") + # If no -o32, -n32, or -64 flag is given, set a reasonable default. - IF("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)") - ELSE("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)") + if("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)") + else() # Check if this is a 64-bit CMake. - IF(CMAKE_FILE_SELF MATCHES "^CMAKE_FILE_SELF$") - EXEC_PROGRAM(file ARGS ${CMAKE_COMMAND} OUTPUT_VARIABLE CMAKE_FILE_SELF) - SET(CMAKE_FILE_SELF "${CMAKE_FILE_SELF}" CACHE INTERNAL + if(CMAKE_FILE_SELF MATCHES "^CMAKE_FILE_SELF$") + exec_program(file ARGS ${CMAKE_COMMAND} OUTPUT_VARIABLE CMAKE_FILE_SELF) + set(CMAKE_FILE_SELF "${CMAKE_FILE_SELF}" CACHE INTERNAL "Output of file command on ${CMAKE_COMMAND}.") - ENDIF(CMAKE_FILE_SELF MATCHES "^CMAKE_FILE_SELF$") - + endif() + # Set initial flags to match cmake executable. - IF(CMAKE_FILE_SELF MATCHES " 64-bit ") - SET(CMAKE_C_FLAGS_INIT "-64") - SET(CMAKE_CXX_FLAGS_INIT "-64") - SET(CMAKE_Fortran_FLAGS_INIT "-64") - SET(CMAKE_EXE_LINKER_FLAGS_INIT "-64") - SET(CMAKE_SHARED_LINKER_FLAGS_INIT "-64") - SET(CMAKE_MODULE_LINKER_FLAGS_INIT "-64") - ENDIF(CMAKE_FILE_SELF MATCHES " 64-bit ") - ENDIF("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)") - + if(CMAKE_FILE_SELF MATCHES " 64-bit ") + set(CMAKE_C_FLAGS_INIT "-64") + set(CMAKE_CXX_FLAGS_INIT "-64") + set(CMAKE_Fortran_FLAGS_INIT "-64") + set(CMAKE_EXE_LINKER_FLAGS_INIT "-64") + set(CMAKE_SHARED_LINKER_FLAGS_INIT "-64") + set(CMAKE_MODULE_LINKER_FLAGS_INIT "-64") + endif() + endif() + # Set remaining defaults. - SET(CMAKE_CXX_CREATE_STATIC_LIBRARY + set(CMAKE_CXX_CREATE_STATIC_LIBRARY " -ar -o ") - SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") - SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG") - SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") -ENDIF(NOT CMAKE_COMPILER_IS_GNUCC) -INCLUDE(Platform/UnixPaths) + set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") + set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG") + set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") +endif() +include(Platform/UnixPaths) -IF(NOT CMAKE_COMPILER_IS_GNUCC) - SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") - SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE +if(NOT CMAKE_COMPILER_IS_GNUCC) + set (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") + set (CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S " "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " ) -ENDIF(NOT CMAKE_COMPILER_IS_GNUCC) +endif() -IF(NOT CMAKE_COMPILER_IS_GNUCXX) - SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") - SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE +if(NOT CMAKE_COMPILER_IS_GNUCXX) + set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") + set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S " "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " ) -ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) +endif() # Initialize C link type selection flags. These flags are used when # building a shared library, shared module, or executable that links # to other libraries to select whether to use the static or shared # versions of the libraries. -FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") -ENDFOREACH(type) +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +endforeach() # The IRIX linker needs to find transitive shared library dependencies # in the -L path. -SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) +set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Modules/Platform/Linux-CXX.cmake b/Modules/Platform/Linux-CXX.cmake new file mode 100644 index 000000000..b594daeb0 --- /dev/null +++ b/Modules/Platform/Linux-CXX.cmake @@ -0,0 +1,3 @@ +if(NOT CMAKE_CXX_COMPILER_NAMES) + set(CMAKE_CXX_COMPILER_NAMES c++) +endif() diff --git a/Modules/Platform/Linux-Clang-C.cmake b/Modules/Platform/Linux-Clang-C.cmake index dbf89564a..2a77d2710 100644 --- a/Modules/Platform/Linux-Clang-C.cmake +++ b/Modules/Platform/Linux-Clang-C.cmake @@ -1 +1 @@ -INCLUDE(Platform/Linux-GNU-C) +include(Platform/Linux-GNU-C) diff --git a/Modules/Platform/Linux-Clang-CXX.cmake b/Modules/Platform/Linux-Clang-CXX.cmake index 8fe251c4d..9d9a4df66 100644 --- a/Modules/Platform/Linux-Clang-CXX.cmake +++ b/Modules/Platform/Linux-Clang-CXX.cmake @@ -1 +1 @@ -INCLUDE(Platform/Linux-GNU-CXX) +include(Platform/Linux-GNU-CXX) diff --git a/Modules/Platform/Linux-GNU-C.cmake b/Modules/Platform/Linux-GNU-C.cmake index 3ab142f13..84dd49269 100644 --- a/Modules/Platform/Linux-GNU-C.cmake +++ b/Modules/Platform/Linux-GNU-C.cmake @@ -1,2 +1,2 @@ -INCLUDE(Platform/Linux-GNU) +include(Platform/Linux-GNU) __linux_compiler_gnu(C) diff --git a/Modules/Platform/Linux-GNU-CXX.cmake b/Modules/Platform/Linux-GNU-CXX.cmake index 9e4f904f2..416233531 100644 --- a/Modules/Platform/Linux-GNU-CXX.cmake +++ b/Modules/Platform/Linux-GNU-CXX.cmake @@ -1,2 +1,2 @@ -INCLUDE(Platform/Linux-GNU) +include(Platform/Linux-GNU) __linux_compiler_gnu(CXX) diff --git a/Modules/Platform/Linux-GNU-Fortran.cmake b/Modules/Platform/Linux-GNU-Fortran.cmake index e364c872a..68e95404b 100644 --- a/Modules/Platform/Linux-GNU-Fortran.cmake +++ b/Modules/Platform/Linux-GNU-Fortran.cmake @@ -1,2 +1,2 @@ -INCLUDE(Platform/Linux-GNU) +include(Platform/Linux-GNU) __linux_compiler_gnu(Fortran) diff --git a/Modules/Platform/Linux-Intel-C.cmake b/Modules/Platform/Linux-Intel-C.cmake index c909e68fc..d1694d64a 100644 --- a/Modules/Platform/Linux-Intel-C.cmake +++ b/Modules/Platform/Linux-Intel-C.cmake @@ -1,2 +1,2 @@ -INCLUDE(Platform/Linux-Intel) +include(Platform/Linux-Intel) __linux_compiler_intel(C) diff --git a/Modules/Platform/Linux-Intel-CXX.cmake b/Modules/Platform/Linux-Intel-CXX.cmake index 0b7daf475..66df3ac2a 100644 --- a/Modules/Platform/Linux-Intel-CXX.cmake +++ b/Modules/Platform/Linux-Intel-CXX.cmake @@ -1,2 +1,2 @@ -INCLUDE(Platform/Linux-Intel) +include(Platform/Linux-Intel) __linux_compiler_intel(CXX) diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake index 342b5c2fa..bb671eeb2 100644 --- a/Modules/Platform/Linux-Intel-Fortran.cmake +++ b/Modules/Platform/Linux-Intel-Fortran.cmake @@ -1,4 +1,4 @@ -INCLUDE(Platform/Linux-Intel) +include(Platform/Linux-Intel) __linux_compiler_intel(Fortran) set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS} -i_dynamic -nofor_main") set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-i_dynamic") diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake index 47bf24659..2394f1050 100644 --- a/Modules/Platform/Linux-Intel.cmake +++ b/Modules/Platform/Linux-Intel.cmake @@ -28,7 +28,7 @@ if(NOT XIAR) endforeach() find_program(XIAR NAMES xiar HINTS ${_intel_xiar_hints}) mark_as_advanced(XIAR) -endif(NOT XIAR) +endif() macro(__linux_compiler_intel lang) set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC") diff --git a/Modules/Platform/Linux-SunPro-CXX.cmake b/Modules/Platform/Linux-SunPro-CXX.cmake index 8ee96586d..a07f1ec84 100644 --- a/Modules/Platform/Linux-SunPro-CXX.cmake +++ b/Modules/Platform/Linux-SunPro-CXX.cmake @@ -6,4 +6,4 @@ if("${_cxx_flags}" MATCHES "\n-W[^\n]*component") else() set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-rpath-link ") endif() -SET(CMAKE_EXE_EXPORTS_CXX_FLAG "--export-dynamic") +set(CMAKE_EXE_EXPORTS_CXX_FLAG "--export-dynamic") diff --git a/Modules/Platform/Linux-TinyCC-C.cmake b/Modules/Platform/Linux-TinyCC-C.cmake index b753268ea..f78e708f9 100644 --- a/Modules/Platform/Linux-TinyCC-C.cmake +++ b/Modules/Platform/Linux-TinyCC-C.cmake @@ -1,4 +1,4 @@ -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") -SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "") -SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-soname ") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-soname ") diff --git a/Modules/Platform/Linux-XL-C.cmake b/Modules/Platform/Linux-XL-C.cmake index b1b07f617..f1c584ce5 100644 --- a/Modules/Platform/Linux-XL-C.cmake +++ b/Modules/Platform/Linux-XL-C.cmake @@ -1 +1 @@ -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-qmkshrobj") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-qmkshrobj") diff --git a/Modules/Platform/Linux-XL-CXX.cmake b/Modules/Platform/Linux-XL-CXX.cmake index 071a975ed..abd3fa497 100644 --- a/Modules/Platform/Linux-XL-CXX.cmake +++ b/Modules/Platform/Linux-XL-CXX.cmake @@ -1 +1 @@ -SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-qmkshrobj") +set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-qmkshrobj") diff --git a/Modules/Platform/Linux-XL-Fortran.cmake b/Modules/Platform/Linux-XL-Fortran.cmake index 5da574e2e..cdd1f702b 100644 --- a/Modules/Platform/Linux-XL-Fortran.cmake +++ b/Modules/Platform/Linux-XL-Fortran.cmake @@ -1 +1 @@ -SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-qmkshrobj") +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-qmkshrobj") diff --git a/Modules/Platform/Linux-como.cmake b/Modules/Platform/Linux-como.cmake index 7ea732082..d1550d201 100644 --- a/Modules/Platform/Linux-como.cmake +++ b/Modules/Platform/Linux-como.cmake @@ -1,17 +1,17 @@ # create a shared C++ library -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY +set(CMAKE_CXX_CREATE_SHARED_LIBRARY " --prelink_objects " " -o ") # create a C++ static library -SET(CMAKE_CXX_CREATE_STATIC_LIBRARY +set(CMAKE_CXX_CREATE_STATIC_LIBRARY " --prelink_objects " " cr " " ") -SET(CMAKE_CXX_LINK_EXECUTABLE +set(CMAKE_CXX_LINK_EXECUTABLE " --prelink_objects " " -o ") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "") diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index 38f469b33..fe8e0039f 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -1,22 +1,22 @@ -SET(CMAKE_DL_LIBS "dl") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") -SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") -SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") +set(CMAKE_DL_LIBS "dl") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") # Shared libraries with no builtin soname may not be linked safely by # specifying the file path. -SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) +set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) # Initialize C link type selection flags. These flags are used when # building a shared library, shared module, or executable that links # to other libraries to select whether to use the static or shared # versions of the libraries. -FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") -ENDFOREACH(type) +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +endforeach() # Debian policy requires that shared libraries be installed without # executable permission. Fedora policy requires that shared libraries @@ -26,32 +26,32 @@ ENDFOREACH(type) # default. In order to support debian packages we provide an option # here. The option default is based on the current distribution, but # packagers can set it explicitly on the command line. -IF(DEFINED CMAKE_INSTALL_SO_NO_EXE) +if(DEFINED CMAKE_INSTALL_SO_NO_EXE) # Store the decision variable in the cache. This preserves any # setting the user provides on the command line. - SET(CMAKE_INSTALL_SO_NO_EXE "${CMAKE_INSTALL_SO_NO_EXE}" CACHE INTERNAL + set(CMAKE_INSTALL_SO_NO_EXE "${CMAKE_INSTALL_SO_NO_EXE}" CACHE INTERNAL "Install .so files without execute permission.") -ELSE(DEFINED CMAKE_INSTALL_SO_NO_EXE) +else() # Store the decision variable as an internal cache entry to avoid # checking the platform every time. This option is advanced enough # that only package maintainers should need to adjust it. They are # capable of providing a setting on the command line. - IF(EXISTS "/etc/debian_version") - SET(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL + if(EXISTS "/etc/debian_version") + set(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL "Install .so files without execute permission.") - ELSE(EXISTS "/etc/debian_version") - SET(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL + else() + set(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL "Install .so files without execute permission.") - ENDIF(EXISTS "/etc/debian_version") -ENDIF(DEFINED CMAKE_INSTALL_SO_NO_EXE) + endif() +endif() # Match multiarch library directory names. -SET(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_]*") +set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_]*") -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) # Debian has lib64 paths only for compatibility so they should not be # searched. -IF(EXISTS "/etc/debian_version") - SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) -ENDIF(EXISTS "/etc/debian_version") +if(EXISTS "/etc/debian_version") + set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) +endif() diff --git a/Modules/Platform/MP-RAS.cmake b/Modules/Platform/MP-RAS.cmake index ff22a4fda..fe8d81a1b 100644 --- a/Modules/Platform/MP-RAS.cmake +++ b/Modules/Platform/MP-RAS.cmake @@ -1,14 +1,14 @@ -IF(CMAKE_SYSTEM MATCHES "MP-RAS-02*.") - SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) - SET(CMAKE_C_COMPILE_OPTIONS_PIE -K PIE) - SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") -ELSE(CMAKE_SYSTEM MATCHES "MP-RAS-02*.") - SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) - SET(CMAKE_C_COMPILE_OPTIONS_PIE -K PIE) - SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") - SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-Bexport") -ENDIF(CMAKE_SYSTEM MATCHES "MP-RAS-02*.") +if(CMAKE_SYSTEM MATCHES "MP-RAS-02*.") + set(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) + set(CMAKE_C_COMPILE_OPTIONS_PIE -K PIE) + set(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") +else() + set(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) + set(CMAKE_C_COMPILE_OPTIONS_PIE -K PIE) + set(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") + set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-Bexport") +endif() -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) diff --git a/Modules/Platform/NetBSD.cmake b/Modules/Platform/NetBSD.cmake index e1b66b84c..1004eb310 100644 --- a/Modules/Platform/NetBSD.cmake +++ b/Modules/Platform/NetBSD.cmake @@ -1,15 +1,13 @@ -IF(EXISTS /usr/include/dlfcn.h) - SET(CMAKE_DL_LIBS "") - SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") - SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") - SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic - SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared - SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty - SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") - SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") - SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -ENDIF(EXISTS /usr/include/dlfcn.h) +set(CMAKE_DL_LIBS "") +set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") +set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) diff --git a/Modules/Platform/OSF1.cmake b/Modules/Platform/OSF1.cmake index 49a30e971..9c3255e36 100644 --- a/Modules/Platform/OSF1.cmake +++ b/Modules/Platform/OSF1.cmake @@ -1,47 +1,47 @@ -SET(CMAKE_DL_LIBS "") +set(CMAKE_DL_LIBS "") -IF(CMAKE_SYSTEM MATCHES "OSF1-1.[012]") -ENDIF(CMAKE_SYSTEM MATCHES "OSF1-1.[012]") -IF(CMAKE_SYSTEM MATCHES "OSF1-1.*") +if(CMAKE_SYSTEM MATCHES "OSF1-1.[012]") +endif() +if(CMAKE_SYSTEM MATCHES "OSF1-1.*") # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 - SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fpic") - SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fpie") - SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fpic") # -pic - SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fpic") # -pic -ENDIF(CMAKE_SYSTEM MATCHES "OSF1-1.*") + set(CMAKE_C_COMPILE_OPTIONS_PIC "-fpic") + set(CMAKE_C_COMPILE_OPTIONS_PIE "-fpie") + set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fpic") # -pic + set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fpic") # -pic +endif() -IF(CMAKE_SYSTEM MATCHES "OSF1-V.*") - SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared - IF(CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-rpath,") - ELSE(CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-rpath ") - ENDIF(CMAKE_COMPILER_IS_GNUCXX) - IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") - ELSE(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-rpath ") - ENDIF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") -ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*") +if(CMAKE_SYSTEM MATCHES "OSF1-V.*") + set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared + if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-rpath,") + else() + set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-rpath ") + endif() + if(CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") + else() + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-rpath ") + endif() + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +endif() -SET(CMAKE_MAKE_INCLUDE_FROM_ROOT 1) # include $(CMAKE_BINARY_DIR)/... +set(CMAKE_MAKE_INCLUDE_FROM_ROOT 1) # include $(CMAKE_BINARY_DIR)/... -IF(CMAKE_COMPILER_IS_GNUCXX) - # include the gcc flags -ELSE (CMAKE_COMPILER_IS_GNUCXX) +if(CMAKE_COMPILER_IS_GNUCXX) + # include the gcc flags +else () # use default OSF compiler flags - SET (CMAKE_C_FLAGS_INIT "") - SET (CMAKE_C_FLAGS_DEBUG_INIT "-g") - SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-O2 -DNDEBUG") - SET (CMAKE_C_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") - SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2") - SET (CMAKE_CXX_FLAGS_INIT "") - SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") - SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O2 -DNDEBUG") - SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") -ENDIF(CMAKE_COMPILER_IS_GNUCXX) -INCLUDE(Platform/UnixPaths) + set (CMAKE_C_FLAGS_INIT "") + set (CMAKE_C_FLAGS_DEBUG_INIT "-g") + set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-O2 -DNDEBUG") + set (CMAKE_C_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2") + set (CMAKE_CXX_FLAGS_INIT "") + set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") + set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O2 -DNDEBUG") + set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") +endif() +include(Platform/UnixPaths) diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake index b4ed66fb0..53cabedde 100644 --- a/Modules/Platform/OpenBSD.cmake +++ b/Modules/Platform/OpenBSD.cmake @@ -1,18 +1,22 @@ -INCLUDE(Platform/NetBSD) +include(Platform/NetBSD) # On OpenBSD, the compile time linker does not share it's configuration with # the runtime linker. This will extract the library search paths from the # system's ld.so.hints file which will allow CMake to set the appropriate # -rpath-link flags -IF(NOT CMAKE_PLATFORM_RUNTIME_PATH) - EXECUTE_PROCESS(COMMAND /sbin/ldconfig -r +if(NOT CMAKE_PLATFORM_RUNTIME_PATH) + execute_process(COMMAND /sbin/ldconfig -r OUTPUT_VARIABLE LDCONFIG_HINTS ERROR_QUIET) - STRING(REGEX REPLACE ".*search\\ directories:\\ ([^\n]*).*" "\\1" + string(REGEX REPLACE ".*search\\ directories:\\ ([^\n]*).*" "\\1" LDCONFIG_HINTS "${LDCONFIG_HINTS}") - STRING(REGEX REPLACE ":" ";" + string(REGEX REPLACE ":" ";" CMAKE_PLATFORM_RUNTIME_PATH "${LDCONFIG_HINTS}") -ENDIF() +endif() -SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1) +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1) + +# OpenBSD policy requires that shared libraries be installed without +# executable permission. +set(CMAKE_INSTALL_SO_NO_EXE 1) diff --git a/Modules/Platform/OpenVMS.cmake b/Modules/Platform/OpenVMS.cmake index c52effab6..b10da2388 100644 --- a/Modules/Platform/OpenVMS.cmake +++ b/Modules/Platform/OpenVMS.cmake @@ -1,8 +1,8 @@ -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) -SET(CMAKE_C_CREATE_STATIC_LIBRARY +set(CMAKE_C_CREATE_STATIC_LIBRARY " cr " " " ) -SET(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY}) -SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe +set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY}) +set(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index 8cdbe02c1..2598411cd 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -1,33 +1,33 @@ -SET(QNXNTO 1) +set(QNXNTO 1) # The QNX GCC does not seem to have -isystem so remove the flag. -SET(CMAKE_INCLUDE_SYSTEM_FLAG_C) -SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) +set(CMAKE_INCLUDE_SYSTEM_FLAG_C) +set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) -SET(CMAKE_DL_LIBS "") -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") -SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") -SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") -SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") +set(CMAKE_DL_LIBS "") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "") +set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") # Shared libraries with no builtin soname may not be linked safely by # specifying the file path. -SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) +set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) # Initialize C link type selection flags. These flags are used when # building a shared library, shared module, or executable that links # to other libraries to select whether to use the static or shared # versions of the libraries. -FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") -ENDFOREACH(type) +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +endforeach() # force the language to be c++ since qnx only has gcc and not g++ and c++? -SET(CMAKE_CXX_COMPILE_OBJECT +set(CMAKE_CXX_COMPILE_OBJECT " -x c++ -o -c ") -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) diff --git a/Modules/Platform/RISCos.cmake b/Modules/Platform/RISCos.cmake index 3b2a092bf..570cd7b5b 100644 --- a/Modules/Platform/RISCos.cmake +++ b/Modules/Platform/RISCos.cmake @@ -1,6 +1,6 @@ -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-G 0") -SET(CMAKE_SHARED_LIBRARY_SUFFIX "..o") -SET(CMAKE_DL_LIBS "") -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-D,08000000") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-G 0") +set(CMAKE_SHARED_LIBRARY_SUFFIX "..o") +set(CMAKE_DL_LIBS "") +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-D,08000000") -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) diff --git a/Modules/Platform/SCO_SV.cmake b/Modules/Platform/SCO_SV.cmake index cbdcb7dae..ddd960083 100644 --- a/Modules/Platform/SCO_SV.cmake +++ b/Modules/Platform/SCO_SV.cmake @@ -1,2 +1,2 @@ -SET(CMAKE_DL_LIBS "") -INCLUDE(Platform/UnixPaths) +set(CMAKE_DL_LIBS "") +include(Platform/UnixPaths) diff --git a/Modules/Platform/SINIX.cmake b/Modules/Platform/SINIX.cmake index e0809f8e3..c37a113d3 100644 --- a/Modules/Platform/SINIX.cmake +++ b/Modules/Platform/SINIX.cmake @@ -1,4 +1,4 @@ -SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) -SET(CMAKE_C_COMPILE_OPTIONS_PIE "") -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") -INCLUDE(Platform/UnixPaths) +set(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) +set(CMAKE_C_COMPILE_OPTIONS_PIE "") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") +include(Platform/UnixPaths) diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake index de287aa70..da20f97a1 100644 --- a/Modules/Platform/SunOS.cmake +++ b/Modules/Platform/SunOS.cmake @@ -1,32 +1,32 @@ -IF(CMAKE_SYSTEM MATCHES "SunOS-4.*") - SET(CMAKE_C_COMPILE_OPTIONS_PIC "-PIC") - SET(CMAKE_C_COMPILE_OPTIONS_PIE "-PIE") - SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC") - SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r") - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-R") - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") -ENDIF(CMAKE_SYSTEM MATCHES "SunOS-4.*") +if(CMAKE_SYSTEM MATCHES "SunOS-4.*") + set(CMAKE_C_COMPILE_OPTIONS_PIC "-PIC") + set(CMAKE_C_COMPILE_OPTIONS_PIE "-PIE") + set(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC") + set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r") + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-R") + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +endif() -IF(CMAKE_COMPILER_IS_GNUCXX) - IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_CXX_CREATE_SHARED_LIBRARY +if(CMAKE_COMPILER_IS_GNUCXX) + if(CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_CXX_CREATE_SHARED_LIBRARY " -o ") - ELSE(CMAKE_COMPILER_IS_GNUCC) + else() # Take default rule from CMakeDefaultMakeRuleVariables.cmake. - ENDIF(CMAKE_COMPILER_IS_GNUCC) -ENDIF(CMAKE_COMPILER_IS_GNUCXX) -INCLUDE(Platform/UnixPaths) + endif() +endif() +include(Platform/UnixPaths) # Add the compiler's implicit link directories. -IF("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro) - LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES +if("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro) + list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /opt/SUNWspro/lib /opt/SUNWspro/prod/lib /usr/ccs/lib) -ENDIF("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro) +endif() # The Sun linker needs to find transitive shared library dependencies # in the -L path. -SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) +set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) # Shared libraries with no builtin soname may not be linked safely by # specifying the file path. -SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) +set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) diff --git a/Modules/Platform/Tru64.cmake b/Modules/Platform/Tru64.cmake index cf9d17bfd..47852f8e1 100644 --- a/Modules/Platform/Tru64.cmake +++ b/Modules/Platform/Tru64.cmake @@ -1,2 +1,2 @@ -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) diff --git a/Modules/Platform/ULTRIX.cmake b/Modules/Platform/ULTRIX.cmake index 4d0cf755d..9db4c7c20 100644 --- a/Modules/Platform/ULTRIX.cmake +++ b/Modules/Platform/ULTRIX.cmake @@ -1,5 +1,5 @@ -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-G 0") -SET(CMAKE_SHARED_LIBRARY_SUFFIX "..o") -SET(CMAKE_DL_LIBS "") -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-D,08000000") -INCLUDE(Platform/UnixPaths) +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-G 0") +set(CMAKE_SHARED_LIBRARY_SUFFIX "..o") +set(CMAKE_DL_LIBS "") +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-D,08000000") +include(Platform/UnixPaths) diff --git a/Modules/Platform/UNIX_SV.cmake b/Modules/Platform/UNIX_SV.cmake index 869b3a6a0..1ec96aea2 100644 --- a/Modules/Platform/UNIX_SV.cmake +++ b/Modules/Platform/UNIX_SV.cmake @@ -1,5 +1,5 @@ -SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) -SET(CMAKE_C_COMPILE_OPTIONS_PIE "") -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-Bexport") -INCLUDE(Platform/UnixPaths) +set(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) +set(CMAKE_C_COMPILE_OPTIONS_PIE "") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-Bexport") +include(Platform/UnixPaths) diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 5ee7ddbd6..ccb266330 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -17,21 +17,21 @@ # "CMakeSystemSpecificInformation.cmake" already included it. # The extra inclusion is a work-around documented next to the include() # call, so this can be removed when the work-around is removed. -IF(__UNIX_PATHS_INCLUDED) - RETURN() -ENDIF() -SET(__UNIX_PATHS_INCLUDED 1) +if(__UNIX_PATHS_INCLUDED) + return() +endif() +set(__UNIX_PATHS_INCLUDED 1) -SET(UNIX 1) +set(UNIX 1) # also add the install directory of the running cmake to the search directories # CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up -GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH) -GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH) +get_filename_component(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH) +get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH) # List common installation prefixes. These will be used for all # search types. -LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH +list(APPEND CMAKE_SYSTEM_PREFIX_PATH # Standard /usr/local /usr / @@ -43,7 +43,7 @@ LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH ) # List common include file locations not under the common prefixes. -LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH +list(APPEND CMAKE_SYSTEM_INCLUDE_PATH # Windows API on Cygwin /usr/include/w32api @@ -52,11 +52,11 @@ LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH # Other /usr/pkg/include - /opt/csw/include /opt/include + /opt/csw/include /opt/include /usr/openwin/include ) -LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH +list(APPEND CMAKE_SYSTEM_LIBRARY_PATH # Windows API on Cygwin /usr/lib/w32api @@ -65,24 +65,24 @@ LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH # Other /usr/pkg/lib - /opt/csw/lib /opt/lib + /opt/csw/lib /opt/lib /usr/openwin/lib ) -LIST(APPEND CMAKE_SYSTEM_PROGRAM_PATH +list(APPEND CMAKE_SYSTEM_PROGRAM_PATH /usr/pkg/bin ) -LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES +list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /lib /usr/lib /usr/lib32 /usr/lib64 ) -LIST(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES +list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES /usr/include ) -LIST(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES +list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES /usr/include ) # Enable use of lib64 search path variants by default. -SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) diff --git a/Modules/Platform/UnixWare.cmake b/Modules/Platform/UnixWare.cmake index 3112ee1ef..e649bd2a4 100644 --- a/Modules/Platform/UnixWare.cmake +++ b/Modules/Platform/UnixWare.cmake @@ -1,5 +1,5 @@ -SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) -SET(CMAKE_C_COMPILE_OPTIONS_PIE "") -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-Wl,-Bexport") -INCLUDE(Platform/UnixPaths) +set(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC) +set(CMAKE_C_COMPILE_OPTIONS_PIE "") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-Wl,-Bexport") +include(Platform/UnixPaths) diff --git a/Modules/Platform/Windows-CXX.cmake b/Modules/Platform/Windows-CXX.cmake new file mode 100644 index 000000000..bf37f7903 --- /dev/null +++ b/Modules/Platform/Windows-CXX.cmake @@ -0,0 +1,7 @@ +if(NOT CMAKE_CXX_COMPILER_NAMES) + set(CMAKE_CXX_COMPILER_NAMES c++) +endif() + +# Exclude C++ compilers differing from C compiler only by case +# because this platform may have a case-insensitive filesystem. +set(CMAKE_CXX_COMPILER_EXCLUDE CC aCC xlC) diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 62e8eb704..307230e34 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -18,7 +18,7 @@ if(__WINDOWS_EMBARCADERO) endif() set(__WINDOWS_EMBARCADERO 1) -SET(BORLAND 1) +set(BORLAND 1) if("${CMAKE_${_lang}_COMPILER_VERSION}" VERSION_LESS 6.30) # Borland target type flags (bcc32 -h -t): @@ -43,36 +43,36 @@ endif() set(_COMPILE_C "-c") set(_COMPILE_CXX "-P -c") -SET(CMAKE_LIBRARY_PATH_FLAG "-L") -SET(CMAKE_LINK_LIBRARY_FLAG "") +set(CMAKE_LIBRARY_PATH_FLAG "-L") +set(CMAKE_LINK_LIBRARY_FLAG "") -SET(CMAKE_FIND_LIBRARY_SUFFIXES "-bcc.lib" ".lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES "-bcc.lib" ".lib") # uncomment these out to debug makefiles -#SET(CMAKE_START_TEMP_FILE "") -#SET(CMAKE_END_TEMP_FILE "") -#SET(CMAKE_VERBOSE_MAKEFILE 1) +#set(CMAKE_START_TEMP_FILE "") +#set(CMAKE_END_TEMP_FILE "") +#set(CMAKE_VERBOSE_MAKEFILE 1) # Borland cannot handle + in the file name, so mangle object file name -SET (CMAKE_MANGLE_OBJECT_FILE_NAMES "ON") +set (CMAKE_MANGLE_OBJECT_FILE_NAMES "ON") # extra flags for a win32 exe -SET(CMAKE_CREATE_WIN32_EXE "${_tW}" ) +set(CMAKE_CREATE_WIN32_EXE "${_tW}" ) # extra flags for a console app -SET(CMAKE_CREATE_CONSOLE_EXE "${_tC}" ) +set(CMAKE_CREATE_CONSOLE_EXE "${_tC}" ) -SET (CMAKE_BUILD_TYPE Debug CACHE STRING +set (CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.") -SET (CMAKE_EXE_LINKER_FLAGS_INIT "${_tM} -lS:10000000 -lSc:10000000 ") -SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-v") -SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-v") -SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +set (CMAKE_EXE_LINKER_FLAGS_INIT "${_tM} -lS:1048576 -lSc:4098 -lH:1048576 -lHc:8192 ") +set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-v") +set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-v") +set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT}) macro(__embarcadero_language lang) diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 4a37eca87..2bb7a2076 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -57,6 +57,10 @@ if("${_help}" MATCHES "GNU ld .* 2\\.1[1-6]") set(__WINDOWS_GNU_LD_RESPONSE 0) endif() +if(NOT CMAKE_GENERATOR_RC AND CMAKE_GENERATOR MATCHES "Unix Makefiles") + set(CMAKE_GENERATOR_RC windres) +endif() + enable_language(RC) macro(__windows_compiler_gnu lang) @@ -74,7 +78,7 @@ macro(__windows_compiler_gnu lang) foreach(type SHARED_LIBRARY SHARED_MODULE EXE) set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic") set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic") - endforeach(type) + endforeach() endif() # No -fPIC on Windows diff --git a/Modules/Platform/Windows-Intel-Fortran.cmake b/Modules/Platform/Windows-Intel-Fortran.cmake index 5c016a8fd..40523ffe5 100644 --- a/Modules/Platform/Windows-Intel-Fortran.cmake +++ b/Modules/Platform/Windows-Intel-Fortran.cmake @@ -4,8 +4,8 @@ set(_COMPILE_Fortran " /fpp") set(CMAKE_Fortran_MODDIR_FLAG "-module:") set(CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") __windows_compiler_intel(Fortran) -SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads") -SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /dbglibs") -SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O1 /D NDEBUG") -SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O2 /D NDEBUG") -SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O2 /debug:full /D NDEBUG") +set (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads") +set (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /dbglibs") +set (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O1 /D NDEBUG") +set (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O2 /D NDEBUG") +set (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O2 /debug:full /D NDEBUG") diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index 2a54a981b..8a9d630f6 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -19,65 +19,65 @@ endif() set(__WINDOWS_INTEL 1) # make sure to enable languages after setting configuration types -ENABLE_LANGUAGE(RC) -SET(CMAKE_COMPILE_RESOURCE "rc /fo ") +enable_language(RC) +set(CMAKE_COMPILE_RESOURCE "rc /fo ") -SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") -SET(CMAKE_LINK_LIBRARY_FLAG "") -SET(WIN32 1) -IF(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO) -ELSE(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO "/nologo") -ENDIF(CMAKE_VERBOSE_MAKEFILE) -SET(CMAKE_COMPILE_RESOURCE "rc /fo ") -SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) -SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) +set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") +set(CMAKE_LINK_LIBRARY_FLAG "") +set(WIN32 1) +if(CMAKE_VERBOSE_MAKEFILE) + set(CMAKE_CL_NOLOGO) +else() + set(CMAKE_CL_NOLOGO "/nologo") +endif() +set(CMAKE_COMPILE_RESOURCE "rc /fo ") +set(CMAKE_CREATE_WIN32_EXE /subsystem:windows) +set(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) # default to Debug builds -#SET(CMAKE_BUILD_TYPE_INIT Debug) -SET(CMAKE_BUILD_TYPE_INIT Release) +#set(CMAKE_BUILD_TYPE_INIT Debug) +set(CMAKE_BUILD_TYPE_INIT Release) -SET(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") -SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") +set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") +set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") # executable linker flags -SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") -IF(MSVC_C_ARCHITECTURE_ID) - SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}") -ELSEIF(MSVC_CXX_ARCHITECTURE_ID) - SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}") -ELSEIF(MSVC_Fortran_ARCHITECTURE_ID) - SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") -ENDIF() -SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}") -SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") -SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") +set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") +if(MSVC_C_ARCHITECTURE_ID) + set(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}") +elseif(MSVC_CXX_ARCHITECTURE_ID) + set(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}") +elseif(MSVC_Fortran_ARCHITECTURE_ID) + set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") +endif() +set (CMAKE_EXE_LINKER_FLAGS_INIT "/INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}") +set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") +set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") -SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) -INCLUDE("${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake" OPTIONAL) +include("${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake" OPTIONAL) -IF(NOT _INTEL_XILINK_TEST_RUN) - EXECUTE_PROCESS(COMMAND xilink /? +if(NOT _INTEL_XILINK_TEST_RUN) + execute_process(COMMAND xilink /? ERROR_VARIABLE _XILINK_ERR OUTPUT_VARIABLE _XILINK_HELP) - IF(_XILINK_HELP MATCHES MANIFEST) - SET(_INTEL_COMPILER_SUPPORTS_MANIFEST 1) - ENDIF(_XILINK_HELP MATCHES MANIFEST) - IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake") - FILE(WRITE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake + if(_XILINK_HELP MATCHES MANIFEST) + set(_INTEL_COMPILER_SUPPORTS_MANIFEST 1) + endif() + if(NOT EXISTS "${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake") + file(WRITE ${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake " -SET(_INTEL_XILINK_TEST_RUN 1) -SET(_INTEL_COMPILER_SUPPORTS_MANIFEST ${_INTEL_COMPILER_SUPPORTS_MANIFEST}) +set(_INTEL_XILINK_TEST_RUN 1) +set(_INTEL_COMPILER_SUPPORTS_MANIFEST ${_INTEL_COMPILER_SUPPORTS_MANIFEST}) ") - ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake") -ENDIF(NOT _INTEL_XILINK_TEST_RUN) + endif() +endif() macro(__windows_compiler_intel lang) set(CMAKE_${lang}_COMPILE_OBJECT @@ -89,8 +89,9 @@ macro(__windows_compiler_intel lang) set(CMAKE_${lang}_CREATE_SHARED_LIBRARY "xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_SHARED_MODULE "${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") + set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link") set(CMAKE_${lang}_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link /implib: ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /link /implib: ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}") set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /RTC1") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1") @@ -98,11 +99,11 @@ macro(__windows_compiler_intel lang) set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/DNDEBUG /MD /Zi /O2") if(_INTEL_COMPILER_SUPPORTS_MANIFEST) - SET(CMAKE_${lang}_LINK_EXECUTABLE + set(CMAKE_${lang}_LINK_EXECUTABLE " -E vs_link_exe ${CMAKE_${lang}_LINK_EXECUTABLE}") - SET(CMAKE_${lang}_CREATE_SHARED_LIBRARY + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY " -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") - SET(CMAKE_${lang}_CREATE_SHARED_MODULE + set(CMAKE_${lang}_CREATE_SHARED_MODULE " -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_MODULE}") endif() endmacro() diff --git a/Modules/Platform/Windows-MSVC-C.cmake b/Modules/Platform/Windows-MSVC-C.cmake new file mode 100644 index 000000000..e81df9f83 --- /dev/null +++ b/Modules/Platform/Windows-MSVC-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-MSVC) +__windows_compiler_msvc(C) diff --git a/Modules/Platform/Windows-MSVC-CXX.cmake b/Modules/Platform/Windows-MSVC-CXX.cmake new file mode 100644 index 000000000..fdd1dae05 --- /dev/null +++ b/Modules/Platform/Windows-MSVC-CXX.cmake @@ -0,0 +1,3 @@ +include(Platform/Windows-MSVC) +set(_COMPILE_CXX " /TP") +__windows_compiler_msvc(CXX) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake new file mode 100644 index 000000000..f9df6d8a6 --- /dev/null +++ b/Modules/Platform/Windows-MSVC.cmake @@ -0,0 +1,247 @@ + +#============================================================================= +# Copyright 2001-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_MSVC) + return() +endif() +set(__WINDOWS_MSVC 1) + +set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") +set(CMAKE_LINK_LIBRARY_FLAG "") +set(MSVC 1) + +# hack: if a new cmake (which uses CMAKE__LINKER) runs on an old build tree +# (where link was hardcoded) and where CMAKE_LINKER isn't in the cache +# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun) +# hardcode CMAKE_LINKER here to link, so it behaves as it did before, Alex +if(NOT DEFINED CMAKE_LINKER) + set(CMAKE_LINKER link) +endif() + +if(CMAKE_VERBOSE_MAKEFILE) + set(CMAKE_CL_NOLOGO) +else() + set(CMAKE_CL_NOLOGO "/nologo") +endif() + +set(WIN32 1) + +if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE") + set(CMAKE_CREATE_WIN32_EXE "/subsystem:windowsce /entry:WinMainCRTStartup") + set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /entry:mainACRTStartup") + set(WINCE 1) +else() + set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows") + set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console") +endif() + +if(CMAKE_GENERATOR MATCHES "Visual Studio 6") + set (CMAKE_NO_BUILD_TYPE 1) +endif() +if(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") + set (CMAKE_NO_BUILD_TYPE 1) + set (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING + "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") + mark_as_advanced(CMAKE_CONFIGURATION_TYPES) +endif() + +# make sure to enable languages after setting configuration types +enable_language(RC) +set(CMAKE_COMPILE_RESOURCE "rc /fo ") + +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") + set(MSVC_IDE 1) +else() + set(MSVC_IDE 0) +endif() + +if(NOT MSVC_VERSION) + if(CMAKE_C_COMPILER_VERSION) + set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) + else() + set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION}) + endif() + if("${_compiler_version}" MATCHES "^([0-9]+)\\.([0-9]+)") + math(EXPR MSVC_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}") + else() + message(FATAL_ERROR "MSVC compiler version not detected properly: ${_compiler_version}") + endif() + + set(MSVC10) + set(MSVC11) + set(MSVC60) + set(MSVC70) + set(MSVC71) + set(MSVC80) + set(MSVC90) + set(CMAKE_COMPILER_2005) + set(CMAKE_COMPILER_SUPPORTS_PDBTYPE) + if(NOT "${_compiler_version}" VERSION_LESS 17) + set(MSVC11 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 16) + set(MSVC10 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 15) + set(MSVC90 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 14) + set(MSVC80 1) + set(CMAKE_COMPILER_2005 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 13.10) + set(MSVC71 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 13) + set(MSVC70 1) + else() + set(MSVC60 1) + set(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + endif() +endif() + +if(MSVC_C_ARCHITECTURE_ID MATCHES 64 OR MSVC_CXX_ARCHITECTURE_ID MATCHES 64) + set(CMAKE_CL_64 1) +else() + set(CMAKE_CL_64 0) +endif() +if(CMAKE_FORCE_WIN64 OR CMAKE_FORCE_IA64) + set(CMAKE_CL_64 1) +endif() + +if("${MSVC_VERSION}" GREATER 1599) + set(MSVC_INCREMENTAL_DEFAULT ON) +endif() + +# default to Debug builds +set(CMAKE_BUILD_TYPE_INIT Debug) + +if(WINCE) + string(TOUPPER "${MSVC_C_ARCHITECTURE_ID}" _MSVC_C_ARCHITECTURE_ID_UPPER) + string(TOUPPER "${MSVC_CXX_ARCHITECTURE_ID}" _MSVC_CXX_ARCHITECTURE_ID_UPPER) + + if("${CMAKE_SYSTEM_VERSION}" MATCHES "^([0-9]+)\\.([0-9]+)") + math(EXPR _CE_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}") + elseif("${CMAKE_SYSTEM_VERSION}" STREQUAL "") + set(_CE_VERSION "500") + else() + message(FATAL_ERROR "Invalid Windows CE version: ${CMAKE_SYSTEM_VERSION}") + endif() + + set(_PLATFORM_DEFINES "/D_WIN32_WCE=0x${_CE_VERSION} /DUNDER_CE") + set(_PLATFORM_DEFINES_C " /D${MSVC_C_ARCHITECTURE_ID} /D_${_MSVC_C_ARCHITECTURE_ID_UPPER}_") + set(_PLATFORM_DEFINES_CXX " /D${MSVC_CXX_ARCHITECTURE_ID} /D_${_MSVC_CXX_ARCHITECTURE_ID_UPPER}_") + + set(_RTC1 "") + set(_FLAGS_CXX " /GR /EHsc") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib") + set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib") +else() + set(_PLATFORM_DEFINES "/DWIN32") + + if(MSVC_VERSION GREATER 1310) + set(_RTC1 "/RTC1") + set(_FLAGS_CXX " /GR /EHsc") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib") + else() + set(_RTC1 "/GZ") + set(_FLAGS_CXX " /GR /GX") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + endif() + + if(MSVC_VERSION LESS 1310) + set(_FLAGS_C " /Zm1000${_FLAGS_C}") + set(_FLAGS_CXX " /Zm1000${_FLAGS_CXX}") + endif() +endif() + +set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +# executable linker flags +set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") +# set the machine type +set(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID}) +if(NOT _MACHINE_ARCH_FLAG) + set(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID}) +endif() +if(WINCE) + if(_MACHINE_ARCH_FLAG MATCHES "ARM") + set(_MACHINE_ARCH_FLAG "THUMB") + elseif(_MACHINE_ARCH_FLAG MATCHES "SH") + set(_MACHINE_ARCH_FLAG "SH4") + endif() +endif() +set (CMAKE_EXE_LINKER_FLAGS_INIT + "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${_MACHINE_ARCH_FLAG}") + +# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype +# on versions that support it +set( MSVC_INCREMENTAL_YES_FLAG "") +if(NOT MSVC_INCREMENTAL_DEFAULT) + set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES") +else() + set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" ) +endif() + +if (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}") + set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}") +else () + set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}") + set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}") +endif () +# for release and minsize release default to no incremental linking +set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO") +set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO") + +# copy the EXE_LINKER flags to SHARED and MODULE linker flags +# shared linker flags +set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) +# module linker flags +set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) + +macro(__windows_compiler_msvc lang) + if(NOT "${CMAKE_${lang}_COMPILER_VERSION}" VERSION_LESS 14) + # for 2005 make sure the manifest is put in the dll with mt + set(_CMAKE_VS_LINK_DLL " -E vs_link_dll ") + set(_CMAKE_VS_LINK_EXE " -E vs_link_exe ") + endif() + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "${_CMAKE_VS_LINK_DLL} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll /version:. ${CMAKE_END_TEMP_FILE}") + + set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY " /lib ${CMAKE_CL_NOLOGO} /out: ") + + set(CMAKE_${lang}_COMPILE_OBJECT + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo /Fd -c ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} -E ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /FoNUL /FAs /Fa /c ${CMAKE_END_TEMP_FILE}") + + set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link") + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) + set(CMAKE_${lang}_LINK_EXECUTABLE + "${_CMAKE_VS_LINK_EXE} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /Fd /link /implib: /version:. ${CMAKE_END_TEMP_FILE}") + + set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") +endmacro() diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake deleted file mode 100644 index be6abb690..000000000 --- a/Modules/Platform/Windows-cl.cmake +++ /dev/null @@ -1,253 +0,0 @@ -# try to load any previously computed information for C on this platform -INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL) -# try to load any previously computed information for CXX on this platform -INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL) - -SET(WIN32 1) - -INCLUDE(Platform/cl) - -SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) -SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) - -IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") - SET (CMAKE_NO_BUILD_TYPE 1) -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") -IF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") - SET (CMAKE_NO_BUILD_TYPE 1) - SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING - "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") - MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES) -ENDIF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") -# does the compiler support pdbtype and is it the newer compiler -IF(CMAKE_GENERATOR MATCHES "Visual Studio 8") - SET(CMAKE_COMPILER_2005 1) -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8") - -# make sure to enable languages after setting configuration types -ENABLE_LANGUAGE(RC) -SET(CMAKE_COMPILE_RESOURCE "rc /fo ") - -# for nmake we need to compute some information about the compiler -# that is being used. -# the compiler may be free command line, 6, 7, or 71, and -# each have properties that must be determined. -# to avoid running these tests with each cmake run, the -# test results are saved in CMakeCPlatform.cmake, a file -# that is automatically copied into try_compile directories -# by the global generator. -SET(MSVC_IDE 1) -IF(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") - SET(MSVC_IDE 0) - IF(NOT CMAKE_VC_COMPILER_TESTS_RUN) - SET(CMAKE_VC_COMPILER_TESTS 1) - SET(testNmakeCLVersionFile - "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") - STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") - MESSAGE(STATUS "Check for CL compiler version") - SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER}) - IF (NOT CMAKE_C_COMPILER) - SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER}) - ENDIF(NOT CMAKE_C_COMPILER) - EXEC_PROGRAM(${CMAKE_TEST_COMPILER} - ARGS /nologo -EP \"${testNmakeCLVersionFile}\" - OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT - RETURN_VALUE CMAKE_COMPILER_RETURN - ) - IF(NOT CMAKE_COMPILER_RETURN) - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining the version of compiler passed with the following output:\n" - "${CMAKE_COMPILER_OUTPUT}\n\n") - STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") - STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" - compilerVersion "${compilerVersion}") - MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}") - SET(MSVC60) - SET(MSVC70) - SET(MSVC71) - SET(MSVC80) - SET(CMAKE_COMPILER_2005) - IF("${compilerVersion}" LESS 1300) - SET(MSVC60 1) - SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) - ENDIF("${compilerVersion}" LESS 1300) - IF("${compilerVersion}" EQUAL 1300) - SET(MSVC70 1) - SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) - ENDIF("${compilerVersion}" EQUAL 1300) - IF("${compilerVersion}" EQUAL 1310) - SET(MSVC71 1) - SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) - ENDIF("${compilerVersion}" EQUAL 1310) - IF("${compilerVersion}" EQUAL 1400) - SET(MSVC80 1) - SET(CMAKE_COMPILER_2005 1) - ENDIF("${compilerVersion}" EQUAL 1400) - IF("${compilerVersion}" EQUAL 1500) - SET(MSVC90 1) - ENDIF("${compilerVersion}" EQUAL 1500) - IF("${compilerVersion}" EQUAL 1600) - SET(MSVC10 1) - ENDIF("${compilerVersion}" EQUAL 1600) - SET(MSVC_VERSION "${compilerVersion}") - ELSE(NOT CMAKE_COMPILER_RETURN) - MESSAGE(STATUS "Check for CL compiler version - failed") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining the version of compiler failed with the following output:\n" - "${CMAKE_COMPILER_OUTPUT}\n\n") - ENDIF(NOT CMAKE_COMPILER_RETURN) - # try to figure out if we are running the free command line - # tools from Microsoft. These tools do not provide debug libraries, - # so the link flags used have to be different. - MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2") - SET(testForFreeVCFile - "${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx") - STRING(REGEX REPLACE "/" "\\\\" testForFreeVCFile "${testForFreeVCFile}") - MESSAGE(STATUS "Check if this is a free VC compiler") - EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2 - ARGS /nologo /MD /EHsc - \"${testForFreeVCFile}\" - OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT - RETURN_VALUE CMAKE_COMPILER_RETURN - ) - IF(CMAKE_COMPILER_RETURN) - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if this is a free VC compiler failed with the following output:\n" - "${CMAKE_COMPILER_OUTPUT}\n\n") - MESSAGE(STATUS "Check if this is a free VC compiler - yes") - SET(CMAKE_USING_VC_FREE_TOOLS 1) - ELSE(CMAKE_COMPILER_RETURN) - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if this is a free VC compiler passed with the following output:\n" - "${CMAKE_COMPILER_OUTPUT}\n\n") - MESSAGE(STATUS "Check if this is a free VC compiler - no") - SET(CMAKE_USING_VC_FREE_TOOLS 0) - ENDIF(CMAKE_COMPILER_RETURN) - MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3") - ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN) -ENDIF(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") - -IF(MSVC_C_ARCHITECTURE_ID MATCHES 64) - SET(CMAKE_CL_64 1) -ELSE(MSVC_C_ARCHITECTURE_ID MATCHES 64) - SET(CMAKE_CL_64 0) -ENDIF(MSVC_C_ARCHITECTURE_ID MATCHES 64) -IF(CMAKE_FORCE_WIN64 OR CMAKE_FORCE_IA64) - SET(CMAKE_CL_64 1) -ENDIF(CMAKE_FORCE_WIN64 OR CMAKE_FORCE_IA64) - -IF("${MSVC_VERSION}" GREATER 1599) - SET(MSVC_INCREMENTAL_DEFAULT ON) -ENDIF() - -# default to Debug builds -IF(MSVC_VERSION GREATER 1310) - # for 2005 make sure the manifest is put in the dll with mt - SET(CMAKE_CXX_CREATE_SHARED_LIBRARY " -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") - SET(CMAKE_CXX_CREATE_SHARED_MODULE " -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}") - # create a C shared library - SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") - # create a C shared module just copy the shared library rule - SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") - SET(CMAKE_CXX_LINK_EXECUTABLE " -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}") - SET(CMAKE_C_LINK_EXECUTABLE " -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}") - - SET(CMAKE_BUILD_TYPE_INIT Debug) - SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR") - SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") - SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") - SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") - SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") - SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") - SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ") - SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}") -ELSE(MSVC_VERSION GREATER 1310) - IF(CMAKE_USING_VC_FREE_TOOLS) - MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available") - SET(CMAKE_BUILD_TYPE_INIT Release) - SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") - SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") - SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") - SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") - SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") - SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") - SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") - SET (CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") - SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") - ELSE(CMAKE_USING_VC_FREE_TOOLS) - SET(CMAKE_BUILD_TYPE_INIT Debug) - SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") - SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") - SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") - SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") - SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") - SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") - SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - ENDIF(CMAKE_USING_VC_FREE_TOOLS) - SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") -ENDIF(MSVC_VERSION GREATER 1310) - -SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") - -# executable linker flags -SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") -# set the stack size and the machine type -SET(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID}) -IF(NOT _MACHINE_ARCH_FLAG) - SET(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID}) -ENDIF(NOT _MACHINE_ARCH_FLAG) -SET (CMAKE_EXE_LINKER_FLAGS_INIT - "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}") - -# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype -# on versions that support it -SET( MSVC_INCREMENTAL_YES_FLAG "") -IF(NOT MSVC_INCREMENTAL_DEFAULT) - SET( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES") -ELSE() - SET( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" ) -ENDIF() - -IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}") - SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}") -ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}") - SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}") -ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) -# for release and minsize release default to no incremental linking -SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO") -SET(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO") - -# copy the EXE_LINKER flags to SHARED and MODULE linker flags -# shared linker flags -SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) -# module linker flags -SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) - -# save computed information for this platform -IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") - CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCPlatform.cmake IMMEDIATE) -ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") - -IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") - CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE) -ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") diff --git a/Modules/Platform/Windows-cl.cmake.in b/Modules/Platform/Windows-cl.cmake.in deleted file mode 100644 index 82a0e595f..000000000 --- a/Modules/Platform/Windows-cl.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -SET(CMAKE_VC_COMPILER_TESTS_RUN 1) -SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE @CMAKE_COMPILER_SUPPORTS_PDBTYPE@) -SET(CMAKE_COMPILER_2005 @CMAKE_COMPILER_2005@) -SET(CMAKE_USING_VC_FREE_TOOLS @CMAKE_USING_VC_FREE_TOOLS@) -SET(CMAKE_CL_64 @CMAKE_CL_64@) -SET(MSVC60 @MSVC60@) -SET(MSVC70 @MSVC70@) -SET(MSVC71 @MSVC71@) -SET(MSVC80 @MSVC80@) -SET(MSVC90 @MSVC90@) -SET(MSVC10 @MSVC10@) -SET(MSVC_IDE @MSVC_IDE@) -SET(MSVC_VERSION @MSVC_VERSION@) -SET(WIN32 1) diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake index f5046bf35..7e2ac9fe4 100644 --- a/Modules/Platform/Windows-df.cmake +++ b/Modules/Platform/Windows-df.cmake @@ -1,70 +1,71 @@ # compiler support for fortran CVF compiler on windows -SET(CMAKE_WINDOWS_OBJECT_PATH 1) -SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") -SET(CMAKE_LINK_LIBRARY_FLAG "") -SET(WIN32 1) -IF(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO) -ELSE(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO "/nologo") -ENDIF(CMAKE_VERBOSE_MAKEFILE) +set(CMAKE_WINDOWS_OBJECT_PATH 1) +set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") +set(CMAKE_LINK_LIBRARY_FLAG "") +set(WIN32 1) +if(CMAKE_VERBOSE_MAKEFILE) + set(CMAKE_CL_NOLOGO) +else() + set(CMAKE_CL_NOLOGO "/nologo") +endif() -SET(CMAKE_Fortran_MODDIR_FLAG "-module:") +set(CMAKE_Fortran_MODDIR_FLAG "-module:") -SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY +set(CMAKE_Fortran_CREATE_SHARED_LIBRARY "link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /dll ${CMAKE_END_TEMP_FILE}") -SET(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY}) +set(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY}) # create a C++ static library -SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} /out: ") +set(CMAKE_Fortran_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} /out: ") # compile a C++ file into an object file -SET(CMAKE_Fortran_COMPILE_OBJECT +set(CMAKE_Fortran_COMPILE_OBJECT " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /object: /compile_only ${CMAKE_END_TEMP_FILE}") -SET(CMAKE_COMPILE_RESOURCE "rc /fo ") +set(CMAKE_COMPILE_RESOURCE "rc /fo ") -SET(CMAKE_Fortran_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /exe: /link ${CMAKE_END_TEMP_FILE}") +set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link") +set(CMAKE_Fortran_LINK_EXECUTABLE + " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /exe: /link ${CMAKE_END_TEMP_FILE}") -SET(CMAKE_CREATE_WIN32_EXE /winapp) -SET(CMAKE_CREATE_CONSOLE_EXE ) +set(CMAKE_CREATE_WIN32_EXE /winapp) +set(CMAKE_CREATE_CONSOLE_EXE ) -IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") - SET (CMAKE_NO_BUILD_TYPE 1) -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") -IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") - SET (CMAKE_NO_BUILD_TYPE 1) - SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING +if(CMAKE_GENERATOR MATCHES "Visual Studio 6") + set (CMAKE_NO_BUILD_TYPE 1) +endif() +if(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") + set (CMAKE_NO_BUILD_TYPE 1) + set (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") +endif() # does the compiler support pdbtype and is it the newer compiler -SET(CMAKE_BUILD_TYPE_INIT Debug) -SET (CMAKE_Fortran_FLAGS_INIT "") -SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full") -SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/Optimize:2 /Define:NDEBUG") -SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/Optimize:1 /Define:NDEBUG") -SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/Optimize:1 /debug:full /Define:NDEBUG") +set(CMAKE_BUILD_TYPE_INIT Debug) +set (CMAKE_Fortran_FLAGS_INIT "") +set (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full") +set (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/Optimize:2 /Define:NDEBUG") +set (CMAKE_Fortran_FLAGS_RELEASE_INIT "/Optimize:1 /Define:NDEBUG") +set (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/Optimize:1 /debug:full /Define:NDEBUG") -SET (CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") +set (CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") # executable linker flags -SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") -SET (CMAKE_EXE_LINKER_FLAGS_INIT " /INCREMENTAL:YES") -IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept") - SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept") -ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") - SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") -ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) +set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") +set (CMAKE_EXE_LINKER_FLAGS_INIT " /INCREMENTAL:YES") +if (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept") + set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept") +else () + set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") + set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") +endif () -SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index 14b3b81d5..8a03b2972 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -1,122 +1,109 @@ -SET(CMAKE_LIBRARY_PATH_FLAG "libpath ") -SET(CMAKE_LINK_LIBRARY_FLAG "library ") -SET(CMAKE_LINK_LIBRARY_FILE_FLAG "library") - -IF(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_WCL_QUIET) - SET(CMAKE_WLINK_QUIET) - SET(CMAKE_LIB_QUIET) -ELSE(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_WCL_QUIET "-zq") - SET(CMAKE_WLINK_QUIET "option quiet") - SET(CMAKE_LIB_QUIET "-q") -ENDIF(CMAKE_VERBOSE_MAKEFILE) +set(CMAKE_LIBRARY_PATH_FLAG "libpath ") +set(CMAKE_LINK_LIBRARY_FLAG "library ") +set(CMAKE_LINK_LIBRARY_FILE_FLAG "library") + +if(CMAKE_VERBOSE_MAKEFILE) + set(CMAKE_WCL_QUIET) + set(CMAKE_WLINK_QUIET) + set(CMAKE_LIB_QUIET) +else() + set(CMAKE_WCL_QUIET "-zq") + set(CMAKE_WLINK_QUIET "option quiet") + set(CMAKE_LIB_QUIET "-q") +endif() set(CMAKE_CREATE_WIN32_EXE "system nt_win" ) -SET(CMAKE_CREATE_CONSOLE_EXE "system nt" ) +set(CMAKE_CREATE_CONSOLE_EXE "system nt" ) -SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "debug all" ) -SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT "debug all" ) -SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" ) -SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" ) +set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "debug all" ) +set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT "debug all" ) +set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" ) +set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" ) set(CMAKE_C_COMPILE_OPTIONS_DLL "-bd") # Note: This variable is a ';' separated list set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated string. -SET(CMAKE_RC_COMPILER "rc" ) - -SET(CMAKE_BUILD_TYPE_INIT Debug) -SET (CMAKE_CXX_FLAGS_INIT "-w=3 -xs") -SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-br -bm -d2") -SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG") -SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") -SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") -SET (CMAKE_C_FLAGS_INIT "-w=3 ") -SET (CMAKE_C_FLAGS_DEBUG_INIT "-br -bm -d2 -od") -SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG") -SET (CMAKE_C_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") -SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") -SET (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib library kernel32.lib library user32.lib library gdi32.lib library winspool.lib library comdlg32.lib library advapi32.lib library shell32.lib library ole32.lib library oleaut32.lib library uuid.lib library odbc32.lib library odbccp32.lib") -SET (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") - -SET(CMAKE_C_CREATE_IMPORT_LIBRARY +set(CMAKE_RC_COMPILER "rc" ) + +set(CMAKE_BUILD_TYPE_INIT Debug) +set (CMAKE_CXX_FLAGS_INIT "-w=3 -xs") +set (CMAKE_CXX_FLAGS_DEBUG_INIT "-br -bm -d2") +set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG") +set (CMAKE_CXX_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") +set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") +set (CMAKE_C_FLAGS_INIT "-w=3 ") +set (CMAKE_C_FLAGS_DEBUG_INIT "-br -bm -d2 -od") +set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG") +set (CMAKE_C_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") +set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") +set (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib library kernel32.lib library user32.lib library gdi32.lib library winspool.lib library comdlg32.lib library advapi32.lib library shell32.lib library ole32.lib library oleaut32.lib library uuid.lib library odbc32.lib library odbccp32.lib") +set (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +set(CMAKE_C_CREATE_IMPORT_LIBRARY "wlib -c -q -n -b +''") -SET(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) +set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) -SET(CMAKE_C_LINK_EXECUTABLE +set(CMAKE_C_LINK_EXECUTABLE "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '' option caseexact file {} ${CMAKE_END_TEMP_FILE}") -SET(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) +set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) # compile a C++ file into an object file -SET(CMAKE_CXX_COMPILE_OBJECT +set(CMAKE_CXX_COMPILE_OBJECT " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -dWIN32 -d+ -fo -c -cc++ ${CMAKE_END_TEMP_FILE}") # compile a C file into an object file -SET(CMAKE_C_COMPILE_OBJECT +set(CMAKE_C_COMPILE_OBJECT " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -dWIN32 -d+ -fo -c -cc ${CMAKE_END_TEMP_FILE}") # preprocess a C source file -SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -dWIN32 -d+ -fo -pl -cc ${CMAKE_END_TEMP_FILE}") # preprocess a C++ source file -SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -dWIN32 -d+ -fo -pl -cc++ ${CMAKE_END_TEMP_FILE}") -SET(CMAKE_CXX_CREATE_SHARED_MODULE +set(CMAKE_CXX_CREATE_SHARED_MODULE "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '' option caseexact file {} ${CMAKE_END_TEMP_FILE}") -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY +set(CMAKE_CXX_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_MODULE} ${CMAKE_CXX_CREATE_IMPORT_LIBRARY}) # create a C shared library -SET(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) +set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) # create a C shared module -SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE}) +set(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE}) # create a C++ static library -SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b '' ") +set(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b '' ") # create a C static library -SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) - -IF(NOT CMAKE_WATCOM_COMPILER_TESTS_RUN) - SET(CMAKE_WATCOM_COMPILER_TESTS_RUN 1) - SET(testWatcomVersionFile - "${CMAKE_ROOT}/Modules/CMakeTestWatcomVersion.c") - STRING(REGEX REPLACE "/" "\\\\" testWatcomVersionFile "${testWatcomVersionFile}") - MESSAGE(STATUS "Check for Watcom compiler version") - SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER}) - IF (NOT CMAKE_C_COMPILER) - SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER}) - ENDIF() - EXECUTE_PROCESS(COMMAND ${CMAKE_TEST_COMPILER} - -q -pc \"${testWatcomVersionFile}\" - OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT - RESULT_VARIABLE CMAKE_COMPILER_RETURN - ) - STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") - STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" - compilerVersion "${compilerVersion}") - IF("${CMAKE_COMPILER_RETURN}" STREQUAL "0") - SET(WATCOM16) - SET(WATCOM17) - SET(WATCOM18) - SET(WATCOM19) - IF("${compilerVersion}" LESS 1270) - SET(WATCOM16 1) - ENDIF() - IF("${compilerVersion}" EQUAL 1270) - SET(WATCOM17 1) - ENDIF() - IF("${compilerVersion}" EQUAL 1280) - SET(WATCOM18 1) - ENDIF() - IF("${compilerVersion}" EQUAL 1290) - SET(WATCOM19 1) - ENDIF() - ENDIF() -ENDIF() +set(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) + +if(NOT _CMAKE_WATCOM_VERSION) + set(_CMAKE_WATCOM_VERSION 1) + if(CMAKE_C_COMPILER_VERSION) + set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) + else() + set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION}) + endif() + set(WATCOM16) + set(WATCOM17) + set(WATCOM18) + set(WATCOM19) + if("${_compiler_version}" LESS 12.70) + set(WATCOM16 1) + endif() + if("${_compiler_version}" EQUAL 12.70) + set(WATCOM17 1) + endif() + if("${_compiler_version}" EQUAL 12.80) + set(WATCOM18 1) + endif() + if("${_compiler_version}" EQUAL 12.90) + set(WATCOM19 1) + endif() +endif() diff --git a/Modules/Platform/Windows-windres.cmake b/Modules/Platform/Windows-windres.cmake index 8bc1b15e9..01d6be3df 100644 --- a/Modules/Platform/Windows-windres.cmake +++ b/Modules/Platform/Windows-windres.cmake @@ -1 +1 @@ -SET(CMAKE_RC_COMPILE_OBJECT " -O coff ") +set(CMAKE_RC_COMPILE_OBJECT " -O coff ") diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake index 09cb8d303..b158a9dfb 100644 --- a/Modules/Platform/Windows.cmake +++ b/Modules/Platform/Windows.cmake @@ -1,36 +1,36 @@ -SET(WIN32 1) +set(WIN32 1) -SET(CMAKE_STATIC_LIBRARY_PREFIX "") -SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") -SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so -SET(CMAKE_IMPORT_LIBRARY_PREFIX "") -SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib") -SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe -SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib") -SET(CMAKE_DL_LIBS "") +set(CMAKE_STATIC_LIBRARY_PREFIX "") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +set(CMAKE_SHARED_LIBRARY_PREFIX "") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so +set(CMAKE_IMPORT_LIBRARY_PREFIX "") +set(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib") +set(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe +set(CMAKE_LINK_LIBRARY_SUFFIX ".lib") +set(CMAKE_DL_LIBS "") -SET(CMAKE_FIND_LIBRARY_PREFIXES "") -SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") +set(CMAKE_FIND_LIBRARY_PREFIXES "") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") # for borland make long command lines are redirected to a file # with the following syntax, see Windows-bcc32.cmake for use -IF(CMAKE_GENERATOR MATCHES "Borland") - SET(CMAKE_START_TEMP_FILE "@&&|\n") - SET(CMAKE_END_TEMP_FILE "\n|") -ENDIF(CMAKE_GENERATOR MATCHES "Borland") +if(CMAKE_GENERATOR MATCHES "Borland") + set(CMAKE_START_TEMP_FILE "@&&|\n") + set(CMAKE_END_TEMP_FILE "\n|") +endif() # for nmake make long command lines are redirected to a file # with the following syntax, see Windows-bcc32.cmake for use -IF(CMAKE_GENERATOR MATCHES "NMake") - SET(CMAKE_START_TEMP_FILE "@<<\n") - SET(CMAKE_END_TEMP_FILE "\n<<") -ENDIF(CMAKE_GENERATOR MATCHES "NMake") +if(CMAKE_GENERATOR MATCHES "NMake") + set(CMAKE_START_TEMP_FILE "@<<\n") + set(CMAKE_END_TEMP_FILE "\n<<") +endif() -INCLUDE(Platform/WindowsPaths) +include(Platform/WindowsPaths) # uncomment these out to debug nmake and borland makefiles -#SET(CMAKE_START_TEMP_FILE "") -#SET(CMAKE_END_TEMP_FILE "") -#SET(CMAKE_VERBOSE_MAKEFILE 1) +#set(CMAKE_START_TEMP_FILE "") +#set(CMAKE_END_TEMP_FILE "") +#set(CMAKE_VERBOSE_MAKEFILE 1) diff --git a/Modules/Platform/WindowsCE-MSVC-C.cmake b/Modules/Platform/WindowsCE-MSVC-C.cmake new file mode 100644 index 000000000..ce8060bed --- /dev/null +++ b/Modules/Platform/WindowsCE-MSVC-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-C) diff --git a/Modules/Platform/WindowsCE-MSVC-CXX.cmake b/Modules/Platform/WindowsCE-MSVC-CXX.cmake new file mode 100644 index 000000000..281eadc10 --- /dev/null +++ b/Modules/Platform/WindowsCE-MSVC-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-CXX) diff --git a/Modules/Platform/WindowsCE-MSVC.cmake b/Modules/Platform/WindowsCE-MSVC.cmake new file mode 100644 index 000000000..d28b4aba0 --- /dev/null +++ b/Modules/Platform/WindowsCE-MSVC.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC) diff --git a/Modules/Platform/WindowsCE.cmake b/Modules/Platform/WindowsCE.cmake new file mode 100644 index 000000000..65b2eaed4 --- /dev/null +++ b/Modules/Platform/WindowsCE.cmake @@ -0,0 +1 @@ +include(Platform/Windows) diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake index c7b15b342..bd31da021 100644 --- a/Modules/Platform/WindowsPaths.cmake +++ b/Modules/Platform/WindowsPaths.cmake @@ -17,10 +17,10 @@ # "CMakeSystemSpecificInformation.cmake" already included it. # The extra inclusion is a work-around documented next to the include() # call, so this can be removed when the work-around is removed. -IF(__WINDOWS_PATHS_INCLUDED) - RETURN() -ENDIF() -SET(__WINDOWS_PATHS_INCLUDED 1) +if(__WINDOWS_PATHS_INCLUDED) + return() +endif() +set(__WINDOWS_PATHS_INCLUDED 1) # Add the program-files folder(s) to the list of installation # prefixes. @@ -42,39 +42,39 @@ SET(__WINDOWS_PATHS_INCLUDED 1) # ENV{ProgramFiles(x86)} = # ENV{ProgramFiles} = [C:\Program Files (x86)] # ENV{ProgramW6432} = [C:\Program Files] -IF(DEFINED "ENV{ProgramW6432}") +if(DEFINED "ENV{ProgramW6432}") # 32-bit binary on 64-bit windows. # The 64-bit program files are in ProgramW6432. - LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramW6432}") + list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramW6432}") # The 32-bit program files are in ProgramFiles. - IF(DEFINED "ENV{ProgramFiles}") - LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}") - ENDIF() -ELSE() + if(DEFINED "ENV{ProgramFiles}") + list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}") + endif() +else() # 64-bit binary, or 32-bit binary on 32-bit windows. - IF(DEFINED "ENV{ProgramFiles}") - LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}") - ENDIF() - IF(DEFINED "ENV{ProgramFiles(x86)}") + if(DEFINED "ENV{ProgramFiles}") + list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}") + endif() + if(DEFINED "ENV{ProgramFiles(x86)}") # 64-bit binary. 32-bit program files are in ProgramFiles(x86). - LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles(x86)}") - ELSEIF(DEFINED "ENV{SystemDrive}") + list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles(x86)}") + elseif(DEFINED "ENV{SystemDrive}") # Guess the 32-bit program files location. - IF(EXISTS "$ENV{SystemDrive}/Program Files (x86)") - LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH + if(EXISTS "$ENV{SystemDrive}/Program Files (x86)") + list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{SystemDrive}/Program Files (x86)") - ENDIF() - ENDIF() -ENDIF() + endif() + endif() +endif() # Add the CMake install location. -GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH) -GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH) -LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "${_CMAKE_INSTALL_DIR}") +get_filename_component(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH) +get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH) +list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${_CMAKE_INSTALL_DIR}") # Add other locations. -LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH +list(APPEND CMAKE_SYSTEM_PREFIX_PATH # Project install destination. "${CMAKE_INSTALL_PREFIX}" @@ -82,15 +82,15 @@ LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH / ) -LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH +list(APPEND CMAKE_SYSTEM_INCLUDE_PATH ) # mingw can also link against dlls which can also be in /bin, so list this too -LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH +list(APPEND CMAKE_SYSTEM_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/bin" "${_CMAKE_INSTALL_DIR}/bin" /bin ) -LIST(APPEND CMAKE_SYSTEM_PROGRAM_PATH +list(APPEND CMAKE_SYSTEM_PROGRAM_PATH ) diff --git a/Modules/Platform/Xenix.cmake b/Modules/Platform/Xenix.cmake index cf9d17bfd..47852f8e1 100644 --- a/Modules/Platform/Xenix.cmake +++ b/Modules/Platform/Xenix.cmake @@ -1,2 +1,2 @@ -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) diff --git a/Modules/Platform/cl.cmake b/Modules/Platform/cl.cmake deleted file mode 100644 index c0f014b58..000000000 --- a/Modules/Platform/cl.cmake +++ /dev/null @@ -1,62 +0,0 @@ -SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") -SET(CMAKE_LINK_LIBRARY_FLAG "") -SET(MSVC 1) - -# hack: if a new cmake (which uses CMAKE__LINKER) runs on an old build tree -# (where link was hardcoded) and where CMAKE_LINKER isn't in the cache -# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun) -# hardcode CMAKE_LINKER here to link, so it behaves as it did before, Alex -IF(NOT DEFINED CMAKE_LINKER) - SET(CMAKE_LINKER link) -ENDIF(NOT DEFINED CMAKE_LINKER) - -IF(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO) -ELSE(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO "/nologo") -ENDIF(CMAKE_VERBOSE_MAKEFILE) -# create a shared C++ library -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll /version:. ${CMAKE_END_TEMP_FILE}") -SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) - -# create a C shared library -SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") - -# create a C shared module -SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") - -# create a C++ static library -SET(CMAKE_CXX_CREATE_STATIC_LIBRARY " /lib ${CMAKE_CL_NOLOGO} /out: ") - -# create a C static library -SET(CMAKE_C_CREATE_STATIC_LIBRARY "${CMAKE_CXX_CREATE_STATIC_LIBRARY}") - -# compile a C++ file into an object file -SET(CMAKE_CXX_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP /Fo /Fd -c ${CMAKE_END_TEMP_FILE}") - -# compile a C file into an object file -SET(CMAKE_C_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /Fo /Fd -c ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) -SET(CMAKE_C_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /Fd -link /implib: /version:. ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) -SET(CMAKE_CXX_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /Fd -link /implib: /version:. ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE - " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} -E ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE - " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP -E ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_C_CREATE_ASSEMBLY_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /FAs /FoNUL /Fa /c ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP /FAs /FoNUL /Fa /c ${CMAKE_END_TEMP_FILE}") - diff --git a/Modules/Platform/eCos.cmake b/Modules/Platform/eCos.cmake index b437c1a9b..a20382692 100644 --- a/Modules/Platform/eCos.cmake +++ b/Modules/Platform/eCos.cmake @@ -1,65 +1,65 @@ # support for eCos http://ecos.sourceware.org # Guard against multiple inclusion, which e.g. leads to multiple calls to add_definition() #12987 -IF(__ECOS_CMAKE_INCLUDED) - RETURN() -ENDIF() -SET(__ECOS_CMAKE_INCLUDED TRUE) +if(__ECOS_CMAKE_INCLUDED) + return() +endif() +set(__ECOS_CMAKE_INCLUDED TRUE) -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty +set(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty -SET(CMAKE_LINK_LIBRARY_SUFFIX "") -SET(CMAKE_STATIC_LIBRARY_PREFIX "lib") -SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a") -SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a -SET(CMAKE_EXECUTABLE_SUFFIX ".elf") # same suffix as if built using UseEcos.cmake -SET(CMAKE_DL_LIBS "" ) +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a +set(CMAKE_EXECUTABLE_SUFFIX ".elf") # same suffix as if built using UseEcos.cmake +set(CMAKE_DL_LIBS "" ) -SET(CMAKE_FIND_LIBRARY_PREFIXES "lib") -SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) # eCos can be built only with gcc -GET_PROPERTY(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE) -IF(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) - MESSAGE(FATAL_ERROR "GNU gcc is required for eCos") -ENDIF(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) -IF(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) - MESSAGE(FATAL_ERROR "GNU g++ is required for eCos") -ENDIF(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) +get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE) +if(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) + message(FATAL_ERROR "GNU gcc is required for eCos") +endif() +if(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) + message(FATAL_ERROR "GNU g++ is required for eCos") +endif() # find eCos system files -FIND_PATH(ECOS_SYSTEM_CONFIG_HEADER_PATH NAMES pkgconf/system.h) -FIND_LIBRARY(ECOS_SYSTEM_TARGET_LIBRARY NAMES libtarget.a) +find_path(ECOS_SYSTEM_CONFIG_HEADER_PATH NAMES pkgconf/system.h) +find_library(ECOS_SYSTEM_TARGET_LIBRARY NAMES libtarget.a) -IF(NOT ECOS_SYSTEM_CONFIG_HEADER_PATH) - MESSAGE(FATAL_ERROR "Could not find eCos pkgconf/system.h. Build eCos first and set up CMAKE_FIND_ROOT_PATH correctly.") -ENDIF(NOT ECOS_SYSTEM_CONFIG_HEADER_PATH) +if(NOT ECOS_SYSTEM_CONFIG_HEADER_PATH) + message(FATAL_ERROR "Could not find eCos pkgconf/system.h. Build eCos first and set up CMAKE_FIND_ROOT_PATH correctly.") +endif() -IF(NOT ECOS_SYSTEM_TARGET_LIBRARY) - MESSAGE(FATAL_ERROR "Could not find eCos \"libtarget.a\". Build eCos first and set up CMAKE_FIND_ROOT_PATH correctly.") -ENDIF(NOT ECOS_SYSTEM_TARGET_LIBRARY) +if(NOT ECOS_SYSTEM_TARGET_LIBRARY) + message(FATAL_ERROR "Could not find eCos \"libtarget.a\". Build eCos first and set up CMAKE_FIND_ROOT_PATH correctly.") +endif() -GET_FILENAME_COMPONENT(ECOS_LIBTARGET_DIRECTORY "${ECOS_SYSTEM_TARGET_LIBRARY}" PATH) -INCLUDE_DIRECTORIES(${ECOS_SYSTEM_CONFIG_HEADER_PATH}) -ADD_DEFINITIONS(-D__ECOS__=1 -D__ECOS=1) +get_filename_component(ECOS_LIBTARGET_DIRECTORY "${ECOS_SYSTEM_TARGET_LIBRARY}" PATH) +include_directories(${ECOS_SYSTEM_CONFIG_HEADER_PATH}) +add_definitions(-D__ECOS__=1 -D__ECOS=1) # special link commands for eCos executables -SET(CMAKE_CXX_LINK_EXECUTABLE " -o -nostdlib -nostartfiles -L${ECOS_LIBTARGET_DIRECTORY} -Ttarget.ld ") -SET(CMAKE_C_LINK_EXECUTABLE " -o -nostdlib -nostartfiles -L${ECOS_LIBTARGET_DIRECTORY} -Ttarget.ld ") +set(CMAKE_CXX_LINK_EXECUTABLE " -o -nostdlib -nostartfiles -L${ECOS_LIBTARGET_DIRECTORY} -Ttarget.ld ") +set(CMAKE_C_LINK_EXECUTABLE " -o -nostdlib -nostartfiles -L${ECOS_LIBTARGET_DIRECTORY} -Ttarget.ld ") # eCos doesn't support shared libs -SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) -SET(CMAKE_CXX_LINK_SHARED_LIBRARY ) -SET(CMAKE_CXX_LINK_MODULE_LIBRARY ) -SET(CMAKE_C_LINK_SHARED_LIBRARY ) -SET(CMAKE_C_LINK_MODULE_LIBRARY ) +set(CMAKE_CXX_LINK_SHARED_LIBRARY ) +set(CMAKE_CXX_LINK_MODULE_LIBRARY ) +set(CMAKE_C_LINK_SHARED_LIBRARY ) +set(CMAKE_C_LINK_MODULE_LIBRARY ) diff --git a/Modules/Platform/gas.cmake b/Modules/Platform/gas.cmake index c34aef17a..7d2bc8454 100644 --- a/Modules/Platform/gas.cmake +++ b/Modules/Platform/gas.cmake @@ -1,19 +1,19 @@ -IF(UNIX) - SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o) -ELSE(UNIX) - SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .obj) -ENDIF(UNIX) +if(UNIX) + set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o) +else() + set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .obj) +endif() -SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o ") +set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o ") -SET(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY +set(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY " cr " " ") -SET(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE +set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE " -o ") # to be done -SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY) -SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE) +set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY) +set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE) diff --git a/Modules/Platform/kFreeBSD.cmake b/Modules/Platform/kFreeBSD.cmake index c1295fb0d..c1db2594d 100644 --- a/Modules/Platform/kFreeBSD.cmake +++ b/Modules/Platform/kFreeBSD.cmake @@ -1,4 +1,4 @@ # kFreeBSD looks just like Linux. -INCLUDE(Platform/Linux) +include(Platform/Linux) -SET(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-kfreebsd-gnu[a-z0-9_]*") +set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-kfreebsd-gnu[a-z0-9_]*") diff --git a/Modules/Platform/syllable.cmake b/Modules/Platform/syllable.cmake index 2d11d08b3..69c108db0 100644 --- a/Modules/Platform/syllable.cmake +++ b/Modules/Platform/syllable.cmake @@ -9,25 +9,25 @@ # @bindir@/. and @bindir@/../lib are in DLL_PATH -SET(CMAKE_DL_LIBS "dl") -SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") -SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib -SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -#SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") +set(CMAKE_DL_LIBS "dl") +set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") +set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +#set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") # Initialize C link type selection flags. These flags are used when # building a shared library, shared module, or executable that links # to other libraries to select whether to use the static or shared # versions of the libraries. -FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") -ENDFOREACH(type) +foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") +endforeach() -INCLUDE(Platform/UnixPaths) +include(Platform/UnixPaths) # these are Syllable specific: -LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH /usr/indexes) +list(APPEND CMAKE_SYSTEM_PREFIX_PATH /usr/indexes) diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake index eff4766b1..0d1dfda16 100644 --- a/Modules/ProcessorCount.cmake +++ b/Modules/ProcessorCount.cmake @@ -57,6 +57,7 @@ function(ProcessorCount var) # Mac, FreeBSD, OpenBSD (systems with sysctl): find_program(ProcessorCount_cmd_sysctl sysctl PATHS /usr/sbin /sbin) + mark_as_advanced(ProcessorCount_cmd_sysctl) if(ProcessorCount_cmd_sysctl) execute_process(COMMAND ${ProcessorCount_cmd_sysctl} -n hw.ncpu ERROR_QUIET @@ -69,6 +70,7 @@ function(ProcessorCount var) if(NOT count) # Linux (systems with getconf): find_program(ProcessorCount_cmd_getconf getconf) + mark_as_advanced(ProcessorCount_cmd_getconf) if(ProcessorCount_cmd_getconf) execute_process(COMMAND ${ProcessorCount_cmd_getconf} _NPROCESSORS_ONLN ERROR_QUIET @@ -82,6 +84,7 @@ function(ProcessorCount var) # HPUX (systems with machinfo): find_program(ProcessorCount_cmd_machinfo machinfo PATHS /usr/contrib/bin) + mark_as_advanced(ProcessorCount_cmd_machinfo) if(ProcessorCount_cmd_machinfo) execute_process(COMMAND ${ProcessorCount_cmd_machinfo} ERROR_QUIET @@ -97,6 +100,7 @@ function(ProcessorCount var) # IRIX (systems with hinv): find_program(ProcessorCount_cmd_hinv hinv PATHS /sbin) + mark_as_advanced(ProcessorCount_cmd_hinv) if(ProcessorCount_cmd_hinv) execute_process(COMMAND ${ProcessorCount_cmd_hinv} ERROR_QUIET @@ -112,6 +116,7 @@ function(ProcessorCount var) # AIX (systems with lsconf): find_program(ProcessorCount_cmd_lsconf lsconf PATHS /usr/sbin) + mark_as_advanced(ProcessorCount_cmd_lsconf) if(ProcessorCount_cmd_lsconf) execute_process(COMMAND ${ProcessorCount_cmd_lsconf} ERROR_QUIET @@ -126,6 +131,7 @@ function(ProcessorCount var) if(NOT count) # QNX (systems with pidin): find_program(ProcessorCount_cmd_pidin pidin) + mark_as_advanced(ProcessorCount_cmd_pidin) if(ProcessorCount_cmd_pidin) execute_process(COMMAND ${ProcessorCount_cmd_pidin} info ERROR_QUIET @@ -140,6 +146,7 @@ function(ProcessorCount var) if(NOT count) # Sun (systems where uname -X emits "NumCPU" in its output): find_program(ProcessorCount_cmd_uname uname) + mark_as_advanced(ProcessorCount_cmd_uname) if(ProcessorCount_cmd_uname) execute_process(COMMAND ${ProcessorCount_cmd_uname} -X ERROR_QUIET diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake index 10af3bc95..6db5da18a 100644 --- a/Modules/Qt4ConfigDependentSettings.cmake +++ b/Modules/Qt4ConfigDependentSettings.cmake @@ -16,7 +16,7 @@ ############################################### # -# configuration/system dependent settings +# configuration/system dependent settings # ############################################### @@ -26,270 +26,270 @@ # if a user needs the dependencies, and they couldn't be found, they can set # the variables themselves. -SET(QT_QTGUI_LIB_DEPENDENCIES "") -SET(QT_QTCORE_LIB_DEPENDENCIES "") -SET(QT_QTNETWORK_LIB_DEPENDENCIES "") -SET(QT_QTOPENGL_LIB_DEPENDENCIES "") -SET(QT_QTDBUS_LIB_DEPENDENCIES "") -SET(QT_QTHELP_LIB_DEPENDENCIES ${QT_QTCLUCENE_LIBRARY}) +set(QT_QTGUI_LIB_DEPENDENCIES "") +set(QT_QTCORE_LIB_DEPENDENCIES "") +set(QT_QTNETWORK_LIB_DEPENDENCIES "") +set(QT_QTOPENGL_LIB_DEPENDENCIES "") +set(QT_QTDBUS_LIB_DEPENDENCIES "") +set(QT_QTHELP_LIB_DEPENDENCIES ${QT_QTCLUCENE_LIBRARY}) -IF(Q_WS_WIN) +if(Q_WS_WIN) # On Windows, qconfig.pri has "shared" for shared library builds - IF(NOT QT_CONFIG MATCHES "shared") - SET(QT_IS_STATIC 1) - ENDIF(NOT QT_CONFIG MATCHES "shared") -ELSE(Q_WS_WIN) + if(NOT QT_CONFIG MATCHES "shared") + set(QT_IS_STATIC 1) + endif() +else() # On other platforms, check file extension to know if its static - IF(QT_QTCORE_LIBRARY_RELEASE) - GET_FILENAME_COMPONENT(qtcore_lib_ext "${QT_QTCORE_LIBRARY_RELEASE}" EXT) - IF("${qtcore_lib_ext}" STREQUAL "${CMAKE_STATIC_LIBRARY_SUFFIX}") - SET(QT_IS_STATIC 1) - ENDIF("${qtcore_lib_ext}" STREQUAL "${CMAKE_STATIC_LIBRARY_SUFFIX}") - ENDIF(QT_QTCORE_LIBRARY_RELEASE) - IF(QT_QTCORE_LIBRARY_DEBUG) - GET_FILENAME_COMPONENT(qtcore_lib_ext "${QT_QTCORE_LIBRARY_DEBUG}" EXT) - IF(${qtcore_lib_ext} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX}) - SET(QT_IS_STATIC 1) - ENDIF(${qtcore_lib_ext} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX}) - ENDIF(QT_QTCORE_LIBRARY_DEBUG) -ENDIF(Q_WS_WIN) + if(QT_QTCORE_LIBRARY_RELEASE) + get_filename_component(qtcore_lib_ext "${QT_QTCORE_LIBRARY_RELEASE}" EXT) + if("${qtcore_lib_ext}" STREQUAL "${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(QT_IS_STATIC 1) + endif() + endif() + if(QT_QTCORE_LIBRARY_DEBUG) + get_filename_component(qtcore_lib_ext "${QT_QTCORE_LIBRARY_DEBUG}" EXT) + if(${qtcore_lib_ext} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(QT_IS_STATIC 1) + endif() + endif() +endif() # build using shared Qt needs -DQT_DLL on Windows -IF(Q_WS_WIN AND NOT QT_IS_STATIC) - SET(QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_DLL) -ENDIF(Q_WS_WIN AND NOT QT_IS_STATIC) +if(Q_WS_WIN AND NOT QT_IS_STATIC) + set(QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_DLL) +endif() -IF(NOT QT_IS_STATIC) - RETURN() -ENDIF(NOT QT_IS_STATIC) +if(NOT QT_IS_STATIC) + return() +endif() # QtOpenGL dependencies find_package(OpenGL) -SET (QT_QTOPENGL_LIB_DEPENDENCIES ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY}) +set (QT_QTOPENGL_LIB_DEPENDENCIES ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY}) ## system png -IF(QT_QCONFIG MATCHES "system-png") +if(QT_QCONFIG MATCHES "system-png") find_package(PNG) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${PNG_LIBRARY}) -ENDIF(QT_QCONFIG MATCHES "system-png") + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${PNG_LIBRARY}) +endif() ## system jpeg -IF(QT_QCONFIG MATCHES "system-jpeg") +if(QT_QCONFIG MATCHES "system-jpeg") find_package(JPEG) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${JPEG_LIBRARIES}) -ENDIF(QT_QCONFIG MATCHES "system-jpeg") + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${JPEG_LIBRARIES}) +endif() ## system tiff -IF(QT_QCONFIG MATCHES "system-tiff") +if(QT_QCONFIG MATCHES "system-tiff") find_package(TIFF) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${TIFF_LIBRARIES}) -ENDIF(QT_QCONFIG MATCHES "system-tiff") + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${TIFF_LIBRARIES}) +endif() ## system mng -IF(QT_QCONFIG MATCHES "system-mng") +if(QT_QCONFIG MATCHES "system-mng") find_library(MNG_LIBRARY NAMES mng) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${MNG_LIBRARY}) -ENDIF(QT_QCONFIG MATCHES "system-mng") + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${MNG_LIBRARY}) +endif() # for X11, get X11 library directory -IF(Q_WS_X11) - FIND_PACKAGE(X11) -ENDIF(Q_WS_X11) +if(Q_WS_X11) + find_package(X11) +endif() ## X11 SM -IF(QT_QCONFIG MATCHES "x11sm") - IF(X11_SM_LIB AND X11_ICE_LIB) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_SM_LIB} ${X11_ICE_LIB}) - ENDIF(X11_SM_LIB AND X11_ICE_LIB) -ENDIF(QT_QCONFIG MATCHES "x11sm") +if(QT_QCONFIG MATCHES "x11sm") + if(X11_SM_LIB AND X11_ICE_LIB) + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_SM_LIB} ${X11_ICE_LIB}) + endif() +endif() ## Xi -IF(QT_QCONFIG MATCHES "tablet") - IF(X11_Xi_LIB) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xi_LIB}) - ENDIF(X11_Xi_LIB) -ENDIF(QT_QCONFIG MATCHES "tablet") +if(QT_QCONFIG MATCHES "tablet") + if(X11_Xi_LIB) + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xi_LIB}) + endif() +endif() ## Xrender -IF(QT_QCONFIG MATCHES "xrender") - IF(X11_Xrender_LIB) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xrender_LIB}) - ENDIF(X11_Xrender_LIB) -ENDIF(QT_QCONFIG MATCHES "xrender") +if(QT_QCONFIG MATCHES "xrender") + if(X11_Xrender_LIB) + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xrender_LIB}) + endif() +endif() ## Xrandr -IF(QT_QCONFIG MATCHES "xrandr") - IF(X11_Xrandr_LIB) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xrandr_LIB}) - ENDIF(X11_Xrandr_LIB) -ENDIF(QT_QCONFIG MATCHES "xrandr") +if(QT_QCONFIG MATCHES "xrandr") + if(X11_Xrandr_LIB) + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xrandr_LIB}) + endif() +endif() ## Xcursor -IF(QT_QCONFIG MATCHES "xcursor") - IF(X11_Xcursor_LIB) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xcursor_LIB}) - ENDIF(X11_Xcursor_LIB) -ENDIF(QT_QCONFIG MATCHES "xcursor") +if(QT_QCONFIG MATCHES "xcursor") + if(X11_Xcursor_LIB) + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xcursor_LIB}) + endif() +endif() ## Xinerama -IF(QT_QCONFIG MATCHES "xinerama") - IF(X11_Xinerama_LIB) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xinerama_LIB}) - ENDIF(X11_Xinerama_LIB) -ENDIF(QT_QCONFIG MATCHES "xinerama") +if(QT_QCONFIG MATCHES "xinerama") + if(X11_Xinerama_LIB) + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xinerama_LIB}) + endif() +endif() ## Xfixes -IF(QT_QCONFIG MATCHES "xfixes") - IF(X11_Xfixes_LIB) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xfixes_LIB}) - ENDIF(X11_Xfixes_LIB) -ENDIF(QT_QCONFIG MATCHES "xfixes") +if(QT_QCONFIG MATCHES "xfixes") + if(X11_Xfixes_LIB) + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xfixes_LIB}) + endif() +endif() ## fontconfig -IF(QT_QCONFIG MATCHES "fontconfig") - FIND_LIBRARY(QT_FONTCONFIG_LIBRARY NAMES fontconfig) - MARK_AS_ADVANCED(QT_FONTCONFIG_LIBRARY) - IF(QT_FONTCONFIG_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FONTCONFIG_LIBRARY}) - ENDIF(QT_FONTCONFIG_LIBRARY) -ENDIF(QT_QCONFIG MATCHES "fontconfig") +if(QT_QCONFIG MATCHES "fontconfig") + find_library(QT_FONTCONFIG_LIBRARY NAMES fontconfig) + mark_as_advanced(QT_FONTCONFIG_LIBRARY) + if(QT_FONTCONFIG_LIBRARY) + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FONTCONFIG_LIBRARY}) + endif() +endif() ## system-freetype -IF(QT_QCONFIG MATCHES "system-freetype") +if(QT_QCONFIG MATCHES "system-freetype") find_package(Freetype) if(FREETYPE_LIBRARIES) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${FREETYPE_LIBRARIES}) - endif(FREETYPE_LIBRARIES) -ENDIF(QT_QCONFIG MATCHES "system-freetype") + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${FREETYPE_LIBRARIES}) + endif() +endif() ## system-zlib -IF(QT_QCONFIG MATCHES "system-zlib") +if(QT_QCONFIG MATCHES "system-zlib") find_package(ZLIB) - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${ZLIB_LIBRARIES}) -ENDIF(QT_QCONFIG MATCHES "system-zlib") + set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${ZLIB_LIBRARIES}) +endif() ## openssl -IF(NOT Q_WS_WIN) - SET(_QT_NEED_OPENSSL 0) - IF(QT_VERSION_MINOR LESS 4 AND QT_QCONFIG MATCHES "openssl") - SET(_QT_NEED_OPENSSL 1) - ENDIF(QT_VERSION_MINOR LESS 4 AND QT_QCONFIG MATCHES "openssl") - IF(QT_VERSION_MINOR GREATER 3 AND QT_QCONFIG MATCHES "openssl-linked") - SET(_QT_NEED_OPENSSL 1) - ENDIF(QT_VERSION_MINOR GREATER 3 AND QT_QCONFIG MATCHES "openssl-linked") - IF(_QT_NEED_OPENSSL) - FIND_PACKAGE(OpenSSL) - IF(OPENSSL_LIBRARIES) - SET(QT_QTNETWORK_LIB_DEPENDENCIES ${QT_QTNETWORK_LIB_DEPENDENCIES} ${OPENSSL_LIBRARIES}) - ENDIF(OPENSSL_LIBRARIES) - ENDIF(_QT_NEED_OPENSSL) -ENDIF(NOT Q_WS_WIN) +if(NOT Q_WS_WIN) + set(_QT_NEED_OPENSSL 0) + if(QT_VERSION_MINOR LESS 4 AND QT_QCONFIG MATCHES "openssl") + set(_QT_NEED_OPENSSL 1) + endif() + if(QT_VERSION_MINOR GREATER 3 AND QT_QCONFIG MATCHES "openssl-linked") + set(_QT_NEED_OPENSSL 1) + endif() + if(_QT_NEED_OPENSSL) + find_package(OpenSSL) + if(OPENSSL_LIBRARIES) + set(QT_QTNETWORK_LIB_DEPENDENCIES ${QT_QTNETWORK_LIB_DEPENDENCIES} ${OPENSSL_LIBRARIES}) + endif() + endif() +endif() ## dbus -IF(QT_QCONFIG MATCHES "dbus") +if(QT_QCONFIG MATCHES "dbus") - FIND_LIBRARY(QT_DBUS_LIBRARY NAMES dbus-1 ) - IF(QT_DBUS_LIBRARY) - SET(QT_QTDBUS_LIB_DEPENDENCIES ${QT_QTDBUS_LIB_DEPENDENCIES} ${QT_DBUS_LIBRARY}) - ENDIF(QT_DBUS_LIBRARY) - MARK_AS_ADVANCED(QT_DBUS_LIBRARY) + find_library(QT_DBUS_LIBRARY NAMES dbus-1 ) + if(QT_DBUS_LIBRARY) + set(QT_QTDBUS_LIB_DEPENDENCIES ${QT_QTDBUS_LIB_DEPENDENCIES} ${QT_DBUS_LIBRARY}) + endif() + mark_as_advanced(QT_DBUS_LIBRARY) -ENDIF(QT_QCONFIG MATCHES "dbus") +endif() ## glib -IF(QT_QCONFIG MATCHES "glib") +if(QT_QCONFIG MATCHES "glib") # Qt 4.2.0+ uses glib-2.0 - FIND_LIBRARY(QT_GLIB_LIBRARY NAMES glib-2.0 ) - FIND_LIBRARY(QT_GTHREAD_LIBRARY NAMES gthread-2.0 ) - MARK_AS_ADVANCED(QT_GLIB_LIBRARY) - MARK_AS_ADVANCED(QT_GTHREAD_LIBRARY) + find_library(QT_GLIB_LIBRARY NAMES glib-2.0 ) + find_library(QT_GTHREAD_LIBRARY NAMES gthread-2.0 ) + mark_as_advanced(QT_GLIB_LIBRARY) + mark_as_advanced(QT_GTHREAD_LIBRARY) - IF(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY) - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} + if(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY) + set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_GTHREAD_LIBRARY} ${QT_GLIB_LIBRARY}) - ENDIF(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY) + endif() # Qt 4.5+ also links to gobject-2.0 - IF(QT_VERSION_MINOR GREATER 4) - FIND_LIBRARY(QT_GOBJECT_LIBRARY NAMES gobject-2.0 PATHS ${_glib_query_output} ) - MARK_AS_ADVANCED(QT_GOBJECT_LIBRARY) + if(QT_VERSION_MINOR GREATER 4) + find_library(QT_GOBJECT_LIBRARY NAMES gobject-2.0 PATHS ${_glib_query_output} ) + mark_as_advanced(QT_GOBJECT_LIBRARY) - IF(QT_GOBJECT_LIBRARY) - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} + if(QT_GOBJECT_LIBRARY) + set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_GOBJECT_LIBRARY}) - ENDIF(QT_GOBJECT_LIBRARY) - ENDIF(QT_VERSION_MINOR GREATER 4) + endif() + endif() -ENDIF(QT_QCONFIG MATCHES "glib") +endif() ## clock-monotonic, just see if we need to link with rt -IF(QT_QCONFIG MATCHES "clock-monotonic") - SET(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) - SET(CMAKE_REQUIRED_LIBRARIES rt) +if(QT_QCONFIG MATCHES "clock-monotonic") + set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) + set(CMAKE_REQUIRED_LIBRARIES rt) CHECK_SYMBOL_EXISTS(_POSIX_TIMERS "unistd.h;time.h" QT_POSIX_TIMERS) - SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) - IF(QT_POSIX_TIMERS) - FIND_LIBRARY(QT_RT_LIBRARY NAMES rt) - MARK_AS_ADVANCED(QT_RT_LIBRARY) - IF(QT_RT_LIBRARY) - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_RT_LIBRARY}) - ENDIF(QT_RT_LIBRARY) - ENDIF(QT_POSIX_TIMERS) -ENDIF(QT_QCONFIG MATCHES "clock-monotonic") - - -IF(Q_WS_X11) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) + if(QT_POSIX_TIMERS) + find_library(QT_RT_LIBRARY NAMES rt) + mark_as_advanced(QT_RT_LIBRARY) + if(QT_RT_LIBRARY) + set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_RT_LIBRARY}) + endif() + endif() +endif() + + +if(Q_WS_X11) # X11 libraries Qt always depends on - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xext_LIB} ${X11_X11_LIB}) + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xext_LIB} ${X11_X11_LIB}) set(CMAKE_THREAD_PREFER_PTHREADS 1) find_package(Threads) if(CMAKE_USE_PTHREADS_INIT) - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT}) - endif(CMAKE_USE_PTHREADS_INIT) + set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT}) + endif() - SET (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_DL_LIBS}) + set (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_DL_LIBS}) -ENDIF(Q_WS_X11) +endif() -IF(Q_WS_WIN) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} imm32 winmm) - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ws2_32) -ENDIF(Q_WS_WIN) +if(Q_WS_WIN) + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} imm32 winmm) + set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ws2_32) +endif() -IF(Q_WS_MAC) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework Carbon") +if(Q_WS_MAC) + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework Carbon") # Qt 4.0, 4.1, 4.2 use QuickTime - IF(QT_VERSION_MINOR LESS 3) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework QuickTime") - ENDIF(QT_VERSION_MINOR LESS 3) + if(QT_VERSION_MINOR LESS 3) + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework QuickTime") + endif() # Qt 4.2+ use AppKit - IF(QT_VERSION_MINOR GREATER 1) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework AppKit") - ENDIF(QT_VERSION_MINOR GREATER 1) + if(QT_VERSION_MINOR GREATER 1) + set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework AppKit") + endif() - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} "-framework ApplicationServices") -ENDIF(Q_WS_MAC) + set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} "-framework ApplicationServices") +endif() diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 68f3c8085..251d57c3d 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -21,322 +21,324 @@ ###################################### -MACRO (QT4_EXTRACT_OPTIONS _qt4_files _qt4_options) - SET(${_qt4_files}) - SET(${_qt4_options}) - SET(_QT4_DOING_OPTIONS FALSE) - FOREACH(_currentArg ${ARGN}) - IF ("${_currentArg}" STREQUAL "OPTIONS") - SET(_QT4_DOING_OPTIONS TRUE) - ELSE ("${_currentArg}" STREQUAL "OPTIONS") - IF(_QT4_DOING_OPTIONS) - LIST(APPEND ${_qt4_options} "${_currentArg}") - ELSE(_QT4_DOING_OPTIONS) - LIST(APPEND ${_qt4_files} "${_currentArg}") - ENDIF(_QT4_DOING_OPTIONS) - ENDIF ("${_currentArg}" STREQUAL "OPTIONS") - ENDFOREACH(_currentArg) -ENDMACRO (QT4_EXTRACT_OPTIONS) +macro (QT4_EXTRACT_OPTIONS _qt4_files _qt4_options) + set(${_qt4_files}) + set(${_qt4_options}) + set(_QT4_DOING_OPTIONS FALSE) + foreach(_currentArg ${ARGN}) + if ("${_currentArg}" STREQUAL "OPTIONS") + set(_QT4_DOING_OPTIONS TRUE) + else () + if(_QT4_DOING_OPTIONS) + list(APPEND ${_qt4_options} "${_currentArg}") + else() + list(APPEND ${_qt4_files} "${_currentArg}") + endif() + endif () + endforeach() +endmacro () # macro used to create the names of output files preserving relative dirs -MACRO (QT4_MAKE_OUTPUT_FILE infile prefix ext outfile ) - STRING(LENGTH ${CMAKE_CURRENT_BINARY_DIR} _binlength) - STRING(LENGTH ${infile} _infileLength) - SET(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR}) - IF(_infileLength GREATER _binlength) - STRING(SUBSTRING "${infile}" 0 ${_binlength} _checkinfile) - IF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") - FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_BINARY_DIR} ${infile}) - ELSE(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") - FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile}) - ENDIF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") - ELSE(_infileLength GREATER _binlength) - FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile}) - ENDIF(_infileLength GREATER _binlength) - IF(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path - STRING(REGEX REPLACE "^([a-zA-Z]):(.*)$" "\\1_\\2" rel "${rel}") - ENDIF(WIN32 AND rel MATCHES "^[a-zA-Z]:") - SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}") - STRING(REPLACE ".." "__" _outfile ${_outfile}) - GET_FILENAME_COMPONENT(outpath ${_outfile} PATH) - GET_FILENAME_COMPONENT(_outfile ${_outfile} NAME_WE) - FILE(MAKE_DIRECTORY ${outpath}) - SET(${outfile} ${outpath}/${prefix}${_outfile}.${ext}) -ENDMACRO (QT4_MAKE_OUTPUT_FILE ) - - -MACRO (QT4_GET_MOC_FLAGS _moc_flags) - SET(${_moc_flags}) - GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES) - - FOREACH(_current ${_inc_DIRS}) - IF("${_current}" MATCHES "\\.framework/?$") - STRING(REGEX REPLACE "/[^/]+\\.framework" "" framework_path "${_current}") - SET(${_moc_flags} ${${_moc_flags}} "-F${framework_path}") - ELSE("${_current}" MATCHES "\\.framework/?$") - SET(${_moc_flags} ${${_moc_flags}} "-I${_current}") - ENDIF("${_current}" MATCHES "\\.framework/?$") - ENDFOREACH(_current ${_inc_DIRS}) - - GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS) - FOREACH(_current ${_defines}) - SET(${_moc_flags} ${${_moc_flags}} "-D${_current}") - ENDFOREACH(_current ${_defines}) - - IF(Q_WS_WIN) - SET(${_moc_flags} ${${_moc_flags}} -DWIN32) - ENDIF(Q_WS_WIN) - -ENDMACRO(QT4_GET_MOC_FLAGS) +macro (QT4_MAKE_OUTPUT_FILE infile prefix ext outfile ) + string(LENGTH ${CMAKE_CURRENT_BINARY_DIR} _binlength) + string(LENGTH ${infile} _infileLength) + set(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR}) + if(_infileLength GREATER _binlength) + string(SUBSTRING "${infile}" 0 ${_binlength} _checkinfile) + if(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") + file(RELATIVE_PATH rel ${CMAKE_CURRENT_BINARY_DIR} ${infile}) + else() + file(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile}) + endif() + else() + file(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile}) + endif() + if(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path + string(REGEX REPLACE "^([a-zA-Z]):(.*)$" "\\1_\\2" rel "${rel}") + endif() + set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}") + string(REPLACE ".." "__" _outfile ${_outfile}) + get_filename_component(outpath ${_outfile} PATH) + get_filename_component(_outfile ${_outfile} NAME_WE) + file(MAKE_DIRECTORY ${outpath}) + set(${outfile} ${outpath}/${prefix}${_outfile}.${ext}) +endmacro () + + +macro (QT4_GET_MOC_FLAGS _moc_flags) + set(${_moc_flags}) + get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES) + + foreach(_current ${_inc_DIRS}) + if("${_current}" MATCHES "\\.framework/?$") + string(REGEX REPLACE "/[^/]+\\.framework" "" framework_path "${_current}") + set(${_moc_flags} ${${_moc_flags}} "-F${framework_path}") + else() + set(${_moc_flags} ${${_moc_flags}} "-I${_current}") + endif() + endforeach() + + get_directory_property(_defines COMPILE_DEFINITIONS) + foreach(_current ${_defines}) + set(${_moc_flags} ${${_moc_flags}} "-D${_current}") + endforeach() + + if(Q_WS_WIN) + set(${_moc_flags} ${${_moc_flags}} -DWIN32) + endif() + +endmacro() # helper macro to set up a moc rule -MACRO (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options) +macro (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options) # For Windows, create a parameters file to work around command line length limit - IF (WIN32) + if (WIN32) # Pass the parameters in a file. Set the working directory to # be that containing the parameters file and reference it by # just the file name. This is necessary because the moc tool on # MinGW builds does not seem to handle spaces in the path to the # file given with the @ syntax. - GET_FILENAME_COMPONENT(_moc_outfile_name "${outfile}" NAME) - GET_FILENAME_COMPONENT(_moc_outfile_dir "${outfile}" PATH) - IF(_moc_outfile_dir) - SET(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir}) - ENDIF(_moc_outfile_dir) - SET (_moc_parameters_file ${outfile}_parameters) - SET (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}") - STRING (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}") - FILE (WRITE ${_moc_parameters_file} "${_moc_parameters}") - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + get_filename_component(_moc_outfile_name "${outfile}" NAME) + get_filename_component(_moc_outfile_dir "${outfile}" PATH) + if(_moc_outfile_dir) + set(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir}) + endif() + set (_moc_parameters_file ${outfile}_parameters) + set (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}") + string (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}") + file (WRITE ${_moc_parameters_file} "${_moc_parameters}") + add_custom_command(OUTPUT ${outfile} COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters DEPENDS ${infile} ${_moc_working_dir} VERBATIM) - ELSE (WIN32) - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + else () + add_custom_command(OUTPUT ${outfile} COMMAND ${QT_MOC_EXECUTABLE} ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile} DEPENDS ${infile} VERBATIM) - ENDIF (WIN32) -ENDMACRO (QT4_CREATE_MOC_COMMAND) + endif () +endmacro () -MACRO (QT4_GENERATE_MOC infile outfile ) +macro (QT4_GENERATE_MOC infile outfile ) # get include dirs and flags QT4_GET_MOC_FLAGS(moc_flags) - GET_FILENAME_COMPONENT(abs_infile ${infile} ABSOLUTE) - SET(_outfile "${outfile}") - IF(NOT IS_ABSOLUTE "${outfile}") - SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") - ENDIF(NOT IS_ABSOLUTE "${outfile}") + get_filename_component(abs_infile ${infile} ABSOLUTE) + set(_outfile "${outfile}") + if(NOT IS_ABSOLUTE "${outfile}") + set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") + endif() QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "") - SET_SOURCE_FILES_PROPERTIES(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file -ENDMACRO (QT4_GENERATE_MOC) + set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file +endmacro () # QT4_WRAP_CPP(outfiles inputfile ... ) -MACRO (QT4_WRAP_CPP outfiles ) +macro (QT4_WRAP_CPP outfiles ) # get include dirs QT4_GET_MOC_FLAGS(moc_flags) QT4_EXTRACT_OPTIONS(moc_files moc_options ${ARGN}) - FOREACH (it ${moc_files}) - GET_FILENAME_COMPONENT(it ${it} ABSOLUTE) + foreach (it ${moc_files}) + get_filename_component(it ${it} ABSOLUTE) QT4_MAKE_OUTPUT_FILE(${it} moc_ cxx outfile) QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}") - SET(${outfiles} ${${outfiles}} ${outfile}) - ENDFOREACH(it) + set(${outfiles} ${${outfiles}} ${outfile}) + endforeach() -ENDMACRO (QT4_WRAP_CPP) +endmacro () # QT4_WRAP_UI(outfiles inputfile ... ) -MACRO (QT4_WRAP_UI outfiles ) +macro (QT4_WRAP_UI outfiles ) QT4_EXTRACT_OPTIONS(ui_files ui_options ${ARGN}) - FOREACH (it ${ui_files}) - GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) - GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) - SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h) - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + foreach (it ${ui_files}) + get_filename_component(outfile ${it} NAME_WE) + get_filename_component(infile ${it} ABSOLUTE) + set(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h) + add_custom_command(OUTPUT ${outfile} COMMAND ${QT_UIC_EXECUTABLE} ARGS ${ui_options} -o ${outfile} ${infile} MAIN_DEPENDENCY ${infile} VERBATIM) - SET(${outfiles} ${${outfiles}} ${outfile}) - ENDFOREACH (it) + set(${outfiles} ${${outfiles}} ${outfile}) + endforeach () -ENDMACRO (QT4_WRAP_UI) +endmacro () # QT4_ADD_RESOURCES(outfiles inputfile ... ) -MACRO (QT4_ADD_RESOURCES outfiles ) +macro (QT4_ADD_RESOURCES outfiles ) QT4_EXTRACT_OPTIONS(rcc_files rcc_options ${ARGN}) - FOREACH (it ${rcc_files}) - GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE) - GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) - GET_FILENAME_COMPONENT(rc_path ${infile} PATH) - SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx) + foreach (it ${rcc_files}) + get_filename_component(outfilename ${it} NAME_WE) + get_filename_component(infile ${it} ABSOLUTE) + get_filename_component(rc_path ${infile} PATH) + set(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx) - SET(_RC_DEPENDS) - IF(EXISTS "${infile}") + set(_RC_DEPENDS) + if(EXISTS "${infile}") # parse file for dependencies # all files are absolute paths or relative to the location of the qrc file - FILE(READ "${infile}" _RC_FILE_CONTENTS) - STRING(REGEX MATCHALL "]*>" "" _RC_FILE "${_RC_FILE}") - IF(NOT IS_ABSOLUTE "${_RC_FILE}") - SET(_RC_FILE "${rc_path}/${_RC_FILE}") - ENDIF(NOT IS_ABSOLUTE "${_RC_FILE}") - SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}") - ENDFOREACH(_RC_FILE) + file(READ "${infile}" _RC_FILE_CONTENTS) + string(REGEX MATCHALL "]*>" "" _RC_FILE "${_RC_FILE}") + if(NOT IS_ABSOLUTE "${_RC_FILE}") + set(_RC_FILE "${rc_path}/${_RC_FILE}") + endif() + set(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}") + endforeach() + unset(_RC_FILES) + unset(_RC_FILE_CONTENTS) # Since this cmake macro is doing the dependency scanning for these files, # let's make a configured file and add it as a dependency so cmake is run # again when dependencies need to be recomputed. QT4_MAKE_OUTPUT_FILE("${infile}" "" "qrc.depends" out_depends) - CONFIGURE_FILE("${infile}" "${out_depends}" COPY_ONLY) - ELSE(EXISTS "${infile}") + configure_file("${infile}" "${out_depends}" COPY_ONLY) + else() # The .qrc file does not exist (yet). Let's add a dependency and hope # that it will be generated later - SET(out_depends) - ENDIF(EXISTS "${infile}") + set(out_depends) + endif() - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + add_custom_command(OUTPUT ${outfile} COMMAND ${QT_RCC_EXECUTABLE} ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile} MAIN_DEPENDENCY ${infile} DEPENDS ${_RC_DEPENDS} "${out_depends}" VERBATIM) - SET(${outfiles} ${${outfiles}} ${outfile}) - ENDFOREACH (it) + set(${outfiles} ${${outfiles}} ${outfile}) + endforeach () -ENDMACRO (QT4_ADD_RESOURCES) +endmacro () -MACRO(QT4_ADD_DBUS_INTERFACE _sources _interface _basename) - GET_FILENAME_COMPONENT(_infile ${_interface} ABSOLUTE) - SET(_header "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h") - SET(_impl "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp") - SET(_moc "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc") +macro(QT4_ADD_DBUS_INTERFACE _sources _interface _basename) + get_filename_component(_infile ${_interface} ABSOLUTE) + set(_header "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h") + set(_impl "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp") + set(_moc "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc") - GET_SOURCE_FILE_PROPERTY(_nonamespace ${_interface} NO_NAMESPACE) - IF(_nonamespace) - SET(_params -N -m) - ELSE(_nonamespace) - SET(_params -m) - ENDIF(_nonamespace) + get_source_file_property(_nonamespace ${_interface} NO_NAMESPACE) + if(_nonamespace) + set(_params -N -m) + else() + set(_params -m) + endif() - GET_SOURCE_FILE_PROPERTY(_classname ${_interface} CLASSNAME) - IF(_classname) - SET(_params ${_params} -c ${_classname}) - ENDIF(_classname) + get_source_file_property(_classname ${_interface} CLASSNAME) + if(_classname) + set(_params ${_params} -c ${_classname}) + endif() - GET_SOURCE_FILE_PROPERTY(_include ${_interface} INCLUDE) - IF(_include) - SET(_params ${_params} -i ${_include}) - ENDIF(_include) + get_source_file_property(_include ${_interface} INCLUDE) + if(_include) + set(_params ${_params} -i ${_include}) + endif() - ADD_CUSTOM_COMMAND(OUTPUT "${_impl}" "${_header}" + add_custom_command(OUTPUT "${_impl}" "${_header}" COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} ${_params} -p ${_basename} ${_infile} DEPENDS ${_infile} VERBATIM) - SET_SOURCE_FILES_PROPERTIES("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) + set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) QT4_GENERATE_MOC("${_header}" "${_moc}") - LIST(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}") + list(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}") MACRO_ADD_FILE_DEPENDENCIES("${_impl}" "${_moc}") -ENDMACRO(QT4_ADD_DBUS_INTERFACE) +endmacro() -MACRO(QT4_ADD_DBUS_INTERFACES _sources) - FOREACH (_current_FILE ${ARGN}) - GET_FILENAME_COMPONENT(_infile ${_current_FILE} ABSOLUTE) - GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME) +macro(QT4_ADD_DBUS_INTERFACES _sources) + foreach (_current_FILE ${ARGN}) + get_filename_component(_infile ${_current_FILE} ABSOLUTE) + get_filename_component(_basename ${_current_FILE} NAME) # get the part before the ".xml" suffix - STRING(TOLOWER ${_basename} _basename) - STRING(REGEX REPLACE "(.*\\.)?([^\\.]+)\\.xml" "\\2" _basename ${_basename}) + string(TOLOWER ${_basename} _basename) + string(REGEX REPLACE "(.*\\.)?([^\\.]+)\\.xml" "\\2" _basename ${_basename}) QT4_ADD_DBUS_INTERFACE(${_sources} ${_infile} ${_basename}interface) - ENDFOREACH (_current_FILE) -ENDMACRO(QT4_ADD_DBUS_INTERFACES) + endforeach () +endmacro() -MACRO(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options ) +macro(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options ) QT4_EXTRACT_OPTIONS(_customName _qt4_dbus_options ${ARGN}) - GET_FILENAME_COMPONENT(_in_file ${_header} ABSOLUTE) - GET_FILENAME_COMPONENT(_basename ${_header} NAME_WE) + get_filename_component(_in_file ${_header} ABSOLUTE) + get_filename_component(_basename ${_header} NAME_WE) - IF (_customName) + if (_customName) if (IS_ABSOLUTE ${_customName}) get_filename_component(_containingDir ${_customName} PATH) if (NOT EXISTS ${_containingDir}) file(MAKE_DIRECTORY "${_containingDir}") endif() - SET(_target ${_customName}) + set(_target ${_customName}) else() - SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_customName}) + set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_customName}) endif() - ELSE (_customName) - SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.xml) - ENDIF (_customName) + else () + set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.xml) + endif () - ADD_CUSTOM_COMMAND(OUTPUT ${_target} + add_custom_command(OUTPUT ${_target} COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} ${_qt4_dbus_options} ${_in_file} -o ${_target} DEPENDS ${_in_file} VERBATIM ) -ENDMACRO(QT4_GENERATE_DBUS_INTERFACE) +endmacro() -MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optionalBasename _optionalClassName) - GET_FILENAME_COMPONENT(_infile ${_xml_file} ABSOLUTE) +macro(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optionalBasename _optionalClassName) + get_filename_component(_infile ${_xml_file} ABSOLUTE) - SET(_optionalBasename "${ARGV4}") - IF (_optionalBasename) - SET(_basename ${_optionalBasename} ) - ELSE (_optionalBasename) - STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2adaptor" _basename ${_infile}) - STRING(TOLOWER ${_basename} _basename) - ENDIF (_optionalBasename) + set(_optionalBasename "${ARGV4}") + if (_optionalBasename) + set(_basename ${_optionalBasename} ) + else () + string(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2adaptor" _basename ${_infile}) + string(TOLOWER ${_basename} _basename) + endif () - SET(_optionalClassName "${ARGV5}") - SET(_header "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h") - SET(_impl "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp") - SET(_moc "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc") + set(_optionalClassName "${ARGV5}") + set(_header "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h") + set(_impl "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp") + set(_moc "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc") - IF(_optionalClassName) - ADD_CUSTOM_COMMAND(OUTPUT "${_impl}" "${_header}" + if(_optionalClassName) + add_custom_command(OUTPUT "${_impl}" "${_header}" COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile} DEPENDS ${_infile} VERBATIM ) - ELSE(_optionalClassName) - ADD_CUSTOM_COMMAND(OUTPUT "${_impl}" "${_header}" + else() + add_custom_command(OUTPUT "${_impl}" "${_header}" COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile} DEPENDS ${_infile} VERBATIM ) - ENDIF(_optionalClassName) + endif() QT4_GENERATE_MOC("${_header}" "${_moc}") - SET_SOURCE_FILES_PROPERTIES("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) + set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) MACRO_ADD_FILE_DEPENDENCIES("${_impl}" "${_moc}") - LIST(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}") -ENDMACRO(QT4_ADD_DBUS_ADAPTOR) + list(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}") +endmacro() -MACRO(QT4_AUTOMOC) +macro(QT4_AUTOMOC) QT4_GET_MOC_FLAGS(_moc_INCS) - SET(_matching_FILES ) - FOREACH (_current_FILE ${ARGN}) + set(_matching_FILES ) + foreach (_current_FILE ${ARGN}) - GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. # This is required to make uic work correctly: # we need to add generated .cpp files to the sources (to compile them), @@ -344,98 +346,119 @@ MACRO(QT4_AUTOMOC) # cmake is run for the very first time on them -> however the .cpp files might # exist at a later run. at that time we need to skip them, so that we don't add two # different rules for the same moc file - GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC) + get_source_file_property(_skip ${_abs_FILE} SKIP_AUTOMOC) - IF ( NOT _skip AND EXISTS ${_abs_FILE} ) + if ( NOT _skip AND EXISTS ${_abs_FILE} ) - FILE(READ ${_abs_FILE} _contents) + file(READ ${_abs_FILE} _contents) - GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH) + get_filename_component(_abs_PATH ${_abs_FILE} PATH) - STRING(REGEX MATCHALL "# *include +[^ ]+\\.moc[\">]" _match "${_contents}") - IF(_match) - FOREACH (_current_MOC_INC ${_match}) - STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}") + string(REGEX MATCHALL "# *include +[^ ]+\\.moc[\">]" _match "${_contents}") + if(_match) + foreach (_current_MOC_INC ${_match}) + string(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}") - GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE) - IF(EXISTS ${_abs_PATH}/${_basename}.hpp) - SET(_header ${_abs_PATH}/${_basename}.hpp) - ELSE(EXISTS ${_abs_PATH}/${_basename}.hpp) - SET(_header ${_abs_PATH}/${_basename}.h) - ENDIF(EXISTS ${_abs_PATH}/${_basename}.hpp) - SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) + get_filename_component(_basename ${_current_MOC} NAME_WE) + if(EXISTS ${_abs_PATH}/${_basename}.hpp) + set(_header ${_abs_PATH}/${_basename}.hpp) + else() + set(_header ${_abs_PATH}/${_basename}.h) + endif() + set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) QT4_CREATE_MOC_COMMAND(${_header} ${_moc} "${_moc_INCS}" "") MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) - ENDFOREACH (_current_MOC_INC) - ENDIF(_match) - ENDIF ( NOT _skip AND EXISTS ${_abs_FILE} ) - ENDFOREACH (_current_FILE) -ENDMACRO(QT4_AUTOMOC) + endforeach () + endif() + endif () + endforeach () +endmacro() -MACRO(QT4_CREATE_TRANSLATION _qm_files) +macro(QT4_CREATE_TRANSLATION _qm_files) QT4_EXTRACT_OPTIONS(_lupdate_files _lupdate_options ${ARGN}) - SET(_my_sources) - SET(_my_dirs) - SET(_my_tsfiles) - SET(_ts_pro) - FOREACH (_file ${_lupdate_files}) - GET_FILENAME_COMPONENT(_ext ${_file} EXT) - GET_FILENAME_COMPONENT(_abs_FILE ${_file} ABSOLUTE) - IF(_ext MATCHES "ts") - LIST(APPEND _my_tsfiles ${_abs_FILE}) - ELSE(_ext MATCHES "ts") - IF(NOT _ext) - LIST(APPEND _my_dirs ${_abs_FILE}) - ELSE(NOT _ext) - LIST(APPEND _my_sources ${_abs_FILE}) - ENDIF(NOT _ext) - ENDIF(_ext MATCHES "ts") - ENDFOREACH(_file) - FOREACH(_ts_file ${_my_tsfiles}) - IF(_my_sources) + set(_my_sources) + set(_my_dirs) + set(_my_tsfiles) + set(_ts_pro) + foreach (_file ${_lupdate_files}) + get_filename_component(_ext ${_file} EXT) + get_filename_component(_abs_FILE ${_file} ABSOLUTE) + if(_ext MATCHES "ts") + list(APPEND _my_tsfiles ${_abs_FILE}) + else() + if(NOT _ext) + list(APPEND _my_dirs ${_abs_FILE}) + else() + list(APPEND _my_sources ${_abs_FILE}) + endif() + endif() + endforeach() + foreach(_ts_file ${_my_tsfiles}) + if(_my_sources) # make a .pro file to call lupdate on, so we don't make our commands too # long for some systems - GET_FILENAME_COMPONENT(_ts_name ${_ts_file} NAME_WE) - SET(_ts_pro ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lupdate.pro) - SET(_pro_srcs) - FOREACH(_pro_src ${_my_sources}) - SET(_pro_srcs "${_pro_srcs} \"${_pro_src}\"") - ENDFOREACH(_pro_src ${_my_sources}) - SET(_pro_includes) - GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES) - FOREACH(_pro_include ${_inc_DIRS}) - GET_FILENAME_COMPONENT(_abs_include "${_pro_include}" ABSOLUTE) - SET(_pro_includes "${_pro_includes} \"${_abs_include}\"") - ENDFOREACH(_pro_include ${CMAKE_CXX_INCLUDE_PATH}) - FILE(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}\nINCLUDEPATH = ${_pro_includes}\n") - ENDIF(_my_sources) - ADD_CUSTOM_COMMAND(OUTPUT ${_ts_file} + get_filename_component(_ts_name ${_ts_file} NAME_WE) + set(_ts_pro ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lupdate.pro) + set(_pro_srcs) + foreach(_pro_src ${_my_sources}) + set(_pro_srcs "${_pro_srcs} \"${_pro_src}\"") + endforeach() + set(_pro_includes) + get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES) + foreach(_pro_include ${_inc_DIRS}) + get_filename_component(_abs_include "${_pro_include}" ABSOLUTE) + set(_pro_includes "${_pro_includes} \"${_abs_include}\"") + endforeach() + file(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}\nINCLUDEPATH = ${_pro_includes}\n") + endif() + add_custom_command(OUTPUT ${_ts_file} COMMAND ${QT_LUPDATE_EXECUTABLE} ARGS ${_lupdate_options} ${_ts_pro} ${_my_dirs} -ts ${_ts_file} DEPENDS ${_my_sources} ${_ts_pro} VERBATIM) - ENDFOREACH(_ts_file) + endforeach() QT4_ADD_TRANSLATION(${_qm_files} ${_my_tsfiles}) -ENDMACRO(QT4_CREATE_TRANSLATION) - - -MACRO(QT4_ADD_TRANSLATION _qm_files) - FOREACH (_current_FILE ${ARGN}) - GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) - GET_FILENAME_COMPONENT(qm ${_abs_FILE} NAME_WE) - GET_SOURCE_FILE_PROPERTY(output_location ${_abs_FILE} OUTPUT_LOCATION) - IF(output_location) - FILE(MAKE_DIRECTORY "${output_location}") - SET(qm "${output_location}/${qm}.qm") - ELSE(output_location) - SET(qm "${CMAKE_CURRENT_BINARY_DIR}/${qm}.qm") - ENDIF(output_location) - - ADD_CUSTOM_COMMAND(OUTPUT ${qm} +endmacro() + + +macro(QT4_ADD_TRANSLATION _qm_files) + foreach (_current_FILE ${ARGN}) + get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(qm ${_abs_FILE} NAME_WE) + get_source_file_property(output_location ${_abs_FILE} OUTPUT_LOCATION) + if(output_location) + file(MAKE_DIRECTORY "${output_location}") + set(qm "${output_location}/${qm}.qm") + else() + set(qm "${CMAKE_CURRENT_BINARY_DIR}/${qm}.qm") + endif() + + add_custom_command(OUTPUT ${qm} COMMAND ${QT_LRELEASE_EXECUTABLE} ARGS ${_abs_FILE} -qm ${qm} DEPENDS ${_abs_FILE} VERBATIM ) - SET(${_qm_files} ${${_qm_files}} ${qm}) - ENDFOREACH (_current_FILE) -ENDMACRO(QT4_ADD_TRANSLATION) + set(${_qm_files} ${${_qm_files}} ${qm}) + endforeach () +endmacro() + +function(qt4_use_modules _target _link_type) + if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE") + set(modules ${ARGN}) + set(link_type ${_link_type}) + else() + set(modules ${_link_type} ${ARGN}) + endif() + foreach(_module ${modules}) + string(TOUPPER ${_module} _ucmodule) + if (NOT QT_QT${_ucmodule}_FOUND) + message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.") + endif() + if ("${_ucmodule}" STREQUAL "MAIN") + message(FATAL_ERROR "Can not use \"${_module}\" module with qt4_use_modules.") + endif() + target_link_libraries(${_target} ${link_type} ${QT_QT${_ucmodule}_LIBRARY}) + set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${QT_QT${_ucmodule}_INCLUDE_DIR} ${QT_HEADERS_DIR} ${QT_MKSPECS_DIR}/default) + set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${QT_QT${_ucmodule}_COMPILE_DEFINITIONS}) + endforeach() +endfunction() diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake index 2e8ade0df..62137bb28 100644 --- a/Modules/SelectLibraryConfigurations.cmake +++ b/Modules/SelectLibraryConfigurations.cmake @@ -6,7 +6,7 @@ # basename_LIBRARY_RELEASE is defined, basename_LIBRARY, basename_LIBRARY_DEBUG, # and basename_LIBRARY_RELEASE will be set to the release value. If only # basename_LIBRARY_DEBUG is defined, then basename_LIBRARY, -# basename_LIBRARY_DEBUG and basename_LIBRARY_RELEASE will take the debug value. +# basename_LIBRARY_DEBUG and basename_LIBRARY_RELEASE will take the debug value. # # If the generator supports configuration types, then basename_LIBRARY and # basename_LIBRARIES will be set with debug and optimized flags specifying the @@ -38,8 +38,8 @@ macro( _set_library_name basename GOOD BAD ) set( ${basename}_LIBRARY_${BAD} ${${basename}_LIBRARY_${GOOD}} ) set( ${basename}_LIBRARY ${${basename}_LIBRARY_${GOOD}} ) set( ${basename}_LIBRARIES ${${basename}_LIBRARY_${GOOD}} ) - endif( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} ) -endmacro( _set_library_name ) + endif() +endmacro() macro( select_library_configurations basename ) # if only the release version was found, set the debug to be the release @@ -48,34 +48,40 @@ macro( select_library_configurations basename ) # if only the debug version was found, set the release value to be the # debug value. _set_library_name( ${basename} DEBUG RELEASE ) - if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND - NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE) + + # Set a default case, which will come into effect if + # -no build type is set and the generator only supports one build type + # at a time (i.e. CMAKE_CONFIGURATION_TYPES is false) + # -${basename}_LIBRARY_DEBUG and ${basename}_LIBRARY_RELEASE are the same + # -${basename}_LIBRARY_DEBUG and ${basename}_LIBRARY_RELEASE are both empty + set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) + set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} ) + + if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND + NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE ) # if the generator supports configuration types or CMAKE_BUILD_TYPE # is set, then set optimized and debug options. if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) - set( ${basename}_LIBRARY - optimized ${${basename}_LIBRARY_RELEASE} - debug ${${basename}_LIBRARY_DEBUG} ) - set( ${basename}_LIBRARIES - optimized ${${basename}_LIBRARY_RELEASE} - debug ${${basename}_LIBRARY_DEBUG} ) - else( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) - # If there are no configuration types or build type, just use - # the release version - set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) - set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} ) - endif( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) + set( ${basename}_LIBRARY ) + foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE ) + list( APPEND ${basename}_LIBRARY optimized "${_libname}" ) + endforeach() + foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG ) + list( APPEND ${basename}_LIBRARY debug "${_libname}" ) + endforeach() + set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" ) + endif() endif() - set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH + set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH "The ${basename} library" ) if( ${basename}_LIBRARY ) set( ${basename}_FOUND TRUE ) - endif( ${basename}_LIBRARY ) + endif() - mark_as_advanced( ${basename}_LIBRARY + mark_as_advanced( ${basename}_LIBRARY ${basename}_LIBRARY_RELEASE ${basename}_LIBRARY_DEBUG ) -endmacro( select_library_configurations ) +endmacro() diff --git a/Modules/Squish4RunTestCase.bat b/Modules/Squish4RunTestCase.bat new file mode 100755 index 000000000..ad1cc8c3b --- /dev/null +++ b/Modules/Squish4RunTestCase.bat @@ -0,0 +1,24 @@ +set SQUISHSERVER=%1 +set SQUISHRUNNER=%2 +set TESTSUITE=%3 +set TESTCASE=%4 +set AUT=%5 +set AUTDIR=%6 +set SETTINGSGROUP=%7 + +%SQUISHSERVER% --stop + +echo "Adding AUT... %SQUISHSERVER% --config addAUT %AUT% %AUTDIR%" +%SQUISHSERVER% --config addAUT "%AUT%" "%AUTDIR%" + +echo "Starting the squish server... %SQUISHSERVER%" +start /B %SQUISHSERVER% + +echo "Running the test case...%SQUISHRUNNER% --testsuite %TESTSUITE% --testcase %TESTCASE%" +%SQUISHRUNNER% --testsuite "%TESTSUITE%" --testcase "%TESTCASE%" +set returnValue=%ERRORLEVEL% + +echo "Stopping the squish server... %SQUISHSERVER% --stop" +%SQUISHSERVER% --stop + +exit /B %returnValue% diff --git a/Modules/Squish4RunTestCase.sh b/Modules/Squish4RunTestCase.sh new file mode 100755 index 000000000..abd5debd2 --- /dev/null +++ b/Modules/Squish4RunTestCase.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +SQUISHSERVER=$1 +SQUISHRUNNER=$2 +TESTSUITE=$3 +TESTCASE=$4 +AUT=$5 +AUTDIR=$6 +SETTINGSGROUP=$7 + +$SQUISHSERVER --stop > /dev/null 2>&1 + +echo "Adding AUT... $SQUISHSERVER --settingsGroup $SETTINGSGROUP --config addAUT $AUT $AUTDIR" +$SQUISHSERVER --settingsGroup "$SETTINGSGROUP" --config addAUT "$AUT" "$AUTDIR" || exit -1 +# sleep 1 + +echo "Starting the squish server... $SQUISHSERVER --daemon" +$SQUISHSERVER --daemon || exit -1 +# sleep 2 + +echo "Running the test case...$SQUISHRUNNER --settingsGroup $SETTINGSGROUP --testsuite $TESTSUITE --testcase $TESTCASE" +$SQUISHRUNNER --settingsGroup "$SETTINGSGROUP" --testsuite "$TESTSUITE" --testcase "$TESTCASE" +returnValue=$? + +echo "Stopping the squish server... $SQUISHSERVER --stop" +$SQUISHSERVER --stop + +exit $returnValue diff --git a/Modules/SquishTestScript.cmake b/Modules/SquishTestScript.cmake index 9eac9707f..f794b3eee 100644 --- a/Modules/SquishTestScript.cmake +++ b/Modules/SquishTestScript.cmake @@ -22,17 +22,22 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -cmake_minimum_required(VERSION 2.6 FATAL_ERROR) - # print out the variable that we are using message(STATUS "squish_aut='${squish_aut}'") +message(STATUS "squish_aut_dir='${squish_aut_dir}'") +message(STATUS "squish_version='${squish_version}'") message(STATUS "squish_server_executable='${squish_server_executable}'") message(STATUS "squish_client_executable='${squish_client_executable}'") message(STATUS "squish_libqtdir ='${squish_libqtdir}'") +message(STATUS "squish_test_suite='${squish_test_suite}'") message(STATUS "squish_test_case='${squish_test_case}'") message(STATUS "squish_wrapper='${squish_wrapper}'") message(STATUS "squish_env_vars='${squish_env_vars}'") +message(STATUS "squish_module_dir='${squish_module_dir}'") +message(STATUS "squish_settingsgroup='${squish_settingsgroup}'") +message(STATUS "squish_pre_command='${squish_pre_command}'") +message(STATUS "squish_post_command='${squish_post_command}'") # parse enviornment variables foreach(i ${squish_env_vars}) @@ -44,29 +49,42 @@ foreach(i ${squish_env_vars}) endforeach() if (QT4_INSTALLED) - # record qt lib directory + # record Qt lib directory set ( ENV{${SQUISH_LIBQTDIR}} ${squish_libqtdir} ) -endif (QT4_INSTALLED) +endif () + +if(squish_pre_command) + message(STATUS "Executing pre command: ${squish_pre_command}") + execute_process(COMMAND "${squish_pre_command}") +endif() # run the test -if (WIN32) - execute_process( - COMMAND ${CMAKE_ROOT}/Modules/SquishRunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut} - RESULT_VARIABLE test_rv - ) -endif (WIN32) +if("${squish_version}" STREQUAL "4") + if (WIN32) + execute_process(COMMAND ${squish_module_dir}/Squish4RunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_suite} ${squish_test_case} ${squish_aut} ${squish_aut_dir} ${squish_settingsgroup} + RESULT_VARIABLE test_rv ) + elseif(UNIX) + execute_process(COMMAND ${squish_module_dir}/Squish4RunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_suite} ${squish_test_case} ${squish_aut} ${squish_aut_dir} ${squish_settingsgroup} + RESULT_VARIABLE test_rv ) + endif () + +else() + + if (WIN32) + execute_process(COMMAND ${squish_module_dir}/SquishRunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut} + RESULT_VARIABLE test_rv ) + elseif(UNIX) + execute_process(COMMAND ${squish_module_dir}/SquishRunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut} + RESULT_VARIABLE test_rv ) + endif () +endif() -if (UNIX) - execute_process( - COMMAND ${CMAKE_ROOT}/Modules/SquishRunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut} - RESULT_VARIABLE test_rv - ) -endif (UNIX) +if(squish_post_command) + message(STATUS "Executing post command: ${squish_post_command}") + execute_process(COMMAND "${squish_post_command}") +endif() # check for an error with running the test if(NOT "${test_rv}" STREQUAL "0") message(FATAL_ERROR "Error running Squish test") -endif(NOT "${test_rv}" STREQUAL "0") - - - +endif() diff --git a/Modules/SystemInformation.cmake b/Modules/SystemInformation.cmake index d4f22331d..fa8507106 100644 --- a/Modules/SystemInformation.cmake +++ b/Modules/SystemInformation.cmake @@ -12,92 +12,92 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION}) -PROJECT(DumpInformation) +cmake_minimum_required(VERSION ${CMAKE_VERSION}) +project(DumpInformation) # first get the standard information for th platform -INCLUDE_DIRECTORIES("This does not exists") -GET_DIRECTORY_PROPERTY(incl INCLUDE_DIRECTORIES) -SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${DumpInformation_BINARY_DIR};${DumpInformation_SOURCE_DIR}") +include_directories("This does not exists") +get_directory_property(incl INCLUDE_DIRECTORIES) +set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${DumpInformation_BINARY_DIR};${DumpInformation_SOURCE_DIR}") -CONFIGURE_FILE("${CMAKE_ROOT}/Modules/SystemInformation.in" "${RESULT_FILE}") +configure_file("${CMAKE_ROOT}/Modules/SystemInformation.in" "${RESULT_FILE}") -FILE(APPEND "${RESULT_FILE}" +file(APPEND "${RESULT_FILE}" "\n=================================================================\n") -FILE(APPEND "${RESULT_FILE}" +file(APPEND "${RESULT_FILE}" "=== VARIABLES\n") -FILE(APPEND "${RESULT_FILE}" +file(APPEND "${RESULT_FILE}" "=================================================================\n") -GET_CMAKE_PROPERTY(res VARIABLES) -FOREACH(var ${res}) - FILE(APPEND "${RESULT_FILE}" "${var} \"${${var}}\"\n") -ENDFOREACH(var ${res}) +get_cmake_property(res VARIABLES) +foreach(var ${res}) + file(APPEND "${RESULT_FILE}" "${var} \"${${var}}\"\n") +endforeach() -FILE(APPEND "${RESULT_FILE}" +file(APPEND "${RESULT_FILE}" "\n=================================================================\n") -FILE(APPEND "${RESULT_FILE}" +file(APPEND "${RESULT_FILE}" "=== COMMANDS\n") -FILE(APPEND "${RESULT_FILE}" +file(APPEND "${RESULT_FILE}" "=================================================================\n") -GET_CMAKE_PROPERTY(res COMMANDS) -FOREACH(var ${res}) - FILE(APPEND "${RESULT_FILE}" "${var}\n") -ENDFOREACH(var ${res}) +get_cmake_property(res COMMANDS) +foreach(var ${res}) + file(APPEND "${RESULT_FILE}" "${var}\n") +endforeach() -FILE(APPEND "${RESULT_FILE}" +file(APPEND "${RESULT_FILE}" "\n=================================================================\n") -FILE(APPEND "${RESULT_FILE}" +file(APPEND "${RESULT_FILE}" "=== MACROS\n") -FILE(APPEND "${RESULT_FILE}" +file(APPEND "${RESULT_FILE}" "=================================================================\n") -FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AllMacros.txt "") -GET_CMAKE_PROPERTY(res MACROS) -FOREACH(var ${res}) - FILE(APPEND "${RESULT_FILE}" "${var}\n") -ENDFOREACH(var ${res}) +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AllMacros.txt "") +get_cmake_property(res MACROS) +foreach(var ${res}) + file(APPEND "${RESULT_FILE}" "${var}\n") +endforeach() -FILE(APPEND "${RESULT_FILE}" +file(APPEND "${RESULT_FILE}" "\n=================================================================\n") -FILE(APPEND "${RESULT_FILE}" +file(APPEND "${RESULT_FILE}" "=== OTHER\n") -FILE(APPEND "${RESULT_FILE}" +file(APPEND "${RESULT_FILE}" "=================================================================\n") -GET_DIRECTORY_PROPERTY(res INCLUDE_DIRECTORIES) -FOREACH(var ${res}) - FILE(APPEND "${RESULT_FILE}" "INCLUDE_DIRECTORY: ${var}\n") -ENDFOREACH(var) +get_directory_property(res INCLUDE_DIRECTORIES) +foreach(var ${res}) + file(APPEND "${RESULT_FILE}" "INCLUDE_DIRECTORY: ${var}\n") +endforeach() -GET_DIRECTORY_PROPERTY(res LINK_DIRECTORIES) -FOREACH(var ${res}) - FILE(APPEND "${RESULT_FILE}" "LINK_DIRECTORIES: ${var}\n") -ENDFOREACH(var) +get_directory_property(res LINK_DIRECTORIES) +foreach(var ${res}) + file(APPEND "${RESULT_FILE}" "LINK_DIRECTORIES: ${var}\n") +endforeach() -GET_DIRECTORY_PROPERTY(res INCLUDE_REGULAR_EXPRESSION) -FILE(APPEND "${RESULT_FILE}" "INCLUDE_REGULAR_EXPRESSION: ${res}\n") +get_directory_property(res INCLUDE_REGULAR_EXPRESSION) +file(APPEND "${RESULT_FILE}" "INCLUDE_REGULAR_EXPRESSION: ${res}\n") # include other files if they are present, such as when run from within the # binary tree -MACRO(DUMP_FILE THE_FILE) - IF (EXISTS "${THE_FILE}") - FILE(APPEND "${RESULT_FILE}" +macro(DUMP_FILE THE_FILE) + if (EXISTS "${THE_FILE}") + file(APPEND "${RESULT_FILE}" "\n=================================================================\n") - FILE(APPEND "${RESULT_FILE}" + file(APPEND "${RESULT_FILE}" "=== ${THE_FILE}\n") - FILE(APPEND "${RESULT_FILE}" + file(APPEND "${RESULT_FILE}" "=================================================================\n") - - FILE(READ "${THE_FILE}" FILE_CONTENTS LIMIT 50000) - FILE(APPEND "${RESULT_FILE}" "${FILE_CONTENTS}") - ENDIF (EXISTS "${THE_FILE}") -ENDMACRO(DUMP_FILE) + + file(READ "${THE_FILE}" FILE_CONTENTS LIMIT 50000) + file(APPEND "${RESULT_FILE}" "${FILE_CONTENTS}") + endif () +endmacro() DUMP_FILE("../CMakeCache.txt") DUMP_FILE("../CMakeFiles/CMakeOutput.log") DUMP_FILE("../CMakeFiles/CMakeError.log") DUMP_FILE("../CMakeFiles/CMakeSystem.cmake") -FOREACH (EXTRA_FILE ${EXTRA_DUMP_FILES}) +foreach (EXTRA_FILE ${EXTRA_DUMP_FILES}) DUMP_FILE("${EXTRA_FILE}") -ENDFOREACH (EXTRA_FILE) +endforeach () diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake index 996060210..193df8fda 100644 --- a/Modules/TestBigEndian.cmake +++ b/Modules/TestBigEndian.cmake @@ -17,96 +17,96 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -MACRO(TEST_BIG_ENDIAN VARIABLE) - IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") - MESSAGE(STATUS "Check if the system is big endian") - MESSAGE(STATUS "Searching 16 bit integer") - - INCLUDE(CheckTypeSize) +macro(TEST_BIG_ENDIAN VARIABLE) + if("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") + message(STATUS "Check if the system is big endian") + message(STATUS "Searching 16 bit integer") + + include(CheckTypeSize) CHECK_TYPE_SIZE("unsigned short" CMAKE_SIZEOF_UNSIGNED_SHORT) - IF(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2) - MESSAGE(STATUS "Using unsigned short") - SET(CMAKE_16BIT_TYPE "unsigned short") - ELSE(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2) + if(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2) + message(STATUS "Using unsigned short") + set(CMAKE_16BIT_TYPE "unsigned short") + else() CHECK_TYPE_SIZE("unsigned int" CMAKE_SIZEOF_UNSIGNED_INT) - IF(CMAKE_SIZEOF_UNSIGNED_INT) - MESSAGE(STATUS "Using unsigned int") - SET(CMAKE_16BIT_TYPE "unsigned int") + if(CMAKE_SIZEOF_UNSIGNED_INT) + message(STATUS "Using unsigned int") + set(CMAKE_16BIT_TYPE "unsigned int") + + else() - ELSE(CMAKE_SIZEOF_UNSIGNED_INT) - CHECK_TYPE_SIZE("unsigned long" CMAKE_SIZEOF_UNSIGNED_LONG) - IF(CMAKE_SIZEOF_UNSIGNED_LONG) - MESSAGE(STATUS "Using unsigned long") - SET(CMAKE_16BIT_TYPE "unsigned long") - ELSE(CMAKE_SIZEOF_UNSIGNED_LONG) - MESSAGE(FATAL_ERROR "no suitable type found") - ENDIF(CMAKE_SIZEOF_UNSIGNED_LONG) - - ENDIF(CMAKE_SIZEOF_UNSIGNED_INT) - - ENDIF(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2) - - - CONFIGURE_FILE("${CMAKE_ROOT}/Modules/TestEndianess.c.in" + if(CMAKE_SIZEOF_UNSIGNED_LONG) + message(STATUS "Using unsigned long") + set(CMAKE_16BIT_TYPE "unsigned long") + else() + message(FATAL_ERROR "no suitable type found") + endif() + + endif() + + endif() + + + configure_file("${CMAKE_ROOT}/Modules/TestEndianess.c.in" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/TestEndianess.c" IMMEDIATE @ONLY) - - FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/TestEndianess.c" + + file(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/TestEndianess.c" TEST_ENDIANESS_FILE_CONTENT) - TRY_COMPILE(HAVE_${VARIABLE} + try_compile(HAVE_${VARIABLE} "${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/TestEndianess.c" OUTPUT_VARIABLE OUTPUT COPY_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin" ) - IF(HAVE_${VARIABLE}) + if(HAVE_${VARIABLE}) - FILE(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin" + file(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin" CMAKE_TEST_ENDIANESS_STRINGS_LE LIMIT_COUNT 1 REGEX "THIS IS LITTLE ENDIAN") - FILE(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin" + file(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin" CMAKE_TEST_ENDIANESS_STRINGS_BE LIMIT_COUNT 1 REGEX "THIS IS BIG ENDIAN") # on mac, if there are universal binaries built both will be true # return the result depending on the machine on which cmake runs - IF(CMAKE_TEST_ENDIANESS_STRINGS_BE AND CMAKE_TEST_ENDIANESS_STRINGS_LE) - IF(CMAKE_SYSTEM_PROCESSOR MATCHES powerpc) - SET(CMAKE_TEST_ENDIANESS_STRINGS_BE TRUE) - SET(CMAKE_TEST_ENDIANESS_STRINGS_LE FALSE) - ELSE(CMAKE_SYSTEM_PROCESSOR MATCHES powerpc) - SET(CMAKE_TEST_ENDIANESS_STRINGS_BE FALSE) - SET(CMAKE_TEST_ENDIANESS_STRINGS_LE TRUE) - ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES powerpc) - MESSAGE(STATUS "TEST_BIG_ENDIAN found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !") - ENDIF(CMAKE_TEST_ENDIANESS_STRINGS_BE AND CMAKE_TEST_ENDIANESS_STRINGS_LE) - - IF(CMAKE_TEST_ENDIANESS_STRINGS_LE) - SET(${VARIABLE} 0 CACHE INTERNAL "Result of TEST_BIG_ENDIAN" FORCE) - MESSAGE(STATUS "Check if the system is big endian - little endian") - ENDIF(CMAKE_TEST_ENDIANESS_STRINGS_LE) - - IF(CMAKE_TEST_ENDIANESS_STRINGS_BE) - SET(${VARIABLE} 1 CACHE INTERNAL "Result of TEST_BIG_ENDIAN" FORCE) - MESSAGE(STATUS "Check if the system is big endian - big endian") - ENDIF(CMAKE_TEST_ENDIANESS_STRINGS_BE) - - IF(NOT CMAKE_TEST_ENDIANESS_STRINGS_BE AND NOT CMAKE_TEST_ENDIANESS_STRINGS_LE) - MESSAGE(SEND_ERROR "TEST_BIG_ENDIAN found no result!") - ENDIF(NOT CMAKE_TEST_ENDIANESS_STRINGS_BE AND NOT CMAKE_TEST_ENDIANESS_STRINGS_LE) - - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + if(CMAKE_TEST_ENDIANESS_STRINGS_BE AND CMAKE_TEST_ENDIANESS_STRINGS_LE) + if(CMAKE_SYSTEM_PROCESSOR MATCHES powerpc) + set(CMAKE_TEST_ENDIANESS_STRINGS_BE TRUE) + set(CMAKE_TEST_ENDIANESS_STRINGS_LE FALSE) + else() + set(CMAKE_TEST_ENDIANESS_STRINGS_BE FALSE) + set(CMAKE_TEST_ENDIANESS_STRINGS_LE TRUE) + endif() + message(STATUS "TEST_BIG_ENDIAN found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !") + endif() + + if(CMAKE_TEST_ENDIANESS_STRINGS_LE) + set(${VARIABLE} 0 CACHE INTERNAL "Result of TEST_BIG_ENDIAN" FORCE) + message(STATUS "Check if the system is big endian - little endian") + endif() + + if(CMAKE_TEST_ENDIANESS_STRINGS_BE) + set(${VARIABLE} 1 CACHE INTERNAL "Result of TEST_BIG_ENDIAN" FORCE) + message(STATUS "Check if the system is big endian - big endian") + endif() + + if(NOT CMAKE_TEST_ENDIANESS_STRINGS_BE AND NOT CMAKE_TEST_ENDIANESS_STRINGS_LE) + message(SEND_ERROR "TEST_BIG_ENDIAN found no result!") + endif() + + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the system is big endian passed with the following output:\n${OUTPUT}\nTestEndianess.c:\n${TEST_ENDIANESS_FILE_CONTENT}\n\n") - - ELSE(HAVE_${VARIABLE}) - MESSAGE(STATUS "Check if the system is big endian - failed") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + + else() + message(STATUS "Check if the system is big endian - failed") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the system is big endian failed with the following output:\n${OUTPUT}\nTestEndianess.c:\n${TEST_ENDIANESS_FILE_CONTENT}\n\n") - SET(${VARIABLE}) - ENDIF(HAVE_${VARIABLE}) - ENDIF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") -ENDMACRO(TEST_BIG_ENDIAN) + set(${VARIABLE}) + endif() + endif() +endmacro() diff --git a/Modules/TestCXXAcceptsFlag.cmake b/Modules/TestCXXAcceptsFlag.cmake index 52d0cf3e6..2694737ef 100644 --- a/Modules/TestCXXAcceptsFlag.cmake +++ b/Modules/TestCXXAcceptsFlag.cmake @@ -20,24 +20,24 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -MACRO(CHECK_CXX_ACCEPTS_FLAG FLAGS VARIABLE) - IF(NOT DEFINED ${VARIABLE}) - MESSAGE(STATUS "Checking to see if CXX compiler accepts flag ${FLAGS}") - TRY_COMPILE(${VARIABLE} +macro(CHECK_CXX_ACCEPTS_FLAG FLAGS VARIABLE) + if(NOT DEFINED ${VARIABLE}) + message(STATUS "Checking to see if CXX compiler accepts flag ${FLAGS}") + try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_ROOT}/Modules/DummyCXXFile.cxx CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${FLAGS} - OUTPUT_VARIABLE OUTPUT) - IF(${VARIABLE}) - MESSAGE(STATUS "Checking to see if CXX compiler accepts flag ${FLAGS} - yes") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + OUTPUT_VARIABLE OUTPUT) + if(${VARIABLE}) + message(STATUS "Checking to see if CXX compiler accepts flag ${FLAGS} - yes") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the CXX compiler accepts the flag ${FLAGS} passed with " "the following output:\n${OUTPUT}\n\n") - ELSE(${VARIABLE}) - MESSAGE(STATUS "Checking to see if CXX compiler accepts flag ${FLAGS} - no") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + else() + message(STATUS "Checking to see if CXX compiler accepts flag ${FLAGS} - no") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the CXX compiler accepts the flag ${FLAGS} failed with " "the following output:\n${OUTPUT}\n\n") - ENDIF(${VARIABLE}) - ENDIF(NOT DEFINED ${VARIABLE}) -ENDMACRO(CHECK_CXX_ACCEPTS_FLAG) + endif() + endif() +endmacro() diff --git a/Modules/TestForANSIForScope.cmake b/Modules/TestForANSIForScope.cmake index ae2acef7e..9b4d51cda 100644 --- a/Modules/TestForANSIForScope.cmake +++ b/Modules/TestForANSIForScope.cmake @@ -16,27 +16,27 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF("CMAKE_ANSI_FOR_SCOPE" MATCHES "^CMAKE_ANSI_FOR_SCOPE$") - MESSAGE(STATUS "Check for ANSI scope") - TRY_COMPILE(CMAKE_ANSI_FOR_SCOPE ${CMAKE_BINARY_DIR} +if("CMAKE_ANSI_FOR_SCOPE" MATCHES "^CMAKE_ANSI_FOR_SCOPE$") + message(STATUS "Check for ANSI scope") + try_compile(CMAKE_ANSI_FOR_SCOPE ${CMAKE_BINARY_DIR} ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx OUTPUT_VARIABLE OUTPUT) - IF (CMAKE_ANSI_FOR_SCOPE) - MESSAGE(STATUS "Check for ANSI scope - found") - SET (CMAKE_NO_ANSI_FOR_SCOPE 0 CACHE INTERNAL + if (CMAKE_ANSI_FOR_SCOPE) + message(STATUS "Check for ANSI scope - found") + set (CMAKE_NO_ANSI_FOR_SCOPE 0 CACHE INTERNAL "Does the compiler support ansi for scope.") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the CXX compiler understands ansi for scopes passed with " "the following output:\n${OUTPUT}\n\n") - ELSE (CMAKE_ANSI_FOR_SCOPE) - MESSAGE(STATUS "Check for ANSI scope - not found") - SET (CMAKE_NO_ANSI_FOR_SCOPE 1 CACHE INTERNAL + else () + message(STATUS "Check for ANSI scope - not found") + set (CMAKE_NO_ANSI_FOR_SCOPE 1 CACHE INTERNAL "Does the compiler support ansi for scope.") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the CXX compiler understands ansi for scopes failed with " "the following output:\n${OUTPUT}\n\n") - ENDIF (CMAKE_ANSI_FOR_SCOPE) -ENDIF("CMAKE_ANSI_FOR_SCOPE" MATCHES "^CMAKE_ANSI_FOR_SCOPE$") + endif () +endif() diff --git a/Modules/TestForANSIStreamHeaders.cmake b/Modules/TestForANSIStreamHeaders.cmake index 19c1ab2f2..060b3a43a 100644 --- a/Modules/TestForANSIStreamHeaders.cmake +++ b/Modules/TestForANSIStreamHeaders.cmake @@ -16,19 +16,19 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(CheckIncludeFileCXX) +include(${CMAKE_CURRENT_LIST_DIR}/CheckIncludeFileCXX.cmake) -IF(NOT CMAKE_NO_ANSI_STREAM_HEADERS) +if(NOT CMAKE_NO_ANSI_STREAM_HEADERS) CHECK_INCLUDE_FILE_CXX(iostream CMAKE_ANSI_STREAM_HEADERS) - IF (CMAKE_ANSI_STREAM_HEADERS) - SET (CMAKE_NO_ANSI_STREAM_HEADERS 0 CACHE INTERNAL + if (CMAKE_ANSI_STREAM_HEADERS) + set (CMAKE_NO_ANSI_STREAM_HEADERS 0 CACHE INTERNAL "Does the compiler support headers like iostream.") - ELSE (CMAKE_ANSI_STREAM_HEADERS) - SET (CMAKE_NO_ANSI_STREAM_HEADERS 1 CACHE INTERNAL + else () + set (CMAKE_NO_ANSI_STREAM_HEADERS 1 CACHE INTERNAL "Does the compiler support headers like iostream.") - ENDIF (CMAKE_ANSI_STREAM_HEADERS) + endif () - MARK_AS_ADVANCED(CMAKE_NO_ANSI_STREAM_HEADERS) -ENDIF(NOT CMAKE_NO_ANSI_STREAM_HEADERS) + mark_as_advanced(CMAKE_NO_ANSI_STREAM_HEADERS) +endif() diff --git a/Modules/TestForAnsiForScope.cxx b/Modules/TestForAnsiForScope.cxx index f2ec76077..e8807ab4a 100644 --- a/Modules/TestForAnsiForScope.cxx +++ b/Modules/TestForAnsiForScope.cxx @@ -1,5 +1,5 @@ int main(int, char*[]) -{ +{ int i; for(int i=0; i < 1; ++i); (void)i; diff --git a/Modules/TestForSSTREAM.cmake b/Modules/TestForSSTREAM.cmake index 8dd53e744..db39c1e70 100644 --- a/Modules/TestForSSTREAM.cmake +++ b/Modules/TestForSSTREAM.cmake @@ -16,27 +16,27 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF("CMAKE_HAS_ANSI_STRING_STREAM" MATCHES "^CMAKE_HAS_ANSI_STRING_STREAM$") - MESSAGE(STATUS "Check for sstream") - TRY_COMPILE(CMAKE_HAS_ANSI_STRING_STREAM ${CMAKE_BINARY_DIR} +if("CMAKE_HAS_ANSI_STRING_STREAM" MATCHES "^CMAKE_HAS_ANSI_STRING_STREAM$") + message(STATUS "Check for sstream") + try_compile(CMAKE_HAS_ANSI_STRING_STREAM ${CMAKE_BINARY_DIR} ${CMAKE_ROOT}/Modules/TestForSSTREAM.cxx OUTPUT_VARIABLE OUTPUT) - IF (CMAKE_HAS_ANSI_STRING_STREAM) - MESSAGE(STATUS "Check for sstream - found") - SET (CMAKE_NO_ANSI_STRING_STREAM 0 CACHE INTERNAL + if (CMAKE_HAS_ANSI_STRING_STREAM) + message(STATUS "Check for sstream - found") + set (CMAKE_NO_ANSI_STRING_STREAM 0 CACHE INTERNAL "Does the compiler support sstream") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the CXX compiler has sstream passed with " "the following output:\n${OUTPUT}\n\n") - ELSE (CMAKE_HAS_ANSI_STRING_STREAM) - MESSAGE(STATUS "Check for sstream - not found") - SET (CMAKE_NO_ANSI_STRING_STREAM 1 CACHE INTERNAL + else () + message(STATUS "Check for sstream - not found") + set (CMAKE_NO_ANSI_STRING_STREAM 1 CACHE INTERNAL "Does the compiler support sstream") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the CXX compiler has sstream failed with " "the following output:\n${OUTPUT}\n\n") - ENDIF (CMAKE_HAS_ANSI_STRING_STREAM) -ENDIF("CMAKE_HAS_ANSI_STRING_STREAM" MATCHES "^CMAKE_HAS_ANSI_STRING_STREAM$") + endif () +endif() diff --git a/Modules/TestForSSTREAM.cxx b/Modules/TestForSSTREAM.cxx index af4a4bbef..1c939da23 100644 --- a/Modules/TestForSSTREAM.cxx +++ b/Modules/TestForSSTREAM.cxx @@ -1,6 +1,6 @@ #include int main(int, char*[]) -{ +{ std::ostringstream os; os << "12345"; if(os.str().size() == 5) diff --git a/Modules/TestForSTDNamespace.cmake b/Modules/TestForSTDNamespace.cmake index 932d6e994..6a7564445 100644 --- a/Modules/TestForSTDNamespace.cmake +++ b/Modules/TestForSTDNamespace.cmake @@ -16,27 +16,27 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF("CMAKE_STD_NAMESPACE" MATCHES "^CMAKE_STD_NAMESPACE$") - MESSAGE(STATUS "Check for STD namespace") - TRY_COMPILE(CMAKE_STD_NAMESPACE ${CMAKE_BINARY_DIR} +if("CMAKE_STD_NAMESPACE" MATCHES "^CMAKE_STD_NAMESPACE$") + message(STATUS "Check for STD namespace") + try_compile(CMAKE_STD_NAMESPACE ${CMAKE_BINARY_DIR} ${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx OUTPUT_VARIABLE OUTPUT) - IF (CMAKE_STD_NAMESPACE) - MESSAGE(STATUS "Check for STD namespace - found") - SET (CMAKE_NO_STD_NAMESPACE 0 CACHE INTERNAL + if (CMAKE_STD_NAMESPACE) + message(STATUS "Check for STD namespace - found") + set (CMAKE_NO_STD_NAMESPACE 0 CACHE INTERNAL "Does the compiler support std::.") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the CXX compiler has std namespace passed with " "the following output:\n${OUTPUT}\n\n") - ELSE (CMAKE_STD_NAMESPACE) - MESSAGE(STATUS "Check for STD namespace - not found") - SET (CMAKE_NO_STD_NAMESPACE 1 CACHE INTERNAL + else () + message(STATUS "Check for STD namespace - not found") + set (CMAKE_NO_STD_NAMESPACE 1 CACHE INTERNAL "Does the compiler support std::.") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the CXX compiler has std namespace failed with " "the following output:\n${OUTPUT}\n\n") - ENDIF (CMAKE_STD_NAMESPACE) -ENDIF("CMAKE_STD_NAMESPACE" MATCHES "^CMAKE_STD_NAMESPACE$") + endif () +endif() diff --git a/Modules/TestForSTDNamespace.cxx b/Modules/TestForSTDNamespace.cxx index fc3ac5911..b537d44a9 100644 --- a/Modules/TestForSTDNamespace.cxx +++ b/Modules/TestForSTDNamespace.cxx @@ -1,6 +1,6 @@ #include int main(int, char*[]) -{ +{ std::list(); return 0; } diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake index 60e1e46b4..028df8202 100644 --- a/Modules/UseEcos.cmake +++ b/Modules/UseEcos.cmake @@ -30,89 +30,89 @@ # License text for the above reference.) # first check that ecosconfig is available -FIND_PROGRAM(ECOSCONFIG_EXECUTABLE NAMES ecosconfig) -IF(NOT ECOSCONFIG_EXECUTABLE) - MESSAGE(SEND_ERROR "ecosconfig was not found. Either include it in the system path or set it manually using ccmake.") -ELSE(NOT ECOSCONFIG_EXECUTABLE) - MESSAGE(STATUS "Found ecosconfig: ${ECOSCONFIG_EXECUTABLE}") -ENDIF(NOT ECOSCONFIG_EXECUTABLE) +find_program(ECOSCONFIG_EXECUTABLE NAMES ecosconfig) +if(NOT ECOSCONFIG_EXECUTABLE) + message(SEND_ERROR "ecosconfig was not found. Either include it in the system path or set it manually using ccmake.") +else() + message(STATUS "Found ecosconfig: ${ECOSCONFIG_EXECUTABLE}") +endif() # check that ECOS_REPOSITORY is set correctly -IF (NOT EXISTS $ENV{ECOS_REPOSITORY}/ecos.db) - MESSAGE(SEND_ERROR "The environment variable ECOS_REPOSITORY is not set correctly. Set it to the directory which contains the file ecos.db") -ELSE (NOT EXISTS $ENV{ECOS_REPOSITORY}/ecos.db) - MESSAGE(STATUS "ECOS_REPOSITORY is set to $ENV{ECOS_REPOSITORY}") -ENDIF (NOT EXISTS $ENV{ECOS_REPOSITORY}/ecos.db) +if (NOT EXISTS $ENV{ECOS_REPOSITORY}/ecos.db) + message(SEND_ERROR "The environment variable ECOS_REPOSITORY is not set correctly. Set it to the directory which contains the file ecos.db") +else () + message(STATUS "ECOS_REPOSITORY is set to $ENV{ECOS_REPOSITORY}") +endif () # check that tclsh (coming with TCL) is available, otherwise ecosconfig doesn't work -FIND_PACKAGE(Tclsh) -IF (NOT TCL_TCLSH) - MESSAGE(SEND_ERROR "The TCL tclsh was not found. Please install TCL, it is required for building eCos applications.") -ELSE (NOT TCL_TCLSH) - MESSAGE(STATUS "tlcsh found: ${TCL_TCLSH}") -ENDIF (NOT TCL_TCLSH) +find_package(Tclsh) +if (NOT TCL_TCLSH) + message(SEND_ERROR "The TCL tclsh was not found. Please install TCL, it is required for building eCos applications.") +else () + message(STATUS "tlcsh found: ${TCL_TCLSH}") +endif () #add the globale include-diretories #usage: ECOS_ADD_INCLUDE_DIRECTORIES() -MACRO(ECOS_ADD_INCLUDE_DIRECTORIES) +macro(ECOS_ADD_INCLUDE_DIRECTORIES) #check for ProjectSources.txt one level higher - IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../ProjectSources.txt) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../) - ELSE (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../ProjectSources.txt) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/) - ENDIF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../ProjectSources.txt) + if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../ProjectSources.txt) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../) + else () + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/) + endif () #the ecos include directory - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/ecos/install/include/) + include_directories(${CMAKE_CURRENT_BINARY_DIR}/ecos/install/include/) -ENDMACRO(ECOS_ADD_INCLUDE_DIRECTORIES) +endmacro() #we want to compile for the xscale processor, in this case the following macro has to be called #usage: ECOS_USE_ARM_ELF_TOOLS() -MACRO (ECOS_USE_ARM_ELF_TOOLS) - SET(CMAKE_CXX_COMPILER "arm-elf-c++") - SET(CMAKE_COMPILER_IS_GNUCXX 1) - SET(CMAKE_C_COMPILER "arm-elf-gcc") - SET(CMAKE_AR "arm-elf-ar") - SET(CMAKE_RANLIB "arm-elf-ranlib") +macro (ECOS_USE_ARM_ELF_TOOLS) + set(CMAKE_CXX_COMPILER "arm-elf-c++") + set(CMAKE_COMPILER_IS_GNUCXX 1) + set(CMAKE_C_COMPILER "arm-elf-gcc") + set(CMAKE_AR "arm-elf-ar") + set(CMAKE_RANLIB "arm-elf-ranlib") #for linking - SET(ECOS_LD_MCPU "-mcpu=xscale") + set(ECOS_LD_MCPU "-mcpu=xscale") #for compiling - ADD_DEFINITIONS(-mcpu=xscale -mapcs-frame) + add_definitions(-mcpu=xscale -mapcs-frame) #for the obj-tools - SET(ECOS_ARCH_PREFIX "arm-elf-") -ENDMACRO (ECOS_USE_ARM_ELF_TOOLS) + set(ECOS_ARCH_PREFIX "arm-elf-") +endmacro () #usage: ECOS_USE_PPC_EABI_TOOLS() -MACRO (ECOS_USE_PPC_EABI_TOOLS) - SET(CMAKE_CXX_COMPILER "powerpc-eabi-c++") - SET(CMAKE_COMPILER_IS_GNUCXX 1) - SET(CMAKE_C_COMPILER "powerpc-eabi-gcc") - SET(CMAKE_AR "powerpc-eabi-ar") - SET(CMAKE_RANLIB "powerpc-eabi-ranlib") +macro (ECOS_USE_PPC_EABI_TOOLS) + set(CMAKE_CXX_COMPILER "powerpc-eabi-c++") + set(CMAKE_COMPILER_IS_GNUCXX 1) + set(CMAKE_C_COMPILER "powerpc-eabi-gcc") + set(CMAKE_AR "powerpc-eabi-ar") + set(CMAKE_RANLIB "powerpc-eabi-ranlib") #for linking - SET(ECOS_LD_MCPU "") + set(ECOS_LD_MCPU "") #for compiling - ADD_DEFINITIONS() + add_definitions() #for the obj-tools - SET(ECOS_ARCH_PREFIX "powerpc-eabi-") -ENDMACRO (ECOS_USE_PPC_EABI_TOOLS) + set(ECOS_ARCH_PREFIX "powerpc-eabi-") +endmacro () #usage: ECOS_USE_I386_ELF_TOOLS() -MACRO (ECOS_USE_I386_ELF_TOOLS) - SET(CMAKE_CXX_COMPILER "i386-elf-c++") - SET(CMAKE_COMPILER_IS_GNUCXX 1) - SET(CMAKE_C_COMPILER "i386-elf-gcc") - SET(CMAKE_AR "i386-elf-ar") - SET(CMAKE_RANLIB "i386-elf-ranlib") +macro (ECOS_USE_I386_ELF_TOOLS) + set(CMAKE_CXX_COMPILER "i386-elf-c++") + set(CMAKE_COMPILER_IS_GNUCXX 1) + set(CMAKE_C_COMPILER "i386-elf-gcc") + set(CMAKE_AR "i386-elf-ar") + set(CMAKE_RANLIB "i386-elf-ranlib") #for linking - SET(ECOS_LD_MCPU "") + set(ECOS_LD_MCPU "") #for compiling - ADD_DEFINITIONS() + add_definitions() #for the obj-tools - SET(ECOS_ARCH_PREFIX "i386-elf-") -ENDMACRO (ECOS_USE_I386_ELF_TOOLS) + set(ECOS_ARCH_PREFIX "i386-elf-") +endmacro () #since the actual sources are located one level upwards @@ -121,84 +121,84 @@ ENDMACRO (ECOS_USE_I386_ELF_TOOLS) #is the name of the new list of source files with adjusted paths, #followed by all source files #usage: ECOS_ADJUST_DIRECTORY(adjusted_SRCS ${my_srcs}) -MACRO(ECOS_ADJUST_DIRECTORY _target_FILES ) - FOREACH (_current_FILE ${ARGN}) - GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) - IF (NOT ${_abs_FILE} STREQUAL ${_current_FILE}) - GET_FILENAME_COMPONENT(_abs_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../${_current_FILE} ABSOLUTE) - ENDIF (NOT ${_abs_FILE} STREQUAL ${_current_FILE}) - LIST(APPEND ${_target_FILES} ${_abs_FILE}) - ENDFOREACH (_current_FILE) -ENDMACRO(ECOS_ADJUST_DIRECTORY) +macro(ECOS_ADJUST_DIRECTORY _target_FILES ) + foreach (_current_FILE ${ARGN}) + get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) + if (NOT ${_abs_FILE} STREQUAL ${_current_FILE}) + get_filename_component(_abs_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../${_current_FILE} ABSOLUTE) + endif () + list(APPEND ${_target_FILES} ${_abs_FILE}) + endforeach () +endmacro() # the default ecos config file name # maybe in the future also out-of-source builds may be possible -SET(ECOS_CONFIG_FILE ecos.ecc) +set(ECOS_CONFIG_FILE ecos.ecc) #creates the dependancy from all source files on the ecos target.ld, #adds the command for compiling ecos -MACRO(ECOS_ADD_TARGET_LIB) +macro(ECOS_ADD_TARGET_LIB) # when building out-of-source, create the ecos/ subdir - IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/ecos) - FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ecos) - ENDIF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/ecos) + if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/ecos) + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ecos) + endif() #sources depend on target.ld - SET_SOURCE_FILES_PROPERTIES( + set_source_files_properties( ${ARGN} PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld ) - ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld COMMAND sh -c \"make -C ${CMAKE_CURRENT_BINARY_DIR}/ecos || exit -1\; if [ -e ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld ] \; then touch ${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib/target.ld\; fi\" DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile ) - ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile COMMAND sh -c \" cd ${CMAKE_CURRENT_BINARY_DIR}/ecos\; ${ECOSCONFIG_EXECUTABLE} --config=${CMAKE_CURRENT_SOURCE_DIR}/ecos/${ECOS_CONFIG_FILE} tree || exit -1\;\" DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ecos/${ECOS_CONFIG_FILE} ) - ADD_CUSTOM_TARGET( ecos make -C ${CMAKE_CURRENT_BINARY_DIR}/ecos/ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile ) -ENDMACRO(ECOS_ADD_TARGET_LIB) + add_custom_target( ecos make -C ${CMAKE_CURRENT_BINARY_DIR}/ecos/ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ecos/makefile ) +endmacro() # get the directory of the current file, used later on in the file -GET_FILENAME_COMPONENT( ECOS_CMAKE_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) +get_filename_component( ECOS_CMAKE_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) #macro for creating an executable ecos application #the first parameter is the name of the executable, #the second is the list of all source files (where the path #has been adjusted beforehand by calling ECOS_ADJUST_DIRECTORY() #usage: ECOS_ADD_EXECUTABLE(my_app ${adjusted_SRCS}) -MACRO(ECOS_ADD_EXECUTABLE _exe_NAME ) +macro(ECOS_ADD_EXECUTABLE _exe_NAME ) #definitions, valid for all ecos projects #the optimization and "-g" for debugging has to be enabled #in the project-specific CMakeLists.txt - ADD_DEFINITIONS(-D__ECOS__=1 -D__ECOS=1) - SET(ECOS_DEFINITIONS -Wall -Wno-long-long -pipe -fno-builtin) + add_definitions(-D__ECOS__=1 -D__ECOS=1) + set(ECOS_DEFINITIONS -Wall -Wno-long-long -pipe -fno-builtin) #the executable depends on ecos target.ld ECOS_ADD_TARGET_LIB(${ARGN}) # when using nmake makefiles, the custom buildtype supresses the default cl.exe flags # and the rules for creating objects are adjusted for gcc - SET(CMAKE_BUILD_TYPE CUSTOM_ECOS_BUILD) - SET(CMAKE_C_COMPILE_OBJECT " -o -c ") - SET(CMAKE_CXX_COMPILE_OBJECT " -o -c ") + set(CMAKE_BUILD_TYPE CUSTOM_ECOS_BUILD) + set(CMAKE_C_COMPILE_OBJECT " -o -c ") + set(CMAKE_CXX_COMPILE_OBJECT " -o -c ") # special link commands for ecos-executables - SET(CMAKE_CXX_LINK_EXECUTABLE " -o ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}") - SET(CMAKE_C_LINK_EXECUTABLE " -o ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}") + set(CMAKE_CXX_LINK_EXECUTABLE " -o ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}") + set(CMAKE_C_LINK_EXECUTABLE " -o ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_BINARY_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}") # some strict compiler flags - SET (CMAKE_C_FLAGS "-Wstrict-prototypes") - SET (CMAKE_CXX_FLAGS "-Woverloaded-virtual -fno-rtti -Wctor-dtor-privacy -fno-strict-aliasing -fno-exceptions") + set (CMAKE_C_FLAGS "-Wstrict-prototypes") + set (CMAKE_CXX_FLAGS "-Woverloaded-virtual -fno-rtti -Wctor-dtor-privacy -fno-strict-aliasing -fno-exceptions") - ADD_EXECUTABLE(${_exe_NAME} ${ARGN}) - SET_TARGET_PROPERTIES(${_exe_NAME} PROPERTIES SUFFIX ".elf") + add_executable(${_exe_NAME} ${ARGN}) + set_target_properties(${_exe_NAME} PROPERTIES SUFFIX ".elf") #create a binary file - ADD_CUSTOM_COMMAND( + add_custom_command( TARGET ${_exe_NAME} POST_BUILD COMMAND ${ECOS_ARCH_PREFIX}objcopy @@ -206,7 +206,7 @@ MACRO(ECOS_ADD_EXECUTABLE _exe_NAME ) ) #and an srec file - ADD_CUSTOM_COMMAND( + add_custom_command( TARGET ${_exe_NAME} POST_BUILD COMMAND ${ECOS_ARCH_PREFIX}objcopy @@ -214,17 +214,17 @@ MACRO(ECOS_ADD_EXECUTABLE _exe_NAME ) ) #add the created files to the clean-files - SET_DIRECTORY_PROPERTIES( + set_directory_properties( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.bin;${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.srec;${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst;" ) - ADD_CUSTOM_TARGET(ecosclean ${CMAKE_COMMAND} -DECOS_DIR=${CMAKE_CURRENT_BINARY_DIR}/ecos/ -P ${ECOS_CMAKE_MODULE_DIR}/ecos_clean.cmake ) - ADD_CUSTOM_TARGET(normalclean ${CMAKE_MAKE_PROGRAM} clean WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - ADD_DEPENDENCIES (ecosclean normalclean) + add_custom_target(ecosclean ${CMAKE_COMMAND} -DECOS_DIR=${CMAKE_CURRENT_BINARY_DIR}/ecos/ -P ${ECOS_CMAKE_MODULE_DIR}/ecos_clean.cmake ) + add_custom_target(normalclean ${CMAKE_MAKE_PROGRAM} clean WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_dependencies (ecosclean normalclean) - ADD_CUSTOM_TARGET( listing + add_custom_target( listing COMMAND echo -e \"\\n--- Symbols sorted by address ---\\n\" > ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -n ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst COMMAND echo -e \"\\n--- Symbols sorted by size ---\\n\" >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst @@ -232,5 +232,5 @@ MACRO(ECOS_ADD_EXECUTABLE _exe_NAME ) COMMAND echo -e \"\\n--- Full assembly listing ---\\n\" >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst COMMAND ${ECOS_ARCH_PREFIX}objdump -S -x -d -C ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.elf >> ${CMAKE_CURRENT_BINARY_DIR}/${_exe_NAME}.lst ) -ENDMACRO(ECOS_ADD_EXECUTABLE) +endmacro() diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 0b2d1b833..1b823a8e9 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -198,7 +198,7 @@ function (__java_copy_file src dest comment) ${dest} DEPENDS ${src} COMMENT ${comment}) -endfunction (__java_copy_file src dest comment) +endfunction () # define helper scripts set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.cmake) @@ -209,18 +209,18 @@ function(add_jar _TARGET_NAME) if (NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) - endif(NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) + endif() if (CMAKE_JAVA_JAR_ENTRY_POINT) set(_ENTRY_POINT_OPTION e) set(_ENTRY_POINT_VALUE ${CMAKE_JAVA_JAR_ENTRY_POINT}) - endif (CMAKE_JAVA_JAR_ENTRY_POINT) + endif () if (LIBRARY_OUTPUT_PATH) set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH}) - else (LIBRARY_OUTPUT_PATH) + else () set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${CMAKE_JAVA_TARGET_OUTPUT_DIR}) - endif (LIBRARY_OUTPUT_PATH) + endif () set(CMAKE_JAVA_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH} @@ -231,13 +231,13 @@ function(add_jar _TARGET_NAME) if (WIN32 AND NOT CYGWIN) set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";") - else (WIN32 AND NOT CYGWIN) + else () set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":") - endif(WIN32 AND NOT CYGWIN) + endif() foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH}) set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") - endforeach(JAVA_INCLUDE_DIR) + endforeach() set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_JAVA_TARGET_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") @@ -250,7 +250,7 @@ function(add_jar _TARGET_NAME) set(_JAVA_TARGET_OUTPUT_LINK "${_TARGET_NAME}.jar") elseif (CMAKE_JAVA_TARGET_OUTPUT_NAME) set(_JAVA_TARGET_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}.jar") - endif (CMAKE_JAVA_TARGET_OUTPUT_NAME AND CMAKE_JAVA_TARGET_VERSION) + endif () # reset set(CMAKE_JAVA_TARGET_OUTPUT_NAME) @@ -270,9 +270,9 @@ function(add_jar _TARGET_NAME) string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN) if (${_BIN_LEN} LESS ${_SRC_LEN}) set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH}) - else (${_BIN_LEN} LESS ${_SRC_LEN}) + else () set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH}) - endif (${_BIN_LEN} LESS ${_SRC_LEN}) + endif () get_filename_component(_JAVA_REL_PATH ${_JAVA_REL_PATH} PATH) if (_JAVA_EXT MATCHES ".java") @@ -290,13 +290,13 @@ function(add_jar _TARGET_NAME) list(APPEND CMAKE_JAVA_INCLUDE_PATH ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}} ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}_CLASSPATH}) list(APPEND _JAVA_DEPENDS ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}}) - else (_JAVA_EXT MATCHES ".java") + else () __java_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/${_JAVA_SOURCE_FILE} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE} "Copying ${_JAVA_SOURCE_FILE} to the build directory") list(APPEND _JAVA_RESOURCE_FILES ${_JAVA_SOURCE_FILE}) - endif (_JAVA_EXT MATCHES ".java") - endforeach(_JAVA_SOURCE_FILE) + endif () + endforeach() # create an empty java_class_filelist if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist) @@ -327,7 +327,7 @@ function(add_jar _TARGET_NAME) DEPENDS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) - endif (_JAVA_COMPILE_FILES) + endif () # create the jar file set(_JAVA_JAR_OUTPUT_PATH @@ -367,7 +367,7 @@ function(add_jar _TARGET_NAME) DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}" ) - endif (CMAKE_JNI_TARGET) + endif () # Add the target and make sure we have the latest resource files. add_custom_target(${_TARGET_NAME} ALL DEPENDS ${_JAVA_JAR_OUTPUT_PATH}) @@ -398,8 +398,8 @@ function(add_jar _TARGET_NAME) JNI_SYMLINK ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} ) - endif (CMAKE_JNI_TARGET) - endif (_JAVA_TARGET_OUTPUT_LINK) + endif () + endif () set_property( TARGET @@ -417,7 +417,7 @@ function(add_jar _TARGET_NAME) ${CMAKE_JAVA_CLASS_OUTPUT_PATH} ) -endfunction(add_jar) +endfunction() function(INSTALL_JAR _TARGET_NAME _DESTINATION) get_property(__FILES @@ -434,10 +434,10 @@ function(INSTALL_JAR _TARGET_NAME _DESTINATION) DESTINATION ${_DESTINATION} ) - else (__FILES) + else () message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.") - endif (__FILES) -endfunction(INSTALL_JAR _TARGET_NAME _DESTINATION) + endif () +endfunction() function(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION) get_property(__SYMLINK @@ -454,10 +454,10 @@ function(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION) DESTINATION ${_DESTINATION} ) - else (__SYMLINK) + else () message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.") - endif (__SYMLINK) -endfunction(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION) + endif () +endfunction() function (find_jar VARIABLE) set(_jar_names) @@ -481,12 +481,12 @@ function (find_jar VARIABLE) set(_state "paths") elseif (${arg} STREQUAL "DOC") set(_state "doc") - else (${arg} STREQUAL "NAMES") + else () set(_jar_names ${arg}) if (_jar_doc STREQUAL "NOTSET") set(_jar_doc "Finding ${arg} jar") - endif (_jar_doc STREQUAL "NOTSET") - endif (${arg} STREQUAL "VERSIONS") + endif () + endif () elseif (${_state} STREQUAL "versions") if (${arg} STREQUAL "NAMES") set(_state "names") @@ -494,9 +494,9 @@ function (find_jar VARIABLE) set(_state "paths") elseif (${arg} STREQUAL "DOC") set(_state "doc") - else (${arg} STREQUAL "NAMES") + else () set(_jar_versions ${_jar_versions} ${arg}) - endif (${arg} STREQUAL "NAMES") + endif () elseif (${_state} STREQUAL "names") if (${arg} STREQUAL "VERSIONS") set(_state "versions") @@ -504,12 +504,12 @@ function (find_jar VARIABLE) set(_state "paths") elseif (${arg} STREQUAL "DOC") set(_state "doc") - else (${arg} STREQUAL "VERSIONS") + else () set(_jar_names ${_jar_names} ${arg}) if (_jar_doc STREQUAL "NOTSET") set(_jar_doc "Finding ${arg} jar") - endif (_jar_doc STREQUAL "NOTSET") - endif (${arg} STREQUAL "VERSIONS") + endif () + endif () elseif (${_state} STREQUAL "paths") if (${arg} STREQUAL "VERSIONS") set(_state "versions") @@ -517,9 +517,9 @@ function (find_jar VARIABLE) set(_state "names") elseif (${arg} STREQUAL "DOC") set(_state "doc") - else (${arg} STREQUAL "VERSIONS") + else () set(_jar_paths ${_jar_paths} ${arg}) - endif (${arg} STREQUAL "VERSIONS") + endif () elseif (${_state} STREQUAL "doc") if (${arg} STREQUAL "VERSIONS") set(_state "versions") @@ -527,29 +527,29 @@ function (find_jar VARIABLE) set(_state "names") elseif (${arg} STREQUAL "PATHS") set(_state "paths") - else (${arg} STREQUAL "VERSIONS") + else () set(_jar_doc ${arg}) - endif (${arg} STREQUAL "VERSIONS") - endif (${_state} STREQUAL "name") - endforeach (arg ${ARGN}) + endif () + endif () + endforeach () if (NOT _jar_names) message(FATAL_ERROR "find_jar: No name to search for given") - endif (NOT _jar_names) + endif () foreach (jar_name ${_jar_names}) foreach (version ${_jar_versions}) set(_jar_files ${_jar_files} ${jar_name}-${version}.jar) - endforeach (version ${_jar_versions}) + endforeach () set(_jar_files ${_jar_files} ${jar_name}.jar) - endforeach (jar_name ${_jar_names}) + endforeach () find_file(${VARIABLE} NAMES ${_jar_files} PATHS ${_jar_paths} DOC ${_jar_doc} NO_DEFAULT_PATH) -endfunction (find_jar VARIABLE) +endfunction () function(create_javadoc _target) set(_javadoc_packages) @@ -815,8 +815,8 @@ function(create_javadoc _target) else () set(_javadoc_version ${arg}) endif () - endif (${_state} STREQUAL "package") - endforeach (arg ${ARGN}) + endif () + endforeach () set(_javadoc_builddir ${CMAKE_CURRENT_BINARY_DIR}/javadoc/${_target}) set(_javadoc_options -d ${_javadoc_builddir}) @@ -827,12 +827,12 @@ function(create_javadoc _target) if (_start) set(_sourcepath ${_path}) set(_start FALSE) - else (_start) + else () set(_sourcepath ${_sourcepath}:${_path}) - endif (_start) - endforeach(_path ${_javadoc_sourcepath}) + endif () + endforeach() set(_javadoc_options ${_javadoc_options} -sourcepath ${_sourcepath}) - endif (_javadoc_sourcepath) + endif () if (_javadoc_classpath) set(_start TRUE) @@ -840,32 +840,32 @@ function(create_javadoc _target) if (_start) set(_classpath ${_path}) set(_start FALSE) - else (_start) + else () set(_classpath ${_classpath}:${_path}) - endif (_start) - endforeach(_path ${_javadoc_classpath}) + endif () + endforeach() set(_javadoc_options ${_javadoc_options} -classpath "${_classpath}") - endif (_javadoc_classpath) + endif () if (_javadoc_doctitle) set(_javadoc_options ${_javadoc_options} -doctitle '${_javadoc_doctitle}') - endif (_javadoc_doctitle) + endif () if (_javadoc_windowtitle) set(_javadoc_options ${_javadoc_options} -windowtitle '${_javadoc_windowtitle}') - endif (_javadoc_windowtitle) + endif () if (_javadoc_author) set(_javadoc_options ${_javadoc_options} -author) - endif (_javadoc_author) + endif () if (_javadoc_use) set(_javadoc_options ${_javadoc_options} -use) - endif (_javadoc_use) + endif () if (_javadoc_version) set(_javadoc_options ${_javadoc_options} -version) - endif (_javadoc_version) + endif () add_custom_target(${_target}_javadoc ALL COMMAND ${Java_JAVADOC_EXECUTABLE} ${_javadoc_options} @@ -878,4 +878,4 @@ function(create_javadoc _target) DIRECTORY ${_javadoc_builddir} DESTINATION ${_javadoc_installpath} ) -endfunction(create_javadoc) +endfunction() diff --git a/Modules/UseJavaClassFilelist.cmake b/Modules/UseJavaClassFilelist.cmake index c842bf71a..6f3a4e7a9 100644 --- a/Modules/UseJavaClassFilelist.cmake +++ b/Modules/UseJavaClassFilelist.cmake @@ -28,25 +28,25 @@ if (CMAKE_JAVA_CLASS_OUTPUT_PATH) file(GLOB_RECURSE _JAVA_GLOBBED_TMP_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${JAR_CLASS_PREFIX}/*.class") if (_JAVA_GLOBBED_TMP_FILES) list(APPEND _JAVA_GLOBBED_FILES ${_JAVA_GLOBBED_TMP_FILES}) - endif (_JAVA_GLOBBED_TMP_FILES) - endforeach(JAR_CLASS_PREFIX ${CMAKE_JAR_CLASSES_PREFIX}) + endif () + endforeach() else() file(GLOB_RECURSE _JAVA_GLOBBED_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/*.class") - endif (CMAKE_JAR_CLASSES_PREFIX) + endif () set(_JAVA_CLASS_FILES) # file(GLOB_RECURSE foo RELATIVE) is broken so we need this. foreach(_JAVA_GLOBBED_FILE ${_JAVA_GLOBBED_FILES}) file(RELATIVE_PATH _JAVA_CLASS_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH} ${_JAVA_GLOBBED_FILE}) set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES}${_JAVA_CLASS_FILE}\n) - endforeach(_JAVA_GLOBBED_FILE ${_JAVA_GLOBBED_FILES}) + endforeach() # write to file file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist ${_JAVA_CLASS_FILES}) - else (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}") + else () message(SEND_ERROR "FATAL: Java class output path doesn't exist") - endif (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}") -else (CMAKE_JAVA_CLASS_OUTPUT_PATH) + endif () +else () message(SEND_ERROR "FATAL: Can't find CMAKE_JAVA_CLASS_OUTPUT_PATH") -endif (CMAKE_JAVA_CLASS_OUTPUT_PATH) +endif () diff --git a/Modules/UseJavaSymlinks.cmake b/Modules/UseJavaSymlinks.cmake index c66ee1ea1..88dd7689c 100644 --- a/Modules/UseJavaSymlinks.cmake +++ b/Modules/UseJavaSymlinks.cmake @@ -26,7 +26,7 @@ if (UNIX AND _JAVA_TARGET_OUTPUT_LINK) COMMAND ${LN_EXECUTABLE} -sf "${_JAVA_TARGET_OUTPUT_NAME}" "${_JAVA_TARGET_OUTPUT_LINK}" WORKING_DIRECTORY ${_JAVA_TARGET_DIR} ) - else (_JAVA_TARGET_OUTPUT_NAME) + else () message(SEND_ERROR "FATAL: Can't find _JAVA_TARGET_OUTPUT_NAME") - endif (_JAVA_TARGET_OUTPUT_NAME) -endif (UNIX AND _JAVA_TARGET_OUTPUT_LINK) + endif () +endif () diff --git a/Modules/UsePkgConfig.cmake b/Modules/UsePkgConfig.cmake index 7f4318f05..b1569f9da 100644 --- a/Modules/UsePkgConfig.cmake +++ b/Modules/UsePkgConfig.cmake @@ -24,55 +24,55 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(PKGCONFIG_EXECUTABLE NAMES pkg-config ) +find_program(PKGCONFIG_EXECUTABLE NAMES pkg-config ) -MACRO(PKGCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags) - MESSAGE(STATUS +macro(PKGCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags) + message(STATUS "WARNING: you are using the obsolete 'PKGCONFIG' macro, use FindPkgConfig") # reset the variables at the beginning - SET(${_include_DIR}) - SET(${_link_DIR}) - SET(${_link_FLAGS}) - SET(${_cflags}) + set(${_include_DIR}) + set(${_link_DIR}) + set(${_link_FLAGS}) + set(${_cflags}) # if pkg-config has been found - IF(PKGCONFIG_EXECUTABLE) + if(PKGCONFIG_EXECUTABLE) - EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --exists RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull ) + exec_program(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --exists RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull ) # and if the package of interest also exists for pkg-config, then get the information - IF(NOT _return_VALUE) + if(NOT _return_VALUE) - EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=includedir + exec_program(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=includedir OUTPUT_VARIABLE ${_include_DIR} ) - STRING(REGEX REPLACE "[\r\n]" " " ${_include_DIR} "${${_include_DIR}}") + string(REGEX REPLACE "[\r\n]" " " ${_include_DIR} "${${_include_DIR}}") - EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=libdir + exec_program(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=libdir OUTPUT_VARIABLE ${_link_DIR} ) - STRING(REGEX REPLACE "[\r\n]" " " ${_link_DIR} "${${_link_DIR}}") + string(REGEX REPLACE "[\r\n]" " " ${_link_DIR} "${${_link_DIR}}") - EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --libs + exec_program(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --libs OUTPUT_VARIABLE ${_link_FLAGS} ) - STRING(REGEX REPLACE "[\r\n]" " " ${_link_FLAGS} "${${_link_FLAGS}}") + string(REGEX REPLACE "[\r\n]" " " ${_link_FLAGS} "${${_link_FLAGS}}") - EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --cflags + exec_program(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --cflags OUTPUT_VARIABLE ${_cflags} ) - STRING(REGEX REPLACE "[\r\n]" " " ${_cflags} "${${_cflags}}") + string(REGEX REPLACE "[\r\n]" " " ${_cflags} "${${_cflags}}") - ELSE( NOT _return_VALUE) + else() - MESSAGE(STATUS "PKGCONFIG() indicates that ${_package} is not installed (install the package which contains ${_package}.pc if you want to support this feature)") + message(STATUS "PKGCONFIG() indicates that ${_package} is not installed (install the package which contains ${_package}.pc if you want to support this feature)") - ENDIF(NOT _return_VALUE) + endif() # if pkg-config has NOT been found, INFORM the user - ELSE(PKGCONFIG_EXECUTABLE) + else() - MESSAGE(STATUS "WARNING: PKGCONFIG() indicates that the tool pkg-config has not been found on your system. You should install it.") + message(STATUS "WARNING: PKGCONFIG() indicates that the tool pkg-config has not been found on your system. You should install it.") - ENDIF(PKGCONFIG_EXECUTABLE) + endif() -ENDMACRO(PKGCONFIG _include_DIR _link_DIR _link_FLAGS _cflags) +endmacro() -MARK_AS_ADVANCED(PKGCONFIG_EXECUTABLE) +mark_as_advanced(PKGCONFIG_EXECUTABLE) diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake index 027504fc5..f05a3d5f3 100644 --- a/Modules/UseQt4.cmake +++ b/Modules/UseQt4.cmake @@ -16,93 +16,101 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -ADD_DEFINITIONS(${QT_DEFINITIONS}) -SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG QT_DEBUG) -SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG) -SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG) -SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG) -IF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) - SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_DEBUG) -ENDIF() +add_definitions(${QT_DEFINITIONS}) +set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG QT_DEBUG) +set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG) +set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG) +set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG) +if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_DEBUG) +endif() -INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR}) +if(QT_INCLUDE_DIRS_NO_SYSTEM) + include_directories(${QT_INCLUDE_DIR}) +else(QT_INCLUDE_DIRS_NO_SYSTEM) + include_directories(SYSTEM ${QT_INCLUDE_DIR}) +endif(QT_INCLUDE_DIRS_NO_SYSTEM) -SET(QT_LIBRARIES "") -SET(QT_LIBRARIES_PLUGINS "") +set(QT_LIBRARIES "") +set(QT_LIBRARIES_PLUGINS "") -IF (QT_USE_QTMAIN) - IF (Q_WS_WIN) - SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY}) - ENDIF (Q_WS_WIN) -ENDIF (QT_USE_QTMAIN) +if (QT_USE_QTMAIN) + if (Q_WS_WIN) + set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY}) + endif () +endif () -IF(QT_DONT_USE_QTGUI) - SET(QT_USE_QTGUI 0) -ELSE(QT_DONT_USE_QTGUI) - SET(QT_USE_QTGUI 1) -ENDIF(QT_DONT_USE_QTGUI) +if(QT_DONT_USE_QTGUI) + set(QT_USE_QTGUI 0) +else() + set(QT_USE_QTGUI 1) +endif() -IF(QT_DONT_USE_QTCORE) - SET(QT_USE_QTCORE 0) -ELSE(QT_DONT_USE_QTCORE) - SET(QT_USE_QTCORE 1) -ENDIF(QT_DONT_USE_QTCORE) +if(QT_DONT_USE_QTCORE) + set(QT_USE_QTCORE 0) +else() + set(QT_USE_QTCORE 1) +endif() -IF (QT_USE_QT3SUPPORT) - ADD_DEFINITIONS(-DQT3_SUPPORT) -ENDIF (QT_USE_QT3SUPPORT) +if (QT_USE_QT3SUPPORT) + add_definitions(-DQT3_SUPPORT) +endif () # list dependent modules, so dependent libraries are added -SET(QT_QT3SUPPORT_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE) -SET(QT_QTSVG_MODULE_DEPENDS QTGUI QTXML QTCORE) -SET(QT_QTUITOOLS_MODULE_DEPENDS QTGUI QTXML QTCORE) -SET(QT_QTHELP_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE) -IF(QT_QTDBUS_FOUND) - SET(QT_PHONON_MODULE_DEPENDS QTGUI QTDBUS QTCORE) -ELSE(QT_QTDBUS_FOUND) - SET(QT_PHONON_MODULE_DEPENDS QTGUI QTCORE) -ENDIF(QT_QTDBUS_FOUND) -SET(QT_QTDBUS_MODULE_DEPENDS QTXML QTCORE) -SET(QT_QTXMLPATTERNS_MODULE_DEPENDS QTNETWORK QTCORE) -SET(QT_QAXCONTAINER_MODULE_DEPENDS QTGUI QTCORE) -SET(QT_QAXSERVER_MODULE_DEPENDS QTGUI QTCORE) -SET(QT_QTSCRIPTTOOLS_MODULE_DEPENDS QTGUI QTCORE) -SET(QT_QTWEBKIT_MODULE_DEPENDS QTXMLPATTERNS QTGUI QTCORE) -SET(QT_QTDECLARATIVE_MODULE_DEPENDS QTSCRIPT QTSVG QTSQL QTXMLPATTERNS QTGUI QTCORE) -SET(QT_QTMULTIMEDIA_MODULE_DEPENDS QTGUI QTCORE) -SET(QT_QTOPENGL_MODULE_DEPENDS QTGUI QTCORE) -SET(QT_QTSCRIPT_MODULE_DEPENDS QTCORE) -SET(QT_QTGUI_MODULE_DEPENDS QTCORE) -SET(QT_QTTEST_MODULE_DEPENDS QTCORE) -SET(QT_QTXML_MODULE_DEPENDS QTCORE) -SET(QT_QTSQL_MODULE_DEPENDS QTCORE) -SET(QT_QTNETWORK_MODULE_DEPENDS QTCORE) +set(QT_QT3SUPPORT_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE) +set(QT_QTSVG_MODULE_DEPENDS QTGUI QTXML QTCORE) +set(QT_QTUITOOLS_MODULE_DEPENDS QTGUI QTXML QTCORE) +set(QT_QTHELP_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE) +if(QT_QTDBUS_FOUND) + set(QT_PHONON_MODULE_DEPENDS QTGUI QTDBUS QTCORE) +else() + set(QT_PHONON_MODULE_DEPENDS QTGUI QTCORE) +endif() +set(QT_QTDBUS_MODULE_DEPENDS QTXML QTCORE) +set(QT_QTXMLPATTERNS_MODULE_DEPENDS QTNETWORK QTCORE) +set(QT_QAXCONTAINER_MODULE_DEPENDS QTGUI QTCORE) +set(QT_QAXSERVER_MODULE_DEPENDS QTGUI QTCORE) +set(QT_QTSCRIPTTOOLS_MODULE_DEPENDS QTGUI QTCORE) +set(QT_QTWEBKIT_MODULE_DEPENDS QTXMLPATTERNS QTGUI QTCORE) +set(QT_QTDECLARATIVE_MODULE_DEPENDS QTSCRIPT QTSVG QTSQL QTXMLPATTERNS QTGUI QTCORE) +set(QT_QTMULTIMEDIA_MODULE_DEPENDS QTGUI QTCORE) +set(QT_QTOPENGL_MODULE_DEPENDS QTGUI QTCORE) +set(QT_QTSCRIPT_MODULE_DEPENDS QTCORE) +set(QT_QTGUI_MODULE_DEPENDS QTCORE) +set(QT_QTTEST_MODULE_DEPENDS QTCORE) +set(QT_QTXML_MODULE_DEPENDS QTCORE) +set(QT_QTSQL_MODULE_DEPENDS QTCORE) +set(QT_QTNETWORK_MODULE_DEPENDS QTCORE) # Qt modules (in order of dependence) -FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN +foreach(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN QAXSERVER QAXCONTAINER QTDECLARATIVE QTSCRIPT QTSVG QTUITOOLS QTHELP QTWEBKIT PHONON QTSCRIPTTOOLS QTMULTIMEDIA QTXMLPATTERNS QTGUI QTTEST QTDBUS QTXML QTSQL QTNETWORK QTCORE) - IF (QT_USE_${module} OR QT_USE_${module}_DEPENDS) - IF (QT_${module}_FOUND) - IF(QT_USE_${module}) - STRING(REPLACE "QT" "" qt_module_def "${module}") - ADD_DEFINITIONS(-DQT_${qt_module_def}_LIB) - INCLUDE_DIRECTORIES(${QT_${module}_INCLUDE_DIR}) - ENDIF(QT_USE_${module}) - SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY}) - SET(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS}) - IF(QT_IS_STATIC) - SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES}) - ENDIF(QT_IS_STATIC) - FOREACH(depend_module ${QT_${module}_MODULE_DEPENDS}) - SET(QT_USE_${depend_module}_DEPENDS 1) - ENDFOREACH(depend_module ${QT_${module}_MODULE_DEPENDS}) - ELSE (QT_${module}_FOUND) - MESSAGE("Qt ${module} library not found.") - ENDIF (QT_${module}_FOUND) - ENDIF (QT_USE_${module} OR QT_USE_${module}_DEPENDS) - -ENDFOREACH(module) + if (QT_USE_${module} OR QT_USE_${module}_DEPENDS) + if (QT_${module}_FOUND) + if(QT_USE_${module}) + string(REPLACE "QT" "" qt_module_def "${module}") + add_definitions(-DQT_${qt_module_def}_LIB) + if(QT_INCLUDE_DIRS_NO_SYSTEM) + include_directories(${QT_${module}_INCLUDE_DIR}) + else(QT_INCLUDE_DIRS_NO_SYSTEM) + include_directories(SYSTEM ${QT_${module}_INCLUDE_DIR}) + endif(QT_INCLUDE_DIRS_NO_SYSTEM) + endif() + set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY}) + set(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS}) + if(QT_IS_STATIC) + set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES}) + endif() + foreach(depend_module ${QT_${module}_MODULE_DEPENDS}) + set(QT_USE_${depend_module}_DEPENDS 1) + endforeach() + else () + message("Qt ${module} library not found.") + endif () + endif () + +endforeach() diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index ef7672440..2a095854c 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -10,12 +10,12 @@ # Set Source files properties such as CPLUSPLUS and SWIG_FLAGS to specify # special behavior of SWIG. Also global CMAKE_SWIG_FLAGS can be used to add # special flags to all swig calls. -# Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify +# Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify # where to write all the swig generated module (swig -outdir option) # The name-specific variable SWIG_MODULE__EXTRA_DEPS may be used # to specify extra dependencies for the generated modules. # If the source file generated by swig need some special flag you can use -# SET_SOURCE_FILES_PROPERTIES( ${swig_generated_file_fullname} +# set_source_files_properties( ${swig_generated_file_fullname} # PROPERTIES COMPILE_FLAGS "-bla") @@ -33,136 +33,136 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET(SWIG_CXX_EXTENSION "cxx") -SET(SWIG_EXTRA_LIBRARIES "") +set(SWIG_CXX_EXTENSION "cxx") +set(SWIG_EXTRA_LIBRARIES "") -SET(SWIG_PYTHON_EXTRA_FILE_EXTENSION "py") +set(SWIG_PYTHON_EXTRA_FILE_EXTENSION "py") # # For given swig module initialize variables associated with it # -MACRO(SWIG_MODULE_INITIALIZE name language) - STRING(TOUPPER "${language}" swig_uppercase_language) - STRING(TOLOWER "${language}" swig_lowercase_language) - SET(SWIG_MODULE_${name}_LANGUAGE "${swig_uppercase_language}") - SET(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}") - - SET(SWIG_MODULE_${name}_REAL_NAME "${name}") - IF("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "UNKNOWN") - MESSAGE(FATAL_ERROR "SWIG Error: Language \"${language}\" not found") - ELSEIF("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PYTHON") +macro(SWIG_MODULE_INITIALIZE name language) + string(TOUPPER "${language}" swig_uppercase_language) + string(TOLOWER "${language}" swig_lowercase_language) + set(SWIG_MODULE_${name}_LANGUAGE "${swig_uppercase_language}") + set(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}") + + set(SWIG_MODULE_${name}_REAL_NAME "${name}") + if("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "UNKNOWN") + message(FATAL_ERROR "SWIG Error: Language \"${language}\" not found") + elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PYTHON") # when swig is used without the -interface it will produce in the module.py - # a 'import _modulename' statement, which implies having a corresponding + # a 'import _modulename' statement, which implies having a corresponding # _modulename.so (*NIX), _modulename.pyd (Win32). - SET(SWIG_MODULE_${name}_REAL_NAME "_${name}") - ELSEIF("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PERL") - SET(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow") - ENDIF() -ENDMACRO(SWIG_MODULE_INITIALIZE) + set(SWIG_MODULE_${name}_REAL_NAME "_${name}") + elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PERL") + set(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow") + endif() +endmacro() # # For a given language, input file, and output file, determine extra files that # will be generated. This is internal swig macro. # -MACRO(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile) - SET(${outfiles} "") - GET_SOURCE_FILE_PROPERTY(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename +macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile) + set(${outfiles} "") + get_source_file_property(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename ${infile} SWIG_MODULE_NAME) - IF(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND") - GET_FILENAME_COMPONENT(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${infile}" NAME_WE) - ENDIF(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND") - FOREACH(it ${SWIG_${language}_EXTRA_FILE_EXTENSION}) - SET(${outfiles} ${${outfiles}} + if(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND") + get_filename_component(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${infile}" NAME_WE) + endif() + foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSION}) + set(${outfiles} ${${outfiles}} "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}.${it}") - ENDFOREACH(it) -ENDMACRO(SWIG_GET_EXTRA_OUTPUT_FILES) + endforeach() +endmacro() # # Take swig (*.i) file and add proper custom commands for it # -MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) - SET(swig_full_infile ${infile}) - GET_FILENAME_COMPONENT(swig_source_file_path "${infile}" PATH) - GET_FILENAME_COMPONENT(swig_source_file_name_we "${infile}" NAME_WE) - GET_SOURCE_FILE_PROPERTY(swig_source_file_generated ${infile} GENERATED) - GET_SOURCE_FILE_PROPERTY(swig_source_file_cplusplus ${infile} CPLUSPLUS) - GET_SOURCE_FILE_PROPERTY(swig_source_file_flags ${infile} SWIG_FLAGS) - IF("${swig_source_file_flags}" STREQUAL "NOTFOUND") - SET(swig_source_file_flags "") - ENDIF("${swig_source_file_flags}" STREQUAL "NOTFOUND") - SET(swig_source_file_fullname "${infile}") - IF(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}") - STRING(REGEX REPLACE +macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) + set(swig_full_infile ${infile}) + get_filename_component(swig_source_file_path "${infile}" PATH) + get_filename_component(swig_source_file_name_we "${infile}" NAME_WE) + get_source_file_property(swig_source_file_generated ${infile} GENERATED) + get_source_file_property(swig_source_file_cplusplus ${infile} CPLUSPLUS) + get_source_file_property(swig_source_file_flags ${infile} SWIG_FLAGS) + if("${swig_source_file_flags}" STREQUAL "NOTFOUND") + set(swig_source_file_flags "") + endif() + set(swig_source_file_fullname "${infile}") + if(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}") + string(REGEX REPLACE "^${CMAKE_CURRENT_SOURCE_DIR}" "" swig_source_file_relative_path "${swig_source_file_path}") - ELSE(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}") - IF(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}") - STRING(REGEX REPLACE + else() + if(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}") + string(REGEX REPLACE "^${CMAKE_CURRENT_BINARY_DIR}" "" swig_source_file_relative_path "${swig_source_file_path}") - SET(swig_source_file_generated 1) - ELSE(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}") - SET(swig_source_file_relative_path "${swig_source_file_path}") - IF(swig_source_file_generated) - SET(swig_source_file_fullname "${CMAKE_CURRENT_BINARY_DIR}/${infile}") - ELSE(swig_source_file_generated) - SET(swig_source_file_fullname "${CMAKE_CURRENT_SOURCE_DIR}/${infile}") - ENDIF(swig_source_file_generated) - ENDIF(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}") - ENDIF(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}") - - SET(swig_generated_file_fullname + set(swig_source_file_generated 1) + else() + set(swig_source_file_relative_path "${swig_source_file_path}") + if(swig_source_file_generated) + set(swig_source_file_fullname "${CMAKE_CURRENT_BINARY_DIR}/${infile}") + else() + set(swig_source_file_fullname "${CMAKE_CURRENT_SOURCE_DIR}/${infile}") + endif() + endif() + endif() + + set(swig_generated_file_fullname "${CMAKE_CURRENT_BINARY_DIR}") - IF(swig_source_file_relative_path) - SET(swig_generated_file_fullname + if(swig_source_file_relative_path) + set(swig_generated_file_fullname "${swig_generated_file_fullname}/${swig_source_file_relative_path}") - ENDIF(swig_source_file_relative_path) + endif() # If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir - IF(CMAKE_SWIG_OUTDIR) - SET(swig_outdir ${CMAKE_SWIG_OUTDIR}) - ELSE(CMAKE_SWIG_OUTDIR) - SET(swig_outdir ${CMAKE_CURRENT_BINARY_DIR}) - ENDIF(CMAKE_SWIG_OUTDIR) + if(CMAKE_SWIG_OUTDIR) + set(swig_outdir ${CMAKE_SWIG_OUTDIR}) + else() + set(swig_outdir ${CMAKE_CURRENT_BINARY_DIR}) + endif() SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE} swig_extra_generated_files "${swig_outdir}" "${infile}") - SET(swig_generated_file_fullname + set(swig_generated_file_fullname "${swig_generated_file_fullname}/${swig_source_file_name_we}") # add the language into the name of the file (i.e. TCL_wrap) # this allows for the same .i file to be wrapped into different languages - SET(swig_generated_file_fullname + set(swig_generated_file_fullname "${swig_generated_file_fullname}${SWIG_MODULE_${name}_LANGUAGE}_wrap") - IF(swig_source_file_cplusplus) - SET(swig_generated_file_fullname + if(swig_source_file_cplusplus) + set(swig_generated_file_fullname "${swig_generated_file_fullname}.${SWIG_CXX_EXTENSION}") - ELSE(swig_source_file_cplusplus) - SET(swig_generated_file_fullname + else() + set(swig_generated_file_fullname "${swig_generated_file_fullname}.c") - ENDIF(swig_source_file_cplusplus) + endif() - #MESSAGE("Full path to source file: ${swig_source_file_fullname}") - #MESSAGE("Full path to the output file: ${swig_generated_file_fullname}") - GET_DIRECTORY_PROPERTY(cmake_include_directories INCLUDE_DIRECTORIES) - SET(swig_include_dirs) - FOREACH(it ${cmake_include_directories}) - SET(swig_include_dirs ${swig_include_dirs} "-I${it}") - ENDFOREACH(it) + #message("Full path to source file: ${swig_source_file_fullname}") + #message("Full path to the output file: ${swig_generated_file_fullname}") + get_directory_property(cmake_include_directories INCLUDE_DIRECTORIES) + set(swig_include_dirs) + foreach(it ${cmake_include_directories}) + set(swig_include_dirs ${swig_include_dirs} "-I${it}") + endforeach() - SET(swig_special_flags) + set(swig_special_flags) # default is c, so add c++ flag if it is c++ - IF(swig_source_file_cplusplus) - SET(swig_special_flags ${swig_special_flags} "-c++") - ENDIF(swig_source_file_cplusplus) - SET(swig_extra_flags) - IF(SWIG_MODULE_${name}_EXTRA_FLAGS) - SET(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS}) - ENDIF(SWIG_MODULE_${name}_EXTRA_FLAGS) - ADD_CUSTOM_COMMAND( + if(swig_source_file_cplusplus) + set(swig_special_flags ${swig_special_flags} "-c++") + endif() + set(swig_extra_flags) + if(SWIG_MODULE_${name}_EXTRA_FLAGS) + set(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS}) + endif() + add_custom_command( OUTPUT "${swig_generated_file_fullname}" ${swig_extra_generated_files} # Let's create the ${swig_outdir} at execution time, in case dir contains $(OutDir) COMMAND ${CMAKE_COMMAND} -E make_directory ${swig_outdir} @@ -178,54 +178,54 @@ MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) "${swig_source_file_fullname}" MAIN_DEPENDENCY "${swig_source_file_fullname}" DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS} - COMMENT "Swig source") - SET_SOURCE_FILES_PROPERTIES("${swig_generated_file_fullname}" ${swig_extra_generated_files} + COMMENT "Swig source") + set_source_files_properties("${swig_generated_file_fullname}" ${swig_extra_generated_files} PROPERTIES GENERATED 1) - SET(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files}) -ENDMACRO(SWIG_ADD_SOURCE_TO_MODULE) + set(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files}) +endmacro() # # Create Swig module # -MACRO(SWIG_ADD_MODULE name language) +macro(SWIG_ADD_MODULE name language) SWIG_MODULE_INITIALIZE(${name} ${language}) - SET(swig_dot_i_sources) - SET(swig_other_sources) - FOREACH(it ${ARGN}) - IF(${it} MATCHES ".*\\.i$") - SET(swig_dot_i_sources ${swig_dot_i_sources} "${it}") - ELSE(${it} MATCHES ".*\\.i$") - SET(swig_other_sources ${swig_other_sources} "${it}") - ENDIF(${it} MATCHES ".*\\.i$") - ENDFOREACH(it) - - SET(swig_generated_sources) - FOREACH(it ${swig_dot_i_sources}) + set(swig_dot_i_sources) + set(swig_other_sources) + foreach(it ${ARGN}) + if(${it} MATCHES ".*\\.i$") + set(swig_dot_i_sources ${swig_dot_i_sources} "${it}") + else() + set(swig_other_sources ${swig_other_sources} "${it}") + endif() + endforeach() + + set(swig_generated_sources) + foreach(it ${swig_dot_i_sources}) SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source ${it}) - SET(swig_generated_sources ${swig_generated_sources} "${swig_generated_source}") - ENDFOREACH(it) - GET_DIRECTORY_PROPERTY(swig_extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES) - SET_DIRECTORY_PROPERTIES(PROPERTIES + set(swig_generated_sources ${swig_generated_sources} "${swig_generated_source}") + endforeach() + get_directory_property(swig_extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES) + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${swig_extra_clean_files};${swig_generated_sources}") - ADD_LIBRARY(${SWIG_MODULE_${name}_REAL_NAME} + add_library(${SWIG_MODULE_${name}_REAL_NAME} MODULE ${swig_generated_sources} ${swig_other_sources}) - STRING(TOLOWER "${language}" swig_lowercase_language) - IF ("${swig_lowercase_language}" STREQUAL "java") - IF (APPLE) + string(TOLOWER "${language}" swig_lowercase_language) + if ("${swig_lowercase_language}" STREQUAL "java") + if (APPLE) # In java you want: # System.loadLibrary("LIBRARY"); # then JNI will look for a library whose name is platform dependent, namely # MacOS : libLIBRARY.jnilib # Windows: LIBRARY.dll # Linux : libLIBRARY.so - SET_TARGET_PROPERTIES (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib") - ENDIF (APPLE) - ENDIF ("${swig_lowercase_language}" STREQUAL "java") - IF ("${swig_lowercase_language}" STREQUAL "python") + set_target_properties (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib") + endif () + endif () + if ("${swig_lowercase_language}" STREQUAL "python") # this is only needed for the python case where a _modulename.so is generated - SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") + set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") # Python extension modules on Windows must have the extension ".pyd" # instead of ".dll" as of Python 2.5. Older python versions do support # this suffix. @@ -234,20 +234,20 @@ MACRO(SWIG_ADD_MODULE name language) # Windows: .dll is no longer supported as a filename extension for extension modules. # .pyd is now the only filename extension that will be searched for. # - IF(WIN32 AND NOT CYGWIN) - SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".pyd") - ENDIF(WIN32 AND NOT CYGWIN) - ENDIF ("${swig_lowercase_language}" STREQUAL "python") -ENDMACRO(SWIG_ADD_MODULE) + if(WIN32 AND NOT CYGWIN) + set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".pyd") + endif() + endif () +endmacro() # # Like TARGET_LINK_LIBRARIES but for swig modules # -MACRO(SWIG_LINK_LIBRARIES name) - IF(SWIG_MODULE_${name}_REAL_NAME) - TARGET_LINK_LIBRARIES(${SWIG_MODULE_${name}_REAL_NAME} ${ARGN}) - ELSE(SWIG_MODULE_${name}_REAL_NAME) - MESSAGE(SEND_ERROR "Cannot find Swig library \"${name}\".") - ENDIF(SWIG_MODULE_${name}_REAL_NAME) -ENDMACRO(SWIG_LINK_LIBRARIES name) +macro(SWIG_LINK_LIBRARIES name) + if(SWIG_MODULE_${name}_REAL_NAME) + target_link_libraries(${SWIG_MODULE_${name}_REAL_NAME} ${ARGN}) + else() + message(SEND_ERROR "Cannot find Swig library \"${name}\".") + endif() +endmacro() diff --git a/Modules/UseVTK40.cmake b/Modules/UseVTK40.cmake index c1157d6be..d6bdaaa52 100644 --- a/Modules/UseVTK40.cmake +++ b/Modules/UseVTK40.cmake @@ -19,11 +19,11 @@ # to point here. # Add compiler flags needed to use VTK. -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VTK_REQUIRED_C_FLAGS}") -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VTK_REQUIRED_CXX_FLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VTK_REQUIRED_C_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VTK_REQUIRED_CXX_FLAGS}") # Add include directories needed to use VTK. -INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS}) +include_directories(${VTK_INCLUDE_DIRS}) # Add link directories needed to use VTK. -LINK_DIRECTORIES(${VTK_LIBRARY_DIRS}) +link_directories(${VTK_LIBRARY_DIRS}) diff --git a/Modules/UseVTKBuildSettings40.cmake b/Modules/UseVTKBuildSettings40.cmake index 4df59b9dd..474f67c9c 100644 --- a/Modules/UseVTKBuildSettings40.cmake +++ b/Modules/UseVTKBuildSettings40.cmake @@ -16,23 +16,23 @@ # Implementation detail for FindVTK.cmake to let it provide a # VTK_BUILD_SETTINGS_FILE for VTK 4.0. -SET(CMAKE_BUILD_SETTING_CMAKE_MAJOR_VERSION "${VTK40_CMAKE_MAJOR_VERSION}") -SET(CMAKE_BUILD_SETTING_CMAKE_MINOR_VERSION "${VTK40_CMAKE_MINOR_VERSION}") -SET(CMAKE_BUILD_SETTING_PROJECT_NAME "VTK") +set(CMAKE_BUILD_SETTING_CMAKE_MAJOR_VERSION "${VTK40_CMAKE_MAJOR_VERSION}") +set(CMAKE_BUILD_SETTING_CMAKE_MINOR_VERSION "${VTK40_CMAKE_MINOR_VERSION}") +set(CMAKE_BUILD_SETTING_PROJECT_NAME "VTK") -SET(CMAKE_BUILD_SETTING_C_COMPILER "${VTK40_CMAKE_C_COMPILER}") -SET(CMAKE_BUILD_SETTING_C_FLAGS "${VTK40_CMAKE_C_FLAGS}") -SET(CMAKE_BUILD_SETTING_C_FLAGS_DEBUG "${VTK40_CMAKE_C_FLAGS_DEBUG}") -SET(CMAKE_BUILD_SETTING_C_FLAGS_RELEASE "${VTK40_CMAKE_C_FLAGS_RELEASE}") -SET(CMAKE_BUILD_SETTING_C_FLAGS_MINSIZEREL "${VTK40_CMAKE_C_FLAGS_MINSIZEREL}") -SET(CMAKE_BUILD_SETTING_C_FLAGS_RELWITHDEBINFO "${VTK40_CMAKE_C_FLAGS_RELWITHDEBINFO}") +set(CMAKE_BUILD_SETTING_C_COMPILER "${VTK40_CMAKE_C_COMPILER}") +set(CMAKE_BUILD_SETTING_C_FLAGS "${VTK40_CMAKE_C_FLAGS}") +set(CMAKE_BUILD_SETTING_C_FLAGS_DEBUG "${VTK40_CMAKE_C_FLAGS_DEBUG}") +set(CMAKE_BUILD_SETTING_C_FLAGS_RELEASE "${VTK40_CMAKE_C_FLAGS_RELEASE}") +set(CMAKE_BUILD_SETTING_C_FLAGS_MINSIZEREL "${VTK40_CMAKE_C_FLAGS_MINSIZEREL}") +set(CMAKE_BUILD_SETTING_C_FLAGS_RELWITHDEBINFO "${VTK40_CMAKE_C_FLAGS_RELWITHDEBINFO}") -SET(CMAKE_BUILD_SETTING_CXX_COMPILER "${VTK40_CMAKE_CXX_COMPILER}") -SET(CMAKE_BUILD_SETTING_CXX_FLAGS "${VTK40_CMAKE_CXX_FLAGS}") -SET(CMAKE_BUILD_SETTING_CXX_FLAGS_DEBUG "${VTK40_CMAKE_CXX_FLAGS_DEBUG}") -SET(CMAKE_BUILD_SETTING_CXX_FLAGS_RELEASE "${VTK40_CMAKE_CXX_FLAGS_RELEASE}") -SET(CMAKE_BUILD_SETTING_CXX_FLAGS_MINSIZEREL "${VTK40_CMAKE_CXX_FLAGS_MINSIZEREL}") -SET(CMAKE_BUILD_SETTING_CXX_FLAGS_RELWITHDEBINFO "${VTK40_CMAKE_CXX_FLAGS_RELWITHDEBINFO}") +set(CMAKE_BUILD_SETTING_CXX_COMPILER "${VTK40_CMAKE_CXX_COMPILER}") +set(CMAKE_BUILD_SETTING_CXX_FLAGS "${VTK40_CMAKE_CXX_FLAGS}") +set(CMAKE_BUILD_SETTING_CXX_FLAGS_DEBUG "${VTK40_CMAKE_CXX_FLAGS_DEBUG}") +set(CMAKE_BUILD_SETTING_CXX_FLAGS_RELEASE "${VTK40_CMAKE_CXX_FLAGS_RELEASE}") +set(CMAKE_BUILD_SETTING_CXX_FLAGS_MINSIZEREL "${VTK40_CMAKE_CXX_FLAGS_MINSIZEREL}") +set(CMAKE_BUILD_SETTING_CXX_FLAGS_RELWITHDEBINFO "${VTK40_CMAKE_CXX_FLAGS_RELWITHDEBINFO}") -SET(CMAKE_BUILD_SETTING_BUILD_TYPE "${VTK40_CMAKE_BUILD_TYPE}") -SET(CMAKE_BUILD_SETTING_BUILD_TOOL "${VTK40_CMAKE_BUILD_TOOL}") +set(CMAKE_BUILD_SETTING_BUILD_TYPE "${VTK40_CMAKE_BUILD_TYPE}") +set(CMAKE_BUILD_SETTING_BUILD_TOOL "${VTK40_CMAKE_BUILD_TOOL}") diff --git a/Modules/UseVTKConfig40.cmake b/Modules/UseVTKConfig40.cmake index ca5e7aa3c..554b8c447 100644 --- a/Modules/UseVTKConfig40.cmake +++ b/Modules/UseVTKConfig40.cmake @@ -17,21 +17,21 @@ # FindVTK.cmake module. Do not include directly. # Hard-code the version number since it isn't provided by VTK 4.0. -SET(VTK_MAJOR_VERSION 4) -SET(VTK_MINOR_VERSION 0) -SET(VTK_BUILD_VERSION 2) +set(VTK_MAJOR_VERSION 4) +set(VTK_MINOR_VERSION 0) +set(VTK_BUILD_VERSION 2) # Provide a new UseVTK file that doesn't do a full LOAD_CACHE. -SET(VTK_USE_FILE ${CMAKE_ROOT}/Modules/UseVTK40.cmake) +set(VTK_USE_FILE ${CMAKE_ROOT}/Modules/UseVTK40.cmake) # Provide a build settings file. -SET(VTK_BUILD_SETTINGS_FILE ${CMAKE_ROOT}/Modules/UseVTKBuildSettings40.cmake) +set(VTK_BUILD_SETTINGS_FILE ${CMAKE_ROOT}/Modules/UseVTKBuildSettings40.cmake) # There are no CMake extensions for VTK 4.0. -SET(VTK_CMAKE_EXTENSIONS_DIR "") +set(VTK_CMAKE_EXTENSIONS_DIR "") # grep "VTK40_" UseVTKConfig40.cmake |sed 's/.*VTK40_\([A-Za-z0-9_]*\).*/ \1/' -LOAD_CACHE(${VTK_DIR} READ_WITH_PREFIX VTK40_ +load_cache(${VTK_DIR} READ_WITH_PREFIX VTK40_ BUILD_SHARED_LIBS CMAKE_BUILD_TOOL CMAKE_BUILD_TYPE @@ -132,124 +132,124 @@ LOAD_CACHE(${VTK_DIR} READ_WITH_PREFIX VTK40_ ) # Copy needed settings from the VTK 4.0 cache. -SET(VTK_BUILD_SHARED ${VTK40_BUILD_SHARED_LIBS}) -SET(VTK_DEBUG_LEAKS ${VTK40_VTK_DEBUG_LEAKS}) -SET(VTK_HAVE_VG500 ${VTK40_VTK_HAVE_VG500}) -SET(VTK_HAVE_VP1000 ${VTK40_VTK_HAVE_VP1000}) -SET(VTK_USE_MANGLED_MESA ${VTK40_VTK_MANGLE_MESA}) -SET(VTK_MPIRUN_EXE ${VTK40_MPIRUN}) -SET(VTK_MPI_POSTFLAGS ${VTK40_MPI_POSTFLAGS}) -SET(VTK_MPI_PREFLAGS ${VTK40_MPI_PREFLAGS}) -SET(VTK_OPENGL_HAS_OSMESA ${VTK40_VTK_OPENGL_HAS_OSMESA}) -SET(VTK_USE_64BIT_IDS ${VTK40_VTK_USE_64BIT_IDS}) -SET(VTK_USE_ANSI_STDLIB ${VTK40_VTK_USE_ANSI_STDLIB}) -SET(VTK_USE_HYBRID ${VTK40_VTK_USE_HYBRID}) -SET(VTK_USE_MATROX_IMAGING ${VTK40_VTK_USE_MATROX_IMAGING}) -SET(VTK_USE_MPI ${VTK40_VTK_USE_MPI}) -SET(VTK_USE_PARALLEL ${VTK40_VTK_USE_PARALLEL}) -SET(VTK_USE_PATENTED ${VTK40_VTK_USE_PATENTED}) -SET(VTK_USE_RENDERING ${VTK40_VTK_USE_RENDERING}) -SET(VTK_USE_VIDEO_FOR_WINDOWS ${VTK40_VTK_USE_VIDEO_FOR_WINDOWS}) -SET(VTK_USE_VOLUMEPRO ${VTK40_VTK_USE_VOLUMEPRO}) -SET(VTK_USE_X ${VTK40_VTK_USE_X}) -SET(VTK_WRAP_JAVA ${VTK40_VTK_WRAP_JAVA}) -SET(VTK_WRAP_PYTHON ${VTK40_VTK_WRAP_PYTHON}) -SET(VTK_WRAP_TCL ${VTK40_VTK_WRAP_TCL}) +set(VTK_BUILD_SHARED ${VTK40_BUILD_SHARED_LIBS}) +set(VTK_DEBUG_LEAKS ${VTK40_VTK_DEBUG_LEAKS}) +set(VTK_HAVE_VG500 ${VTK40_VTK_HAVE_VG500}) +set(VTK_HAVE_VP1000 ${VTK40_VTK_HAVE_VP1000}) +set(VTK_USE_MANGLED_MESA ${VTK40_VTK_MANGLE_MESA}) +set(VTK_MPIRUN_EXE ${VTK40_MPIRUN}) +set(VTK_MPI_POSTFLAGS ${VTK40_MPI_POSTFLAGS}) +set(VTK_MPI_PREFLAGS ${VTK40_MPI_PREFLAGS}) +set(VTK_OPENGL_HAS_OSMESA ${VTK40_VTK_OPENGL_HAS_OSMESA}) +set(VTK_USE_64BIT_IDS ${VTK40_VTK_USE_64BIT_IDS}) +set(VTK_USE_ANSI_STDLIB ${VTK40_VTK_USE_ANSI_STDLIB}) +set(VTK_USE_HYBRID ${VTK40_VTK_USE_HYBRID}) +set(VTK_USE_MATROX_IMAGING ${VTK40_VTK_USE_MATROX_IMAGING}) +set(VTK_USE_MPI ${VTK40_VTK_USE_MPI}) +set(VTK_USE_PARALLEL ${VTK40_VTK_USE_PARALLEL}) +set(VTK_USE_PATENTED ${VTK40_VTK_USE_PATENTED}) +set(VTK_USE_RENDERING ${VTK40_VTK_USE_RENDERING}) +set(VTK_USE_VIDEO_FOR_WINDOWS ${VTK40_VTK_USE_VIDEO_FOR_WINDOWS}) +set(VTK_USE_VOLUMEPRO ${VTK40_VTK_USE_VOLUMEPRO}) +set(VTK_USE_X ${VTK40_VTK_USE_X}) +set(VTK_WRAP_JAVA ${VTK40_VTK_WRAP_JAVA}) +set(VTK_WRAP_PYTHON ${VTK40_VTK_WRAP_PYTHON}) +set(VTK_WRAP_TCL ${VTK40_VTK_WRAP_TCL}) # Create the list of available kits. -SET(VTK_KITS COMMON FILTERING GRAPHICS IMAGING IO) -IF(VTK_USE_RENDERING) - SET(VTK_KITS ${VTK_KITS} RENDERING) -ENDIF(VTK_USE_RENDERING) -IF(VTK_USE_HYBRID) - SET(VTK_KITS ${VTK_KITS} HYBRID) -ENDIF(VTK_USE_HYBRID) -IF(VTK_USE_PARALLEL) - SET(VTK_KITS ${VTK_KITS} PARALLEL) -ENDIF(VTK_USE_PARALLEL) -IF(VTK_USE_PATENTED) - SET(VTK_KITS ${VTK_KITS} PATENTED) -ENDIF(VTK_USE_PATENTED) +set(VTK_KITS COMMON FILTERING GRAPHICS IMAGING IO) +if(VTK_USE_RENDERING) + set(VTK_KITS ${VTK_KITS} RENDERING) +endif() +if(VTK_USE_HYBRID) + set(VTK_KITS ${VTK_KITS} HYBRID) +endif() +if(VTK_USE_PARALLEL) + set(VTK_KITS ${VTK_KITS} PARALLEL) +endif() +if(VTK_USE_PATENTED) + set(VTK_KITS ${VTK_KITS} PATENTED) +endif() # Create the list of available languages. -SET(VTK_LANGUAGES "") -IF(VTK_WRAP_TCL) - SET(VTK_LANGUAGES ${VTK_LANGUAGES} TCL) -ENDIF(VTK_WRAP_TCL) -IF(VTK_WRAP_PYTHON) - SET(VTK_LANGUAGES ${VTK_LANGUAGES} PYTHON) -ENDIF(VTK_WRAP_PYTHON) -IF(VTK_WRAP_JAVA) - SET(VTK_LANGUAGES ${VTK_LANGUAGES} JAVA) -ENDIF(VTK_WRAP_JAVA) +set(VTK_LANGUAGES "") +if(VTK_WRAP_TCL) + set(VTK_LANGUAGES ${VTK_LANGUAGES} TCL) +endif() +if(VTK_WRAP_PYTHON) + set(VTK_LANGUAGES ${VTK_LANGUAGES} PYTHON) +endif() +if(VTK_WRAP_JAVA) + set(VTK_LANGUAGES ${VTK_LANGUAGES} JAVA) +endif() # Include directories for other projects installed on the system and # used by VTK. -SET(VTK_INCLUDE_DIRS_SYS "") -IF(VTK_USE_RENDERING) - SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} +set(VTK_INCLUDE_DIRS_SYS "") +if(VTK_USE_RENDERING) + set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_OPENGL_INCLUDE_PATH} ${VTK40_OPENGL_INCLUDE_DIR}) - IF(VTK_USE_X) - SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} + if(VTK_USE_X) + set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_CMAKE_Xlib_INCLUDE_PATH} ${VTK40_CMAKE_Xutil_INCLUDE_PATH}) - ENDIF(VTK_USE_X) -ENDIF(VTK_USE_RENDERING) + endif() +endif() -IF(VTK_OPENGL_HAS_OSMESA) - SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} +if(VTK_OPENGL_HAS_OSMESA) + set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_OSMESA_INCLUDE_PATH}) -ENDIF(VTK_OPENGL_HAS_OSMESA) +endif() -IF(VTK_USE_MPI) - SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_MPI_INCLUDE_PATH}) -ENDIF(VTK_USE_MPI) +if(VTK_USE_MPI) + set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_MPI_INCLUDE_PATH}) +endif() -IF(VTK_WRAP_TCL) - SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_TCL_INCLUDE_PATH}) -ENDIF(VTK_WRAP_TCL) +if(VTK_WRAP_TCL) + set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_TCL_INCLUDE_PATH}) +endif() -IF(VTK_WRAP_PYTHON) - SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_PYTHON_INCLUDE_PATH}) -ENDIF(VTK_WRAP_PYTHON) +if(VTK_WRAP_PYTHON) + set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_PYTHON_INCLUDE_PATH}) +endif() -IF(VTK_WRAP_JAVA) - SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} +if(VTK_WRAP_JAVA) + set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_JAVA_INCLUDE_PATH} ${VTK40_JAVA_INCLUDE_PATH2}) -ENDIF(VTK_WRAP_JAVA) +endif() -IF(VTK_HAVE_VG500) - SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} +if(VTK_HAVE_VG500) + set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_VLI_INCLUDE_PATH_FOR_VG500}) -ENDIF(VTK_HAVE_VG500) +endif() -IF(VTK_HAVE_VP1000) - SET(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} +if(VTK_HAVE_VP1000) + set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_VLI_INCLUDE_PATH_FOR_VP1000}) -ENDIF(VTK_HAVE_VP1000) +endif() # See if this is a build tree or install tree. -IF(EXISTS ${VTK_DIR}/Common) +if(EXISTS ${VTK_DIR}/Common) # This is a VTK 4.0 build tree. - SET(VTK_LIBRARY_DIRS ${VTK40_LIBRARY_OUTPUT_PATH}) + set(VTK_LIBRARY_DIRS ${VTK40_LIBRARY_OUTPUT_PATH}) # Determine the include directories needed. - SET(VTK_INCLUDE_DIRS ${VTK40_VTK_BINARY_DIR}) - IF(VTK_USE_PARALLEL) - SET(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Parallel) - ENDIF(VTK_USE_PARALLEL) - IF(VTK_USE_HYBRID) - SET(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Hybrid) - ENDIF(VTK_USE_HYBRID) - IF(VTK_USE_PATENTED) - SET(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Patented) - ENDIF(VTK_USE_PATENTED) - IF(VTK_USE_RENDERING) - SET(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Rendering) - ENDIF(VTK_USE_RENDERING) + set(VTK_INCLUDE_DIRS ${VTK40_VTK_BINARY_DIR}) + if(VTK_USE_PARALLEL) + set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Parallel) + endif() + if(VTK_USE_HYBRID) + set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Hybrid) + endif() + if(VTK_USE_PATENTED) + set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Patented) + endif() + if(VTK_USE_RENDERING) + set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Rendering) + endif() # These directories are always needed. - SET(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} + set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/IO ${VTK40_VTK_SOURCE_DIR}/Imaging ${VTK40_VTK_SOURCE_DIR}/Graphics @@ -257,119 +257,119 @@ IF(EXISTS ${VTK_DIR}/Common) ${VTK40_VTK_SOURCE_DIR}/Common) # Give access to a few utilities. - SET(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} + set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_BINARY_DIR}/Utilities/png ${VTK40_VTK_SOURCE_DIR}/Utilities/png ${VTK40_VTK_BINARY_DIR}/Utilities/zlib ${VTK40_VTK_SOURCE_DIR}/Utilities/zlib) # Executable locations. - IF(VTK_WRAP_TCL) - SET(VTK_TCL_EXE ${VTK40_EXECUTABLE_OUTPUT_PATH}/vtk) - SET(VTK_WRAP_TCL_EXE ${VTK40_VTK_WRAP_TCL_EXE}) - SET(VTK_TCL_HOME ${VTK40_VTK_SOURCE_DIR}/Wrapping/Tcl) - ENDIF(VTK_WRAP_TCL) - IF(VTK_WRAP_PYTHON) - SET(VTK_WRAP_PYTHON_EXE ${VTK40_VTK_WRAP_PYTHON_EXE}) - ENDIF(VTK_WRAP_PYTHON) - IF(VTK_WRAP_JAVA) - SET(VTK_PARSE_JAVA_EXE ${VTK40_VTK_PARSE_JAVA_EXE}) - SET(VTK_WRAP_JAVA_EXE ${VTK40_VTK_WRAP_JAVA_EXE}) - ENDIF(VTK_WRAP_JAVA) - -ELSE(EXISTS ${VTK_DIR}/Common) + if(VTK_WRAP_TCL) + set(VTK_TCL_EXE ${VTK40_EXECUTABLE_OUTPUT_PATH}/vtk) + set(VTK_WRAP_TCL_EXE ${VTK40_VTK_WRAP_TCL_EXE}) + set(VTK_TCL_HOME ${VTK40_VTK_SOURCE_DIR}/Wrapping/Tcl) + endif() + if(VTK_WRAP_PYTHON) + set(VTK_WRAP_PYTHON_EXE ${VTK40_VTK_WRAP_PYTHON_EXE}) + endif() + if(VTK_WRAP_JAVA) + set(VTK_PARSE_JAVA_EXE ${VTK40_VTK_PARSE_JAVA_EXE}) + set(VTK_WRAP_JAVA_EXE ${VTK40_VTK_WRAP_JAVA_EXE}) + endif() + +else() # This is a VTK 4.0 install tree. - SET(VTK_INCLUDE_DIRS ${VTK_DIR}) - SET(VTK_LIBRARY_DIRS ${VTK40_CMAKE_INSTALL_PREFIX}/lib/vtk) + set(VTK_INCLUDE_DIRS ${VTK_DIR}) + set(VTK_LIBRARY_DIRS ${VTK40_CMAKE_INSTALL_PREFIX}/lib/vtk) # Executable locations. - IF(VTK_WRAP_TCL) - SET(VTK_TCL_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtk) - SET(VTK_WRAP_TCL_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapTcl) - SET(VTK_TCL_HOME ${VTK40_CMAKE_INSTALL_PREFIX}/lib/vtk/tcl) - ENDIF(VTK_WRAP_TCL) - IF(VTK_WRAP_PYTHON) - SET(VTK_WRAP_PYTHON_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapPython) - ENDIF(VTK_WRAP_PYTHON) - IF(VTK_WRAP_JAVA) - SET(VTK_PARSE_JAVA_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkParseJava) - SET(VTK_WRAP_JAVA_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapJava) - ENDIF(VTK_WRAP_JAVA) -ENDIF(EXISTS ${VTK_DIR}/Common) + if(VTK_WRAP_TCL) + set(VTK_TCL_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtk) + set(VTK_WRAP_TCL_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapTcl) + set(VTK_TCL_HOME ${VTK40_CMAKE_INSTALL_PREFIX}/lib/vtk/tcl) + endif() + if(VTK_WRAP_PYTHON) + set(VTK_WRAP_PYTHON_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapPython) + endif() + if(VTK_WRAP_JAVA) + set(VTK_PARSE_JAVA_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkParseJava) + set(VTK_WRAP_JAVA_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapJava) + endif() +endif() # Add the system include directories last. -SET(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK_INCLUDE_DIRS_SYS}) +set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK_INCLUDE_DIRS_SYS}) # Find the required C and C++ compiler flags. -IF(CMAKE_COMPILER_IS_GNUCXX) - IF(WIN32) +if(CMAKE_COMPILER_IS_GNUCXX) + if(WIN32) # The platform is gcc on cygwin. - SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -mwin32") - SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -mwin32") - ENDIF(WIN32) -ELSE(CMAKE_COMPILER_IS_GNUCXX) - IF(CMAKE_ANSI_CFLAGS) - SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") - ENDIF(CMAKE_ANSI_CFLAGS) - IF(CMAKE_SYSTEM MATCHES "OSF1-V.*") - SET(VTK_REQUIRED_CXX_FLAGS + set(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -mwin32") + set(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -mwin32") + endif() +else() + if(CMAKE_ANSI_CFLAGS) + set(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") + endif() + if(CMAKE_SYSTEM MATCHES "OSF1-V.*") + set(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -timplicit_local -no_implicit_include") - ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*") -ENDIF(CMAKE_COMPILER_IS_GNUCXX) + endif() +endif() -IF(VTK_USE_X) - IF(CMAKE_X_CFLAGS) - SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_X_CFLAGS}") - SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} ${CMAKE_X_CFLAGS}") - ENDIF(CMAKE_X_CFLAGS) -ENDIF(VTK_USE_X) +if(VTK_USE_X) + if(CMAKE_X_CFLAGS) + set(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_X_CFLAGS}") + set(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} ${CMAKE_X_CFLAGS}") + endif() +endif() # Copy library dependencies. -SET(vtkCommonJava_LIB_DEPENDS "${VTK40_vtkCommonJava_LIB_DEPENDS}") -SET(vtkCommonPython_LIB_DEPENDS "${VTK40_vtkCommonPython_LIB_DEPENDS}") -SET(vtkCommonTCL_LIB_DEPENDS "${VTK40_vtkCommonTCL_LIB_DEPENDS}") -SET(vtkCommon_LIB_DEPENDS "${VTK40_vtkCommon_LIB_DEPENDS}") -SET(vtkFilteringJava_LIB_DEPENDS "${VTK40_vtkFilteringJava_LIB_DEPENDS}") -SET(vtkFilteringPython_LIB_DEPENDS "${VTK40_vtkFilteringPython_LIB_DEPENDS}") -SET(vtkFilteringTCL_LIB_DEPENDS "${VTK40_vtkFilteringTCL_LIB_DEPENDS}") -SET(vtkFiltering_LIB_DEPENDS "${VTK40_vtkFiltering_LIB_DEPENDS}") -SET(vtkGraphicsJava_LIB_DEPENDS "${VTK40_vtkGraphicsJava_LIB_DEPENDS}") -SET(vtkGraphicsPython_LIB_DEPENDS "${VTK40_vtkGraphicsPython_LIB_DEPENDS}") -SET(vtkGraphicsTCL_LIB_DEPENDS "${VTK40_vtkGraphicsTCL_LIB_DEPENDS}") -SET(vtkGraphics_LIB_DEPENDS "${VTK40_vtkGraphics_LIB_DEPENDS}") -SET(vtkHybridJava_LIB_DEPENDS "${VTK40_vtkHybridJava_LIB_DEPENDS}") -SET(vtkHybridPython_LIB_DEPENDS "${VTK40_vtkHybridPython_LIB_DEPENDS}") -SET(vtkHybridTCL_LIB_DEPENDS "${VTK40_vtkHybridTCL_LIB_DEPENDS}") -SET(vtkHybrid_LIB_DEPENDS "${VTK40_vtkHybrid_LIB_DEPENDS}") -SET(vtkIOJava_LIB_DEPENDS "${VTK40_vtkIOJava_LIB_DEPENDS}") -SET(vtkIOPython_LIB_DEPENDS "${VTK40_vtkIOPython_LIB_DEPENDS}") -SET(vtkIOTCL_LIB_DEPENDS "${VTK40_vtkIOTCL_LIB_DEPENDS}") -SET(vtkIO_LIB_DEPENDS "${VTK40_vtkIO_LIB_DEPENDS}") -SET(vtkImagingJava_LIB_DEPENDS "${VTK40_vtkImagingJava_LIB_DEPENDS}") -SET(vtkImagingPython_LIB_DEPENDS "${VTK40_vtkImagingPython_LIB_DEPENDS}") -SET(vtkImagingTCL_LIB_DEPENDS "${VTK40_vtkImagingTCL_LIB_DEPENDS}") -SET(vtkImaging_LIB_DEPENDS "${VTK40_vtkImaging_LIB_DEPENDS}") -SET(vtkParallelJava_LIB_DEPENDS "${VTK40_vtkParallelJava_LIB_DEPENDS}") -SET(vtkParallelPython_LIB_DEPENDS "${VTK40_vtkParallelPython_LIB_DEPENDS}") -SET(vtkParallelTCL_LIB_DEPENDS "${VTK40_vtkParallelTCL_LIB_DEPENDS}") -SET(vtkParallel_LIB_DEPENDS "${VTK40_vtkParallel_LIB_DEPENDS}") -SET(vtkPatentedJava_LIB_DEPENDS "${VTK40_vtkPatentedJava_LIB_DEPENDS}") -SET(vtkPatentedPython_LIB_DEPENDS "${VTK40_vtkPatentedPython_LIB_DEPENDS}") -SET(vtkPatentedTCL_LIB_DEPENDS "${VTK40_vtkPatentedTCL_LIB_DEPENDS}") -SET(vtkPatented_LIB_DEPENDS "${VTK40_vtkPatented_LIB_DEPENDS}") -SET(vtkRenderingJava_LIB_DEPENDS "${VTK40_vtkRenderingJava_LIB_DEPENDS}") -SET(vtkRenderingPythonTkWidgets_LIB_DEPENDS "${VTK40_vtkRenderingPythonTkWidgets_LIB_DEPENDS}") -SET(vtkRenderingPython_LIB_DEPENDS "${VTK40_vtkRenderingPython_LIB_DEPENDS}") -SET(vtkRenderingTCL_LIB_DEPENDS "${VTK40_vtkRenderingTCL_LIB_DEPENDS}") -SET(vtkRendering_LIB_DEPENDS "${VTK40_vtkRendering_LIB_DEPENDS}") -SET(vtkjpeg_LIB_DEPENDS "${VTK40_vtkjpeg_LIB_DEPENDS}") -SET(vtkpng_LIB_DEPENDS "${VTK40_vtkpng_LIB_DEPENDS}") -SET(vtkzlib_LIB_DEPENDS "${VTK40_vtkzlib_LIB_DEPENDS}") +set(vtkCommonJava_LIB_DEPENDS "${VTK40_vtkCommonJava_LIB_DEPENDS}") +set(vtkCommonPython_LIB_DEPENDS "${VTK40_vtkCommonPython_LIB_DEPENDS}") +set(vtkCommonTCL_LIB_DEPENDS "${VTK40_vtkCommonTCL_LIB_DEPENDS}") +set(vtkCommon_LIB_DEPENDS "${VTK40_vtkCommon_LIB_DEPENDS}") +set(vtkFilteringJava_LIB_DEPENDS "${VTK40_vtkFilteringJava_LIB_DEPENDS}") +set(vtkFilteringPython_LIB_DEPENDS "${VTK40_vtkFilteringPython_LIB_DEPENDS}") +set(vtkFilteringTCL_LIB_DEPENDS "${VTK40_vtkFilteringTCL_LIB_DEPENDS}") +set(vtkFiltering_LIB_DEPENDS "${VTK40_vtkFiltering_LIB_DEPENDS}") +set(vtkGraphicsJava_LIB_DEPENDS "${VTK40_vtkGraphicsJava_LIB_DEPENDS}") +set(vtkGraphicsPython_LIB_DEPENDS "${VTK40_vtkGraphicsPython_LIB_DEPENDS}") +set(vtkGraphicsTCL_LIB_DEPENDS "${VTK40_vtkGraphicsTCL_LIB_DEPENDS}") +set(vtkGraphics_LIB_DEPENDS "${VTK40_vtkGraphics_LIB_DEPENDS}") +set(vtkHybridJava_LIB_DEPENDS "${VTK40_vtkHybridJava_LIB_DEPENDS}") +set(vtkHybridPython_LIB_DEPENDS "${VTK40_vtkHybridPython_LIB_DEPENDS}") +set(vtkHybridTCL_LIB_DEPENDS "${VTK40_vtkHybridTCL_LIB_DEPENDS}") +set(vtkHybrid_LIB_DEPENDS "${VTK40_vtkHybrid_LIB_DEPENDS}") +set(vtkIOJava_LIB_DEPENDS "${VTK40_vtkIOJava_LIB_DEPENDS}") +set(vtkIOPython_LIB_DEPENDS "${VTK40_vtkIOPython_LIB_DEPENDS}") +set(vtkIOTCL_LIB_DEPENDS "${VTK40_vtkIOTCL_LIB_DEPENDS}") +set(vtkIO_LIB_DEPENDS "${VTK40_vtkIO_LIB_DEPENDS}") +set(vtkImagingJava_LIB_DEPENDS "${VTK40_vtkImagingJava_LIB_DEPENDS}") +set(vtkImagingPython_LIB_DEPENDS "${VTK40_vtkImagingPython_LIB_DEPENDS}") +set(vtkImagingTCL_LIB_DEPENDS "${VTK40_vtkImagingTCL_LIB_DEPENDS}") +set(vtkImaging_LIB_DEPENDS "${VTK40_vtkImaging_LIB_DEPENDS}") +set(vtkParallelJava_LIB_DEPENDS "${VTK40_vtkParallelJava_LIB_DEPENDS}") +set(vtkParallelPython_LIB_DEPENDS "${VTK40_vtkParallelPython_LIB_DEPENDS}") +set(vtkParallelTCL_LIB_DEPENDS "${VTK40_vtkParallelTCL_LIB_DEPENDS}") +set(vtkParallel_LIB_DEPENDS "${VTK40_vtkParallel_LIB_DEPENDS}") +set(vtkPatentedJava_LIB_DEPENDS "${VTK40_vtkPatentedJava_LIB_DEPENDS}") +set(vtkPatentedPython_LIB_DEPENDS "${VTK40_vtkPatentedPython_LIB_DEPENDS}") +set(vtkPatentedTCL_LIB_DEPENDS "${VTK40_vtkPatentedTCL_LIB_DEPENDS}") +set(vtkPatented_LIB_DEPENDS "${VTK40_vtkPatented_LIB_DEPENDS}") +set(vtkRenderingJava_LIB_DEPENDS "${VTK40_vtkRenderingJava_LIB_DEPENDS}") +set(vtkRenderingPythonTkWidgets_LIB_DEPENDS "${VTK40_vtkRenderingPythonTkWidgets_LIB_DEPENDS}") +set(vtkRenderingPython_LIB_DEPENDS "${VTK40_vtkRenderingPython_LIB_DEPENDS}") +set(vtkRenderingTCL_LIB_DEPENDS "${VTK40_vtkRenderingTCL_LIB_DEPENDS}") +set(vtkRendering_LIB_DEPENDS "${VTK40_vtkRendering_LIB_DEPENDS}") +set(vtkjpeg_LIB_DEPENDS "${VTK40_vtkjpeg_LIB_DEPENDS}") +set(vtkpng_LIB_DEPENDS "${VTK40_vtkpng_LIB_DEPENDS}") +set(vtkzlib_LIB_DEPENDS "${VTK40_vtkzlib_LIB_DEPENDS}") # List of VTK configuration variables set above. -# grep "^[ ]*SET(VTK" UseVTKConfig40.cmake |sed 's/[ ]*SET(\([^ ]*\) .*/ \1/' -SET(VTK_SETTINGS +# grep "^[ ]*set(VTK" UseVTKConfig40.cmake |sed 's/[ ]*set(\([^ ]*\) .*/ \1/' +set(VTK_SETTINGS VTK_BUILD_SHARED VTK_BUILD_VERSION VTK_DEBUG_LEAKS diff --git a/Modules/Use_wxWindows.cmake b/Modules/Use_wxWindows.cmake index 01a15168e..6c95681e2 100644 --- a/Modules/Use_wxWindows.cmake +++ b/Modules/Use_wxWindows.cmake @@ -7,10 +7,10 @@ # USAGE: # just include Use_wxWindows.cmake # in your projects CMakeLists.txt -# INCLUDE( ${CMAKE_MODULE_PATH}/Use_wxWindows.cmake) +# include( ${CMAKE_MODULE_PATH}/Use_wxWindows.cmake) ## # if you are sure you need GL then -# SET(WXWINDOWS_USE_GL 1) +# set(WXWINDOWS_USE_GL 1) # *before* you include this file. #============================================================================= @@ -31,34 +31,34 @@ # 16.Feb.2004: changed INCLUDE to FIND_PACKAGE to read from users own non-system CMAKE_MODULE_PATH (Jan Woetzel JW) # 07/2006: rewrite as FindwxWidgets.cmake, kept for backward compatibility JW -MESSAGE(STATUS "Use_wxWindows.cmake is DEPRECATED. \n" -"Please use FIND_PACKAGE(wxWidgets) and INCLUDE(${wxWidgets_USE_FILE}) instead. (JW)") +message(STATUS "Use_wxWindows.cmake is DEPRECATED. \n" +"Please use find_package(wxWidgets) and include(${wxWidgets_USE_FILE}) instead. (JW)") # ------------------------ -FIND_PACKAGE( wxWindows ) +find_package( wxWindows ) -IF(WXWINDOWS_FOUND) +if(WXWINDOWS_FOUND) -#MESSAGE("DBG Use_wxWindows.cmake: WXWINDOWS_INCLUDE_DIR=${WXWINDOWS_INCLUDE_DIR} WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES} WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES} CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS} WXWINDOWS_DEFINITIONS=${WXWINDOWS_DEFINITIONS}") +#message("DBG Use_wxWindows.cmake: WXWINDOWS_INCLUDE_DIR=${WXWINDOWS_INCLUDE_DIR} WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES} WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES} CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS} WXWINDOWS_DEFINITIONS=${WXWINDOWS_DEFINITIONS}") - IF(WXWINDOWS_INCLUDE_DIR) - INCLUDE_DIRECTORIES(${WXWINDOWS_INCLUDE_DIR}) - ENDIF(WXWINDOWS_INCLUDE_DIR) - IF(WXWINDOWS_LINK_DIRECTORIES) - LINK_DIRECTORIES(${WXWINDOWS_LINK_DIRECTORIES}) - ENDIF(WXWINDOWS_LINK_DIRECTORIES) - IF(WXWINDOWS_LIBRARIES) - LINK_LIBRARIES(${WXWINDOWS_LIBRARIES}) - ENDIF(WXWINDOWS_LIBRARIES) - IF (CMAKE_WXWINDOWS_CXX_FLAGS) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_WXWINDOWS_CXX_FLAGS}") - ENDIF(CMAKE_WXWINDOWS_CXX_FLAGS) - IF(WXWINDOWS_DEFINITIONS) - ADD_DEFINITIONS(${WXWINDOWS_DEFINITIONS}) - ENDIF(WXWINDOWS_DEFINITIONS) -ELSE(WXWINDOWS_FOUND) - MESSAGE(SEND_ERROR "wxWindows not found by Use_wxWindows.cmake") -ENDIF(WXWINDOWS_FOUND) + if(WXWINDOWS_INCLUDE_DIR) + include_directories(${WXWINDOWS_INCLUDE_DIR}) + endif() + if(WXWINDOWS_LINK_DIRECTORIES) + link_directories(${WXWINDOWS_LINK_DIRECTORIES}) + endif() + if(WXWINDOWS_LIBRARIES) + link_libraries(${WXWINDOWS_LIBRARIES}) + endif() + if (CMAKE_WXWINDOWS_CXX_FLAGS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_WXWINDOWS_CXX_FLAGS}") + endif() + if(WXWINDOWS_DEFINITIONS) + add_definitions(${WXWINDOWS_DEFINITIONS}) + endif() +else() + message(SEND_ERROR "wxWindows not found by Use_wxWindows.cmake") +endif() diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake index a0f2e8632..bb8c29b3e 100644 --- a/Modules/UsewxWidgets.cmake +++ b/Modules/UsewxWidgets.cmake @@ -4,10 +4,10 @@ # # USAGE # # Note that for MinGW users the order of libs is important! -# FIND_PACKAGE(wxWidgets REQUIRED net gl core base) -# INCLUDE(${wxWidgets_USE_FILE}) +# find_package(wxWidgets REQUIRED net gl core base) +# include(${wxWidgets_USE_FILE}) # # and for each of your dependent executable/library targets: -# TARGET_LINK_LIBRARIES( ${wxWidgets_LIBRARIES}) +# target_link_libraries( ${wxWidgets_LIBRARIES}) # # DEPRECATED # LINK_LIBRARIES is not called in favor of adding dependencies per target. @@ -31,59 +31,59 @@ # debug message and logging. # comment these out for distribution -IF (NOT LOGFILE ) - # SET(LOGFILE "${PROJECT_BINARY_DIR}/CMakeOutput.log") -ENDIF (NOT LOGFILE ) -MACRO(MSG _MSG) - # FILE(APPEND ${LOGFILE} "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}\n") - # MESSAGE(STATUS "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}") -ENDMACRO(MSG) +if (NOT LOGFILE ) + # set(LOGFILE "${PROJECT_BINARY_DIR}/CMakeOutput.log") +endif () +macro(MSG _MSG) + # file(APPEND ${LOGFILE} "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}\n") + # message(STATUS "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}") +endmacro() MSG("wxWidgets_FOUND=${wxWidgets_FOUND}") -IF (wxWidgets_FOUND) - IF (wxWidgets_INCLUDE_DIRS) - IF(wxWidgets_INCLUDE_DIRS_NO_SYSTEM) - INCLUDE_DIRECTORIES(${wxWidgets_INCLUDE_DIRS}) - ELSE(wxWidgets_INCLUDE_DIRS_NO_SYSTEM) - INCLUDE_DIRECTORIES(SYSTEM ${wxWidgets_INCLUDE_DIRS}) - ENDIF(wxWidgets_INCLUDE_DIRS_NO_SYSTEM) +if (wxWidgets_FOUND) + if (wxWidgets_INCLUDE_DIRS) + if(wxWidgets_INCLUDE_DIRS_NO_SYSTEM) + include_directories(${wxWidgets_INCLUDE_DIRS}) + else() + include_directories(SYSTEM ${wxWidgets_INCLUDE_DIRS}) + endif() MSG("wxWidgets_INCLUDE_DIRS=${wxWidgets_INCLUDE_DIRS}") - ENDIF(wxWidgets_INCLUDE_DIRS) + endif() - IF (wxWidgets_LIBRARY_DIRS) - LINK_DIRECTORIES(${wxWidgets_LIBRARY_DIRS}) + if (wxWidgets_LIBRARY_DIRS) + link_directories(${wxWidgets_LIBRARY_DIRS}) MSG("wxWidgets_LIBRARY_DIRS=${wxWidgets_LIBRARY_DIRS}") - ENDIF(wxWidgets_LIBRARY_DIRS) + endif() - IF (wxWidgets_DEFINITIONS) - SET_PROPERTY(DIRECTORY APPEND + if (wxWidgets_DEFINITIONS) + set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${wxWidgets_DEFINITIONS}) MSG("wxWidgets_DEFINITIONS=${wxWidgets_DEFINITIONS}") - ENDIF(wxWidgets_DEFINITIONS) + endif() - IF (wxWidgets_DEFINITIONS_DEBUG) - SET_PROPERTY(DIRECTORY APPEND + if (wxWidgets_DEFINITIONS_DEBUG) + set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG ${wxWidgets_DEFINITIONS_DEBUG}) MSG("wxWidgets_DEFINITIONS_DEBUG=${wxWidgets_DEFINITIONS_DEBUG}") - ENDIF(wxWidgets_DEFINITIONS_DEBUG) + endif() - IF (wxWidgets_CXX_FLAGS) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}") + if (wxWidgets_CXX_FLAGS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}") MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}") - ENDIF(wxWidgets_CXX_FLAGS) + endif() # DEPRECATED JW # just for backward compatibility: add deps to all targets - # library projects better use advanced FIND_PACKAGE(wxWidgets) directly. - #IF(wxWidgets_LIBRARIES) - # LINK_LIBRARIES(${wxWidgets_LIBRARIES}) + # library projects better use advanced find_package(wxWidgets) directly. + #if(wxWidgets_LIBRARIES) + # link_libraries(${wxWidgets_LIBRARIES}) # # BUG: str too long: MSG("wxWidgets_LIBRARIES=${wxWidgets_LIBRARIES}") - # IF(LOGFILE) - # FILE(APPEND ${LOGFILE} "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${wxWidgets_LIBRARIES}\n") - # ENDIF(LOGFILE) - #ENDIF(wxWidgets_LIBRARIES) + # if(LOGFILE) + # file(APPEND ${LOGFILE} "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${wxWidgets_LIBRARIES}\n") + # endif() + #endif() -ELSE (wxWidgets_FOUND) - MESSAGE("wxWidgets requested but not found.") -ENDIF(wxWidgets_FOUND) +else () + message("wxWidgets requested but not found.") +endif() diff --git a/Modules/VTKCompatibility.cmake b/Modules/VTKCompatibility.cmake index 802969f2f..b33bf2e16 100644 --- a/Modules/VTKCompatibility.cmake +++ b/Modules/VTKCompatibility.cmake @@ -12,41 +12,41 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -IF(APPLE) - SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}") - SET(CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_C_CREATE_SHARED_MODULE}") - STRING( REGEX REPLACE "CMAKE_C_COMPILER" +if(APPLE) + set(CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}") + set(CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_C_CREATE_SHARED_MODULE}") + string( REGEX REPLACE "CMAKE_C_COMPILER" CMAKE_CXX_COMPILER CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") - STRING( REGEX REPLACE "CMAKE_C_COMPILER" + string( REGEX REPLACE "CMAKE_C_COMPILER" CMAKE_CXX_COMPILER CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") -ENDIF(APPLE) +endif() -SET(VTKFTGL_BINARY_DIR "${VTK_BINARY_DIR}/Utilities/ftgl" +set(VTKFTGL_BINARY_DIR "${VTK_BINARY_DIR}/Utilities/ftgl" CACHE INTERNAL "") -SET(VTKFREETYPE_BINARY_DIR "${VTK_BINARY_DIR}/Utilities/freetype" +set(VTKFREETYPE_BINARY_DIR "${VTK_BINARY_DIR}/Utilities/freetype" CACHE INTERNAL "") -SET(VTKFTGL_SOURCE_DIR "${VTK_SOURCE_DIR}/Utilities/ftgl" +set(VTKFTGL_SOURCE_DIR "${VTK_SOURCE_DIR}/Utilities/ftgl" CACHE INTERNAL "") -SET(VTKFREETYPE_SOURCE_DIR "${VTK_SOURCE_DIR}/Utilities/freetype" +set(VTKFREETYPE_SOURCE_DIR "${VTK_SOURCE_DIR}/Utilities/freetype" CACHE INTERNAL "") -SET(VTK_GLEXT_FILE "${VTK_SOURCE_DIR}/Utilities/ParseOGLExt/headers/glext.h" +set(VTK_GLEXT_FILE "${VTK_SOURCE_DIR}/Utilities/ParseOGLExt/headers/glext.h" CACHE FILEPATH "Location of the OpenGL extensions header file (glext.h).") -SET(VTK_GLXEXT_FILE +set(VTK_GLXEXT_FILE "${VTK_SOURCE_DIR}/Utilities/ParseOGLExt/headers/glxext.h" CACHE FILEPATH "Location of the GLX extensions header file (glxext.h).") -SET(VTK_WGLEXT_FILE "${VTK_SOURCE_DIR}/Utilities/ParseOGLExt/headers/wglext.h" +set(VTK_WGLEXT_FILE "${VTK_SOURCE_DIR}/Utilities/ParseOGLExt/headers/wglext.h" CACHE FILEPATH "Location of the WGL extensions header file (wglext.h).") # work around an old bug in VTK -SET(TIFF_RIGHT_VERSION 1) +set(TIFF_RIGHT_VERSION 1) # for very old VTK (versions prior to 4.2) -MACRO(SOURCE_FILES) +macro(SOURCE_FILES) message (FATAL_ERROR "You are trying to build a very old version of VTK (prior to VTK 4.2). To do this you need to use CMake 2.0 as it was the last version of CMake to support VTK 4.0.") -ENDMACRO(SOURCE_FILES) +endmacro() diff --git a/Modules/WIX.template.in b/Modules/WIX.template.in new file mode 100644 index 000000000..0bc7e10ce --- /dev/null +++ b/Modules/WIX.template.in @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + ProductIcon.ico + + + + + + + + + + + + + + + + diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake index 038cb5798..4466cd797 100644 --- a/Modules/WriteBasicConfigVersionFile.cmake +++ b/Modules/WriteBasicConfigVersionFile.cmake @@ -28,7 +28,7 @@ function(WRITE_BASIC_CONFIG_VERSION_FILE _filename) if(CVF_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown keywords given to WRITE_BASIC_CONFIG_VERSION_FILE(): \"${CVF_UNPARSED_ARGUMENTS}\"") - endif(CVF_UNPARSED_ARGUMENTS) + endif() set(versionTemplateFile "${CMAKE_ROOT}/Modules/BasicConfigVersion-${CVF_COMPATIBILITY}.cmake.in") if(NOT EXISTS "${versionTemplateFile}") @@ -41,4 +41,4 @@ function(WRITE_BASIC_CONFIG_VERSION_FILE _filename) configure_file("${versionTemplateFile}" "${_filename}" @ONLY) -endfunction(WRITE_BASIC_CONFIG_VERSION_FILE) +endfunction() diff --git a/Modules/ecos_clean.cmake b/Modules/ecos_clean.cmake index 7a563ae23..37a1f93c2 100644 --- a/Modules/ecos_clean.cmake +++ b/Modules/ecos_clean.cmake @@ -21,6 +21,6 @@ foreach(_entry ${_files}) get_filename_component(dir ${_entry} NAME) if(${dir} MATCHES "^[a-z]+$") file(REMOVE_RECURSE ${_entry}) - endif(${dir} MATCHES "^[a-z]+$") - endif(IS_DIRECTORY ${_entry}) -endforeach(_entry) + endif() + endif() +endforeach() diff --git a/Modules/kde3uic.cmake b/Modules/kde3uic.cmake index 6f904ac92..4ad364b50 100644 --- a/Modules/kde3uic.cmake +++ b/Modules/kde3uic.cmake @@ -17,7 +17,7 @@ # neundorf@kde.org -EXECUTE_PROCESS(COMMAND ${KDE_UIC_EXECUTABLE} +execute_process(COMMAND ${KDE_UIC_EXECUTABLE} -L ${KDE_UIC_PLUGIN_DIR} -nounload -tr tr2i18n -impl ${KDE_UIC_H_FILE} ${KDE_UIC_FILE} @@ -25,9 +25,9 @@ EXECUTE_PROCESS(COMMAND ${KDE_UIC_EXECUTABLE} ERROR_QUIET ) -STRING(REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _uic_CONTENTS "${_uic_CONTENTS}" ) -STRING(REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _uic_CONTENTS "${_uic_CONTENTS}" ) +string(REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _uic_CONTENTS "${_uic_CONTENTS}" ) +string(REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _uic_CONTENTS "${_uic_CONTENTS}" ) -FILE(WRITE ${KDE_UIC_CPP_FILE} "#include \n#include \n\n") -FILE(APPEND ${KDE_UIC_CPP_FILE} "${_uic_CONTENTS}") +file(WRITE ${KDE_UIC_CPP_FILE} "#include \n#include \n\n") +file(APPEND ${KDE_UIC_CPP_FILE} "${_uic_CONTENTS}") diff --git a/Modules/readme.txt b/Modules/readme.txt index 7d61d8d27..9dc1c6ab3 100644 --- a/Modules/readme.txt +++ b/Modules/readme.txt @@ -18,6 +18,9 @@ XXX_VERSION_YY Expect Version YY if true. Make sure at most one of thes XXX_WRAP_YY If False, do not try to use the relevent CMake wrapping command. XXX_YY_FOUND If False, optional YY part of XXX sytem is not available. XXX_FOUND Set to false, or undefined, if we haven't found, or don't want to use XXX. +XXX_NOT_FOUND_MESSAGE Should be set by config-files in the case that it has set XXX_FOUND to FALSE. + The contained message will be printed by the find_package() command and by + find_package_handle_standard_args() to inform the user about the problem. XXX_RUNTIME_LIBRARY_DIRS Optionally, the runtime library search path for use when running an executable linked to shared libraries. The list should be used by user code to create the PATH on windows or LD_LIBRARY_PATH on unix. This should not be a cache entry. @@ -124,7 +127,10 @@ If neither the QUIET nor REQUIRED options are given then the FindXXX.cmake module should look for the package and complain without error if the module is not found. -A package can be provide sub-components. +FIND_PACKAGE() will set the variable CMAKE_FIND_PACKAGE_NAME to +contain the actual name of the package. + +A package can provide sub-components. Those components can be listed after the COMPONENTS (or REQUIRED) or OPTIONAL_COMPONENTS keywords. The set of all listed components will be specified in a XXX_FIND_COMPONENTS variable. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index e9c5a587e..ab62d2b35 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -9,33 +9,33 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -INCLUDE(CheckIncludeFile) +include(CheckIncludeFile) # Check if we can build support for ELF parsing. CHECK_INCLUDE_FILE("elf.h" HAVE_ELF_H) -IF(HAVE_ELF_H) - SET(CMAKE_USE_ELF_PARSER 1) -ELSE(HAVE_ELF_H) - SET(CMAKE_USE_ELF_PARSER) -ENDIF(HAVE_ELF_H) +if(HAVE_ELF_H) + set(CMAKE_USE_ELF_PARSER 1) +else() + set(CMAKE_USE_ELF_PARSER) +endif() -SET(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR}) +set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR}) # configure the .h file -CONFIGURE_FILE( +configure_file( "${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in" "${CMake_BINARY_DIR}/Source/cmConfigure.h" ) -CONFIGURE_FILE( +configure_file( "${CMake_SOURCE_DIR}/Source/cmVersionConfig.h.in" "${CMake_BINARY_DIR}/Source/cmVersionConfig.h" ) -CONFIGURE_FILE( +configure_file( "${CMake_SOURCE_DIR}/Source/CPack/cmCPackConfigure.h.in" "${CMake_BINARY_DIR}/Source/CPack/cmCPackConfigure.h" ) # add the include path to find the .h -INCLUDE_DIRECTORIES( +include_directories( "${CMake_BINARY_DIR}/Source" "${CMake_SOURCE_DIR}/Source" ${CMAKE_ZLIB_INCLUDES} @@ -45,72 +45,72 @@ INCLUDE_DIRECTORIES( ) # let cmake know it is supposed to use it -ADD_DEFINITIONS(-DCMAKE_BUILD_WITH_CMAKE) +add_definitions(-DCMAKE_BUILD_WITH_CMAKE) -OPTION(CMAKE_REGENERATE_YACCLEX +option(CMAKE_REGENERATE_YACCLEX "Regenerate YACC and LEXX files" OFF) -MARK_AS_ADVANCED(CMAKE_REGENERATE_YACCLEX) -IF(CMAKE_REGENERATE_YACCLEX) - SET(parsersLexers cmDependsFortran cmCommandArgument cmExpr) - FIND_PROGRAM(YACC_EXECUTABLE +mark_as_advanced(CMAKE_REGENERATE_YACCLEX) +if(CMAKE_REGENERATE_YACCLEX) + set(parsersLexers cmDependsFortran cmCommandArgument cmExpr) + find_program(YACC_EXECUTABLE NAMES yacc bison PATHS /usr/bin DOC "Yacc or Bison executable") - FIND_PROGRAM(FLEX_EXECUTABLE + find_program(FLEX_EXECUTABLE NAMES flex PATHS /usr/bin DOC "Flex executable") - MARK_AS_ADVANCED(YACC_EXECUTABLE FLEX_EXECUTABLE) - IF(YACC_EXECUTABLE) - SET(BISON_FLAGS) - IF(YACC_EXECUTABLE MATCHES "bison") - SET(BISON_FLAGS "--yacc") - ENDIF(YACC_EXECUTABLE MATCHES "bison") - SET(yacc_files) - FOREACH(name ${parsersLexers}) - SET(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}Parser.y") - SET(dst "${CMAKE_CURRENT_BINARY_DIR}/${name}Parser.cxx") - SET(hdr "${CMAKE_CURRENT_BINARY_DIR}/${name}ParserTokens.h") - ADD_CUSTOM_COMMAND( + mark_as_advanced(YACC_EXECUTABLE FLEX_EXECUTABLE) + if(YACC_EXECUTABLE) + set(BISON_FLAGS) + if(YACC_EXECUTABLE MATCHES "bison") + set(BISON_FLAGS "--yacc") + endif() + set(yacc_files) + foreach(name ${parsersLexers}) + set(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}Parser.y") + set(dst "${CMAKE_CURRENT_BINARY_DIR}/${name}Parser.cxx") + set(hdr "${CMAKE_CURRENT_BINARY_DIR}/${name}ParserTokens.h") + add_custom_command( OUTPUT "${dst}" DEPENDS "${src}" COMMAND ${YACC_EXECUTABLE} --name-prefix=${name}_yy --defines=${hdr} -o${dst} ${src} ) - SET(yacc_files ${yacc_files} "${dst}") - ENDFOREACH(name) - ADD_CUSTOM_TARGET(RerunYacc DEPENDS ${yacc_files}) - ENDIF(YACC_EXECUTABLE) - IF(FLEX_EXECUTABLE) - SET(lex_files) - FOREACH(name ${parsersLexers}) - SET(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}Lexer.in.l") - SET(dst "${CMAKE_CURRENT_BINARY_DIR}/${name}Lexer.cxx") - SET(hdr "${CMAKE_CURRENT_BINARY_DIR}/${name}Lexer.h") - ADD_CUSTOM_COMMAND( + set(yacc_files ${yacc_files} "${dst}") + endforeach() + add_custom_target(RerunYacc DEPENDS ${yacc_files}) + endif() + if(FLEX_EXECUTABLE) + set(lex_files) + foreach(name ${parsersLexers}) + set(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}Lexer.in.l") + set(dst "${CMAKE_CURRENT_BINARY_DIR}/${name}Lexer.cxx") + set(hdr "${CMAKE_CURRENT_BINARY_DIR}/${name}Lexer.h") + add_custom_command( OUTPUT "${dst}" DEPENDS "${src}" COMMAND ${FLEX_EXECUTABLE} --prefix=${name}_yy --header-file=${hdr} -o${dst} ${src} ) - SET(lex_files ${lex_files} "${dst}") - ENDFOREACH(name) - ADD_CUSTOM_TARGET(RerunLex DEPENDS ${lex_files}) - ENDIF(FLEX_EXECUTABLE) + set(lex_files ${lex_files} "${dst}") + endforeach() + add_custom_target(RerunLex DEPENDS ${lex_files}) + endif() -ENDIF(CMAKE_REGENERATE_YACCLEX) +endif() # Check if we can build the ELF parser. -IF(CMAKE_USE_ELF_PARSER) - SET(ELF_SRCS cmELF.h cmELF.cxx) -ENDIF(CMAKE_USE_ELF_PARSER) +if(CMAKE_USE_ELF_PARSER) + set(ELF_SRCS cmELF.h cmELF.cxx) +endif() # # Sources for CMakeLib # -SET(SRCS +set(SRCS cmStandardIncludes.cxx cmArchiveWrite.cxx cmBootstrapCommands.cxx @@ -176,19 +176,36 @@ SET(SRCS cmExportFileGenerator.cxx cmExportInstallFileGenerator.h cmExportInstallFileGenerator.cxx + cmExportTryCompileFileGenerator.h + cmExportTryCompileFileGenerator.cxx + cmExportSet.h + cmExportSet.cxx + cmExportSetMap.h + cmExportSetMap.cxx cmExtraCodeBlocksGenerator.cxx cmExtraCodeBlocksGenerator.h cmExtraEclipseCDT4Generator.cxx cmExtraEclipseCDT4Generator.h + cmExtraSublimeTextGenerator.cxx + cmExtraSublimeTextGenerator.h cmFileTimeComparison.cxx cmFileTimeComparison.h cmGeneratedFileStream.cxx + cmGeneratorExpressionDAGChecker.cxx + cmGeneratorExpressionDAGChecker.h + cmGeneratorExpressionEvaluator.cxx + cmGeneratorExpressionEvaluator.h + cmGeneratorExpressionLexer.cxx + cmGeneratorExpressionLexer.h + cmGeneratorExpressionParser.cxx + cmGeneratorExpressionParser.h cmGeneratorExpression.cxx cmGeneratorExpression.h cmGeneratorTarget.cxx cmGeneratorTarget.h cmGlobalGenerator.cxx cmGlobalGenerator.h + cmGlobalGeneratorFactory.h cmGlobalUnixMakefileGenerator3.cxx cmGlobalUnixMakefileGenerator3.h cmGraphAdjacencyList.h @@ -251,6 +268,7 @@ SET(SRCS cmSystemTools.h cmTarget.cxx cmTarget.h + cmTargetExport.h cmTest.cxx cmTest.h cmTestGenerator.cxx @@ -275,30 +293,30 @@ SET(SRCS ) # Kdevelop only works on UNIX and not windows -IF(UNIX) - SET(SRCS ${SRCS} cmGlobalKdevelopGenerator.cxx) -ENDIF(UNIX) +if(UNIX) + set(SRCS ${SRCS} cmGlobalKdevelopGenerator.cxx) +endif() # Xcode only works on Apple -IF(APPLE) - SET(SRCS ${SRCS} +if(APPLE) + set(SRCS ${SRCS} cmXCodeObject.cxx cmXCode21Object.cxx cmGlobalXCodeGenerator.cxx cmGlobalXCodeGenerator.h cmLocalXCodeGenerator.cxx cmLocalXCodeGenerator.h) -ENDIF(APPLE) +endif() -IF (WIN32) - SET(SRCS ${SRCS} +if (WIN32) + set(SRCS ${SRCS} cmCallVisualStudioMacro.cxx cmCallVisualStudioMacro.h ) - IF(NOT UNIX) - SET(SRCS ${SRCS} + if(NOT UNIX) + set(SRCS ${SRCS} cmGlobalBorlandMakefileGenerator.cxx cmGlobalBorlandMakefileGenerator.h cmGlobalMSYSMakefileGenerator.cxx @@ -317,12 +335,6 @@ IF (WIN32) cmGlobalVisualStudio8Generator.h cmGlobalVisualStudio9Generator.cxx cmGlobalVisualStudio9Generator.h - cmGlobalVisualStudio8Win64Generator.cxx - cmGlobalVisualStudio8Win64Generator.h - cmGlobalVisualStudio9Win64Generator.cxx - cmGlobalVisualStudio9Win64Generator.h - cmGlobalVisualStudio9IA64Generator.cxx - cmGlobalVisualStudio9IA64Generator.h cmVisualStudioGeneratorOptions.h cmVisualStudioGeneratorOptions.cxx cmVisualStudio10TargetGenerator.h @@ -331,16 +343,8 @@ IF (WIN32) cmLocalVisualStudio10Generator.h cmGlobalVisualStudio10Generator.h cmGlobalVisualStudio10Generator.cxx - cmGlobalVisualStudio10Win64Generator.h - cmGlobalVisualStudio10Win64Generator.cxx - cmGlobalVisualStudio10IA64Generator.h - cmGlobalVisualStudio10IA64Generator.cxx cmGlobalVisualStudio11Generator.h cmGlobalVisualStudio11Generator.cxx - cmGlobalVisualStudio11Win64Generator.h - cmGlobalVisualStudio11Win64Generator.cxx - cmGlobalVisualStudio11ARMGenerator.h - cmGlobalVisualStudio11ARMGenerator.cxx cmGlobalVisualStudioGenerator.cxx cmGlobalVisualStudioGenerator.h cmGlobalWatcomWMakeGenerator.cxx @@ -353,14 +357,16 @@ IF (WIN32) cmLocalVisualStudio7Generator.h cmLocalVisualStudioGenerator.cxx cmLocalVisualStudioGenerator.h + cmVisualStudioWCEPlatformParser.h + cmVisualStudioWCEPlatformParser.cxx cmWin32ProcessExecution.cxx cmWin32ProcessExecution.h ) - ENDIF(NOT UNIX) -ENDIF (WIN32) + endif() +endif () # Ninja support -SET(SRCS ${SRCS} +set(SRCS ${SRCS} cmGlobalNinjaGenerator.cxx cmGlobalNinjaGenerator.h cmNinjaTypes.h @@ -373,34 +379,34 @@ SET(SRCS ${SRCS} cmNinjaUtilityTargetGenerator.cxx cmNinjaUtilityTargetGenerator.h ) -IF(WIN32 AND NOT CYGWIN AND NOT BORLAND) - SET_SOURCE_FILES_PROPERTIES(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501) - ADD_EXECUTABLE(cmcldeps cmcldeps.cxx) - TARGET_LINK_LIBRARIES(cmcldeps CMakeLib) - INSTALL_TARGETS(/bin cmcldeps) -ENDIF() +if(WIN32 AND NOT CYGWIN AND NOT BORLAND) + set_source_files_properties(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501) + add_executable(cmcldeps cmcldeps.cxx) + target_link_libraries(cmcldeps CMakeLib) + install_targets(/bin cmcldeps) +endif() # create a library used by the command line and the GUI -ADD_LIBRARY(CMakeLib ${SRCS}) -TARGET_LINK_LIBRARIES(CMakeLib cmsys +add_library(CMakeLib ${SRCS}) +target_link_libraries(CMakeLib cmsys ${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES} ${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES} ${CMAKE_CURL_LIBRARIES} ) # On Apple we need CoreFoundation -IF(APPLE) - TARGET_LINK_LIBRARIES(CMakeLib "-framework CoreFoundation") -ENDIF(APPLE) +if(APPLE) + target_link_libraries(CMakeLib "-framework CoreFoundation") +endif() # On some platforms we need the rpcrt4 library for the VS 7 generators. -IF(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW) - TARGET_LINK_LIBRARIES(CMakeLib rpcrt4) -ENDIF(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW) +if(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW) + target_link_libraries(CMakeLib rpcrt4) +endif() # # CTestLib # -INCLUDE_DIRECTORIES( +include_directories( "${CMake_SOURCE_DIR}/Source/CTest" ${CMAKE_XMLRPC_INCLUDES} ${CMAKE_CURL_INCLUDES} @@ -408,7 +414,7 @@ INCLUDE_DIRECTORIES( # # Sources for CTestLib # -SET(CTEST_SRCS cmCTest.cxx +set(CTEST_SRCS cmCTest.cxx CTest/cmProcess.cxx CTest/cmCTestBatchTestHandler.cxx CTest/cmCTestBuildAndTestHandler.cxx @@ -461,13 +467,13 @@ SET(CTEST_SRCS cmCTest.cxx ) # Build CTestLib -ADD_LIBRARY(CTestLib ${CTEST_SRCS}) -TARGET_LINK_LIBRARIES(CTestLib CMakeLib ${CMAKE_CURL_LIBRARIES} ${CMAKE_XMLRPC_LIBRARIES}) +add_library(CTestLib ${CTEST_SRCS}) +target_link_libraries(CTestLib CMakeLib ${CMAKE_CURL_LIBRARIES} ${CMAKE_XMLRPC_LIBRARIES}) # # Sources for CPack # -SET(CPACK_SRCS +set(CPACK_SRCS CPack/cmCPackArchiveGenerator.cxx CPack/cmCPackComponentGroup.cxx CPack/cmCPackGeneratorFactory.cxx @@ -483,82 +489,90 @@ SET(CPACK_SRCS CPack/cmCPackDocumentMacros.cxx ) -IF(CYGWIN) - SET(CPACK_SRCS ${CPACK_SRCS} +if(CYGWIN) + set(CPACK_SRCS ${CPACK_SRCS} CPack/cmCPackCygwinBinaryGenerator.cxx CPack/cmCPackCygwinSourceGenerator.cxx ) -ENDIF(CYGWIN) +endif() -IF(UNIX) - SET(CPACK_SRCS ${CPACK_SRCS} +if(UNIX) + set(CPACK_SRCS ${CPACK_SRCS} CPack/cmCPackDebGenerator.cxx CPack/cmCPackRPMGenerator.cxx ) -ENDIF(UNIX) +endif() -IF(APPLE) - SET(CPACK_SRCS ${CPACK_SRCS} +if(WIN32) + set(CPACK_SRCS ${CPACK_SRCS} + CPack/WiX/cmCPackWIXGenerator.cxx + CPack/WiX/cmWIXSourceWriter.cxx + CPack/WiX/cmWIXRichTextFormatWriter.cxx + ) +endif() + +if(APPLE) + set(CPACK_SRCS ${CPACK_SRCS} CPack/cmCPackBundleGenerator.cxx CPack/cmCPackDragNDropGenerator.cxx CPack/cmCPackOSXX11Generator.cxx CPack/cmCPackPackageMakerGenerator.cxx ) -ENDIF(APPLE) +endif() # Build CPackLib -ADD_LIBRARY(CPackLib ${CPACK_SRCS}) -TARGET_LINK_LIBRARIES(CPackLib CMakeLib) +add_library(CPackLib ${CPACK_SRCS}) +target_link_libraries(CPackLib CMakeLib) -IF(APPLE) - ADD_EXECUTABLE(cmakexbuild cmakexbuild.cxx) - TARGET_LINK_LIBRARIES(cmakexbuild CMakeLib) - ADD_EXECUTABLE(OSXScriptLauncher +if(APPLE) + add_executable(cmakexbuild cmakexbuild.cxx) + target_link_libraries(cmakexbuild CMakeLib) + add_executable(OSXScriptLauncher CPack/OSXScriptLauncher.cxx) - TARGET_LINK_LIBRARIES(OSXScriptLauncher cmsys) - TARGET_LINK_LIBRARIES(OSXScriptLauncher "-framework CoreFoundation") -ENDIF(APPLE) + target_link_libraries(OSXScriptLauncher cmsys) + target_link_libraries(OSXScriptLauncher "-framework CoreFoundation") +endif() # Build CMake executable -ADD_EXECUTABLE(cmake cmakemain.cxx) -TARGET_LINK_LIBRARIES(cmake CMakeLib) +add_executable(cmake cmakemain.cxx) +target_link_libraries(cmake CMakeLib) # Build special executable for running programs on Windows 98 -IF(WIN32) - IF(NOT UNIX) - ADD_EXECUTABLE(cmw9xcom cmw9xcom.cxx) - TARGET_LINK_LIBRARIES(cmw9xcom CMakeLib) - INSTALL_TARGETS(/bin cmw9xcom) - ENDIF(NOT UNIX) -ENDIF(WIN32) +if(WIN32) + if(NOT UNIX) + add_executable(cmw9xcom cmw9xcom.cxx) + target_link_libraries(cmw9xcom CMakeLib) + install_targets(/bin cmw9xcom) + endif() +endif() # Build CTest executable -ADD_EXECUTABLE(ctest ctest.cxx) -TARGET_LINK_LIBRARIES(ctest CTestLib) +add_executable(ctest ctest.cxx) +target_link_libraries(ctest CTestLib) # Build CPack executable -ADD_EXECUTABLE(cpack CPack/cpack.cxx) -TARGET_LINK_LIBRARIES(cpack CPackLib) +add_executable(cpack CPack/cpack.cxx) +target_link_libraries(cpack CPackLib) # Curses GUI -IF(BUILD_CursesDialog) - INCLUDE(${CMake_SOURCE_DIR}/Source/CursesDialog/CMakeLists.txt) -ENDIF(BUILD_CursesDialog) +if(BUILD_CursesDialog) + include(${CMake_SOURCE_DIR}/Source/CursesDialog/CMakeLists.txt) +endif() # Qt GUI -OPTION(BUILD_QtDialog "Build Qt dialog for CMake" FALSE) -IF(BUILD_QtDialog) - SUBDIRS(QtDialog) -ENDIF(BUILD_QtDialog) - -INCLUDE (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL) -INCLUDE (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL) - -INSTALL_TARGETS(/bin cmake) -INSTALL_TARGETS(/bin ctest) -INSTALL_TARGETS(/bin cpack) -IF(APPLE) - INSTALL_TARGETS(/bin cmakexbuild) -ENDIF(APPLE) - -INSTALL_FILES(${CMAKE_DATA_DIR}/include cmCPluginAPI.h) +option(BUILD_QtDialog "Build Qt dialog for CMake" FALSE) +if(BUILD_QtDialog) + add_subdirectory(QtDialog) +endif() + +include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL) +include (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL) + +install_targets(/bin cmake) +install_targets(/bin ctest) +install_targets(/bin cpack) +if(APPLE) + install_targets(/bin cmakexbuild) +endif() + +install_files(${CMAKE_DATA_DIR}/include cmCPluginAPI.h) diff --git a/Source/CMakeVersion.bash b/Source/CMakeVersion.bash index 126adba8e..4794e608d 100755 --- a/Source/CMakeVersion.bash +++ b/Source/CMakeVersion.bash @@ -3,5 +3,5 @@ if test "x$1" = "x-f"; then shift ; n='*' ; else n='\{8\}' ; fi if test "$#" -gt 0; then echo 1>&2 "usage: CMakeVersion.bash [-f]"; exit 1; fi sed -i -e ' -s/\(^SET(CMake_VERSION_TWEAK\) [0-9]'"$n"'\(.*\)/\1 '"$(date +%Y%m%d)"'\2/ +s/\(^set(CMake_VERSION_TWEAK\) [0-9]'"$n"'\(.*\)/\1 '"$(date +%Y%m%d)"'\2/ ' "${BASH_SOURCE%/*}/CMakeVersion.cmake" diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d124b660c..e3335759e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,6 +1,6 @@ # CMake version number components. -SET(CMake_VERSION_MAJOR 2) -SET(CMake_VERSION_MINOR 8) -SET(CMake_VERSION_PATCH 9) -SET(CMake_VERSION_TWEAK 0) -#SET(CMake_VERSION_RC 3) +set(CMake_VERSION_MAJOR 2) +set(CMake_VERSION_MINOR 8) +set(CMake_VERSION_PATCH 11) +set(CMake_VERSION_TWEAK 0) +set(CMake_VERSION_RC 1) diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx index e0fbe9b75..a9842c1df 100644 --- a/Source/CPack/OSXScriptLauncher.cxx +++ b/Source/CPack/OSXScriptLauncher.cxx @@ -93,7 +93,7 @@ int main(int argc, char* argv[]) cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); cmsysProcess_SetTimeout(cp, 0); cmsysProcess_Execute(cp); - + std::vector tempOutput; char* data; int length; @@ -111,9 +111,9 @@ int main(int argc, char* argv[]) } cmsys_ios::cout.write(data, length); } - + cmsysProcess_WaitForExit(cp, 0); - + bool result = true; if(cmsysProcess_GetState(cp) == cmsysProcess_State_Exited) { @@ -140,7 +140,7 @@ int main(int argc, char* argv[]) std::cerr << error_str << std::endl; result = false; } - + cmsysProcess_Delete(cp); return 0; diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx new file mode 100644 index 000000000..e8b0ea971 --- /dev/null +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -0,0 +1,571 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmCPackWIXGenerator.h" + +#include +#include +#include +#include + +#include "cmWIXSourceWriter.h" +#include "cmWIXRichTextFormatWriter.h" + +#include +#include + +#include // for GUID generation + +int cmCPackWIXGenerator::InitializeInternal() +{ + componentPackageMethod = ONE_PACKAGE; + + return this->Superclass::InitializeInternal(); +} + +bool cmCPackWIXGenerator::RunWiXCommand(const std::string& command) +{ + std::string cpackTopLevel; + if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel)) + { + return false; + } + + std::string logFileName = cpackTopLevel + "/wix.log"; + + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Running WiX command: " << command << std::endl); + + std::string output; + + int returnValue = 0; + bool status = cmSystemTools::RunSingleCommand(command.c_str(), &output, + &returnValue, 0, cmSystemTools::OUTPUT_NONE); + + std::ofstream logFile(logFileName.c_str(), std::ios::app); + logFile << command << std::endl; + logFile << output; + logFile.close(); + + if(!status || returnValue) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem running WiX candle. " + "Please check '" << logFileName << "' for errors." << std::endl); + + return false; + } + + return true; +} + +bool cmCPackWIXGenerator::RunCandleCommand( + const std::string& sourceFile, const std::string& objectFile) +{ + std::string executable; + if(!RequireOption("CPACK_WIX_CANDLE_EXECUTABLE", executable)) + { + return false; + } + + std::stringstream command; + command << QuotePath(executable); + command << " -nologo"; + command << " -arch " << GetArchitecture(); + command << " -out " << QuotePath(objectFile); + command << " " << QuotePath(sourceFile); + + return RunWiXCommand(command.str()); +} + +bool cmCPackWIXGenerator::RunLightCommand(const std::string& objectFiles) +{ + std::string executable; + if(!RequireOption("CPACK_WIX_LIGHT_EXECUTABLE", executable)) + { + return false; + } + + std::stringstream command; + command << QuotePath(executable); + command << " -nologo"; + command << " -out " << QuotePath(packageFileNames.at(0)); + command << " -ext WixUIExtension"; + command << " " << objectFiles; + + return RunWiXCommand(command.str()); +} + +int cmCPackWIXGenerator::PackageFiles() +{ + if(!PackageFilesImpl() || cmSystemTools::GetErrorOccuredFlag()) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Fatal WiX Generator Error" << std::endl); + return false; + } + + return true; +} + +bool cmCPackWIXGenerator::InitializeWiXConfiguration() +{ + if(!ReadListFile("CPackWIX.cmake")) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error while executing CPackWIX.cmake" << std::endl); + return false; + } + + if(GetOption("CPACK_WIX_PRODUCT_GUID") == 0) + { + std::string guid = GenerateGUID(); + SetOption("CPACK_WIX_PRODUCT_GUID", guid.c_str()); + + cmCPackLogger(cmCPackLog::LOG_VERBOSE, + "CPACK_WIX_PRODUCT_GUID implicitly set to " << guid << " . " + << std::endl); + } + + if(GetOption("CPACK_WIX_UPGRADE_GUID") == 0) + { + std::string guid = GenerateGUID(); + SetOption("CPACK_WIX_UPGRADE_GUID", guid.c_str()); + + cmCPackLogger(cmCPackLog::LOG_WARNING, + "CPACK_WIX_UPGRADE_GUID implicitly set to " << guid << " . " + "Please refer to the documentation on how and why " + "you might want to set this explicitly." << std::endl); + } + + std::string cpackTopLevel; + if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel)) + { + return false; + } + + if(GetOption("CPACK_WIX_LICENSE_RTF") == 0) + { + std::string licenseFilename = cpackTopLevel + "/License.rtf"; + SetOption("CPACK_WIX_LICENSE_RTF", licenseFilename.c_str()); + + if(!CreateLicenseFile()) + { + return false; + } + } + + return true; +} + +bool cmCPackWIXGenerator::PackageFilesImpl() +{ + if(!InitializeWiXConfiguration()) + { + return false; + } + + if(!CreateWiXVariablesIncludeFile()) + { + return false; + } + + if(!CreateWiXSourceFiles()) + { + return false; + } + + std::stringstream objectFiles; + for(size_t i = 0; i < wixSources.size(); ++i) + { + const std::string& sourceFilename = wixSources[i]; + + std::string objectFilename = + cmSystemTools::GetFilenameWithoutExtension(sourceFilename) + ".wixobj"; + + if(!RunCandleCommand(sourceFilename, objectFilename)) + { + return false; + } + + objectFiles << " " << QuotePath(objectFilename); + } + + return RunLightCommand(objectFiles.str()); +} + +bool cmCPackWIXGenerator::CreateWiXVariablesIncludeFile() +{ + std::string cpackTopLevel; + if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel)) + { + return false; + } + + std::string includeFilename = + cpackTopLevel + "/cpack_variables.wxi"; + + cmWIXSourceWriter includeFile(Logger, includeFilename, true); + CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_GUID"); + CopyDefinition(includeFile, "CPACK_WIX_UPGRADE_GUID"); + CopyDefinition(includeFile, "CPACK_PACKAGE_VENDOR"); + CopyDefinition(includeFile, "CPACK_PACKAGE_NAME"); + CopyDefinition(includeFile, "CPACK_PACKAGE_VERSION"); + CopyDefinition(includeFile, "CPACK_WIX_LICENSE_RTF"); + CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_ICON"); + CopyDefinition(includeFile, "CPACK_WIX_UI_BANNER"); + CopyDefinition(includeFile, "CPACK_WIX_UI_DIALOG"); + + return true; +} + +void cmCPackWIXGenerator::CopyDefinition( + cmWIXSourceWriter &source, const std::string &name) +{ + const char* value = GetOption(name.c_str()); + if(value) + { + AddDefinition(source, name, value); + } +} + +void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source, + const std::string& name, const std::string& value) +{ + std::stringstream tmp; + tmp << name << "=\"" << value << '"'; + + source.AddProcessingInstruction("define", + cmWIXSourceWriter::WindowsCodepageToUtf8(tmp.str())); +} + +bool cmCPackWIXGenerator::CreateWiXSourceFiles() +{ + std::string cpackTopLevel; + if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel)) + { + return false; + } + + std::string directoryDefinitionsFilename = + cpackTopLevel + "/directories.wxs"; + + wixSources.push_back(directoryDefinitionsFilename); + + cmWIXSourceWriter directoryDefinitions(Logger, directoryDefinitionsFilename); + directoryDefinitions.BeginElement("Fragment"); + + directoryDefinitions.BeginElement("Directory"); + directoryDefinitions.AddAttribute("Id", "TARGETDIR"); + directoryDefinitions.AddAttribute("Name", "SourceDir"); + + directoryDefinitions.BeginElement("Directory"); + if(GetArchitecture() == "x86") + { + directoryDefinitions.AddAttribute("Id", "ProgramFilesFolder"); + } + else + { + directoryDefinitions.AddAttribute("Id", "ProgramFiles64Folder"); + } + + std::vector install_root; + + std::string tmp; + if(!RequireOption("CPACK_PACKAGE_INSTALL_DIRECTORY", tmp)) + { + return false; + } + + cmSystemTools::SplitPath(tmp.c_str(), install_root); + + if(!install_root.empty() && install_root.back().empty()) + { + install_root.pop_back(); + } + + for(size_t i = 1; i < install_root.size(); ++i) + { + directoryDefinitions.BeginElement("Directory"); + + if(i == install_root.size() - 1) + { + directoryDefinitions.AddAttribute("Id", "INSTALL_ROOT"); + } + else + { + std::stringstream ss; + ss << "INSTALL_PREFIX_" << i; + directoryDefinitions.AddAttribute("Id", ss.str()); + } + + directoryDefinitions.AddAttribute("Name", install_root[i]); + } + + size_t directoryCounter = 0; + size_t fileCounter = 0; + + std::string fileDefinitionsFilename = + cpackTopLevel + "/files.wxs"; + + wixSources.push_back(fileDefinitionsFilename); + + cmWIXSourceWriter fileDefinitions(Logger, fileDefinitionsFilename); + fileDefinitions.BeginElement("Fragment"); + + std::string featureDefinitionsFilename = + cpackTopLevel +"/features.wxs"; + + wixSources.push_back(featureDefinitionsFilename); + + cmWIXSourceWriter featureDefinitions(Logger, featureDefinitionsFilename); + featureDefinitions.BeginElement("Fragment"); + + featureDefinitions.BeginElement("Feature"); + featureDefinitions.AddAttribute("Id", "ProductFeature"); + featureDefinitions.AddAttribute("Title", Name); + featureDefinitions.AddAttribute("Level", "1"); + featureDefinitions.EndElement(); + + featureDefinitions.BeginElement("FeatureRef"); + featureDefinitions.AddAttribute("Id", "ProductFeature"); + + AddDirectoryAndFileDefinitons( + toplevel, "INSTALL_ROOT", + directoryDefinitions, fileDefinitions, featureDefinitions, + directoryCounter, fileCounter); + + featureDefinitions.EndElement(); + featureDefinitions.EndElement(); + fileDefinitions.EndElement(); + + for(size_t i = 1; i < install_root.size(); ++i) + { + directoryDefinitions.EndElement(); + } + + directoryDefinitions.EndElement(); + directoryDefinitions.EndElement(); + directoryDefinitions.EndElement(); + + std::string wixTemplate = FindTemplate("WIX.template.in"); + if(wixTemplate.empty()) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Could not find CPack WiX template file WIX.template.in" << std::endl); + return false; + } + + std::string mainSourceFilePath = cpackTopLevel + "/main.wxs"; + + if(!ConfigureFile(wixTemplate.c_str(), mainSourceFilePath .c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Failed creating '" << mainSourceFilePath << + "'' from template." << std::endl); + + return false; + } + + wixSources.push_back(mainSourceFilePath); + + return true; +} + +bool cmCPackWIXGenerator::CreateLicenseFile() +{ + std::string licenseSourceFilename; + if(!RequireOption("CPACK_RESOURCE_FILE_LICENSE", licenseSourceFilename)) + { + return false; + } + + std::string licenseDestinationFilename; + if(!RequireOption("CPACK_WIX_LICENSE_RTF", licenseDestinationFilename)) + { + return false; + } + + std::string extension = GetRightmostExtension(licenseSourceFilename); + + if(extension == ".rtf") + { + cmSystemTools::CopyAFile( + licenseSourceFilename.c_str(), + licenseDestinationFilename.c_str()); + } + else if(extension == ".txt") + { + cmWIXRichTextFormatWriter rtfWriter(licenseDestinationFilename); + + std::ifstream licenseSource(licenseSourceFilename.c_str()); + + std::string line; + while(std::getline(licenseSource, line)) + { + rtfWriter.AddText(line); + rtfWriter.AddText("\n"); + } + } + else + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "unsupported WiX License file extension '" << + extension << "'" << std::endl); + + return false; + } + + return true; +} + +void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( + const std::string& topdir, + const std::string& directoryId, + cmWIXSourceWriter& directoryDefinitions, + cmWIXSourceWriter& fileDefinitions, + cmWIXSourceWriter& featureDefinitions, + size_t& directoryCounter, + size_t& fileCounter) +{ + cmsys::Directory dir; + dir.Load(topdir.c_str()); + + for(size_t i = 0; i < dir.GetNumberOfFiles(); ++i) + { + std::string fileName = dir.GetFile(static_cast(i)); + + if(fileName == "." || fileName == "..") + { + continue; + } + + std::string fullPath = topdir + "/" + fileName; + + if(cmSystemTools::FileIsDirectory(fullPath.c_str())) + { + std::stringstream tmp; + tmp << "DIR_ID_" << ++directoryCounter; + std::string subDirectoryId = tmp.str(); + + directoryDefinitions.BeginElement("Directory"); + directoryDefinitions.AddAttribute("Id", subDirectoryId); + directoryDefinitions.AddAttribute("Name", fileName); + + AddDirectoryAndFileDefinitons( + fullPath, subDirectoryId, + directoryDefinitions, + fileDefinitions, + featureDefinitions, + directoryCounter, + fileCounter); + + directoryDefinitions.EndElement(); + } + else + { + std::stringstream tmp; + tmp << "_ID_" << ++fileCounter; + std::string idSuffix = tmp.str(); + + std::string componentId = std::string("CMP") + idSuffix; + std::string fileId = std::string("FILE") + idSuffix; + + fileDefinitions.BeginElement("DirectoryRef"); + fileDefinitions.AddAttribute("Id", directoryId); + + fileDefinitions.BeginElement("Component"); + fileDefinitions.AddAttribute("Id", componentId); + fileDefinitions.AddAttribute("Guid", "*"); + + fileDefinitions.BeginElement("File"); + fileDefinitions.AddAttribute("Id", fileId); + fileDefinitions.AddAttribute("Source", fullPath); + fileDefinitions.AddAttribute("KeyPath", "yes"); + + fileDefinitions.EndElement(); + fileDefinitions.EndElement(); + fileDefinitions.EndElement(); + + featureDefinitions.BeginElement("ComponentRef"); + featureDefinitions.AddAttribute("Id", componentId); + featureDefinitions.EndElement(); + } + } +} + +bool cmCPackWIXGenerator::RequireOption( + const std::string& name, std::string &value) const +{ + const char* tmp = GetOption(name.c_str()); + if(tmp) + { + value = tmp; + + return true; + } + else + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Required variable " << name << " not set" << std::endl); + + return false; + } +} + +std::string cmCPackWIXGenerator::GetArchitecture() const +{ + std::string void_p_size; + RequireOption("CPACK_WIX_SIZEOF_VOID_P", void_p_size); + + if(void_p_size == "8") + { + return "x64"; + } + else + { + return "x86"; + } +} + +std::string cmCPackWIXGenerator::GenerateGUID() +{ + UUID guid; + UuidCreate(&guid); + + unsigned char *tmp = 0; + UuidToString(&guid, &tmp); + + std::string result(reinterpret_cast(tmp)); + RpcStringFree(&tmp); + + return cmSystemTools::UpperCase(result); +} + +std::string cmCPackWIXGenerator::QuotePath(const std::string& path) +{ + return std::string("\"") + path + '"'; +} + +std::string cmCPackWIXGenerator::GetRightmostExtension( + const std::string& filename) +{ + std::string extension; + + std::string::size_type i = filename.rfind("."); + if(i != std::string::npos) + { + extension = filename.substr(i); + } + + return cmSystemTools::LowerCase(extension); +} diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h new file mode 100644 index 000000000..0e95d70f6 --- /dev/null +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -0,0 +1,101 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmCPackWIXGenerator_h +#define cmCPackWIXGenerator_h + +#include + +#include +#include + +class cmWIXSourceWriter; + +/** \class cmCPackWIXGenerator + * \brief A generator for WIX files + */ +class cmCPackWIXGenerator : public cmCPackGenerator +{ +public: + cmCPackTypeMacro(cmCPackWIXGenerator, cmCPackGenerator); + +protected: + virtual int InitializeInternal(); + + virtual int PackageFiles(); + + virtual const char* GetOutputExtension() + { + return ".msi"; + } + + virtual enum CPackSetDestdirSupport SupportsSetDestdir() const + { + return SETDESTDIR_UNSUPPORTED; + } + + virtual bool SupportsAbsoluteDestination() const + { + return false; + } + + virtual bool SupportsComponentInstallation() const + { + return false; + } + +private: + bool InitializeWiXConfiguration(); + + bool PackageFilesImpl(); + + bool CreateWiXVariablesIncludeFile(); + + void CopyDefinition( + cmWIXSourceWriter &source, const std::string &name); + + void AddDefinition(cmWIXSourceWriter& source, + const std::string& name, const std::string& value); + + bool CreateWiXSourceFiles(); + + bool CreateLicenseFile(); + + bool RunWiXCommand(const std::string& command); + + bool RunCandleCommand( + const std::string& sourceFile, const std::string& objectFile); + + bool RunLightCommand(const std::string& objectFiles); + + void AddDirectoryAndFileDefinitons(const std::string& topdir, + const std::string& directoryId, + cmWIXSourceWriter& directoryDefinitions, + cmWIXSourceWriter& fileDefinitions, + cmWIXSourceWriter& featureDefinitions, + size_t& directoryCounter, + size_t& fileCounter); + + bool RequireOption(const std::string& name, std::string& value) const; + + std::string GetArchitecture() const; + + static std::string GenerateGUID(); + + static std::string QuotePath(const std::string& path); + + static std::string GetRightmostExtension(const std::string& filename); + + std::vector wixSources; +}; + +#endif diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx new file mode 100644 index 000000000..774c22c76 --- /dev/null +++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx @@ -0,0 +1,137 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmWIXRichTextFormatWriter.h" + +#include + +cmWIXRichTextFormatWriter::cmWIXRichTextFormatWriter( + const std::string& filename): + file(filename.c_str(), std::ios::binary) +{ + StartGroup(); + WriteHeader(); + WriteDocumentPrefix(); +} + +cmWIXRichTextFormatWriter::~cmWIXRichTextFormatWriter() +{ + EndGroup(); + + /* I haven't seen this in the RTF spec but + * wordpad terminates its RTF like this */ + file << "\r\n"; + file.put(0); +} + +void cmWIXRichTextFormatWriter::AddText(const std::string& text) +{ + typedef unsigned char rtf_byte_t; + + for(size_t i = 0; i < text.size(); ++i) + { + rtf_byte_t c = rtf_byte_t(text[i]); + + switch(c) + { + case '\\': + file << "\\\\"; + break; + case '{': + file << "\\{"; + break; + case '}': + file << "\\}"; + break; + case '\n': + file << "\\par\r\n"; + break; + case '\r': + continue; + default: + { + if(c <= 0x7F) + { + file << c; + } + else + { + file << "[NON-ASCII-" << int(c) << "]"; + } + } + break; + } + } +} + +void cmWIXRichTextFormatWriter::WriteHeader() +{ + ControlWord("rtf1"); + ControlWord("ansi"); + ControlWord("ansicpg1252"); + ControlWord("deff0"); + ControlWord("deflang1031"); + + WriteFontTable(); + WriteGenerator(); +} + +void cmWIXRichTextFormatWriter::WriteFontTable() +{ + StartGroup(); + ControlWord("fonttbl"); + + StartGroup(); + ControlWord("f0"); + ControlWord("fswiss"); + ControlWord("fcharset0 Arial;"); + EndGroup(); + + EndGroup(); +} + +void cmWIXRichTextFormatWriter::WriteGenerator() +{ + StartGroup(); + NewControlWord("generator"); + file << " CPack WiX Generator (" << cmVersion::GetCMakeVersion() << ");"; + EndGroup(); +} + +void cmWIXRichTextFormatWriter::WriteDocumentPrefix() +{ + ControlWord("viewkind4"); + ControlWord("uc1"); + ControlWord("pard"); + ControlWord("f0"); + ControlWord("fs20"); +} + +void cmWIXRichTextFormatWriter::ControlWord(const std::string& keyword) +{ + file << "\\" << keyword; +} + +void cmWIXRichTextFormatWriter::NewControlWord(const std::string& keyword) +{ + file << "\\*\\" << keyword; +} + +void cmWIXRichTextFormatWriter::StartGroup() +{ + file.put('{'); +} + +void cmWIXRichTextFormatWriter::EndGroup() +{ + file.put('}'); +} diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h new file mode 100644 index 000000000..10b67c39f --- /dev/null +++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h @@ -0,0 +1,46 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmWIXRichTextFormatWriter_h +#define cmWIXRichTextFormatWriter_h + +#include + +/** \class cmWIXRichtTextFormatWriter + * \brief Helper class to generate Rich Text Format (RTF) documents + * from plain text (e.g. for license and welcome text) + */ +class cmWIXRichTextFormatWriter +{ +public: + cmWIXRichTextFormatWriter(const std::string& filename); + ~cmWIXRichTextFormatWriter(); + + void AddText(const std::string& text); + +private: + void WriteHeader(); + void WriteFontTable(); + void WriteGenerator(); + + void WriteDocumentPrefix(); + + void ControlWord(const std::string& keyword); + void NewControlWord(const std::string& keyword); + + void StartGroup(); + void EndGroup(); + + std::ofstream file; +}; + +#endif diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx new file mode 100644 index 000000000..af7ba807f --- /dev/null +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -0,0 +1,189 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmWIXSourceWriter.h" + +#include + +#include + +cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger, + const std::string& filename, + bool isIncludeFile): + Logger(logger), + file(filename.c_str()), + state(DEFAULT) +{ + WriteXMLDeclaration(); + + if(isIncludeFile) + { + BeginElement("Include"); + } + else + { + BeginElement("Wix"); + } + + AddAttribute("xmlns", "http://schemas.microsoft.com/wix/2006/wi"); +} + +cmWIXSourceWriter::~cmWIXSourceWriter() +{ + while(elements.size()) + { + EndElement(); + } +} + +void cmWIXSourceWriter::BeginElement(const std::string& name) +{ + if(state == BEGIN) + { + file << ">"; + } + + file << "\n"; + Indent(elements.size()); + file << "<" << name; + + elements.push_back(name); + state = BEGIN; +} + +void cmWIXSourceWriter::EndElement() +{ + if(elements.empty()) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "can not end WiX element with no open elements" << std::endl); + return; + } + + if(state == DEFAULT) + { + file << "\n"; + Indent(elements.size()-1); + file << ""; + } + else + { + file << "/>"; + } + + elements.pop_back(); + state = DEFAULT; +} + +void cmWIXSourceWriter::AddProcessingInstruction( + const std::string& target, const std::string& content) +{ + if(state == BEGIN) + { + file << ">"; + } + + file << "\n"; + Indent(elements.size()); + file << ""; + + state = DEFAULT; +} + +void cmWIXSourceWriter::AddAttribute( + const std::string& key, const std::string& value) +{ + std::string utf8 = WindowsCodepageToUtf8(value); + + file << " " << key << "=\"" << EscapeAttributeValue(utf8) << '"'; +} + +std::string cmWIXSourceWriter::WindowsCodepageToUtf8(const std::string& value) +{ + if(value.empty()) + { + return std::string(); + } + + int characterCount = MultiByteToWideChar( + CP_ACP, 0, value.c_str(), static_cast(value.size()), 0, 0); + + if(characterCount == 0) + { + return std::string(); + } + + std::vector utf16(characterCount); + + MultiByteToWideChar( + CP_ACP, 0, value.c_str(), static_cast(value.size()), + &utf16[0], static_cast(utf16.size())); + + int utf8ByteCount = WideCharToMultiByte( + CP_UTF8, 0, &utf16[0], static_cast(utf16.size()), 0, 0, 0, 0); + + if(utf8ByteCount == 0) + { + return std::string(); + } + + std::vector utf8(utf8ByteCount); + + WideCharToMultiByte(CP_UTF8, 0, &utf16[0], static_cast(utf16.size()), + &utf8[0], static_cast(utf8.size()), 0, 0); + + return std::string(&utf8[0], utf8.size()); +} + + +void cmWIXSourceWriter::WriteXMLDeclaration() +{ + file << "" << std::endl; +} + +void cmWIXSourceWriter::Indent(size_t count) +{ + for(size_t i = 0; i < count; ++i) + { + file << " "; + } +} + +std::string cmWIXSourceWriter::EscapeAttributeValue( + const std::string& value) +{ + std::string result; + result.reserve(value.size()); + + char c = 0; + for(size_t i = 0 ; i < value.size(); ++i) + { + c = value[i]; + switch(c) + { + case '<': + result += "<"; + break; + case '&': + result +="&"; + break; + case '"': + result += """; + break; + default: + result += c; + break; + } + } + + return result; +} diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h new file mode 100644 index 000000000..1dafc1ff2 --- /dev/null +++ b/Source/CPack/WiX/cmWIXSourceWriter.h @@ -0,0 +1,67 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmWIXSourceWriter_h +#define cmWIXSourceWriter_h + +#include +#include +#include + +#include + +/** \class cmWIXSourceWriter + * \brief Helper class to generate XML WiX source files + */ +class cmWIXSourceWriter +{ +public: + cmWIXSourceWriter(cmCPackLog* logger, + const std::string& filename, bool isIncludeFile = false); + + ~cmWIXSourceWriter(); + + void BeginElement(const std::string& name); + + void EndElement(); + + void AddProcessingInstruction( + const std::string& target, const std::string& content); + + void AddAttribute( + const std::string& key, const std::string& value); + + static std::string WindowsCodepageToUtf8(const std::string& value); + +private: + enum State + { + DEFAULT, + BEGIN + }; + + void WriteXMLDeclaration(); + + void Indent(size_t count); + + static std::string EscapeAttributeValue(const std::string& value); + + cmCPackLog* Logger; + + std::ofstream file; + + State state; + + std::vector elements; +}; + +#endif diff --git a/Source/CPack/bills-comments.txt b/Source/CPack/bills-comments.txt index f73499d01..c3b4ee8e7 100644 --- a/Source/CPack/bills-comments.txt +++ b/Source/CPack/bills-comments.txt @@ -1,18 +1,18 @@ cpack.cxx - -cmCPackGenerators -- creates cmCPackGenericGenerator's via NewGenerator + +cmCPackGenerators -- creates cmCPackGenericGenerator's via NewGenerator - a cmCPackGenericGenerator factory cmCPackGenericGenerator::Initialize this->InitializeInternal - CPACK_INCLUDE_TOPLEVEL_DIRECTORY = 0 turns off + CPACK_INCLUDE_TOPLEVEL_DIRECTORY = 0 turns off // binary package run cmCPackGenericGenerator::ProcessGenerator // DoPackage cmCPackGenericGenerator::PrepareNames -- sets a bunch of CPACK_vars - cmCPackGenericGenerator::InstallProject + cmCPackGenericGenerator::InstallProject run preinstall (make preinstall/fast) call ReadListFile(cmake_install.cmake) glob recurse in install directory to get list of files @@ -22,9 +22,9 @@ cmCPackGenericGenerator::ProcessGenerator // DoPackage // source package run cmCPackGenericGenerator::ProcessGenerator // DoPackage cmCPackGenericGenerator::PrepareNames -- sets a bunch of CPACK_vars - cmCPackGenericGenerator::InstallProject --> + cmCPackGenericGenerator::InstallProject --> if set CPACK_INSTALLED_DIRECTORIES - glob the files in that directory + glob the files in that directory copy those files to the tmp install directory _CPack something glob recurse in install directory to get list of files this->CompressFiles with the list of files @@ -35,12 +35,12 @@ packages. It is controled based on values set in CPACK_ variables. InstallProject - 1. CPACK_INSTALL_COMMANDS - a list of commands used to install the package + 1. CPACK_INSTALL_COMMANDS - a list of commands used to install the package 2. CPACK_INSTALLED_DIRECTORIES - copy this directory to CPACK_TEMPORARY_DIRECTORY 3. CPACK_INSTALL_CMAKE_PROJECTS - a cmake install script - - run make preinstall + - run make preinstall - run cmake_install.cmake - set CMAKE_INSTALL_PREFIX to the temp directory - CPACK_BUILD_CONFIG check this and set the BUILD_TYPE to it @@ -59,10 +59,10 @@ rename cmCPackGenericGenerator::ProcessGenerator -> cmCPackGenerator::DoPackage break up cmCPackGenerator::InstallProject so it calls the following: // run user provided install commands - cmCPackGenerator::RunInstallCommands(); + cmCPackGenerator::RunInstallCommands(); // copy entire directories that need no processing like source trees - cmCPackGenerator::CopyPreInstalledDirectories(); + cmCPackGenerator::CopyPreInstalledDirectories(); // run the cmake install scripts if provided - cmCPackGenerator::RunCMakeInstallScripts() + cmCPackGenerator::RunCMakeInstallScripts() - diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index b1bbb8363..6411b1ebf 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -33,7 +33,7 @@ public: */ cmCPackArchiveGenerator(cmArchiveWrite::Compress, cmArchiveWrite::Type); virtual ~cmCPackArchiveGenerator(); - // Used to add a header to the archive + // Used to add a header to the archive virtual int GenerateHeader(std::ostream* os); // component support virtual bool SupportsComponentInstallation() const; diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index af78e7822..6c994f13f 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -91,8 +91,8 @@ int cmCPackBundleGenerator::PackageFiles() } // Get optional arguments ... - const std::string cpack_bundle_startup_command = - this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND") + const std::string cpack_bundle_startup_command = + this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND") ? this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND") : ""; // The staging directory contains everything that will end-up inside the diff --git a/Source/CPack/cmCPackComponentGroup.cxx b/Source/CPack/cmCPackComponentGroup.cxx index 1d21fb11c..f93eca823 100644 --- a/Source/CPack/cmCPackComponentGroup.cxx +++ b/Source/CPack/cmCPackComponentGroup.cxx @@ -36,7 +36,7 @@ unsigned long cmCPackComponent::GetInstalledSize(const char* installDir) const } //---------------------------------------------------------------------- -unsigned long +unsigned long cmCPackComponent::GetInstalledSizeInKbytes(const char* installDir) const { unsigned long result = (GetInstalledSize(installDir) + 512) / 1024; diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index cebdd6d20..abae3724e 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -18,7 +18,7 @@ class cmCPackComponentGroup; /** \class cmCPackInstallationType - * \brief A certain type of installation, which encompasses a + * \brief A certain type of installation, which encompasses a * set of components. */ class cmCPackInstallationType @@ -42,7 +42,9 @@ public: class cmCPackComponent { public: - cmCPackComponent() : Group(0), TotalSize(0) { } + cmCPackComponent() : Group(0), IsRequired(true), IsHidden(false), + IsDisabledByDefault(false), IsDownloaded(false), + TotalSize(0) { } /// The name of the component (used to reference the component). std::string Name; @@ -90,7 +92,7 @@ public: std::vector Directories; /// Get the total installed size of all of the files in this - /// component, in bytes. installDir is the directory into which the + /// component, in bytes. installDir is the directory into which the /// component was installed. unsigned long GetInstalledSize(const char* installDir) const; diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx index 6c8fc54e0..6605f16e0 100644 --- a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx +++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx @@ -50,7 +50,7 @@ int cmCPackCygwinBinaryGenerator::PackageFiles() std::string manifest = "/usr/share/doc/"; manifest += packageName; manifest += "/MANIFEST"; - std::string manifestFile + std::string manifestFile = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); // Create a MANIFEST file that contains all of the files in // the tar file @@ -70,8 +70,8 @@ int cmCPackCygwinBinaryGenerator::PackageFiles() } // add the manifest file to the list of all files files.push_back(manifestFile); - - // create the bzip2 tar file + + // create the bzip2 tar file return this->Superclass::PackageFiles(); } @@ -81,8 +81,8 @@ const char* cmCPackCygwinBinaryGenerator::GetOutputExtension() const char* patchNumber =this->GetOption("CPACK_CYGWIN_PATCH_NUMBER"); if(!patchNumber) { - patchNumber = "1"; - cmCPackLogger(cmCPackLog::LOG_WARNING, + patchNumber = "1"; + cmCPackLogger(cmCPackLog::LOG_WARNING, "CPACK_CYGWIN_PATCH_NUMBER not specified using 1" << std::endl); } diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx index 597972992..f1e8539b9 100644 --- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx +++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx @@ -68,18 +68,18 @@ int cmCPackCygwinSourceGenerator::PackageFiles() // and the CPACK_CYGWIN_PATCH_FILE and CPACK_TOPLEVEL_DIRECTORY // files std::string compressOutFile = packageDirFileName; - // at this point compressOutFile is the full path to + // at this point compressOutFile is the full path to // _CPack_Package/.../package-2.5.0.tar.bz2 // we want to create a tar _CPack_Package/.../package-2.5.0-1-src.tar.bz2 - // with these - // _CPack_Package/.../package-2.5.0-1.patch + // with these + // _CPack_Package/.../package-2.5.0-1.patch // _CPack_Package/.../package-2.5.0-1.sh // _CPack_Package/.../package-2.5.0.tar.bz2 // the -1 is CPACK_CYGWIN_PATCH_NUMBER - + // first copy the patch file and the .sh file // to the toplevel cpack temp dir - + // copy the patch file into place if(!this->GetOption("CPACK_CYGWIN_PATCH_FILE")) { @@ -98,7 +98,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles() } if(!this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT")) { - cmCPackLogger(cmCPackLog::LOG_ERROR, + cmCPackLogger(cmCPackLog::LOG_ERROR, "No build script specified for cygwin sources."); return 0; } @@ -168,7 +168,7 @@ const char* cmCPackCygwinSourceGenerator::GetPackagingInstallPrefix() const char* cmCPackCygwinSourceGenerator::GetOutputExtension() { this->OutputExtension = "-"; - const char* patch = this->GetOption("CPACK_CYGWIN_PATCH_NUMBER"); + const char* patch = this->GetOption("CPACK_CYGWIN_PATCH_NUMBER"); if(!patch) { cmCPackLogger(cmCPackLog::LOG_WARNING, "CPACK_CYGWIN_PATCH_NUMBER" @@ -179,4 +179,4 @@ const char* cmCPackCygwinSourceGenerator::GetOutputExtension() this->OutputExtension += "-src.tar.bz2"; return this->OutputExtension.c_str(); } - + diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index fa456deff..f99db5889 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -76,6 +76,11 @@ int cmCPackDebGenerator::PackageOnePack(std::string initialTopLevel, packageFileName.c_str()); // Tell CPackDeb.cmake the name of the component GROUP. this->SetOption("CPACK_DEB_PACKAGE_COMPONENT",packageName.c_str()); + // Tell CPackDeb.cmake the path where the component is. + std::string component_path = "/"; + component_path += packageName; + this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH", + component_path.c_str()); if (!this->ReadListFile("CPackDeb.cmake")) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -198,8 +203,11 @@ int cmCPackDebGenerator::PackageComponentsAllInOne() /* replace the TEMPORARY package file name */ this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME", packageFileName.c_str()); - // Tell CPackDeb.cmake the name of the component GROUP. - this->SetOption("CPACK_DEB_PACKAGE_COMPONENT",compInstDirName.c_str()); + // Tell CPackDeb.cmake the path where the component is. + std::string component_path = "/"; + component_path += compInstDirName; + this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH", + component_path.c_str()); if (!this->ReadListFile("CPackDeb.cmake")) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -293,15 +301,15 @@ int cmCPackDebGenerator::createDeb() // debian policy enforce lower case for package name // mandatory entries: - std::string debian_pkg_name = cmsys::SystemTools::LowerCase( + std::string debian_pkg_name = cmsys::SystemTools::LowerCase( this->GetOption("CPACK_DEBIAN_PACKAGE_NAME") ); - const char* debian_pkg_version = + const char* debian_pkg_version = this->GetOption("CPACK_DEBIAN_PACKAGE_VERSION"); - const char* debian_pkg_section = + const char* debian_pkg_section = this->GetOption("CPACK_DEBIAN_PACKAGE_SECTION"); - const char* debian_pkg_priority = + const char* debian_pkg_priority = this->GetOption("CPACK_DEBIAN_PACKAGE_PRIORITY"); - const char* debian_pkg_arch = + const char* debian_pkg_arch = this->GetOption("CPACK_DEBIAN_PACKAGE_ARCHITECTURE"); const char* maintainer = this->GetOption("CPACK_DEBIAN_PACKAGE_MAINTAINER"); const char* desc = this->GetOption("CPACK_DEBIAN_PACKAGE_DESCRIPTION"); @@ -719,8 +727,8 @@ static int copy_ar(CF *cfp, off_t size) FILE* from = cfp->rFile; FILE* to = cfp->wFile; - while (sz && - (nr = fread(buf, 1, sz < static_cast(sizeof(buf)) + while (sz && + (nr = fread(buf, 1, sz < static_cast(sizeof(buf)) ? static_cast(sz) : sizeof(buf), from )) > 0) { sz -= nr; @@ -731,7 +739,7 @@ static int copy_ar(CF *cfp, off_t size) if (sz) return -2; - if (cfp->flags & WPAD && (size + ar_already_written) & 1 + if (cfp->flags & WPAD && (size + ar_already_written) & 1 && fwrite(&pad, 1, 1, to) != 1) return -4; @@ -767,8 +775,8 @@ static int put_arobj(CF *cfp, struct stat *sb) (long long)sb->st_size + lname, ARFMAG); else { lname = 0; - (void)sprintf(ar_hb, HDR2, name, - (long int)sb->st_mtime, uid, gid, sb->st_mode, + (void)sprintf(ar_hb, HDR2, name, + (long int)sb->st_mtime, uid, gid, sb->st_mode, (long long)sb->st_size, ARFMAG); } off_t size = sb->st_size; @@ -790,7 +798,7 @@ static int put_arobj(CF *cfp, struct stat *sb) /* append -- * Append files to the archive - modifies original archive or creates - * a new archive if named archive does not exist. + * a new archive if named archive does not exist. */ static int ar_append(const char* archive,const std::vector& files) { diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx index edbef45ef..6a841fa8d 100644 --- a/Source/CPack/cmCPackDocumentVariables.cxx +++ b/Source/CPack/cmCPackDocumentVariables.cxx @@ -31,31 +31,42 @@ void cmCPackDocumentVariables::DefineVariables(cmake* cm) "Each CPack generator as a built-in default value for this" " variable. E.g. Archive generators (ZIP, TGZ, ...) includes" " the top level whereas RPM or DEB don't. The user may override" - " the default value byt setting this variable.\n" + " the default value by setting this variable.\n" "There is a similar variable " - "CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY" + "CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY " "which may be used to override the behavior for the component" - "packaging case which may have different default value for" - "historical (now backward compatibility) reason.", false, + " packaging case which may have different default value for" + " historical (now backward compatibility) reason.", false, "Variables common to all CPack generators"); + cm->DefineProperty + ("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY", cmProperty::VARIABLE, + "Boolean toggle to include/exclude top level directory " + "(component case).", + "Similar usage as CPACK_INCLUDE_TOPLEVEL_DIRECTORY" + " but for the component case. " + "See CPACK_INCLUDE_TOPLEVEL_DIRECTORY documentation for" + " the detail.", false, + "Variables common to all CPack generators"); + cm->DefineProperty ("CPACK_SET_DESTDIR", cmProperty::VARIABLE, "Boolean toggle to make CPack use DESTDIR mechanism when" " packaging.", "DESTDIR means DESTination DIRectory." " It is commonly used by makefile " "users in order to install software at non-default location. It " - "is a basic relocation mechanism. " + "is a basic relocation mechanism that should not be used on" + " Windows (see CMAKE_INSTALL_PREFIX documentation). " "It is usually invoked like this:\n" " make DESTDIR=/home/john install\n" "which will install the concerned software using the" - " installation prefix, e.g. \"/usr/local\" prepended with " + " installation prefix, e.g. \"/usr/local\" pre-pended with " "the DESTDIR value which finally gives \"/home/john/usr/local\"." " When preparing a package, CPack first installs the items to be " "packaged in a local (to the build tree) directory by using the " "same DESTDIR mechanism. Nevertheless, if " "CPACK_SET_DESTDIR is set then CPack will set DESTDIR before" - " doing the local install. The most noticeable difference is" + " doing the local install. The most noticeable difference is" " that without CPACK_SET_DESTDIR, CPack uses " "CPACK_PACKAGING_INSTALL_PREFIX as a prefix whereas with " "CPACK_SET_DESTDIR set, CPack will use CMAKE_INSTALL_PREFIX as" diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 6aee401ff..d973c0134 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -17,7 +17,7 @@ #include -static const char* SLAHeader = +static const char* SLAHeader = "data 'LPic' (5000) {\n" " $\"0002 0011 0003 0001 0000 0000 0002 0000\"\n" " $\"0008 0003 0000 0001 0004 0000 0004 0005\"\n" @@ -29,7 +29,7 @@ static const char* SLAHeader = "};\n" "\n"; -static const char* SLASTREnglish = +static const char* SLASTREnglish = "resource 'STR#' (5002, \"English\") {\n" " {\n" " \"English\",\n" @@ -90,7 +90,7 @@ int cmCPackDragNDropGenerator::InitializeInternal() return 0; } this->SetOptionIfNotSet("CPACK_COMMAND_SETFILE", setfile_path.c_str()); - + const std::string rez_path = cmSystemTools::FindProgram("Rez", paths, false); if(rez_path.empty()) @@ -222,7 +222,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, // Get optional arguments ... const std::string cpack_package_icon = this->GetOption("CPACK_PACKAGE_ICON") ? this->GetOption("CPACK_PACKAGE_ICON") : ""; - + const std::string cpack_dmg_volume_name = this->GetOption("CPACK_DMG_VOLUME_NAME") ? this->GetOption("CPACK_DMG_VOLUME_NAME") @@ -233,8 +233,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, ? this->GetOption("CPACK_DMG_FORMAT") : "UDZO"; // Get optional arguments ... - std::string cpack_license_file = - this->GetOption("CPACK_RESOURCE_FILE_LICENSE") ? + std::string cpack_license_file = + this->GetOption("CPACK_RESOURCE_FILE_LICENSE") ? this->GetOption("CPACK_RESOURCE_FILE_LICENSE") : ""; const std::string cpack_dmg_background_image = @@ -405,7 +405,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cmOStringStream detach_command; detach_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); detach_command << " detach"; - detach_command << " \"" << temp_mount.str() << "\""; + detach_command << " \"" << temp_mount.str() << "\""; if(!this->RunCommand(detach_command)) { @@ -416,7 +416,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, return 0; } } - + if(!cpack_license_file.empty()) { std::string sla_r = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); @@ -442,7 +442,22 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, line.replace(pos, 1, "\\\""); pos = line.find('\"', pos+2); } - osf << " \"" << line << "\\n\"\n"; + // break up long lines to avoid Rez errors + std::vector lines; + const size_t max_line_length = 512; + for(size_t i=0; i line.size()) + line_length = line.size()-i; + lines.push_back(line.substr(i, line_length)); + } + + for(size_t i=0; iRunCommand(udco_image_command, &error)) { @@ -476,17 +491,17 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, unflatten_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); unflatten_command << " unflatten "; unflatten_command << "\"" << temp_udco << "\""; - + if(!this->RunCommand(unflatten_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error unflattening dmg for adding SLA." << std::endl - << error + << error << std::endl); return 0; } - - // Rez the SLA + + // Rez the SLA cmOStringStream embed_sla_command; embed_sla_command << this->GetOption("CPACK_COMMAND_REZ"); embed_sla_command << " \"" << sla_r << "\""; @@ -496,8 +511,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, if(!this->RunCommand(embed_sla_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error adding SLA." << std::endl - << error + "Error adding SLA." << std::endl + << error << std::endl); return 0; } @@ -507,7 +522,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, flatten_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); flatten_command << " flatten "; flatten_command << "\"" << temp_udco << "\""; - + if(!this->RunCommand(flatten_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -530,7 +545,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, final_image_command << " -imagekey"; final_image_command << " zlib-level=9"; final_image_command << " -o \"" << output_file << "\""; - + if(!this->RunCommand(final_image_command)) { cmCPackLogger(cmCPackLog::LOG_ERROR, diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 0177653f5..7cc152269 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -23,7 +23,6 @@ #include #include -#include // auto_ptr #include #if defined(__HAIKU__) @@ -97,7 +96,6 @@ int cmCPackGenerator::PrepareNames() } tempDirectory += this->GetOption("CPACK_GENERATOR"); std::string topDirectory = tempDirectory; - this->GetOption("CPACK_PACKAGE_FILE_NAME"); const char* pfname = this->GetOption("CPACK_PACKAGE_FILE_NAME"); if(!pfname) { @@ -105,7 +103,7 @@ int cmCPackGenerator::PrepareNames() "CPACK_PACKAGE_FILE_NAME not specified" << std::endl); return 0; } - std::string outName = pfname; + std::string outName = pfname; tempDirectory += "/" + outName; if(!this->GetOutputExtension()) { @@ -149,7 +147,7 @@ int cmCPackGenerator::PrepareNames() if ( !cmSystemTools::FileExists(descFileName) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Cannot find description file name: [" + "Cannot find description file name: [" << descFileName << "]" << std::endl); return 0; } @@ -207,8 +205,8 @@ int cmCPackGenerator::InstallProject() if ( !cmsys::SystemTools::MakeDirectory(bareTempInstallDirectory.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating temporary directory: " - << (tempInstallDirectory ? tempInstallDirectory : "(NULL}") + "Problem creating temporary directory: " + << (tempInstallDirectory ? tempInstallDirectory : "(NULL)") << std::endl); return 0; } @@ -584,7 +582,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( !(this->IsSet("CPACK_MONOLITHIC_INSTALL"))) { // Determine the installation types for this project (if provided). - std::string installTypesVar = "CPACK_" + std::string installTypesVar = "CPACK_" + cmSystemTools::UpperCase(installComponent) + "_INSTALL_TYPES"; const char *installTypes = this->GetOption(installTypesVar.c_str()); if (installTypes && *installTypes) @@ -596,16 +594,16 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( installTypeIt != installTypesVector.end(); ++installTypeIt) { - this->GetInstallationType(installProjectName.c_str(), + this->GetInstallationType(installProjectName.c_str(), installTypeIt->c_str()); } } // Determine the set of components that will be used in this project - std::string componentsVar + std::string componentsVar = "CPACK_COMPONENTS_" + cmSystemTools::UpperCase(installComponent); const char *components = this->GetOption(componentsVar.c_str()); - if (components && *components) + if (components && *components) { cmSystemTools::ExpandListArgument(components, componentsVector); std::vector::iterator compIt; @@ -688,16 +686,16 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( if (componentInstall) { cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Install component: " << installComponent + "- Install component: " << installComponent << std::endl); } - + cmake cm; cm.AddCMakePaths(); cm.SetProgressCallback(cmCPackGeneratorProgress, this); cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - std::auto_ptr lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr lg(gg.CreateLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); std::string realInstallDirectory = tempInstallDirectory; if ( !installSubDirectory.empty() && installSubDirectory != "/" ) @@ -758,7 +756,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( "- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf->AddDefinition)" << std::endl); cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'" + "- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'" << std::endl); // Make sure that DESTDIR + CPACK_INSTALL_PREFIX directory @@ -792,7 +790,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( if ( !cmsys::SystemTools::MakeDirectory(dir.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating temporary directory: " + "Problem creating temporary directory: " << dir << std::endl); return 0; } @@ -806,7 +804,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( tempInstallDirectory.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating temporary directory: " + "Problem creating temporary directory: " << tempInstallDirectory << std::endl); return 0; } @@ -832,7 +830,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( installComponent.c_str()); } - // strip on TRUE, ON, 1, one or several file names, but not on + // strip on TRUE, ON, 1, one or several file names, but not on // FALSE, OFF, 0 and an empty string if (!cmSystemTools::IsOff(this->GetOption("CPACK_STRIP_FILES"))) { @@ -855,7 +853,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( // If CPack was asked to warn on ABSOLUTE INSTALL DESTINATION // then forward request to cmake_install.cmake script - if (this->GetOption("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION")) + if (this->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION")) { mf->AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); @@ -865,7 +863,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( // then ask cmake_install.cmake script to error out // as soon as it occurs (before installing file) if (!SupportsAbsoluteDestination() || - this->GetOption("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION")) + this->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION")) { mf->AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); @@ -905,7 +903,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( localFileName = cmSystemTools::RelativePath(InstallPrefix, fit->c_str()); localFileName = - localFileName.substr(localFileName.find('/')+1, + localFileName.substr(localFileName.find_first_not_of('/'), std::string::npos); Components[installComponent].Files.push_back(localFileName); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file <" @@ -1024,7 +1022,7 @@ int cmCPackGenerator::DoPackage() = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); if ( cmSystemTools::FileExists(toplevelDirectory) ) { - cmCPackLogger(cmCPackLog::LOG_VERBOSE, + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Remove toplevel directory: " << toplevelDirectory << std::endl); if ( !cmSystemTools::RepeatedRemoveDirectory(toplevelDirectory) ) @@ -1153,10 +1151,10 @@ int cmCPackGenerator::Initialize(const char* name, cmMakefile* mf) // set the running generator name this->SetOption("CPACK_GENERATOR", this->Name.c_str()); // Load the project specific config file - const char* config = + const char* config = this->GetOption("CPACK_PROJECT_CONFIG_FILE"); if(config) - { + { mf->ReadListFile(config); } int result = this->InitializeInternal(); @@ -1193,13 +1191,13 @@ bool cmCPackGenerator::IsOn(const char* name) const //---------------------------------------------------------------------- const char* cmCPackGenerator::GetOption(const char* op) const -{ +{ const char* ret = this->MakefileMap->GetDefinition(op); if(!ret) - { - cmCPackLogger(cmCPackLog::LOG_DEBUG, + { + cmCPackLogger(cmCPackLog::LOG_DEBUG, "Warning, GetOption return NULL for: " - << op + << op << std::endl); } return ret; @@ -1222,7 +1220,7 @@ int cmCPackGenerator::SetCMakeRoot() return 1; } cmCPackLogger(cmCPackLog::LOG_ERROR, - "Could not find CMAKE_ROOT !!!" + "Could not find CMAKE_ROOT !!!" << std::endl << "CMake has most likely not been installed correctly." << std::endl @@ -1516,14 +1514,14 @@ cmCPackGenerator::GetInstallationType(const char *projectName, (void) projectName; bool hasInstallationType = this->InstallationTypes.count(name) != 0; cmCPackInstallationType *installType = &this->InstallationTypes[name]; - if (!hasInstallationType) + if (!hasInstallationType) { // Define the installation type - std::string macroPrefix = "CPACK_INSTALL_TYPE_" + std::string macroPrefix = "CPACK_INSTALL_TYPE_" + cmsys::SystemTools::UpperCase(name); installType->Name = name; - const char* displayName + const char* displayName = this->GetOption((macroPrefix + "_DISPLAY_NAME").c_str()); if (displayName && *displayName) { @@ -1546,13 +1544,13 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name) { bool hasComponent = this->Components.count(name) != 0; cmCPackComponent *component = &this->Components[name]; - if (!hasComponent) + if (!hasComponent) { // Define the component - std::string macroPrefix = "CPACK_COMPONENT_" + std::string macroPrefix = "CPACK_COMPONENT_" + cmsys::SystemTools::UpperCase(name); component->Name = name; - const char* displayName + const char* displayName = this->GetOption((macroPrefix + "_DISPLAY_NAME").c_str()); if (displayName && *displayName) { @@ -1562,7 +1560,7 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name) { component->DisplayName = component->Name; } - component->IsHidden + component->IsHidden = this->IsSet((macroPrefix + "_HIDDEN").c_str()); component->IsRequired = this->IsSet((macroPrefix + "_REQUIRED").c_str()); @@ -1572,7 +1570,7 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name) = this->IsSet((macroPrefix + "_DOWNLOADED").c_str()) || cmSystemTools::IsOn(this->GetOption("CPACK_DOWNLOAD_ALL")); - const char* archiveFile = this->GetOption((macroPrefix + + const char* archiveFile = this->GetOption((macroPrefix + "_ARCHIVE_FILE").c_str()); if (archiveFile && *archiveFile) { @@ -1580,7 +1578,7 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name) } const char* groupName = this->GetOption((macroPrefix + "_GROUP").c_str()); - if (groupName && *groupName) + if (groupName && *groupName) { component->Group = GetComponentGroup(projectName, groupName); component->Group->Components.push_back(component); @@ -1598,15 +1596,15 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name) } // Determine the installation types. - const char *installTypes + const char *installTypes = this->GetOption((macroPrefix + "_INSTALL_TYPES").c_str()); - if (installTypes && *installTypes) + if (installTypes && *installTypes) { std::vector installTypesVector; cmSystemTools::ExpandListArgument(installTypes, installTypesVector); std::vector::iterator installTypesIt; - for (installTypesIt = installTypesVector.begin(); - installTypesIt != installTypesVector.end(); + for (installTypesIt = installTypesVector.begin(); + installTypesIt != installTypesVector.end(); ++installTypesIt) { component->InstallationTypes.push_back( @@ -1616,16 +1614,16 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name) // Determine the component dependencies. const char *depends = this->GetOption((macroPrefix + "_DEPENDS").c_str()); - if (depends && *depends) + if (depends && *depends) { std::vector dependsVector; cmSystemTools::ExpandListArgument(depends, dependsVector); std::vector::iterator dependIt; - for (dependIt = dependsVector.begin(); - dependIt != dependsVector.end(); + for (dependIt = dependsVector.begin(); + dependIt != dependsVector.end(); ++dependIt) { - cmCPackComponent *child = GetComponent(projectName, + cmCPackComponent *child = GetComponent(projectName, dependIt->c_str()); component->Dependencies.push_back(child); child->ReverseDependencies.push_back(component); @@ -1640,15 +1638,15 @@ cmCPackComponentGroup* cmCPackGenerator::GetComponentGroup(const char *projectName, const char *name) { (void) projectName; - std::string macroPrefix = "CPACK_COMPONENT_GROUP_" + std::string macroPrefix = "CPACK_COMPONENT_GROUP_" + cmsys::SystemTools::UpperCase(name); bool hasGroup = this->ComponentGroups.count(name) != 0; cmCPackComponentGroup *group = &this->ComponentGroups[name]; - if (!hasGroup) + if (!hasGroup) { // Define the group group->Name = name; - const char* displayName + const char* displayName = this->GetOption((macroPrefix + "_DISPLAY_NAME").c_str()); if (displayName && *displayName) { @@ -1669,7 +1667,7 @@ cmCPackGenerator::GetComponentGroup(const char *projectName, const char *name) = this->IsSet((macroPrefix + "_BOLD_TITLE").c_str()); group->IsExpandedByDefault = this->IsSet((macroPrefix + "_EXPANDED").c_str()); - const char* parentGroupName + const char* parentGroupName = this->GetOption((macroPrefix + "_PARENT_GROUP").c_str()); if (parentGroupName && *parentGroupName) { diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 6748512d2..8fafef93d 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -113,7 +113,7 @@ public: //! Display verbose information via logger void DisplayVerboseOutput(const char* msg, float progress); - + bool ReadListFile(const char* moduleName); protected: diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index 37ff46041..b36c2a2f8 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -19,6 +19,7 @@ #include "cmCPackZIPGenerator.h" #include "cmCPackSTGZGenerator.h" #include "cmCPackNSISGenerator.h" + #ifdef __APPLE__ # include "cmCPackDragNDropGenerator.h" # include "cmCPackBundleGenerator.h" @@ -32,11 +33,14 @@ #endif #if !defined(_WIN32) \ - && !defined(__QNXNTO__) && !defined(__BEOS__) + && !defined(__QNXNTO__) && !defined(__BEOS__) && !defined(__HAIKU__) # include "cmCPackDebGenerator.h" # include "cmCPackRPMGenerator.h" #endif +#ifdef _WIN32 +# include "WiX/cmCPackWIXGenerator.h" +#endif #include "cmCPackLog.h" @@ -61,6 +65,8 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() { this->RegisterGenerator("NSIS", "Null Soft Installer", cmCPackNSISGenerator::CreateGenerator); + this->RegisterGenerator("NSIS64", "Null Soft Installer (64-bit)", + cmCPackNSISGenerator::CreateGenerator64); } #ifdef __CYGWIN__ if (cmCPackCygwinBinaryGenerator::CanGenerate()) @@ -80,6 +86,13 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() this->RegisterGenerator("ZIP", "ZIP file format", cmCPackZIPGenerator::CreateGenerator); } +#ifdef _WIN32 + if (cmCPackWIXGenerator::CanGenerate()) + { + this->RegisterGenerator("WIX", "MSI file format via WiX tools", + cmCPackWIXGenerator::CreateGenerator); + } +#endif if (cmCPackTarBZip2Generator::CanGenerate()) { this->RegisterGenerator("TBZ2", "Tar BZip2 compression", @@ -113,7 +126,7 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() } #endif #if !defined(_WIN32) \ - && !defined(__QNXNTO__) && !defined(__BEOS__) + && !defined(__QNXNTO__) && !defined(__BEOS__) && !defined(__HAIKU__) if (cmCPackDebGenerator::CanGenerate()) { this->RegisterGenerator("DEB", "Debian packages", diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 7b5251148..62bfa91d4 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -33,8 +33,9 @@ #endif //---------------------------------------------------------------------- -cmCPackNSISGenerator::cmCPackNSISGenerator() +cmCPackNSISGenerator::cmCPackNSISGenerator(bool nsis64) { + Nsis64 = nsis64; } //---------------------------------------------------------------------- @@ -102,7 +103,7 @@ int cmCPackNSISGenerator::PackageFiles() } if (!Components.empty()) { - // If this is a component installation, strip off the component + // If this is a component installation, strip off the component // part of the path. std::string::size_type slash = fileN.find('/'); if (slash != std::string::npos) @@ -124,12 +125,12 @@ int cmCPackNSISGenerator::PackageFiles() } cmCPackLogger(cmCPackLog::LOG_DEBUG, "Uninstall Dirs: " << dstr.str().c_str() << std::endl); - this->SetOptionIfNotSet("CPACK_NSIS_DELETE_DIRECTORIES", + this->SetOptionIfNotSet("CPACK_NSIS_DELETE_DIRECTORIES", dstr.str().c_str()); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " << nsisInFileName << " to " << nsisFileName << std::endl); - if(this->IsSet("CPACK_NSIS_MUI_ICON") + if(this->IsSet("CPACK_NSIS_MUI_ICON") || this->IsSet("CPACK_NSIS_MUI_UNIICON")) { std::string installerIconCode; @@ -174,7 +175,7 @@ int cmCPackNSISGenerator::PackageFiles() this->SetOptionIfNotSet("CPACK_NSIS_INSTALLATION_TYPES", ""); this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC", ""); this->SetOptionIfNotSet("CPACK_NSIS_PAGE_COMPONENTS", ""); - this->SetOptionIfNotSet("CPACK_NSIS_FULL_INSTALL", + this->SetOptionIfNotSet("CPACK_NSIS_FULL_INSTALL", "File /r \"${INST_DIR}\\*.*\""); this->SetOptionIfNotSet("CPACK_NSIS_COMPONENT_SECTIONS", ""); this->SetOptionIfNotSet("CPACK_NSIS_COMPONENT_SECTION_LIST", ""); @@ -194,7 +195,7 @@ int cmCPackNSISGenerator::PackageFiles() // Create installation types. The order is significant, so we first fill // in a vector based on the indices, and print them in that order. - std::vector + std::vector installTypes(this->InstallationTypes.size()); std::map::iterator installTypeIt; for (installTypeIt = this->InstallationTypes.begin(); @@ -221,15 +222,15 @@ int cmCPackNSISGenerator::PackageFiles() { if (groupIt->second.ParentGroup == 0) { - componentCode += + componentCode += this->CreateComponentGroupDescription(&groupIt->second, macrosOut); } // Add the group description, if any. if (!groupIt->second.Description.empty()) { - groupDescriptions += " !insertmacro MUI_DESCRIPTION_TEXT ${" - + groupIt->first + "} \"" + groupDescriptions += " !insertmacro MUI_DESCRIPTION_TEXT ${" + + groupIt->first + "} \"" + this->TranslateNewlines(groupIt->second.Description) + "\"\n"; } } @@ -251,7 +252,7 @@ int cmCPackNSISGenerator::PackageFiles() if (!compIt->second.Group) { - componentCode + componentCode += this->CreateComponentDescription(&compIt->second, macrosOut); } @@ -265,8 +266,8 @@ int cmCPackNSISGenerator::PackageFiles() // Add the component description, if any. if (!compIt->second.Description.empty()) { - componentDescriptions += " !insertmacro MUI_DESCRIPTION_TEXT ${" - + compIt->first + "} \"" + componentDescriptions += " !insertmacro MUI_DESCRIPTION_TEXT ${" + + compIt->first + "} \"" + this->TranslateNewlines(compIt->second.Description) + "\"\n"; } } @@ -276,17 +277,17 @@ int cmCPackNSISGenerator::PackageFiles() if (componentDescriptions.empty() && groupDescriptions.empty()) { // Turn off the "Description" box - this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC", + this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC", "!define MUI_COMPONENTSPAGE_NODESC"); } else { - componentDescriptions = + componentDescriptions = "!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN\n" + componentDescriptions + groupDescriptions + "!insertmacro MUI_FUNCTION_DESCRIPTION_END\n"; - this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC", + this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC", componentDescriptions.c_str()); } @@ -308,12 +309,12 @@ int cmCPackNSISGenerator::PackageFiles() componentCode.c_str()); this->SetOptionIfNotSet("CPACK_NSIS_COMPONENT_SECTION_LIST", sectionList.c_str()); - this->SetOptionIfNotSet("CPACK_NSIS_SECTION_SELECTED_VARS", + this->SetOptionIfNotSet("CPACK_NSIS_SECTION_SELECTED_VARS", selectedVarsList.c_str()); this->SetOption("CPACK_NSIS_DEFINES", defines.c_str()); } - this->ConfigureFile(nsisInInstallOptions.c_str(), + this->ConfigureFile(nsisInInstallOptions.c_str(), nsisInstallOptions.c_str()); this->ConfigureFile(nsisInFileName.c_str(), nsisFileName.c_str()); std::string nsisCmd = "\""; @@ -356,18 +357,45 @@ int cmCPackNSISGenerator::InitializeInternal() << std::endl); std::vector path; std::string nsisPath; - bool gotRegValue = true; + bool gotRegValue = false; #ifdef _WIN32 - if ( !cmsys::SystemTools::ReadRegistryValue( - "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath, - cmsys::SystemTools::KeyWOW64_32) ) + if (Nsis64) { - if ( !cmsys::SystemTools::ReadRegistryValue( - "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) ) + if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath, + cmsys::SystemTools::KeyWOW64_64) ) { - gotRegValue = false; + gotRegValue = true; } + if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath, + cmsys::SystemTools::KeyWOW64_64) ) + { + gotRegValue = true; + } + } + if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath, + cmsys::SystemTools::KeyWOW64_32) ) + { + gotRegValue = true; + } + if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath) ) + { + gotRegValue = true; + } + if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath, + cmsys::SystemTools::KeyWOW64_32) ) + { + gotRegValue = true; + } + if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) ) + { + gotRegValue = true; } if (gotRegValue) @@ -404,11 +432,14 @@ int cmCPackNSISGenerator::InitializeInternal() int retVal = 1; bool resS = cmSystemTools::RunSingleCommand(nsisCmd.c_str(), &output, &retVal, 0, this->GeneratorVerbose, 0); - cmsys::RegularExpression versionRex("v([0-9]+.[0-9]+)"); - if ( !resS || retVal || !versionRex.find(output)) + cmsys::RegularExpression versionRexCVS("v(.*)\\.cvs"); + if ( !resS || retVal || + (!versionRex.find(output) && !versionRexCVS.find(output)) + ) { - std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); + const char* topDir = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); + std::string tmpFile = topDir ? topDir : "."; tmpFile += "/NSISOutput.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); ofs << "# Run command: " << nsisCmd.c_str() << std::endl @@ -420,17 +451,26 @@ int cmCPackNSISGenerator::InitializeInternal() << "Please check " << tmpFile.c_str() << " for errors" << std::endl); return 0; } - double nsisVersion = atof(versionRex.match(1).c_str()); - double minNSISVersion = 2.09; - cmCPackLogger(cmCPackLog::LOG_DEBUG, "NSIS Version: " - << nsisVersion << std::endl); - if ( nsisVersion < minNSISVersion ) + if ( versionRex.find(output)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "CPack requires NSIS Version 2.09 or greater. NSIS found on the system " - "was: " + double nsisVersion = atof(versionRex.match(1).c_str()); + double minNSISVersion = 2.09; + cmCPackLogger(cmCPackLog::LOG_DEBUG, "NSIS Version: " << nsisVersion << std::endl); - return 0; + if ( nsisVersion < minNSISVersion ) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "CPack requires NSIS Version 2.09 or greater. " + "NSIS found on the system was: " + << nsisVersion << std::endl); + return 0; + } + } + if ( versionRexCVS.find(output)) + { + // No version check for NSIS cvs build + cmCPackLogger(cmCPackLog::LOG_DEBUG, "NSIS Version: CVS " + << versionRexCVS.match(1).c_str() << std::endl); } this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", nsisPath.c_str()); this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLES_DIRECTORY", "bin"); @@ -445,11 +485,11 @@ int cmCPackNSISGenerator::InitializeInternal() { cmCPackLogger(cmCPackLog::LOG_DEBUG, "CPACK_CREATE_DESKTOP_LINKS: " << cpackPackageDeskTopLinks << std::endl); - + cmSystemTools:: ExpandListArgument(cpackPackageDeskTopLinks, cpackPackageDesktopLinksVector); - for(std::vector::iterator i = + for(std::vector::iterator i = cpackPackageDesktopLinksVector.begin(); i != cpackPackageDesktopLinksVector.end(); ++i) { @@ -499,7 +539,7 @@ int cmCPackNSISGenerator::InitializeInternal() if(cpackPackageDesktopLinksVector.size() && std::find(cpackPackageDesktopLinksVector.begin(), cpackPackageDesktopLinksVector.end(), - execName) + execName) != cpackPackageDesktopLinksVector.end()) { str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n"; @@ -579,7 +619,7 @@ void cmCPackNSISGenerator::CreateMenuLinks( cmOStringStream& str, else { str << " WriteINIStr \"$SMPROGRAMS\\$STARTMENU_FOLDER\\" - << linkName << ".url\" \"InternetShortcut\" \"URL\" \"" + << linkName << ".url\" \"InternetShortcut\" \"URL\" \"" << sourceName << "\"" << std::endl; deleteStr << " Delete \"$SMPROGRAMS\\$MUI_TEMP\\" << linkName @@ -651,9 +691,9 @@ bool cmCPackNSISGenerator::SupportsComponentInstallation() const } //---------------------------------------------------------------------- -std::string +std::string cmCPackNSISGenerator:: -CreateComponentDescription(cmCPackComponent *component, +CreateComponentDescription(cmCPackComponent *component, cmOStringStream& macrosOut) { // Basic description of the component @@ -668,7 +708,7 @@ CreateComponentDescription(cmCPackComponent *component, componentCode += "-"; } componentCode += component->DisplayName + "\" " + component->Name + "\n"; - if (component->IsRequired) + if (component->IsRequired) { componentCode += " SectionIn RO\n"; } @@ -701,7 +741,7 @@ CreateComponentDescription(cmCPackComponent *component, } // Create the directory for the upload area - const char* userUploadDirectory = + const char* userUploadDirectory = this->GetOption("CPACK_UPLOAD_DIRECTORY"); std::string uploadDirectory; if (userUploadDirectory && *userUploadDirectory) @@ -727,7 +767,7 @@ CreateComponentDescription(cmCPackComponent *component, // Remove the old archive, if one exists std::string archiveFile = uploadDirectory + '/' + component->ArchiveFile; cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Building downloaded component archive: " + "- Building downloaded component archive: " << archiveFile << std::endl); if (cmSystemTools::FileExists(archiveFile.c_str(), true)) { @@ -760,18 +800,18 @@ CreateComponentDescription(cmCPackComponent *component, dirName += component->Name; dirName += '/'; - // Build the list of files to go into this archive, and determine the + // Build the list of files to go into this archive, and determine the // size of the installed component. std::string zipListFileName = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); zipListFileName += "/winZip.filelist"; - bool needQuotesInFile + bool needQuotesInFile = cmSystemTools::IsOn(this->GetOption("CPACK_ZIP_NEED_QUOTES")); unsigned long totalSize = 0; { // the scope is needed for cmGeneratedFileStream cmGeneratedFileStream out(zipListFileName.c_str()); std::vector::iterator fileIt; - for (fileIt = component->Files.begin(); - fileIt != component->Files.end(); + for (fileIt = component->Files.begin(); + fileIt != component->Files.end(); ++fileIt) { if ( needQuotesInFile ) @@ -792,11 +832,11 @@ CreateComponentDescription(cmCPackComponent *component, // Build the archive in the upload area std::string cmd = this->GetOption("CPACK_ZIP_COMMAND"); cmsys::SystemTools::ReplaceString(cmd, "", archiveFile.c_str()); - cmsys::SystemTools::ReplaceString(cmd, "", + cmsys::SystemTools::ReplaceString(cmd, "", zipListFileName.c_str()); std::string output; int retVal = -1; - int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &retVal, + int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &retVal, dirName.c_str(), cmSystemTools::OUTPUT_NONE, 0); if ( !res || retVal ) @@ -812,7 +852,7 @@ CreateComponentDescription(cmCPackComponent *component, << "Please check " << tmpFile.c_str() << " for errors" << std::endl); return ""; } - + // Create the NSIS code to download this file on-the-fly. unsigned long totalSizeInKbytes = (totalSize + 512) / 1024; if (totalSizeInKbytes == 0) @@ -823,7 +863,7 @@ CreateComponentDescription(cmCPackComponent *component, out << " AddSize " << totalSizeInKbytes << "\n" << " Push \"" << component->ArchiveFile << "\"\n" << " Call DownloadFile\n" - << " ZipDLL::extractall \"$INSTDIR\\" + << " ZipDLL::extractall \"$INSTDIR\\" << component->ArchiveFile << "\" \"$INSTDIR\"\n" << " Pop $2 ; error message\n" " StrCmp $2 \"success\" +2 0\n" @@ -889,7 +929,7 @@ std::string cmCPackNSISGenerator::CreateSelectionDependenciesDescription std::set& visited) { // Don't visit a component twice - if (visited.count(component)) + if (visited.count(component)) { return std::string(); } @@ -921,7 +961,7 @@ std::string cmCPackNSISGenerator::CreateDeselectionDependenciesDescription std::set& visited) { // Don't visit a component twice - if (visited.count(component)) + if (visited.count(component)) { return std::string(); } @@ -939,7 +979,7 @@ std::string cmCPackNSISGenerator::CreateDeselectionDependenciesDescription out << " IntOp $0 $0 & $1\n"; out << " SectionSetFlags ${" << (*dependIt)->Name << "} $0\n"; out << " IntOp $" << (*dependIt)->Name << "_selected 0 + 0\n"; - + // Recurse out << CreateDeselectionDependenciesDescription(*dependIt, visited).c_str(); @@ -949,9 +989,9 @@ std::string cmCPackNSISGenerator::CreateDeselectionDependenciesDescription } //---------------------------------------------------------------------- -std::string +std::string cmCPackNSISGenerator:: -CreateComponentGroupDescription(cmCPackComponentGroup *group, +CreateComponentGroupDescription(cmCPackComponentGroup *group, cmOStringStream& macrosOut) { if (group->Components.empty() && group->Subgroups.empty()) @@ -982,8 +1022,8 @@ CreateComponentGroupDescription(cmCPackComponentGroup *group, } std::vector::iterator comp; - for (comp = group->Components.begin(); - comp != group->Components.end(); + for (comp = group->Components.begin(); + comp != group->Components.end(); ++comp) { if ((*comp)->Files.empty()) diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index 82248546f..e46fbdab7 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -27,10 +27,13 @@ class cmCPackNSISGenerator : public cmCPackGenerator public: cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenerator); + static cmCPackGenerator* CreateGenerator64() + { return new cmCPackNSISGenerator(true); } + /** * Construct generator */ - cmCPackNSISGenerator(); + cmCPackNSISGenerator(bool nsis64 = false); virtual ~cmCPackNSISGenerator(); protected: @@ -77,6 +80,8 @@ protected: /// Translations any newlines found in the string into \\r\\n, so that the /// resulting string can be used within NSIS. static std::string TranslateNewlines(std::string str); + + bool Nsis64; }; #endif diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 363ccea0c..76e15fb84 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -64,7 +64,7 @@ int cmCPackOSXX11Generator::PackageFiles() { std::string cpackExecutableName = *it; ++ it; - this->SetOptionIfNotSet("CPACK_EXECUTABLE_NAME", + this->SetOptionIfNotSet("CPACK_EXECUTABLE_NAME", cpackExecutableName.c_str()); } } @@ -113,7 +113,7 @@ int cmCPackOSXX11Generator::PackageFiles() cmSystemTools::CreateSymlink("/Applications", applicationsLinkName.c_str()); if ( - !this->CopyResourcePlistFile("VolumeIcon.icns", + !this->CopyResourcePlistFile("VolumeIcon.icns", diskImageDirectory.c_str(), ".VolumeIcon.icns", true ) || !this->CopyResourcePlistFile("DS_Store", diskImageDirectory.c_str(), @@ -125,9 +125,9 @@ int cmCPackOSXX11Generator::PackageFiles() "Info.plist" ) || !this->CopyResourcePlistFile("OSXX11.main.scpt", scrDir, "main.scpt", true ) || - !this->CopyResourcePlistFile("OSXScriptLauncher.rsrc", dir, + !this->CopyResourcePlistFile("OSXScriptLauncher.rsrc", dir, rsrcFile, true) || - !this->CopyResourcePlistFile("OSXScriptLauncher", appdir, + !this->CopyResourcePlistFile("OSXScriptLauncher", appdir, this->GetOption("CPACK_PACKAGE_FILE_NAME"), true) ) { @@ -167,11 +167,11 @@ int cmCPackOSXX11Generator::PackageFiles() tmpFile += "/hdiutilOutput.log"; cmOStringStream dmgCmd; dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE") - << "\" create -ov -format UDZO -srcfolder \"" - << diskImageDirectory.c_str() + << "\" create -ov -format UDZO -srcfolder \"" + << diskImageDirectory.c_str() << "\" \"" << packageFileNames[0] << "\""; cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Compress disk image using command: " + "Compress disk image using command: " << dmgCmd.str().c_str() << std::endl); // since we get random dashboard failures with this one // try running it more than once @@ -181,7 +181,7 @@ int cmCPackOSXX11Generator::PackageFiles() while(numTries > 0) { res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output, - &retVal, 0, + &retVal, 0, this->GeneratorVerbose, 0); if ( res && !retVal ) { @@ -219,7 +219,7 @@ int cmCPackOSXX11Generator::InitializeInternal() << std::endl); return 0; } - this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM_DISK_IMAGE", + this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM_DISK_IMAGE", pkgPath.c_str()); return this->Superclass::InitializeInternal(); @@ -235,7 +235,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const char* name) if ( !inFileName ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: " << cpackVar.c_str() - << " not specified. It should point to " + << " not specified. It should point to " << (name ? name : "(NULL)") << ".rtf, " << name << ".html, or " << name << ".txt file" << std::endl); @@ -243,7 +243,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const char* name) } if ( !cmSystemTools::FileExists(inFileName) ) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find " + cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find " << (name ? name : "(NULL)") << " resource file: " << inFileName << std::endl); return false; @@ -262,7 +262,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const char* name) destFileName += name + ext; - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " << (inFileName ? inFileName : "(NULL)") << " to " << destFileName.c_str() << std::endl); this->ConfigureFile(inFileName, destFileName.c_str()); diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 3a0e89bbd..c617a3e32 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -52,7 +52,7 @@ int cmCPackPackageMakerGenerator::CopyInstallScript(const char* resdir, cmSystemTools::CopyFileAlways(script, dst.c_str()); cmSystemTools::SetPermissions(dst.c_str(),0777); cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "copy script : " << script << "\ninto " << dst.c_str() << + "copy script : " << script << "\ninto " << dst.c_str() << std::endl); return 1; @@ -79,7 +79,7 @@ int cmCPackPackageMakerGenerator::PackageFiles() if ( !cmsys::SystemTools::MakeDirectory(packageDirFileName.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "unable to create package directory " + "unable to create package directory " << packageDirFileName << std::endl); return 0; } @@ -89,7 +89,7 @@ int cmCPackPackageMakerGenerator::PackageFiles() if ( !cmsys::SystemTools::MakeDirectory(resDir.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "unable to create package subdirectory " << resDir + "unable to create package subdirectory " << resDir << std::endl); return 0; } @@ -98,7 +98,7 @@ int cmCPackPackageMakerGenerator::PackageFiles() if ( !cmsys::SystemTools::MakeDirectory(resDir.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "unable to create package subdirectory " << resDir + "unable to create package subdirectory " << resDir << std::endl); return 0; } @@ -106,56 +106,101 @@ int cmCPackPackageMakerGenerator::PackageFiles() resDir += "/en.lproj"; } - - // Create directory structure - std::string preflightDirName = resDir + "/PreFlight"; - std::string postflightDirName = resDir + "/PostFlight"; const char* preflight = this->GetOption("CPACK_PREFLIGHT_SCRIPT"); const char* postflight = this->GetOption("CPACK_POSTFLIGHT_SCRIPT"); const char* postupgrade = this->GetOption("CPACK_POSTUPGRADE_SCRIPT"); - // if preflight or postflight scripts not there create directories - // of the same name, I think this makes it work - if(!preflight) + + if(this->Components.empty()) { - if ( !cmsys::SystemTools::MakeDirectory(preflightDirName.c_str())) + // Create directory structure + std::string preflightDirName = resDir + "/PreFlight"; + std::string postflightDirName = resDir + "/PostFlight"; + // if preflight or postflight scripts not there create directories + // of the same name, I think this makes it work + if(!preflight) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating installer directory: " - << preflightDirName.c_str() << std::endl); - return 0; + if ( !cmsys::SystemTools::MakeDirectory(preflightDirName.c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating installer directory: " + << preflightDirName.c_str() << std::endl); + return 0; + } + } + if(!postflight) + { + if ( !cmsys::SystemTools::MakeDirectory(postflightDirName.c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating installer directory: " + << postflightDirName.c_str() << std::endl); + return 0; + } + } + // if preflight, postflight, or postupgrade are set + // then copy them into the resource directory and make + // them executable + if(preflight) + { + this->CopyInstallScript(resDir.c_str(), + preflight, + "preflight"); + } + if(postflight) + { + this->CopyInstallScript(resDir.c_str(), + postflight, + "postflight"); + } + if(postupgrade) + { + this->CopyInstallScript(resDir.c_str(), + postupgrade, + "postupgrade"); } } - if(!postflight) + else if(postflight) { - if ( !cmsys::SystemTools::MakeDirectory(postflightDirName.c_str())) + // create a postflight component to house the script + this->PostFlightComponent.Name = "PostFlight"; + this->PostFlightComponent.DisplayName = "PostFlight"; + this->PostFlightComponent.Description = "PostFlight"; + this->PostFlightComponent.IsHidden = true; + + // empty directory for pkg contents + std::string packageDir = toplevel + "/" + PostFlightComponent.Name; + if (!cmsys::SystemTools::MakeDirectory(packageDir.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating installer directory: " - << postflightDirName.c_str() << std::endl); + "Problem creating component packages directory: " + << packageDir.c_str() << std::endl); return 0; } - } - // if preflight, postflight, or postupgrade are set - // then copy them into the resource directory and make - // them executable - if(preflight) - { - this->CopyInstallScript(resDir.c_str(), - preflight, - "preflight"); - } - if(postflight) - { - this->CopyInstallScript(resDir.c_str(), + + // create package + std::string packageFileDir = packageDirFileName + "/Contents/Packages/"; + if (!cmsys::SystemTools::MakeDirectory(packageFileDir.c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating component PostFlight Packages directory: " + << packageFileDir.c_str() << std::endl); + return 0; + } + std::string packageFile = packageFileDir + + this->GetPackageName(PostFlightComponent); + if (!this->GenerateComponentPackage(packageFile.c_str(), + packageDir.c_str(), + PostFlightComponent)) + { + return 0; + } + + // copy postflight script into resource directory of .pkg + std::string resourceDir = packageFile + "/Contents/Resources"; + this->CopyInstallScript(resourceDir.c_str(), postflight, "postflight"); } - if(postupgrade) - { - this->CopyInstallScript(resDir.c_str(), - postupgrade, - "postupgrade"); - } if (!this->Components.empty()) { @@ -206,7 +251,7 @@ int cmCPackPackageMakerGenerator::PackageFiles() if (!cmSystemTools::MakeDirectory(uploadDirectory.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Unable to create package upload directory " + "Unable to create package upload directory " << uploadDirectory << std::endl); return 0; } @@ -254,7 +299,7 @@ int cmCPackPackageMakerGenerator::PackageFiles() std::string packageDir = toplevel; packageDir += '/'; packageDir += compIt->first; - if (!this->GenerateComponentPackage(packageFile.c_str(), + if (!this->GenerateComponentPackage(packageFile.c_str(), packageDir.c_str(), compIt->second)) { @@ -293,7 +338,7 @@ int cmCPackPackageMakerGenerator::PackageFiles() } pkgCmd << "\" -r \"" << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "/Resources\" -i \"" - << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") + << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "/Info.plist\" -d \"" << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "/Description.plist\""; @@ -324,7 +369,7 @@ int cmCPackPackageMakerGenerator::PackageFiles() while(numTries > 0) { res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output, - &retVal, 0, this->GeneratorVerbose, + &retVal, 0, this->GeneratorVerbose, 0); if ( res && !retVal ) { @@ -474,7 +519,7 @@ int cmCPackPackageMakerGenerator::InitializeInternal() const char *packageCompat = this->GetOption("CPACK_OSX_PACKAGE_VERSION"); if (packageCompat && *packageCompat) { - this->PackageCompatibilityVersion = atof(packageCompat); + this->PackageCompatibilityVersion = atof(packageCompat); } else if (this->GetOption("CPACK_DOWNLOAD_SITE")) { @@ -500,7 +545,7 @@ int cmCPackPackageMakerGenerator::InitializeInternal() << std::endl); return 0; } - this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM_DISK_IMAGE", + this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM_DISK_IMAGE", pkgPath.c_str()); return this->Superclass::InitializeInternal(); @@ -516,7 +561,7 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name, if ( !inFileName ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: " << cpackVar.c_str() - << " not specified. It should point to " + << " not specified. It should point to " << (name ? name : "(NULL)") << ".rtf, " << name << ".html, or " << name << ".txt file" << std::endl); @@ -524,7 +569,7 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name, } if ( !cmSystemTools::FileExists(inFileName) ) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find " + cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find " << (name ? name : "(NULL)") << " resource file: " << inFileName << std::endl); return false; @@ -547,7 +592,7 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name, this->SetOption(("CPACK_RESOURCE_FILE_" + uname + "_NOPATH").c_str(), (name + ext).c_str()); - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " << (inFileName ? inFileName : "(NULL)") << " to " << destFileName.c_str() << std::endl); this->ConfigureFile(inFileName, destFileName.c_str()); @@ -593,7 +638,7 @@ bool cmCPackPackageMakerGenerator::RunPackageMaker(const char *command, cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << command << std::endl); std::string output; int retVal = 1; - bool res = cmSystemTools::RunSingleCommand(command, &output, &retVal, 0, + bool res = cmSystemTools::RunSingleCommand(command, &output, &retVal, 0, this->GeneratorVerbose, 0); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running package maker" << std::endl); @@ -612,7 +657,7 @@ bool cmCPackPackageMakerGenerator::RunPackageMaker(const char *command, // sometimes the command finishes but the directory is not yet // created, so try 10 times to see if it shows up int tries = 10; - while(tries > 0 && + while(tries > 0 && !cmSystemTools::FileExists(packageFile)) { cmSystemTools::Delay(500); @@ -632,7 +677,7 @@ bool cmCPackPackageMakerGenerator::RunPackageMaker(const char *command, } //---------------------------------------------------------------------- -std::string +std::string cmCPackPackageMakerGenerator::GetPackageName(const cmCPackComponent& component) { if (component.ArchiveFile.empty()) @@ -664,7 +709,7 @@ GenerateComponentPackage(const char *packageFile, // The command that will be used to run PackageMaker cmOStringStream pkgCmd; - if (this->PackageCompatibilityVersion < 10.5 || + if (this->PackageCompatibilityVersion < 10.5 || this->PackageMakerVersion < 3.0) { // Create Description.plist and Info.plist files for normal Mac OS @@ -680,10 +725,10 @@ GenerateComponentPackage(const char *packageFile, << " IFPkgDescriptionTitle" << std::endl << " " << component.DisplayName << "" << std::endl << " IFPkgDescriptionVersion" << std::endl - << " " << this->GetOption("CPACK_PACKAGE_VERSION") + << " " << this->GetOption("CPACK_PACKAGE_VERSION") << "" << std::endl << " IFPkgDescriptionDescription" << std::endl - << " " + this->EscapeForXML(component.Description) + << " " + this->EscapeForXML(component.Description) << "" << std::endl << "" << std::endl << "" << std::endl; @@ -692,7 +737,7 @@ GenerateComponentPackage(const char *packageFile, // Create the Info.plist file for this component std::string moduleVersionSuffix = "."; moduleVersionSuffix += component.Name; - this->SetOption("CPACK_MODULE_VERSION_SUFFIX", + this->SetOption("CPACK_MODULE_VERSION_SUFFIX", moduleVersionSuffix.c_str()); std::string infoFileName = component.Name; infoFileName += "-Info.plist"; @@ -704,9 +749,9 @@ GenerateComponentPackage(const char *packageFile, pkgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM") << "\" -build -p \"" << packageFile << "\"" << " -f \"" << packageDir << "\"" - << " -i \"" << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") + << " -i \"" << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "/" << infoFileName << "\"" - << " -d \"" << descriptionFile << "\""; + << " -d \"" << descriptionFile << "\""; } else { @@ -729,16 +774,16 @@ GenerateComponentPackage(const char *packageFile, << " --out \"" << packageFile << "\""; } - // Run PackageMaker + // Run PackageMaker return RunPackageMaker(pkgCmd.str().c_str(), packageFile); } //---------------------------------------------------------------------- -void +void cmCPackPackageMakerGenerator:: WriteDistributionFile(const char* metapackageFile) { - std::string distributionTemplate + std::string distributionTemplate = this->FindTemplate("CPack.distribution.dist.in"); if ( distributionTemplate.empty() ) { @@ -757,8 +802,8 @@ WriteDistributionFile(const char* metapackageFile) // Emit the outline for the groups std::map::iterator groupIt; - for (groupIt = this->ComponentGroups.begin(); - groupIt != this->ComponentGroups.end(); + for (groupIt = this->ComponentGroups.begin(); + groupIt != this->ComponentGroups.end(); ++groupIt) { if (groupIt->second.ParentGroup == 0) @@ -778,11 +823,16 @@ WriteDistributionFile(const char* metapackageFile) << std::endl; } } + if(!this->PostFlightComponent.Name.empty()) + { + choiceOut << "" << std::endl; + } choiceOut << "" << std::endl; // Create the actual choices - for (groupIt = this->ComponentGroups.begin(); - groupIt != this->ComponentGroups.end(); + for (groupIt = this->ComponentGroups.begin(); + groupIt != this->ComponentGroups.end(); ++groupIt) { CreateChoice(groupIt->second, choiceOut); @@ -792,11 +842,17 @@ WriteDistributionFile(const char* metapackageFile) { CreateChoice(compIt->second, choiceOut); } + + if(!this->PostFlightComponent.Name.empty()) + { + CreateChoice(PostFlightComponent, choiceOut); + } + this->SetOption("CPACK_PACKAGEMAKER_CHOICES", choiceOut.str().c_str()); // Create the distribution.dist file in the metapackage to turn it // into a distribution package. - this->ConfigureFile(distributionTemplate.c_str(), + this->ConfigureFile(distributionTemplate.c_str(), distributionFile.c_str()); } @@ -824,13 +880,13 @@ CreateChoiceOutline(const cmCPackComponentGroup& group, cmOStringStream& out) } //---------------------------------------------------------------------- -void +void cmCPackPackageMakerGenerator::CreateChoice(const cmCPackComponentGroup& group, cmOStringStream& out) { - out << "GetOption("CPACK_PACKAGE_VENDOR"); - packageId += '.'; + packageId += '.'; packageId += this->GetOption("CPACK_PACKAGE_NAME"); packageId += '.'; packageId += component.Name; - out << "GetOption("CPACK_TEMPORARY_DIRECTORY"); dirName += '/'; dirName += component.Name; - unsigned long installedSize + unsigned long installedSize = component.GetInstalledSizeInKbytes(dirName.c_str()); out << ""; if (component.IsDownloaded) { - out << this->GetOption("CPACK_DOWNLOAD_SITE") + out << this->GetOption("CPACK_DOWNLOAD_SITE") << this->GetPackageName(component); } else @@ -925,9 +981,9 @@ cmCPackPackageMakerGenerator::CreateChoice(const cmCPackComponent& component, } //---------------------------------------------------------------------- -void +void cmCPackPackageMakerGenerator:: -AddDependencyAttributes(const cmCPackComponent& component, +AddDependencyAttributes(const cmCPackComponent& component, std::set& visited, cmOStringStream& out) { @@ -942,16 +998,16 @@ AddDependencyAttributes(const cmCPackComponent& component, dependIt != component.Dependencies.end(); ++dependIt) { - out << " && choices['" << + out << " && choices['" << (*dependIt)->Name << "Choice'].selected"; AddDependencyAttributes(**dependIt, visited, out); } } //---------------------------------------------------------------------- -void +void cmCPackPackageMakerGenerator:: -AddReverseDependencyAttributes(const cmCPackComponent& component, +AddReverseDependencyAttributes(const cmCPackComponent& component, std::set& visited, cmOStringStream& out) { diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h index 2bab94791..ba3d968f6 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.h +++ b/Source/CPack/cmCPackPackageMakerGenerator.h @@ -67,8 +67,8 @@ protected: // Generate a package in the file packageFile for the given // component. All of the files within this component are stored in // the directory packageDir. Returns true if successful, false - // otherwise. - bool GenerateComponentPackage(const char *packageFile, + // otherwise. + bool GenerateComponentPackage(const char *packageFile, const char *packageDir, const cmCPackComponent& component); @@ -87,14 +87,14 @@ protected: // Subroutine of WriteDistributionFile that writes out the // reverse dependency attributes for inter-component dependencies. - void + void AddReverseDependencyAttributes(const cmCPackComponent& component, std::set& visited, cmOStringStream& out); // Generates XML that encodes the hierarchy of component groups and // their components in a form that can be used by distribution - // metapackages. + // metapackages. void CreateChoiceOutline(const cmCPackComponentGroup& group, cmOStringStream& out); @@ -111,7 +111,10 @@ protected: // Escape the given string to make it usable as an XML attribute // value. std::string EscapeForXML(std::string str); - + + // The PostFlight component when creating a metapackage + cmCPackComponent PostFlightComponent; + double PackageMakerVersion; double PackageCompatibilityVersion; }; diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 413572ee7..66a419405 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -77,6 +77,11 @@ int cmCPackRPMGenerator::PackageOnePack(std::string initialToplevel, packageFileName.c_str()); // Tell CPackRPM.cmake the name of the component NAME. this->SetOption("CPACK_RPM_PACKAGE_COMPONENT",packageName.c_str()); + // Tell CPackRPM.cmake the path where the component is. + std::string component_path = "/"; + component_path += packageName; + this->SetOption("CPACK_RPM_PACKAGE_COMPONENT_PART_PATH", + component_path.c_str()); if (!this->ReadListFile("CPackRPM.cmake")) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -178,8 +183,11 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne() /* replace the TEMPORARY package file name */ this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME", packageFileName.c_str()); - // Tell CPackRPM.cmake the name of the component GROUP. - this->SetOption("CPACK_RPM_PACKAGE_COMPONENT",compInstDirName.c_str()); + // Tell CPackRPM.cmake the path where the component is. + std::string component_path = "/"; + component_path += compInstDirName; + this->SetOption("CPACK_RPM_PACKAGE_COMPONENT_PART_PATH", + component_path.c_str()); if (!this->ReadListFile("CPackRPM.cmake")) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -230,7 +238,7 @@ int cmCPackRPMGenerator::PackageFiles() } } - if (!this->IsSet("RPMBUILD_EXECUTABLE")) + if (!this->IsSet("RPMBUILD_EXECUTABLE")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find rpmbuild" << std::endl); retval = 0; diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index 966a231b7..9b6cf14df 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -97,7 +97,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os) { licenseText += line + "\n"; } - this->SetOptionIfNotSet("CPACK_RESOURCE_FILE_LICENSE_CONTENT", + this->SetOptionIfNotSet("CPACK_RESOURCE_FILE_LICENSE_CONTENT", licenseText.c_str()); const char headerLengthTag[] = "###CPACK_HEADER_LENGTH###"; @@ -126,7 +126,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os) ++ptr; } counter ++; - cmCPackLogger(cmCPackLog::LOG_DEBUG, + cmCPackLogger(cmCPackLog::LOG_DEBUG, "Number of lines: " << counter << std::endl); char buffer[1024]; sprintf(buffer, "%d", counter); diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx index 971d16667..ae73c3795 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.cxx +++ b/Source/CPack/cmCPackTarBZip2Generator.cxx @@ -12,7 +12,7 @@ #include "cmCPackTarBZip2Generator.h" //---------------------------------------------------------------------- -cmCPackTarBZip2Generator::cmCPackTarBZip2Generator() +cmCPackTarBZip2Generator::cmCPackTarBZip2Generator() :cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2, cmArchiveWrite::TypeTAR) { diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx index 7a8f697c0..df294084c 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.cxx +++ b/Source/CPack/cmCPackTarCompressGenerator.cxx @@ -13,7 +13,7 @@ #include "cmCPackTarCompressGenerator.h" //---------------------------------------------------------------------- -cmCPackTarCompressGenerator::cmCPackTarCompressGenerator() +cmCPackTarCompressGenerator::cmCPackTarCompressGenerator() :cmCPackArchiveGenerator(cmArchiveWrite::CompressCompress, cmArchiveWrite::TypeTAR) { diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index b6035854e..b18891858 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -27,7 +27,6 @@ #include #include -#include // auto_ptr //---------------------------------------------------------------------------- static const char * cmDocumentationName[][3] = @@ -181,7 +180,6 @@ int main (int argc, char *argv[]) { cmSystemTools::FindExecutableDirectory(argv[0]); cmCPackLog log; - int nocwd = 0; log.SetErrorPrefix("CPack Error: "); log.SetWarningPrefix("CPack Warning: "); @@ -194,7 +192,7 @@ int main (int argc, char *argv[]) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Current working directory cannot be established." << std::endl); - nocwd = 1; + return 1; } std::string generator; @@ -276,7 +274,7 @@ int main (int argc, char *argv[]) cminst.RemoveUnscriptableCommands(); cmGlobalGenerator cmgg; cmgg.SetCMakeInstance(&cminst); - std::auto_ptr cmlg(cmgg.CreateLocalGenerator()); + cmsys::auto_ptr cmlg(cmgg.CreateLocalGenerator()); cmMakefile* globalMF = cmlg->GetMakefile(); bool cpackConfigFileSpecified = true; @@ -298,7 +296,7 @@ int main (int argc, char *argv[]) * should launch cpack using "cpackConfigFile" if it exists * in the current directory. */ - if((doc.CheckOptions(argc, argv,"-G") || nocwd) && !(argc==1)) + if((doc.CheckOptions(argc, argv,"-G")) && !(argc==1)) { help = true; } diff --git a/Source/CPack/cygwin.readme b/Source/CPack/cygwin.readme index 88922d3e6..c0cd4b913 100644 --- a/Source/CPack/cygwin.readme +++ b/Source/CPack/cygwin.readme @@ -16,11 +16,11 @@ Source- - write diff into toplevel - create tar file call super class -cmake-2.2.3-1 +cmake-2.2.3-1 + - 1. a source release -cmake-2.2.3-2-src.tar.bz2 +cmake-2.2.3-2-src.tar.bz2 cmake-2.2.3-2.patch has cmake-2.2.3/CYGWIN-PATCHES/cmake.README cmake-2.2.3/CYGWIN-PATCHES/setup.hint cmake-2.2.3-2.sh -> script to create cygwin release diff --git a/Source/CTest/cmCTestBatchTestHandler.cxx b/Source/CTest/cmCTestBatchTestHandler.cxx index 00bb6fa70..a22c7be41 100644 --- a/Source/CTest/cmCTestBatchTestHandler.cxx +++ b/Source/CTest/cmCTestBatchTestHandler.cxx @@ -56,7 +56,7 @@ void cmCTestBatchTestHandler::WriteSrunArgs(int test, std::fstream& fout) fout << "srun "; //fout << "--jobid=" << test << " "; fout << "-J=" << properties->Name << " "; - + //Write dependency information /*if(this->Tests[test].size() > 0) { diff --git a/Source/CTest/cmCTestBatchTestHandler.h b/Source/CTest/cmCTestBatchTestHandler.h index fdfd1be29..ab0d081ae 100644 --- a/Source/CTest/cmCTestBatchTestHandler.h +++ b/Source/CTest/cmCTestBatchTestHandler.h @@ -21,7 +21,7 @@ /** \class cmCTestBatchTestHandler * \brief run parallel ctest * - * cmCTestBatchTestHandler + * cmCTestBatchTestHandler */ class cmCTestBatchTestHandler : public cmCTestMultiProcessHandler { diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 8a2d65a7b..4fa3c53b9 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -67,7 +67,13 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, generator += this->BuildGenerator; args.push_back(generator); } - + if(this->BuildGeneratorToolset.size()) + { + std::string toolset = "-T"; + toolset += this->BuildGeneratorToolset; + args.push_back(toolset); + } + const char* config = 0; if ( this->CTest->GetConfigType().size() > 0 ) { @@ -79,7 +85,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, config = CMAKE_INTDIR; } #endif - + if ( config ) { std::string btype @@ -198,8 +204,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) std::string resultingConfig; std::vector extraPaths; std::vector failed; - fullPath = - cmCTestTestHandler::FindExecutable(this->CTest, + fullPath = + cmCTestTestHandler::FindExecutable(this->CTest, this->ConfigSample.c_str(), resultingConfig, extraPaths, @@ -211,7 +217,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) out << "Using config sample with results: " << fullPath << " and " << resultingConfig << std::endl; } - + // we need to honor the timeout specified, the timeout include cmake, build // and test time double clock_start = cmSystemTools::GetTime(); @@ -228,11 +234,15 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) // should we cmake? cmake cm; - cm.SetProgressCallback(CMakeProgressCallback, &cmakeOutString); - cm.SetGlobalGenerator(cm.CreateGlobalGenerator( - this->BuildGenerator.c_str())); + cm.SetProgressCallback(CMakeProgressCallback, &cmakeOutString); - if(!this->BuildNoCMake) + if(this->BuildNoCMake) + { + cm.SetGlobalGenerator(cm.CreateGlobalGenerator( + this->BuildGenerator.c_str())); + cm.SetGeneratorToolset(this->BuildGeneratorToolset); + } + else { // do the cmake step, no timeout here since it is not a sub process if (this->RunCMake(outstring,out,cmakeOutString,cwd,&cm)) @@ -247,7 +257,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) { this->BuildTargets.push_back(""); } - for ( tarIt = this->BuildTargets.begin(); + for ( tarIt = this->BuildTargets.begin(); tarIt != this->BuildTargets.end(); ++ tarIt ) { double remainingTime = 0; @@ -284,7 +294,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) this->BuildProject.c_str(), tarIt->c_str(), &output, this->BuildMakeProgram.c_str(), config, - !this->BuildNoClean, + !this->BuildNoClean, false, remainingTime); out << output; // if the build failed then return @@ -322,13 +332,13 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) extraPaths.push_back(tempPath); } std::vector failed; - fullPath = - cmCTestTestHandler::FindExecutable(this->CTest, + fullPath = + cmCTestTestHandler::FindExecutable(this->CTest, this->TestCommand.c_str(), resultingConfig, extraPaths, failed); - + if(!cmSystemTools::FileExists(fullPath.c_str())) { out << "Could not find path to executable, perhaps it was not built: " @@ -388,8 +398,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) return 1; } } - - int runTestRes = this->CTest->RunTest(testCommand, &outs, &retval, 0, + + int runTestRes = this->CTest->RunTest(testCommand, &outs, &retval, 0, remainingTime, 0); if(runTestRes != cmsysProcess_State_Exited || retval != 0) @@ -466,11 +476,17 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments( idx++; this->Timeout = atof(allArgs[idx].c_str()); } - if(currentArg.find("--build-generator",0) == 0 && idx < allArgs.size() - 1) + if(currentArg == "--build-generator" && idx < allArgs.size() - 1) { idx++; this->BuildGenerator = allArgs[idx]; } + if(currentArg == "--build-generator-toolset" && + idx < allArgs.size() - 1) + { + idx++; + this->BuildGeneratorToolset = allArgs[idx]; + } if(currentArg.find("--build-project",0) == 0 && idx < allArgs.size() - 1) { idx++; diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h index 6e5f7a6ab..ca50c6452 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.h +++ b/Source/CTest/cmCTestBuildAndTestHandler.h @@ -42,7 +42,7 @@ public: * Get the output variable */ const char* GetOutput(); - + cmCTestBuildAndTestHandler(); virtual void Initialize(); @@ -50,13 +50,14 @@ public: protected: ///! Run CMake and build a test and then run it as a single test. int RunCMakeAndTest(std::string* output); - int RunCMake(std::string* outstring, cmOStringStream &out, + int RunCMake(std::string* outstring, cmOStringStream &out, std::string &cmakeOutString, std::string &cwd, cmake *cm); - + cmStdString Output; std::string BuildGenerator; + std::string BuildGeneratorToolset; std::vector BuildOptions; bool BuildTwoConfig; std::string BuildMakeProgram; diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index b984e850f..f4d38cef1 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -175,7 +175,7 @@ bool cmCTestBuildCommand::InitialPass(std::vector const& args, { bool ret = cmCTestHandlerCommand::InitialPass(args, status); if ( this->Values[ctb_NUMBER_ERRORS] && *this->Values[ctb_NUMBER_ERRORS]) - { + { cmOStringStream str; str << this->Handler->GetTotalErrors(); this->Makefile->AddDefinition( diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 27bb06c13..39eeb70a3 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -168,7 +168,7 @@ static cmCTestBuildCompileErrorWarningRex cmCTestWarningErrorFileLine[] = { { "^Warning W[0-9]+ ([a-zA-Z.\\:/0-9_+ ~-]+) ([0-9]+):", 1, 2 }, { "^([a-zA-Z./0-9_+ ~-]+):([0-9]+):", 1, 2 }, - { "^([a-zA-Z.\\:/0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 }, + { "^([a-zA-Z.\\:/0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 }, { "^[0-9]+>([a-zA-Z.\\:/0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 }, { "^([a-zA-Z./0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 }, { "\"([a-zA-Z./0-9_+ ~-]+)\", line ([0-9]+)", 1, 2 }, @@ -289,7 +289,7 @@ std::string cmCTestBuildHandler::GetMakeCommand() std::string makeCommand = this->CTest->GetCTestConfiguration("MakeCommand"); cmCTestLog(this->CTest, - HANDLER_VERBOSE_OUTPUT, "MakeCommand:" << makeCommand << + HANDLER_VERBOSE_OUTPUT, "MakeCommand:" << makeCommand << "\n"); std::string configType = this->CTest->GetConfigType(); @@ -392,7 +392,7 @@ int cmCTestBuildHandler::ProcessHandler() { this->CustomWarningMatches.push_back(cmCTestWarningMatches[cc]); } - + for ( cc = 0; cmCTestWarningExceptions[cc]; cc ++ ) { this->CustomWarningExceptions.push_back(cmCTestWarningExceptions[cc]); @@ -557,7 +557,7 @@ void cmCTestBuildHandler::GenerateXMLHeader(std::ostream& os) this->CTest->StartXML(os, this->AppendXML); os << "\n" << "\t" << this->StartBuild << "\n" - << "\t" << + << "\t" << static_cast(this->StartBuildTime) << "\n" << "" @@ -998,7 +998,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, // dashboard. cmCTestBuildErrorWarning errorwarning; errorwarning.LogLine = 1; - errorwarning.Text + errorwarning.Text = "*** WARNING non-zero return value in ctest from: "; errorwarning.Text += argv[0]; errorwarning.PreContext = ""; @@ -1150,7 +1150,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, { // This is not an error or warning. // So, figure out if this is a post-context line - if ( this->ErrorsAndWarnings.size() && + if ( this->ErrorsAndWarnings.size() && this->LastErrorOrWarning != this->ErrorsAndWarnings.end() && this->PostContextCount < this->MaxPostContext ) { diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 7a99ddfa0..d6d39a98f 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -144,6 +144,15 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() cmakeConfigureCommand += cmakeGeneratorName; cmakeConfigureCommand += "\""; + const char* cmakeGeneratorToolset = + this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR_TOOLSET"); + if(cmakeGeneratorToolset && *cmakeGeneratorToolset) + { + cmakeConfigureCommand += " \"-T"; + cmakeConfigureCommand += cmakeGeneratorToolset; + cmakeConfigureCommand += "\""; + } + cmakeConfigureCommand += " \""; cmakeConfigureCommand += source_dir; cmakeConfigureCommand += "\""; diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx index 33297564e..7c4129864 100644 --- a/Source/CTest/cmCTestConfigureHandler.cxx +++ b/Source/CTest/cmCTestConfigureHandler.cxx @@ -106,7 +106,7 @@ int cmCTestConfigureHandler::ProcessHandler() std::string end_time = this->CTest->CurrentTime(); os << "\t" << retVal << "\n" << "\t" << end_time << "\n" - << "\t" << + << "\t" << static_cast(cmSystemTools::GetTime()) << "\n" << "" diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 81d366937..20aded2b5 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -80,15 +80,15 @@ public: { args.push_back(i->c_str()); } - args.push_back(0); // null terminate + args.push_back(0); // null terminate cmsysProcess_SetCommand(this->Process, &*args.begin()); if(this->WorkingDirectory.size()) { cmsysProcess_SetWorkingDirectory(this->Process, this->WorkingDirectory.c_str()); } - - cmsysProcess_SetOption(this->Process, + + cmsysProcess_SetOption(this->Process, cmsysProcess_Option_HideWindow, 1); if(this->TimeOut != -1) { @@ -112,7 +112,7 @@ public: { cmsysProcess_SetPipeFile(this->Process, cmsysProcess_Pipe_STDERR, fname); } - int WaitForExit(double* timeout =0) + int WaitForExit(double* timeout =0) { this->PipeState = cmsysProcess_WaitForExit(this->Process, timeout); @@ -183,7 +183,7 @@ bool cmCTestCoverageHandler::StartCoverageLogFile( this->CTest->StartXML(covLogFile, this->AppendXML); covLogFile << "" << std::endl << "\t" << local_start_time << "" - << "\t" + << "\t" << static_cast(cmSystemTools::GetTime()) << "" << std::endl; @@ -196,7 +196,7 @@ void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr, { std::string local_end_time = this->CTest->CurrentTime(); ostr << "\t" << local_end_time << "" << std::endl - << "\t" << + << "\t" << static_cast(cmSystemTools::GetTime()) << "" << std::endl << "" << std::endl; @@ -325,7 +325,7 @@ int cmCTestCoverageHandler::ProcessHandler() { return error; } - + std::string coverage_start_time = this->CTest->CurrentTime(); unsigned int coverage_start_time_time = static_cast( cmSystemTools::GetTime()); @@ -659,7 +659,7 @@ int cmCTestCoverageHandler::ProcessHandler() covSumFile.precision(2); covSumFile << (percent_coverage)<< "\n" << "\t" << end_time << "\n" - << "\t" << + << "\t" << static_cast(cmSystemTools::GetTime()) << "\n"; covSumFile << "" << @@ -871,7 +871,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find any GCov coverage files." << std::endl); - // No coverage files is a valid thing, so the exit code is 0 + // No coverage files is a valid thing, so the exit code is 0 return 0; } @@ -1097,10 +1097,17 @@ int cmCTestCoverageHandler::HandleGCovCoverage( } else { - cmCTestLog(this->CTest, ERROR_MESSAGE, - "Unknown gcov output line: [" << line->c_str() << "]" << std::endl); - cont->Error ++; - //abort(); + // gcov 4.7 can have output lines saying "No executable lines" and + // "Removing 'filename.gcov'"... Don't log those as "errors." + if(*line != "No executable lines" && + !cmSystemTools::StringStartsWith(line->c_str(), "Removing ")) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Unknown gcov output line: [" << line->c_str() << "]" + << std::endl); + cont->Error ++; + //abort(); + } } @@ -1294,7 +1301,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find any Python Trace.py coverage files." << std::endl); - // No coverage files is a valid thing, so the exit code is 0 + // No coverage files is a valid thing, so the exit code is 0 return 0; } @@ -1436,7 +1443,7 @@ std::string cmCTestCoverageHandler::FindFile( // This is a header put on each marked up source file namespace { - const char* bullseyeHelp[] = + const char* bullseyeHelp[] = {" Coverage produced by bullseye covbr tool: ", " www.bullseye.com/help/ref_covbr.html", " * An arrow --> indicates incomplete coverage.", @@ -1451,7 +1458,7 @@ namespace " * The slash / means this probe is excluded from summary results. ", 0}; } - + //---------------------------------------------------------------------- int cmCTestCoverageHandler::RunBullseyeCoverageBranch( cmCTestCoverageHandlerContainer* cont, @@ -1461,7 +1468,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( { if(files.size() != filesFullPath.size()) { - cmCTestLog(this->CTest, ERROR_MESSAGE, + cmCTestLog(this->CTest, ERROR_MESSAGE, "Files and full path files not the same size?:\n"); return 0; } @@ -1498,13 +1505,13 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( } std::map fileMap; std::vector::iterator fp = filesFullPath.begin(); - for(std::vector::iterator f = files.begin(); + for(std::vector::iterator f = files.begin(); f != files.end(); ++f, ++fp) { fileMap[*f] = *fp; } - int count =0; // keep count of the number of files + int count =0; // keep count of the number of files // Now parse each line from the bullseye cov log file std::string lineIn; bool valid = false; // are we in a valid output file @@ -1542,9 +1549,9 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( { return -1; } - count++; // move on one + count++; // move on one } - std::map::iterator + std::map::iterator i = fileMap.find(file); // if the file should be covered write out the header for that file if(i != fileMap.end()) @@ -1659,10 +1666,10 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( cmCTestLog(this->CTest, ERROR_MESSAGE, "error running covsrc:\n"); return 0; } - + std::ostream& tmpLog = *cont->OFS; // copen the Coverage.xml file in the Testing directory - cmGeneratedFileStream covSumFile; + cmGeneratedFileStream covSumFile; if(!this->StartResultingXML(cmCTest::PartCoverage, "Coverage", covSumFile)) { cmCTestLog(this->CTest, ERROR_MESSAGE, @@ -1673,10 +1680,10 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( double elapsed_time_start = cmSystemTools::GetTime(); std::string coverage_start_time = this->CTest->CurrentTime(); covSumFile << "" << std::endl - << "\t" + << "\t" << coverage_start_time << "" << std::endl - << "\t" + << "\t" << static_cast(cmSystemTools::GetTime()) << "" << std::endl; @@ -1717,7 +1724,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( { // parse the comma separated output this->ParseBullsEyeCovsrcLine(stdline, - sourceFile, + sourceFile, functionsCalled, totalFunctions, percentFunction, @@ -1741,7 +1748,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( file = cmSystemTools::CollapseFullPath(file.c_str()); bool shouldIDoCoverage = this->ShouldIDoCoverage(file.c_str(), - cont->SourceDir.c_str(), + cont->SourceDir.c_str(), cont->BinaryDir.c_str()); if ( !shouldIDoCoverage ) { @@ -1797,20 +1804,20 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( << "\t\t" << branchCovered << "\n" - << "\t\t" + << "\t\t" << totalBranches - branchCovered << "\n" << "\t\t" << functionsCalled << "\n" - << "\t\t" + << "\t\t" << totalFunctions - functionsCalled << "\n" // Hack for conversion of function to loc assume a function // has 100 lines of code << "\t\t" << functionsCalled *100 << "\n" - << "\t\t" + << "\t\t" << (totalFunctions - functionsCalled)*100 << "\n" << "\t\t"; @@ -1832,12 +1839,12 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( << "\t"; covSumFile.setf(std::ios::fixed, std::ios::floatfield); covSumFile.precision(2); - covSumFile + covSumFile << SAFEDIV(percent_coverage,number_files)<< "\n" << "\t" << end_time << "\n" << "\t" << static_cast(cmSystemTools::GetTime()) << "\n"; - covSumFile + covSumFile << "" << static_cast((cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0 << "" @@ -1858,22 +1865,22 @@ int cmCTestCoverageHandler::HandleBullseyeCoverage( const char* covfile = cmSystemTools::GetEnv("COVFILE"); if(!covfile || strlen(covfile) == 0) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " COVFILE environment variable not found, not running " + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " COVFILE environment variable not found, not running " " bullseye\n"); return 0; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " run covsrc with COVFILE=[" + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " run covsrc with COVFILE=[" << covfile << "]" << std::endl); if(!this->RunBullseyeSourceSummary(cont)) - { - cmCTestLog(this->CTest, ERROR_MESSAGE, + { + cmCTestLog(this->CTest, ERROR_MESSAGE, "Error running bullseye summary.\n"); return 0; } - cmCTestLog(this->CTest, DEBUG, "HandleBullseyeCoverage return 1 " + cmCTestLog(this->CTest, DEBUG, "HandleBullseyeCoverage return 1 " << std::endl); return 1; } @@ -1881,7 +1888,7 @@ int cmCTestCoverageHandler::HandleBullseyeCoverage( bool cmCTestCoverageHandler::GetNextInt(std::string const& inputLine, std::string::size_type& pos, int& value) -{ +{ std::string::size_type start = pos; pos = inputLine.find(',', start); value = atoi(inputLine.substr(start, pos).c_str()); @@ -1892,7 +1899,7 @@ bool cmCTestCoverageHandler::GetNextInt(std::string const& inputLine, pos++; return true; } - + bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine( std::string const& inputLine, std::string& sourceFile, @@ -1906,7 +1913,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine( // find the first comma std::string::size_type pos = inputLine.find(','); if(pos == inputLine.npos) - { + { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error parsing string : " << inputLine.c_str() << "\n"); return false; @@ -1942,7 +1949,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine( if(pos != inputLine.npos) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error parsing input : " - << inputLine.c_str() << " last pos not npos = " << pos << + << inputLine.c_str() << " last pos not npos = " << pos << "\n"); } return true; diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx index 56312c0fb..abc33de68 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx @@ -28,8 +28,8 @@ bool cmCTestEmptyBinaryDirectoryCommand ostr << "problem removing the binary directory: " << args[0].c_str(); this->SetError(ostr.str().c_str()); return false; - } - + } + return true; } diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 2c1a0afd9..5b3449181 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -68,7 +68,7 @@ std::string cmCTestGIT::GetWorkingRevision() { // Run plumbing "git rev-list" to get work tree revision. const char* git = this->CommandLineTool.c_str(); - const char* git_rev_list[] = {git, "rev-list", "-n", "1", "HEAD", 0}; + const char* git_rev_list[] = {git, "rev-list", "-n", "1", "HEAD", "--", 0}; std::string rev; OneLineParser out(this, "rl-out> ", rev); OutputLogger err(this->Log, "rl-err> "); @@ -639,7 +639,7 @@ void cmCTestGIT::LoadModifications() this->RunChild(git_update_index, &ui_out, &ui_err); // Use 'git diff-index' to get modified files. - const char* git_diff_index[] = {git, "diff-index", "-z", "HEAD", 0}; + const char* git_diff_index[] = {git, "diff-index", "-z", "HEAD", "--", 0}; DiffParser out(this, "di-out> "); OutputLogger err(this->Log, "di-err> "); this->RunChild(git_diff_index, &out, &err); diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index fd75e45e8..5338f307b 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -51,7 +51,7 @@ void cmCTestGenericHandler::SetOption(const char* op, const char* value) } //---------------------------------------------------------------------- -void cmCTestGenericHandler::SetPersistentOption(const char* op, +void cmCTestGenericHandler::SetPersistentOption(const char* op, const char* value) { this->SetOption(op, value); @@ -79,7 +79,7 @@ void cmCTestGenericHandler::Initialize() this->AppendXML = false; this->Options.clear(); t_StringToString::iterator it; - for ( it = this->PersistentOptions.begin(); + for ( it = this->PersistentOptions.begin(); it != this->PersistentOptions.end(); ++ it ) { @@ -117,7 +117,7 @@ bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part, { ostr << "_" << this->SubmitIndex; } - ostr << ".xml"; + ostr << ".xml"; if(this->CTest->GetCurrentTag().empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index 18189ec2b..ba8febb61 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -73,7 +73,7 @@ public: typedef std::map t_StringToString; - + void SetPersistentOption(const char* op, const char* value); void SetOption(const char* op, const char* value); const char* GetOption(const char* op); diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 1957e04e3..453e32ce2 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -91,7 +91,7 @@ bool cmCTestHandlerCommand } else { - const char* bdir = + const char* bdir = this->Makefile->GetSafeDefinition("CTEST_BINARY_DIRECTORY"); if(bdir) { @@ -121,7 +121,7 @@ bool cmCTestHandlerCommand } if ( this->Values[ct_SUBMIT_INDEX] ) { - if ( this->CTest->GetDartVersion() <= 1 ) + if(!this->CTest->GetDropSiteCDash() && this->CTest->GetDartVersion() <= 1) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Dart before version 2.0 does not support collecting submissions." diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h index 399fe8b22..6db47aec8 100644 --- a/Source/CTest/cmCTestMemCheckCommand.h +++ b/Source/CTest/cmCTestMemCheckCommand.h @@ -60,7 +60,7 @@ public: " ctest_memcheck([BUILD build_dir] [RETURN_VALUE res] [APPEND]\n" " [START start number] [END end number]\n" " [STRIDE stride number] [EXCLUDE exclude regex ]\n" - " [INCLUDE include regex] \n" + " [INCLUDE include regex] \n" " [EXCLUDE_LABEL exclude regex] \n" " [INCLUDE_LABEL label regex] \n" " [PARALLEL_LEVEL level] )\n" diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 3e4ecddaa..80218ad38 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -84,7 +84,7 @@ public: } const char* GetAttribute(const char* name, const char** atts) - { + { int i = 0; for(; atts[i] != 0; ++i) { @@ -117,9 +117,9 @@ public: } if(ptr->ErrorCategory) { - this->Errors.push_back(cmCTestMemCheckHandler::ABW); // do not know + this->Errors.push_back(cmCTestMemCheckHandler::ABW); // do not know cmCTestLog(this->CTest, ERROR_MESSAGE, - "Found unknown Bounds Checker error " + "Found unknown Bounds Checker error " << ptr->ErrorCategory << std::endl); } } @@ -247,7 +247,8 @@ void cmCTestMemCheckHandler::GenerateTestCommand( { std::vector::size_type pp; std::string memcheckcommand = ""; - memcheckcommand = this->MemoryTester; + memcheckcommand + = cmSystemTools::ConvertToOutputPath(this->MemoryTester.c_str()); for ( pp = 0; pp < this->MemoryTesterOptions.size(); pp ++ ) { args.push_back(this->MemoryTesterOptions[pp]); @@ -410,29 +411,46 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() "MemoryCheckCommand").c_str()) ) { this->MemoryTester - = cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration( - "MemoryCheckCommand").c_str()); + = this->CTest->GetCTestConfiguration("MemoryCheckCommand").c_str(); + + // determine the checker type + if ( this->MemoryTester.find("valgrind") != std::string::npos ) + { + this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND; + } + else if ( this->MemoryTester.find("purify") != std::string::npos ) + { + this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY; + } + else if ( this->MemoryTester.find("BC") != std::string::npos ) + { + this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER; + } + else + { + this->MemoryTesterStyle = cmCTestMemCheckHandler::UNKNOWN; + } } else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration( "PurifyCommand").c_str()) ) { this->MemoryTester - = cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration( - "PurifyCommand").c_str()); + = this->CTest->GetCTestConfiguration("PurifyCommand").c_str(); + this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY; } else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration( "ValgrindCommand").c_str()) ) { this->MemoryTester - = cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration( - "ValgrindCommand").c_str()); + = this->CTest->GetCTestConfiguration("ValgrindCommand").c_str(); + this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND; } else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration( "BoundsCheckerCommand").c_str()) ) { this->MemoryTester - = cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration( - "BoundsCheckerCommand").c_str()); + = this->CTest->GetCTestConfiguration("BoundsCheckerCommand").c_str(); + this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER; } else { @@ -470,82 +488,81 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTesterOutputFile = this->CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.log"; - if ( this->MemoryTester.find("valgrind") != std::string::npos ) + switch ( this->MemoryTesterStyle ) { - this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND; - if ( this->MemoryTesterOptions.empty() ) - { - this->MemoryTesterOptions.push_back("-q"); - this->MemoryTesterOptions.push_back("--tool=memcheck"); - this->MemoryTesterOptions.push_back("--leak-check=yes"); - this->MemoryTesterOptions.push_back("--show-reachable=yes"); - this->MemoryTesterOptions.push_back("--workaround-gcc296-bugs=yes"); - this->MemoryTesterOptions.push_back("--num-callers=50"); - } - if ( this->CTest->GetCTestConfiguration( - "MemoryCheckSuppressionFile").size() ) - { - if ( !cmSystemTools::FileExists(this->CTest->GetCTestConfiguration( - "MemoryCheckSuppressionFile").c_str()) ) + case cmCTestMemCheckHandler::VALGRIND: + if ( this->MemoryTesterOptions.empty() ) { - cmCTestLog(this->CTest, ERROR_MESSAGE, - "Cannot find memory checker suppression file: " - << this->CTest->GetCTestConfiguration( - "MemoryCheckSuppressionFile").c_str() << std::endl); - return false; - } - std::string suppressions = "--suppressions=" - + this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile"); - this->MemoryTesterOptions.push_back(suppressions); - } - } - else if ( this->MemoryTester.find("purify") != std::string::npos ) - { - this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY; - std::string outputFile; -#ifdef _WIN32 - if( this->CTest->GetCTestConfiguration( + this->MemoryTesterOptions.push_back("-q"); + this->MemoryTesterOptions.push_back("--tool=memcheck"); + this->MemoryTesterOptions.push_back("--leak-check=yes"); + this->MemoryTesterOptions.push_back("--show-reachable=yes"); + this->MemoryTesterOptions.push_back("--workaround-gcc296-bugs=yes"); + this->MemoryTesterOptions.push_back("--num-callers=50"); + } + if ( this->CTest->GetCTestConfiguration( "MemoryCheckSuppressionFile").size() ) + { + if ( !cmSystemTools::FileExists(this->CTest->GetCTestConfiguration( + "MemoryCheckSuppressionFile").c_str()) ) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Cannot find memory checker suppression file: " + << this->CTest->GetCTestConfiguration( + "MemoryCheckSuppressionFile").c_str() << std::endl); + return false; + } + std::string suppressions = "--suppressions=" + + this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile"); + this->MemoryTesterOptions.push_back(suppressions); + } + break; + case cmCTestMemCheckHandler::PURIFY: { - if( !cmSystemTools::FileExists(this->CTest->GetCTestConfiguration( - "MemoryCheckSuppressionFile").c_str()) ) + std::string outputFile; +#ifdef _WIN32 + if( this->CTest->GetCTestConfiguration( + "MemoryCheckSuppressionFile").size() ) { - cmCTestLog(this->CTest, ERROR_MESSAGE, - "Cannot find memory checker suppression file: " - << this->CTest->GetCTestConfiguration( - "MemoryCheckSuppressionFile").c_str() << std::endl); - return false; - } - std::string filterFiles = "/FilterFiles=" - + this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile"); - this->MemoryTesterOptions.push_back(filterFiles); - } - outputFile = "/SAVETEXTDATA="; + if( !cmSystemTools::FileExists(this->CTest->GetCTestConfiguration( + "MemoryCheckSuppressionFile").c_str()) ) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Cannot find memory checker suppression file: " + << this->CTest->GetCTestConfiguration( + "MemoryCheckSuppressionFile").c_str() << std::endl); + return false; + } + std::string filterFiles = "/FilterFiles=" + + this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile"); + this->MemoryTesterOptions.push_back(filterFiles); + } + outputFile = "/SAVETEXTDATA="; #else - outputFile = "-log-file="; + outputFile = "-log-file="; #endif - outputFile += this->MemoryTesterOutputFile; - this->MemoryTesterOptions.push_back(outputFile); - } - else if ( this->MemoryTester.find("BC") != std::string::npos ) - { - this->BoundsCheckerXMLFile = this->MemoryTesterOutputFile; - std::string dpbdFile = this->CTest->GetBinaryDir() - + "/Testing/Temporary/MemoryChecker.DPbd"; - this->BoundsCheckerDPBDFile = dpbdFile; - this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER; - this->MemoryTesterOptions.push_back("/B"); - this->MemoryTesterOptions.push_back(dpbdFile); - this->MemoryTesterOptions.push_back("/X"); - this->MemoryTesterOptions.push_back(this->MemoryTesterOutputFile); - this->MemoryTesterOptions.push_back("/M"); - } - else - { - cmCTestLog(this->CTest, ERROR_MESSAGE, - "Do not understand memory checker: " << this->MemoryTester.c_str() - << std::endl); - return false; + outputFile += this->MemoryTesterOutputFile; + this->MemoryTesterOptions.push_back(outputFile); + break; + } + case cmCTestMemCheckHandler::BOUNDS_CHECKER: + { + this->BoundsCheckerXMLFile = this->MemoryTesterOutputFile; + std::string dpbdFile = this->CTest->GetBinaryDir() + + "/Testing/Temporary/MemoryChecker.DPbd"; + this->BoundsCheckerDPBDFile = dpbdFile; + this->MemoryTesterOptions.push_back("/B"); + this->MemoryTesterOptions.push_back(dpbdFile); + this->MemoryTesterOptions.push_back("/X"); + this->MemoryTesterOptions.push_back(this->MemoryTesterOutputFile); + this->MemoryTesterOptions.push_back("/M"); + break; + } + default: + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Do not understand memory checker: " << this->MemoryTester.c_str() + << std::endl); + return false; } std::vector::size_type cc; @@ -594,9 +611,9 @@ bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str, bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( const std::string& str, std::string& log, int* results) -{ +{ std::vector lines; - cmSystemTools::Split(str.c_str(), lines); + cmSystemTools::Split(str.c_str(), lines); cmOStringStream ostr; log = ""; @@ -604,7 +621,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( int defects = 0; - for( std::vector::iterator i = lines.begin(); + for( std::vector::iterator i = lines.begin(); i != lines.end(); ++i) { int failure = cmCTestMemCheckHandler::NO_MEMORY_FAULT; @@ -657,7 +674,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( { unlimitedOutput = true; } - + std::string::size_type cc; cmOStringStream ostr; @@ -782,7 +799,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( } totalOutputSize += lines[cc].size(); ostr << cmXMLSafe(lines[cc]) << std::endl; - } + } else { nonValGrindOutput.push_back(cc); @@ -791,7 +808,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( // Now put all all the non valgrind output into the test output if(!outputFull) { - for(std::vector::iterator i = + for(std::vector::iterator i = nonValGrindOutput.begin(); i != nonValGrindOutput.end(); ++i) { totalOutputSize += lines[*i].size(); @@ -801,7 +818,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( << cmXMLSafe(lines[*i]) << std::endl); ostr << cmXMLSafe(lines[*i]) << std::endl; - if(!unlimitedOutput && totalOutputSize > + if(!unlimitedOutput && totalOutputSize > static_cast(this->CustomMaximumFailedTestOutputSize)) { outputFull = true; @@ -833,7 +850,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( log = ""; double sttime = cmSystemTools::GetTime(); std::vector lines; - cmSystemTools::Split(str.c_str(), lines); + cmSystemTools::Split(str.c_str(), lines); cmCTestLog(this->CTest, DEBUG, "Start test: " << lines.size() << std::endl); std::vector::size_type cc; for ( cc = 0; cc < lines.size(); cc ++ ) @@ -886,8 +903,8 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( // for the test void cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res) -{ - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, +{ + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessBoundsCheckerTest for : " << res.Name.c_str() << std::endl); if ( !cmSystemTools::FileExists(this->MemoryTesterOutputFile.c_str()) ) @@ -902,22 +919,22 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res) std::ifstream ifs(this->MemoryTesterOutputFile.c_str()); if ( !ifs ) { - std::string log = "Cannot read memory tester output file: " + std::string log = "Cannot read memory tester output file: " + this->MemoryTesterOutputFile; cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl); return; - } + } res.Output += BOUNDS_CHECKER_MARKER; res.Output += "\n"; std::string line; while ( cmSystemTools::GetLineFromStream(ifs, line) ) { - res.Output += line; + res.Output += line; res.Output += "\n"; } } cmSystemTools::Delay(1000); - cmSystemTools::RemoveFile(this->BoundsCheckerDPBDFile.c_str()); + cmSystemTools::RemoveFile(this->BoundsCheckerDPBDFile.c_str()); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " << this->BoundsCheckerDPBDFile.c_str() << std::endl); cmSystemTools::RemoveFile(this->BoundsCheckerXMLFile.c_str()); @@ -928,7 +945,7 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res) void cmCTestMemCheckHandler::PostProcessPurifyTest(cmCTestTestResult& res) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessPurifyTest for : " << res.Name.c_str() << std::endl); if ( !cmSystemTools::FileExists(this->MemoryTesterOutputFile.c_str()) ) @@ -945,7 +962,7 @@ cmCTestMemCheckHandler::PostProcessPurifyTest(cmCTestTestResult& res) + this->MemoryTesterOutputFile; cmCTestLog(this->CTest, ERROR_MESSAGE, log.c_str() << std::endl); return; - } + } std::string line; while ( cmSystemTools::GetLineFromStream(ifs, line) ) { diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 427d4717d..1e81c893b 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -30,7 +30,7 @@ public: cmTypeMacro(cmCTestMemCheckHandler, cmCTestTestHandler); void PopulateCustomVectors(cmMakefile *mf); - + cmCTestMemCheckHandler(); void Initialize(); @@ -108,13 +108,13 @@ private: //! Parse Valgrind/Purify/Bounds Checker result out of the output //string. After running, log holds the output and results hold the //different memmory errors. - bool ProcessMemCheckOutput(const std::string& str, + bool ProcessMemCheckOutput(const std::string& str, std::string& log, int* results); - bool ProcessMemCheckValgrindOutput(const std::string& str, + bool ProcessMemCheckValgrindOutput(const std::string& str, std::string& log, int* results); - bool ProcessMemCheckPurifyOutput(const std::string& str, + bool ProcessMemCheckPurifyOutput(const std::string& str, std::string& log, int* results); - bool ProcessMemCheckBoundsCheckerOutput(const std::string& str, + bool ProcessMemCheckBoundsCheckerOutput(const std::string& str, std::string& log, int* results); void PostProcessPurifyTest(cmCTestTestResult& res); diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 2cae80215..76ddeea01 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -48,7 +48,7 @@ cmCTestMultiProcessHandler::~cmCTestMultiProcessHandler() } // Set the tests -void +void cmCTestMultiProcessHandler::SetTests(TestMap& tests, PropertiesMap& properties) { @@ -178,7 +178,7 @@ void cmCTestMultiProcessHandler::EraseTest(int test) //--------------------------------------------------------- inline size_t cmCTestMultiProcessHandler::GetProcessorsUsed(int test) { - size_t processors = + size_t processors = static_cast(this->Properties[test]->Processors); //If this is set to run serially, it must run alone. //Also, if processors setting is set higher than the -j @@ -205,7 +205,7 @@ bool cmCTestMultiProcessHandler::StartTest(int test) } } - // copy the depend tests locally because when + // copy the depend tests locally because when // a test is finished it will be removed from the depend list // and we don't want to be iterating a list while removing from it TestSet depends = this->Tests[test]; @@ -240,7 +240,7 @@ bool cmCTestMultiProcessHandler::StartTest(int test) this->StartTestProcess(test); return true; } - // This test was not able to start because it is waiting + // This test was not able to start because it is waiting // on depends to run return false; } @@ -248,7 +248,12 @@ bool cmCTestMultiProcessHandler::StartTest(int test) //--------------------------------------------------------- void cmCTestMultiProcessHandler::StartNextTests() { - size_t numToStart = this->ParallelLevel - this->RunningCount; + size_t numToStart = 0; + if(this->RunningCount < this->ParallelLevel) + { + numToStart = this->ParallelLevel - this->RunningCount; + } + if(numToStart == 0) { return; @@ -351,7 +356,7 @@ void cmCTestMultiProcessHandler::UpdateCostData() while(std::getline(fin, line)) { if(line == "---") break; - std::vector parts = + std::vector parts = cmSystemTools::SplitString(line.c_str(), ' '); //Format: if(parts.size() < 3) break; @@ -552,7 +557,7 @@ void cmCTestMultiProcessHandler::PrintTestList() } cmOStringStream indexStr; indexStr << " #" << p.Index << ":"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3 + getNumWidth(this->TestHandler->GetMaxIndex())) << indexStr.str().c_str()); cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); @@ -603,7 +608,7 @@ void cmCTestMultiProcessHandler::CheckResume() << std::endl << "----------------------------------------------------------" << std::endl; - + std::ifstream fin; fin.open(fname.c_str()); std::string line; diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 1483440c6..cd21d9187 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -19,16 +19,16 @@ /** \class cmCTestMultiProcessHandler * \brief run parallel ctest * - * cmCTestMultiProcessHandler + * cmCTestMultiProcessHandler */ -class cmCTestMultiProcessHandler +class cmCTestMultiProcessHandler { friend class TestComparator; public: struct TestSet : public std::set {}; struct TestMap : public std::map {}; struct TestList : public std::vector {}; - struct PropertiesMap : public + struct PropertiesMap : public std::map {}; cmCTestMultiProcessHandler(); diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h index f382b0f2d..b984c84e9 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.h +++ b/Source/CTest/cmCTestReadCustomFilesCommand.h @@ -25,11 +25,11 @@ class cmCTestReadCustomFilesCommand : public cmCTestCommand public: cmCTestReadCustomFilesCommand() {} - + /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { cmCTestReadCustomFilesCommand* ni = new cmCTestReadCustomFilesCommand; ni->CTest = this->CTest; @@ -55,7 +55,7 @@ public: { return "read CTestCustom files."; } - + /** * More documentation. */ diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h index 6df69afa6..05e78991a 100644 --- a/Source/CTest/cmCTestRunScriptCommand.h +++ b/Source/CTest/cmCTestRunScriptCommand.h @@ -25,11 +25,11 @@ class cmCTestRunScriptCommand : public cmCTestCommand public: cmCTestRunScriptCommand() {} - + /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { cmCTestRunScriptCommand* ni = new cmCTestRunScriptCommand; ni->CTest = this->CTest; @@ -56,7 +56,7 @@ public: { return "runs a ctest -S script"; } - + /** * More documentation. */ diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index c3de5dcf6..5eabf3fbe 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -59,7 +59,7 @@ bool cmCTestRunTest::CheckOutput() { // Store this line of output. cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - this->GetIndex() << ": " << line << std::endl); + this->GetIndex() << ": " << line << std::endl); this->ProcessOutput += line; this->ProcessOutput += "\n"; } @@ -79,7 +79,7 @@ void cmCTestRunTest::CompressOutput() int ret; z_stream strm; - unsigned char* in = + unsigned char* in = reinterpret_cast( const_cast(this->ProcessOutput.c_str())); //zlib makes the guarantee that this is the maximum output size @@ -112,7 +112,7 @@ void cmCTestRunTest::CompressOutput() } (void)deflateEnd(&strm); - + unsigned char *encoded_buffer = new unsigned char[static_cast(outSize * 1.5)]; @@ -169,11 +169,11 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) } } if ( !found ) - { + { reason = "Required regular expression not found."; forceFail = true; } - reason += "Regex=["; + reason += "Regex=["; for ( passIt = this->TestProperties->RequiredRegularExpressions.begin(); passIt != this->TestProperties->RequiredRegularExpressions.end(); ++ passIt ) @@ -201,10 +201,10 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) } if (res == cmsysProcess_State_Exited) { - bool success = - !forceFail && (retVal == 0 || + bool success = + !forceFail && (retVal == 0 || this->TestProperties->RequiredRegularExpressions.size()); - if((success && !this->TestProperties->WillFail) + if((success && !this->TestProperties->WillFail) || (!success && this->TestProperties->WillFail)) { this->TestResult.Status = cmCTestTestHandler::COMPLETED; @@ -312,10 +312,10 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) << std::endl; if(this->TestResult.Reason.size()) { - *this->TestHandler->LogFile << reasonType << ":\n" + *this->TestHandler->LogFile << reasonType << ":\n" << this->TestResult.Reason << "\n"; } - else + else { if(pass) { @@ -333,14 +333,14 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) << "----------------------------------------------------------" << std::endl << std::endl; } - // if the test actually started and ran - // record the results in TestResult + // if the test actually started and ran + // record the results in TestResult if(started) { bool compress = !this->TestHandler->MemCheck && this->CompressionRatio < 1 && this->CTest->ShouldCompressTestOutput(); - this->TestResult.Output = compress ? this->CompressedOutput + this->TestResult.Output = compress ? this->CompressedOutput : this->ProcessOutput; this->TestResult.CompressOutput = compress; this->TestResult.ReturnValue = this->TestProcess->GetExitValue(); @@ -378,7 +378,7 @@ void cmCTestRunTest::MemCheckPostProcess() { return; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": process test output now: " << this->TestProperties->Name.c_str() << " " << this->TestResult.Name.c_str() << std::endl); @@ -390,7 +390,7 @@ void cmCTestRunTest::MemCheckPostProcess() } else if(handler->MemoryTesterStyle == cmCTestMemCheckHandler::PURIFY) { - handler->PostProcessPurifyTest(this->TestResult); + handler->PostProcessPurifyTest(this->TestResult); } } @@ -411,7 +411,7 @@ bool cmCTestRunTest::StartTest(size_t total) this->TestResult.ReturnValue = -1; this->TestResult.CompletionStatus = "Failed to start"; this->TestResult.Status = cmCTestTestHandler::BAD_COMMAND; - this->TestResult.TestCount = this->TestProperties->Index; + this->TestResult.TestCount = this->TestProperties->Index; this->TestResult.Name = this->TestProperties->Name; this->TestResult.Path = this->TestProperties->Directory.c_str(); @@ -438,7 +438,7 @@ bool cmCTestRunTest::StartTest(size_t total) this->TestResult.Status = cmCTestTestHandler::NOT_RUN; return false; } - + // Check if all required files exist for(std::vector::iterator i = this->TestProperties->RequiredFiles.begin(); @@ -465,9 +465,9 @@ bool cmCTestRunTest::StartTest(size_t total) if (this->ActualCommand == "") { // if the command was not found create a TestResult object - // that has that information + // that has that information this->TestProcess = new cmProcess; - *this->TestHandler->LogFile << "Unable to find executable: " + *this->TestHandler->LogFile << "Unable to find executable: " << args[1].c_str() << std::endl; cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to find executable: " << args[1].c_str() << std::endl); @@ -536,7 +536,7 @@ void cmCTestRunTest::ComputeArguments() cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl << this->Index << ": " - << (this->TestHandler->MemCheck?"MemCheck":"Test") + << (this->TestHandler->MemCheck?"MemCheck":"Test") << " command: " << testCommand << std::endl); } @@ -544,7 +544,7 @@ void cmCTestRunTest::ComputeArguments() //---------------------------------------------------------------------- void cmCTestRunTest::DartProcessing() { - if (!this->ProcessOutput.empty() && + if (!this->ProcessOutput.empty() && this->ProcessOutput.find("ProcessOutput.npos) { if (this->TestHandler->DartStuff.find(this->ProcessOutput.c_str())) @@ -695,7 +695,7 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) cmOStringStream indexStr; indexStr << " #" << this->Index << ":"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3 + getNumWidth(this->TestHandler->GetMaxIndex())) << indexStr.str().c_str()); cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); @@ -704,17 +704,17 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) outname.resize(maxTestNameWidth + 4, '.'); *this->TestHandler->LogFile << this->TestProperties->Index << "/" - << this->TestHandler->TotalNumberOfTests << " Testing: " + << this->TestHandler->TotalNumberOfTests << " Testing: " << this->TestProperties->Name << std::endl; *this->TestHandler->LogFile << this->TestProperties->Index << "/" << this->TestHandler->TotalNumberOfTests << " Test: " << this->TestProperties->Name.c_str() << std::endl; *this->TestHandler->LogFile << "Command: \"" << this->ActualCommand << "\""; - + for (std::vector::iterator i = this->Arguments.begin(); i != this->Arguments.end(); ++i) { - *this->TestHandler->LogFile + *this->TestHandler->LogFile << " \"" << i->c_str() << "\""; } *this->TestHandler->LogFile << std::endl @@ -730,6 +730,6 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) << this->ProcessOutput.c_str() << "" << std::endl; cmCTestLog(this->CTest, HANDLER_OUTPUT, outname.c_str()); - cmCTestLog(this->CTest, DEBUG, "Testing " + cmCTestLog(this->CTest, DEBUG, "Testing " << this->TestProperties->Name.c_str() << " ... "); } diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 89456d505..476f3e126 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -74,7 +74,7 @@ private: cmCTestTestHandler * TestHandler; cmCTest * CTest; cmProcess * TestProcess; - //If the executable to run is ctest, don't create a new process; + //If the executable to run is ctest, don't create a new process; //just instantiate a new cmTest. (Can be disabled for a single test //if this option is set to false.) //bool OptimizeForCTest; diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index fab9a8cba..2668c8eef 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -18,6 +18,11 @@ #include +struct cmCTestSVN::Revision: public cmCTestVC::Revision +{ + cmCTestSVN::SVNInfo* SVNInfo; +}; + //---------------------------------------------------------------------------- cmCTestSVN::cmCTestSVN(cmCTest* ct, std::ostream& log): cmCTestGlobalVC(ct, log) @@ -33,19 +38,22 @@ cmCTestSVN::~cmCTestSVN() //---------------------------------------------------------------------------- void cmCTestSVN::CleanupImpl() { - const char* svn = this->CommandLineTool.c_str(); - const char* svn_cleanup[] = {svn, "cleanup", 0}; + std::vector svn_cleanup; + svn_cleanup.push_back("cleanup"); OutputLogger out(this->Log, "cleanup-out> "); OutputLogger err(this->Log, "cleanup-err> "); - this->RunChild(svn_cleanup, &out, &err); + this->RunSVNCommand(svn_cleanup, &out, &err); } //---------------------------------------------------------------------------- class cmCTestSVN::InfoParser: public cmCTestVC::LineParser { public: - InfoParser(cmCTestSVN* svn, const char* prefix, std::string& rev): - SVN(svn), Rev(rev) + InfoParser(cmCTestSVN* svn, + const char* prefix, + std::string& rev, + SVNInfo& svninfo): + Rev(rev), SVNRepo(svninfo) { this->SetLog(&svn->Log, prefix); this->RegexRev.compile("^Revision: ([0-9]+)"); @@ -53,8 +61,8 @@ public: this->RegexRoot.compile("^Repository Root: +([^ ]+) *$"); } private: - cmCTestSVN* SVN; std::string& Rev; + cmCTestSVN::SVNInfo& SVNRepo; cmsys::RegularExpression RegexRev; cmsys::RegularExpression RegexURL; cmsys::RegularExpression RegexRoot; @@ -66,11 +74,11 @@ private: } else if(this->RegexURL.find(this->Line)) { - this->SVN->URL = this->RegexURL.match(1); + this->SVNRepo.URL = this->RegexURL.match(1); } else if(this->RegexRoot.find(this->Line)) { - this->SVN->Root = this->RegexRoot.match(1); + this->SVNRepo.Root = this->RegexRoot.match(1); } return true; } @@ -95,70 +103,110 @@ static bool cmCTestSVNPathStarts(std::string const& p1, std::string const& p2) } //---------------------------------------------------------------------------- -std::string cmCTestSVN::LoadInfo() +std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo) { // Run "svn info" to get the repository info from the work tree. - const char* svn = this->CommandLineTool.c_str(); - const char* svn_info[] = {svn, "info", 0}; + std::vector svn_info; + svn_info.push_back("info"); + svn_info.push_back(svninfo.LocalPath.c_str()); std::string rev; - InfoParser out(this, "info-out> ", rev); + InfoParser out(this, "info-out> ", rev, svninfo); OutputLogger err(this->Log, "info-err> "); - this->RunChild(svn_info, &out, &err); + this->RunSVNCommand(svn_info, &out, &err); return rev; } //---------------------------------------------------------------------------- void cmCTestSVN::NoteOldRevision() { - this->OldRevision = this->LoadInfo(); - this->Log << "Revision before update: " << this->OldRevision << "\n"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Old revision of repository is: " - << this->OldRevision << "\n"); + // Info for root repository + this->Repositories.push_back( SVNInfo("") ); + this->RootInfo = &(this->Repositories.back()); + // Info for the external repositories + this->LoadExternals(); + + // Get info for all the repositories + std::list::iterator itbeg = this->Repositories.begin(); + std::list::iterator itend = this->Repositories.end(); + for( ; itbeg != itend ; itbeg++) + { + SVNInfo& svninfo = *itbeg; + svninfo.OldRevision = this->LoadInfo(svninfo); + this->Log << "Revision for repository '" << svninfo.LocalPath + << "' before update: " << svninfo.OldRevision << "\n"; + cmCTestLog(this->CTest, HANDLER_OUTPUT, + " Old revision of external repository '" + << svninfo.LocalPath << "' is: " + << svninfo.OldRevision << "\n"); + } + + // Set the global old revision to the one of the root + this->OldRevision = this->RootInfo->OldRevision; this->PriorRev.Rev = this->OldRevision; } //---------------------------------------------------------------------------- void cmCTestSVN::NoteNewRevision() { - this->NewRevision = this->LoadInfo(); - this->Log << "Revision after update: " << this->NewRevision << "\n"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, " New revision of repository is: " - << this->NewRevision << "\n"); + // Get info for the external repositories + std::list::iterator itbeg = this->Repositories.begin(); + std::list::iterator itend = this->Repositories.end(); + for( ; itbeg != itend ; itbeg++) + { + SVNInfo& svninfo = *itbeg; + svninfo.NewRevision = this->LoadInfo(svninfo); + this->Log << "Revision for repository '" << svninfo.LocalPath + << "' after update: " << svninfo.NewRevision << "\n"; + cmCTestLog(this->CTest, HANDLER_OUTPUT, + " New revision of external repository '" + << svninfo.LocalPath << "' is: " + << svninfo.NewRevision << "\n"); + + // svninfo.Root = ""; // uncomment to test GuessBase + this->Log << "Repository '" << svninfo.LocalPath + << "' URL = " << svninfo.URL << "\n"; + this->Log << "Repository '" << svninfo.LocalPath + << "' Root = " << svninfo.Root << "\n"; + + // Compute the base path the working tree has checked out under + // the repository root. + if(!svninfo.Root.empty() + && cmCTestSVNPathStarts(svninfo.URL, svninfo.Root)) + { + svninfo.Base = cmCTest::DecodeURL( + svninfo.URL.substr(svninfo.Root.size())); + svninfo.Base += "/"; + } + this->Log << "Repository '" << svninfo.LocalPath + << "' Base = " << svninfo.Base << "\n"; - // this->Root = ""; // uncomment to test GuessBase - this->Log << "URL = " << this->URL << "\n"; - this->Log << "Root = " << this->Root << "\n"; + } - // Compute the base path the working tree has checked out under - // the repository root. - if(!this->Root.empty() && cmCTestSVNPathStarts(this->URL, this->Root)) - { - this->Base = cmCTest::DecodeURL(this->URL.substr(this->Root.size())); - this->Base += "/"; - } - this->Log << "Base = " << this->Base << "\n"; + // Set the global new revision to the one of the root + this->NewRevision = this->RootInfo->NewRevision; } //---------------------------------------------------------------------------- -void cmCTestSVN::GuessBase(std::vector const& changes) +void cmCTestSVN::GuessBase(SVNInfo& svninfo, + std::vector const& changes) { // Subversion did not give us a good repository root so we need to // guess the base path from the URL and the paths in a revision with // changes under it. // Consider each possible URL suffix from longest to shortest. - for(std::string::size_type slash = this->URL.find('/'); - this->Base.empty() && slash != std::string::npos; - slash = this->URL.find('/', slash+1)) + for(std::string::size_type slash = svninfo.URL.find('/'); + svninfo.Base.empty() && slash != std::string::npos; + slash = svninfo.URL.find('/', slash+1)) { // If the URL suffix is a prefix of at least one path then it is the base. - std::string base = cmCTest::DecodeURL(this->URL.substr(slash)); + std::string base = cmCTest::DecodeURL(svninfo.URL.substr(slash)); for(std::vector::const_iterator ci = changes.begin(); - this->Base.empty() && ci != changes.end(); ++ci) + svninfo.Base.empty() && ci != changes.end(); ++ci) { if(cmCTestSVNPathStarts(ci->Path, base)) { - this->Base = base; + svninfo.Base = base; } } } @@ -167,25 +215,9 @@ void cmCTestSVN::GuessBase(std::vector const& changes) // base lie under its path. If no base was found then the working // tree must be a checkout of the entire repo and this will match // the leading slash in all paths. - this->Base += "/"; - - this->Log << "Guessed Base = " << this->Base << "\n"; -} + svninfo.Base += "/"; -//---------------------------------------------------------------------------- -const char* cmCTestSVN::LocalPath(std::string const& path) -{ - if(path.size() > this->Base.size() && - strncmp(path.c_str(), this->Base.c_str(), this->Base.size()) == 0) - { - // This path lies under the base, so return a relative path. - return path.c_str() + this->Base.size(); - } - else - { - // This path does not lie under the base, so ignore it. - return 0; - } + this->Log << "Guessed Base = " << svninfo.Base << "\n"; } //---------------------------------------------------------------------------- @@ -254,19 +286,52 @@ bool cmCTestSVN::UpdateImpl() } std::vector svn_update; - svn_update.push_back(this->CommandLineTool.c_str()); svn_update.push_back("update"); - svn_update.push_back("--non-interactive"); for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { svn_update.push_back(ai->c_str()); } - svn_update.push_back(0); UpdateParser out(this, "up-out> "); OutputLogger err(this->Log, "up-err> "); - return this->RunUpdateCommand(&svn_update[0], &out, &err); + return this->RunSVNCommand(svn_update, &out, &err); +} + +//---------------------------------------------------------------------------- +bool cmCTestSVN::RunSVNCommand(std::vector const& parameters, + OutputParser* out, OutputParser* err) +{ + if(parameters.empty()) return false; + + std::vector args; + args.push_back(this->CommandLineTool.c_str()); + + args.insert(args.end(), parameters.begin(), parameters.end()); + + args.push_back("--non-interactive"); + + std::string userOptions = + this->CTest->GetCTestConfiguration("SVNOptions"); + + std::vector parsedUserOptions = + cmSystemTools::ParseArguments(userOptions.c_str()); + for(std::vector::iterator i = parsedUserOptions.begin(); + i != parsedUserOptions.end(); ++i) + { + args.push_back(i->c_str()); + } + + args.push_back(0); + + if(strcmp(parameters[0], "update") == 0) + { + return RunUpdateCommand(&args[0], out, err); + } + else + { + return RunChild(&args[0], out, err); + } } //---------------------------------------------------------------------------- @@ -274,11 +339,13 @@ class cmCTestSVN::LogParser: public cmCTestVC::OutputLogger, private cmXMLParser { public: - LogParser(cmCTestSVN* svn, const char* prefix): - OutputLogger(svn->Log, prefix), SVN(svn) { this->InitializeParser(); } + LogParser(cmCTestSVN* svn, const char* prefix, SVNInfo& svninfo): + OutputLogger(svn->Log, prefix), SVN(svn), SVNRepo(svninfo) + { this->InitializeParser(); } ~LogParser() { this->CleanupParser(); } private: cmCTestSVN* SVN; + cmCTestSVN::SVNInfo& SVNRepo; typedef cmCTestSVN::Revision Revision; typedef cmCTestSVN::Change Change; @@ -300,6 +367,7 @@ private: if(strcmp(name, "logentry") == 0) { this->Rev = Revision(); + this->Rev.SVNInfo = &SVNRepo; if(const char* rev = this->FindAttribute(atts, "revision")) { this->Rev.Rev = rev; @@ -325,11 +393,13 @@ private: { if(strcmp(name, "logentry") == 0) { - this->SVN->DoRevision(this->Rev, this->Changes); + this->SVN->DoRevisionSVN(this->Rev, this->Changes); } else if(strcmp(name, "path") == 0 && !this->CData.empty()) { - this->CurChange.Path.assign(&this->CData[0], this->CData.size()); + std::string orig_path(&this->CData[0], this->CData.size()); + std::string new_path = SVNRepo.BuildLocalPath( orig_path ); + this->CurChange.Path.assign(new_path); this->Changes.push_back(this->CurChange); } else if(strcmp(name, "author") == 0 && !this->CData.empty()) @@ -355,37 +425,60 @@ private: //---------------------------------------------------------------------------- void cmCTestSVN::LoadRevisions() +{ + // Get revisions for all the external repositories + std::list::iterator itbeg = this->Repositories.begin(); + std::list::iterator itend = this->Repositories.end(); + for( ; itbeg != itend ; itbeg++) + { + SVNInfo& svninfo = *itbeg; + LoadRevisions(svninfo); + } +} + +//---------------------------------------------------------------------------- +void cmCTestSVN::LoadRevisions(SVNInfo &svninfo) { // We are interested in every revision included in the update. std::string revs; - if(atoi(this->OldRevision.c_str()) < atoi(this->NewRevision.c_str())) + if(atoi(svninfo.OldRevision.c_str()) < atoi(svninfo.NewRevision.c_str())) { - revs = "-r" + this->OldRevision + ":" + this->NewRevision; + revs = "-r" + svninfo.OldRevision + ":" + svninfo.NewRevision; } else { - revs = "-r" + this->NewRevision; + revs = "-r" + svninfo.NewRevision; } // Run "svn log" to get all global revisions of interest. - const char* svn = this->CommandLineTool.c_str(); - const char* svn_log[] = {svn, "log", "--xml", "-v", revs.c_str(), 0}; - { - LogParser out(this, "log-out> "); + std::vector svn_log; + svn_log.push_back("log"); + svn_log.push_back("--xml"); + svn_log.push_back("-v"); + svn_log.push_back(revs.c_str()); + svn_log.push_back(svninfo.LocalPath.c_str()); + LogParser out(this, "log-out> ", svninfo); OutputLogger err(this->Log, "log-err> "); - this->RunChild(svn_log, &out, &err); - } + this->RunSVNCommand(svn_log, &out, &err); } //---------------------------------------------------------------------------- -void cmCTestSVN::DoRevision(Revision const& revision, - std::vector const& changes) +void cmCTestSVN::DoRevisionSVN(Revision const& revision, + std::vector const& changes) { // Guess the base checkout path from the changes if necessary. - if(this->Base.empty() && !changes.empty()) + if(this->RootInfo->Base.empty() && !changes.empty()) + { + this->GuessBase(*this->RootInfo, changes); + } + + // Ignore changes in the old revision for external repositories + if(revision.Rev == revision.SVNInfo->OldRevision + && revision.SVNInfo->LocalPath != "") { - this->GuessBase(changes); + return; } + this->cmCTestGlobalVC::DoRevision(revision, changes); } @@ -434,11 +527,11 @@ private: void cmCTestSVN::LoadModifications() { // Run "svn status" which reports local modifications. - const char* svn = this->CommandLineTool.c_str(); - const char* svn_status[] = {svn, "status", "--non-interactive", 0}; + std::vector svn_status; + svn_status.push_back("status"); StatusParser out(this, "status-out> "); OutputLogger err(this->Log, "status-err> "); - this->RunChild(svn_status, &out, &err); + this->RunSVNCommand(svn_status, &out, &err); } //---------------------------------------------------------------------------- @@ -446,5 +539,81 @@ void cmCTestSVN::WriteXMLGlobal(std::ostream& xml) { this->cmCTestGlobalVC::WriteXMLGlobal(xml); - xml << "\t" << this->Base << "\n"; + xml << "\t" << this->RootInfo->Base << "\n"; +} + +//---------------------------------------------------------------------------- +class cmCTestSVN::ExternalParser: public cmCTestVC::LineParser +{ +public: + ExternalParser(cmCTestSVN* svn, const char* prefix): SVN(svn) + { + this->SetLog(&svn->Log, prefix); + this->RegexExternal.compile("^X..... +(.+)$"); + } +private: + cmCTestSVN* SVN; + cmsys::RegularExpression RegexExternal; + bool ProcessLine() + { + if(this->RegexExternal.find(this->Line)) + { + this->DoPath(this->RegexExternal.match(1)); + } + return true; + } + + void DoPath(std::string const& path) + { + // Get local path relative to the source directory + std::string local_path; + if(path.size() > this->SVN->SourceDirectory.size() && + strncmp(path.c_str(), this->SVN->SourceDirectory.c_str(), + this->SVN->SourceDirectory.size()) == 0) + { + local_path = path.c_str() + this->SVN->SourceDirectory.size() + 1; + } + else + { + local_path = path; + } + this->SVN->Repositories.push_back( SVNInfo(local_path.c_str()) ); + } +}; + +//---------------------------------------------------------------------------- +void cmCTestSVN::LoadExternals() +{ + // Run "svn status" to get the list of external repositories + std::vector svn_status; + svn_status.push_back("status"); + ExternalParser out(this, "external-out> "); + OutputLogger err(this->Log, "external-err> "); + this->RunSVNCommand(svn_status, &out, &err); +} + +//---------------------------------------------------------------------------- +std::string cmCTestSVN::SVNInfo::BuildLocalPath(std::string const& path) const +{ + std::string local_path; + + // Add local path prefix if not empty + if (!this->LocalPath.empty()) + { + local_path += this->LocalPath; + local_path += "/"; + } + + // Add path with base prefix removed + if(path.size() > this->Base.size() && + strncmp(path.c_str(), this->Base.c_str(), this->Base.size()) == 0) + { + local_path += (path.c_str() + this->Base.size()); + } + else + { + local_path += path; + } + + return local_path; } diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index f72c58fb0..c6548e3fb 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -33,24 +33,54 @@ private: virtual void NoteNewRevision(); virtual bool UpdateImpl(); - // URL of repository directory checked out in the working tree. - std::string URL; + bool RunSVNCommand(std::vector const& parameters, + OutputParser* out, OutputParser* err); - // URL of repository root directory. - std::string Root; + // Information about an SVN repository (root repository or external) + struct SVNInfo { - // Directory under repository root checked out in working tree. - std::string Base; + SVNInfo(const char* path) : LocalPath(path) {} + // Remove base from the filename + std::string BuildLocalPath(std::string const& path) const; - std::string LoadInfo(); + // LocalPath relative to the main source directory. + std::string LocalPath; + + // URL of repository directory checked out in the working tree. + std::string URL; + + // URL of repository root directory. + std::string Root; + + // Directory under repository root checked out in working tree. + std::string Base; + + // Old and new repository revisions. + std::string OldRevision; + std::string NewRevision; + + }; + + // Extended revision structure to include info about external it refers to. + struct Revision; + friend struct Revision; + + // Info of all the repositories (root, externals and nested ones). + std::list Repositories; + + // Pointer to the infos of the root repository. + SVNInfo* RootInfo; + + std::string LoadInfo(SVNInfo& svninfo); + void LoadExternals(); void LoadModifications(); void LoadRevisions(); + void LoadRevisions(SVNInfo& svninfo); - void GuessBase(std::vector const& changes); - const char* LocalPath(std::string const& path); + void GuessBase(SVNInfo &svninfo, std::vector const& changes); - void DoRevision(Revision const& revision, - std::vector const& changes); + void DoRevisionSVN(Revision const& revision, + std::vector const& changes); void WriteXMLGlobal(std::ostream& xml); @@ -59,10 +89,12 @@ private: class LogParser; class StatusParser; class UpdateParser; + class ExternalParser; friend class InfoParser; friend class LogParser; friend class StatusParser; friend class UpdateParser; + friend class ExternalParser; }; #endif diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index a7cf6ba65..9d852cab6 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -97,7 +97,7 @@ public: static void SleepInSeconds(unsigned int secondsToWait); void UpdateElapsedTime(); - /** + /** * Return the time remaianing that the script is allowed to run in * seconds if the user has set the variable CTEST_TIME_LIMIT. If that has * not been set it returns 1e7 seconds diff --git a/Source/CTest/cmCTestSleepCommand.cxx b/Source/CTest/cmCTestSleepCommand.cxx index 5b0697219..7e8755066 100644 --- a/Source/CTest/cmCTestSleepCommand.cxx +++ b/Source/CTest/cmCTestSleepCommand.cxx @@ -47,7 +47,7 @@ bool cmCTestSleepCommand } return true; } - + this->SetError("called with incorrect number of arguments"); return false; } diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index 80fd6afb7..0f51ddfeb 100644 --- a/Source/CTest/cmCTestSleepCommand.h +++ b/Source/CTest/cmCTestSleepCommand.h @@ -25,11 +25,11 @@ class cmCTestSleepCommand : public cmCTestCommand public: cmCTestSleepCommand() {} - + /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { cmCTestSleepCommand* ni = new cmCTestSleepCommand; ni->CTest = this->CTest; @@ -56,7 +56,7 @@ public: { return "sleeps for some amount of time"; } - + /** * More documentation. */ diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index 5aee035c7..231f035fb 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -32,7 +32,7 @@ cmCTestTestCommand::cmCTestTestCommand() cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() { - const char* ctestTimeout = + const char* ctestTimeout = this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT"); double timeout = this->CTest->GetTimeOut(); @@ -86,7 +86,7 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() } if(this->Values[ctt_INCLUDE_LABEL]) { - handler->SetOption("LabelRegularExpression", + handler->SetOption("LabelRegularExpression", this->Values[ctt_INCLUDE_LABEL]); } if(this->Values[ctt_PARALLEL_LEVEL]) diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index d184ff2a0..130cb6973 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -58,7 +58,7 @@ public: " ctest_test([BUILD build_dir] [APPEND]\n" " [START start number] [END end number]\n" " [STRIDE stride number] [EXCLUDE exclude regex ]\n" - " [INCLUDE include regex] [RETURN_VALUE res] \n" + " [INCLUDE include regex] [RETURN_VALUE res] \n" " [EXCLUDE_LABEL exclude regex] \n" " [INCLUDE_LABEL label regex] \n" " [PARALLEL_LEVEL level] \n" diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index ead449edd..e7491bba3 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -32,7 +32,6 @@ #include #include -#include // auto_ptr #include //---------------------------------------------------------------------- @@ -1304,9 +1303,10 @@ int cmCTestTestHandler::ExecuteCommands(std::vector& vec) for ( it = vec.begin(); it != vec.end(); ++it ) { int retVal = 0; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << *it + std::string cmd = cmSystemTools::ConvertToOutputPath(it->c_str()); + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << cmd << std::endl); - if ( !cmSystemTools::RunSingleCommand(it->c_str(), 0, &retVal, 0, + if ( !cmSystemTools::RunSingleCommand(cmd.c_str(), 0, &retVal, 0, cmSystemTools::OUTPUT_MERGE /*this->Verbose*/) || retVal != 0 ) { @@ -1546,7 +1546,7 @@ void cmCTestTestHandler::GetListOfTests() cmake cm; cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - std::auto_ptr lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr lg(gg.CreateLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); mf->AddDefinition("CTEST_CONFIGURATION_TYPE", this->CTest->GetConfigType().c_str()); diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx index 841434911..2ca9f6c86 100644 --- a/Source/CTest/cmCTestUpdateCommand.cxx +++ b/Source/CTest/cmCTestUpdateCommand.cxx @@ -43,6 +43,8 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler() "SVNCommand", "CTEST_SVN_COMMAND"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS"); + this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, + "SVNOptions", "CTEST_SVN_OPTIONS"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "BZRCommand", "CTEST_BZR_COMMAND"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h index 44e1dacbb..9dd06515d 100644 --- a/Source/CTest/cmCTestVC.h +++ b/Source/CTest/cmCTestVC.h @@ -67,6 +67,9 @@ protected: virtual void NoteNewRevision(); virtual bool WriteXMLUpdates(std::ostream& xml); +#if defined(__SUNPRO_CC) && __SUNPRO_CC <= 0x510 +public: // Sun CC 5.1 needs help to allow cmCTestSVN::Revision to see this +#endif /** Basic information about one revision of a tree or file. */ struct Revision { @@ -80,6 +83,7 @@ protected: std::string Log; }; +protected: struct File; friend struct File; diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 0ee631fe9..000bc8503 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -196,12 +196,12 @@ int cmProcess::ReportStatus() { case cmsysProcess_State_Starting: { - std::cerr << "cmProcess: Never started " + std::cerr << "cmProcess: Never started " << this->Command << " process.\n"; } break; case cmsysProcess_State_Error: { - std::cerr << "cmProcess: Error executing " << this->Command + std::cerr << "cmProcess: Error executing " << this->Command << " process: " << cmsysProcess_GetErrorString(this->Process) << "\n"; @@ -241,19 +241,19 @@ int cmProcess::ReportStatus() } break; case cmsysProcess_State_Executing: { - std::cerr << "cmProcess: Never terminated " << + std::cerr << "cmProcess: Never terminated " << this->Command << " process.\n"; } break; case cmsysProcess_State_Exited: { result = cmsysProcess_GetExitValue(this->Process); - std::cerr << "cmProcess: " << this->Command + std::cerr << "cmProcess: " << this->Command << " process exited with code " << result << "\n"; } break; case cmsysProcess_State_Expired: { - std::cerr << "cmProcess: killed " << this->Command + std::cerr << "cmProcess: killed " << this->Command << " process due to timeout.\n"; } break; case cmsysProcess_State_Killed: diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h index ff99ca23d..1479df05f 100644 --- a/Source/CTest/cmProcess.h +++ b/Source/CTest/cmProcess.h @@ -22,7 +22,7 @@ * * cmProcess wraps the kwsys process stuff in a c++ class. */ -class cmProcess +class cmProcess { public: cmProcess(); @@ -37,7 +37,7 @@ public: // return the process status int GetProcessStatus(); - // Report the status of the program + // Report the status of the program int ReportStatus(); int GetId() { return this->Id; } void SetId(int id) { this->Id = id;} diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt index 3349ebe96..96e28b491 100644 --- a/Source/CursesDialog/CMakeLists.txt +++ b/Source/CursesDialog/CMakeLists.txt @@ -10,7 +10,7 @@ # See the License for more information. #============================================================================= -SET( CURSES_SRCS +set( CURSES_SRCS CursesDialog/cmCursesBoolWidget CursesDialog/cmCursesCacheEntryComposite CursesDialog/cmCursesDummyWidget @@ -25,13 +25,13 @@ SET( CURSES_SRCS CursesDialog/ccmake ) -INCLUDE_DIRECTORIES(${CMake_SOURCE_DIR}/Source/CursesDialog/form +include_directories(${CMake_SOURCE_DIR}/Source/CursesDialog/form ${CMake_BINARY_DIR}/Source/CursesDialog/form) -INCLUDE_DIRECTORIES(${CURSES_INCLUDE_PATH}) +include_directories(${CURSES_INCLUDE_PATH}) -ADD_EXECUTABLE(ccmake ${CURSES_SRCS} ) -TARGET_LINK_LIBRARIES(ccmake CMakeLib) -TARGET_LINK_LIBRARIES(ccmake cmForm) +add_executable(ccmake ${CURSES_SRCS} ) +target_link_libraries(ccmake CMakeLib) +target_link_libraries(ccmake cmForm) -INSTALL_TARGETS(/bin ccmake) +install_targets(/bin ccmake) diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx index 9c4c5a577..fd15b9944 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.cxx +++ b/Source/CursesDialog/cmCursesBoolWidget.cxx @@ -12,7 +12,7 @@ #include "cmCursesBoolWidget.h" #include "cmCursesMainForm.h" -cmCursesBoolWidget::cmCursesBoolWidget(int width, int height, +cmCursesBoolWidget::cmCursesBoolWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { @@ -38,15 +38,15 @@ bool cmCursesBoolWidget::HandleInput(int& key, cmCursesMainForm*, WINDOW* w) this->SetValueAsBool(true); } - touchwin(w); - wrefresh(w); + touchwin(w); + wrefresh(w); return true; } else { return false; } - + } void cmCursesBoolWidget::SetValueAsBool(bool value) @@ -56,7 +56,7 @@ void cmCursesBoolWidget::SetValueAsBool(bool value) this->SetValue("ON"); } else - { + { this->SetValue("OFF"); } } @@ -68,7 +68,7 @@ bool cmCursesBoolWidget::GetValueAsBool() return true; } else - { + { return false; } } diff --git a/Source/CursesDialog/cmCursesBoolWidget.h b/Source/CursesDialog/cmCursesBoolWidget.h index 0d1d6a6cf..d2a25ca12 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.h +++ b/Source/CursesDialog/cmCursesBoolWidget.h @@ -19,7 +19,7 @@ class cmCursesBoolWidget : public cmCursesWidget { public: cmCursesBoolWidget(int width, int height, int left, int top); - + // Description: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 828384d71..c58d037f0 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -19,19 +19,19 @@ #include "../cmSystemTools.h" cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(const char* key, - int labelwidth, + int labelwidth, int entrywidth) : Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth) { this->Label = new cmCursesLabelWidget(this->LabelWidth, 1, 1, 1, key); this->IsNewLabel = new cmCursesLabelWidget(1, 1, 1, 1, " "); - this->Entry = 0; + this->Entry = 0; this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1); } cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( - const char* key, const cmCacheManager::CacheIterator& it, bool isNew, - int labelwidth, int entrywidth) + const char* key, const cmCacheManager::CacheIterator& it, bool isNew, + int labelwidth, int entrywidth) : Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth) { this->Label = new cmCursesLabelWidget(this->LabelWidth, 1, 1, 1, key); @@ -74,7 +74,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( it.GetValue()); break; case cmCacheManager::UNINITIALIZED: - cmSystemTools::Error("Found an undefined variable: ", it.GetName()); + cmSystemTools::Error("Found an undefined variable: ", it.GetName()); break; default: // TODO : put warning message here diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h index a40ea28e1..1357a02ec 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.h +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h @@ -20,7 +20,7 @@ class cmCursesCacheEntryComposite public: cmCursesCacheEntryComposite(const char* key, int labelwidth, int entrywidth); cmCursesCacheEntryComposite(const char* key, - const cmCacheManager::CacheIterator& it, + const cmCacheManager::CacheIterator& it, bool isNew, int labelwidth, int entrywidth); ~cmCursesCacheEntryComposite(); const char* GetValue(); diff --git a/Source/CursesDialog/cmCursesDummyWidget.cxx b/Source/CursesDialog/cmCursesDummyWidget.cxx index 1d8a45d79..60086a51b 100644 --- a/Source/CursesDialog/cmCursesDummyWidget.cxx +++ b/Source/CursesDialog/cmCursesDummyWidget.cxx @@ -11,7 +11,7 @@ ============================================================================*/ #include "cmCursesDummyWidget.h" -cmCursesDummyWidget::cmCursesDummyWidget(int width, int height, +cmCursesDummyWidget::cmCursesDummyWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { diff --git a/Source/CursesDialog/cmCursesDummyWidget.h b/Source/CursesDialog/cmCursesDummyWidget.h index cc4cc748d..9ac13652d 100644 --- a/Source/CursesDialog/cmCursesDummyWidget.h +++ b/Source/CursesDialog/cmCursesDummyWidget.h @@ -20,7 +20,7 @@ class cmCursesDummyWidget : public cmCursesWidget { public: cmCursesDummyWidget(int width, int height, int left, int top); - + // Description: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was diff --git a/Source/CursesDialog/cmCursesFilePathWidget.cxx b/Source/CursesDialog/cmCursesFilePathWidget.cxx index 13bbcc936..01db014bb 100644 --- a/Source/CursesDialog/cmCursesFilePathWidget.cxx +++ b/Source/CursesDialog/cmCursesFilePathWidget.cxx @@ -11,7 +11,7 @@ ============================================================================*/ #include "cmCursesFilePathWidget.h" -cmCursesFilePathWidget::cmCursesFilePathWidget(int width, int height, +cmCursesFilePathWidget::cmCursesFilePathWidget(int width, int height, int left, int top) : cmCursesPathWidget(width, height, left, top) { diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h index 7556d74b5..3cba856ab 100644 --- a/Source/CursesDialog/cmCursesForm.h +++ b/Source/CursesDialog/cmCursesForm.h @@ -20,7 +20,7 @@ class cmCursesForm public: cmCursesForm(); virtual ~cmCursesForm(); - + // Description: // Handle user input. virtual void HandleInput() = 0; @@ -59,7 +59,7 @@ public: } static cmCursesForm* CurrentForm; - + protected: diff --git a/Source/CursesDialog/cmCursesLabelWidget.cxx b/Source/CursesDialog/cmCursesLabelWidget.cxx index 2ad4813c6..b5ed3128c 100644 --- a/Source/CursesDialog/cmCursesLabelWidget.cxx +++ b/Source/CursesDialog/cmCursesLabelWidget.cxx @@ -11,7 +11,7 @@ ============================================================================*/ #include "cmCursesLabelWidget.h" -cmCursesLabelWidget::cmCursesLabelWidget(int width, int height, +cmCursesLabelWidget::cmCursesLabelWidget(int width, int height, int left, int top, const std::string& name) : cmCursesWidget(width, height, left, top) diff --git a/Source/CursesDialog/cmCursesLabelWidget.h b/Source/CursesDialog/cmCursesLabelWidget.h index bbcc58618..cc32d11ea 100644 --- a/Source/CursesDialog/cmCursesLabelWidget.h +++ b/Source/CursesDialog/cmCursesLabelWidget.h @@ -23,7 +23,7 @@ public: cmCursesLabelWidget(int width, int height, int left, int top, const std::string& name); virtual ~cmCursesLabelWidget(); - + // Description: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index 0e2cd229f..057f8f3d8 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -19,10 +19,10 @@ inline int ctrl(int z) { return (z&037); -} +} -cmCursesLongMessageForm::cmCursesLongMessageForm(std::vector - const& messages, const char* +cmCursesLongMessageForm::cmCursesLongMessageForm(std::vector + const& messages, const char* title) { // Append all messages into on big string @@ -84,7 +84,7 @@ void cmCursesLongMessageForm::UpdateStatusBar() curses_move(y-4,0); attron(A_STANDOUT); printw(bar); - attroff(A_STANDOUT); + attroff(A_STANDOUT); curses_move(y-3,0); printw(version); pos_form_cursor(this->Form); @@ -94,7 +94,7 @@ void cmCursesLongMessageForm::PrintKeys() { int x,y; getmaxyx(stdscr, y, x); - if ( x < cmCursesMainForm::MIN_WIDTH || + if ( x < cmCursesMainForm::MIN_WIDTH || y < cmCursesMainForm::MIN_HEIGHT ) { return; @@ -105,7 +105,7 @@ void cmCursesLongMessageForm::PrintKeys() curses_move(y-2,0); printw(firstLine); pos_form_cursor(this->Form); - + } void cmCursesLongMessageForm::Render(int, int, int, int) @@ -155,7 +155,7 @@ void cmCursesLongMessageForm::Render(int, int, int, int) this->UpdateStatusBar(); this->PrintKeys(); - touchwin(stdscr); + touchwin(stdscr); refresh(); } @@ -200,8 +200,8 @@ void cmCursesLongMessageForm::HandleInput() this->UpdateStatusBar(); this->PrintKeys(); - touchwin(stdscr); - wrefresh(stdscr); + touchwin(stdscr); + wrefresh(stdscr); } } diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h b/Source/CursesDialog/cmCursesLongMessageForm.h index 341f9c6c6..1e86974f2 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.h +++ b/Source/CursesDialog/cmCursesLongMessageForm.h @@ -21,10 +21,10 @@ class cmCursesCacheEntryComposite; class cmCursesLongMessageForm : public cmCursesForm { public: - cmCursesLongMessageForm(std::vector const& messages, + cmCursesLongMessageForm(std::vector const& messages, const char* title); virtual ~cmCursesLongMessageForm(); - + // Description: // Handle user input. virtual void HandleInput(); diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 3e191b497..883a2b3d6 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -30,12 +30,12 @@ class cmCursesMainForm : public cmCursesForm public: cmCursesMainForm(std::vector const& args, int initwidth); virtual ~cmCursesMainForm(); - + /** * Set the widgets which represent the cache entries. */ void InitializeUI(); - + /** * Handle user input. */ @@ -65,7 +65,7 @@ public: * exception is during a resize. The optional argument specifies the * string to be displayed in the status bar. */ - virtual void UpdateStatusBar() { this->UpdateStatusBar(0); } + virtual void UpdateStatusBar() { this->UpdateStatusBar(0); } virtual void UpdateStatusBar(const char* message); /** @@ -90,7 +90,7 @@ public: int Configure(int noconfigure=0); /** - * Used to generate + * Used to generate */ int Generate(); @@ -98,7 +98,7 @@ public: * Used by main program */ int LoadCache(const char *dir); - + /** * Progress callback */ diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx index b113c2e6a..14c325bcb 100644 --- a/Source/CursesDialog/cmCursesPathWidget.cxx +++ b/Source/CursesDialog/cmCursesPathWidget.cxx @@ -14,7 +14,7 @@ #include "cmCursesMainForm.h" #include "cmSystemTools.h" -cmCursesPathWidget::cmCursesPathWidget(int width, int height, +cmCursesPathWidget::cmCursesPathWidget(int width, int height, int left, int top) : cmCursesStringWidget(width, height, left, top) { @@ -75,8 +75,8 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w) } this->SetString(cstr.c_str()); - touchwin(w); - wrefresh(w); + touchwin(w); + wrefresh(w); form_driver(form, REQ_END_FIELD); this->LastGlob = glob; this->LastString = cstr; diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index d363f0090..bd1ff71c6 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -15,9 +15,9 @@ inline int ctrl(int z) { return (z&037); -} +} -cmCursesStringWidget::cmCursesStringWidget(int width, int height, +cmCursesStringWidget::cmCursesStringWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { @@ -63,7 +63,7 @@ void cmCursesStringWidget::OnType(int& key, cmCursesMainForm* fm, WINDOW*) form_driver(fm->GetForm(), key); } -bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, +bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) { int x,y; @@ -90,7 +90,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, getmaxyx(stdscr, y, x); // If window too small, handle 'q' only - if ( x < cmCursesMainForm::MIN_WIDTH || + if ( x < cmCursesMainForm::MIN_WIDTH || y < cmCursesMainForm::MIN_HEIGHT ) { // quit @@ -100,7 +100,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, } else { - key=getch(); + key=getch(); continue; } } @@ -111,7 +111,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, return false; } // 10 == enter - if (key == 10 || key == KEY_ENTER) + if (key == 10 || key == KEY_ENTER) { this->OnReturn(fm, w); } @@ -121,7 +121,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, key == KEY_PPAGE || key == ctrl('u')) { this->InEdit = false; - delete[] this->OriginalString; + delete[] this->OriginalString; // trick to force forms to update the field buffer form_driver(form, REQ_NEXT_FIELD); form_driver(form, REQ_PREV_FIELD); @@ -136,8 +136,8 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, fm->PrintKeys(); this->SetString(this->OriginalString); delete[] this->OriginalString; - touchwin(w); - wrefresh(w); + touchwin(w); + wrefresh(w); return true; } } @@ -165,7 +165,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, { form_driver(form, REQ_END_FIELD); } - else if ( key == 127 || + else if ( key == 127 || key == KEY_BACKSPACE ) { if ( form->curcol > 0 ) @@ -175,7 +175,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, } else if ( key == ctrl('d') ||key == KEY_DC ) { - if ( form->curcol > 0 ) + if ( form->curcol >= 0 ) { form_driver(form, REQ_DEL_CHAR); } @@ -186,10 +186,10 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, } if ( !this->Done ) { - touchwin(w); - wrefresh(w); - - key=getch(); + touchwin(w); + wrefresh(w); + + key=getch(); } } return true; @@ -214,7 +214,7 @@ bool cmCursesStringWidget::PrintKeys() { int x,y; getmaxyx(stdscr, y, x); - if ( x < cmCursesMainForm::MIN_WIDTH || + if ( x < cmCursesMainForm::MIN_WIDTH || y < cmCursesMainForm::MIN_HEIGHT ) { return false; diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h index cd54f249b..e939049df 100644 --- a/Source/CursesDialog/cmCursesStringWidget.h +++ b/Source/CursesDialog/cmCursesStringWidget.h @@ -26,7 +26,7 @@ class cmCursesStringWidget : public cmCursesWidget { public: cmCursesStringWidget(int width, int height, int left, int top); - + /** * Handle user input. Called by the container of this widget * when this widget has focus. Returns true if the input was diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h index ee36af613..952c67a86 100644 --- a/Source/CursesDialog/cmCursesWidget.h +++ b/Source/CursesDialog/cmCursesWidget.h @@ -22,7 +22,7 @@ class cmCursesWidget public: cmCursesWidget(int width, int height, int left, int top); virtual ~cmCursesWidget(); - + /** * Handle user input. Called by the container of this widget * when this widget has focus. Returns true if the input was diff --git a/Source/CursesDialog/form/CMakeLists.txt b/Source/CursesDialog/form/CMakeLists.txt index 2435f3935..4e07fa0ff 100644 --- a/Source/CursesDialog/form/CMakeLists.txt +++ b/Source/CursesDialog/form/CMakeLists.txt @@ -9,14 +9,14 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -PROJECT(CMAKE_FORM) +project(CMAKE_FORM) -INCLUDE_REGULAR_EXPRESSION("^.*$") -INCLUDE_DIRECTORIES(${CURSES_INCLUDE_PATH} "${CMAKE_CURRENT_BINARY_DIR}") +include_regular_expression("^.*$") +include_directories(${CURSES_INCLUDE_PATH} "${CMAKE_CURRENT_BINARY_DIR}") -CONFIGURE_FILE(cmFormConfigure.h.in "${CMAKE_CURRENT_BINARY_DIR}/cmFormConfigure.h") +configure_file(cmFormConfigure.h.in "${CMAKE_CURRENT_BINARY_DIR}/cmFormConfigure.h") -SET( FORM_SRCS +set( FORM_SRCS fld_arg.c fld_attr.c fld_current.c @@ -58,9 +58,9 @@ SET( FORM_SRCS fty_regex.c ) -INCLUDE_DIRECTORIES(${CMAKE_FORM_SOURCE_DIR}) -ADD_LIBRARY(cmForm ${FORM_SRCS} ) -TARGET_LINK_LIBRARIES(cmForm ${CURSES_LIBRARY}) -IF(CURSES_EXTRA_LIBRARY) - TARGET_LINK_LIBRARIES(cmForm ${CURSES_EXTRA_LIBRARY}) -ENDIF(CURSES_EXTRA_LIBRARY) +include_directories(${CMAKE_FORM_SOURCE_DIR}) +add_library(cmForm ${FORM_SRCS} ) +target_link_libraries(cmForm ${CURSES_LIBRARY}) +if(CURSES_EXTRA_LIBRARY) + target_link_libraries(cmForm ${CURSES_EXTRA_LIBRARY}) +endif() diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 07ec10674..1684fb229 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -9,115 +9,133 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -PROJECT(QtDialog) -SET(QT_MIN_VERSION "4.4.0") -FIND_PACKAGE(Qt4 REQUIRED) -IF(NOT QT4_FOUND) - MESSAGE(SEND_ERROR "Failed to find Qt 4.4 or greater.") -ELSE(NOT QT4_FOUND) +project(QtDialog) +find_package(Qt5Widgets QUIET) +if (Qt5Widgets_FOUND) + include_directories(${Qt5Widgets_INCLUDE_DIRS}) + add_definitions(${Qt5Widgets_DEFINITONS}) + macro(qt4_wrap_ui) + qt5_wrap_ui(${ARGN}) + endmacro() + macro(qt4_wrap_cpp) + qt5_wrap_cpp(${ARGN}) + endmacro() + macro(qt4_add_resources) + qt5_add_resources(${ARGN}) + endmacro() + set(QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) + # Remove this when the minimum version of Qt is 4.6. + add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) - INCLUDE(${QT_USE_FILE}) - SET(CMAKE_PACKAGE_QTGUI TRUE) - SET(SRCS - AddCacheEntry.cxx - AddCacheEntry.h - CMakeSetup.cxx - CMakeSetupDialog.cxx - CMakeSetupDialog.h - FirstConfigure.cxx - FirstConfigure.h - QCMake.cxx - QCMake.h - QCMakeCacheView.cxx - QCMakeCacheView.h - QCMakeWidgets.cxx - QCMakeWidgets.h - QMacInstallDialog.cxx - QMacInstallDialog.h - ) - QT4_WRAP_UI(UI_SRCS - CMakeSetupDialog.ui - Compilers.ui - CrossCompiler.ui - AddCacheEntry.ui - MacInstallDialog.ui - ) - QT4_WRAP_CPP(MOC_SRCS - AddCacheEntry.h - Compilers.h - CMakeSetupDialog.h - FirstConfigure.h - QCMake.h - QCMakeCacheView.h - QCMakeWidgets.h - QMacInstallDialog.h - ) - QT4_ADD_RESOURCES(RC_SRCS CMakeSetup.qrc) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") +else() + set(QT_MIN_VERSION "4.4.0") + find_package(Qt4 REQUIRED) + if(NOT QT4_FOUND) + message(SEND_ERROR "Failed to find Qt 4.4 or greater.") + return() + endif() - SET(SRCS ${SRCS} ${UI_SRCS} ${MOC_SRCS} ${RC_SRCS}) - IF(Q_WS_WIN) - SET(SRCS ${SRCS} CMakeSetup.rc) - ENDIF(Q_WS_WIN) - IF(Q_WS_MAC) - SET(SRCS ${SRCS} CMakeSetup.icns) - SET(MACOSX_BUNDLE_ICON_FILE CMakeSetup.icns) - SET_SOURCE_FILES_PROPERTIES(CMakeSetup.icns PROPERTIES - MACOSX_PACKAGE_LOCATION Resources) - ENDIF(Q_WS_MAC) + include(${QT_USE_FILE}) +endif() - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +set(SRCS + AddCacheEntry.cxx + AddCacheEntry.h + CMakeSetup.cxx + CMakeSetupDialog.cxx + CMakeSetupDialog.h + FirstConfigure.cxx + FirstConfigure.h + QCMake.cxx + QCMake.h + QCMakeCacheView.cxx + QCMakeCacheView.h + QCMakeWidgets.cxx + QCMakeWidgets.h + QMacInstallDialog.cxx + QMacInstallDialog.h + ) +QT4_WRAP_UI(UI_SRCS + CMakeSetupDialog.ui + Compilers.ui + CrossCompiler.ui + AddCacheEntry.ui + MacInstallDialog.ui + ) +QT4_WRAP_CPP(MOC_SRCS + AddCacheEntry.h + Compilers.h + CMakeSetupDialog.h + FirstConfigure.h + QCMake.h + QCMakeCacheView.h + QCMakeWidgets.h + QMacInstallDialog.h + ) +QT4_ADD_RESOURCES(RC_SRCS CMakeSetup.qrc) - ADD_EXECUTABLE(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS}) - TARGET_LINK_LIBRARIES(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES}) - IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4) - IF(APPLE) - SET_TARGET_PROPERTIES(cmake-gui PROPERTIES - OUTPUT_NAME ${CMAKE_BUNDLE_NAME}) - ENDIF(APPLE) - SET(CMAKE_INSTALL_DESTINATION_ARGS - BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}") - ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4) +set(SRCS ${SRCS} ${UI_SRCS} ${MOC_SRCS} ${RC_SRCS}) +if(WIN32) + set(SRCS ${SRCS} CMakeSetup.rc) +endif() +if(APPLE) + set(SRCS ${SRCS} CMakeSetup.icns) + set(MACOSX_BUNDLE_ICON_FILE CMakeSetup.icns) + set_source_files_properties(CMakeSetup.icns PROPERTIES + MACOSX_PACKAGE_LOCATION Resources) +endif() - INSTALL(TARGETS cmake-gui RUNTIME DESTINATION bin ${CMAKE_INSTALL_DESTINATION_ARGS}) +set(CMAKE_INCLUDE_CURRENT_DIR ON) - IF(UNIX) - # install a desktop file so CMake appears in the application start menu - # with an icon - INSTALL(FILES CMake.desktop DESTINATION share/applications ) - INSTALL(FILES CMakeSetup32.png DESTINATION share/pixmaps ) - INSTALL(FILES cmakecache.xml DESTINATION share/mime/packages ) - ENDIF(UNIX) +add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS}) +target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES}) - IF(APPLE) - SET(CMAKE_POSTFLIGHT_SCRIPT - "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh") - SET(CMAKE_POSTUPGRADE_SCRIPT - "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh") - configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postflight.sh.in" - "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh") - configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postupgrade.sh.in" - "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh") - INSTALL(CODE "execute_process(COMMAND ln -s \"../MacOS/${CMAKE_BUNDLE_NAME}\" cmake-gui - WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)") - ENDIF(APPLE) +if(APPLE) + set_target_properties(cmake-gui PROPERTIES + OUTPUT_NAME ${CMAKE_BUNDLE_NAME}) +endif() +set(CMAKE_INSTALL_DESTINATION_ARGS + BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}") - if(APPLE OR WIN32) - # install rules for including 3rd party libs such as Qt - # if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation - set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/cmake-gui${CMAKE_EXECUTABLE_SUFFIX}") - if(APPLE) - set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/${CMAKE_BUNDLE_NAME}") - endif(APPLE) - install(CODE " - include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\") - set(BU_CHMOD_BUNDLE_ITEMS ON) - fixup_bundle(\"${fixup_exe}\" \"\" \"${QT_LIBRARY_DIR};${QT_BINARY_DIR}\") - ") - endif(APPLE OR WIN32) +install(TARGETS cmake-gui RUNTIME DESTINATION bin ${CMAKE_INSTALL_DESTINATION_ARGS}) - CONFIGURE_FILE("${QtDialog_SOURCE_DIR}/QtDialogCPack.cmake.in" - "${QtDialog_BINARY_DIR}/QtDialogCPack.cmake" @ONLY) -ENDIF(NOT QT4_FOUND) +if(UNIX) + # install a desktop file so CMake appears in the application start menu + # with an icon + install(FILES CMake.desktop DESTINATION share/applications ) + install(FILES CMakeSetup32.png DESTINATION share/pixmaps ) + install(FILES cmakecache.xml DESTINATION share/mime/packages ) +endif() +if(APPLE) + set(CMAKE_POSTFLIGHT_SCRIPT + "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh") + set(CMAKE_POSTUPGRADE_SCRIPT + "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh") + configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postflight.sh.in" + "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh") + configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postupgrade.sh.in" + "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh") + install(CODE "execute_process(COMMAND ln -s \"../MacOS/${CMAKE_BUNDLE_NAME}\" cmake-gui + WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)") +endif() + +if(APPLE OR WIN32) + # install rules for including 3rd party libs such as Qt + # if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation + set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/cmake-gui${CMAKE_EXECUTABLE_SUFFIX}") + if(APPLE) + set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/${CMAKE_BUNDLE_NAME}") + endif() + install(CODE " + include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\") + set(BU_CHMOD_BUNDLE_ITEMS ON) + fixup_bundle(\"${fixup_exe}\" \"\" \"${QT_LIBRARY_DIR};${QT_BINARY_DIR}\") + ") +endif() + +set(CMAKE_PACKAGE_QTGUI TRUE) +configure_file("${QtDialog_SOURCE_DIR}/QtDialogCPack.cmake.in" + "${QtDialog_BINARY_DIR}/QtDialogCPack.cmake" @ONLY) diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index c942bc4ad..01893f589 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -99,15 +99,15 @@ int main(int argc, char** argv) } QApplication app(argc, argv); - + // clean out standard Qt paths for plugins, which we don't use anyway // when creating Mac bundles, it potentially causes problems foreach(QString p, QApplication::libraryPaths()) { QApplication::removeLibraryPath(p); } - - // if arg for install + + // if arg for install for(int i =0; i < argc; i++) { if(strcmp(argv[i], "--mac-install") == 0) @@ -117,7 +117,7 @@ int main(int argc, char** argv) return 0; } } - // tell the cmake library where cmake is + // tell the cmake library where cmake is QDir cmExecDir(QApplication::applicationDirPath()); #if defined(Q_OS_MAC) cmExecDir.cd("../../../"); @@ -131,7 +131,7 @@ int main(int argc, char** argv) QString transfile = QString("cmake_%1").arg(QLocale::system().name()); translator.load(transfile, translationsDir.path()); app.installTranslator(&translator); - + // app setup app.setApplicationName("CMakeSetup"); app.setOrganizationName("Kitware"); @@ -139,16 +139,16 @@ int main(int argc, char** argv) appIcon.addFile(":/Icons/CMakeSetup32.png"); appIcon.addFile(":/Icons/CMakeSetup128.png"); app.setWindowIcon(appIcon); - + CMakeSetupDialog dialog; dialog.show(); - + cmsys::CommandLineArguments arg; arg.Initialize(argc, argv); std::string binaryDirectory; std::string sourceDirectory; typedef cmsys::CommandLineArguments argT; - arg.AddArgument("-B", argT::CONCAT_ARGUMENT, + arg.AddArgument("-B", argT::CONCAT_ARGUMENT, &binaryDirectory, "Binary Directory"); arg.AddArgument("-H", argT::CONCAT_ARGUMENT, &sourceDirectory, "Source Directory"); @@ -199,7 +199,7 @@ int main(int argc, char** argv) } } } - + return app.exec(); } diff --git a/Source/QtDialog/Compilers.h b/Source/QtDialog/Compilers.h index e9c90a504..3f7b83411 100644 --- a/Source/QtDialog/Compilers.h +++ b/Source/QtDialog/Compilers.h @@ -10,7 +10,7 @@ class Compilers : public QWidget, public Ui::Compilers { Q_OBJECT public: - Compilers(QWidget* p=NULL) : + Compilers(QWidget* p=NULL) : QWidget(p) { this->setupUi(this); diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx index 2a79877da..6de9f00cc 100644 --- a/Source/QtDialog/FirstConfigure.cxx +++ b/Source/QtDialog/FirstConfigure.cxx @@ -25,7 +25,7 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p) l->addWidget(this->CompilerSetupOptions[1]); l->addWidget(this->CompilerSetupOptions[2]); l->addWidget(this->CompilerSetupOptions[3]); - + this->CompilerSetupOptions[0]->setChecked(true); QObject::connect(this->CompilerSetupOptions[0], SIGNAL(toggled(bool)), @@ -47,7 +47,7 @@ void StartCompilerSetup::setGenerators(const QStringList& gens) this->GeneratorOptions->clear(); this->GeneratorOptions->addItems(gens); }; - + void StartCompilerSetup::setCurrentGenerator(const QString& gen) { int idx = this->GeneratorOptions->findText(gen); @@ -237,7 +237,7 @@ void CrossCompilerSetup::setProcessor(const QString& t) { this->systemProcessor->setText(t); } - + QString CrossCompilerSetup::getFindRoot() const { return this->crossFindRoot->text(); @@ -313,10 +313,10 @@ FirstConfigure::FirstConfigure() this->mNativeCompilerSetupPage = new NativeCompilerSetup(this); this->setPage(NativeSetup, this->mNativeCompilerSetupPage); - + this->mCrossCompilerSetupPage = new CrossCompilerSetup(this); this->setPage(CrossSetup, this->mCrossCompilerSetupPage); - + this->mToolchainCompilerSetupPage = new ToolchainCompilerSetup(this); this->setPage(ToolchainSetup, this->mToolchainCompilerSetupPage); } @@ -370,14 +370,14 @@ void FirstConfigure::loadFromSettings() void FirstConfigure::saveToSettings() { QSettings settings; - + // save generator settings.beginGroup("Settings/StartPath"); QString lastGen = this->mStartCompilerSetupPage->getGenerator(); settings.setValue("LastGenerator", lastGen); settings.endGroup(); - // save compiler setup + // save compiler setup settings.beginGroup("Settings/Compiler"); settings.setValue("CCompiler", this->mNativeCompilerSetupPage->getCCompiler()); settings.setValue("CXXCompiler", this->mNativeCompilerSetupPage->getCXXCompiler()); @@ -419,7 +419,7 @@ bool FirstConfigure::crossCompilerToolChainFile() const { return this->mStartCompilerSetupPage->crossCompilerToolChainFile(); } - + QString FirstConfigure::getCrossCompilerToolChainFile() const { return this->mToolchainCompilerSetupPage->toolchainFile(); diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h index f4e368bfc..be390b0fd 100644 --- a/Source/QtDialog/FirstConfigure.h +++ b/Source/QtDialog/FirstConfigure.h @@ -30,14 +30,14 @@ class StartCompilerSetup : public QWizardPage void setGenerators(const QStringList& gens); void setCurrentGenerator(const QString& gen); QString getGenerator() const; - + bool defaultSetup() const; bool compilerSetup() const; bool crossCompilerSetup() const; bool crossCompilerToolChainFile() const; int nextId() const; - + signals: void selectionChanged(); @@ -56,7 +56,7 @@ class NativeCompilerSetup : public QWizardPage, protected Ui::Compilers public: NativeCompilerSetup(QWidget* p); ~NativeCompilerSetup(); - + QString getCCompiler() const; void setCCompiler(const QString&); @@ -65,7 +65,7 @@ class NativeCompilerSetup : public QWizardPage, protected Ui::Compilers QString getFortranCompiler() const; void setFortranCompiler(const QString&); - + int nextId() const { return -1; } }; @@ -76,13 +76,13 @@ class CrossCompilerSetup : public QWizardPage, protected Ui::CrossCompiler public: CrossCompilerSetup(QWidget* p); ~CrossCompilerSetup(); - + QString getSystem() const; void setSystem(const QString&); - + QString getVersion() const; void setVersion(const QString&); - + QString getProcessor() const; void setProcessor(const QString&); @@ -94,7 +94,7 @@ class CrossCompilerSetup : public QWizardPage, protected Ui::CrossCompiler QString getFortranCompiler() const; void setFortranCompiler(const QString&); - + QString getFindRoot() const; void setFindRoot(const QString&); @@ -104,14 +104,14 @@ class CrossCompilerSetup : public QWizardPage, protected Ui::CrossCompiler ONLY, NEVER }; - + int getProgramMode() const; void setProgramMode(int); int getLibraryMode() const; void setLibraryMode(int); int getIncludeMode() const; void setIncludeMode(int); - + int nextId() const { return -1; } }; @@ -127,7 +127,7 @@ class ToolchainCompilerSetup : public QWizardPage void setToolchainFile(const QString&); int nextId() const { return -1; } - + protected: QCMakeFilePathEditor* ToolchainFile; }; @@ -151,7 +151,7 @@ public: QString getCCompiler() const; QString getCXXCompiler() const; QString getFortranCompiler() const; - + QString getSystemName() const; QString getSystemVersion() const; QString getSystemProcessor() const; @@ -159,7 +159,7 @@ public: QString getCrossProgramMode() const; QString getCrossLibraryMode() const; QString getCrossIncludeMode() const; - + QString getCrossCompilerToolChainFile() const; void loadFromSettings(); diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 8554ff894..0d0118164 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -32,9 +32,9 @@ QCMake::QCMake(QObject* p) this->WarnUnusedMode = false; qRegisterMetaType(); qRegisterMetaType(); - + QDir execDir(QCoreApplication::applicationDirPath()); - + #if defined(Q_OS_MAC) if(execDir.exists("../bin/cmake")) { @@ -45,7 +45,7 @@ QCMake::QCMake(QObject* p) execDir.cd("../../../"); // path to cmake in build directory (need to fix for deployment) } #endif - + QString cmakeCommand = QString("cmake")+QString::fromLocal8Bit(cmSystemTools::GetExecutableExtension()); cmakeCommand = execDir.filePath(cmakeCommand); @@ -58,7 +58,7 @@ QCMake::QCMake(QObject* p) this->CMakeInstance->SetCMakeCommand(cmakeCommand.toLocal8Bit().data()); #if defined(Q_OS_MAC) this->CMakeInstance->SetCMakeEditCommand("cmake-gui.app/Contents/MacOS/cmake-gui"); -#else +#else this->CMakeInstance->SetCMakeEditCommand("cmake-gui"); #endif this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this); @@ -96,7 +96,7 @@ void QCMake::loadCache(const QString& dir) void QCMake::setSourceDirectory(const QString& _dir) { - QString dir = + QString dir = QString::fromLocal8Bit(cmSystemTools::GetActualCaseForPath(_dir.toLocal8Bit().data()).c_str()); if(this->SourceDirectory != dir) { @@ -107,7 +107,7 @@ void QCMake::setSourceDirectory(const QString& _dir) void QCMake::setBinaryDirectory(const QString& _dir) { - QString dir = + QString dir = QString::fromLocal8Bit(cmSystemTools::GetActualCaseForPath(_dir.toLocal8Bit().data()).c_str()); if(this->BinaryDirectory != dir) { @@ -126,7 +126,7 @@ void QCMake::setBinaryDirectory(const QString& _dir) "Please check the permissions of the directory you are trying to run CMake on."); } } - + QCMakePropertyList props = this->properties(); emit this->propertiesChanged(props); cmCacheManager::CacheIterator itm = cachem->NewIterator(); @@ -202,7 +202,7 @@ void QCMake::generate() emit this->generateDone(err); } - + void QCMake::setProperties(const QCMakePropertyList& newProps) { QCMakePropertyList props = newProps; @@ -251,7 +251,7 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) cachem->RemoveCacheEntry(s.toLocal8Bit().data()); } - + // add some new properites foreach(QCMakeProperty s, props) { @@ -286,7 +286,7 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) cmCacheManager::FILEPATH); } } - + cachem->SaveCache(this->BinaryDirectory.toLocal8Bit().data()); } @@ -339,7 +339,7 @@ QCMakePropertyList QCMake::properties() const return ret; } - + void QCMake::interrupt() { this->InterruptFlag.ref(); @@ -348,7 +348,11 @@ void QCMake::interrupt() bool QCMake::interruptCallback(void* cd) { QCMake* self = reinterpret_cast(cd); +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) return self->InterruptFlag; +#else + return self->InterruptFlag.load(); +#endif } void QCMake::progressCallback(const char* msg, float percent, void* cd) @@ -416,7 +420,7 @@ void QCMake::reloadCache() props = this->properties(); emit this->propertiesChanged(props); } - + void QCMake::setDebugOutput(bool flag) { if(flag != this->CMakeInstance->GetDebugOutput()) diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index 0d68586f2..93ac8ab00 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -38,12 +38,12 @@ struct QCMakeProperty QString Help; PropertyType Type; bool Advanced; - bool operator==(const QCMakeProperty& other) const - { + bool operator==(const QCMakeProperty& other) const + { return this->Key == other.Key; } - bool operator<(const QCMakeProperty& other) const - { + bool operator<(const QCMakeProperty& other) const + { return this->Key < other.Key; } }; @@ -56,7 +56,7 @@ Q_DECLARE_METATYPE(QCMakeProperty) Q_DECLARE_METATYPE(QCMakePropertyList) /// Qt API for CMake library. -/// Wrapper like class allows for easier integration with +/// Wrapper like class allows for easier integration with /// Qt features such as, signal/slot connections, multi-threading, etc.. class QCMake : public QObject { @@ -136,7 +136,7 @@ protected: static bool interruptCallback(void*); static void progressCallback(const char* msg, float percent, void* cd); - static void errorCallback(const char* msg, const char* title, + static void errorCallback(const char* msg, const char* title, bool&, void* cd); bool SuppressDevWarnings; bool WarnUninitializedMode; diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 72e9b2464..031350ba4 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -64,7 +64,7 @@ protected: return true; } } - + return false; } }; @@ -73,11 +73,11 @@ protected: class QCMakeAdvancedFilter : public QSortFilterProxyModel { public: - QCMakeAdvancedFilter(QObject* o) + QCMakeAdvancedFilter(QObject* o) : QSortFilterProxyModel(o), ShowAdvanced(false) {} - void setShowAdvanced(bool f) - { + void setShowAdvanced(bool f) + { this->ShowAdvanced = f; this->invalidate(); } @@ -102,7 +102,7 @@ protected: } return false; } - + // check children int num = m->rowCount(idx); for(int i=0; isetItemDelegate(delegate); - + this->setUniformRowHeights(true); - + this->setEditTriggers(QAbstractItemView::AllEditTriggers); // tab, backtab doesn't step through items @@ -153,13 +153,13 @@ bool QCMakeCacheView::event(QEvent* e) } return QTreeView::event(e); } - + QCMakeCacheModel* QCMakeCacheView::cacheModel() const { return this->CacheModel; } - -QModelIndex QCMakeCacheView::moveCursor(CursorAction act, + +QModelIndex QCMakeCacheView::moveCursor(CursorAction act, Qt::KeyboardModifiers mod) { // want home/end to go to begin/end of rows, not columns @@ -173,7 +173,7 @@ QModelIndex QCMakeCacheView::moveCursor(CursorAction act, } return QTreeView::moveCursor(act, mod); } - + void QCMakeCacheView::setShowAdvanced(bool s) { #if QT_VERSION >= 040300 @@ -224,7 +224,7 @@ void QCMakeCacheModel::clear() { this->QStandardItemModel::clear(); this->NewPropertyCount = 0; - + QStringList labels; labels << tr("Name") << tr("Value"); this->setHorizontalHeaderLabels(labels); @@ -281,7 +281,7 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) this->breakProperties(newProps2, newPropsTree2); QStandardItem* root = this->invisibleRootItem(); - + foreach(QString key, newPropsTree.keys()) { QCMakePropertyList props2 = newPropsTree[key]; @@ -308,12 +308,12 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) this->setPropertyData(this->indexFromItem(items[0]), prop, true); } } - + foreach(QString key, newPropsTree2.keys()) { QCMakePropertyList props2 = newPropsTree2[key]; - QStandardItem* parentItem = + QStandardItem* parentItem = new QStandardItem(key.isEmpty() ? tr("Ungrouped Entries") : key); root->appendRow(parentItem); parentItem->setData(1, GroupRole); @@ -330,7 +330,7 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) } } } - + this->blockSignals(b); this->reset(); } @@ -361,7 +361,7 @@ void QCMakeCacheModel::setViewType(QCMakeCacheModel::ViewType t) this->reset(); } -void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1, +void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1, const QCMakeProperty& prop, bool isNew) { QModelIndex idx2 = idx1.sibling(idx1.row(), 1); @@ -370,7 +370,7 @@ void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1, this->setData(idx1, prop.Help, QCMakeCacheModel::HelpRole); this->setData(idx1, prop.Type, QCMakeCacheModel::TypeRole); this->setData(idx1, prop.Advanced, QCMakeCacheModel::AdvancedRole); - + if(prop.Type == QCMakeProperty::BOOL) { int check = prop.Value.toBool() ? Qt::Checked : Qt::Unchecked; @@ -394,7 +394,7 @@ void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1, } } -void QCMakeCacheModel::getPropertyData(const QModelIndex& idx1, +void QCMakeCacheModel::getPropertyData(const QModelIndex& idx1, QCMakeProperty& prop) const { QModelIndex idx2 = idx1.sibling(idx1.row(), 1); @@ -457,7 +457,7 @@ void QCMakeCacheModel::breakProperties(const QSet& props, } result = tmp; } - + QCMakePropertyList QCMakeCacheModel::properties() const { QCMakePropertyList props; @@ -488,9 +488,13 @@ QCMakePropertyList QCMakeCacheModel::properties() const this->getPropertyData(idx, prop); props.append(prop); } - + // go to the next in the tree - while(!idxs.isEmpty() && !idxs.last().sibling(idxs.last().row()+1, 0).isValid()) + while(!idxs.isEmpty() && ( +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 3) + (idxs.last().row()+1) >= rowCount(idxs.last().parent()) || +#endif + !idxs.last().sibling(idxs.last().row()+1, 0).isValid())) { idxs.removeLast(); } @@ -503,7 +507,7 @@ QCMakePropertyList QCMakeCacheModel::properties() const return props; } - + bool QCMakeCacheModel::insertProperty(QCMakeProperty::PropertyType t, const QString& name, const QString& description, const QVariant& value, bool advanced) @@ -554,7 +558,7 @@ Qt::ItemFlags QCMakeCacheModel::flags (const QModelIndex& idx) const QModelIndex QCMakeCacheModel::buddy(const QModelIndex& idx) const { - if(!this->hasChildren(idx) && + if(!this->hasChildren(idx) && this->data(idx, TypeRole).toInt() != QCMakeProperty::BOOL) { return this->index(idx.row(), 1, idx.parent()); @@ -572,7 +576,7 @@ void QCMakeCacheModelDelegate::setFileDialogFlag(bool f) this->FileDialogFlag = f; } -QWidget* QCMakeCacheModelDelegate::createEditor(QWidget* p, +QWidget* QCMakeCacheModelDelegate::createEditor(QWidget* p, const QStyleOptionViewItem&, const QModelIndex& idx) const { QModelIndex var = idx.sibling(idx.row(), 0); @@ -584,7 +588,7 @@ QWidget* QCMakeCacheModelDelegate::createEditor(QWidget* p, else if(type == QCMakeProperty::PATH) { QCMakePathEditor* editor = - new QCMakePathEditor(p, + new QCMakePathEditor(p, var.data(Qt::DisplayRole).toString()); QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this, SLOT(setFileDialogFlag(bool))); @@ -593,7 +597,7 @@ QWidget* QCMakeCacheModelDelegate::createEditor(QWidget* p, else if(type == QCMakeProperty::FILEPATH) { QCMakeFilePathEditor* editor = - new QCMakeFilePathEditor(p, + new QCMakeFilePathEditor(p, var.data(Qt::DisplayRole).toString()); QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this, SLOT(setFileDialogFlag(bool))); @@ -602,7 +606,7 @@ QWidget* QCMakeCacheModelDelegate::createEditor(QWidget* p, else if(type == QCMakeProperty::STRING && var.data(QCMakeCacheModel::StringsRole).isValid()) { - QCMakeComboBox* editor = + QCMakeComboBox* editor = new QCMakeComboBox(p, var.data(QCMakeCacheModel::StringsRole).toStringList()); editor->setFrame(false); return editor; @@ -613,7 +617,7 @@ QWidget* QCMakeCacheModelDelegate::createEditor(QWidget* p, return editor; } -bool QCMakeCacheModelDelegate::editorEvent(QEvent* e, QAbstractItemModel* model, +bool QCMakeCacheModelDelegate::editorEvent(QEvent* e, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index) { Qt::ItemFlags flags = model->flags(index); @@ -637,7 +641,7 @@ bool QCMakeCacheModelDelegate::editorEvent(QEvent* e, QAbstractItemModel* model, { return true; } - } + } else if (e->type() == QEvent::KeyPress) { if(static_cast(e)->key() != Qt::Key_Space && @@ -645,8 +649,8 @@ bool QCMakeCacheModelDelegate::editorEvent(QEvent* e, QAbstractItemModel* model, { return false; } - } - else + } + else { return false; } @@ -660,7 +664,7 @@ bool QCMakeCacheModelDelegate::editorEvent(QEvent* e, QAbstractItemModel* model, } return success; } - + // Issue 205903 fixed in Qt 4.5.0. // Can remove this function and FileDialogFlag when minimum Qt version is 4.5 bool QCMakeCacheModelDelegate::eventFilter(QObject* object, QEvent* evt) @@ -682,7 +686,7 @@ void QCMakeCacheModelDelegate::setModelData(QWidget* editor, QItemDelegate::setModelData(editor, model, index); const_cast(this)->recordChange(model, index); } - + QSize QCMakeCacheModelDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const { QSize sz = QItemDelegate::sizeHint(option, index); @@ -695,7 +699,7 @@ QSize QCMakeCacheModelDelegate::sizeHint(const QStyleOptionViewItem& option, con return sz; } - + QSet QCMakeCacheModelDelegate::changes() const { return mChanges; @@ -721,7 +725,7 @@ void QCMakeCacheModelDelegate::recordChange(QAbstractItemModel* model, const QMo QCMakeProperty prop; idx = idx.sibling(idx.row(), 0); cache_model->getPropertyData(idx, prop); - + // clean out an old one QSet::iterator iter = mChanges.find(prop); if(iter != mChanges.end()) diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h index 0a628b90a..41f0bd87c 100644 --- a/Source/QtDialog/QCMakeCacheView.h +++ b/Source/QtDialog/QCMakeCacheView.h @@ -33,7 +33,7 @@ public: // retrieve the QCMakeCacheModel storing all the pointers // this isn't necessarily the model one would get from model() QCMakeCacheModel* cacheModel() const; - + // get whether to show advanced entries bool showAdvanced() const; @@ -65,7 +65,7 @@ public: // roles used to retrieve extra data such has help strings, types of // properties, and the advanced flag enum { HelpRole = Qt::ToolTipRole, - TypeRole = Qt::UserRole, + TypeRole = Qt::UserRole, AdvancedRole, StringsRole, GroupRole @@ -102,7 +102,7 @@ public slots: public: // get the properties QCMakePropertyList properties() const; - + // editing enabled bool editEnabled() const; @@ -112,7 +112,7 @@ public: // return flags (overloaded to modify flag based on EditEnabled flag) Qt::ItemFlags flags (const QModelIndex& index) const; QModelIndex buddy(const QModelIndex& idx) const; - + // get the data in the model for this property void getPropertyData(const QModelIndex& idx1, QCMakeProperty& prop) const; @@ -124,20 +124,20 @@ protected: ViewType View; // set the data in the model for this property - void setPropertyData(const QModelIndex& idx1, + void setPropertyData(const QModelIndex& idx1, const QCMakeProperty& p, bool isNew); // breaks up he property list into groups // where each group has the same prefix up to the first underscore static void breakProperties(const QSet& props, QMap& result); - + // gets the prefix of a string up to the first _ static QString prefix(const QString& s); }; -/// Qt delegate class for interaction (or other customization) +/// Qt delegate class for interaction (or other customization) /// with cache properties class QCMakeCacheModelDelegate : public QItemDelegate { @@ -145,9 +145,9 @@ class QCMakeCacheModelDelegate : public QItemDelegate public: QCMakeCacheModelDelegate(QObject* p); /// create our own editors for cache properties - QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, + QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const; - bool editorEvent (QEvent* event, QAbstractItemModel* model, + bool editorEvent (QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index); bool eventFilter(QObject* object, QEvent* event); void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index ) const; diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx index 144e1f32e..a0c5e17fe 100644 --- a/Source/QtDialog/QCMakeWidgets.cxx +++ b/Source/QtDialog/QCMakeWidgets.cxx @@ -69,7 +69,7 @@ void QCMakeFilePathEditor::chooseFile() this->fileDialogExists(true); path = QFileDialog::getOpenFileName(this, title, info.absolutePath()); this->fileDialogExists(false); - + if(!path.isEmpty()) { this->setText(QDir::fromNativeSeparators(path)); diff --git a/Source/QtDialog/QMacInstallDialog.cxx b/Source/QtDialog/QMacInstallDialog.cxx index 6eb053b21..8b8c5319f 100644 --- a/Source/QtDialog/QMacInstallDialog.cxx +++ b/Source/QtDialog/QMacInstallDialog.cxx @@ -15,11 +15,11 @@ QMacInstallDialog::QMacInstallDialog(QWidget*w) { this->Internals = new QMacInstallDialogInternals; this->Internals->setupUi(this); - QObject::connect(this->Internals->choosePathButton, SIGNAL(pressed()), + QObject::connect(this->Internals->choosePathButton, SIGNAL(pressed()), this, SLOT(ShowBrowser())); - QObject::connect(this->Internals->skipInstallButton, SIGNAL(pressed()), + QObject::connect(this->Internals->skipInstallButton, SIGNAL(pressed()), this, SLOT(SkipInstall())); - QObject::connect(this->Internals->doInstallButton, SIGNAL(pressed()), + QObject::connect(this->Internals->doInstallButton, SIGNAL(pressed()), this, SLOT(DoInstall())); this->Internals->InstallPrefix->setText("/usr/bin/"); @@ -31,7 +31,7 @@ QMacInstallDialog::~QMacInstallDialog() } void QMacInstallDialog::DoInstall() -{ +{ QDir installDir(this->Internals->InstallPrefix->text()); QString installTo = installDir.path(); if(!cmSystemTools::FileExists(installTo.toLocal8Bit().data())) @@ -42,7 +42,7 @@ void QMacInstallDialog::DoInstall() message += installDir.path(); QString title = tr("Create Directory"); QMessageBox::StandardButton btn; - btn = QMessageBox::information(this, title, message, + btn = QMessageBox::information(this, title, message, QMessageBox::Yes | QMessageBox::No); if(btn == QMessageBox::Yes) { @@ -52,7 +52,7 @@ void QMacInstallDialog::DoInstall() QDir cmExecDir(QApplication::applicationDirPath()); cmExecDir.cd("../bin"); QFileInfoList list = cmExecDir.entryInfoList(); - for (int i = 0; i < list.size(); ++i) + for (int i = 0; i < list.size(); ++i) { QFileInfo fileInfo = list.at(i); QString filename = fileInfo.fileName(); @@ -75,7 +75,7 @@ void QMacInstallDialog::DoInstall() message += newName; QString title = tr("Error Removing file"); QMessageBox::StandardButton btn = - QMessageBox::critical(this, title, message, + QMessageBox::critical(this, title, message, QMessageBox::Ok|QMessageBox::Abort); if(btn == QMessageBox::Abort) { @@ -93,7 +93,7 @@ void QMacInstallDialog::DoInstall() message += newName; QString title = tr("Error Creating Symlink"); QMessageBox::StandardButton btn = - QMessageBox::critical(this, title, message, + QMessageBox::critical(this, title, message, QMessageBox::Ok|QMessageBox::Abort); if(btn == QMessageBox::Abort) { @@ -112,7 +112,7 @@ void QMacInstallDialog::SkipInstall() void QMacInstallDialog::ShowBrowser() { - QString dir = QFileDialog::getExistingDirectory(this, + QString dir = QFileDialog::getExistingDirectory(this, tr("Enter Install Prefix"), this->Internals->InstallPrefix->text()); if(!dir.isEmpty()) { diff --git a/Source/QtDialog/QtDialogCPack.cmake.in b/Source/QtDialog/QtDialogCPack.cmake.in index 701991b7a..3196471d7 100644 --- a/Source/QtDialog/QtDialogCPack.cmake.in +++ b/Source/QtDialog/QtDialogCPack.cmake.in @@ -1,18 +1,18 @@ -SET(IS_APPLE @APPLE@) -SET(CMAKE_PACKAGE_QTGUI @CMAKE_PACKAGE_QTGUI@) +set(IS_APPLE @APPLE@) +set(CMAKE_PACKAGE_QTGUI @CMAKE_PACKAGE_QTGUI@) -IF(CMAKE_PACKAGE_QTGUI) - SET(CPACK_PACKAGE_EXECUTABLES "cmake-gui" "CMake (cmake-gui)" ${CPACK_PACKAGE_EXECUTABLES}) - SET(CPACK_CREATE_DESKTOP_LINKS "cmake-gui" ${CPACK_CREATE_DESKTOP_LINKS}) - IF(IS_APPLE) +if(CMAKE_PACKAGE_QTGUI) + set(CPACK_PACKAGE_EXECUTABLES "cmake-gui" "CMake (cmake-gui)" ${CPACK_PACKAGE_EXECUTABLES}) + set(CPACK_CREATE_DESKTOP_LINKS "cmake-gui" ${CPACK_CREATE_DESKTOP_LINKS}) + if(IS_APPLE) # for apple install we set the install prefix to # / and then install # cmake into the bundle for cmake-gui and must use DESTDIR - SET(CPACK_SET_DESTDIR TRUE) + set(CPACK_SET_DESTDIR TRUE) # we also want to run post install stuff to setup command line - SET(CPACK_POSTFLIGHT_SCRIPT "@CMAKE_POSTFLIGHT_SCRIPT@") - SET(CPACK_POSTUPGRADE_SCRIPT "@CMAKE_POSTUPGRADE_SCRIPT@") - ENDIF(IS_APPLE) -ENDIF(CMAKE_PACKAGE_QTGUI) + set(CPACK_POSTFLIGHT_SCRIPT "@CMAKE_POSTFLIGHT_SCRIPT@") + set(CPACK_POSTUPGRADE_SCRIPT "@CMAKE_POSTUPGRADE_SCRIPT@") + endif() +endif() diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index 1f770ed39..1cc1e3a75 100644 --- a/Source/cmAddCustomCommandCommand.h +++ b/Source/cmAddCustomCommandCommand.h @@ -16,7 +16,7 @@ #include "cmDocumentGeneratorExpressions.h" /** \class cmAddCustomCommandCommand - * \brief + * \brief * * cmAddCustomCommandCommand defines a new command (rule) that can * be executed within the build process @@ -29,7 +29,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmAddCustomCommandCommand; } @@ -45,7 +45,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "add_custom_command";} - + /** * Succinct documentation. */ @@ -53,7 +53,7 @@ public: { return "Add a custom build rule to the generated build system."; } - + /** * More documentation. */ @@ -68,7 +68,8 @@ public: " [COMMAND command2 [ARGS] [args2...] ...]\n" " [MAIN_DEPENDENCY depend]\n" " [DEPENDS [depends...]]\n" - " [IMPLICIT_DEPENDS depend1 ...]\n" + " [IMPLICIT_DEPENDS depend1\n" + " [ depend2] ...]\n" " [WORKING_DIRECTORY dir]\n" " [COMMENT comment] [VERBATIM] [APPEND])\n" "This defines a command to generate specified OUTPUT file(s). " @@ -142,6 +143,8 @@ public: "dependencies of an input file. The language given specifies the " "programming language whose corresponding dependency scanner should " "be used. Currently only C and CXX language scanners are supported. " + "The language has to be specified for every file in the " + "IMPLICIT_DEPENDS list. " "Dependencies discovered from the scanning are added to those of " "the custom command at build time. Note that the IMPLICIT_DEPENDS " "option is currently supported only for Makefile generators and " @@ -177,7 +180,7 @@ public: "is recompiled.\n" ; } - + cmTypeMacro(cmAddCustomCommandCommand, cmCommand); protected: bool CheckOutputs(const std::vector& outputs); diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h index 50bffefde..d4ed450f0 100644 --- a/Source/cmAddCustomTargetCommand.h +++ b/Source/cmAddCustomTargetCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmAddCustomTargetCommand; } @@ -38,13 +38,13 @@ public: */ virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - + /** * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "add_custom_target";} - + /** * Succinct documentation. */ @@ -52,7 +52,7 @@ public: { return "Add a target with no output so it will always be built."; } - + /** * More documentation. */ @@ -101,7 +101,7 @@ public: "convenience in editing even if they have not build rules." ; } - + cmTypeMacro(cmAddCustomTargetCommand, cmCommand); }; diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h index 14a7741fa..ed8006765 100644 --- a/Source/cmAddDependenciesCommand.h +++ b/Source/cmAddDependenciesCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmAddDependenciesCommand; } @@ -49,7 +49,7 @@ public: { return "Add a dependency between top-level targets."; } - + /** * More documentation. */ @@ -70,7 +70,7 @@ public: "SET_SOURCE_FILES_PROPERTIES to add file-level dependencies to object " "files."; } - + cmTypeMacro(cmAddDependenciesCommand, cmCommand); }; diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h index b1ae20289..e5f27cb51 100644 --- a/Source/cmAddLibraryCommand.h +++ b/Source/cmAddLibraryCommand.h @@ -26,7 +26,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmAddLibraryCommand; } @@ -50,7 +50,7 @@ public: { return "Add a library to the project using the specified source files."; } - + /** * More documentation. */ @@ -78,7 +78,9 @@ public: "functionality. " "If no type is given explicitly the type is STATIC or SHARED based " "on whether the current value of the variable BUILD_SHARED_LIBS is " - "true." + "true. " + "For SHARED and MODULE libraries the POSITION_INDEPENDENT_CODE " + "target property is set to TRUE automatically." "\n" "By default the library file will be created in the build tree " "directory corresponding to the source tree directory in which " @@ -132,9 +134,13 @@ public: "They may contain custom commands generating such sources, but not " "PRE_BUILD, PRE_LINK, or POST_BUILD commands. " "Object libraries cannot be imported, exported, installed, or linked." + " " + "Some native build systems may not like targets that have only " + "object files, so consider adding at least one real source file " + "to any target that references $." ; } - + cmTypeMacro(cmAddLibraryCommand, cmCommand); }; diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index 5fca527ca..5b1c9c668 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -20,11 +20,11 @@ bool cmAddSubDirectoryCommand::InitialPass this->SetError("called with incorrect number of arguments"); return false; } - + // store the binpath std::string srcArg = args[0]; std::string binArg; - + bool excludeFromAll = false; // process the rest of the arguments looking for optional args @@ -78,7 +78,7 @@ bool cmAddSubDirectoryCommand::InitialPass // No binary directory was specified. If the source directory is // not a subdirectory of the current directory then it is an // error. - if(!cmSystemTools::FindLastString(srcPath.c_str(), + if(!cmSystemTools::IsSubDirectory(srcPath.c_str(), this->Makefile->GetCurrentDirectory())) { cmOStringStream e; @@ -93,10 +93,15 @@ bool cmAddSubDirectoryCommand::InitialPass // Remove the CurrentDirectory from the srcPath and replace it // with the CurrentOutputDirectory. - binPath = srcPath; - cmSystemTools::ReplaceString(binPath, - this->Makefile->GetCurrentDirectory(), - this->Makefile->GetCurrentOutputDirectory()); + const char* src = this->Makefile->GetCurrentDirectory(); + const char* bin = this->Makefile->GetCurrentOutputDirectory(); + size_t srcLen = strlen(src); + size_t binLen = strlen(bin); + if(srcLen > 0 && src[srcLen-1] == '/') + { --srcLen; } + if(binLen > 0 && bin[binLen-1] == '/') + { --binLen; } + binPath = std::string(bin, binLen) + srcPath.substr(srcLen); } else { diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h index 3d6f51ea5..fa322b0c4 100644 --- a/Source/cmAddSubDirectoryCommand.h +++ b/Source/cmAddSubDirectoryCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmAddSubDirectoryCommand; } @@ -51,7 +51,7 @@ public: { return "Add a subdirectory to the build."; } - + /** * More documentation. */ @@ -90,7 +90,7 @@ public: "project build system to satisfy the dependency." ; } - + cmTypeMacro(cmAddSubDirectoryCommand, cmCommand); }; diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index 59f10f622..6a0cd9d2e 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -26,7 +26,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmAddTestCommand; } @@ -50,7 +50,7 @@ public: { return "Add a test to the project with the specified arguments."; } - + /** * More documentation. */ @@ -81,7 +81,7 @@ public: "\n" "Arguments after COMMAND may use \"generator expressions\" with the " "syntax \"$<...>\". " - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS + CM_DOCUMENT_ADD_TEST_GENERATOR_EXPRESSIONS "Example usage:\n" " add_test(NAME mytest\n" " COMMAND testDriver --config $\n" @@ -91,7 +91,7 @@ public: "executable file produced by target \"myexe\"." ; } - + cmTypeMacro(cmAddTestCommand, cmCommand); private: bool HandleNameMode(std::vector const& args); diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index f88be3d58..01f64b730 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -23,7 +23,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass this->SetError("called with incorrect number of arguments"); return false; } - + std::string sourceListValue; std::string templateDirectory = args[0]; this->Makefile->AddExtraDirectory(templateDirectory.c_str()); @@ -40,12 +40,12 @@ bool cmAuxSourceDirectoryCommand::InitialPass } // was the list already populated - const char *def = this->Makefile->GetDefinition(args[1].c_str()); + const char *def = this->Makefile->GetDefinition(args[1].c_str()); if (def) { sourceListValue = def; } - + // Load all the files in the directory cmsys::Directory dir; if(dir.Load(tdir.c_str())) @@ -69,7 +69,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass std::string fullname = templateDirectory; fullname += "/"; fullname += file; - // add the file as a class file so + // add the file as a class file so // depends can be done cmSourceFile* sf = this->Makefile->GetOrCreateSource(fullname.c_str()); @@ -83,7 +83,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass } } } - this->Makefile->AddDefinition(args[1].c_str(), sourceListValue.c_str()); + this->Makefile->AddDefinition(args[1].c_str(), sourceListValue.c_str()); return true; } diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h index f059e4473..8a70f19cb 100644 --- a/Source/cmAuxSourceDirectoryCommand.h +++ b/Source/cmAuxSourceDirectoryCommand.h @@ -29,7 +29,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmAuxSourceDirectoryCommand; } @@ -45,7 +45,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const { return "aux_source_directory";} - + /** * Succinct documentation. */ @@ -53,7 +53,7 @@ public: { return "Find all source files in a directory."; } - + /** * More documentation. */ @@ -77,7 +77,7 @@ public: "one would have to manually rerun CMake to generate a build system " "incorporating the new file."; } - + cmTypeMacro(cmAuxSourceDirectoryCommand, cmCommand); }; diff --git a/Source/cmBootstrapCommands.cxx b/Source/cmBootstrapCommands.cxx index 9097a7482..e3a2ad4e5 100644 --- a/Source/cmBootstrapCommands.cxx +++ b/Source/cmBootstrapCommands.cxx @@ -89,6 +89,7 @@ #include "cmStringCommand.cxx" #include "cmSubdirCommand.cxx" #include "cmTargetLinkLibrariesCommand.cxx" +#include "cmTimestamp.cxx" #include "cmTryCompileCommand.cxx" #include "cmTryRunCommand.cxx" #include "cmUnsetCommand.cxx" diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h index 67ef37e9a..17f57cfa1 100644 --- a/Source/cmBreakCommand.h +++ b/Source/cmBreakCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmBreakCommand; } @@ -46,7 +46,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "break";} - + /** * Succinct documentation. */ @@ -54,7 +54,7 @@ public: { return "Break from an enclosing foreach or while loop."; } - + /** * More documentation. */ @@ -64,7 +64,7 @@ public: " break()\n" "Breaks from an enclosing foreach loop or while loop"; } - + cmTypeMacro(cmBreakCommand, cmCommand); }; diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index 3722ab635..91d55a5a2 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -87,6 +87,14 @@ bool cmBuildCommand const char* makeprogram = this->Makefile->GetDefinition("CMAKE_MAKE_PROGRAM"); + if(!makeprogram) + { + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + "build_command() requires CMAKE_MAKE_PROGRAM to be defined. " + "Call project() or enable_language() first."); + return true; + } // If null/empty CONFIGURATION argument, GenerateBuildCommand uses 'Debug' // in the currently implemented multi-configuration global generators... diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h index a333c5d95..1bab4536e 100644 --- a/Source/cmBuildCommand.h +++ b/Source/cmBuildCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmBuildCommand; } diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx index fa698303c..f95a79eda 100644 --- a/Source/cmBuildNameCommand.cxx +++ b/Source/cmBuildNameCommand.cxx @@ -25,7 +25,7 @@ bool cmBuildNameCommand const char* cacheValue = this->Makefile->GetDefinition(args[0].c_str()); if(cacheValue) { - // do we need to correct the value? + // do we need to correct the value? cmsys::RegularExpression reg("[()/]"); if (reg.find(cacheValue)) { @@ -41,7 +41,7 @@ bool cmBuildNameCommand return true; } - + std::string buildname = "WinNT"; if(this->Makefile->GetDefinition("UNIX")) { @@ -67,7 +67,7 @@ bool cmBuildNameCommand "(", "_"); cmSystemTools::ReplaceString(buildname, ")", "_"); - + this->Makefile->AddCacheDefinition(args[0].c_str(), buildname.c_str(), "Name of build.", diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index 126934ceb..49c585fba 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -120,7 +120,7 @@ bool cmCMakeMinimumRequired { this->Makefile->SetPolicyVersion(version_string.c_str()); } - + return true; } diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h index d23ce79cf..acf28298b 100644 --- a/Source/cmCMakeMinimumRequired.h +++ b/Source/cmCMakeMinimumRequired.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmCMakeMinimumRequired; } @@ -46,7 +46,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "cmake_minimum_required";} - + /** * Succinct documentation. */ @@ -54,7 +54,7 @@ public: { return "Set the minimum required version of cmake for a project."; } - + /** * More documentation. */ @@ -77,7 +77,7 @@ public: "It should be specified so CMake versions 2.4 and lower fail with an " "error instead of just a warning."; } - + cmTypeMacro(cmCMakeMinimumRequired, cmCommand); private: diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h index 4f1ed36ad..4f9faa168 100644 --- a/Source/cmCMakePolicyCommand.h +++ b/Source/cmCMakePolicyCommand.h @@ -17,8 +17,8 @@ /** \class cmCMakePolicyCommand * \brief Set how CMake should handle policies * - * cmCMakePolicyCommand sets how CMake should deal with backwards - * compatibility policies. + * cmCMakePolicyCommand sets how CMake should deal with backwards + * compatibility policies. */ class cmCMakePolicyCommand : public cmCommand { @@ -26,7 +26,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmCMakePolicyCommand; } @@ -47,7 +47,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "cmake_policy";} - + /** * Succinct documentation. */ @@ -55,7 +55,7 @@ public: { return "Manage CMake Policy settings."; } - + /** * More documentation. */ @@ -129,7 +129,7 @@ public: "closest nested policy stack entry." ; } - + cmTypeMacro(cmCMakePolicyCommand, cmCommand); private: bool HandleSetMode(std::vector const& args); diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index e23791355..48ae50e42 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -389,7 +389,7 @@ void CCONV cmAddLibrary(void *arg, const char *libname, int shared, { srcs2.push_back(srcs[i]); } - mf->AddLibrary(libname, + mf->AddLibrary(libname, (shared? cmTarget::SHARED_LIBRARY : cmTarget::STATIC_LIBRARY), srcs2); } @@ -859,13 +859,13 @@ void CCONV cmFree(void *data) } void CCONV DefineSourceFileProperty (void *arg, const char *name, - const char *briefDocs, + const char *briefDocs, const char *longDocs, int chained) { cmMakefile *mf = static_cast(arg); mf->GetCMakeInstance()->DefineProperty(name,cmProperty::SOURCE_FILE, - briefDocs, longDocs, + briefDocs, longDocs, chained != 0); } diff --git a/Source/cmCPluginAPI.h b/Source/cmCPluginAPI.h index fd5a4f819..5c832c30e 100644 --- a/Source/cmCPluginAPI.h +++ b/Source/cmCPluginAPI.h @@ -168,10 +168,10 @@ typedef struct /* new functions added after 2.4 */ void *(CCONV *CreateNewSourceFile) (void *mf); void (CCONV *DefineSourceFileProperty) (void *mf, const char *name, - const char *briefDocs, + const char *briefDocs, const char *longDocs, int chained); - + /* this is the end of the C function stub API structure */ } cmCAPI; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index b5687e39a..322a6a26f 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -53,7 +53,7 @@ #include #include -#if defined(__BEOS__) && !defined(__HAIKU__) +#if defined(__BEOS__) #include /* disable_debugger() API. */ #endif @@ -75,8 +75,8 @@ struct tm* cmCTest::GetNightlyTime(std::string str, char buf[1024]; // add todays year day and month to the time in str because // curl_getdate no longer assumes the day is today - sprintf(buf, "%d%02d%02d %s", - lctime->tm_year+1900, + sprintf(buf, "%d%02d%02d %s", + lctime->tm_year+1900, lctime->tm_mon +1, lctime->tm_mday, str.c_str()); @@ -223,7 +223,7 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method, default: break; } - + ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); ::curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout); ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); @@ -237,7 +237,7 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method, ::curl_easy_cleanup(curl); ::curl_global_cleanup(); - + return static_cast(res); } #endif @@ -300,7 +300,7 @@ cmCTest::cmCTest() this->ForceNewCTestProcess = false; this->TomorrowTag = false; this->Verbose = false; - + this->Debug = false; this->ShowLineNumbers = false; this->Quiet = false; @@ -327,6 +327,7 @@ cmCTest::cmCTest() this->OutputLogFileLastTag = -1; this->SuppressUpdatingCTestConfiguration = false; this->DartVersion = 1; + this->DropSiteCDash = false; this->OutputTestOutputOnTestFailure = false; this->ComputedCompressTestOutput = false; this->ComputedCompressMemCheckOutput = false; @@ -653,6 +654,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) = this->GetCTestConfiguration("SourceDirectory").c_str(); std::string bld_dir = this->GetCTestConfiguration("BuildDirectory").c_str(); this->DartVersion = 1; + this->DropSiteCDash = false; for(Part p = PartStart; p != PartCount; p = Part(p+1)) { this->Parts[p].SubmitFiles.clear(); @@ -719,6 +721,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) return false; } } + this->DropSiteCDash = mf->IsOn("CTEST_DROP_SITE_CDASH"); if ( !this->Initialize(bld_dir.c_str(), command) ) { @@ -760,7 +763,7 @@ bool cmCTest::UpdateCTestConfiguration() } else { - cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Parse Config file:" + cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Parse Config file:" << fileName.c_str() << "\n"); // parse the dart test file std::ifstream fin(fileName.c_str()); @@ -944,7 +947,7 @@ bool cmCTest::AddIfExists(Part part, const char* file) //---------------------------------------------------------------------- bool cmCTest::CTestFileExists(const std::string& filename) { - std::string testingDir = this->BinaryDir + "/Testing/" + + std::string testingDir = this->BinaryDir + "/Testing/" + this->CurrentTag + "/" + filename; return cmSystemTools::FileExists(testingDir.c_str()); } @@ -952,7 +955,7 @@ bool cmCTest::CTestFileExists(const std::string& filename) //---------------------------------------------------------------------- cmCTestGenericHandler* cmCTest::GetInitializedHandler(const char* handler) { - cmCTest::t_TestingHandlers::iterator it = + cmCTest::t_TestingHandlers::iterator it = this->TestingHandlers.find(handler); if ( it == this->TestingHandlers.end() ) { @@ -965,7 +968,7 @@ cmCTestGenericHandler* cmCTest::GetInitializedHandler(const char* handler) //---------------------------------------------------------------------- cmCTestGenericHandler* cmCTest::GetHandler(const char* handler) { - cmCTest::t_TestingHandlers::iterator it = + cmCTest::t_TestingHandlers::iterator it = this->TestingHandlers.find(handler); if ( it == this->TestingHandlers.end() ) { @@ -1314,8 +1317,8 @@ int cmCTest::RunTest(std::vector argv, { if(argv[i]) { - // make sure we pass the timeout in for any build and test - // invocations. Since --build-generator is required this is a + // make sure we pass the timeout in for any build and test + // invocations. Since --build-generator is required this is a // good place to check for it, and to add the arguments in if (strcmp(argv[i],"--build-generator") == 0 && timeout > 0) { @@ -1524,18 +1527,18 @@ void cmCTest::StartXML(std::ostream& ostr, bool append) << "\tNumberOfPhysicalCPU=\""<< info.GetNumberOfPhysicalCPU() << "\"\n" << "\tTotalVirtualMemory=\"" << info.GetTotalVirtualMemory() << "\"\n" << "\tTotalPhysicalMemory=\""<< info.GetTotalPhysicalMemory() << "\"\n" - << "\tLogicalProcessorsPerPhysical=\"" + << "\tLogicalProcessorsPerPhysical=\"" << info.GetLogicalProcessorsPerPhysical() << "\"\n" - << "\tProcessorClockFrequency=\"" - << info.GetProcessorClockFrequency() << "\"\n" + << "\tProcessorClockFrequency=\"" + << info.GetProcessorClockFrequency() << "\"\n" << ">" << std::endl; - this->AddSiteProperties(ostr); + this->AddSiteProperties(ostr); } //---------------------------------------------------------------------- void cmCTest::AddSiteProperties(std::ostream& ostr) { - cmCTestScriptHandler* ch = + cmCTestScriptHandler* ch = static_cast(this->GetHandler("script")); cmake* cm = ch->GetCMake(); // if no CMake then this is the old style script and props like @@ -1547,9 +1550,9 @@ void cmCTest::AddSiteProperties(std::ostream& ostr) // This code should go when cdash is changed to use labels only const char* subproject = cm->GetProperty("SubProject", cmProperty::GLOBAL); if(subproject) - { + { ostr << "\n"; - const char* labels = + const char* labels = ch->GetCMake()->GetProperty("SubProjectLabels", cmProperty::GLOBAL); if(labels) { @@ -1566,11 +1569,11 @@ void cmCTest::AddSiteProperties(std::ostream& ostr) } ostr << "\n"; } - + // This code should stay when cdash only does label based sub-projects const char* label = cm->GetProperty("Label", cmProperty::GLOBAL); if(label) - { + { ostr << "\n"; ostr << " \n"; ostr << "\n"; @@ -1762,7 +1765,7 @@ bool cmCTest::SubmitExtraFiles(const char* cfiles) //------------------------------------------------------- -// for a -D argument convert the next argument into +// for a -D argument convert the next argument into // the proper list of dashboard steps via SetTest bool cmCTest::AddTestsForDashboardType(std::string &targ) { @@ -1980,9 +1983,9 @@ bool cmCTest::CheckArgument(const std::string& arg, const char* varg1, //---------------------------------------------------------------------- -// Processes one command line argument (and its arguments if any) +// Processes one command line argument (and its arguments if any) // for many simple options and then returns -void cmCTest::HandleCommandLineArguments(size_t &i, +void cmCTest::HandleCommandLineArguments(size_t &i, std::vector &args) { std::string arg = args[i]; @@ -2031,14 +2034,14 @@ void cmCTest::HandleCommandLineArguments(size_t &i, i++; this->SetStopTime(args[i]); } - + if(this->CheckArgument(arg, "-C", "--build-config") && i < args.size() - 1) { i++; this->SetConfigType(args[i].c_str()); } - + if(this->CheckArgument(arg, "--debug")) { this->Debug = true; @@ -2078,7 +2081,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i, { this->OutputTestOutputOnTestFailure = true; } - + if(this->CheckArgument(arg, "-N", "--show-only")) { this->ShowOnly = true; @@ -2118,7 +2121,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i, this->SubmitIndex = 0; } } - + if(this->CheckArgument(arg, "--overwrite") && i < args.size() - 1) { i++; @@ -2171,7 +2174,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i, this->GetHandler("memcheck")-> SetPersistentOption("ExcludeLabelRegularExpression", args[i].c_str()); } - + if(this->CheckArgument(arg, "-E", "--exclude-regex") && i < args.size() - 1) { @@ -2180,17 +2183,17 @@ void cmCTest::HandleCommandLineArguments(size_t &i, SetPersistentOption("ExcludeRegularExpression", args[i].c_str()); this->GetHandler("memcheck")-> SetPersistentOption("ExcludeRegularExpression", args[i].c_str()); - } + } } //---------------------------------------------------------------------- // handle the -S -SR and -SP arguments -void cmCTest::HandleScriptArguments(size_t &i, +void cmCTest::HandleScriptArguments(size_t &i, std::vector &args, bool &SRArgumentSpecified) { std::string arg = args[i]; - if(this->CheckArgument(arg, "-SP", "--script-new-process") && + if(this->CheckArgument(arg, "-SP", "--script-new-process") && i < args.size() - 1 ) { this->RunConfigurationScript = true; @@ -2203,8 +2206,8 @@ void cmCTest::HandleScriptArguments(size_t &i, ch->AddConfigurationScript(args[i].c_str(),false); } } - - if(this->CheckArgument(arg, "-SR", "--script-run") && + + if(this->CheckArgument(arg, "-SR", "--script-run") && i < args.size() - 1 ) { SRArgumentSpecified = true; @@ -2214,7 +2217,7 @@ void cmCTest::HandleScriptArguments(size_t &i, = static_cast(this->GetHandler("script")); ch->AddConfigurationScript(args[i].c_str(),true); } - + if(this->CheckArgument(arg, "-S", "--script") && i < args.size() - 1 ) { this->RunConfigurationScript = true; @@ -2396,7 +2399,7 @@ int cmCTest::Run(std::vector &args, std::string* output) } // the close of the for argument loop - // now what sould cmake do? if --build-and-test was specified then + // now what sould cmake do? if --build-and-test was specified then // we run the build and test handler and return if(cmakeAndTest) { @@ -2410,7 +2413,7 @@ int cmCTest::Run(std::vector &args, std::string* output) #endif if(retv != 0) { - cmCTestLog(this, DEBUG, "build and test failing returing: " << retv + cmCTestLog(this, DEBUG, "build and test failing returing: " << retv << std::endl); } return retv; @@ -2438,14 +2441,14 @@ int cmCTest::Run(std::vector &args, std::string* output) res = this->GetHandler("script")->ProcessHandler(); if(res != 0) { - cmCTestLog(this, DEBUG, "running script failing returning: " << res + cmCTestLog(this, DEBUG, "running script failing returning: " << res << std::endl); } } else { - // What is this? -V seems to be the same as -VV, + // What is this? -V seems to be the same as -VV, // and Verbose is always on in this case this->ExtraVerbose = this->Verbose; this->Verbose = true; @@ -2472,7 +2475,7 @@ int cmCTest::Run(std::vector &args, std::string* output) } if(res != 0) { - cmCTestLog(this, DEBUG, "Running a test(s) failed returning : " << res + cmCTestLog(this, DEBUG, "Running a test(s) failed returning : " << res << std::endl); } return res; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index beffe9e7a..587a6db51 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -93,7 +93,7 @@ public: */ static int HTTPRequest(std::string url, HTTPMethod method, std::string& response, - std::string fields = "", + std::string fields = "", std::string putFile = "", int timeout = 0); #endif @@ -198,13 +198,13 @@ public: //! base64 encode a file std::string Base64EncodeFile(std::string file); - /** + /** * Return the time remaining that the script is allowed to run in * seconds if the user has set the variable CTEST_TIME_LIMIT. If that has * not been set it returns 1e7 seconds */ double GetRemainingTimeAllowed(); - + ///! Open file in the output directory and set the stream bool OpenOutputFile(const std::string& path, const std::string& name, @@ -384,6 +384,7 @@ public: //! Get the version of dart server int GetDartVersion() { return this->DartVersion; } + int GetDropSiteCDash() { return this->DropSiteCDash; } //! Add file to be submitted void AddSubmitFile(Part part, const char* name); @@ -529,11 +530,11 @@ private: bool AddVariableDefinition(const std::string &arg); //! parse and process most common command line arguments - void HandleCommandLineArguments(size_t &i, + void HandleCommandLineArguments(size_t &i, std::vector &args); //! hande the -S -SP and -SR arguments - void HandleScriptArguments(size_t &i, + void HandleScriptArguments(size_t &i, std::vector &args, bool &SRArgumentSpecified); @@ -561,6 +562,7 @@ private: bool Quiet; int DartVersion; + bool DropSiteCDash; std::vector InitialCommandLineArguments; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 47a0e8553..3d5b24b84 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -267,7 +267,7 @@ bool cmCacheManager::LoadCache(const char* path, // If the entry is not internal to the cache being loaded // or if it is in the list of internal entries to be // imported, load it. - if ( internal || (e.Type != INTERNAL) || + if ( internal || (e.Type != INTERNAL) || (includes.find(entryKey) != includes.end()) ) { // If we are loading the cache from another project, @@ -478,7 +478,7 @@ bool cmCacheManager::SaveCache(const char* path) = this->GetCacheEntry("CMAKE_COMMAND"); if ( cmakeCacheEntry ) { - fout << "# It was generated by CMake: " << + fout << "# It was generated by CMake: " << cmakeCacheEntry->Value << std::endl; } @@ -500,10 +500,10 @@ bool cmCacheManager::SaveCache(const char* path) fout << "########################\n"; fout << "\n"; - for( std::map::const_iterator i = + for( std::map::const_iterator i = this->Cache.begin(); i != this->Cache.end(); ++i) { - const CacheEntry& ce = (*i).second; + const CacheEntry& ce = (*i).second; CacheEntryType t = ce.Type; if(!ce.Initialized) { @@ -584,23 +584,15 @@ bool cmCacheManager::DeleteCache(const char* path) cmSystemTools::ConvertToUnixSlashes(cacheFile); std::string cmakeFiles = cacheFile; cacheFile += "/CMakeCache.txt"; - cmSystemTools::RemoveFile(cacheFile.c_str()); - // now remove the files in the CMakeFiles directory - // this cleans up language cache files - cmsys::Directory dir; - cmakeFiles += cmake::GetCMakeFilesDirectory(); - dir.Load(cmakeFiles.c_str()); - for (unsigned long fileNum = 0; - fileNum < dir.GetNumberOfFiles(); - ++fileNum) - { - if(!cmSystemTools:: - FileIsDirectory(dir.GetFile(fileNum))) + if(cmSystemTools::FileExists(cacheFile.c_str())) + { + cmSystemTools::RemoveFile(cacheFile.c_str()); + // now remove the files in the CMakeFiles directory + // this cleans up language cache files + cmakeFiles += cmake::GetCMakeFilesDirectory(); + if(cmSystemTools::FileIsDirectory(cmakeFiles.c_str())) { - std::string fullPath = cmakeFiles; - fullPath += "/"; - fullPath += dir.GetFile(fileNum); - cmSystemTools::RemoveFile(fullPath.c_str()); + cmSystemTools::RemoveADirectory(cmakeFiles.c_str()); } } return true; @@ -641,7 +633,7 @@ void cmCacheManager::OutputHelpString(std::ostream& fout, std::string::size_type pos = 0; for (std::string::size_type i=0; i<=end; i++) { - if ((i==end) + if ((i==end) || (helpString[i]=='\n') || ((i-pos >= 60) && (helpString[i]==' '))) { @@ -700,12 +692,12 @@ void cmCacheManager::PrintCache(std::ostream& out) const { out << "=================================================" << std::endl; out << "CMakeCache Contents:" << std::endl; - for(std::map::const_iterator i = + for(std::map::const_iterator i = this->Cache.begin(); i != this->Cache.end(); ++i) { if((*i).second.Type != INTERNAL) { - out << (*i).first.c_str() << " = " << (*i).second.Value.c_str() + out << (*i).first.c_str() << " = " << (*i).second.Value.c_str() << std::endl; } } @@ -768,7 +760,7 @@ bool cmCacheManager::CacheIterator::IsAtEnd() const void cmCacheManager::CacheIterator::Begin() { - this->Position = this->Container.Cache.begin(); + this->Position = this->Container.Cache.begin(); } bool cmCacheManager::CacheIterator::Find(const char* key) @@ -781,7 +773,7 @@ void cmCacheManager::CacheIterator::Next() { if (!this->IsAtEnd()) { - ++this->Position; + ++this->Position; } } diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 9c94d214c..4a5ee450f 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -22,7 +22,7 @@ class cmake; * \brief Control class for cmake's cache * * Load and Save CMake cache files. - * + * */ class cmCacheManager { @@ -30,7 +30,7 @@ public: cmCacheManager(cmake* cm); class CacheIterator; friend class cmCacheManager::CacheIterator; - enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, + enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, UNINITIALIZED }; private: @@ -57,7 +57,7 @@ public: bool IsAtEnd() const; void Next(); const char *GetName() const { - return this->Position->first.c_str(); } + return this->Position->first.c_str(); } const char* GetProperty(const char*) const ; bool GetPropertyAsBool(const char*) const ; bool PropertyExists(const char*) const; @@ -76,7 +76,7 @@ public: CacheIterator(cmCacheManager &cm) : Container(cm) { this->Begin(); } - CacheIterator(cmCacheManager &cm, const char* key) : Container(cm) + CacheIterator(cmCacheManager &cm, const char* key) : Container(cm) { if ( key ) { @@ -87,30 +87,30 @@ public: CacheEntry const& GetEntry() const { return this->Position->second; } CacheEntry& GetEntry() { return this->Position->second; } }; - + ///! return an iterator to iterate through the cache map - cmCacheManager::CacheIterator NewIterator() + cmCacheManager::CacheIterator NewIterator() { return CacheIterator(*this); - } - + } + /** * Types for the cache entries. These are useful as * hints for a cache editor program. Path should bring - * up a file chooser, BOOL a check box, and STRING a + * up a file chooser, BOOL a check box, and STRING a * text entry box, FILEPATH is a full path to a file which * can be different than just a path input */ static CacheEntryType StringToType(const char*); static const char* TypeToString(CacheEntryType); static bool IsType(const char*); - + ///! Load a cache for given makefile. Loads from ouput home. - bool LoadCache(cmMakefile*); + bool LoadCache(cmMakefile*); ///! Load a cache for given makefile. Loads from path/CMakeCache.txt. bool LoadCache(const char* path); bool LoadCache(const char* path, bool internal); - bool LoadCache(const char* path, bool internal, + bool LoadCache(const char* path, bool internal, std::set& excludes, std::set& includes); @@ -124,19 +124,19 @@ public: ///! Print the cache to a stream void PrintCache(std::ostream&) const; - + ///! Get the iterator for an entry with a given key. cmCacheManager::CacheIterator GetCacheIterator(const char *key=0); - + ///! Remove an entry from the cache void RemoveCacheEntry(const char* key); - + ///! Get the number of entries in the cache int GetSize() { return static_cast(this->Cache.size()); } - + ///! Break up a line like VAR:type="value" into var, type and value - static bool ParseEntry(const char* entry, + static bool ParseEntry(const char* entry, std::string& var, std::string& value, CacheEntryType& type); @@ -154,7 +154,7 @@ public: protected: ///! Add an entry into the cache - void AddCacheEntry(const char* key, const char* value, + void AddCacheEntry(const char* key, const char* value, const char* helpString, CacheEntryType type); ///! Get a cache entry object for a key diff --git a/Source/cmCommand.h b/Source/cmCommand.h index 4faaee3ac..49f451b58 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -23,8 +23,8 @@ * cmCommand is the base class for all commands in CMake. A command * manifests as an entry in CMakeLists.txt and produces one or * more makefile rules. Commands are associated with a particular - * makefile. This base class cmCommand defines the API for commands - * to support such features as enable/disable, inheritance, + * makefile. This base class cmCommand defines the API for commands + * to support such features as enable/disable, inheritance, * documentation, and construction. */ class cmCommand : public cmObject @@ -35,18 +35,18 @@ public: /** * Construct the command. By default it is enabled with no makefile. */ - cmCommand() + cmCommand() {this->Makefile = 0; this->Enabled = true;} /** * Need virtual destructor to destroy real command type. */ virtual ~cmCommand() {} - + /** * Specify the makefile. */ - void SetMakefile(cmMakefile*m) + void SetMakefile(cmMakefile*m) {this->Makefile = m; } cmMakefile* GetMakefile() { return this->Makefile; } @@ -87,12 +87,12 @@ public: * Does this command have a final pass? Query after InitialPass. */ virtual bool HasFinalPass() const { return false; } - + /** * This is a virtual constructor for the command. */ virtual cmCommand* Clone() = 0; - + /** * This determines if the command is invoked when in script mode. */ @@ -139,13 +139,13 @@ public: /** * Enable the command. */ - void EnabledOn() + void EnabledOn() {this->Enabled = true;} /** * Disable the command. */ - void EnabledOff() + void EnabledOff() {this->Enabled = false;} /** @@ -157,13 +157,13 @@ public: /** * Disable or enable the command. */ - void SetEnabled(bool enabled) + void SetEnabled(bool enabled) {this->Enabled = enabled;} /** * Return the last error string. */ - const char* GetError() + const char* GetError() { if(this->Error.length() == 0) { diff --git a/Source/cmCommandArgumentLexer.h b/Source/cmCommandArgumentLexer.h index 828122b9f..2ea3fa29f 100644 --- a/Source/cmCommandArgumentLexer.h +++ b/Source/cmCommandArgumentLexer.h @@ -45,7 +45,7 @@ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. + * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 @@ -62,7 +62,7 @@ typedef uint32_t flex_uint32_t; typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; +typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; @@ -192,7 +192,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ diff --git a/Source/cmCommandArgumentLexer.in.l b/Source/cmCommandArgumentLexer.in.l index d10e50d97..fdca61bfa 100644 --- a/Source/cmCommandArgumentLexer.in.l +++ b/Source/cmCommandArgumentLexer.in.l @@ -66,43 +66,43 @@ Modify cmCommandArgumentLexer.h: return cal_ENVCURLY; } -\$[A-Za-z0-9/_.+-]+\{ { +\$[A-Za-z0-9/_.+-]+\{ { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; - yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2); - return cal_NCURLY; -} + yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2); + return cal_NCURLY; +} -@[A-Za-z0-9/_.+-]+@ { +@[A-Za-z0-9/_.+-]+@ { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; - yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2); - return cal_ATNAME; -} + yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2); + return cal_ATNAME; +} "${" { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; - //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); + //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); yylvalp->str = yyextra->DCURLYVariable; return cal_DCURLY; } "}" { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; - //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); + //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); yylvalp->str = yyextra->RCURLYVariable; return cal_RCURLY; } "@" { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; - //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); + //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); yylvalp->str = yyextra->ATVariable; return cal_AT; } -[A-Za-z0-9/_.+-]+ { +[A-Za-z0-9/_.+-]+ { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; - yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - return cal_NAME; + yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); + return cal_NAME; } \\. { @@ -110,31 +110,31 @@ Modify cmCommandArgumentLexer.h: { return cal_ERROR; } - return cal_SYMBOL; + return cal_SYMBOL; } -[^\${}\\@]+ { +[^\${}\\@]+ { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; - yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - return cal_SYMBOL; + yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); + return cal_SYMBOL; } "$" { - //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); + //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); yylvalp->str = yyextra->DOLLARVariable; - return cal_DOLLAR; + return cal_DOLLAR; } "{" { - //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); + //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); yylvalp->str = yyextra->LCURLYVariable; - return cal_LCURLY; + return cal_LCURLY; } "\\" { - //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); + //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); yylvalp->str = yyextra->BSLASHVariable; - return cal_BSLASH; + return cal_BSLASH; } "\\" { diff --git a/Source/cmCommandArgumentParser.cxx b/Source/cmCommandArgumentParser.cxx index 696a6a8c3..c5146c5d7 100644 --- a/Source/cmCommandArgumentParser.cxx +++ b/Source/cmCommandArgumentParser.cxx @@ -279,7 +279,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -701,7 +701,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index a781767e3..2f26b0cd4 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -61,7 +61,7 @@ char* cmCommandArgumentParserHelper::AddString(const char* str) return stVal; } -char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, +char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, const char* var) { if ( !key ) @@ -163,7 +163,7 @@ char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var) // try to expand the variable char* ret = this->ExpandVariable(var); // if the return was 0 and we want to replace empty strings - // then return an empty string + // then return an empty string if(!ret && this->RemoveEmpty) { return this->AddString(ret); @@ -175,7 +175,7 @@ char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var) } } // at this point we want to put it back because of one of these cases: - // - this->ReplaceAtSyntax is false + // - this->ReplaceAtSyntax is false // - this->ReplaceAtSyntax is true, but this->RemoveEmpty is false, // and the variable was not defined std::string ref = "@"; @@ -274,7 +274,7 @@ int cmCommandArgumentParserHelper::ParseString(const char* str, int verb) this->InputBuffer = str; this->InputBufferPos = 0; this->CurrentLine = 0; - + this->Result = ""; yyscan_t yyscanner; @@ -292,7 +292,7 @@ int cmCommandArgumentParserHelper::ParseString(const char* str, int verb) if ( Verbose ) { - std::cerr << "Expanding [" << str << "] produced: [" + std::cerr << "Expanding [" << str << "] produced: [" << this->Result.c_str() << "]" << std::endl; } return 1; diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index cdb832b5f..f8c672fef 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -66,8 +66,8 @@ public: void SetNoEscapeMode(bool b) { this->NoEscapeMode = b; } void SetReplaceAtSyntax(bool b) { this->ReplaceAtSyntax = b; } void SetRemoveEmpty(bool b) { this->RemoveEmpty = b; } - - const char* GetError() { return this->ErrorString.c_str(); } + + const char* GetError() { return this->ErrorString.c_str(); } char EmptyVariable[1]; char DCURLYVariable[3]; char RCURLYVariable[3]; @@ -102,7 +102,7 @@ private: std::string ErrorString; bool NoEscapeMode; bool ReplaceAtSyntax; - bool RemoveEmpty; + bool RemoveEmpty; }; #endif diff --git a/Source/cmCommandArgumentsHelper.cxx b/Source/cmCommandArgumentsHelper.cxx index d92013788..1d5fc0790 100644 --- a/Source/cmCommandArgumentsHelper.cxx +++ b/Source/cmCommandArgumentsHelper.cxx @@ -12,20 +12,20 @@ #include "cmCommandArgumentsHelper.h" -cmCommandArgument::cmCommandArgument(cmCommandArgumentsHelper* args, - const char* key, +cmCommandArgument::cmCommandArgument(cmCommandArgumentsHelper* args, + const char* key, cmCommandArgumentGroup* group) :Key(key) ,Group(group) ,WasActive(false) ,ArgumentsBeforeEmpty(true) -,CurrentIndex(0) +,CurrentIndex(0) { if (args!=0) { args->AddArgument(this); } - + if (this->Group!=0) { this->Group->ContainedArguments.push_back(this); @@ -50,7 +50,7 @@ void cmCommandArgument::FollowsGroup(const cmCommandArgumentGroup* group) if (group!=0) { this->ArgumentsBeforeEmpty = false; - for(std::vector::const_iterator + for(std::vector::const_iterator argIt= group->ContainedArguments.begin(); argIt != group->ContainedArguments.end(); ++argIt) @@ -67,7 +67,7 @@ bool cmCommandArgument::MayFollow(const cmCommandArgument* current) const return true; } - std::set::const_iterator argIt + std::set::const_iterator argIt = this->ArgumentsBefore.find(current); if (argIt != this->ArgumentsBefore.end()) { @@ -90,7 +90,7 @@ void cmCommandArgument::ApplyOwnGroup() { if (this->Group!=0) { - for (std::vector::const_iterator + for (std::vector::const_iterator it = this->Group->ContainedArguments.begin(); it != this->Group->ContainedArguments.end(); ++it) @@ -105,7 +105,7 @@ void cmCommandArgument::ApplyOwnGroup() void cmCommandArgument::Activate() { - this->WasActive = true; + this->WasActive = true; this->CurrentIndex = 0; } @@ -117,8 +117,8 @@ bool cmCommandArgument::Consume(const std::string& arg) } -cmCAStringVector::cmCAStringVector(cmCommandArgumentsHelper* args, - const char* key, +cmCAStringVector::cmCAStringVector(cmCommandArgumentsHelper* args, + const char* key, cmCommandArgumentGroup* group) :cmCommandArgument(args, key, group) ,Ignore(0) @@ -151,8 +151,8 @@ void cmCAStringVector::DoReset() this->Vector.clear(); } -cmCAString::cmCAString(cmCommandArgumentsHelper* args, - const char* key, +cmCAString::cmCAString(cmCommandArgumentsHelper* args, + const char* key, cmCommandArgumentGroup* group) :cmCommandArgument(args, key, group) { @@ -181,11 +181,11 @@ void cmCAString::DoReset() this->String = ""; } -cmCAEnabler::cmCAEnabler(cmCommandArgumentsHelper* args, - const char* key, +cmCAEnabler::cmCAEnabler(cmCommandArgumentsHelper* args, + const char* key, cmCommandArgumentGroup* group) :cmCommandArgument(args, key, group) -,Enabled(false) +,Enabled(false) {} bool cmCAEnabler::DoConsume(const std::string&, unsigned int index) @@ -202,11 +202,11 @@ void cmCAEnabler::DoReset() this->Enabled = false; } -cmCADisabler::cmCADisabler(cmCommandArgumentsHelper* args, - const char* key, +cmCADisabler::cmCADisabler(cmCommandArgumentsHelper* args, + const char* key, cmCommandArgumentGroup* group) :cmCommandArgument(args, key, group) -,Enabled(true) +,Enabled(true) {} bool cmCADisabler::DoConsume(const std::string&, unsigned int index) @@ -225,7 +225,7 @@ void cmCADisabler::DoReset() void cmCommandArgumentGroup::Follows(const cmCommandArgument* arg) { - for(std::vector::iterator + for(std::vector::iterator it = this->ContainedArguments.begin(); it != this->ContainedArguments.end(); ++it) @@ -236,7 +236,7 @@ void cmCommandArgumentGroup::Follows(const cmCommandArgument* arg) void cmCommandArgumentGroup::FollowsGroup(const cmCommandArgumentGroup* group) { - for(std::vector::iterator + for(std::vector::iterator it = this->ContainedArguments.begin(); it != this->ContainedArguments.end(); ++it) @@ -245,7 +245,7 @@ void cmCommandArgumentGroup::FollowsGroup(const cmCommandArgumentGroup* group) } } -void cmCommandArgumentsHelper::Parse(const std::vector* args, +void cmCommandArgumentsHelper::Parse(const std::vector* args, std::vector* unconsumedArgs) { if(args==0) @@ -253,7 +253,7 @@ void cmCommandArgumentsHelper::Parse(const std::vector* args, return; } - for(std::vector::iterator + for(std::vector::iterator argIt = this->Arguments.begin(); argIt != this->Arguments.end(); ++argIt) @@ -268,7 +268,7 @@ void cmCommandArgumentsHelper::Parse(const std::vector* args, it != args->end(); ++it) { - for(std::vector::iterator + for(std::vector::iterator argIt = this->Arguments.begin(); argIt != this->Arguments.end(); ++argIt) diff --git a/Source/cmCommandArgumentsHelper.h b/Source/cmCommandArgumentsHelper.h index 3b0b058fd..f732f8f1d 100644 --- a/Source/cmCommandArgumentsHelper.h +++ b/Source/cmCommandArgumentsHelper.h @@ -18,7 +18,7 @@ class cmCommandArgumentsHelper; class cmCommandArgumentGroup; /* cmCommandArgumentsHelper, cmCommandArgumentGroup and cmCommandArgument (i.e. -its derived classes cmCAXXX can be used to simplify the processing of +its derived classes cmCAXXX can be used to simplify the processing of arguments to cmake commands. Maybe they can also be used to generate documentation. @@ -26,11 +26,11 @@ For every argument supported by a command one cmCommandArgument is created and added to cmCommandArgumentsHelper. cmCommand has a cmCommandArgumentsHelper as member variable so this should be used. -The order of the arguments is defined using the Follows(arg) method. It says +The order of the arguments is defined using the Follows(arg) method. It says that this argument follows immediateley the given argument. It can be used with multiple arguments if the argument can follow after different arguments. -Arguments can be arranged in groups using cmCommandArgumentGroup. Every +Arguments can be arranged in groups using cmCommandArgumentGroup. Every member of a group can follow any other member of the group. These groups can also be used to define the order. @@ -42,8 +42,8 @@ For an example see cmExportCommand.cxx. class cmCommandArgument { public: - cmCommandArgument(cmCommandArgumentsHelper* args, - const char* key, + cmCommandArgument(cmCommandArgumentsHelper* args, + const char* key, cmCommandArgumentGroup* group=0); virtual ~cmCommandArgument() {} @@ -56,8 +56,8 @@ class cmCommandArgument /// Returns true if the argument was found in the argument list bool WasFound() const {return this->WasActive;} - // The following methods are only called from - // cmCommandArgumentsHelper::Parse(), but making this a friend would + // The following methods are only called from + // cmCommandArgumentsHelper::Parse(), but making this a friend would // give it access to everything /// Make the current argument the currently active argument @@ -89,19 +89,19 @@ class cmCommandArgument virtual void DoReset() = 0; }; -/** cmCAStringVector is to be used for arguments which can consist of more +/** cmCAStringVector is to be used for arguments which can consist of more than one string, e.g. the FILES argument in INSTALL(FILES f1 f2 f3 ...). */ class cmCAStringVector : public cmCommandArgument { public: - cmCAStringVector(cmCommandArgumentsHelper* args, - const char* key, + cmCAStringVector(cmCommandArgumentsHelper* args, + const char* key, cmCommandArgumentGroup* group=0); /// Return the vector of strings const std::vector& GetVector() const {return this->Vector;} - /** Is there a keyword which should be skipped in + /** Is there a keyword which should be skipped in the arguments (e.g. ARGS for ADD_CUSTOM_COMMAND) ? */ void SetIgnore(const char* ignore) {this->Ignore=ignore;} private: @@ -118,8 +118,8 @@ e.g. the executable name in ADD_EXECUTABLE(). */ class cmCAString : public cmCommandArgument { public: - cmCAString(cmCommandArgumentsHelper* args, - const char* key, + cmCAString(cmCommandArgumentsHelper* args, + const char* key, cmCommandArgumentGroup* group=0); /// Return the string @@ -138,8 +138,8 @@ enabled using a special argument, e.g. EXCLUDE_FROM_ALL in ADD_EXECUTABLE(). */ class cmCAEnabler : public cmCommandArgument { public: - cmCAEnabler(cmCommandArgumentsHelper* args, - const char* key, + cmCAEnabler(cmCommandArgumentsHelper* args, + const char* key, cmCommandArgumentGroup* group=0); /// Has it been enabled ? @@ -156,8 +156,8 @@ disabled using a special argument.*/ class cmCADisabler : public cmCommandArgument { public: - cmCADisabler(cmCommandArgumentsHelper* args, - const char* key, + cmCADisabler(cmCommandArgumentsHelper* args, + const char* key, cmCommandArgumentGroup* group=0); /// Is it still enabled ? @@ -170,7 +170,7 @@ class cmCADisabler : public cmCommandArgument }; -/** Group of arguments, needed for ordering. E.g. WIN32, EXCLUDE_FROM_ALL and +/** Group of arguments, needed for ordering. E.g. WIN32, EXCLUDE_FROM_ALL and MACSOX_BUNDLE from ADD_EXECUTABLE() are a group. */ class cmCommandArgumentGroup @@ -192,7 +192,7 @@ class cmCommandArgumentsHelper { public: /// Parse the argument list - void Parse(const std::vector* args, + void Parse(const std::vector* args, std::vector* unconsumedArgs); /// Add an argument. void AddArgument(cmCommandArgument* arg); diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 49ed96795..227b22678 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -28,6 +28,9 @@ #include "cmRemoveDefinitionsCommand.cxx" #include "cmSourceGroupCommand.cxx" #include "cmSubdirDependsCommand.cxx" +#include "cmTargetCompileDefinitionsCommand.cxx" +#include "cmTargetIncludeDirectoriesCommand.cxx" +#include "cmTargetPropCommandBase.cxx" #include "cmUseMangledMesaCommand.cxx" #include "cmUtilitySourceCommand.cxx" #include "cmVariableRequiresCommand.cxx" @@ -66,6 +69,8 @@ void GetPredefinedCommands(std::list& commands.push_back(new cmRemoveDefinitionsCommand); commands.push_back(new cmSourceGroupCommand); commands.push_back(new cmSubdirDependsCommand); + commands.push_back(new cmTargetIncludeDirectoriesCommand); + commands.push_back(new cmTargetCompileDefinitionsCommand); commands.push_back(new cmUseMangledMesaCommand); commands.push_back(new cmUtilitySourceCommand); commands.push_back(new cmVariableRequiresCommand); diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 055aab032..dec2b54d1 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -172,10 +172,11 @@ satisfy dependencies. //---------------------------------------------------------------------------- cmComputeLinkDepends -::cmComputeLinkDepends(cmTarget* target, const char* config) +::cmComputeLinkDepends(cmTarget* target, const char* config, cmTarget* head) { // Store context information. this->Target = target; + this->HeadTarget = head; this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = this->Makefile->GetLocalGenerator(); this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); @@ -352,7 +353,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe) { // Follow the target dependencies. if(cmTarget::LinkInterface const* iface = - entry.Target->GetLinkInterface(this->Config)) + entry.Target->GetLinkInterface(this->Config, this->HeadTarget)) { // This target provides its own link interface information. this->AddLinkEntries(depender_index, iface->Libraries); @@ -444,7 +445,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) if(entry.Target) { if(cmTarget::LinkInterface const* iface = - entry.Target->GetLinkInterface(this->Config)) + entry.Target->GetLinkInterface(this->Config, this->HeadTarget)) { // Follow public and private dependencies transitively. this->FollowSharedDeps(index, iface, true); @@ -533,7 +534,7 @@ void cmComputeLinkDepends::AddDirectLinkEntries() { // Add direct link dependencies in this configuration. cmTarget::LinkImplementation const* impl = - this->Target->GetLinkImplementation(this->Config); + this->Target->GetLinkImplementation(this->Config, this->HeadTarget); this->AddLinkEntries(-1, impl->Libraries); for(std::vector::const_iterator wi = impl->WrongConfigLibraries.begin(); @@ -944,7 +945,7 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl) if(cmTarget* target = this->EntryList[*ni].Target) { if(cmTarget::LinkInterface const* iface = - target->GetLinkInterface(this->Config)) + target->GetLinkInterface(this->Config, this->HeadTarget)) { if(iface->Multiplicity > count) { diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 80a04541f..1d5d1b920 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -32,7 +32,7 @@ class cmake; class cmComputeLinkDepends { public: - cmComputeLinkDepends(cmTarget* target, const char* config); + cmComputeLinkDepends(cmTarget* target, const char* config, cmTarget *head); ~cmComputeLinkDepends(); // Basic information about each link item. @@ -59,6 +59,7 @@ private: // Context information. cmTarget* Target; + cmTarget* HeadTarget; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; cmGlobalGenerator* GlobalGenerator; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index df78bf886..896b50aa5 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -239,10 +239,12 @@ because this need be done only for shared libraries without soname-s. //---------------------------------------------------------------------------- cmComputeLinkInformation -::cmComputeLinkInformation(cmTarget* target, const char* config) +::cmComputeLinkInformation(cmTarget* target, const char* config, + cmTarget *headTarget) { // Store context information. this->Target = target; + this->HeadTarget = headTarget; this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = this->Makefile->GetLocalGenerator(); this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); @@ -265,7 +267,7 @@ cmComputeLinkInformation this->OrderDependentRPath = 0; // Get the language used for linking this target. - this->LinkLanguage = this->Target->GetLinkerLanguage(config); + this->LinkLanguage = this->Target->GetLinkerLanguage(config, headTarget); if(!this->LinkLanguage) { // The Compute method will do nothing, so skip the rest of the @@ -277,6 +279,10 @@ cmComputeLinkInformation this->UseImportLibrary = this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")?true:false; + // Check whether we should skip dependencies on shared library files. + this->LinkDependsNoShared = + this->Target->GetPropertyAsBool("LINK_DEPENDS_NO_SHARED"); + // On platforms without import libraries there may be a special flag // to use when creating a plugin (module) that obtains symbols from // the program that will load it. @@ -499,7 +505,7 @@ bool cmComputeLinkInformation::Compute() } // Compute the ordered link line items. - cmComputeLinkDepends cld(this->Target, this->Config); + cmComputeLinkDepends cld(this->Target, this->Config, this->HeadTarget); cld.SetOldLinkDirMode(this->OldLinkDirMode); cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute(); @@ -565,7 +571,8 @@ bool cmComputeLinkInformation::Compute() void cmComputeLinkInformation::AddImplicitLinkInfo() { // The link closure lists all languages whose implicit info is needed. - cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config); + cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config, + this->HeadTarget); for(std::vector::const_iterator li = lc->Languages.begin(); li != lc->Languages.end(); ++li) { @@ -650,7 +657,11 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt) // Pass the full path to the target file. std::string lib = tgt->GetFullPath(config, implib, true); - this->Depends.push_back(lib); + if(!this->LinkDependsNoShared || + tgt->GetType() != cmTarget::SHARED_LIBRARY) + { + this->Depends.push_back(lib); + } this->AddTargetItem(lib, tgt); this->AddLibraryRuntimeInfo(lib, tgt); @@ -1214,7 +1225,7 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item, { // if this is a -l option then we might need to warn about // CMP0003 so put it in OldUserFlagItems, if it is not a -l - // or -Wl,-l (-framework -pthread), then allow it without a + // or -Wl,-l (-framework -pthread), then allow it without a // CMP0003 as -L will not affect those other linker flags if(item.find("-l") == 0 || item.find("-Wl,-l") == 0) { @@ -1368,10 +1379,31 @@ void cmComputeLinkInformation::DropDirectoryItem(std::string const& item) //---------------------------------------------------------------------------- void cmComputeLinkInformation::ComputeFrameworkInfo() { - // Avoid adding system framework paths. See "man ld" on OS X. - this->FrameworkPathsEmmitted.insert("/Library/Frameworks"); - this->FrameworkPathsEmmitted.insert("/Network/Library/Frameworks"); - this->FrameworkPathsEmmitted.insert("/System/Library/Frameworks"); + // Avoid adding implicit framework paths. + std::vector implicitDirVec; + + // Get platform-wide implicit directories. + if(const char* implicitLinks = this->Makefile->GetDefinition + ("CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES")) + { + cmSystemTools::ExpandListArgument(implicitLinks, implicitDirVec); + } + + // Get language-specific implicit directories. + std::string implicitDirVar = "CMAKE_"; + implicitDirVar += this->LinkLanguage; + implicitDirVar += "_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES"; + if(const char* implicitDirs = + this->Makefile->GetDefinition(implicitDirVar.c_str())) + { + cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec); + } + + for(std::vector::const_iterator i = implicitDirVec.begin(); + i != implicitDirVec.end(); ++i) + { + this->FrameworkPathsEmmitted.insert(*i); + } // Regular expression to extract a framework path and name. this->SplitFramework.compile("(.*)/(.*)\\.framework$"); @@ -1751,6 +1783,22 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath) } } +//---------------------------------------------------------------------------- +static void cmCLI_ExpandListUnique(const char* str, + std::vector& out, + std::set& emitted) +{ + std::vector tmp; + cmSystemTools::ExpandListArgument(str, tmp); + for(std::vector::iterator i = tmp.begin(); i != tmp.end(); ++i) + { + if(emitted.insert(*i).second) + { + out.push_back(*i); + } + } +} + //---------------------------------------------------------------------------- void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, bool for_install) @@ -1768,7 +1816,7 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, (outputRuntime && this->Target->HaveInstallTreeRPATH() && linking_for_install); bool use_build_rpath = - (outputRuntime && this->Target->HaveBuildTreeRPATH() && + (outputRuntime && this->Target->HaveBuildTreeRPATH(this->Config) && !linking_for_install); bool use_link_rpath = outputRuntime && linking_for_install && @@ -1776,10 +1824,11 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, this->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH"); // Construct the RPATH. + std::set emitted; if(use_install_rpath) { const char* install_rpath = this->Target->GetProperty("INSTALL_RPATH"); - cmSystemTools::ExpandListArgument(install_rpath, runtimeDirs); + cmCLI_ExpandListUnique(install_rpath, runtimeDirs, emitted); } if(use_build_rpath || use_link_rpath) { @@ -1791,7 +1840,10 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, // support or if using the link path as an rpath. if(use_build_rpath) { - runtimeDirs.push_back(*ri); + if(emitted.insert(*ri).second) + { + runtimeDirs.push_back(*ri); + } } else if(use_link_rpath) { @@ -1803,15 +1855,40 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, !cmSystemTools::IsSubDirectory(ri->c_str(), topSourceDir) && !cmSystemTools::IsSubDirectory(ri->c_str(), topBinaryDir)) { - runtimeDirs.push_back(*ri); + if(emitted.insert(*ri).second) + { + runtimeDirs.push_back(*ri); + } } } } } + // Add runtime paths required by the languages to always be + // present. This is done even when skipping rpath support. + { + cmTarget::LinkClosure const* lc = + this->Target->GetLinkClosure(this->Config, this->HeadTarget); + for(std::vector::const_iterator li = lc->Languages.begin(); + li != lc->Languages.end(); ++li) + { + std::string useVar = "CMAKE_" + *li + + "_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH"; + if(this->Makefile->IsOn(useVar.c_str())) + { + std::string dirVar = "CMAKE_" + *li + + "_IMPLICIT_LINK_DIRECTORIES"; + if(const char* dirs = this->Makefile->GetDefinition(dirVar.c_str())) + { + cmCLI_ExpandListUnique(dirs, runtimeDirs, emitted); + } + } + } + } + // Add runtime paths required by the platform to always be // present. This is done even when skipping rpath support. - cmSystemTools::ExpandListArgument(this->RuntimeAlways.c_str(), runtimeDirs); + cmCLI_ExpandListUnique(this->RuntimeAlways.c_str(), runtimeDirs, emitted); } //---------------------------------------------------------------------------- diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index f60f8d325..1a76922a5 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -29,7 +29,8 @@ class cmOrderDirectories; class cmComputeLinkInformation { public: - cmComputeLinkInformation(cmTarget* target, const char* config); + cmComputeLinkInformation(cmTarget* target, const char* config, + cmTarget* headTarget); ~cmComputeLinkInformation(); bool Compute(); @@ -74,6 +75,7 @@ private: // Context information. cmTarget* Target; + cmTarget* HeadTarget; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; cmGlobalGenerator* GlobalGenerator; @@ -82,6 +84,7 @@ private: // Configuration information. const char* Config; const char* LinkLanguage; + bool LinkDependsNoShared; // Modes for dealing with dependent shared libraries. enum SharedDepMode diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index ab77c6bc9..8fd95b9cd 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -200,20 +200,48 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Get the depender. cmTarget* depender = this->Targets[depender_index]; - // Loop over all targets linked directly. + // Loop over all targets linked directly in all configs. + // We need to make targets depend on the union of all config-specific + // dependencies in all targets, because the generated build-systems can't + // deal with config-specific dependencies. { - cmTarget::LinkLibraryVectorType const& tlibs = - depender->GetOriginalLinkLibraries(); std::set emitted; + { + std::vector tlibs; + depender->GetDirectLinkLibraries(0, tlibs, depender); // A target should not depend on itself. emitted.insert(depender->GetName()); - for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin(); + for(std::vector::const_iterator lib = tlibs.begin(); lib != tlibs.end(); ++lib) { // Don't emit the same library twice for this target. - if(emitted.insert(lib->first).second) + if(emitted.insert(*lib).second) { - this->AddTargetDepend(depender_index, lib->first.c_str(), true); + this->AddTargetDepend(depender_index, lib->c_str(), true); + this->AddInterfaceDepends(depender_index, lib->c_str(), + true, emitted); + } + } + } + std::vector configs; + depender->GetMakefile()->GetConfigurations(configs); + for (std::vector::const_iterator it = configs.begin(); + it != configs.end(); ++it) + { + std::vector tlibs; + depender->GetDirectLinkLibraries(it->c_str(), tlibs, depender); + // A target should not depend on itself. + emitted.insert(depender->GetName()); + for(std::vector::const_iterator lib = tlibs.begin(); + lib != tlibs.end(); ++lib) + { + // Don't emit the same library twice for this target. + if(emitted.insert(*lib).second) + { + this->AddTargetDepend(depender_index, lib->c_str(), true); + this->AddInterfaceDepends(depender_index, lib->c_str(), + true, emitted); + } } } } @@ -236,6 +264,64 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) } } +//---------------------------------------------------------------------------- +void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, + cmTarget* dependee, + const char *config, + std::set &emitted) +{ + cmTarget* depender = this->Targets[depender_index]; + if(cmTarget::LinkInterface const* iface = + dependee->GetLinkInterface(config, depender)) + { + for(std::vector::const_iterator + lib = iface->Libraries.begin(); + lib != iface->Libraries.end(); ++lib) + { + // Don't emit the same library twice for this target. + if(emitted.insert(*lib).second) + { + this->AddTargetDepend(depender_index, lib->c_str(), true); + } + } + } +} + +//---------------------------------------------------------------------------- +void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, + const char* dependee_name, + bool linking, + std::set &emitted) +{ + cmTarget* depender = this->Targets[depender_index]; + cmTarget* dependee = + depender->GetMakefile()->FindTargetToUse(dependee_name); + // Skip targets that will not really be linked. This is probably a + // name conflict between an external library and an executable + // within the project. + if(linking && dependee && + dependee->GetType() == cmTarget::EXECUTABLE && + !dependee->IsExecutableWithExports()) + { + dependee = 0; + } + + if(dependee) + { + this->AddInterfaceDepends(depender_index, dependee, 0, emitted); + std::vector configs; + depender->GetMakefile()->GetConfigurations(configs); + for (std::vector::const_iterator it = configs.begin(); + it != configs.end(); ++it) + { + // A target should not depend on itself. + emitted.insert(depender->GetName()); + this->AddInterfaceDepends(depender_index, dependee, + it->c_str(), emitted); + } + } +} + //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddTargetDepend(int depender_index, const char* dependee_name, diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index 67bce72d9..d6131cf1c 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -48,7 +48,11 @@ private: bool linking); void AddTargetDepend(int depender_index, cmTarget* dependee, bool linking); bool ComputeFinalDepends(cmComputeComponentGraph const& ccg); - + void AddInterfaceDepends(int depender_index, const char* dependee_name, + bool linking, std::set &emitted); + void AddInterfaceDepends(int depender_index, cmTarget* dependee, + const char *config, + std::set &emitted); cmGlobalGenerator* GlobalGenerator; bool DebugMode; bool NoCycles; diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index ea98326e2..e52ddef35 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -104,7 +104,7 @@ bool cmConfigureFileCommand this->Immediate = true; } } - + // If we were told to copy the file immediately, then do it on the // first pass (now). if(this->Immediate) @@ -115,7 +115,7 @@ bool cmConfigureFileCommand return false; } } - + return true; } diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h index de497a952..0393ecfa9 100644 --- a/Source/cmConfigureFileCommand.h +++ b/Source/cmConfigureFileCommand.h @@ -19,7 +19,7 @@ class cmConfigureFileCommand : public cmCommand public: cmTypeMacro(cmConfigureFileCommand, cmCommand); - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmConfigureFileCommand; } @@ -48,7 +48,7 @@ public: { return "Copy a file to another location and modify its contents."; } - + /** * Longer documentation. */ @@ -68,6 +68,9 @@ public: "If names an existing directory the input file is placed " "in that directory with its original name. " "\n" + "If the file is modified the build system will re-run CMake " + "to re-configure the file and generate the build system again." + "\n" "This command replaces any variables in the input file referenced as " "${VAR} or @VAR@ with their values as determined by CMake. If a " "variable is not defined, it will be replaced with nothing. " @@ -76,13 +79,18 @@ public: "will be C-style escaped. " "The file will be configured with the current values of CMake " "variables. If @ONLY is specified, only variables " - "of the form @VAR@ will be replaces and ${VAR} will be ignored. " - "This is useful for configuring scripts that use ${VAR}. " - "Any occurrences of #cmakedefine VAR will be replaced with " - "either #define VAR or /* #undef VAR */ depending on " - "the setting of VAR in CMake. Any occurrences of #cmakedefine01 VAR " - "will be replaced with either #define VAR 1 or #define VAR 0 " - "depending on whether VAR evaluates to TRUE or FALSE in CMake.\n" + "of the form @VAR@ will be replaced and ${VAR} will be ignored. " + "This is useful for configuring scripts that use ${VAR}." + "\n" + "Input file lines of the form \"#cmakedefine VAR ...\" " + "will be replaced with either \"#define VAR ...\" or " + "\"/* #undef VAR */\" depending on whether VAR is set in CMake to " + "any value not considered a false constant by the if() command. " + "(Content of \"...\", if any, is processed as above.) " + "Input file lines of the form \"#cmakedefine01 VAR\" " + "will be replaced with either \"#define VAR 1\" or " + "\"#define VAR 0\" similarly." + "\n" "With NEWLINE_STYLE the line ending could be adjusted: \n" " 'UNIX' or 'LF' for \\n, 'DOS', 'WIN32' or 'CRLF' for \\r\\n.\n" "COPYONLY must not be used with NEWLINE_STYLE.\n"; @@ -93,7 +101,7 @@ public: private: int ConfigureFile(); - + cmNewLineStyle NewLineStyle; std::string InputFile; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 1ae70350b..387f6ed5b 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -13,8 +13,11 @@ #include "cmake.h" #include "cmCacheManager.h" #include "cmGlobalGenerator.h" +#include "cmExportTryCompileFileGenerator.h" #include +#include + int cmCoreTryCompile::TryCompileCode(std::vector const& argv) { this->BinaryDirectory = argv[1].c_str(); @@ -39,7 +42,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) // is not used, so it matches regular command line parsing which has // the program name as arg 0 for (; i < argv.size() && argv[i] != "COMPILE_DEFINITIONS" && - argv[i] != "OUTPUT_VARIABLE"; + argv[i] != "OUTPUT_VARIABLE" && + argv[i] != "LINK_LIBRARIES"; ++i) { extraArgs++; @@ -75,7 +79,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) { extraArgs++; for (i = i + 1; i < argv.size() && argv[i] != "CMAKE_FLAGS" && - argv[i] != "OUTPUT_VARIABLE"; + argv[i] != "OUTPUT_VARIABLE" && + argv[i] != "LINK_LIBRARIES"; ++i) { extraArgs++; @@ -85,6 +90,61 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) } } + std::vector targets; + std::string libsToLink = " "; + bool useOldLinkLibs = true; + for (i = 3; i < argv.size(); ++i) + { + if (argv[i] == "LINK_LIBRARIES") + { + if ( argv.size() <= (i+1) ) + { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, + "LINK_LIBRARIES specified but there is no content"); + return -1; + } + extraArgs++; + ++i; + useOldLinkLibs = false; + for ( ; i < argv.size() && argv[i] != "CMAKE_FLAGS" + && argv[i] != "COMPILE_DEFINITIONS" && argv[i] != "OUTPUT_VARIABLE"; + ++i) + { + extraArgs++; + libsToLink += argv[i] + " "; + cmTarget *tgt = this->Makefile->FindTargetToUse(argv[i].c_str()); + if (!tgt) + { + continue; + } + switch(tgt->GetType()) + { + case cmTarget::SHARED_LIBRARY: + case cmTarget::STATIC_LIBRARY: + case cmTarget::UNKNOWN_LIBRARY: + break; + case cmTarget::EXECUTABLE: + if (tgt->IsExecutableWithExports()) + { + break; + } + default: + this->Makefile->IssueMessage(cmake::FATAL_ERROR, + "Only libraries may be used as try_compile IMPORTED " + "LINK_LIBRARIES. Got " + std::string(tgt->GetName()) + " of " + "type " + tgt->GetTargetTypeName(tgt->GetType()) + "."); + return -1; + } + if (!tgt->IsImported()) + { + continue; + } + targets.push_back(tgt); + } + break; + } + } + // look for COPY_FILE std::string copyFile; for (i = 3; i < argv.size(); ++i) @@ -247,6 +307,32 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) fprintf(fout, ")\n"); } + /* Use a random file name to avoid rapid creation and deletion + of the same executable name (some filesystems fail on that). */ + sprintf(targetNameBuf, "cmTryCompileExec%u", + cmSystemTools::RandomSeed()); + targetName = targetNameBuf; + + if (!targets.empty()) + { + std::string fname = "/" + std::string(targetName) + "Targets.cmake"; + cmExportTryCompileFileGenerator tcfg; + tcfg.SetExportFile((this->BinaryDirectory + fname).c_str()); + tcfg.SetExports(targets); + tcfg.SetConfig(this->Makefile->GetDefinition( + "CMAKE_TRY_COMPILE_CONFIGURATION")); + + if(!tcfg.GenerateImportFile()) + { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, + "could not write export file."); + return -1; + } + fprintf(fout, + "\ninclude(\"${CMAKE_CURRENT_LIST_DIR}/%s\")\n\n", + fname.c_str()); + } + /* for the TRY_COMPILEs we want to be able to specify the architecture. So the user can set CMAKE_OSX_ARCHITECTURE to i386;ppc and then set CMAKE_TRY_COMPILE_OSX_ARCHITECTURE first to i386 and then to ppc to @@ -286,18 +372,22 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) fprintf(fout, "SET(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n"); } - /* Use a random file name to avoid rapid creation and deletion - of the same executable name (some filesystems fail on that). */ - sprintf(targetNameBuf, "cmTryCompileExec%u", - cmSystemTools::RandomSeed()); - targetName = targetNameBuf; - /* Put the executable at a known location (for COPY_FILE). */ fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", this->BinaryDirectory.c_str()); /* Create the actual executable. */ fprintf(fout, "ADD_EXECUTABLE(%s \"%s\")\n", targetName, source.c_str()); - fprintf(fout, "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName); + if (useOldLinkLibs) + { + fprintf(fout, + "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName); + } + else + { + fprintf(fout, "TARGET_LINK_LIBRARIES(%s %s)\n", + targetName, + libsToLink.c_str()); + } fclose(fout); projectName = "CMAKE_TRY_COMPILE"; // if the source is not in CMakeTmp diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h index 806e5a909..3aa0a79cf 100644 --- a/Source/cmCreateTestSourceList.h +++ b/Source/cmCreateTestSourceList.h @@ -15,7 +15,7 @@ #include "cmCommand.h" /** \class cmCreateTestSourceList - * \brief + * \brief * */ @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmCreateTestSourceList; } @@ -41,7 +41,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "create_test_sourcelist";} - + /** * Succinct documentation. */ @@ -49,7 +49,7 @@ public: { return "Create a test driver and source list for building test programs."; } - + /** * More documentation. */ @@ -81,7 +81,7 @@ public: "CMAKE_TESTDRIVER_AFTER_TESTMAIN can be set to have code that will be " "placed directly after the call to the test main function."; } - + cmTypeMacro(cmCreateTestSourceList, cmCommand); }; diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index a65012905..f2f77eea0 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -21,7 +21,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( cmCustomCommand const& cc, const char* config, cmMakefile* mf): CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()), OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), - GE(new cmGeneratorExpression(mf, config, cc.GetBacktrace())) + GE(new cmGeneratorExpression(cc.GetBacktrace())) { } @@ -47,7 +47,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { return target->GetLocation(this->Config); } - return this->GE->Process(argv0); + return this->GE->Parse(argv0)->Evaluate(this->Makefile, this->Config); } //---------------------------------------------------------------------------- @@ -58,7 +58,8 @@ cmCustomCommandGenerator cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c]; for(unsigned int j=1;j < commandLine.size(); ++j) { - std::string arg = this->GE->Process(commandLine[j]); + std::string arg = this->GE->Parse(commandLine[j])->Evaluate(this->Makefile, + this->Config); cmd += " "; if(this->OldStyle) { diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h index 55ef52137..b5175d50b 100644 --- a/Source/cmDefinePropertyCommand.h +++ b/Source/cmDefinePropertyCommand.h @@ -17,7 +17,7 @@ class cmDefinePropertyCommand : public cmCommand { public: - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmDefinePropertyCommand; } @@ -41,7 +41,7 @@ public: { return "Define and document custom properties."; } - + /** * Longer documentation. */ @@ -80,7 +80,7 @@ public: "Corresponding options to the get_property command will retrieve the " "documentation."; } - + cmTypeMacro(cmDefinePropertyCommand, cmCommand); private: std::string PropertyName; diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 9296d4cca..74a0ccb21 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -50,6 +50,7 @@ bool cmDepends::Write(std::ostream &makeDepends, std::vector pairs; cmSystemTools::ExpandListArgument(srcStr, pairs); + std::map > dependencies; for(std::vector::iterator si = pairs.begin(); si != pairs.end();) { @@ -62,9 +63,14 @@ bool cmDepends::Write(std::ostream &makeDepends, obj = this->LocalGenerator->Convert(obj.c_str(), cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); + dependencies[obj].insert(src); + } + for(std::map >::const_iterator + it = dependencies.begin(); it != dependencies.end(); ++it) + { // Write the dependencies for this pair. - if(!this->WriteDependencies(src.c_str(), obj.c_str(), + if(!this->WriteDependencies(it->second, it->first, makeDepends, internalDepends)) { return false; @@ -98,7 +104,7 @@ bool cmDepends::Check(const char *makeFile, const char *internalFile, // Check whether dependencies must be regenerated. bool okay = true; std::ifstream fin(internalFile); - if(!(fin && this->CheckDependencies(fin, validDeps))) + if(!(fin && this->CheckDependencies(fin, internalFile, validDeps))) { // Clear all dependencies so they will be regenerated. this->Clear(makeFile); @@ -134,8 +140,9 @@ void cmDepends::Clear(const char *file) } //---------------------------------------------------------------------------- -bool cmDepends::WriteDependencies(const char*, const char*, - std::ostream&, std::ostream&) +bool cmDepends::WriteDependencies( + const std::set&, const std::string&, + std::ostream&, std::ostream&) { // This should be implemented by the subclass. return false; @@ -143,6 +150,7 @@ bool cmDepends::WriteDependencies(const char*, const char*, //---------------------------------------------------------------------------- bool cmDepends::CheckDependencies(std::istream& internalDepends, + const char* internalDependsFileName, std::map& validDeps) { // Parse dependencies from the stream. If any dependee is missing @@ -154,7 +162,7 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, while(internalDepends.getline(this->Dependee, this->MaxPath)) { - if ( this->Dependee[0] == 0 || this->Dependee[0] == '#' || + if ( this->Dependee[0] == 0 || this->Dependee[0] == '#' || this->Dependee[0] == '\r' ) { continue; @@ -173,8 +181,10 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, // kdelibs/khtml this reduces the number of calls from 184k down to 92k, // or the time for cmake -E cmake_depends from 0.3 s down to 0.21 s. dependerExists = cmSystemTools::FileExists(this->Depender); - DependencyVector tmp; - validDeps[this->Depender] = tmp; + // If we erase validDeps[this->Depender] by overwriting it with an empty + // vector, we lose dependencies for dependers that have multiple + // entries. No need to initialize the entry, std::map will do so on first + // access. currentDependencies = &validDeps[this->Depender]; continue; } @@ -186,8 +196,11 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, } */ - // Dependencies must be regenerated if the dependee does not exist - // or if the depender exists and is older than the dependee. + // Dependencies must be regenerated + // * if the dependee does not exist + // * if the depender exists and is older than the dependee. + // * if the depender does not exist, but the dependee is newer than the + // depends file bool regenerate = false; const char* dependee = this->Dependee+1; const char* depender = this->Depender; @@ -211,24 +224,49 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, cmSystemTools::Stdout(msg.str().c_str()); } } - else if(dependerExists) + else { - // The dependee and depender both exist. Compare file times. - int result = 0; - if((!this->FileComparison->FileTimeCompare(depender, dependee, - &result) || result < 0)) + if(dependerExists) { - // The depender is older than the dependee. - regenerate = true; + // The dependee and depender both exist. Compare file times. + int result = 0; + if((!this->FileComparison->FileTimeCompare(depender, dependee, + &result) || result < 0)) + { + // The depender is older than the dependee. + regenerate = true; - // Print verbose output. - if(this->Verbose) + // Print verbose output. + if(this->Verbose) + { + cmOStringStream msg; + msg << "Dependee \"" << dependee + << "\" is newer than depender \"" + << depender << "\"." << std::endl; + cmSystemTools::Stdout(msg.str().c_str()); + } + } + } + else + { + // The dependee exists, but the depender doesn't. Regenerate if the + // internalDepends file is older than the dependee. + int result = 0; + if((!this->FileComparison->FileTimeCompare(internalDependsFileName, + dependee, &result) || result < 0)) { - cmOStringStream msg; - msg << "Dependee \"" << dependee - << "\" is newer than depender \"" - << depender << "\"." << std::endl; - cmSystemTools::Stdout(msg.str().c_str()); + // The depends-file is older than the dependee. + regenerate = true; + + // Print verbose output. + if(this->Verbose) + { + cmOStringStream msg; + msg << "Dependee \"" << dependee + << "\" is newer than depends file \"" + << internalDependsFileName << "\"." << std::endl; + cmSystemTools::Stdout(msg.str().c_str()); + } } } } diff --git a/Source/cmDepends.h b/Source/cmDepends.h index 087da6400..d787eddc6 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -30,7 +30,7 @@ public: /** Instances need to know the build directory name and the relative path from the build directory to the target file. */ cmDepends(cmLocalGenerator* lg=0, const char* targetDir=""); - + /** at what level will the compile be done from */ void SetCompileDirectory(const char *dir) {this->CompileDirectory = dir;}; @@ -48,7 +48,7 @@ public: /** should this be verbose in its output */ void SetVerbose(bool verb) { this->Verbose = verb; } - + /** Virtual destructor to cleanup subclasses properly. */ virtual ~cmDepends(); @@ -69,20 +69,23 @@ public: void Clear(const char *file); /** Set the file comparison object */ - void SetFileComparison(cmFileTimeComparison* fc) { + void SetFileComparison(cmFileTimeComparison* fc) { this->FileComparison = fc; } protected: // Write dependencies for the target file to the given stream. // Return true for success and false for failure. - virtual bool WriteDependencies(const char *src, const char* obj, - std::ostream& makeDepends, std::ostream& internalDepends); + virtual bool WriteDependencies(const std::set& sources, + const std::string& obj, + std::ostream& makeDepends, + std::ostream& internalDepends); // Check dependencies for the target file in the given stream. // Return false if dependencies must be regenerated and true // otherwise. virtual bool CheckDependencies(std::istream& internalDepends, + const char* internalDependsFileName, std::map& validDeps); // Finalize the dependency information for the target. diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 44841a900..43b7b8a60 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -98,176 +98,179 @@ cmDependsC::~cmDependsC() } //---------------------------------------------------------------------------- -bool cmDependsC::WriteDependencies(const char *src, const char *obj, - std::ostream& makeDepends, std::ostream& internalDepends) +bool cmDependsC::WriteDependencies(const std::set& sources, + const std::string& obj, + std::ostream& makeDepends, + std::ostream& internalDepends) { // Make sure this is a scanning instance. - if(!src || src[0] == '\0') + if(sources.empty() || sources.begin()->empty()) { cmSystemTools::Error("Cannot scan dependencies without a source file."); return false; } - if(!obj || obj[0] == '\0') + if(obj.empty()) { cmSystemTools::Error("Cannot scan dependencies without an object file."); return false; } + std::set dependencies; + bool haveDeps = false; + if (this->ValidDeps != 0) { std::map::const_iterator tmpIt = this->ValidDeps->find(obj); if (tmpIt!= this->ValidDeps->end()) { - // Write the dependencies to the output stream. Makefile rules - // written by the original local generator for this directory - // convert the dependencies to paths relative to the home output - // directory. We must do the same here. - internalDepends << obj << std::endl; for(DependencyVector::const_iterator i=tmpIt->second.begin(); i != tmpIt->second.end(); ++i) { - makeDepends << obj << ": " << - this->LocalGenerator->Convert(i->c_str(), - cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE) - << std::endl; - internalDepends << " " << i->c_str() << std::endl; + dependencies.insert(*i); } - makeDepends << std::endl; - return true; + haveDeps = true; } } - // Walk the dependency graph starting with the source file. - bool first = true; - UnscannedEntry root; - root.FileName = src; - this->Unscanned.push(root); - this->Encountered.clear(); - this->Encountered.insert(src); - std::set dependencies; - std::set scanned; + if (!haveDeps) + { + // Walk the dependency graph starting with the source file. + int srcFiles = (int)sources.size(); + this->Encountered.clear(); + + for(std::set::const_iterator srcIt = sources.begin(); + srcIt != sources.end(); ++srcIt) + { + UnscannedEntry root; + root.FileName = *srcIt; + this->Unscanned.push(root); + this->Encountered.insert(*srcIt); + } - // Use reserve to allocate enough memory for tempPathStr - // so that during the loops no memory is allocated or freed - std::string tempPathStr; - tempPathStr.reserve(4*1024); + std::set scanned; - while(!this->Unscanned.empty()) - { - // Get the next file to scan. - UnscannedEntry current = this->Unscanned.front(); - this->Unscanned.pop(); + // Use reserve to allocate enough memory for tempPathStr + // so that during the loops no memory is allocated or freed + std::string tempPathStr; + tempPathStr.reserve(4*1024); - // If not a full path, find the file in the include path. - std::string fullName; - if(first || cmSystemTools::FileIsFullPath(current.FileName.c_str())) + while(!this->Unscanned.empty()) { - if(cmSystemTools::FileExists(current.FileName.c_str(), true)) + // Get the next file to scan. + UnscannedEntry current = this->Unscanned.front(); + this->Unscanned.pop(); + + // If not a full path, find the file in the include path. + std::string fullName; + if((srcFiles>0) + || cmSystemTools::FileIsFullPath(current.FileName.c_str())) { - fullName = current.FileName; + if(cmSystemTools::FileExists(current.FileName.c_str(), true)) + { + fullName = current.FileName; + } } - } - else if(!current.QuotedLocation.empty() && - cmSystemTools::FileExists(current.QuotedLocation.c_str(), true)) - { - // The include statement producing this entry was a double-quote - // include and the included file is present in the directory of - // the source containing the include statement. - fullName = current.QuotedLocation; - } - else - { - std::map::iterator - headerLocationIt=this->HeaderLocationCache.find(current.FileName); - if (headerLocationIt!=this->HeaderLocationCache.end()) + else if(!current.QuotedLocation.empty() && + cmSystemTools::FileExists(current.QuotedLocation.c_str(), true)) { - fullName=headerLocationIt->second; + // The include statement producing this entry was a double-quote + // include and the included file is present in the directory of + // the source containing the include statement. + fullName = current.QuotedLocation; } - else for(std::vector::const_iterator i = - this->IncludePath.begin(); i != this->IncludePath.end(); ++i) + else { - // Construct the name of the file as if it were in the current - // include directory. Avoid using a leading "./". - - tempPathStr = ""; - if((*i) == ".") + std::map::iterator + headerLocationIt=this->HeaderLocationCache.find(current.FileName); + if (headerLocationIt!=this->HeaderLocationCache.end()) { - tempPathStr += current.FileName; + fullName=headerLocationIt->second; } - else + else for(std::vector::const_iterator i = + this->IncludePath.begin(); i != this->IncludePath.end(); ++i) { - tempPathStr += *i; - tempPathStr+="/"; - tempPathStr+=current.FileName; - } + // Construct the name of the file as if it were in the current + // include directory. Avoid using a leading "./". - // Look for the file in this location. - if(cmSystemTools::FileExists(tempPathStr.c_str(), true)) - { - fullName = tempPathStr; - HeaderLocationCache[current.FileName]=fullName; - break; + tempPathStr = ""; + if((*i) == ".") + { + tempPathStr += current.FileName; + } + else + { + tempPathStr += *i; + tempPathStr+="/"; + tempPathStr+=current.FileName; + } + + // Look for the file in this location. + if(cmSystemTools::FileExists(tempPathStr.c_str(), true)) + { + fullName = tempPathStr; + HeaderLocationCache[current.FileName]=fullName; + break; + } } } - } - - // Complain if the file cannot be found and matches the complain - // regex. - if(fullName.empty() && - this->IncludeRegexComplain.find(current.FileName.c_str())) - { - cmSystemTools::Error("Cannot find file \"", - current.FileName.c_str(), "\"."); - return false; - } - // Scan the file if it was found and has not been scanned already. - if(!fullName.empty() && (scanned.find(fullName) == scanned.end())) - { - // Record scanned files. - scanned.insert(fullName); + // Complain if the file cannot be found and matches the complain + // regex. + if(fullName.empty() && + this->IncludeRegexComplain.find(current.FileName.c_str())) + { + cmSystemTools::Error("Cannot find file \"", + current.FileName.c_str(), "\"."); + return false; + } - // Check whether this file is already in the cache - std::map::iterator fileIt= - this->FileCache.find(fullName); - if (fileIt!=this->FileCache.end()) + // Scan the file if it was found and has not been scanned already. + if(!fullName.empty() && (scanned.find(fullName) == scanned.end())) { - fileIt->second->Used=true; - dependencies.insert(fullName); - for (std::vector::const_iterator incIt= - fileIt->second->UnscannedEntries.begin(); - incIt!=fileIt->second->UnscannedEntries.end(); ++incIt) + // Record scanned files. + scanned.insert(fullName); + + // Check whether this file is already in the cache + std::map::iterator fileIt= + this->FileCache.find(fullName); + if (fileIt!=this->FileCache.end()) { - if (this->Encountered.find(incIt->FileName) == - this->Encountered.end()) + fileIt->second->Used=true; + dependencies.insert(fullName); + for (std::vector::const_iterator incIt= + fileIt->second->UnscannedEntries.begin(); + incIt!=fileIt->second->UnscannedEntries.end(); ++incIt) { - this->Encountered.insert(incIt->FileName); - this->Unscanned.push(*incIt); + if (this->Encountered.find(incIt->FileName) == + this->Encountered.end()) + { + this->Encountered.insert(incIt->FileName); + this->Unscanned.push(*incIt); + } } } - } - else - { - - // Try to scan the file. Just leave it out if we cannot find - // it. - std::ifstream fin(fullName.c_str()); - if(fin) + else { - // Add this file as a dependency. - dependencies.insert(fullName); - // Scan this file for new dependencies. Pass the directory - // containing the file to handle double-quote includes. - std::string dir = cmSystemTools::GetFilenamePath(fullName); - this->Scan(fin, dir.c_str(), fullName); + // Try to scan the file. Just leave it out if we cannot find + // it. + std::ifstream fin(fullName.c_str()); + if(fin) + { + // Add this file as a dependency. + dependencies.insert(fullName); + + // Scan this file for new dependencies. Pass the directory + // containing the file to handle double-quote includes. + std::string dir = cmSystemTools::GetFilenamePath(fullName); + this->Scan(fin, dir.c_str(), fullName); + } } } - } - first = false; + srcFiles--; + } } // Write the dependencies to the output stream. Makefile rules @@ -275,7 +278,7 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj, // convert the dependencies to paths relative to the home output // directory. We must do the same here. internalDepends << obj << std::endl; - for(std::set::iterator i=dependencies.begin(); + for(std::set::const_iterator i=dependencies.begin(); i != dependencies.end(); ++i) { makeDepends << obj << ": " << diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index bd9a4b7b4..16dfad7bc 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -32,11 +32,9 @@ public: virtual ~cmDependsC(); protected: - typedef std::vector t_CharBuffer; - // Implement writing/checking methods required by superclass. - virtual bool WriteDependencies(const char *src, - const char *file, + virtual bool WriteDependencies(const std::set& sources, + const std::string& obj, std::ostream& makeDepends, std::ostream& internalDepends); @@ -82,7 +80,6 @@ protected: const std::map* ValidDeps; std::set Encountered; std::queue Unscanned; - t_CharBuffer Buffer; std::map FileCache; std::map HeaderLocationCache; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index c1b60905d..e41e5ea86 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -170,44 +170,50 @@ cmDependsFortran::~cmDependsFortran() } //---------------------------------------------------------------------------- -bool cmDependsFortran::WriteDependencies(const char *src, const char *obj, - std::ostream&, std::ostream&) +bool cmDependsFortran::WriteDependencies( + const std::set& sources, const std::string& obj, + std::ostream&, std::ostream&) { // Make sure this is a scanning instance. - if(!src || src[0] == '\0') + if(sources.empty() || sources.begin()->empty()) { - cmSystemTools::Error("Cannot scan dependencies without an source file."); + cmSystemTools::Error("Cannot scan dependencies without a source file."); return false; } - if(!obj || obj[0] == '\0') + if(obj.empty()) { cmSystemTools::Error("Cannot scan dependencies without an object file."); return false; } - // Get the information object for this source. - cmDependsFortranSourceInfo& info = - this->Internal->CreateObjectInfo(obj, src); + bool okay = true; + for(std::set::const_iterator it = sources.begin(); + it != sources.end(); ++it) + { + const std::string& src = *it; + // Get the information object for this source. + cmDependsFortranSourceInfo& info = + this->Internal->CreateObjectInfo(obj.c_str(), src.c_str()); - // Make a copy of the macros defined via ADD_DEFINITIONS - std::set ppDefines(this->PPDefinitions.begin(), - this->PPDefinitions.end()); + // Make a copy of the macros defined via ADD_DEFINITIONS + std::set ppDefines(this->PPDefinitions.begin(), + this->PPDefinitions.end()); - // Create the parser object. The constructor takes ppMacro and info per - // reference, so we may look into the resulting objects later. - cmDependsFortranParser parser(this, ppDefines, info); + // Create the parser object. The constructor takes ppMacro and info per + // reference, so we may look into the resulting objects later. + cmDependsFortranParser parser(this, ppDefines, info); - // Push on the starting file. - cmDependsFortranParser_FilePush(&parser, src); + // Push on the starting file. + cmDependsFortranParser_FilePush(&parser, src.c_str()); - // Parse the translation unit. - if(cmDependsFortran_yyparse(parser.Scanner) != 0) - { - // Failed to parse the file. Report failure to write dependencies. - return false; + // Parse the translation unit. + if(cmDependsFortran_yyparse(parser.Scanner) != 0) + { + // Failed to parse the file. Report failure to write dependencies. + okay = false; + } } - - return true; + return okay; } //---------------------------------------------------------------------------- @@ -889,7 +895,7 @@ bool cmDependsFortran::FindIncludeFile(const char* dir, } // Search the include path for the file. - for(std::vector::const_iterator i = + for(std::vector::const_iterator i = this->IncludePath.begin(); i != this->IncludePath.end(); ++i) { fullName = *i; diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index cdfde6ea9..cb40796c8 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -66,7 +66,7 @@ protected: // Implement writing/checking methods required by superclass. virtual bool WriteDependencies( - const char *src, const char *file, + const std::set& sources, const std::string& file, std::ostream& makeDepends, std::ostream& internalDepends); // Actually write the depenencies to the streams. diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx index 1d849145c..949d46515 100644 --- a/Source/cmDependsJava.cxx +++ b/Source/cmDependsJava.cxx @@ -25,11 +25,11 @@ cmDependsJava::~cmDependsJava() } //---------------------------------------------------------------------------- -bool cmDependsJava::WriteDependencies(const char *src, const char *, - std::ostream&, std::ostream&) +bool cmDependsJava::WriteDependencies(const std::set& sources, + const std::string&, std::ostream&, std::ostream&) { // Make sure this is a scanning instance. - if(!src || src[0] == '\0') + if(sources.empty() || sources.begin()->empty()) { cmSystemTools::Error("Cannot scan dependencies without an source file."); return false; @@ -38,7 +38,7 @@ bool cmDependsJava::WriteDependencies(const char *src, const char *, return true; } -bool cmDependsJava::CheckDependencies(std::istream&, +bool cmDependsJava::CheckDependencies(std::istream&, const char*, std::map&) { return true; diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h index fe6fef50d..22af53f8d 100644 --- a/Source/cmDependsJava.h +++ b/Source/cmDependsJava.h @@ -29,10 +29,12 @@ public: protected: // Implement writing/checking methods required by superclass. - virtual bool WriteDependencies(const char *src, const char *file, + virtual bool WriteDependencies( + const std::set& sources, const std::string& file, std::ostream& makeDepends, std::ostream& internalDepends); virtual bool CheckDependencies(std::istream& internalDepends, - std::map& validDeps); + const char* internalDependsFileName, + std::map& validDeps); private: cmDependsJava(cmDependsJava const&); // Purposely not implemented. diff --git a/Source/cmDependsJavaLexer.h b/Source/cmDependsJavaLexer.h index 09c19bfff..61aa66de2 100644 --- a/Source/cmDependsJavaLexer.h +++ b/Source/cmDependsJavaLexer.h @@ -58,7 +58,7 @@ typedef uint32_t flex_uint32_t; typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; +typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ @@ -188,7 +188,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ diff --git a/Source/cmDependsJavaLexer.in.l b/Source/cmDependsJavaLexer.in.l index aae7ec658..9796ad52a 100644 --- a/Source/cmDependsJavaLexer.in.l +++ b/Source/cmDependsJavaLexer.in.l @@ -171,18 +171,18 @@ null { PRIMITIVE; return jp_NULLLITERAL; } "\*" { SYMBOL; return jp_TIMES; } "\*=" { SYMBOL; return jp_TIMESEQUALS; } -[a-z_A-Z][a-z_0-9A-Z]* { - yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - return jp_NAME; +[a-z_A-Z][a-z_0-9A-Z]* { + yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); + return jp_NAME; } \/\/.*\n { } [ \f\t\n\r] { } -. { - std::cerr << "Unknown character: " << yytext[0] - << " (" << (int)yytext[0] << ")" << std::endl; - yyextra->Error("Unknown character"); - return jp_ERROR; +. { + std::cerr << "Unknown character: " << yytext[0] + << " (" << (int)yytext[0] << ")" << std::endl; + yyextra->Error("Unknown character"); + return jp_ERROR; } %% diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index 7b595cc1f..6136baa84 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -35,7 +35,7 @@ cmDependsJavaParserHelper::~cmDependsJavaParserHelper() } void cmDependsJavaParserHelper::CurrentClass -::AddFileNamesForPrinting(std::vector *files, +::AddFileNamesForPrinting(std::vector *files, const char* prefix, const char* sep) { cmStdString rname = ""; @@ -103,7 +103,7 @@ void cmDependsJavaParserHelper::AddPackagesImport(const char* sclass) this->PackagesImport.push_back(sclass); } -void cmDependsJavaParserHelper::SafePrintMissing(const char* str, +void cmDependsJavaParserHelper::SafePrintMissing(const char* str, int line, int cnt) { if ( str ) @@ -134,7 +134,7 @@ void cmDependsJavaParserHelper::Print(const char* place, const char* str) } } -void cmDependsJavaParserHelper::CombineUnions(char** out, +void cmDependsJavaParserHelper::CombineUnions(char** out, const char* in1, char** in2, const char* sep) { @@ -193,7 +193,7 @@ void cmDependsJavaParserHelper } void cmDependsJavaParserHelper -::AllocateParserType(cmDependsJavaParserHelper::ParserType* pt, +::AllocateParserType(cmDependsJavaParserHelper::ParserType* pt, const char* str, int len) { pt->str = 0; @@ -270,7 +270,7 @@ std::vector cmDependsJavaParserHelper::GetFilesProduced() std::vector files; CurrentClass* toplevel = &(*(this->ClassStack.begin())); std::vector::iterator it; - for ( it = toplevel->NestedClasses->begin(); + for ( it = toplevel->NestedClasses->begin(); it != toplevel->NestedClasses->end(); ++ it ) { @@ -289,7 +289,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) this->InputBuffer = str; this->InputBufferPos = 0; this->CurrentLine = 0; - + yyscan_t yyscanner; cmDependsJava_yylex_init(&yyscanner); @@ -306,7 +306,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) { if ( this->CurrentPackage.size() > 0 ) { - std::cout << "Current package is: " << + std::cout << "Current package is: " << this->CurrentPackage.c_str() << std::endl; } std::cout << "Imports packages:"; @@ -337,7 +337,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) this->PrintClasses(); if ( this->UnionsAvailable != 0 ) { - std::cout << "There are still " << + std::cout << "There are still " << this->UnionsAvailable << " unions available" << std::endl; } } @@ -348,13 +348,13 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) void cmDependsJavaParserHelper::CleanupParser() { std::vector::iterator it; - for ( it = this->Allocates.begin(); + for ( it = this->Allocates.begin(); it != this->Allocates.end(); ++ it ) { delete [] *it; } - this->Allocates.erase(this->Allocates.begin(), + this->Allocates.erase(this->Allocates.begin(), this->Allocates.end()); } @@ -382,11 +382,11 @@ int cmDependsJavaParserHelper::LexInput(char* buf, int maxlen) void cmDependsJavaParserHelper::Error(const char* str) { unsigned long pos = static_cast(this->InputBufferPos); - fprintf(stderr, "JPError: %s (%lu / Line: %d)\n", + fprintf(stderr, "JPError: %s (%lu / Line: %d)\n", str, pos, this->CurrentLine); int cc; std::cerr << "String: ["; - for ( cc = 0; + for ( cc = 0; cc < 30 && *(this->InputBuffer.c_str() + this->InputBufferPos + cc); cc ++ ) { @@ -395,7 +395,7 @@ void cmDependsJavaParserHelper::Error(const char* str) std::cerr << "]" << std::endl; } -void cmDependsJavaParserHelper::UpdateCombine(const char* str1, +void cmDependsJavaParserHelper::UpdateCombine(const char* str1, const char* str2) { if ( this->CurrentCombine == "" && str1 != 0) diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h index baecab378..9807a048c 100644 --- a/Source/cmDependsJavaParserHelper.h +++ b/Source/cmDependsJavaParserHelper.h @@ -9,7 +9,7 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef cmDependsJavaParserHelper_h +#ifndef cmDependsJavaParserHelper_h #define cmDependsJavaParserHelper_h #include "cmStandardIncludes.h" @@ -39,7 +39,7 @@ public: int ParseFile(const char* file); // For the lexer: - void AllocateParserType(cmDependsJavaParserHelper::ParserType* pt, + void AllocateParserType(cmDependsJavaParserHelper::ParserType* pt, const char* str, int len = 0); int LexInput(char* buf, int maxlen); @@ -69,7 +69,7 @@ private: public: cmStdString Name; std::vector* NestedClasses; - CurrentClass() + CurrentClass() { this->NestedClasses = new std::vector; } @@ -77,7 +77,7 @@ private: { delete this->NestedClasses; } - CurrentClass& operator=(CurrentClass const& c) + CurrentClass& operator=(CurrentClass const& c) { this->NestedClasses->clear(); this->Name = c.Name; @@ -93,7 +93,7 @@ private: { (*this) = c; } - void AddFileNamesForPrinting(std::vector *files, + void AddFileNamesForPrinting(std::vector *files, const char* prefix, const char* sep); }; cmStdString CurrentPackage; @@ -117,7 +117,7 @@ private: void PrintClasses(); void Print(const char* place, const char* str); - void CombineUnions(char** out, const char* in1, char** in2, + void CombineUnions(char** out, const char* in1, char** in2, const char* sep); void SafePrintMissing(const char* str, int line, int cnt); diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h index 535901397..6cc3f25ae 100644 --- a/Source/cmDocumentGeneratorExpressions.h +++ b/Source/cmDocumentGeneratorExpressions.h @@ -12,11 +12,32 @@ #ifndef cmDocumentGeneratorExpressions_h #define cmDocumentGeneratorExpressions_h -#define CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS \ +#define CM_DOCUMENT_ADD_TEST_GENERATOR_EXPRESSIONS \ "Generator expressions are evaluted during build system generation " \ "to produce information specific to each build configuration. " \ "Valid expressions are:\n" \ + " $<0:...> = empty string (ignores \"...\")\n" \ + " $<1:...> = content of \"...\"\n" \ + " $ = '1' if config is \"cfg\", else '0'\n" \ " $ = configuration name\n" \ + " $ = '1' if the '...' is true, else '0'\n" \ + " $ = '1' if a is STREQUAL b, else '0'\n" \ + " $ = A literal '>'. Used to compare " \ + "strings which contain a '>' for example.\n" \ + " $ = A literal ','. Used to compare " \ + "strings which contain a ',' for example.\n" \ + " $ = A literal ';'. Used to prevent " \ + "list expansion on an argument with ';'.\n" \ + " $ = Marks ... as being the name of a " \ + "target. This is required if exporting targets to multiple " \ + "dependent export sets. The '...' must be a literal name of a " \ + "target- it may not contain generator expressions.\n" \ + " $ = content of \"...\" when the property " \ + "is exported using install(EXPORT), and empty otherwise.\n" \ + " $ = content of \"...\" when the property " \ + "is exported using export(), or when the target is used by another " \ + "target in the same buildsystem. Expands to the empty string " \ + "otherwise.\n" \ " $ = main file (.exe, .so.1.2, .a)\n" \ " $ = file used to link (.a, .lib, .so)\n" \ " $ = file with soname (.so.3)\n" \ @@ -25,6 +46,30 @@ "versions can produce the directory and file name components:\n" \ " $/$\n" \ " $/$\n" \ - " $/$\n" + " $/$\n" \ + "\n" \ + " $ = The value of the property prop " \ + "on the target tgt.\n" \ + "Note that tgt is not added as a dependency of the target this " \ + "expression is evaluated on.\n" \ + " $ = '1' if the policy was NEW when " \ + "the 'head' target was created, else '0'. If the policy was not " \ + "set, the warning message for the policy will be emitted. This " \ + "generator expression only works for a subset of policies.\n" \ + " $ = Content of the install prefix when " \ + "the target is exported via INSTALL(EXPORT) and empty otherwise.\n" \ + "Boolean expressions:\n" \ + " $ = '1' if all '?' are '1', else '0'\n" \ + " $ = '0' if all '?' are '0', else '1'\n" \ + " $ = '0' if '?' is '1', else '1'\n" \ + "where '?' is always either '0' or '1'.\n" \ + "" + +#define CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS \ + CM_DOCUMENT_ADD_TEST_GENERATOR_EXPRESSIONS \ + "Expressions with an implicit 'this' target:\n" \ + " $ = The value of the property prop on " \ + "the target on which the generator expression is evaluated.\n" \ + "" #endif diff --git a/Source/cmDocumentLocationUndefined.h b/Source/cmDocumentLocationUndefined.h index d1be77abf..9aecf2163 100644 --- a/Source/cmDocumentLocationUndefined.h +++ b/Source/cmDocumentLocationUndefined.h @@ -16,8 +16,8 @@ "\n" \ "Do not set properties that affect the location of a target after " \ action ". These include properties whose names match " \ - "\"(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_)?\" " \ - "or \"(IMPLIB_)?(PREFIX|SUFFIX)\". " \ + "\"(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_)?\", " \ + "\"(IMPLIB_)?(PREFIX|SUFFIX)\", or \"LINKER_LANGUAGE\". " \ "Failure to follow this rule is not diagnosed and leaves the location " \ "of the target undefined." diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 77aaffcba..326a4ce27 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -1,6 +1,8 @@ #include "cmDocumentVariables.h" #include "cmake.h" +#include + void cmDocumentVariables::DefineVariables(cmake* cm) { // Subsection: variables defined by cmake, that give @@ -252,6 +254,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "for the respective IDE. This IDE project file generator is stored in " "CMAKE_EXTRA_GENERATOR (e.g. \"Eclipse CDT4\").",false, "Variables that Provide Information"); + cm->DefineProperty + ("CMAKE_GENERATOR_TOOLSET", cmProperty::VARIABLE, + "Native build system toolset name specified by user.", + "Some CMake generators support a toolset name to be given to the " + "native build system to choose a compiler. " + "If the user specifies a toolset name (e.g. via the cmake -T option) " + "the value will be available in this variable.",false, + "Variables that Provide Information"); cm->DefineProperty ("CMAKE_HOME_DIRECTORY", cmProperty::VARIABLE, "Path to top of source tree.", @@ -282,6 +292,25 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "This variable is around for backwards compatibility, " "see CMAKE_BUILD_TOOL.",false, "Variables that Provide Information"); + cm->DefineProperty + ("CMAKE_VS_PLATFORM_TOOLSET", cmProperty::VARIABLE, + "Visual Studio Platform Toolset name.", + "VS 10 and above use MSBuild under the hood and support multiple " + "compiler toolchains. " + "CMake may specify a toolset explicitly, such as \"v110\" for " + "VS 11 or \"Windows7.1SDK\" for 64-bit support in VS 10 Express. " + "CMake provides the name of the chosen toolset in this variable." + ,false, + "Variables that Provide Information"); + cm->DefineProperty + ("CMAKE_XCODE_PLATFORM_TOOLSET", cmProperty::VARIABLE, + "Xcode compiler selection.", + "Xcode supports selection of a compiler from one of the installed " + "toolsets. " + "CMake provides the name of the chosen toolset in this variable, " + "if any is explicitly selected (e.g. via the cmake -T option)." + ,false, + "Variables that Provide Information"); cm->DefineProperty ("CMAKE_MINOR_VERSION", cmProperty::VARIABLE, "The Minor version of cmake (i.e. the 4 in X.4.X).", @@ -372,12 +401,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "This is the list of libraries that are linked " "into all executables and libraries.",false, "Variables that Provide Information"); - cm->DefineProperty - ("CMAKE_USING_VC_FREE_TOOLS", cmProperty::VARIABLE, - "True if free visual studio tools being used.", - "This is set to true if the compiler is Visual " - "Studio free tools.",false, - "Variables that Provide Information"); cm->DefineProperty ("CMAKE_VERBOSE_MAKEFILE", cmProperty::VARIABLE, "Create verbose makefiles if on.", @@ -595,7 +618,21 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "If \"make install\" is invoked or INSTALL is built" ", this directory is pre-pended onto all install " "directories. This variable defaults to /usr/local" - " on UNIX and c:/Program Files on Windows.",false, + " on UNIX and c:/Program Files on Windows.\n" + "On UNIX one can use the DESTDIR mechanism in order" + " to relocate the whole installation. " + "DESTDIR means DESTination DIRectory. It is " + "commonly used by makefile users " + "in order to install software at non-default location. " + "It is usually invoked like this:\n" + " make DESTDIR=/home/john install\n" + "which will install the concerned software using the" + " installation prefix, e.g. \"/usr/local\" pre-pended with " + "the DESTDIR value which finally gives \"/home/john/usr/local\".\n" + "WARNING: DESTDIR may not be used on Windows because installation" + " prefix usually contains a drive letter like in \"C:/Program Files\"" + " which cannot be pre-pended with some other prefix." + ,false, "Variables That Change Behavior"); cm->DefineProperty @@ -681,7 +718,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("CMAKE_SYSTEM_IGNORE_PATH", cmProperty::VARIABLE, "Path to be ignored by FIND_XXX() commands.", - "Specifies directories to be ignored by searches in FIND_XXX() commands " + "Specifies directories to be ignored by searches in FIND_XXX() " + "commands. " "This is useful in cross-compiled environments where some system " "directories contain incompatible but possibly linkable libraries. For " "example, on cross-compiled cluster environments, this allows a user to " @@ -696,7 +734,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("CMAKE_IGNORE_PATH", cmProperty::VARIABLE, "Path to be ignored by FIND_XXX() commands.", - "Specifies directories to be ignored by searches in FIND_XXX() commands " + "Specifies directories to be ignored by searches in FIND_XXX() " + "commands. " "This is useful in cross-compiled environments where some system " "directories contain incompatible but possibly linkable libraries. For " "example, on cross-compiled cluster environments, this allows a user to " @@ -827,13 +866,13 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Tell cmake to use MFC for an executable or dll.", "This can be set in a CMakeLists.txt file and will " "enable MFC in the application. It should be set " - "to 1 for static the static MFC library, and 2 for " - "the shared MFC library. This is used in visual " - "studio 6 and 7 project files. The CMakeSetup " + "to 1 for the static MFC library, and 2 for " + "the shared MFC library. This is used in Visual " + "Studio 6 and 7 project files. The CMakeSetup " "dialog used MFC and the CMakeLists.txt looks like this:\n" - "add_definitions(-D_AFXDLL)\n" - "set(CMAKE_MFC_FLAG 2)\n" - "add_executable(CMakeSetup WIN32 ${SRCS})\n",false, + " add_definitions(-D_AFXDLL)\n" + " set(CMAKE_MFC_FLAG 2)\n" + " add_executable(CMakeSetup WIN32 ${SRCS})\n",false, "Variables That Change Behavior"); cm->DefineProperty @@ -874,6 +913,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm) " script, it may get fatal error messages from the script.",false, "Variables That Change Behavior"); + cm->DefineProperty + ("CMAKE_DEBUG_TARGET_PROPERTIES", cmProperty::VARIABLE, + "Enables tracing output for target properties.", + "This variable can be populated with a list of properties to generate " + "debug output for when evaluating target properties. Currently it can " + "only be used when evaluating the INCLUDE_DIRECTORIES target property. " + "In that case, it outputs a backtrace for each include directory in " + "the build. Default is unset.",false,"Variables That Change Behavior"); + // Variables defined by CMake that describe the system cm->DefineProperty @@ -974,12 +1022,33 @@ void cmDocumentVariables::DefineVariables(cmake* cm) false, "Variables That Describe the System"); - cm->DefineProperty - ("MSVC80", cmProperty::VARIABLE, - "True when using Microsoft Visual C 8.0", - "Set to true when the compiler is version 8.0 of Microsoft Visual C.", - false, - "Variables That Describe the System"); + int msvc_versions[] = { 60, 70, 71, 80, 90, 100, 110, 0 }; + for (int i = 0; msvc_versions[i] != 0; i ++) + { + const char minor = (char)('0' + (msvc_versions[i] % 10)); + cmStdString varName = "MSVC"; + cmsys_ios::ostringstream majorStr; + + majorStr << (msvc_versions[i] / 10); + varName += majorStr.str(); + if (msvc_versions[i] < 100) + { + varName += minor; + } + + cmStdString verString = majorStr.str() + "." + minor; + + cmStdString shortStr = "True when using Microsoft Visual C " + verString; + cmStdString fullStr = "Set to true when the compiler is version " + + verString + + " of Microsoft Visual C."; + cm->DefineProperty + (varName.c_str(), cmProperty::VARIABLE, + shortStr.c_str(), + fullStr.c_str(), + false, + "Variables That Describe the System"); + } cm->DefineProperty ("MSVC_IDE", cmProperty::VARIABLE, @@ -999,6 +1068,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) " 1400 = VS 8.0\n" " 1500 = VS 9.0\n" " 1600 = VS 10.0\n" + " 1700 = VS 11.0\n" "", false, "Variables That Describe the System"); @@ -1093,6 +1163,18 @@ void cmDocumentVariables::DefineVariables(cmake* cm) false, "Variables that Control the Build"); + cm->DefineProperty + ("CMAKE_BUILD_INTERFACE_INCLUDES", cmProperty::VARIABLE, + "Automatically add the current source- and build directories " + "to the INTERFACE_INCLUDE_DIRECTORIES.", + "If this variable is enabled, CMake automatically adds for each shared " + "library target, static library target, module target and executable " + "target, ${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} to " + "the INTERFACE_INCLUDE_DIRECTORIES." + "By default CMAKE_BUILD_INTERFACE_INCLUDES is OFF.", + false, + "Variables that Control the Build"); + cm->DefineProperty ("CMAKE_INSTALL_RPATH", cmProperty::VARIABLE, "The rpath to use for installed targets.", @@ -1168,6 +1250,24 @@ void cmDocumentVariables::DefineVariables(cmake* cm) false, "Variables that Control the Build"); + cm->DefineProperty + ("CMAKE_PDB_OUTPUT_DIRECTORY", cmProperty::VARIABLE, + "Where to put all the MS debug symbol files.", + "This variable is used to initialize the " + "PDB_OUTPUT_DIRECTORY property on all the targets. " + "See that target property for additional information.", + false, + "Variables that Control the Build"); + + cm->DefineProperty + ("CMAKE_LINK_DEPENDS_NO_SHARED", cmProperty::VARIABLE, + "Whether to skip link dependencies on shared library files.", + "This variable initializes the LINK_DEPENDS_NO_SHARED " + "property on targets when they are created. " + "See that target property for additional information.", + false, + "Variables that Control the Build"); + cm->DefineProperty ("CMAKE_AUTOMOC", cmProperty::VARIABLE, "Whether to handle moc automatically for Qt targets.", @@ -1351,7 +1451,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) false, "Variables that Control the Build"); cm->DefineProperty - ("CMAKE_POSITION_INDEPENDENT_FLAGS", cmProperty::VARIABLE, + ("CMAKE_POSITION_INDEPENDENT_CODE", cmProperty::VARIABLE, "Default value for POSITION_INDEPENDENT_CODE of targets.", "This variable is used to initialize the " "POSITION_INDEPENDENT_CODE property on all the targets. " @@ -1381,8 +1481,30 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("CMAKE__COMPILER_ID", cmProperty::VARIABLE, - "An internal variable subject to change.", - "This is used in determining the compiler and is subject to change.", + "Compiler identification string.", + "A short string unique to the compiler vendor. " + "Possible values include:\n" + " Absoft = Absoft Fortran (absoft.com)\n" + " ADSP = Analog VisualDSP++ (analog.com)\n" + " Clang = LLVM Clang (clang.llvm.org)\n" + " Cray = Cray Compiler (cray.com)\n" + " Embarcadero, Borland = Embarcadero (embarcadero.com)\n" + " G95 = G95 Fortran (g95.org)\n" + " GNU = GNU Compiler Collection (gcc.gnu.org)\n" + " HP = Hewlett-Packard Compiler (hp.com)\n" + " Intel = Intel Compiler (intel.com)\n" + " MIPSpro = SGI MIPSpro (sgi.com)\n" + " MSVC = Microsoft Visual Studio (microsoft.com)\n" + " PGI = The Portland Group (pgroup.com)\n" + " PathScale = PathScale (pathscale.com)\n" + " SDCC = Small Device C Compiler (sdcc.sourceforge.net)\n" + " SunPro = Oracle Solaris Studio (oracle.com)\n" + " TI_DSP = Texas Instruments (ti.com)\n" + " TinyCC = Tiny C Compiler (tinycc.org)\n" + " Watcom = Open Watcom (openwatcom.org)\n" + " XL, VisualAge, zOS = IBM XL (ibm.com)\n" + "This variable is not guaranteed to be defined for all " + "compilers or languages.", false, "Variables for Languages"); @@ -1402,10 +1524,10 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("CMAKE__COMPILER_VERSION", cmProperty::VARIABLE, - "An internal variable subject to change.", + "Compiler version string.", "Compiler version in major[.minor[.patch[.tweak]]] format. " - "This variable is reserved for internal use by CMake and is not " - "guaranteed to be set.", + "This variable is not guaranteed to be defined for all " + "compilers or languages.", false, "Variables for Languages"); @@ -1429,7 +1551,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm) ("CMAKE_COMPILER_IS_GNU", cmProperty::VARIABLE, "True if the compiler is GNU.", "If the selected compiler is the GNU " - "compiler then this is TRUE, if not it is FALSE.",false, + "compiler then this is TRUE, if not it is FALSE. " + "Unlike the other per-language variables, this uses the GNU syntax for " + "identifying languages instead of the CMake syntax. Recognized values of " + "the suffix are:\n" + " CC = C compiler\n" + " CXX = C++ compiler\n" + " G77 = Fortran compiler", + false, "Variables for Languages"); cm->DefineProperty @@ -1537,6 +1666,23 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "These paths are implicit linker search directories for the compiler's " "language. " "CMake automatically detects these directories for each language and " + "reports the results in this variable." + "\n" + "When a library in one of these directories is given by full path to " + "target_link_libraries() CMake will generate the -l form on " + "link lines to ensure the linker searches its implicit directories " + "for the library. " + "Note that some toolchains read implicit directories from an " + "environment variable such as LIBRARY_PATH so keep its value " + "consistent when operating in a given build tree.",false, + "Variables for Languages"); + + cm->DefineProperty + ("CMAKE__IMPLICIT_LINK_FRAMEWORK_DIRECTORIES", cmProperty::VARIABLE, + "Implicit linker framework search path detected for language .", + "These paths are implicit linker framework search directories for " + "the compiler's language. " + "CMake automatically detects these directories for each language and " "reports the results in this variable.", false, "Variables for Languages"); @@ -1728,6 +1874,9 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH", cmProperty::VARIABLE,0,0); + cm->DefineProperty( + "CMAKE__USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH", + cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_SHARED_MODULE_CREATE__FLAGS", cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_SHARED_MODULE__FLAGS", diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 1b042ae6f..debde3be9 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -148,13 +148,6 @@ static const char *cmDocumentationStandardSeeAlso[][3] = "The list is member-post-only but one may sign up on the CMake web page. " "Please first read the full documentation at " "http://www.cmake.org before posting questions to the list."}, - {0, - "Summary of helpful links:\n" - " Home: http://www.cmake.org\n" - " Docs: http://www.cmake.org/HTML/Documentation.html\n" - " Mail: http://www.cmake.org/HTML/MailingLists.html\n" - " FAQ: http://www.cmake.org/Wiki/CMake_FAQ\n" - , 0}, {0,0,0} }; @@ -162,7 +155,7 @@ static const char *cmDocumentationStandardSeeAlso[][3] = static const char *cmDocumentationCopyright[][3] = { {0, - "Copyright 2000-2009 Kitware, Inc., Insight Software Consortium. " + "Copyright 2000-2012 Kitware, Inc., Insight Software Consortium. " "All rights reserved.", 0}, {0, "Redistribution and use in source and binary forms, with or without " diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx index 6762d6677..9f01949b9 100644 --- a/Source/cmDocumentationFormatter.cxx +++ b/Source/cmDocumentationFormatter.cxx @@ -19,7 +19,7 @@ cmDocumentationFormatter::~cmDocumentationFormatter() { } -void cmDocumentationFormatter::PrintFormatted(std::ostream& os, +void cmDocumentationFormatter::PrintFormatted(std::ostream& os, const char* text) { if(!text) diff --git a/Source/cmDocumentationFormatterDocbook.cxx b/Source/cmDocumentationFormatterDocbook.cxx index 30873306d..706ce0a02 100644 --- a/Source/cmDocumentationFormatterDocbook.cxx +++ b/Source/cmDocumentationFormatterDocbook.cxx @@ -11,6 +11,14 @@ ============================================================================*/ #include "cmDocumentationFormatterDocbook.h" #include "cmDocumentationSection.h" +#include +#include // for isalnum + +static int cmIsAlnum(int c) +{ + return isalnum(c); +} + //---------------------------------------------------------------------------- // this function is a copy of the one in the HTML formatter @@ -34,7 +42,7 @@ static void cmDocumentationPrintDocbookChar(std::ostream& os, char c) case '<': os << "<"; break; - case '>': + case '>': os << ">"; break; case '&': @@ -94,151 +102,116 @@ void cmDocumentationPrintDocbookEscapes(std::ostream& os, const char* text) } } - +//---------------------------------------------------------------------------- cmDocumentationFormatterDocbook::cmDocumentationFormatterDocbook() :cmDocumentationFormatter() { } +//---------------------------------------------------------------------------- void cmDocumentationFormatterDocbook ::PrintSection(std::ostream& os, const cmDocumentationSection §ion, const char* name) { - if(name) - { - std::string id = "section_"; - id += name; - if (this->EmittedLinkIds.find(id) == this->EmittedLinkIds.end()) - { - this->EmittedLinkIds.insert(id); - os << "\n" - "\n" << name << "\n"; - } - else - { - static unsigned int i=0; - i++; - os << "\n" - "\n" << name << "\n"; - } - } + os << "PrintId(os, 0, name); + os << "\">\n" << name << "\n"; std::string prefix = this->ComputeSectionLinkPrefix(name); + const std::vector &entries = section.GetEntries(); - const std::vector &entries = - section.GetEntries(); - - if (!entries.empty()) + bool hasSubSections = false; + for(std::vector::const_iterator op = entries.begin(); + op != entries.end(); ++op) { - os << "\n"; - for(std::vector::const_iterator op - = entries.begin(); op != entries.end(); ++ op ) + if(op->Name.size()) { - if(op->Name.size()) - { - os << " Name.c_str()); - os << "\">"; - cmDocumentationPrintDocbookEscapes(os, op->Name.c_str()); - os << "\n"; - } + hasSubSections = true; + break; } - os << "\n" ; } - for(std::vector::const_iterator op = entries.begin(); - op != entries.end();) + bool inAbstract = false; + for(std::vector::const_iterator op = entries.begin(); + op != entries.end(); ++op) { if(op->Name.size()) { - for(;op != entries.end() && op->Name.size(); ++op) + if(inAbstract) { - if(op->Name.size()) - { - os << " Name.c_str()); - - // make sure that each id exists only once. Since it seems - // not easily possible to determine which link refers to which id, - // we have at least to make sure that the duplicated id's get a - // different name (by appending an increasing number), Alex - std::string id = prefix; - id += "_"; - id += op->Name; - if (this->EmittedLinkIds.find(id) == this->EmittedLinkIds.end()) - { - this->EmittedLinkIds.insert(id); - } - else - { - static unsigned int i=0; - i++; - os << i; - } - // continue as normal... - - os << "\">"; - cmDocumentationPrintDocbookEscapes(os, op->Name.c_str()); - os << " "; - } + os << "\n"; + inAbstract = false; + } + os << "PrintId(os, prefix.c_str(), op->Name); + os << "\">\n"; + cmDocumentationPrintDocbookEscapes(os, op->Name.c_str()); + os << "\n"; + if(op->Full.size()) + { + os << "\n"; cmDocumentationPrintDocbookEscapes(os, op->Brief.c_str()); - if(op->Name.size()) - { - os << "\n"; - } - - if(op->Full.size()) - { - // a line break seems to be simply a line break with docbook - os << "\n "; - this->PrintFormatted(os, op->Full.c_str()); - } - os << "\n"; + os << "\n\n"; + this->PrintFormatted(os, op->Full.c_str()); } + else + { + this->PrintFormatted(os, op->Brief.c_str()); + } + os << "\n"; } else { + if(hasSubSections && op == entries.begin()) + { + os << "\n"; + inAbstract = true; + } this->PrintFormatted(os, op->Brief.c_str()); - os << "\n"; - ++op; } } - if(name) + + // empty sections are not allowed in docbook. + if(entries.empty()) { - os << "\n"; + os << "\n"; } + + os << "\n"; } -void cmDocumentationFormatterDocbook::PrintPreformatted(std::ostream& os, - const char* text) +//---------------------------------------------------------------------------- +void cmDocumentationFormatterDocbook +::PrintPreformatted(std::ostream& os, const char* text) { - os << ""; + os << "\n"; cmDocumentationPrintDocbookEscapes(os, text); - os << "\n "; + os << "\n\n"; } -void cmDocumentationFormatterDocbook::PrintParagraph(std::ostream& os, - const char* text) +void cmDocumentationFormatterDocbook +::PrintParagraph(std::ostream& os, const char* text) { os << ""; cmDocumentationPrintDocbookEscapes(os, text); - os << ""; + os << "\n"; } //---------------------------------------------------------------------------- -void cmDocumentationFormatterDocbook::PrintHeader(const char* docname, - const char* appname, - std::ostream& os) +void cmDocumentationFormatterDocbook +::PrintHeader(const char* docname, const char* appname, std::ostream& os) { + this->Docname = docname; + // this one is used to ensure that we don't create multiple link targets - // with the same name. We can clear it here since we are at the + // with the same name. We can clear it here since we are at the // start of a document here. this->EmittedLinkIds.clear(); os << "\n" - "\n" " ]>\n" "
\n" @@ -253,3 +226,29 @@ void cmDocumentationFormatterDocbook::PrintFooter(std::ostream& os) os << "
\n"; } +//---------------------------------------------------------------------------- +void cmDocumentationFormatterDocbook +::PrintId(std::ostream& os, const char* prefix, std::string id) +{ + std::replace_if(id.begin(), id.end(), + std::not1(std::ptr_fun(cmIsAlnum)), '_'); + if(prefix) + { + id = std::string(prefix) + "." + id; + } + os << this->Docname << '.' << id; + + // make sure that each id exists only once. Since it seems + // not easily possible to determine which link refers to which id, + // we have at least to make sure that the duplicated id's get a + // different name (by appending an increasing number), Alex + if (this->EmittedLinkIds.find(id) == this->EmittedLinkIds.end()) + { + this->EmittedLinkIds.insert(id); + } + else + { + static unsigned int i=0; + os << i++; + } +} diff --git a/Source/cmDocumentationFormatterDocbook.h b/Source/cmDocumentationFormatterDocbook.h index 213948dcc..0352d342a 100644 --- a/Source/cmDocumentationFormatterDocbook.h +++ b/Source/cmDocumentationFormatterDocbook.h @@ -35,7 +35,9 @@ public: virtual void PrintPreformatted(std::ostream& os, const char* text); virtual void PrintParagraph(std::ostream& os, const char* text); private: + void PrintId(std::ostream& os, const char* prefix, std::string id); std::set EmittedLinkIds; + std::string Docname; }; #endif diff --git a/Source/cmDocumentationFormatterHTML.cxx b/Source/cmDocumentationFormatterHTML.cxx index cd0077ed9..7213b43de 100644 --- a/Source/cmDocumentationFormatterHTML.cxx +++ b/Source/cmDocumentationFormatterHTML.cxx @@ -29,7 +29,7 @@ static void cmDocumentationPrintHTMLChar(std::ostream& os, char c) // Use an escape sequence if necessary. switch (c) { - case '<': + case '<': os << "<"; break; case '>': @@ -114,7 +114,7 @@ void cmDocumentationFormatterHTML { std::string prefix = this->ComputeSectionLinkPrefix(name); - const std::vector &entries = + const std::vector &entries = section.GetEntries(); // skip the index if the help for only a single item (--help-command, @@ -131,7 +131,7 @@ void cmDocumentationFormatterHTML } // Is a list needed? - for(std::vector::const_iterator op + for(std::vector::const_iterator op = entries.begin(); op != entries.end(); ++ op ) { if (op->Name.size()) @@ -154,7 +154,7 @@ void cmDocumentationFormatterHTML } } - for(std::vector::const_iterator op = entries.begin(); + for(std::vector::const_iterator op = entries.begin(); op != entries.end();) { if(op->Name.size()) @@ -191,7 +191,7 @@ void cmDocumentationFormatterHTML } } -void cmDocumentationFormatterHTML::PrintPreformatted(std::ostream& os, +void cmDocumentationFormatterHTML::PrintPreformatted(std::ostream& os, const char* text) { os << "
";
@@ -199,7 +199,7 @@ void cmDocumentationFormatterHTML::PrintPreformatted(std::ostream& os,
   os << "
\n "; } -void cmDocumentationFormatterHTML::PrintParagraph(std::ostream& os, +void cmDocumentationFormatterHTML::PrintParagraph(std::ostream& os, const char* text) { os << "

"; @@ -229,7 +229,7 @@ void cmDocumentationFormatterHTML::PrintFooter(std::ostream& os) } //---------------------------------------------------------------------------- -void cmDocumentationFormatterHTML::PrintHTMLEscapes(std::ostream& os, +void cmDocumentationFormatterHTML::PrintHTMLEscapes(std::ostream& os, const char* text) { // Hyperlink prefixes. @@ -262,7 +262,7 @@ void cmDocumentationFormatterHTML std::vector& sections) { // skip the index if only the help for a single item is printed - if ((sections.size() == 1) + if ((sections.size() == 1) && (sections[0]->GetName(this->GetForm()) != 0 ) && (std::string(sections[0]->GetName(this->GetForm())) == "SingleItem")) { diff --git a/Source/cmDocumentationFormatterHTML.h b/Source/cmDocumentationFormatterHTML.h index 427e04bc5..44bf24026 100644 --- a/Source/cmDocumentationFormatterHTML.h +++ b/Source/cmDocumentationFormatterHTML.h @@ -32,7 +32,7 @@ public: const cmDocumentationSection& section, const char* name); virtual void PrintPreformatted(std::ostream& os, const char* text); - virtual void PrintParagraph(std::ostream& os, const char* text); + virtual void PrintParagraph(std::ostream& os, const char* text); virtual void PrintIndex(std::ostream& , std::vector&); private: diff --git a/Source/cmDocumentationFormatterText.cxx b/Source/cmDocumentationFormatterText.cxx index 0b04b73d2..5def1947a 100644 --- a/Source/cmDocumentationFormatterText.cxx +++ b/Source/cmDocumentationFormatterText.cxx @@ -33,9 +33,9 @@ void cmDocumentationFormatterText os << name << "\n\n"; } - const std::vector &entries = + const std::vector &entries = section.GetEntries(); - for(std::vector::const_iterator op = entries.begin(); + for(std::vector::const_iterator op = entries.begin(); op != entries.end(); ++op) { if(op->Name.size()) @@ -58,7 +58,7 @@ void cmDocumentationFormatterText } } -void cmDocumentationFormatterText::PrintPreformatted(std::ostream& os, +void cmDocumentationFormatterText::PrintPreformatted(std::ostream& os, const char* text) { bool newline = true; @@ -78,7 +78,7 @@ void cmDocumentationFormatterText::PrintPreformatted(std::ostream& os, os << "\n"; } -void cmDocumentationFormatterText::PrintParagraph(std::ostream& os, +void cmDocumentationFormatterText::PrintParagraph(std::ostream& os, const char* text) { os << this->TextIndent; @@ -91,7 +91,7 @@ void cmDocumentationFormatterText::SetIndent(const char* indent) this->TextIndent = indent; } -void cmDocumentationFormatterText::PrintColumn(std::ostream& os, +void cmDocumentationFormatterText::PrintColumn(std::ostream& os, const char* text) { // Print text arranged in an indented column of fixed witdh. @@ -100,14 +100,14 @@ void cmDocumentationFormatterText::PrintColumn(std::ostream& os, bool newSentence = false; bool firstLine = true; int width = this->TextWidth - static_cast(strlen(this->TextIndent)); - + // Loop until the end of the text. while(*l) { // Parse the next word. const char* r = l; while(*r && (*r != '\n') && (*r != ' ')) { ++r; } - + // Does it fit on this line? if(r-l < (width-column-(newSentence?1:0))) { @@ -135,12 +135,12 @@ void cmDocumentationFormatterText::PrintColumn(std::ostream& os, // first line. os << (firstLine?"":this->TextIndent); } - + // Print the word. os.write(l, static_cast(r-l)); newSentence = (*(r-1) == '.'); } - + if(*r == '\n') { // Text provided a newline. Start a new line. @@ -175,6 +175,6 @@ void cmDocumentationFormatterText::PrintColumn(std::ostream& os, // Move to beginning of next word. Skip over whitespace. l = r; - while(*l && (*l == ' ')) { ++l; } + while(*l && (*l == ' ')) { ++l; } } } diff --git a/Source/cmDocumentationFormatterUsage.cxx b/Source/cmDocumentationFormatterUsage.cxx index 8a415cb4d..a068e5682 100644 --- a/Source/cmDocumentationFormatterUsage.cxx +++ b/Source/cmDocumentationFormatterUsage.cxx @@ -28,9 +28,9 @@ void cmDocumentationFormatterUsage os << name << "\n"; } - const std::vector &entries = + const std::vector &entries = section.GetEntries(); - for(std::vector::const_iterator op = entries.begin(); + for(std::vector::const_iterator op = entries.begin(); op != entries.end(); ++op) { if(op->Name.size()) diff --git a/Source/cmDocumentationSection.h b/Source/cmDocumentationSection.h index 0fab38f81..4f8c10d3e 100644 --- a/Source/cmDocumentationSection.h +++ b/Source/cmDocumentationSection.h @@ -26,28 +26,28 @@ public: /** Create a cmSection, with a special name for man-output mode. */ cmDocumentationSection(const char* name, const char* manName) :Name(name), ManName(manName) {} - + /** Has any content been added to this section or is it empty ? */ bool IsEmpty() const { return this->Entries.empty(); } - + /** Clear contents. */ void Clear() { this->Entries.clear(); } - + /** Return the name of this section for the given output form. */ const char* GetName(cmDocumentationEnums::Form form) const { return (form==cmDocumentationEnums::ManForm ? this->ManName.c_str() : this->Name.c_str()); } - + /** Return a pointer to the first entry of this section. */ const std::vector &GetEntries() const { return this->Entries; } - + /** Append an entry to this section. */ void Append(const cmDocumentationEntry& entry) { this->Entries.push_back(entry); } void Append(const std::vector &entries) { this->Entries.insert(this->Entries.end(),entries.begin(),entries.end()); } - + /** Append an entry to this section using NULL terminated chars */ void Append(const char *[][3]); void Append(const char *n, const char *b, const char *f); @@ -58,7 +58,7 @@ public: { this->Entries.insert(this->Entries.begin(), entries.begin(),entries.end()); } - + private: std::string Name; std::string ManName; diff --git a/Source/cmElseCommand.h b/Source/cmElseCommand.h index 5e8b79058..f25991943 100644 --- a/Source/cmElseCommand.h +++ b/Source/cmElseCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmElseCommand; } @@ -54,7 +54,7 @@ public: { return "Starts the else portion of an if block."; } - + /** * More documentation. */ @@ -64,7 +64,7 @@ public: " else(expression)\n" "See the if command."; } - + cmTypeMacro(cmElseCommand, cmCommand); }; diff --git a/Source/cmElseIfCommand.h b/Source/cmElseIfCommand.h index 20cd81aaa..46e2bd9f9 100644 --- a/Source/cmElseIfCommand.h +++ b/Source/cmElseIfCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmElseIfCommand; } @@ -54,7 +54,7 @@ public: { return "Starts the elseif portion of an if block."; } - + /** * More documentation. */ @@ -64,7 +64,7 @@ public: " elseif(expression)\n" "See the if command."; } - + cmTypeMacro(cmElseIfCommand, cmCommand); }; diff --git a/Source/cmEnableLanguageCommand.cxx b/Source/cmEnableLanguageCommand.cxx index f8f36ebbb..dcabf6a46 100644 --- a/Source/cmEnableLanguageCommand.cxx +++ b/Source/cmEnableLanguageCommand.cxx @@ -22,7 +22,7 @@ bool cmEnableLanguageCommand this->SetError ("called with incorrect number of arguments"); return false; - } + } for (std::vector::const_iterator it = args.begin(); it != args.end(); ++it) diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h index 5958e4481..ee963f920 100644 --- a/Source/cmEnableLanguageCommand.h +++ b/Source/cmEnableLanguageCommand.h @@ -28,7 +28,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmEnableLanguageCommand; } @@ -39,7 +39,7 @@ public: */ virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - + /** * The name of the command as specified in CMakeList.txt. */ @@ -52,7 +52,7 @@ public: { return "Enable a language (CXX/C/Fortran/etc)"; } - + /** * More documentation. */ @@ -65,9 +65,14 @@ public: "any of the extra variables that are created by the project command. " "Example languages are CXX, C, Fortran. " "If OPTIONAL is used, use the CMAKE__COMPILER_WORKS " - "variable to check whether the language has been enabled successfully."; + "variable to check whether the language has been enabled successfully." + "\n" + "This command must be called on file scope (not inside a function) and " + "the language enabled can only be used in the calling project or its " + "subdirectories added by add_subdirectory(). Also note that at present, " + "the OPTIONAL argument does not work."; } - + cmTypeMacro(cmEnableLanguageCommand, cmCommand); }; diff --git a/Source/cmEnableTestingCommand.cxx b/Source/cmEnableTestingCommand.cxx index 5abb873bd..aa41ef73b 100644 --- a/Source/cmEnableTestingCommand.cxx +++ b/Source/cmEnableTestingCommand.cxx @@ -12,7 +12,7 @@ #include "cmEnableTestingCommand.h" #include "cmLocalGenerator.h" -// we do this in the final pass so that we now the subdirs have all +// we do this in the final pass so that we now the subdirs have all // been defined bool cmEnableTestingCommand::InitialPass(std::vector const&, cmExecutionStatus &) diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h index b607818ce..9b9e9851b 100644 --- a/Source/cmEnableTestingCommand.h +++ b/Source/cmEnableTestingCommand.h @@ -24,7 +24,7 @@ * within the valid control structures are replicated in Testfile * (i.e. SUBDIRS() and ADD_TEST() commands within IF() commands that are * not entered by CMake are not replicated in Testfile). - * Note that CTest expects to find this file in the build directory root; + * Note that CTest expects to find this file in the build directory root; * therefore, this command should be in the source directory root too. */ class cmEnableTestingCommand : public cmCommand @@ -33,7 +33,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmEnableTestingCommand; } @@ -57,7 +57,7 @@ public: { return "Enable testing for current directory and below."; } - + /** * More documentation. */ @@ -70,9 +70,9 @@ public: "a test file in the build directory root. Therefore, this command " "should be in the source directory root."; } - + cmTypeMacro(cmEnableTestingCommand, cmCommand); - + }; diff --git a/Source/cmEndForEachCommand.cxx b/Source/cmEndForEachCommand.cxx index 2eca4e292..7f11ae5f9 100644 --- a/Source/cmEndForEachCommand.cxx +++ b/Source/cmEndForEachCommand.cxx @@ -12,7 +12,7 @@ #include "cmEndForEachCommand.h" bool cmEndForEachCommand -::InvokeInitialPass(std::vector const&, +::InvokeInitialPass(std::vector const&, cmExecutionStatus &) { this->SetError("An ENDFOREACH command was found outside of a proper " diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h index 37b2d2a32..d5ee8a6ae 100644 --- a/Source/cmEndForEachCommand.h +++ b/Source/cmEndForEachCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmEndForEachCommand; } @@ -36,7 +36,7 @@ public: */ virtual bool InvokeInitialPass(std::vector const&, cmExecutionStatus &); - + /** * This is called when the command is first encountered in * the CMakeLists.txt file. @@ -61,7 +61,7 @@ public: { return "Ends a list of commands in a FOREACH block."; } - + /** * More documentation. */ @@ -71,7 +71,7 @@ public: " endforeach(expression)\n" "See the FOREACH command."; } - + cmTypeMacro(cmEndForEachCommand, cmCommand); }; diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h index 54ac068f3..d7b74e98b 100644 --- a/Source/cmEndFunctionCommand.h +++ b/Source/cmEndFunctionCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmEndFunctionCommand; } @@ -36,7 +36,7 @@ public: */ virtual bool InvokeInitialPass(std::vector const&, cmExecutionStatus &); - + /** * This is called when the command is first encountered in * the CMakeLists.txt file. @@ -61,7 +61,7 @@ public: { return "Ends a list of commands in a function block."; } - + /** * More documentation. */ @@ -71,7 +71,7 @@ public: " endfunction(expression)\n" "See the function command."; } - + cmTypeMacro(cmEndFunctionCommand, cmCommand); }; diff --git a/Source/cmEndIfCommand.cxx b/Source/cmEndIfCommand.cxx index e98d4d415..0ac09de72 100644 --- a/Source/cmEndIfCommand.cxx +++ b/Source/cmEndIfCommand.cxx @@ -20,7 +20,7 @@ bool cmEndIfCommand::InitialPass(std::vector const&, { return true; } - + this->SetError("An ENDIF command was found outside of a proper " "IF ENDIF structure. Or its arguments did not match " "the opening IF command."); diff --git a/Source/cmEndIfCommand.h b/Source/cmEndIfCommand.h index 81d1b5ff4..5c4b9e36a 100644 --- a/Source/cmEndIfCommand.h +++ b/Source/cmEndIfCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmEndIfCommand; } @@ -54,7 +54,7 @@ public: { return "Ends a list of commands in an if block."; } - + /** * More documentation. */ @@ -64,7 +64,7 @@ public: " endif(expression)\n" "See the if command."; } - + cmTypeMacro(cmEndIfCommand, cmCommand); }; diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h index 25e86b70f..9d0e70fdc 100644 --- a/Source/cmEndMacroCommand.h +++ b/Source/cmEndMacroCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmEndMacroCommand; } @@ -36,7 +36,7 @@ public: */ virtual bool InvokeInitialPass(std::vector const&, cmExecutionStatus &); - + /** * This is called when the command is first encountered in * the CMakeLists.txt file. @@ -61,7 +61,7 @@ public: { return "Ends a list of commands in a macro block."; } - + /** * More documentation. */ @@ -71,7 +71,7 @@ public: " endmacro(expression)\n" "See the macro command."; } - + cmTypeMacro(cmEndMacroCommand, cmCommand); }; diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h index 635ad5a7f..18ba5ea31 100644 --- a/Source/cmEndWhileCommand.h +++ b/Source/cmEndWhileCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmEndWhileCommand; } @@ -36,7 +36,7 @@ public: */ virtual bool InvokeInitialPass(std::vector const& args, cmExecutionStatus &status); - + /** * This is called when the command is first encountered in * the CMakeLists.txt file. @@ -61,7 +61,7 @@ public: { return "Ends a list of commands in a while block."; } - + /** * More documentation. */ @@ -71,7 +71,7 @@ public: " endwhile(expression)\n" "See the while command."; } - + cmTypeMacro(cmEndWhileCommand, cmCommand); }; diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index 61b27eaf0..9fdb1e896 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -36,7 +36,7 @@ bool cmExecProgramCommand doingargs = false; havereturn_variable = false; haveoutput_variable = true; - } + } else if ( haveoutput_variable ) { if ( output_variable.size() > 0 ) @@ -54,7 +54,7 @@ bool cmExecProgramCommand doingargs = false; haveoutput_variable = false; havereturn_variable = true; - } + } else if ( havereturn_variable ) { if ( return_variable.size() > 0 ) @@ -108,16 +108,16 @@ bool cmExecProgramCommand } else { - result = cmSystemTools::RunCommand(command.c_str(), output, + result = cmSystemTools::RunCommand(command.c_str(), output, retVal, 0, verbose); } if(!result) { retVal = -1; - } + } if ( output_variable.size() > 0 ) - { + { std::string::size_type first = output.find_first_not_of(" \n\t\r"); std::string::size_type last = output.find_last_not_of(" \n\t\r"); if(first == std::string::npos) @@ -128,7 +128,7 @@ bool cmExecProgramCommand { last = output.size()-1; } - + std::string coutput = std::string(output, first, last-first+1); this->Makefile->AddDefinition(output_variable.c_str(), coutput.c_str()); } @@ -139,7 +139,7 @@ bool cmExecProgramCommand sprintf(buffer, "%d", retVal); this->Makefile->AddDefinition(return_variable.c_str(), buffer); } - + return true; } diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h index 723386099..f752501fa 100644 --- a/Source/cmExecProgramCommand.h +++ b/Source/cmExecProgramCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmExecProgramCommand; } @@ -38,13 +38,13 @@ public: */ virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - + /** * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "exec_program";} - + /** * This determines if the command is invoked when in script mode. */ @@ -55,10 +55,10 @@ public: */ virtual const char* GetTerseDocumentation() const { - return + return "Deprecated. Use the execute_process() command instead."; } - + /** * More documentation. */ @@ -82,7 +82,7 @@ public: "stdout/stderr of the console running cmake.\n" ; } - + /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const { diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index a0d9c9caf..994c1707b 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -266,12 +266,12 @@ bool cmExecuteProcessCommand } if(!output_file.empty()) { - cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDOUT, + cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDOUT, output_file.c_str()); } if(!error_file.empty()) { - cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDERR, + cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDERR, error_file.c_str()); } @@ -326,12 +326,12 @@ bool cmExecuteProcessCommand // Store the output obtained. if(!output_variable.empty() && tempOutput.size()) { - this->Makefile->AddDefinition(output_variable.c_str(), + this->Makefile->AddDefinition(output_variable.c_str(), &*tempOutput.begin()); } if(!merge_output && !error_variable.empty() && tempError.size()) { - this->Makefile->AddDefinition(error_variable.c_str(), + this->Makefile->AddDefinition(error_variable.c_str(), &*tempError.begin()); } diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h index 9fbecacfe..1488924c7 100644 --- a/Source/cmExecutionStatus.h +++ b/Source/cmExecutionStatus.h @@ -23,19 +23,19 @@ class cmExecutionStatus : public cmObject { public: cmTypeMacro(cmExecutionStatus, cmObject); - + cmExecutionStatus() { this->Clear();}; - - virtual void SetReturnInvoked(bool val) + + virtual void SetReturnInvoked(bool val) { this->ReturnInvoked = val; } virtual bool GetReturnInvoked() { return this->ReturnInvoked; } - - virtual void SetBreakInvoked(bool val) + + virtual void SetBreakInvoked(bool val) { this->BreakInvoked = val; } virtual bool GetBreakInvoked() { return this->BreakInvoked; } - + virtual void Clear() { this->ReturnInvoked = false; @@ -45,7 +45,7 @@ public: virtual void SetNestedError(bool val) { this->NestedError = val; } virtual bool GetNestedError() { return this->NestedError; } - + protected: bool ReturnInvoked; bool BreakInvoked; diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 32595ee4b..7147f86be 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -22,15 +22,20 @@ cmExportBuildFileGenerator::cmExportBuildFileGenerator() //---------------------------------------------------------------------------- bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) { - // Create all the imported targets. + std::vector allTargets; + { + std::string expectedTargets; + std::string sep; for(std::vector::const_iterator tei = this->Exports->begin(); tei != this->Exports->end(); ++tei) { + expectedTargets += sep + this->Namespace + (*tei)->GetName(); + sep = " "; cmTarget* te = *tei; if(this->ExportedTargets.insert(te).second) { - this->GenerateImportTargetCode(os, te); + allTargets.push_back(te); } else { @@ -44,14 +49,46 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) } } + this->GenerateExpectedTargetsCode(os, expectedTargets); + } + + std::vector missingTargets; + + // Create all the imported targets. + for(std::vector::const_iterator + tei = allTargets.begin(); + tei != allTargets.end(); ++tei) + { + cmTarget* te = *tei; + this->GenerateImportTargetCode(os, te); + + te->AppendBuildInterfaceIncludes(); + + ImportPropertyMap properties; + + this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", te, + cmGeneratorExpression::BuildInterface, + properties, missingTargets); + this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", te, + cmGeneratorExpression::BuildInterface, + properties, missingTargets); + this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", + te, properties); + this->PopulateCompatibleInterfaceProperties(te, properties); + + this->GenerateInterfaceProperties(te, os, properties); + } + // Generate import file content for each configuration. for(std::vector::const_iterator ci = this->Configurations.begin(); ci != this->Configurations.end(); ++ci) { - this->GenerateImportConfig(os, ci->c_str()); + this->GenerateImportConfig(os, ci->c_str(), missingTargets); } + this->GenerateMissingTargetsCheckCode(os, missingTargets); + return true; } @@ -59,7 +96,8 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) void cmExportBuildFileGenerator ::GenerateImportTargetsConfig(std::ostream& os, - const char* config, std::string const& suffix) + const char* config, std::string const& suffix, + std::vector &missingTargets) { for(std::vector::const_iterator tei = this->Exports->begin(); @@ -73,7 +111,11 @@ cmExportBuildFileGenerator { // Get the rest of the target details. this->SetImportDetailProperties(config, suffix, - target, properties); + target, properties, missingTargets); + this->SetImportLinkInterface(config, suffix, + cmGeneratorExpression::BuildInterface, + target, properties, missingTargets); + // TOOD: PUBLIC_HEADER_LOCATION // This should wait until the build feature propagation stuff @@ -131,6 +173,25 @@ cmExportBuildFileGenerator } } +//---------------------------------------------------------------------------- +void +cmExportBuildFileGenerator::HandleMissingTarget( + std::string& link_libs, std::vector&, + cmMakefile*, cmTarget* depender, cmTarget* dependee) +{ + // The target is not in the export. + if(!this->AppendMode) + { + // We are not appending, so all exported targets should be + // known here. This is probably user-error. + this->ComplainAboutMissingTarget(depender, dependee); + } + // Assume the target will be exported by another command. + // Append it with the export namespace. + link_libs += this->Namespace; + link_libs += dependee->GetName(); +} + //---------------------------------------------------------------------------- void cmExportBuildFileGenerator diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h index 0f37626cc..5e1be1648 100644 --- a/Source/cmExportBuildFileGenerator.h +++ b/Source/cmExportBuildFileGenerator.h @@ -44,9 +44,16 @@ protected: virtual bool GenerateMainFile(std::ostream& os); virtual void GenerateImportTargetsConfig(std::ostream& os, const char* config, - std::string const& suffix); - virtual void ComplainAboutMissingTarget(cmTarget* depender, - cmTarget* dependee); + std::string const& suffix, + std::vector &missingTargets); + virtual void HandleMissingTarget(std::string& link_libs, + std::vector& missingTargets, + cmMakefile* mf, + cmTarget* depender, + cmTarget* dependee); + + void ComplainAboutMissingTarget(cmTarget* depender, + cmTarget* dependee); /** Fill in properties indicating built file locations. */ void SetImportLocationProperty(const char* config, diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index eb19df5e2..7fd038004 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -11,11 +11,17 @@ ============================================================================*/ #include "cmExportFileGenerator.h" +#include "cmExportSet.h" #include "cmGeneratedFileStream.h" +#include "cmGlobalGenerator.h" +#include "cmInstallExportGenerator.h" +#include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSystemTools.h" #include "cmTarget.h" +#include "cmTargetExport.h" #include "cmVersion.h" +#include "cmComputeLinkInformation.h" #include @@ -76,16 +82,16 @@ bool cmExportFileGenerator::GenerateImportFile() // Protect that file against use with older CMake versions. os << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n"; - os << "IF(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n" - << " MESSAGE(FATAL_ERROR \"CMake >= 2.6.0 required\")\n" - << "ENDIF(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n"; + os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n" + << " message(FATAL_ERROR \"CMake >= 2.6.0 required\")\n" + << "endif()\n"; // Isolate the file policy level. // We use 2.6 here instead of the current version because newer // versions of CMake should be able to export files imported by 2.6 // until the import format changes. - os << "CMAKE_POLICY(PUSH)\n" - << "CMAKE_POLICY(VERSION 2.6)\n"; + os << "cmake_policy(PUSH)\n" + << "cmake_policy(VERSION 2.6)\n"; // Start with the import file header. this->GenerateImportHeaderCode(os); @@ -95,14 +101,15 @@ bool cmExportFileGenerator::GenerateImportFile() // End with the import file footer. this->GenerateImportFooterCode(os); - os << "CMAKE_POLICY(POP)\n"; + os << "cmake_policy(POP)\n"; return result; } //---------------------------------------------------------------------------- void cmExportFileGenerator::GenerateImportConfig(std::ostream& os, - const char* config) + const char* config, + std::vector &missingTargets) { // Construct the property configuration suffix. std::string suffix = "_"; @@ -116,14 +123,379 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os, } // Generate the per-config target information. - this->GenerateImportTargetsConfig(os, config, suffix); + this->GenerateImportTargetsConfig(os, config, suffix, missingTargets); +} + +//---------------------------------------------------------------------------- +void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, + cmTarget *target, + ImportPropertyMap &properties) +{ + const char *input = target->GetProperty(propName); + if (input) + { + properties[propName] = input; + } +} + +//---------------------------------------------------------------------------- +void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, + const char *outputName, + cmTarget *target, + cmGeneratorExpression::PreprocessContext preprocessRule, + ImportPropertyMap &properties, + std::vector &missingTargets) +{ + const char *input = target->GetProperty(propName); + if (input) + { + if (!*input) + { + // Set to empty + properties[outputName] = ""; + return; + } + + std::string prepro = cmGeneratorExpression::Preprocess(input, + preprocessRule); + if (!prepro.empty()) + { + this->ResolveTargetsInGeneratorExpressions(prepro, target, + missingTargets); + properties[outputName] = prepro; + } + } +} + +//---------------------------------------------------------------------------- +void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, + cmTarget *target, + cmGeneratorExpression::PreprocessContext preprocessRule, + ImportPropertyMap &properties, + std::vector &missingTargets) +{ + this->PopulateInterfaceProperty(propName, propName, target, preprocessRule, + properties, missingTargets); +} + + +//---------------------------------------------------------------------------- +void getPropertyContents(cmTarget *tgt, const char *prop, + std::set &ifaceProperties) +{ + const char *p = tgt->GetProperty(prop); + if (!p) + { + return; + } + std::vector content; + cmSystemTools::ExpandListArgument(p, content); + for (std::vector::const_iterator ci = content.begin(); + ci != content.end(); ++ci) + { + ifaceProperties.insert(*ci); + } +} + +//---------------------------------------------------------------------------- +void getCompatibleInterfaceProperties(cmTarget *target, + std::set &ifaceProperties, + const char *config) +{ + cmComputeLinkInformation *info = target->GetLinkInformation(config); + + const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); + + for(cmComputeLinkInformation::ItemVector::const_iterator li = + deps.begin(); + li != deps.end(); ++li) + { + if (!li->Target) + { + continue; + } + getPropertyContents(li->Target, + "COMPATIBLE_INTERFACE_BOOL", + ifaceProperties); + getPropertyContents(li->Target, + "COMPATIBLE_INTERFACE_STRING", + ifaceProperties); + } +} + +//---------------------------------------------------------------------------- +void cmExportFileGenerator::PopulateCompatibleInterfaceProperties( + cmTarget *target, + ImportPropertyMap &properties) +{ + this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_BOOL", + target, properties); + this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_STRING", + target, properties); + + std::set ifaceProperties; + + getPropertyContents(target, "COMPATIBLE_INTERFACE_BOOL", ifaceProperties); + getPropertyContents(target, "COMPATIBLE_INTERFACE_STRING", ifaceProperties); + + getCompatibleInterfaceProperties(target, ifaceProperties, 0); + + std::vector configNames; + target->GetMakefile()->GetConfigurations(configNames); + + for (std::vector::const_iterator ci = configNames.begin(); + ci != configNames.end(); ++ci) + { + getCompatibleInterfaceProperties(target, ifaceProperties, ci->c_str()); + } + + for (std::set::const_iterator it = ifaceProperties.begin(); + it != ifaceProperties.end(); ++it) + { + this->PopulateInterfaceProperty(("INTERFACE_" + *it).c_str(), + target, properties); + } +} + +//---------------------------------------------------------------------------- +void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget *target, + std::ostream& os, + const ImportPropertyMap &properties) +{ + if (!properties.empty()) + { + std::string targetName = this->Namespace; + targetName += target->GetName(); + os << "set_target_properties(" << targetName << " PROPERTIES\n"; + for(ImportPropertyMap::const_iterator pi = properties.begin(); + pi != properties.end(); ++pi) + { + os << " " << pi->first << " \"" << pi->second << "\"\n"; + } + os << ")\n\n"; + } +} + +//---------------------------------------------------------------------------- +bool +cmExportFileGenerator::AddTargetNamespace(std::string &input, + cmTarget* target, + std::vector &missingTargets) +{ + cmMakefile *mf = target->GetMakefile(); + + cmTarget *tgt = mf->FindTargetToUse(input.c_str()); + if (!tgt) + { + return false; + } + + if(tgt->IsImported()) + { + return true; + } + if(this->ExportedTargets.find(tgt) != this->ExportedTargets.end()) + { + input = this->Namespace + input; + } + else + { + std::string namespacedTarget; + this->HandleMissingTarget(namespacedTarget, missingTargets, + mf, target, tgt); + if (!namespacedTarget.empty()) + { + input = namespacedTarget; + } + } + return true; +} + +//---------------------------------------------------------------------------- +void +cmExportFileGenerator::ResolveTargetsInGeneratorExpressions( + std::string &input, + cmTarget* target, + std::vector &missingTargets, + FreeTargetsReplace replace) +{ + if (replace == NoReplaceFreeTargets) + { + this->ResolveTargetsInGeneratorExpression(input, target, missingTargets); + return; + } + std::vector parts; + cmGeneratorExpression::Split(input, parts); + + std::string sep; + input = ""; + for(std::vector::iterator li = parts.begin(); + li != parts.end(); ++li) + { + if (cmGeneratorExpression::Find(*li) == std::string::npos) + { + this->AddTargetNamespace(*li, target, missingTargets); + } + else + { + this->ResolveTargetsInGeneratorExpression( + *li, + target, + missingTargets); + } + input += sep + *li; + sep = ";"; + } +} + +//---------------------------------------------------------------------------- +void +cmExportFileGenerator::ResolveTargetsInGeneratorExpression( + std::string &input, + cmTarget* target, + std::vector &missingTargets) +{ + std::string::size_type pos = 0; + std::string::size_type lastPos = pos; + + cmMakefile *mf = target->GetMakefile(); + + while((pos = input.find("$", nameStartPos); + std::string::size_type commaPos = input.find(",", nameStartPos); + std::string::size_type nextOpenPos = input.find("$<", nameStartPos); + if (commaPos == input.npos // Implied 'this' target + || closePos == input.npos // Imcomplete expression. + || closePos < commaPos // Implied 'this' target + || nextOpenPos < commaPos) // Non-literal + { + lastPos = nameStartPos; + continue; + } + + std::string targetName = input.substr(nameStartPos, + commaPos - nameStartPos); + + if (this->AddTargetNamespace(targetName, target, missingTargets)) + { + input.replace(nameStartPos, commaPos - nameStartPos, targetName); + } + lastPos = nameStartPos + targetName.size() + 1; + } + + std::string errorString; + pos = 0; + lastPos = pos; + while((pos = input.find("$", nameStartPos); + if (endPos == input.npos) + { + errorString = "$ expression incomplete"; + break; + } + std::string targetName = input.substr(nameStartPos, + endPos - nameStartPos); + if(targetName.find("$<") != input.npos) + { + errorString = "$ requires its parameter to be a " + "literal."; + break; + } + if (!this->AddTargetNamespace(targetName, target, missingTargets)) + { + errorString = "$ requires its parameter to be a " + "reachable target."; + break; + } + input.replace(pos, endPos - pos + 1, targetName); + lastPos = endPos; + } + + this->ReplaceInstallPrefix(input); + + if (!errorString.empty()) + { + mf->IssueMessage(cmake::FATAL_ERROR, errorString); + } +} + +//---------------------------------------------------------------------------- +void +cmExportFileGenerator::ReplaceInstallPrefix(std::string &) +{ + // Do nothing +} + +//---------------------------------------------------------------------------- +void +cmExportFileGenerator +::SetImportLinkInterface(const char* config, std::string const& suffix, + cmGeneratorExpression::PreprocessContext preprocessRule, + cmTarget* target, ImportPropertyMap& properties, + std::vector& missingTargets) +{ + // Add the transitive link dependencies for this configuration. + cmTarget::LinkInterface const* iface = target->GetLinkInterface(config, + target); + if (!iface) + { + return; + } + + if (iface->ImplementationIsInterface) + { + this->SetImportLinkProperty(suffix, target, + "IMPORTED_LINK_INTERFACE_LIBRARIES", + iface->Libraries, properties, missingTargets); + return; + } + + const char *propContent; + + if (const char *prop_suffixed = target->GetProperty( + ("LINK_INTERFACE_LIBRARIES" + suffix).c_str())) + { + propContent = prop_suffixed; + } + else if (const char *prop = target->GetProperty( + "LINK_INTERFACE_LIBRARIES")) + { + propContent = prop; + } + else + { + return; + } + + if (!*propContent) + { + properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = ""; + return; + } + + std::string prepro = cmGeneratorExpression::Preprocess(propContent, + preprocessRule); + if (!prepro.empty()) + { + this->ResolveTargetsInGeneratorExpressions(prepro, target, + missingTargets, + ReplaceFreeTargets); + properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = prepro; + } } //---------------------------------------------------------------------------- void cmExportFileGenerator ::SetImportDetailProperties(const char* config, std::string const& suffix, - cmTarget* target, ImportPropertyMap& properties) + cmTarget* target, ImportPropertyMap& properties, + std::vector& missingTargets + ) { // Get the makefile in which to lookup target information. cmMakefile* mf = target->GetMakefile(); @@ -155,17 +527,16 @@ cmExportFileGenerator } // Add the transitive link dependencies for this configuration. - if(cmTarget::LinkInterface const* iface = target->GetLinkInterface(config)) + if(cmTarget::LinkInterface const* iface = target->GetLinkInterface(config, + target)) { this->SetImportLinkProperty(suffix, target, "IMPORTED_LINK_INTERFACE_LANGUAGES", - iface->Languages, properties); - this->SetImportLinkProperty(suffix, target, - "IMPORTED_LINK_INTERFACE_LIBRARIES", - iface->Libraries, properties); + iface->Languages, properties, missingTargets); + this->SetImportLinkProperty(suffix, target, "IMPORTED_LINK_DEPENDENT_LIBRARIES", - iface->SharedDeps, properties); + iface->SharedDeps, properties, missingTargets); if(iface->Multiplicity > 0) { std::string prop = "IMPORTED_LINK_INTERFACE_MULTIPLICITY"; @@ -184,7 +555,9 @@ cmExportFileGenerator cmTarget* target, const char* propName, std::vector const& libs, - ImportPropertyMap& properties) + ImportPropertyMap& properties, + std::vector& missingTargets + ) { // Skip the property if there are no libraries. if(libs.empty()) @@ -192,9 +565,6 @@ cmExportFileGenerator return; } - // Get the makefile in which to lookup target information. - cmMakefile* mf = target->GetMakefile(); - // Construct the property value. std::string link_libs; const char* sep = ""; @@ -205,43 +575,9 @@ cmExportFileGenerator link_libs += sep; sep = ";"; - // Append this entry. - if(cmTarget* tgt = mf->FindTargetToUse(li->c_str())) - { - // This is a target. - if(tgt->IsImported()) - { - // The target is imported (and therefore is not in the - // export). Append the raw name. - link_libs += *li; - } - else if(this->ExportedTargets.find(tgt) != this->ExportedTargets.end()) - { - // The target is in the export. Append it with the export - // namespace. - link_libs += this->Namespace; - link_libs += *li; - } - else - { - // The target is not in the export. - if(!this->AppendMode) - { - // We are not appending, so all exported targets should be - // known here. This is probably user-error. - this->ComplainAboutMissingTarget(target, tgt); - } - // Assume the target will be exported by another command. - // Append it with the export namespace. - link_libs += this->Namespace; - link_libs += *li; - } - } - else - { - // Append the raw name. - link_libs += *li; - } + std::string temp = *li; + this->AddTargetNamespace(temp, target, missingTargets); + link_libs += temp; } // Store the property. @@ -250,6 +586,7 @@ cmExportFileGenerator properties[prop] = link_libs; } + //---------------------------------------------------------------------------- void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os, const char* config) @@ -273,7 +610,7 @@ void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os, void cmExportFileGenerator::GenerateImportFooterCode(std::ostream& os) { os << "# Commands beyond this point should not need to know the version.\n" - << "SET(CMAKE_IMPORT_FILE_VERSION)\n"; + << "set(CMAKE_IMPORT_FILE_VERSION)\n"; } //---------------------------------------------------------------------------- @@ -282,10 +619,41 @@ void cmExportFileGenerator::GenerateImportVersionCode(std::ostream& os) // Store an import file format version. This will let us change the // format later while still allowing old import files to work. os << "# Commands may need to know the format version.\n" - << "SET(CMAKE_IMPORT_FILE_VERSION 1)\n" + << "set(CMAKE_IMPORT_FILE_VERSION 1)\n" << "\n"; } +//---------------------------------------------------------------------------- +void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os, + const std::string &expectedTargets) +{ + os << "set(_targetsDefined)\n" + "set(_targetsNotDefined)\n" + "set(_expectedTargets)\n" + "foreach(_expectedTarget " << expectedTargets << ")\n" + " list(APPEND _expectedTargets ${_expectedTarget})\n" + " if(NOT TARGET ${_expectedTarget})\n" + " list(APPEND _targetsNotDefined ${_expectedTarget})\n" + " endif()\n" + " if(TARGET ${_expectedTarget})\n" + " list(APPEND _targetsDefined ${_expectedTarget})\n" + " endif()\n" + "endforeach()\n" + "if(\"${_targetsDefined}\" STREQUAL \"${_expectedTargets}\")\n" + " set(CMAKE_IMPORT_FILE_VERSION)\n" + " cmake_policy(POP)\n" + " return()\n" + "endif()\n" + "if(NOT \"${_targetsDefined}\" STREQUAL \"\")\n" + " message(FATAL_ERROR \"Some (but not all) targets in this export " + "set were already defined.\\nTargets Defined: ${_targetsDefined}\\n" + "Targets not yet defined: ${_targetsNotDefined}\\n\")\n" + "endif()\n" + "unset(_targetsDefined)\n" + "unset(_targetsNotDefined)\n" + "unset(_expectedTargets)\n" + "\n\n"; +} //---------------------------------------------------------------------------- void cmExportFileGenerator @@ -300,16 +668,19 @@ cmExportFileGenerator switch(target->GetType()) { case cmTarget::EXECUTABLE: - os << "ADD_EXECUTABLE(" << targetName << " IMPORTED)\n"; + os << "add_executable(" << targetName << " IMPORTED)\n"; break; case cmTarget::STATIC_LIBRARY: - os << "ADD_LIBRARY(" << targetName << " STATIC IMPORTED)\n"; + os << "add_library(" << targetName << " STATIC IMPORTED)\n"; break; case cmTarget::SHARED_LIBRARY: - os << "ADD_LIBRARY(" << targetName << " SHARED IMPORTED)\n"; + os << "add_library(" << targetName << " SHARED IMPORTED)\n"; break; case cmTarget::MODULE_LIBRARY: - os << "ADD_LIBRARY(" << targetName << " MODULE IMPORTED)\n"; + os << "add_library(" << targetName << " MODULE IMPORTED)\n"; + break; + case cmTarget::UNKNOWN_LIBRARY: + os << "add_library(" << targetName << " UNKNOWN IMPORTED)\n"; break; default: // should never happen break; @@ -318,27 +689,27 @@ cmExportFileGenerator // Mark the imported executable if it has exports. if(target->IsExecutableWithExports()) { - os << "SET_PROPERTY(TARGET " << targetName + os << "set_property(TARGET " << targetName << " PROPERTY ENABLE_EXPORTS 1)\n"; } // Mark the imported library if it is a framework. if(target->IsFrameworkOnApple()) { - os << "SET_PROPERTY(TARGET " << targetName + os << "set_property(TARGET " << targetName << " PROPERTY FRAMEWORK 1)\n"; } // Mark the imported executable if it is an application bundle. if(target->IsAppBundleOnApple()) { - os << "SET_PROPERTY(TARGET " << targetName + os << "set_property(TARGET " << targetName << " PROPERTY MACOSX_BUNDLE 1)\n"; } if (target->IsCFBundleOnApple()) { - os << "SET_PROPERTY(TARGET " << targetName + os << "set_property(TARGET " << targetName << " PROPERTY BUNDLE 1)\n"; } os << "\n"; @@ -358,7 +729,7 @@ cmExportFileGenerator // Set the import properties. os << "# Import target \"" << targetName << "\" for configuration \"" << config << "\"\n"; - os << "SET_PROPERTY(TARGET " << targetName + os << "set_property(TARGET " << targetName << " APPEND PROPERTY IMPORTED_CONFIGURATIONS "; if(config && *config) { @@ -369,7 +740,7 @@ cmExportFileGenerator os << "NOCONFIG"; } os << ")\n"; - os << "SET_TARGET_PROPERTIES(" << targetName << " PROPERTIES\n"; + os << "set_target_properties(" << targetName << " PROPERTIES\n"; for(ImportPropertyMap::const_iterator pi = properties.begin(); pi != properties.end(); ++pi) { @@ -380,6 +751,55 @@ cmExportFileGenerator } +//---------------------------------------------------------------------------- +void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os, + const std::vector& missingTargets) +{ + if (missingTargets.empty()) + { + os << "# This file does not depend on other imported targets which have\n" + "# been exported from the same project but in a separate " + "export set.\n\n"; + return; + } + os << "# Make sure the targets which have been exported in some other \n" + "# export set exist.\n" + "unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n" + "foreach(_target "; + std::set emitted; + for(unsigned int i=0; iNamespace; targetName += target->GetName(); - os << "LIST(APPEND _IMPORT_CHECK_TARGETS " << targetName << " )\n" - "LIST(APPEND _IMPORT_CHECK_FILES_FOR_" << targetName << " "; + os << "list(APPEND _IMPORT_CHECK_TARGETS " << targetName << " )\n" + "list(APPEND _IMPORT_CHECK_FILES_FOR_" << targetName << " "; for(std::set::const_iterator li = importedLocations.begin(); li != importedLocations.end(); diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index f271e5570..776be614d 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -13,6 +13,7 @@ #define cmExportFileGenerator_h #include "cmCommand.h" +#include "cmGeneratorExpression.h" /** \class cmExportFileGenerator * \brief Generate a file exporting targets from a build or install tree. @@ -46,7 +47,8 @@ protected: // Generate per-configuration target information to the given output // stream. - void GenerateImportConfig(std::ostream& os, const char* config); + void GenerateImportConfig(std::ostream& os, const char* config, + std::vector &missingTargets); // Methods to implement export file code generation. void GenerateImportHeaderCode(std::ostream& os, const char* config = 0); @@ -60,17 +62,23 @@ protected: ImportPropertyMap const& properties, const std::set& importedLocations); void GenerateImportedFileCheckLoop(std::ostream& os); + void GenerateMissingTargetsCheckCode(std::ostream& os, + const std::vector& missingTargets); + void GenerateExpectedTargetsCode(std::ostream& os, + const std::string &expectedTargets); // Collect properties with detailed information about targets beyond // their location on disk. void SetImportDetailProperties(const char* config, std::string const& suffix, cmTarget* target, - ImportPropertyMap& properties); + ImportPropertyMap& properties, + std::vector& missingTargets); void SetImportLinkProperty(std::string const& suffix, cmTarget* target, const char* propName, std::vector const& libs, - ImportPropertyMap& properties); + ImportPropertyMap& properties, + std::vector& missingTargets); /** Each subclass knows how to generate its kind of export file. */ virtual bool GenerateMainFile(std::ostream& os) = 0; @@ -78,12 +86,42 @@ protected: /** Each subclass knows where the target files are located. */ virtual void GenerateImportTargetsConfig(std::ostream& os, const char* config, - std::string const& suffix) = 0; - - /** Each subclass knows how to complain about a target that is - missing from an export set. */ - virtual void ComplainAboutMissingTarget(cmTarget* depender, - cmTarget* dependee) = 0; + std::string const& suffix, + std::vector &missingTargets) = 0; + + /** Each subclass knows how to deal with a target that is missing from an + * export set. */ + virtual void HandleMissingTarget(std::string& link_libs, + std::vector& missingTargets, + cmMakefile* mf, + cmTarget* depender, + cmTarget* dependee) = 0; + void PopulateInterfaceProperty(const char *, + cmTarget *target, + cmGeneratorExpression::PreprocessContext, + ImportPropertyMap &properties, + std::vector &missingTargets); + void PopulateInterfaceProperty(const char *propName, cmTarget *target, + ImportPropertyMap &properties); + void PopulateCompatibleInterfaceProperties(cmTarget *target, + ImportPropertyMap &properties); + void GenerateInterfaceProperties(cmTarget *target, std::ostream& os, + const ImportPropertyMap &properties); + + void SetImportLinkInterface(const char* config, std::string const& suffix, + cmGeneratorExpression::PreprocessContext preprocessRule, + cmTarget* target, ImportPropertyMap& properties, + std::vector& missingTargets); + + enum FreeTargetsReplace { + ReplaceFreeTargets, + NoReplaceFreeTargets + }; + + void ResolveTargetsInGeneratorExpressions(std::string &input, + cmTarget* target, + std::vector &missingTargets, + FreeTargetsReplace replace = NoReplaceFreeTargets); // The namespace in which the exports are placed in the generated file. std::string Namespace; @@ -100,6 +138,22 @@ protected: // The set of targets included in the export. std::set ExportedTargets; + +private: + void PopulateInterfaceProperty(const char *, const char *, + cmTarget *target, + cmGeneratorExpression::PreprocessContext, + ImportPropertyMap &properties, + std::vector &missingTargets); + + bool AddTargetNamespace(std::string &input, cmTarget* target, + std::vector &missingTargets); + + void ResolveTargetsInGeneratorExpression(std::string &input, + cmTarget* target, + std::vector &missingTargets); + + virtual void ReplaceInstallPrefix(std::string &input); }; #endif diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index da14dd787..8b8b8465f 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -11,14 +11,19 @@ ============================================================================*/ #include "cmExportInstallFileGenerator.h" +#include "cmExportSet.h" +#include "cmExportSetMap.h" #include "cmGeneratedFileStream.h" +#include "cmGlobalGenerator.h" +#include "cmLocalGenerator.h" #include "cmInstallExportGenerator.h" #include "cmInstallTargetGenerator.h" +#include "cmTargetExport.h" //---------------------------------------------------------------------------- cmExportInstallFileGenerator ::cmExportInstallFileGenerator(cmInstallExportGenerator* iegen): - InstallExportGenerator(iegen) + IEGen(iegen) { } @@ -34,57 +39,161 @@ std::string cmExportInstallFileGenerator::GetConfigImportFileGlob() //---------------------------------------------------------------------------- bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) { - // Create all the imported targets. + std::vector allTargets; + { + std::string expectedTargets; + std::string sep; for(std::vector::const_iterator - tei = this->ExportSet->begin(); - tei != this->ExportSet->end(); ++tei) + tei = this->IEGen->GetExportSet()->GetTargetExports()->begin(); + tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) { - cmTargetExport* te = *tei; + expectedTargets += sep + this->Namespace + (*tei)->Target->GetName(); + sep = " "; + cmTargetExport const* te = *tei; if(this->ExportedTargets.insert(te->Target).second) { - this->GenerateImportTargetCode(os, te->Target); + allTargets.push_back(te->Target); } else { cmOStringStream e; - e << "INSTALL(EXPORT \"" << this->Name << "\" ...) " - << "includes target \"" << te->Target->GetName() + e << "install(EXPORT \"" + << this->IEGen->GetExportSet()->GetName() + << "\" ...) " << "includes target \"" << te->Target->GetName() << "\" more than once in the export set."; cmSystemTools::Error(e.str().c_str()); return false; } } + this->GenerateExpectedTargetsCode(os, expectedTargets); + } + + // Add code to compute the installation prefix relative to the + // import file location. + const char* installDest = this->IEGen->GetDestination(); + if(!cmSystemTools::FileIsFullPath(installDest)) + { + std::string installPrefix = + this->IEGen->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); + std::string absDest = installPrefix + "/" + installDest + "/"; + if(strncmp(absDest.c_str(), "/lib/", 5) == 0 || + strncmp(absDest.c_str(), "/lib64/", 7) == 0 || + strncmp(absDest.c_str(), "/usr/lib/", 9) == 0 || + strncmp(absDest.c_str(), "/usr/lib64/", 11) == 0) + { + // Assume this is a build for system package installation rather than a + // relocatable distribution. Use an absolute prefix because some Linux + // distros symlink /lib to /usr/lib which confuses the relative path + // computation below if we generate for /lib under one prefix and but the + // file is loaded from another. + os << "set(_IMPORT_PREFIX \"" << installPrefix << "\")\n"; + } + else + { + std::string dest = installDest; + os << "# Compute the installation prefix relative to this file.\n" + << "get_filename_component(_IMPORT_PREFIX " + << "\"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"; + while(!dest.empty()) + { + os << + "get_filename_component(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" PATH)\n"; + dest = cmSystemTools::GetFilenamePath(dest); + } + os << "\n"; + } + + // Import location properties may reference this variable. + this->ImportPrefix = "${_IMPORT_PREFIX}/"; + } + + std::vector missingTargets; + + // Create all the imported targets. + for(std::vector::const_iterator + tei = allTargets.begin(); + tei != allTargets.end(); ++tei) + { + cmTarget* te = *tei; + this->GenerateImportTargetCode(os, te); + + ImportPropertyMap properties; + + this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", + te, + cmGeneratorExpression::InstallInterface, + properties, missingTargets); + this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", + te, + cmGeneratorExpression::InstallInterface, + properties, missingTargets); + this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", + te, properties); + this->PopulateCompatibleInterfaceProperties(te, properties); + + this->GenerateInterfaceProperties(te, os, properties); + } + + // Now load per-configuration properties for them. os << "# Load information for each installed configuration.\n" - << "GET_FILENAME_COMPONENT(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n" - << "FILE(GLOB CONFIG_FILES \"${_DIR}/" + << "get_filename_component(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n" + << "file(GLOB CONFIG_FILES \"${_DIR}/" << this->GetConfigImportFileGlob() << "\")\n" - << "FOREACH(f ${CONFIG_FILES})\n" - << " INCLUDE(${f})\n" - << "ENDFOREACH(f)\n" + << "foreach(f ${CONFIG_FILES})\n" + << " include(${f})\n" + << "endforeach()\n" << "\n"; + // Cleanup the import prefix variable. + if(!this->ImportPrefix.empty()) + { + os << "# Cleanup temporary variables.\n" + << "set(_IMPORT_PREFIX)\n" + << "\n"; + } + this->GenerateImportedFileCheckLoop(os); + // Generate an import file for each configuration. bool result = true; for(std::vector::const_iterator ci = this->Configurations.begin(); ci != this->Configurations.end(); ++ci) { - if(!this->GenerateImportFileConfig(ci->c_str())) + if(!this->GenerateImportFileConfig(ci->c_str(), missingTargets)) { result = false; } } + + this->GenerateMissingTargetsCheckCode(os, missingTargets); + return result; } +//---------------------------------------------------------------------------- +void +cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string &input) +{ + std::string::size_type pos = 0; + std::string::size_type lastPos = pos; + + while((pos = input.find("$", lastPos)) != input.npos) + { + std::string::size_type endPos = pos + sizeof("$") - 1; + input.replace(pos, endPos - pos, "${_IMPORT_PREFIX}"); + lastPos = endPos; + } +} + //---------------------------------------------------------------------------- bool -cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config) +cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config, + std::vector &missingTargets) { // Skip configurations not enabled for this export. - if(!this->InstallExportGenerator->InstallsForConfig(config)) + if(!this->IEGen->InstallsForConfig(config)) { return true; } @@ -121,7 +230,7 @@ cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config) this->GenerateImportHeaderCode(os, config); // Generate the per-config target information. - this->GenerateImportConfig(os, config); + this->GenerateImportConfig(os, config, missingTargets); // End with the import file footer. this->GenerateImportFooterCode(os); @@ -136,36 +245,16 @@ cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config) void cmExportInstallFileGenerator ::GenerateImportTargetsConfig(std::ostream& os, - const char* config, std::string const& suffix) + const char* config, std::string const& suffix, + std::vector &missingTargets) { - // Add code to compute the installation prefix relative to the - // import file location. - const char* installDest = this->InstallExportGenerator->GetDestination(); - if(!cmSystemTools::FileIsFullPath(installDest)) - { - std::string dest = installDest; - os << "# Compute the installation prefix relative to this file.\n" - << "GET_FILENAME_COMPONENT(_IMPORT_PREFIX " - << "\"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"; - while(!dest.empty()) - { - os << - "GET_FILENAME_COMPONENT(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" PATH)\n"; - dest = cmSystemTools::GetFilenamePath(dest); - } - os << "\n"; - - // Import location properties may reference this variable. - this->ImportPrefix = "${_IMPORT_PREFIX}/"; - } - // Add each target in the set to the export. for(std::vector::const_iterator - tei = this->ExportSet->begin(); - tei != this->ExportSet->end(); ++tei) + tei = this->IEGen->GetExportSet()->GetTargetExports()->begin(); + tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) { // Collect import properties for this target. - cmTargetExport* te = *tei; + cmTargetExport const* te = *tei; ImportPropertyMap properties; std::set importedLocations; this->SetImportLocationProperty(config, suffix, te->ArchiveGenerator, @@ -186,7 +275,11 @@ cmExportInstallFileGenerator { // Get the rest of the target details. this->SetImportDetailProperties(config, suffix, - te->Target, properties); + te->Target, properties, missingTargets); + + this->SetImportLinkInterface(config, suffix, + cmGeneratorExpression::InstallInterface, + te->Target, properties, missingTargets); // TOOD: PUBLIC_HEADER_LOCATION // This should wait until the build feature propagation stuff @@ -200,16 +293,6 @@ cmExportInstallFileGenerator importedLocations); } } - - this->GenerateImportedFileCheckLoop(os); - - // Cleanup the import prefix variable. - if(!this->ImportPrefix.empty()) - { - os << "# Cleanup temporary variables.\n" - << "SET(_IMPORT_PREFIX)\n" - << "\n"; - } } //---------------------------------------------------------------------------- @@ -304,14 +387,82 @@ cmExportInstallFileGenerator } } +//---------------------------------------------------------------------------- +void +cmExportInstallFileGenerator::HandleMissingTarget( + std::string& link_libs, std::vector& missingTargets, + cmMakefile* mf, cmTarget* depender, cmTarget* dependee) +{ + std::string name = dependee->GetName(); + std::vector namespaces = this->FindNamespaces(mf, name); + int targetOccurrences = (int)namespaces.size(); + if (targetOccurrences == 1) + { + std::string missingTarget = namespaces[0]; + missingTarget += name; + link_libs += missingTarget; + missingTargets.push_back(missingTarget); + } + else + { + // We are not appending, so all exported targets should be + // known here. This is probably user-error. + this->ComplainAboutMissingTarget(depender, dependee, targetOccurrences); + } +} + +//---------------------------------------------------------------------------- +std::vector +cmExportInstallFileGenerator +::FindNamespaces(cmMakefile* mf, const std::string& name) +{ + std::vector namespaces; + cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator(); + const cmExportSetMap& exportSets = gg->GetExportSets(); + + for(cmExportSetMap::const_iterator expIt = exportSets.begin(); + expIt != exportSets.end(); + ++expIt) + { + const cmExportSet* exportSet = expIt->second; + std::vector const* targets = + exportSet->GetTargetExports(); + + bool containsTarget = false; + for(unsigned int i=0; isize(); i++) + { + if (name == (*targets)[i]->Target->GetName()) + { + containsTarget = true; + break; + } + } + + if (containsTarget) + { + std::vector const* installs = + exportSet->GetInstallations(); + for(unsigned int i=0; isize(); i++) + { + namespaces.push_back((*installs)[i]->GetNamespace()); + } + } + } + + return namespaces; +} + + //---------------------------------------------------------------------------- void cmExportInstallFileGenerator ::ComplainAboutImportPrefix(cmInstallTargetGenerator* itgen) { - const char* installDest = this->InstallExportGenerator->GetDestination(); + const char* installDest = this->IEGen->GetDestination(); cmOStringStream e; - e << "INSTALL(EXPORT \"" << this->Name << "\") given absolute " + e << "install(EXPORT \"" + << this->IEGen->GetExportSet()->GetName() + << "\") given absolute " << "DESTINATION \"" << installDest << "\" but the export " << "references an installation of target \"" << itgen->GetTarget()->GetName() << "\" which has relative " @@ -322,12 +473,24 @@ cmExportInstallFileGenerator //---------------------------------------------------------------------------- void cmExportInstallFileGenerator -::ComplainAboutMissingTarget(cmTarget* depender, cmTarget* dependee) +::ComplainAboutMissingTarget(cmTarget* depender, + cmTarget* dependee, + int occurrences) { cmOStringStream e; - e << "INSTALL(EXPORT \"" << this->Name << "\" ...) " + e << "install(EXPORT \"" + << this->IEGen->GetExportSet()->GetName() + << "\" ...) " << "includes target \"" << depender->GetName() - << "\" which requires target \"" << dependee->GetName() - << "\" that is not in the export set."; + << "\" which requires target \"" << dependee->GetName() << "\" "; + if (occurrences == 0) + { + e << "that is not in the export set."; + } + else + { + e << "that is not in this export set, but " << occurrences + << " times in others."; + } cmSystemTools::Error(e.str().c_str()); } diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index fb678e891..20dd57ad1 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -15,9 +15,7 @@ #include "cmExportFileGenerator.h" class cmInstallExportGenerator; -class cmInstallFilesGenerator; class cmInstallTargetGenerator; -class cmTargetExport; /** \class cmExportInstallFileGenerator * \brief Generate a file exporting targets from an install tree. @@ -40,15 +38,6 @@ public: files. */ cmExportInstallFileGenerator(cmInstallExportGenerator* iegen); - /** Set the name of the export associated with the files. This is - the name given to the install(EXPORT) command mode. */ - void SetName(const char* name) { this->Name = name; } - - /** Set the set of targets to be exported. These are the targets - associated with the export name. */ - void SetExportSet(std::vector const* eSet) - { this->ExportSet = eSet; } - /** Get the per-config file generated for each configuraiton. This maps from the configuration name to the file temporary location for installation. */ @@ -64,12 +53,27 @@ protected: virtual bool GenerateMainFile(std::ostream& os); virtual void GenerateImportTargetsConfig(std::ostream& os, const char* config, - std::string const& suffix); - virtual void ComplainAboutMissingTarget(cmTarget* depender, - cmTarget* dependee); + std::string const& suffix, + std::vector &missingTargets); + virtual void HandleMissingTarget(std::string& link_libs, + std::vector& missingTargets, + cmMakefile* mf, + cmTarget* depender, + cmTarget* dependee); + + virtual void ReplaceInstallPrefix(std::string &input); + + void ComplainAboutMissingTarget(cmTarget* depender, + cmTarget* dependee, + int occurrences); + + std::vector FindNamespaces(cmMakefile* mf, + const std::string& name); + /** Generate a per-configuration file for the targets. */ - bool GenerateImportFileConfig(const char* config); + bool GenerateImportFileConfig(const char* config, + std::vector &missingTargets); /** Fill in properties indicating installed file locations. */ void SetImportLocationProperty(const char* config, @@ -81,9 +85,7 @@ protected: void ComplainAboutImportPrefix(cmInstallTargetGenerator* itgen); - cmInstallExportGenerator* InstallExportGenerator; - std::string Name; - std::vector const* ExportSet; + cmInstallExportGenerator* IEGen; std::string ImportPrefix; @@ -91,34 +93,4 @@ protected: std::map ConfigImportFiles; }; -/* - cmTargetExport is used in cmGlobalGenerator to collect the install - generators for targets associated with an export. -*/ -class cmTargetExport -{ -public: - cmTargetExport(cmTarget* tgt, - cmInstallTargetGenerator* archive, - cmInstallTargetGenerator* runtime, - cmInstallTargetGenerator* library, - cmInstallTargetGenerator* framework, - cmInstallTargetGenerator* bundle, - cmInstallFilesGenerator* headers - ) : Target(tgt), ArchiveGenerator(archive), - RuntimeGenerator(runtime), LibraryGenerator(library), - FrameworkGenerator(framework), BundleGenerator(bundle), - HeaderGenerator(headers) {} - - cmTarget* Target; - cmInstallTargetGenerator* ArchiveGenerator; - cmInstallTargetGenerator* RuntimeGenerator; - cmInstallTargetGenerator* LibraryGenerator; - cmInstallTargetGenerator* FrameworkGenerator; - cmInstallTargetGenerator* BundleGenerator; - cmInstallFilesGenerator* HeaderGenerator; -private: - cmTargetExport(); -}; - #endif diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx index 8fdb069da..f07b783d6 100644 --- a/Source/cmExportLibraryDependencies.cxx +++ b/Source/cmExportLibraryDependencies.cxx @@ -26,7 +26,7 @@ bool cmExportLibraryDependenciesCommand this->SetError("called with incorrect number of arguments"); return false; } - + // store the arguments for the final pass this->Filename = args[0]; this->Append = false; diff --git a/Source/cmExportLibraryDependencies.h b/Source/cmExportLibraryDependencies.h index 2a2ff215e..d8b65ccf1 100644 --- a/Source/cmExportLibraryDependencies.h +++ b/Source/cmExportLibraryDependencies.h @@ -18,7 +18,7 @@ * \brief Add a test to the lists of tests to run. * * cmExportLibraryDependenciesCommand adds a test to the list of tests to run - * + * */ class cmExportLibraryDependenciesCommand : public cmCommand { @@ -26,7 +26,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmExportLibraryDependenciesCommand; } @@ -40,7 +40,7 @@ public: /** * This is called at the end after all the information - * specified by the command is accumulated. + * specified by the command is accumulated. */ virtual void FinalPass(); virtual bool HasFinalPass() const { return true; } @@ -57,7 +57,7 @@ public: { return "Deprecated. Use INSTALL(EXPORT) or EXPORT command."; } - + /** * More documentation. */ @@ -87,7 +87,7 @@ public: { return true; } - + cmTypeMacro(cmExportLibraryDependenciesCommand, cmCommand); private: diff --git a/Source/cmExportSet.cxx b/Source/cmExportSet.cxx new file mode 100644 index 000000000..33b063037 --- /dev/null +++ b/Source/cmExportSet.cxx @@ -0,0 +1,32 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmExportSet.h" +#include "cmTargetExport.h" + +cmExportSet::~cmExportSet() +{ + for(unsigned int i = 0; i < this->TargetExports.size(); ++ i) + { + delete this->TargetExports[i]; + } +} + +void cmExportSet::AddTargetExport(cmTargetExport* te) +{ + this->TargetExports.push_back(te); +} + +void cmExportSet::AddInstallation(cmInstallExportGenerator const* installation) +{ + this->Installations.push_back(installation); +} diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h new file mode 100644 index 000000000..a57aa1204 --- /dev/null +++ b/Source/cmExportSet.h @@ -0,0 +1,46 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmExportSet_h +#define cmExportSet_h + +#include "cmSystemTools.h" +class cmTargetExport; +class cmInstallExportGenerator; + +/// A set of targets that were installed with the same EXPORT parameter. +class cmExportSet +{ +public: + /// Construct an empty export set named \a name + cmExportSet(const std::string &name) : Name(name) {} + /// Destructor + ~cmExportSet(); + + void AddTargetExport(cmTargetExport* tgt); + + void AddInstallation(cmInstallExportGenerator const* installation); + + std::string const& GetName() const { return this->Name; } + + std::vector const* GetTargetExports() const + { return &this->TargetExports; } + + std::vector const* GetInstallations() const + { return &this->Installations; } + +private: + std::vector TargetExports; + std::string Name; + std::vector Installations; +}; + +#endif diff --git a/Source/cmExportSetMap.cxx b/Source/cmExportSetMap.cxx new file mode 100644 index 000000000..96fdb3e4f --- /dev/null +++ b/Source/cmExportSetMap.cxx @@ -0,0 +1,34 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmExportSetMap.h" +#include "cmExportSet.h" + +cmExportSet* cmExportSetMap::operator[](const std::string &name) +{ + std::map::iterator it = this->find(name); + if (it == this->end()) // Export set not found + { + it = this->insert(std::make_pair(name, new cmExportSet(name))).first; + } + return it->second; +} + +cmExportSetMap::~cmExportSetMap() +{ + for(std::map::iterator it = this->begin(); + it != this->end(); + ++ it) + { + delete it->second; + } +} diff --git a/Source/cmExportSetMap.h b/Source/cmExportSetMap.h new file mode 100644 index 000000000..4663c5538 --- /dev/null +++ b/Source/cmExportSetMap.h @@ -0,0 +1,33 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmExportSetMap_h +#define cmExportSetMap_h + +#include "cmSystemTools.h" +class cmExportSet; + +/// A name -> cmExportSet map with overloaded operator[]. +class cmExportSetMap : public std::map +{ +public: + /** \brief Overloaded operator[]. + * + * The operator is overloaded because cmExportSet has no default constructor: + * we do not want unnamed export sets. + */ + cmExportSet* operator[](const std::string &name); + + /// Overloaded destructor deletes all member export sets. + ~cmExportSetMap(); +}; + +#endif diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx new file mode 100644 index 000000000..75f2651ba --- /dev/null +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -0,0 +1,114 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2013 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmExportTryCompileFileGenerator.h" + +#include "cmGeneratedFileStream.h" +#include "cmGeneratorExpressionDAGChecker.h" + +//---------------------------------------------------------------------------- +bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os) +{ + std::set emitted; + std::set emittedDeps; + while(!this->Exports.empty()) + { + cmTarget* te = this->Exports.back(); + this->Exports.pop_back(); + if (emitted.insert(te).second) + { + emittedDeps.insert(te); + this->GenerateImportTargetCode(os, te); + + ImportPropertyMap properties; + + this->FindTargets("INTERFACE_INCLUDE_DIRECTORIES", te, emittedDeps); + this->FindTargets("INTERFACE_COMPILE_DEFINITIONS", te, emittedDeps); + + this->PopulateProperties(te, properties, emittedDeps); + + this->GenerateInterfaceProperties(te, os, properties); + } + } + return true; +} + +std::string cmExportTryCompileFileGenerator::FindTargets(const char *propName, + cmTarget *tgt, + std::set &emitted) +{ + const char *prop = tgt->GetProperty(propName); + if(!prop) + { + return std::string(); + } + + cmListFileBacktrace lfbt; + cmGeneratorExpression ge(lfbt); + + cmGeneratorExpressionDAGChecker dagChecker(lfbt, + tgt->GetName(), + propName, 0, 0); + + cmsys::auto_ptr cge = ge.Parse(prop); + + cmTarget dummyHead; + dummyHead.SetType(cmTarget::EXECUTABLE, "try_compile_dummy_exe"); + dummyHead.SetMakefile(tgt->GetMakefile()); + + std::string result = cge->Evaluate(tgt->GetMakefile(), this->Config, + false, &dummyHead, tgt, &dagChecker); + + const std::set &allTargets = cge->GetAllTargetsSeen(); + for(std::set::const_iterator li = allTargets.begin(); + li != allTargets.end(); ++li) + { + if(emitted.insert(*li).second) + { + this->Exports.push_back(*li); + } + } + return result; +} + +//---------------------------------------------------------------------------- +void +cmExportTryCompileFileGenerator::PopulateProperties(cmTarget* target, + ImportPropertyMap& properties, + std::set &emitted) +{ + cmPropertyMap props = target->GetProperties(); + for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i) + { + properties[i->first] = i->second.GetValue(); + + if(i->first.find("IMPORTED_LINK_INTERFACE_LIBRARIES") == 0) + { + const std::string libs = i->second.GetValue(); + + std::string evalResult = this->FindTargets(i->first.c_str(), + target, emitted); + + std::vector depends; + cmSystemTools::ExpandListArgument(evalResult, depends); + for(std::vector::const_iterator li = depends.begin(); + li != depends.end(); ++li) + { + cmTarget *tgt = target->GetMakefile()->FindTargetToUse(li->c_str()); + if(tgt && emitted.insert(tgt).second) + { + this->Exports.push_back(tgt); + } + } + } + } +} diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h new file mode 100644 index 000000000..ed393abf4 --- /dev/null +++ b/Source/cmExportTryCompileFileGenerator.h @@ -0,0 +1,55 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2013 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmExportInstallFileGenerator_h +#define cmExportInstallFileGenerator_h + +#include "cmExportFileGenerator.h" + +class cmInstallExportGenerator; +class cmInstallTargetGenerator; + +class cmExportTryCompileFileGenerator: public cmExportFileGenerator +{ +public: + /** Set the list of targets to export. */ + void SetExports(const std::vector &exports) + { this->Exports = exports; } + void SetConfig(const char *config) { this->Config = config; } +protected: + + // Implement virtual methods from the superclass. + virtual bool GenerateMainFile(std::ostream& os); + + virtual void GenerateImportTargetsConfig(std::ostream&, + const char*, + std::string const&, + std::vector&) {} + virtual void HandleMissingTarget(std::string&, + std::vector&, + cmMakefile*, + cmTarget*, + cmTarget*) {} + + void PopulateProperties(cmTarget* target, + ImportPropertyMap& properties, + std::set &emitted); + +private: + std::string FindTargets(const char *prop, cmTarget *tgt, + std::set &emitted); + + + std::vector Exports; + const char *Config; +}; + +#endif diff --git a/Source/cmExprLexer.h b/Source/cmExprLexer.h index 4c10496ab..03b36cec5 100644 --- a/Source/cmExprLexer.h +++ b/Source/cmExprLexer.h @@ -58,7 +58,7 @@ typedef uint32_t flex_uint32_t; typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; +typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ @@ -188,7 +188,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ diff --git a/Source/cmExprLexer.in.l b/Source/cmExprLexer.in.l index db9018f99..f344b40ff 100644 --- a/Source/cmExprLexer.in.l +++ b/Source/cmExprLexer.in.l @@ -54,19 +54,19 @@ Modify cmExprLexer.h: %% -[0-9][0-9]* { yylvalp->Number = atoi(yytext); return exp_NUMBER; } +[0-9][0-9]* { yylvalp->Number = atoi(yytext); return exp_NUMBER; } "+" { return exp_PLUS; } -"-" { return exp_MINUS; } -"*" { return exp_TIMES; } -"/" { return exp_DIVIDE; } -"%" { return exp_MOD; } -"\|" { return exp_OR; } -"&" { return exp_AND; } -"^" { return exp_XOR; } -"~" { return exp_NOT; } -"<<" { return exp_SHIFTLEFT; } -">>" { return exp_SHIFTRIGHT; } +"-" { return exp_MINUS; } +"*" { return exp_TIMES; } +"/" { return exp_DIVIDE; } +"%" { return exp_MOD; } +"\|" { return exp_OR; } +"&" { return exp_AND; } +"^" { return exp_XOR; } +"~" { return exp_NOT; } +"<<" { return exp_SHIFTLEFT; } +">>" { return exp_SHIFTRIGHT; } "(" { return exp_OPENPARENT; } ")" { return exp_CLOSEPARENT; } diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index 7728d740b..9c1795ec2 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -42,7 +42,7 @@ int cmExprParserHelper::ParseString(const char* str, int verb) this->InputBuffer = str; this->InputBufferPos = 0; this->CurrentLine = 0; - + this->Result = 0; yyscan_t yyscanner; @@ -61,7 +61,7 @@ int cmExprParserHelper::ParseString(const char* str, int verb) if ( Verbose ) { - std::cerr << "Expanding [" << str << "] produced: [" + std::cerr << "Expanding [" << str << "] produced: [" << this->Result << "]" << std::endl; } return 1; diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index 690426d8d..4b76b3322 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -9,7 +9,7 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef cmExprParserHelper_h +#ifndef cmExprParserHelper_h #define cmExprParserHelper_h #include "cmStandardIncludes.h" diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx index 6ed84bd95..9c965cc24 100644 --- a/Source/cmExternalMakefileProjectGenerator.cxx +++ b/Source/cmExternalMakefileProjectGenerator.cxx @@ -49,7 +49,7 @@ const char* cmExternalMakefileProjectGenerator::GetGlobalGeneratorName( } // otherwise search for the matching global generator - for (std::vector::const_iterator + for (std::vector::const_iterator it = this->SupportedGlobalGenerators.begin(); it != this->SupportedGlobalGenerators.end(); ++it) diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h index 46f1d310b..182c1a8f6 100644 --- a/Source/cmExternalMakefileProjectGenerator.h +++ b/Source/cmExternalMakefileProjectGenerator.h @@ -22,12 +22,12 @@ class cmGlobalGenerator; * \brief Base class for generators for "External Makefile based IDE projects". * * cmExternalMakefileProjectGenerator is a base class for generators - * for "external makefile based projects", i.e. IDE projects which work + * for "external makefile based projects", i.e. IDE projects which work * an already existing makefiles. * See cmGlobalKdevelopGenerator as an example. - * After the makefiles have been generated by one of the Makefile + * After the makefiles have been generated by one of the Makefile * generators, the Generate() method is called and this generator - * can iterate over the local generators and/or projects to produce the + * can iterate over the local generators and/or projects to produce the * project files for the IDE. */ class cmExternalMakefileProjectGenerator @@ -39,7 +39,7 @@ public: ///! Get the name for this generator. virtual const char* GetName() const = 0; /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry, + virtual void GetDocumentation(cmDocumentationEntry& entry, const char* fullName) const = 0; ///! set the global generator which will generate the makefiles @@ -47,7 +47,7 @@ public: {this->GlobalGenerator = generator;} ///! Return the list of global generators supported by this extra generator - const std::vector& GetSupportedGlobalGenerators() const + const std::vector& GetSupportedGlobalGenerators() const {return this->SupportedGlobalGenerators;} ///! Get the name of the global generator for the given full name @@ -55,7 +55,7 @@ public: /** Create a full name from the given global generator name and the * extra generator name */ - static std::string CreateFullGeneratorName(const char* globalGenerator, + static std::string CreateFullGeneratorName(const char* globalGenerator, const char* extraGenerator); ///! Generate the project files, the Makefiles have already been generated diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index ad4ab76ee..6d5d5b5f6 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -617,14 +617,17 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, "

\n" " [FILE_PERMISSIONS permissions...]\n" @@ -248,6 +267,8 @@ protected: bool HandleInstallCommand(std::vector const& args); bool HandleDownloadCommand(std::vector const& args); bool HandleUploadCommand(std::vector const& args); + + bool HandleTimestampCommand(std::vector const& args); }; diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx index b1050d311..3167be496 100644 --- a/Source/cmFileTimeComparison.cxx +++ b/Source/cmFileTimeComparison.cxx @@ -116,7 +116,7 @@ cmFileTimeComparison::~cmFileTimeComparison() } //---------------------------------------------------------------------------- -bool cmFileTimeComparison::FileTimeCompare(const char* f1, +bool cmFileTimeComparison::FileTimeCompare(const char* f1, const char* f2, int* result) { return this->Internals->FileTimeCompare(f1, f2, result); @@ -129,7 +129,7 @@ bool cmFileTimeComparison::FileTimesDiffer(const char* f1, const char* f2) } //---------------------------------------------------------------------------- -int cmFileTimeComparisonInternal::Compare(cmFileTimeComparison_Type* s1, +int cmFileTimeComparisonInternal::Compare(cmFileTimeComparison_Type* s1, cmFileTimeComparison_Type* s2) { #if !defined(_WIN32) || defined(__CYGWIN__) diff --git a/Source/cmFileTimeComparison.h b/Source/cmFileTimeComparison.h index f5de2f619..cc1ef633d 100644 --- a/Source/cmFileTimeComparison.h +++ b/Source/cmFileTimeComparison.h @@ -31,7 +31,7 @@ public: * Compare file modification times. * Return true for successful comparison and false for error. * When true is returned, result has -1, 0, +1 for - * f1 older, same, or newer than f2. + * f1 older, same, or newer than f2. */ bool FileTimeCompare(const char* f1, const char* f2, int* result); @@ -42,7 +42,7 @@ public: bool FileTimesDiffer(const char* f1, const char* f2); protected: - + cmFileTimeComparisonInternal* Internals; }; diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index fb8bcf78d..7ce003216 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -10,11 +10,13 @@ See the License for more information. ============================================================================*/ #include "cmFindBase.h" - + cmFindBase::cmFindBase() { this->AlreadyInCache = false; this->AlreadyInCacheWithoutMetaInfo = false; + this->NamesPerDir = false; + this->NamesPerDirAllowed = false; } //---------------------------------------------------------------------------- @@ -132,7 +134,7 @@ bool cmFindBase::ParseArguments(std::vector const& argsIn) bool compatibility = this->Makefile->NeedBackwardsCompatibility(2,3); // copy argsIn into args so it can be modified, - // in the process extract the DOC "documentation" + // in the process extract the DOC "documentation" size_t size = argsIn.size(); std::vector args; bool foundDoc = false; @@ -178,7 +180,7 @@ bool cmFindBase::ParseArguments(std::vector const& argsIn) this->AlreadyInCache = true; return true; } - this->AlreadyInCache = false; + this->AlreadyInCache = false; // Find the current root path mode. this->SelectDefaultRootPathMode(); @@ -213,6 +215,19 @@ bool cmFindBase::ParseArguments(std::vector const& argsIn) compatibility = false; newStyle = true; } + else if (args[j] == "NAMES_PER_DIR") + { + doing = DoingNone; + if(this->NamesPerDirAllowed) + { + this->NamesPerDir = true; + } + else + { + this->SetError("does not support NAMES_PER_DIR"); + return false; + } + } else if (args[j] == "NO_SYSTEM_PATH") { doing = DoingNone; @@ -264,17 +279,17 @@ bool cmFindBase::ParseArguments(std::vector const& argsIn) } else if(this->Names.size() == 1) { - this->VariableDocumentation += "the " + this->VariableDocumentation += "the " + this->Names[0] + " library be found"; } else - { + { this->VariableDocumentation += "one of the " + this->Names[0]; for (unsigned int j = 1; j < this->Names.size() - 1; ++j) { this->VariableDocumentation += ", " + this->Names[j]; } - this->VariableDocumentation += " or " + this->VariableDocumentation += " or " + this->Names[this->Names.size() - 1] + " libraries be found"; } } @@ -345,13 +360,13 @@ void cmFindBase::AddPrefixPaths(std::vector const& in_paths, { dir += "/"; } - if(subdir == "lib") + if(subdir == "include" || subdir == "lib") { const char* arch = this->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE"); if(arch && *arch) { - this->AddPathInternal(dir+"lib/"+arch, pathType); + this->AddPathInternal(dir+subdir+"/"+arch, pathType); } } std::string add = dir + subdir; @@ -504,7 +519,7 @@ void cmFindBase::AddPathSuffixes() cmSystemTools::ConvertToUnixSlashes(*i); // copy each finalPath combined with SearchPathSuffixes // to the SearchPaths ivar - for(std::vector::iterator j = + for(std::vector::iterator j = this->SearchPathSuffixes.begin(); j != this->SearchPathSuffixes.end(); ++j) { @@ -517,7 +532,7 @@ void cmFindBase::AddPathSuffixes() p += std::string("/"); } p += *j; - // add to all paths because the search path may be modified + // add to all paths because the search path may be modified // later with lib being replaced for lib64 which may exist paths.push_back(p); } @@ -535,13 +550,13 @@ void cmFindBase::PrintFindStuff() std::cerr << "SearchAppBundleOnly: " << this->SearchAppBundleOnly << "\n"; std::cerr << "SearchAppBundleFirst: " << this->SearchAppBundleFirst << "\n"; std::cerr << "VariableName " << this->VariableName << "\n"; - std::cerr << "VariableDocumentation " + std::cerr << "VariableDocumentation " << this->VariableDocumentation << "\n"; std::cerr << "NoDefaultPath " << this->NoDefaultPath << "\n"; - std::cerr << "NoCMakeEnvironmentPath " + std::cerr << "NoCMakeEnvironmentPath " << this->NoCMakeEnvironmentPath << "\n"; std::cerr << "NoCMakePath " << this->NoCMakePath << "\n"; - std::cerr << "NoSystemEnvironmentPath " + std::cerr << "NoSystemEnvironmentPath " << this->NoSystemEnvironmentPath << "\n"; std::cerr << "NoCMakeSystemPath " << this->NoCMakeSystemPath << "\n"; std::cerr << "EnvironmentPath " << this->EnvironmentPath << "\n"; diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h index 37ab2ecd2..84b03300c 100644 --- a/Source/cmFindBase.h +++ b/Source/cmFindBase.h @@ -30,7 +30,7 @@ public: */ virtual bool ParseArguments(std::vector const& args); cmTypeMacro(cmFindBase, cmFindCommon); - + virtual const char* GetFullDocumentation() const; protected: @@ -43,12 +43,14 @@ protected: // also copy the documentation from the cache to VariableDocumentation // if it has documentation in the cache bool CheckForVariableInCache(); - + cmStdString GenericDocumentation; // use by command during find cmStdString VariableDocumentation; cmStdString VariableName; std::vector Names; + bool NamesPerDir; + bool NamesPerDirAllowed; // CMAKE_*_PATH CMAKE_SYSTEM_*_PATH FRAMEWORK|LIBRARY|INCLUDE|PROGRAM cmStdString EnvironmentPath; // LIB,INCLUDE diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h index 7d349d33c..1bfdcbd16 100644 --- a/Source/cmFindFileCommand.h +++ b/Source/cmFindFileCommand.h @@ -18,7 +18,7 @@ * \brief Define a command to search for an executable program. * * cmFindFileCommand is used to define a CMake variable - * that specifies an executable program. The command searches + * that specifies an executable program. The command searches * in the current path (e.g., PATH environment variable) for * an executable that matches one of the supplied names. */ @@ -29,7 +29,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmFindFileCommand; } @@ -42,7 +42,7 @@ public: { return "Find the full path to a file."; } - + cmTypeMacro(cmFindFileCommand, cmFindPathCommand); protected: virtual void GenerateDocumentation(); diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 6cdbbf2dc..4af7e11bf 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -15,8 +15,9 @@ #include cmFindLibraryCommand::cmFindLibraryCommand() -{ +{ this->EnvironmentPath = "LIB"; + this->NamesPerDirAllowed = true; } //---------------------------------------------------------------------------- @@ -44,6 +45,9 @@ void cmFindLibraryCommand::GenerateDocumentation() "SEARCH_XXX", "library"); cmSystemTools::ReplaceString(this->GenericDocumentation, "XXX_SUBDIR", "lib"); + cmSystemTools::ReplaceString(this->GenericDocumentation, + "NAMES name1 [name2 ...]", + "NAMES name1 [name2 ...] [NAMES_PER_DIR]"); cmSystemTools::ReplaceString( this->GenericDocumentation, "XXX_EXTRA_PREFIX_ENTRY", @@ -52,6 +56,12 @@ void cmFindLibraryCommand::GenerateDocumentation() "CMAKE_FIND_ROOT_PATH_MODE_XXX", "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY"); this->GenericDocumentation += + "\n" + "When more than one value is given to the NAMES option this command " + "by default will consider one name at a time and search every directory " + "for it. " + "The NAMES_PER_DIR option tells this command to consider one directory " + "at a time and search for all names in it." "\n" "If the library found is a framework, then VAR will be set to " "the full path to the framework /A.framework. " @@ -105,7 +115,10 @@ bool cmFindLibraryCommand ->GetPropertyAsBool("FIND_LIBRARY_USE_LIB64_PATHS")) { // add special 64 bit paths if this is a 64 bit compile. - this->AddLib64Paths(); + if(this->Makefile->PlatformIs64Bit()) + { + this->AddArchitecturePaths("64"); + } } std::string library = this->FindLibrary(); @@ -129,90 +142,55 @@ bool cmFindLibraryCommand //---------------------------------------------------------------------------- void cmFindLibraryCommand::AddArchitecturePaths(const char* suffix) { - std::vector newPaths; - bool found = false; - std::string subpath = "lib"; - subpath += suffix; - subpath += "/"; - for(std::vector::iterator i = this->SearchPaths.begin(); - i != this->SearchPaths.end(); ++i) + std::vector original; + original.swap(this->SearchPaths); + for(std::vector::iterator i = original.begin(); + i != original.end(); ++i) { - // Try replacing lib/ with lib/ - std::string s = *i; - cmSystemTools::ReplaceString(s, "lib/", subpath.c_str()); - if((s != *i) && cmSystemTools::FileIsDirectory(s.c_str())) - { - found = true; - newPaths.push_back(s); - } + this->AddArchitecturePath(*i, 0, suffix); + } +} - // Now look for lib - s = *i; - s += suffix; - if(cmSystemTools::FileIsDirectory(s.c_str())) +//---------------------------------------------------------------------------- +void cmFindLibraryCommand::AddArchitecturePath( + std::string const& dir, std::string::size_type start_pos, + const char* suffix, bool fresh) +{ + std::string::size_type pos = dir.find("lib/", start_pos); + if(pos != std::string::npos) + { + std::string cur_dir = dir.substr(0,pos+3); + + // Follow "lib". + std::string next_dir = cur_dir + suffix; + if(cmSystemTools::FileIsDirectory(next_dir.c_str())) { - found = true; - newPaths.push_back(s); + next_dir += dir.substr(pos+3); + std::string::size_type next_pos = pos+3+strlen(suffix)+1; + this->AddArchitecturePath(next_dir, next_pos, suffix); } - // now add the original unchanged path - if(cmSystemTools::FileIsDirectory(i->c_str())) + + // Follow "lib". + if(cmSystemTools::FileIsDirectory(cur_dir.c_str())) { - newPaths.push_back(*i); + this->AddArchitecturePath(dir, pos+3+1, suffix, false); } } - - // If any new paths were found replace the original set. - if(found) + if(fresh) { - this->SearchPaths = newPaths; - } -} - -void cmFindLibraryCommand::AddLib64Paths() -{ - std::string voidsize = - this->Makefile->GetSafeDefinition("CMAKE_SIZEOF_VOID_P"); - int size = atoi(voidsize.c_str()); - if(size != 8) - { - return; - } - std::vector path64; - bool found64 = false; - for(std::vector::iterator i = this->SearchPaths.begin(); - i != this->SearchPaths.end(); ++i) - { - std::string s = *i; - std::string s2 = *i; - cmSystemTools::ReplaceString(s, "lib/", "lib64/"); - // try to replace lib with lib64 and see if it is there, - // then prepend it to the path - // Note that all paths have trailing slashes. - if((s != *i) && cmSystemTools::FileIsDirectory(s.c_str())) + // Check for /. + std::string cur_dir = dir + suffix + "/"; + if(cmSystemTools::FileIsDirectory(cur_dir.c_str())) { - path64.push_back(s); - found64 = true; - } - // now just add a 64 to the path name and if it is there, - // add it to the path - s2 += "64/"; - if(cmSystemTools::FileIsDirectory(s2.c_str())) - { - found64 = true; - path64.push_back(s2); - } - // now add the original unchanged path - if(cmSystemTools::FileIsDirectory(i->c_str())) + this->SearchPaths.push_back(cur_dir); + } + + // Now add the original unchanged path + if(cmSystemTools::FileIsDirectory(dir.c_str())) { - path64.push_back(*i); + this->SearchPaths.push_back(dir); } } - // now replace the SearchPaths with the 64 bit converted path - // if any 64 bit paths were discovered - if(found64) - { - this->SearchPaths = path64; - } } //---------------------------------------------------------------------------- @@ -252,18 +230,19 @@ struct cmFindLibraryHelper // Keep track of the best library file found so far. typedef std::vector::size_type size_type; std::string BestPath; - size_type BestPrefix; - size_type BestSuffix; // Support for OpenBSD shared library naming: lib.so.. bool OpenBSD; - unsigned int BestMajor; - unsigned int BestMinor; - // Current name under consideration. - cmsys::RegularExpression NameRegex; - bool TryRawName; - std::string RawName; + // Current names under consideration. + struct Name + { + bool TryRaw; + std::string Raw; + cmsys::RegularExpression Regex; + Name(): TryRaw(false) {} + }; + std::vector Names; // Current full path under consideration. std::string TestPath; @@ -281,8 +260,9 @@ struct cmFindLibraryHelper suffix) - this->Suffixes.begin(); } bool HasValidSuffix(std::string const& name); - void SetName(std::string const& name); + void AddName(std::string const& name); bool CheckDirectory(std::string const& path); + bool CheckDirectoryForName(std::string const& path, Name& name); }; //---------------------------------------------------------------------------- @@ -305,14 +285,6 @@ cmFindLibraryHelper::cmFindLibraryHelper(cmMakefile* mf): this->OpenBSD = this->Makefile->GetCMakeInstance() ->GetPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING"); - - this->TryRawName = false; - - // No library file has yet been found. - this->BestPrefix = this->Prefixes.size(); - this->BestSuffix = this->Suffixes.size(); - this->BestMajor = 0; - this->BestMinor = 0; } //---------------------------------------------------------------------------- @@ -385,11 +357,13 @@ bool cmFindLibraryHelper::HasValidSuffix(std::string const& name) } //---------------------------------------------------------------------------- -void cmFindLibraryHelper::SetName(std::string const& name) +void cmFindLibraryHelper::AddName(std::string const& name) { + Name entry; + // Consider checking the raw name too. - this->TryRawName = this->HasValidSuffix(name); - this->RawName = name; + entry.TryRaw = this->HasValidSuffix(name); + entry.Raw = name; // Build a regular expression to match library names. std::string regex = "^"; @@ -401,21 +375,37 @@ void cmFindLibraryHelper::SetName(std::string const& name) regex += "(\\.[0-9]+\\.[0-9]+)?"; } regex += "$"; - this->NameRegex.compile(regex.c_str()); + entry.Regex.compile(regex.c_str()); + this->Names.push_back(entry); } //---------------------------------------------------------------------------- bool cmFindLibraryHelper::CheckDirectory(std::string const& path) +{ + for(std::vector::iterator i = this->Names.begin(); + i != this->Names.end(); ++i) + { + if(this->CheckDirectoryForName(path, *i)) + { + return true; + } + } + return false; +} + +//---------------------------------------------------------------------------- +bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path, + Name& name) { // If the original library name provided by the user matches one of // the suffixes, try it first. This allows users to search // specifically for a static library on some platforms (on MS tools // one cannot tell just from the library name whether it is a static // library or an import library). - if(this->TryRawName) + if(name.TryRaw) { this->TestPath = path; - this->TestPath += this->RawName; + this->TestPath += name.Raw; if(cmSystemTools::FileExists(this->TestPath.c_str(), true)) { this->BestPath = @@ -425,6 +415,12 @@ bool cmFindLibraryHelper::CheckDirectory(std::string const& path) } } + // No library file has yet been found. + size_type bestPrefix = this->Prefixes.size(); + size_type bestSuffix = this->Suffixes.size(); + unsigned int bestMajor = 0; + unsigned int bestMinor = 0; + // Search for a file matching the library name regex. std::string dir = path; cmSystemTools::ConvertToUnixSlashes(dir); @@ -438,7 +434,7 @@ bool cmFindLibraryHelper::CheckDirectory(std::string const& path) #else std::string const& testName = origName; #endif - if(this->NameRegex.find(testName)) + if(name.Regex.find(testName)) { this->TestPath = path; this->TestPath += origName; @@ -448,25 +444,25 @@ bool cmFindLibraryHelper::CheckDirectory(std::string const& path) // best name found so far. Earlier prefixes are preferred, // followed by earlier suffixes. For OpenBSD, shared library // version extensions are compared. - size_type prefix = this->GetPrefixIndex(this->NameRegex.match(1)); - size_type suffix = this->GetSuffixIndex(this->NameRegex.match(2)); + size_type prefix = this->GetPrefixIndex(name.Regex.match(1)); + size_type suffix = this->GetSuffixIndex(name.Regex.match(2)); unsigned int major = 0; unsigned int minor = 0; if(this->OpenBSD) { - sscanf(this->NameRegex.match(3).c_str(), ".%u.%u", &major, &minor); + sscanf(name.Regex.match(3).c_str(), ".%u.%u", &major, &minor); } - if(this->BestPath.empty() || prefix < this->BestPrefix || - (prefix == this->BestPrefix && suffix < this->BestSuffix) || - (prefix == this->BestPrefix && suffix == this->BestSuffix && - (major > this->BestMajor || - (major == this->BestMajor && minor > this->BestMinor)))) + if(this->BestPath.empty() || prefix < bestPrefix || + (prefix == bestPrefix && suffix < bestSuffix) || + (prefix == bestPrefix && suffix == bestSuffix && + (major > bestMajor || + (major == bestMajor && minor > bestMinor)))) { this->BestPath = this->TestPath; - this->BestPrefix = prefix; - this->BestSuffix = suffix; - this->BestMajor = major; - this->BestMinor = minor; + bestPrefix = prefix; + bestSuffix = suffix; + bestMajor = major; + bestMinor = minor; } } } @@ -478,6 +474,42 @@ bool cmFindLibraryHelper::CheckDirectory(std::string const& path) //---------------------------------------------------------------------------- std::string cmFindLibraryCommand::FindNormalLibrary() +{ + if(this->NamesPerDir) + { + return this->FindNormalLibraryNamesPerDir(); + } + else + { + return this->FindNormalLibraryDirsPerName(); + } +} + +//---------------------------------------------------------------------------- +std::string cmFindLibraryCommand::FindNormalLibraryNamesPerDir() +{ + // Search for all names in each directory. + cmFindLibraryHelper helper(this->Makefile); + for(std::vector::const_iterator ni = this->Names.begin(); + ni != this->Names.end() ; ++ni) + { + helper.AddName(*ni); + } + // Search every directory. + for(std::vector::const_iterator + p = this->SearchPaths.begin(); p != this->SearchPaths.end(); ++p) + { + if(helper.CheckDirectory(*p)) + { + return helper.BestPath; + } + } + // Couldn't find the library. + return ""; +} + +//---------------------------------------------------------------------------- +std::string cmFindLibraryCommand::FindNormalLibraryDirsPerName() { // Search the entire path for each name. cmFindLibraryHelper helper(this->Makefile); @@ -486,7 +518,7 @@ std::string cmFindLibraryCommand::FindNormalLibrary() { // Switch to searching for this name. std::string const& name = *ni; - helper.SetName(name); + helper.AddName(name); // Search every directory. for(std::vector::const_iterator @@ -506,19 +538,60 @@ std::string cmFindLibraryCommand::FindNormalLibrary() //---------------------------------------------------------------------------- std::string cmFindLibraryCommand::FindFrameworkLibrary() { - // Search for a framework of each name in the entire search path. + if(this->NamesPerDir) + { + return this->FindFrameworkLibraryNamesPerDir(); + } + else + { + return this->FindFrameworkLibraryDirsPerName(); + } +} + +//---------------------------------------------------------------------------- +std::string cmFindLibraryCommand::FindFrameworkLibraryNamesPerDir() +{ + std::string fwPath; + // Search for all names in each search path. + for(std::vector::const_iterator di = this->SearchPaths.begin(); + di != this->SearchPaths.end(); ++di) + { + for(std::vector::const_iterator ni = this->Names.begin(); + ni != this->Names.end() ; ++ni) + { + fwPath = *di; + fwPath += *ni; + fwPath += ".framework"; + if(cmSystemTools::FileIsDirectory(fwPath.c_str())) + { + return cmSystemTools::CollapseFullPath(fwPath.c_str()); + } + } + } + + // No framework found. + return ""; +} + +//---------------------------------------------------------------------------- +std::string cmFindLibraryCommand::FindFrameworkLibraryDirsPerName() +{ + std::string fwPath; + // Search for each name in all search paths. for(std::vector::const_iterator ni = this->Names.begin(); ni != this->Names.end() ; ++ni) { - // Search the paths for a framework with this name. - std::string fwName = *ni; - fwName += ".framework"; - std::string fwPath = cmSystemTools::FindDirectory(fwName.c_str(), - this->SearchPaths, - true); - if(!fwPath.empty()) + for(std::vector::const_iterator + di = this->SearchPaths.begin(); + di != this->SearchPaths.end(); ++di) { - return fwPath; + fwPath = *di; + fwPath += *ni; + fwPath += ".framework"; + if(cmSystemTools::FileIsDirectory(fwPath.c_str())) + { + return cmSystemTools::CollapseFullPath(fwPath.c_str()); + } } } diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index b880be266..cd0fce8ad 100644 --- a/Source/cmFindLibraryCommand.h +++ b/Source/cmFindLibraryCommand.h @@ -29,7 +29,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmFindLibraryCommand; } @@ -59,15 +59,22 @@ public: return "Find a library."; } cmTypeMacro(cmFindLibraryCommand, cmFindBase); - + protected: void AddArchitecturePaths(const char* suffix); - void AddLib64Paths(); + void AddArchitecturePath(std::string const& dir, + std::string::size_type start_pos, + const char* suffix, + bool fresh = true); std::string FindLibrary(); virtual void GenerateDocumentation(); private: std::string FindNormalLibrary(); + std::string FindNormalLibraryNamesPerDir(); + std::string FindNormalLibraryDirsPerName(); std::string FindFrameworkLibrary(); + std::string FindFrameworkLibraryNamesPerDir(); + std::string FindFrameworkLibraryDirsPerName(); }; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index be47f95d4..aa3a73d26 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -95,7 +95,8 @@ void cmFindPackageCommand::GenerateDocumentation() "Finds and loads settings from an external project. " "_FOUND will be set to indicate whether the package was found. " "When the package is found package-specific information is provided " - "through variables documented by the package itself. " + "through variables and imported targets documented by the package " + "itself. " "The QUIET option disables messages if the package cannot be found. " "The MODULE option disables the second signature documented below. " "The REQUIRED option stops processing with an error message if the " @@ -840,6 +841,8 @@ bool cmFindPackageCommand //---------------------------------------------------------------------------- void cmFindPackageCommand::SetModuleVariables(const std::string& components) { + this->AddFindDefinition("CMAKE_FIND_PACKAGE_NAME", this->Name.c_str()); + // Store the list of components. std::string components_var = this->Name + "_FIND_COMPONENTS"; this->AddFindDefinition(components_var.c_str(), components.c_str()); @@ -1016,6 +1019,9 @@ bool cmFindPackageCommand::HandlePackageMode() std::string foundVar = this->Name; foundVar += "_FOUND"; + std::string notFoundMessageVar = this->Name; + notFoundMessageVar += "_NOT_FOUND_MESSAGE"; + std::string notFoundMessage; // If the directory for the config file was found, try to read the file. bool result = true; @@ -1033,6 +1039,7 @@ bool cmFindPackageCommand::HandlePackageMode() // has set Foo_FOUND to FALSE itself: this->Makefile->RemoveDefinition(foundVar.c_str()); } + this->Makefile->RemoveDefinition(notFoundMessageVar.c_str()); // Set the version variables before loading the config file. // It may override them. @@ -1051,6 +1058,8 @@ bool cmFindPackageCommand::HandlePackageMode() // we get here if the Config file has set Foo_FOUND actively to FALSE found = false; configFileSetFOUNDFalse = true; + notFoundMessage = this->Makefile->GetSafeDefinition( + notFoundMessageVar.c_str()); } } else @@ -1071,6 +1080,10 @@ bool cmFindPackageCommand::HandlePackageMode() " " << this->FileFound << "\n" "but it set " << foundVar << " to FALSE so package \"" << this->Name << "\" is considered to be NOT FOUND."; + if (!notFoundMessage.empty()) + { + e << " Reason given by package: \n" << notFoundMessage << "\n"; + } } // If there are files in ConsideredConfigs, it means that FooConfig.cmake // have been found, but they didn't have appropriate versions. diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index 846d187cb..6a432984d 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -45,8 +45,10 @@ void cmFindPathCommand::GenerateDocumentation() "SEARCH_XXX", "file in a directory"); cmSystemTools::ReplaceString(this->GenericDocumentation, "XXX_SUBDIR", "include"); - cmSystemTools::ReplaceString(this->GenericDocumentation, - "XXX_EXTRA_PREFIX_ENTRY", ""); + cmSystemTools::ReplaceString( + this->GenericDocumentation, + "XXX_EXTRA_PREFIX_ENTRY", + " /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and\n"); cmSystemTools::ReplaceString(this->GenericDocumentation, "CMAKE_FIND_ROOT_PATH_MODE_XXX", "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE"); @@ -104,7 +106,7 @@ bool cmFindPathCommand (this->VariableName.c_str(), (this->VariableName + "-NOTFOUND").c_str(), this->VariableDocumentation.c_str(), - (this->IncludeFileInPath) ? + (this->IncludeFileInPath) ? cmCacheManager::FILEPATH :cmCacheManager::PATH); return true; } @@ -143,14 +145,14 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file, // remove the name from the slash; fileName = fileName.substr(pos+1); frameWorkName = file; - frameWorkName = + frameWorkName = frameWorkName.substr(0, frameWorkName.size()-fileName.size()-1); // if the framework has a path in it then just use the filename if(frameWorkName.find("/") != frameWorkName.npos) { fileName = file; frameWorkName = ""; - } + } if(frameWorkName.size()) { std::string fpath = dir; @@ -160,7 +162,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file, intPath += "/Headers/"; intPath += fileName; if(cmSystemTools::FileExists(intPath.c_str())) - { + { if(this->IncludeFileInPath) { return intPath; diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index a61299011..759567dc1 100644 --- a/Source/cmFindPathCommand.h +++ b/Source/cmFindPathCommand.h @@ -29,7 +29,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmFindPathCommand; } diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 00f5419c2..909b333ff 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -81,7 +81,7 @@ bool cmFindProgramCommand result.c_str(), this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); - + return true; } this->Makefile->AddCacheDefinition(this->VariableName.c_str(), @@ -117,21 +117,21 @@ std::string cmFindProgramCommand for(std::vector::const_iterator name = names.begin(); name != names.end() ; ++name) { - + std::string appName = *name + std::string(".app"); - std::string appPath = cmSystemTools::FindDirectory(appName.c_str(), - this->SearchPaths, + std::string appPath = cmSystemTools::FindDirectory(appName.c_str(), + this->SearchPaths, true); if ( !appPath.empty() ) { std::string executable = GetBundleExecutable(appPath); - if (!executable.empty()) + if (!executable.empty()) { return cmSystemTools::CollapseFullPath(executable.c_str()); } - } - } + } + } // Couldn't find app bundle return ""; @@ -142,44 +142,44 @@ std::string cmFindProgramCommand::GetBundleExecutable(std::string bundlePath) std::string executable = ""; (void)bundlePath; #if defined(__APPLE__) - // Started with an example on developer.apple.com about finding bundles + // Started with an example on developer.apple.com about finding bundles // and modified from that. - + // Get a CFString of the app bundle path // XXX - Is it safe to assume everything is in UTF8? - CFStringRef bundlePathCFS = - CFStringCreateWithCString(kCFAllocatorDefault , + CFStringRef bundlePathCFS = + CFStringCreateWithCString(kCFAllocatorDefault , bundlePath.c_str(), kCFStringEncodingUTF8 ); - + // Make a CFURLRef from the CFString representation of the // bundle’s path. - CFURLRef bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, + CFURLRef bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, bundlePathCFS, kCFURLPOSIXPathStyle, true ); - + // Make a bundle instance using the URLRef. CFBundleRef appBundle = CFBundleCreate( kCFAllocatorDefault, bundleURL ); - + // returned executableURL is relative to /Contents/MacOS/ CFURLRef executableURL = CFBundleCopyExecutableURL(appBundle); - + if (executableURL != NULL) { const int MAX_OSX_PATH_SIZE = 1024; char buffer[MAX_OSX_PATH_SIZE]; - + // Convert the CFString to a C string - CFStringGetCString( CFURLGetString(executableURL), buffer, + CFStringGetCString( CFURLGetString(executableURL), buffer, MAX_OSX_PATH_SIZE, kCFStringEncodingUTF8 ); - + // And finally to a c++ string executable = bundlePath + "/Contents/MacOS/" + std::string(buffer); // Only release CFURLRef if it's not null CFRelease( executableURL ); } - // Any CF objects returned from functions with "create" or + // Any CF objects returned from functions with "create" or // "copy" in their names must be released by us! CFRelease( bundlePathCFS ); CFRelease( bundleURL ); diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h index c1b14f912..8350c9b42 100644 --- a/Source/cmFindProgramCommand.h +++ b/Source/cmFindProgramCommand.h @@ -18,7 +18,7 @@ * \brief Define a command to search for an executable program. * * cmFindProgramCommand is used to define a CMake variable - * that specifies an executable program. The command searches + * that specifies an executable program. The command searches * in the current path (e.g., PATH environment variable) for * an executable that matches one of the supplied names. */ @@ -28,7 +28,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmFindProgramCommand; } @@ -57,7 +57,7 @@ public: { return "Find an executable program."; } - + cmTypeMacro(cmFindProgramCommand, cmFindBase); protected: diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index 74966c9c8..d69706730 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -25,7 +25,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, else if (!cmSystemTools::Strucmp(lff.Name.c_str(),"endforeach")) { // if this is the endofreach for this statement - if (!this->Depth) + if (!this->Depth) { // Remove the function blocker for this scope or bail. cmsys::auto_ptr @@ -45,7 +45,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, std::string tmps; cmListFileArgument arg; for( ; j != this->Args.end(); ++j) - { + { // set the variable to the loop value mf.AddDefinition(this->Args[0].c_str(),j->c_str()); // Invoke all the functions that were collected in the block. @@ -83,10 +83,10 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, this->Depth--; } } - + // record the command this->Functions.push_back(lff); - + // always return true return true; } @@ -121,7 +121,7 @@ bool cmForEachCommand { return this->HandleInMode(args); } - + // create a function blocker cmForEachFunctionBlocker *f = new cmForEachFunctionBlocker(); if ( args.size() > 1 ) @@ -157,7 +157,7 @@ bool cmForEachCommand step = 1; } } - if ( + if ( (start > stop && step > 0) || (start < stop && step < 0) || step == 0 @@ -198,7 +198,7 @@ bool cmForEachCommand f->Args = args; } this->Makefile->AddFunctionBlocker(f); - + return true; } diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h index ae50005be..dc4761306 100644 --- a/Source/cmForEachCommand.h +++ b/Source/cmForEachCommand.h @@ -25,7 +25,7 @@ public: cmMakefile &mf, cmExecutionStatus &); virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); - + std::vector Args; std::vector Functions; private: @@ -39,7 +39,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmForEachCommand; } @@ -68,7 +68,7 @@ public: { return "Evaluate a group of commands for each value in a list."; } - + /** * More documentation. */ @@ -106,7 +106,7 @@ public: "following it in the iteration." ; } - + cmTypeMacro(cmForEachCommand, cmCommand); private: bool HandleInMode(std::vector const& args); diff --git a/Source/cmFunctionBlocker.h b/Source/cmFunctionBlocker.h index 9ee0b5c2d..68bf76286 100644 --- a/Source/cmFunctionBlocker.h +++ b/Source/cmFunctionBlocker.h @@ -29,7 +29,7 @@ public: /** * should this function blocker be removed, useful when one function adds a - * blocker and another must remove it + * blocker and another must remove it */ virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile&) {return false;} diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index ce36145f4..10b47b9e0 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -65,7 +65,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const { return this->Args[0].c_str(); } - + /** * Succinct documentation. */ @@ -131,15 +131,15 @@ bool cmFunctionHelperCommand::InvokeInitialPass { cmOStringStream tmpStream; tmpStream << "ARGV" << t; - this->Makefile->AddDefinition(tmpStream.str().c_str(), + this->Makefile->AddDefinition(tmpStream.str().c_str(), expandedArgs[t].c_str()); this->Makefile->MarkVariableAsUsed(tmpStream.str().c_str()); } - + // define the formal arguments for (unsigned int j = 1; j < this->Args.size(); ++j) { - this->Makefile->AddDefinition(this->Args[j].c_str(), + this->Makefile->AddDefinition(this->Args[j].c_str(), expandedArgs[j-1].c_str()); } @@ -208,7 +208,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, else if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endfunction")) { // if this is the endfunction for this function then execute - if (!this->Depth) + if (!this->Depth) { std::string name = this->Args[0]; std::vector::size_type cc; @@ -224,20 +224,20 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, f->Args = this->Args; f->Functions = this->Functions; mf.RecordPolicies(f->Policies); - + // Set the FilePath on the arguments to match the function since it is // not stored and the original values may be freed for (unsigned int i = 0; i < f->Functions.size(); ++i) { for (unsigned int j = 0; j < f->Functions[i].Arguments.size(); ++j) { - f->Functions[i].Arguments[j].FilePath = + f->Functions[i].Arguments[j].FilePath = f->Functions[i].FilePath.c_str(); } } std::string newName = "_" + this->Args[0]; - mf.GetCMakeInstance()->RenameCommand(this->Args[0].c_str(), + mf.GetCMakeInstance()->RenameCommand(this->Args[0].c_str(), newName.c_str()); mf.AddCommand(f); @@ -265,7 +265,7 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf) if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endfunction")) { std::vector expandedArguments; - mf.ExpandArguments(lff.Arguments, expandedArguments); + mf.ExpandArguments(lff.Arguments, expandedArguments); // if the endfunction has arguments then make sure // they match the ones in the openeing function command if ((expandedArguments.empty() || @@ -291,7 +291,7 @@ bool cmFunctionCommand cmFunctionFunctionBlocker *f = new cmFunctionFunctionBlocker(); for(std::vector::const_iterator j = args.begin(); j != args.end(); ++j) - { + { f->Args.push_back(*j); } this->Makefile->AddFunctionBlocker(f); diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index 43c8e2983..0a029dc5f 100644 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -20,11 +20,11 @@ class cmFunctionFunctionBlocker : public cmFunctionBlocker public: cmFunctionFunctionBlocker() {this->Depth=0;} virtual ~cmFunctionFunctionBlocker() {} - virtual bool IsFunctionBlocked(const cmListFileFunction&, + virtual bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile &mf, cmExecutionStatus &); virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile &mf); - + std::vector Args; std::vector Functions; int Depth; @@ -90,7 +90,9 @@ public: "will have the actual values of the arguments passed in. This " "facilitates creating functions with optional arguments. Additionally " "ARGV holds the list of all arguments given to the function and ARGN " - "holds the list of argument past the last expected argument." + "holds the list of arguments past the last expected argument." + "\n" + "A function opens a new scope: see set(var PARENT_SCOPE) for details." "\n" "See the cmake_policy() command documentation for the behavior of " "policies inside functions." diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index 1a391ede9..0af07532a 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -31,7 +31,7 @@ cmGeneratedFileStream::cmGeneratedFileStream(const char* name, bool quiet): // Check if the file opened. if(!*this && !quiet) { - cmSystemTools::Error("Cannot open file for write: ", + cmSystemTools::Error("Cannot open file for write: ", this->TempName.c_str()); cmSystemTools::ReportLastSystemError(""); } @@ -58,7 +58,7 @@ cmGeneratedFileStream::Open(const char* name, bool quiet, bool binaryFlag) // Open the temporary output file. if ( binaryFlag ) { - this->Stream::open(this->TempName.c_str(), + this->Stream::open(this->TempName.c_str(), std::ios::out | std::ios::binary); } else @@ -69,7 +69,7 @@ cmGeneratedFileStream::Open(const char* name, bool quiet, bool binaryFlag) // Check if the file opened. if(!*this && !quiet) { - cmSystemTools::Error("Cannot open file for write: ", + cmSystemTools::Error("Cannot open file for write: ", this->TempName.c_str()); cmSystemTools::ReportLastSystemError(""); } diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index f88ab0b71..3f5912919 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -13,181 +13,387 @@ #include "cmMakefile.h" #include "cmTarget.h" +#include "assert.h" + +#include + +#include "cmGeneratorExpressionEvaluator.h" +#include "cmGeneratorExpressionLexer.h" +#include "cmGeneratorExpressionParser.h" +#include "cmGeneratorExpressionDAGChecker.h" //---------------------------------------------------------------------------- cmGeneratorExpression::cmGeneratorExpression( - cmMakefile* mf, const char* config, - cmListFileBacktrace const& backtrace, bool quiet): - Makefile(mf), Config(config), Backtrace(backtrace), Quiet(quiet) + cmListFileBacktrace const& backtrace): + Backtrace(backtrace) { - this->TargetInfo.compile("^\\$$"); } //---------------------------------------------------------------------------- -const char* cmGeneratorExpression::Process(std::string const& input) +cmsys::auto_ptr +cmGeneratorExpression::Parse(std::string const& input) { - return this->Process(input.c_str()); + return this->Parse(input.c_str()); } //---------------------------------------------------------------------------- -const char* cmGeneratorExpression::Process(const char* input) +cmsys::auto_ptr +cmGeneratorExpression::Parse(const char* input) +{ + return cmsys::auto_ptr( + new cmCompiledGeneratorExpression( + this->Backtrace, + input)); +} + +cmGeneratorExpression::~cmGeneratorExpression() { - this->Data.clear(); +} - // We construct and evaluate expressions directly in the output - // buffer. Each expression is replaced by its own output value - // after evaluation. A stack of barriers records the starting - // indices of open (pending) expressions. - for(const char* c = input; *c; ++c) +//---------------------------------------------------------------------------- +const char *cmCompiledGeneratorExpression::Evaluate( + cmMakefile* mf, const char* config, bool quiet, + cmTarget *headTarget, + cmGeneratorExpressionDAGChecker *dagChecker) const +{ + return this->Evaluate(mf, + config, + quiet, + headTarget, + headTarget, + dagChecker); +} + +//---------------------------------------------------------------------------- +const char *cmCompiledGeneratorExpression::Evaluate( + cmMakefile* mf, const char* config, bool quiet, + cmTarget *headTarget, + cmTarget *currentTarget, + cmGeneratorExpressionDAGChecker *dagChecker) const +{ + if (!this->NeedsParsing) + { + return this->Input.c_str(); + } + + this->Output = ""; + + std::vector::const_iterator it + = this->Evaluators.begin(); + const std::vector::const_iterator end + = this->Evaluators.end(); + + cmGeneratorExpressionContext context; + context.Makefile = mf; + context.Config = config; + context.Quiet = quiet; + context.HadError = false; + context.HadContextSensitiveCondition = false; + context.HeadTarget = headTarget; + context.CurrentTarget = currentTarget ? currentTarget : headTarget; + context.Backtrace = this->Backtrace; + + for ( ; it != end; ++it) { - if(c[0] == '$' && c[1] == '<') + this->Output += (*it)->Evaluate(&context, dagChecker); + + for(std::set::const_iterator + p = context.SeenTargetProperties.begin(); + p != context.SeenTargetProperties.end(); ++p) { - this->Barriers.push(this->Data.size()); - this->Data.push_back('$'); - this->Data.push_back('<'); - c += 1; + this->SeenTargetProperties.insert(*p); } - else if(c[0] == '>' && !this->Barriers.empty()) + if (context.HadError) { - this->Data.push_back('>'); - if(!this->Evaluate()) { break; } - this->Barriers.pop(); - } - else - { - this->Data.push_back(c[0]); + this->Output = ""; + break; } } + if (!context.HadError) + { + this->HadContextSensitiveCondition = context.HadContextSensitiveCondition; + } - // Return a null-terminated output value. - this->Data.push_back('\0'); - return &*this->Data.begin(); + this->DependTargets = context.DependTargets; + this->AllTargetsSeen = context.AllTargets; + // TODO: Return a std::string from here instead? + return this->Output.c_str(); } -//---------------------------------------------------------------------------- -bool cmGeneratorExpression::Evaluate() +cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( + cmListFileBacktrace const& backtrace, + const char *input) + : Backtrace(backtrace), Input(input ? input : ""), + HadContextSensitiveCondition(false) { - // The top-most barrier points at the beginning of the expression. - size_t barrier = this->Barriers.top(); - - // Construct a null-terminated representation of the expression. - this->Data.push_back('\0'); - const char* expr = &*(this->Data.begin()+barrier); + cmGeneratorExpressionLexer l; + std::vector tokens = + l.Tokenize(this->Input.c_str()); + this->NeedsParsing = l.GetSawGeneratorExpression(); - // Evaluate the expression. - std::string result; - if(this->Evaluate(expr, result)) + if (this->NeedsParsing) { - // Success. Replace the expression with its evaluation result. - this->Data.erase(this->Data.begin()+barrier, this->Data.end()); - this->Data.insert(this->Data.end(), result.begin(), result.end()); - return true; + cmGeneratorExpressionParser p(tokens); + p.Parse(this->Evaluators); } - else if(!this->Quiet) +} + + +//---------------------------------------------------------------------------- +cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression() +{ + std::vector::const_iterator it + = this->Evaluators.begin(); + const std::vector::const_iterator end + = this->Evaluators.end(); + + for ( ; it != end; ++it) { - // Failure. Report the error message. - cmOStringStream e; - e << "Error evaluating generator expression:\n" - << " " << expr << "\n" - << result; - this->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), - this->Backtrace); - return false; + delete *it; } - return true; } //---------------------------------------------------------------------------- -bool cmGeneratorExpression::Evaluate(const char* expr, std::string& result) +std::string cmGeneratorExpression::StripEmptyListElements( + const std::string &input) { - if(this->TargetInfo.find(expr)) + std::string result; + + const char *c = input.c_str(); + bool skipSemiColons = true; + for ( ; *c; ++c) { - if(!this->EvaluateTargetInfo(result)) + if(c[0] == ';') { - return false; + if(skipSemiColons) + { + continue; + } + skipSemiColons = true; } + else + { + skipSemiColons = false; + } + result += *c; } - else if(strcmp(expr, "$") == 0) - { - result = this->Config? this->Config : ""; - } - else + + if (!result.empty() && *(result.end() - 1) == ';') { - result = "Expression syntax not recognized."; - return false; + result.resize(result.size() - 1); } - return true; + + return result; } //---------------------------------------------------------------------------- -bool cmGeneratorExpression::EvaluateTargetInfo(std::string& result) +static std::string stripAllGeneratorExpressions(const std::string &input) { - // Lookup the referenced target. - std::string name = this->TargetInfo.match(3); - cmTarget* target = this->Makefile->FindTargetToUse(name.c_str()); - if(!target) - { - result = "No target \"" + name + "\""; - return false; - } - if(target->GetType() >= cmTarget::UTILITY && - target->GetType() != cmTarget::UNKNOWN_LIBRARY) + std::string result; + std::string::size_type pos = 0; + std::string::size_type lastPos = pos; + while((pos = input.find("$<", lastPos)) != input.npos) { - result = "Target \"" + name + "\" is not an executable or library."; - return false; + result += input.substr(lastPos, pos - lastPos); + pos += 2; + int nestingLevel = 1; + const char *c = input.c_str() + pos; + const char * const cStart = c; + for ( ; *c; ++c) + { + if(c[0] == '$' && c[1] == '<') + { + ++nestingLevel; + ++c; + continue; + } + if(c[0] == '>') + { + --nestingLevel; + if (nestingLevel == 0) + { + break; + } + } + } + const std::string::size_type traversed = (c - cStart) + 1; + if (!*c) + { + result += "$<" + input.substr(pos, traversed); + } + pos += traversed; + lastPos = pos; } - this->Targets.insert(target); + result += input.substr(lastPos); + return cmGeneratorExpression::StripEmptyListElements(result); +} - // Lookup the target file with the given purpose. - std::string purpose = this->TargetInfo.match(1); - if(purpose == "") - { - // The target implementation file (.so.1.2, .dll, .exe, .a). - result = target->GetFullPath(this->Config, false, true); - } - else if(purpose == "_LINKER") +//---------------------------------------------------------------------------- +static std::string stripExportInterface(const std::string &input, + cmGeneratorExpression::PreprocessContext context) +{ + std::string result; + + std::string::size_type pos = 0; + std::string::size_type lastPos = pos; + while((pos = input.find("$IsLinkable()) + result += input.substr(lastPos, pos - lastPos); + const bool gotInstallInterface = input[pos + 2] == 'I'; + pos += gotInstallInterface ? sizeof("$') + { + --nestingLevel; + if (nestingLevel != 0) + { + continue; + } + if(context == cmGeneratorExpression::BuildInterface + && !gotInstallInterface) + { + result += input.substr(pos, c - cStart); + } + else if(context == cmGeneratorExpression::InstallInterface + && gotInstallInterface) + { + result += input.substr(pos, c - cStart); + } + break; + } + } + const std::string::size_type traversed = (c - cStart) + 1; + if (!*c) { - result = ("TARGET_LINKER_FILE is allowed only for libraries and " - "executables with ENABLE_EXPORTS."); - return false; + result += std::string(gotInstallInterface ? "$GetFullPath(this->Config, target->HasImportLibrary()); + pos += traversed; + lastPos = pos; } - else if(purpose == "_SONAME") + result += input.substr(lastPos); + + return cmGeneratorExpression::StripEmptyListElements(result); +} + +//---------------------------------------------------------------------------- +void cmGeneratorExpression::Split(const std::string &input, + std::vector &output) +{ + std::string::size_type pos = 0; + std::string::size_type lastPos = pos; + while((pos = input.find("$<", lastPos)) != input.npos) { - // The target soname file (.so.1). - if(target->IsDLLPlatform()) + std::string part = input.substr(lastPos, pos - lastPos); + std::string preGenex; + if (!part.empty()) + { + std::string::size_type startPos = input.rfind(";", pos); + if (startPos == std::string::npos) + { + preGenex = part; + part = ""; + } + else if (startPos != pos - 1 && startPos >= lastPos) + { + part = input.substr(lastPos, startPos - lastPos); + preGenex = input.substr(startPos + 1, pos - startPos - 1); + } + if(!part.empty()) + { + cmSystemTools::ExpandListArgument(part.c_str(), output); + } + } + pos += 2; + int nestingLevel = 1; + const char *c = input.c_str() + pos; + const char * const cStart = c; + for ( ; *c; ++c) { - result = "TARGET_SONAME_FILE is not allowed for DLL target platforms."; - return false; + if(c[0] == '$' && c[1] == '<') + { + ++nestingLevel; + ++c; + continue; + } + if(c[0] == '>') + { + --nestingLevel; + if (nestingLevel == 0) + { + break; + } + } } - if(target->GetType() != cmTarget::SHARED_LIBRARY) + for ( ; *c; ++c) { - result = "TARGET_SONAME_FILE is allowed only for SHARED libraries."; - return false; + // Capture the part after the genex and before the next ';' + if(c[0] == ';') + { + --c; + break; + } } - result = target->GetDirectory(this->Config); - result += "/"; - result += target->GetSOName(this->Config); + const std::string::size_type traversed = (c - cStart) + 1; + output.push_back(preGenex + "$<" + input.substr(pos, traversed)); + pos += traversed; + lastPos = pos; + } + if (lastPos < input.size()) + { + cmSystemTools::ExpandListArgument(input.substr(lastPos), output); } +} - // Extract the requested portion of the full path. - std::string part = this->TargetInfo.match(2); - if(part == "_NAME") +//---------------------------------------------------------------------------- +std::string cmGeneratorExpression::Preprocess(const std::string &input, + PreprocessContext context) +{ + if (context == StripAllGeneratorExpressions) + { + return stripAllGeneratorExpressions(input); + } + else if (context == BuildInterface || context == InstallInterface) { - result = cmSystemTools::GetFilenameName(result); + return stripExportInterface(input, context); } - else if(part == "_DIR") + + assert(!"cmGeneratorExpression::Preprocess called with invalid args"); + return std::string(); +} + +//---------------------------------------------------------------------------- +std::string::size_type cmGeneratorExpression::Find(const std::string &input) +{ + const std::string::size_type openpos = input.find("$<"); + if (openpos != std::string::npos + && input.find(">", openpos) != std::string::npos) { - result = cmSystemTools::GetFilenamePath(result); + return openpos; } - return true; + return std::string::npos; +} + +//---------------------------------------------------------------------------- +bool cmGeneratorExpression::IsValidTargetName(const std::string &input) +{ + cmsys::RegularExpression targetNameValidator; + // The ':' is supported to allow use with IMPORTED targets. At least + // Qt 4 and 5 IMPORTED targets use ':' as the namespace delimiter. + targetNameValidator.compile("^[A-Za-z0-9_.:+-]+$"); + + return targetNameValidator.find(input.c_str()); } diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 1a9d4c6e9..86b6f25df 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -9,16 +9,27 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ + +#ifndef cmGeneratorExpression_h +#define cmGeneratorExpression_h + #include "cmStandardIncludes.h" +#include "cmListFileCache.h" #include #include +#include class cmTarget; class cmMakefile; class cmListFileBacktrace; +struct cmGeneratorExpressionEvaluator; +struct cmGeneratorExpressionDAGChecker; + +class cmCompiledGeneratorExpression; + /** \class cmGeneratorExpression * \brief Evaluate generate-time query expression syntax. * @@ -31,28 +42,96 @@ class cmListFileBacktrace; class cmGeneratorExpression { public: - /** Construct with an evaluation context and configuration. */ - cmGeneratorExpression(cmMakefile* mf, const char* config, - cmListFileBacktrace const& backtrace, - bool quiet = false); + /** Construct. */ + cmGeneratorExpression(cmListFileBacktrace const& backtrace); + ~cmGeneratorExpression(); + + cmsys::auto_ptr Parse( + std::string const& input); + cmsys::auto_ptr Parse(const char* input); + + enum PreprocessContext { + StripAllGeneratorExpressions, + BuildInterface, + InstallInterface + }; + + static std::string Preprocess(const std::string &input, + PreprocessContext context); + + static void Split(const std::string &input, + std::vector &output); - /** Evaluate generator expressions in a string. */ - const char* Process(std::string const& input); - const char* Process(const char* input); + static std::string::size_type Find(const std::string &input); + + static bool IsValidTargetName(const std::string &input); + + static std::string StripEmptyListElements(const std::string &input); +private: + cmGeneratorExpression(const cmGeneratorExpression &); + void operator=(const cmGeneratorExpression &); + + cmListFileBacktrace const& Backtrace; +}; + +class cmCompiledGeneratorExpression +{ +public: + const char* Evaluate(cmMakefile* mf, const char* config, + bool quiet = false, + cmTarget *headTarget = 0, + cmTarget *currentTarget = 0, + cmGeneratorExpressionDAGChecker *dagChecker = 0) const; + const char* Evaluate(cmMakefile* mf, const char* config, + bool quiet, + cmTarget *headTarget, + cmGeneratorExpressionDAGChecker *dagChecker) const; /** Get set of targets found during evaluations. */ std::set const& GetTargets() const - { return this->Targets; } + { return this->DependTargets; } + + std::set const& GetSeenTargetProperties() const + { return this->SeenTargetProperties; } + + std::set const& GetAllTargetsSeen() const + { return this->AllTargetsSeen; } + + ~cmCompiledGeneratorExpression(); + + std::string GetInput() const + { + return this->Input; + } + + cmListFileBacktrace GetBacktrace() const + { + return this->Backtrace; + } + bool GetHadContextSensitiveCondition() const + { + return this->HadContextSensitiveCondition; + } + private: - cmMakefile* Makefile; - const char* Config; - cmListFileBacktrace const& Backtrace; - bool Quiet; - std::vector Data; - std::stack Barriers; - cmsys::RegularExpression TargetInfo; - std::set Targets; - bool Evaluate(); - bool Evaluate(const char* expr, std::string& result); - bool EvaluateTargetInfo(std::string& result); + cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, + const char *input); + + friend class cmGeneratorExpression; + + cmCompiledGeneratorExpression(const cmCompiledGeneratorExpression &); + void operator=(const cmCompiledGeneratorExpression &); + + cmListFileBacktrace Backtrace; + std::vector Evaluators; + const std::string Input; + bool NeedsParsing; + + mutable std::set DependTargets; + mutable std::set AllTargetsSeen; + mutable std::set SeenTargetProperties; + mutable std::string Output; + mutable bool HadContextSensitiveCondition; }; + +#endif diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx new file mode 100644 index 000000000..5cb50b9b8 --- /dev/null +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -0,0 +1,170 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmGeneratorExpressionDAGChecker.h" + +#include "cmMakefile.h" + +//---------------------------------------------------------------------------- +cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( + const cmListFileBacktrace &backtrace, + const std::string &target, + const std::string &property, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *parent) + : Parent(parent), Target(target), Property(property), + Content(content), Backtrace(backtrace) +{ + const cmGeneratorExpressionDAGChecker *top = this; + const cmGeneratorExpressionDAGChecker *p = this->Parent; + while (p) + { + top = p; + p = p->Parent; + } + this->CheckResult = this->checkGraph(); + + if (CheckResult == DAG && (top->EvaluatingIncludeDirectories() + || top->EvaluatingCompileDefinitions())) + { + std::map >::const_iterator it + = top->Seen.find(target); + if (it != top->Seen.end()) + { + const std::set &propSet = it->second; + const std::set::const_iterator i = propSet.find(property); + if (i != propSet.end()) + { + this->CheckResult = ALREADY_SEEN; + return; + } + } + const_cast(top) + ->Seen[target].insert(property); + } +} + +//---------------------------------------------------------------------------- +cmGeneratorExpressionDAGChecker::Result +cmGeneratorExpressionDAGChecker::check() const +{ + return this->CheckResult; +} + +//---------------------------------------------------------------------------- +void cmGeneratorExpressionDAGChecker::reportError( + cmGeneratorExpressionContext *context, + const std::string &expr) +{ + if (this->CheckResult == DAG) + { + return; + } + + context->HadError = true; + if (context->Quiet) + { + return; + } + + const cmGeneratorExpressionDAGChecker *parent = this->Parent; + + if (parent && !parent->Parent) + { + cmOStringStream e; + e << "Error evaluating generator expression:\n" + << " " << expr << "\n" + << "Self reference on target \"" + << context->HeadTarget->GetName() << "\".\n"; + context->Makefile->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), + parent->Backtrace); + return; + } + + { + cmOStringStream e; + e << "Error evaluating generator expression:\n" + << " " << expr << "\n" + << "Dependency loop found."; + context->Makefile->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), + context->Backtrace); + } + + int loopStep = 1; + while (parent) + { + cmOStringStream e; + e << "Loop step " << loopStep << "\n" + << " " + << (parent->Content ? parent->Content->GetOriginalExpression() : expr) + << "\n"; + context->Makefile->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), + parent->Backtrace); + parent = parent->Parent; + ++loopStep; + } +} + +//---------------------------------------------------------------------------- +cmGeneratorExpressionDAGChecker::Result +cmGeneratorExpressionDAGChecker::checkGraph() const +{ + const cmGeneratorExpressionDAGChecker *parent = this->Parent; + while (parent) + { + if (this->Target == parent->Target && this->Property == parent->Property) + { + return (parent == this->Parent) ? SELF_REFERENCE : CYCLIC_REFERENCE; + } + parent = parent->Parent; + } + return DAG; +} + +//---------------------------------------------------------------------------- +bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries() +{ + const cmGeneratorExpressionDAGChecker *top = this; + const cmGeneratorExpressionDAGChecker *parent = this->Parent; + while (parent) + { + top = parent; + parent = parent->Parent; + } + + const char *prop = top->Property.c_str(); + return (strcmp(prop, "LINK_LIBRARIES") == 0 + || strcmp(prop, "LINK_INTERFACE_LIBRARIES") == 0 + || strcmp(prop, "IMPORTED_LINK_INTERFACE_LIBRARIES") == 0 + || strncmp(prop, "LINK_INTERFACE_LIBRARIES_", 25) == 0 + || strncmp(prop, "IMPORTED_LINK_INTERFACE_LIBRARIES_", 34) == 0); +} + +//---------------------------------------------------------------------------- +bool cmGeneratorExpressionDAGChecker::EvaluatingIncludeDirectories() const +{ + const char *prop = this->Property.c_str(); + return (strcmp(prop, "INCLUDE_DIRECTORIES") == 0 + || strcmp(prop, "INTERFACE_INCLUDE_DIRECTORIES") == 0 ); +} + +//---------------------------------------------------------------------------- +bool cmGeneratorExpressionDAGChecker::EvaluatingCompileDefinitions() const +{ + const char *prop = this->Property.c_str(); + return (strcmp(prop, "COMPILE_DEFINITIONS") == 0 + || strcmp(prop, "INTERFACE_COMPILE_DEFINITIONS") == 0 + || strncmp(prop, "COMPILE_DEFINITIONS_", 20) == 0); +} diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h new file mode 100644 index 000000000..62a5cdf38 --- /dev/null +++ b/Source/cmGeneratorExpressionDAGChecker.h @@ -0,0 +1,57 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGeneratorExpressionDAGChecker_h +#define cmGeneratorExpressionDAGChecker_h + +#include "cmStandardIncludes.h" + +#include "cmGeneratorExpressionEvaluator.h" + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionDAGChecker +{ + cmGeneratorExpressionDAGChecker(const cmListFileBacktrace &backtrace, + const std::string &target, + const std::string &property, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *parent); + + enum Result { + DAG, + SELF_REFERENCE, + CYCLIC_REFERENCE, + ALREADY_SEEN + }; + + Result check() const; + + void reportError(cmGeneratorExpressionContext *context, + const std::string &expr); + + bool EvaluatingLinkLibraries(); + bool EvaluatingIncludeDirectories() const; + bool EvaluatingCompileDefinitions() const; + +private: + Result checkGraph() const; + +private: + const cmGeneratorExpressionDAGChecker * const Parent; + const std::string Target; + const std::string Property; + std::map > Seen; + const GeneratorExpressionContent * const Content; + const cmListFileBacktrace Backtrace; + Result CheckResult; +}; + +#endif diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx new file mode 100644 index 000000000..6618e83e2 --- /dev/null +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -0,0 +1,1195 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmMakefile.h" + +#include "cmGeneratorExpressionEvaluator.h" +#include "cmGeneratorExpressionParser.h" +#include "cmGeneratorExpressionDAGChecker.h" +#include "cmGeneratorExpression.h" + +#include + +#include + +//---------------------------------------------------------------------------- +#if !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x510 +static +#endif +void reportError(cmGeneratorExpressionContext *context, + const std::string &expr, const std::string &result) +{ + context->HadError = true; + if (context->Quiet) + { + return; + } + + cmOStringStream e; + e << "Error evaluating generator expression:\n" + << " " << expr << "\n" + << result; + context->Makefile->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), + context->Backtrace); +} + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionNode +{ + virtual ~cmGeneratorExpressionNode() {} + + virtual bool GeneratesContent() const { return true; } + + virtual bool RequiresLiteralInput() const { return false; } + + virtual bool AcceptsSingleArbitraryContentParameter() const + { return false; } + + virtual int NumExpectedParameters() const { return 1; } + + virtual std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker + ) const = 0; +}; + +//---------------------------------------------------------------------------- +static const struct ZeroNode : public cmGeneratorExpressionNode +{ + ZeroNode() {} + + virtual bool GeneratesContent() const { return false; } + + virtual bool AcceptsSingleArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + // Unreachable + return std::string(); + } +} zeroNode; + +//---------------------------------------------------------------------------- +static const struct OneNode : public cmGeneratorExpressionNode +{ + OneNode() {} + + virtual bool AcceptsSingleArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + // Unreachable + return std::string(); + } +} oneNode; + +//---------------------------------------------------------------------------- +static const struct OneNode buildInterfaceNode; + +//---------------------------------------------------------------------------- +static const struct ZeroNode installInterfaceNode; + +//---------------------------------------------------------------------------- +#define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \ +static const struct OP ## Node : public cmGeneratorExpressionNode \ +{ \ + OP ## Node () {} \ +/* We let -1 carry the meaning 'at least one' */ \ + virtual int NumExpectedParameters() const { return -1; } \ + \ + std::string Evaluate(const std::vector ¶meters, \ + cmGeneratorExpressionContext *context, \ + const GeneratorExpressionContent *content, \ + cmGeneratorExpressionDAGChecker *) const \ + { \ + std::vector::const_iterator it = parameters.begin(); \ + const std::vector::const_iterator end = parameters.end(); \ + for ( ; it != end; ++it) \ + { \ + if (*it == #FAILURE_VALUE) \ + { \ + return #FAILURE_VALUE; \ + } \ + else if (*it != #SUCCESS_VALUE) \ + { \ + reportError(context, content->GetOriginalExpression(), \ + "Parameters to $<" #OP "> must resolve to either '0' or '1'."); \ + return std::string(); \ + } \ + } \ + return #SUCCESS_VALUE; \ + } \ +} OPNAME; + +BOOLEAN_OP_NODE(andNode, AND, 1, 0) +BOOLEAN_OP_NODE(orNode, OR, 0, 1) + +#undef BOOLEAN_OP_NODE + +//---------------------------------------------------------------------------- +static const struct NotNode : public cmGeneratorExpressionNode +{ + NotNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + if (*parameters.begin() != "0" && *parameters.begin() != "1") + { + reportError(context, content->GetOriginalExpression(), + "$ parameter must resolve to exactly one '0' or '1' value."); + return std::string(); + } + return *parameters.begin() == "0" ? "1" : "0"; + } +} notNode; + +//---------------------------------------------------------------------------- +static const struct BoolNode : public cmGeneratorExpressionNode +{ + BoolNode() {} + + virtual int NumExpectedParameters() const { return 1; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return !cmSystemTools::IsOff(parameters.begin()->c_str()) ? "1" : "0"; + } +} boolNode; + +//---------------------------------------------------------------------------- +static const struct StrEqualNode : public cmGeneratorExpressionNode +{ + StrEqualNode() {} + + virtual int NumExpectedParameters() const { return 2; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return *parameters.begin() == parameters[1] ? "1" : "0"; + } +} strEqualNode; + +//---------------------------------------------------------------------------- +static const struct Angle_RNode : public cmGeneratorExpressionNode +{ + Angle_RNode() {} + + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return ">"; + } +} angle_rNode; + +//---------------------------------------------------------------------------- +static const struct CommaNode : public cmGeneratorExpressionNode +{ + CommaNode() {} + + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return ","; + } +} commaNode; + +//---------------------------------------------------------------------------- +static const struct SemicolonNode : public cmGeneratorExpressionNode +{ + SemicolonNode() {} + + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return ";"; + } +} semicolonNode; + +//---------------------------------------------------------------------------- +static const struct ConfigurationNode : public cmGeneratorExpressionNode +{ + ConfigurationNode() {} + + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + context->HadContextSensitiveCondition = true; + return context->Config ? context->Config : ""; + } +} configurationNode; + +//---------------------------------------------------------------------------- +static const struct ConfigurationTestNode : public cmGeneratorExpressionNode +{ + ConfigurationTestNode() {} + + virtual int NumExpectedParameters() const { return 1; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + cmsys::RegularExpression configValidator; + configValidator.compile("^[A-Za-z0-9_]*$"); + if (!configValidator.find(parameters.begin()->c_str())) + { + reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + context->HadContextSensitiveCondition = true; + if (!context->Config) + { + return parameters.front().empty() ? "1" : "0"; + } + + if (cmsysString_strcasecmp(parameters.begin()->c_str(), + context->Config) == 0) + { + return "1"; + } + + if (context->CurrentTarget + && context->CurrentTarget->IsImported()) + { + const char* loc = 0; + const char* imp = 0; + std::string suffix; + return context->CurrentTarget->GetMappedConfig(context->Config, + &loc, + &imp, + suffix) ? "1" : "0"; + } + return "0"; + } +} configurationTestNode; + + +//---------------------------------------------------------------------------- +static const char* targetPropertyTransitiveWhitelist[] = { + "INTERFACE_INCLUDE_DIRECTORIES" + , "INTERFACE_COMPILE_DEFINITIONS" +}; + +//---------------------------------------------------------------------------- +static const struct TargetPropertyNode : public cmGeneratorExpressionNode +{ + TargetPropertyNode() {} + + // This node handles errors on parameter count itself. + virtual int NumExpectedParameters() const { return -1; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagCheckerParent + ) const + { + if (parameters.size() != 1 && parameters.size() != 2) + { + reportError(context, content->GetOriginalExpression(), + "$ expression requires one or two parameters"); + return std::string(); + } + cmsys::RegularExpression propertyNameValidator; + propertyNameValidator.compile("^[A-Za-z0-9_]+$"); + + cmTarget* target = context->HeadTarget; + std::string propertyName = *parameters.begin(); + + if (!target && parameters.size() == 1) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with targets. It may not " + "be used with add_custom_command. Specify the target to read a " + "property from using the $ signature " + "instead."); + return std::string(); + } + + if (parameters.size() == 2) + { + if (parameters.begin()->empty() && parameters[1].empty()) + { + reportError(context, content->GetOriginalExpression(), + "$ expression requires a non-empty " + "target name and property name."); + return std::string(); + } + if (parameters.begin()->empty()) + { + reportError(context, content->GetOriginalExpression(), + "$ expression requires a non-empty " + "target name."); + return std::string(); + } + + std::string targetName = parameters.front(); + propertyName = parameters[1]; + if (!cmGeneratorExpression::IsValidTargetName(targetName)) + { + if (!propertyNameValidator.find(propertyName.c_str())) + { + ::reportError(context, content->GetOriginalExpression(), + "Target name and property name not supported."); + return std::string(); + } + ::reportError(context, content->GetOriginalExpression(), + "Target name not supported."); + return std::string(); + } + target = context->Makefile->FindTargetToUse( + targetName.c_str()); + + if (!target) + { + cmOStringStream e; + e << "Target \"" + << targetName + << "\" not found."; + reportError(context, content->GetOriginalExpression(), e.str()); + return std::string(); + } + context->AllTargets.insert(target); + } + + if (target == context->HeadTarget) + { + // Keep track of the properties seen while processing. + // The evaluation of the LINK_LIBRARIES generator expressions + // will check this to ensure that properties have one consistent + // value for all evaluations. + context->SeenTargetProperties.insert(propertyName); + } + + if (propertyName.empty()) + { + reportError(context, content->GetOriginalExpression(), + "$ expression requires a non-empty property " + "name."); + return std::string(); + } + + if (!propertyNameValidator.find(propertyName.c_str())) + { + ::reportError(context, content->GetOriginalExpression(), + "Property name not supported."); + return std::string(); + } + + assert(target); + + cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, + target->GetName(), + propertyName, + content, + dagCheckerParent); + + switch (dagChecker.check()) + { + case cmGeneratorExpressionDAGChecker::SELF_REFERENCE: + dagChecker.reportError(context, content->GetOriginalExpression()); + return std::string(); + case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: + // No error. We just skip cyclic references. + return std::string(); + case cmGeneratorExpressionDAGChecker::ALREADY_SEEN: + for (size_t i = 0; + i < (sizeof(targetPropertyTransitiveWhitelist) / + sizeof(*targetPropertyTransitiveWhitelist)); + ++i) + { + if (targetPropertyTransitiveWhitelist[i] == propertyName) + { + // No error. We're not going to find anything new here. + return std::string(); + } + } + case cmGeneratorExpressionDAGChecker::DAG: + break; + } + + const char *prop = target->GetProperty(propertyName.c_str()); + + if (dagCheckerParent) + { + if (dagCheckerParent->EvaluatingLinkLibraries()) + { + if(!prop) + { + return std::string(); + } + } + else + { + assert(dagCheckerParent->EvaluatingIncludeDirectories() + || dagCheckerParent->EvaluatingCompileDefinitions()); + } + } + + std::string linkedTargetsContent; + + std::string interfacePropertyName; + + if (propertyName == "INTERFACE_INCLUDE_DIRECTORIES" + || propertyName == "INCLUDE_DIRECTORIES") + { + interfacePropertyName = "INTERFACE_INCLUDE_DIRECTORIES"; + } + else if (propertyName == "INTERFACE_COMPILE_DEFINITIONS" + || propertyName == "COMPILE_DEFINITIONS" + || strncmp(propertyName.c_str(), "COMPILE_DEFINITIONS_", 20) == 0) + { + interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS"; + } + + if (interfacePropertyName == "INTERFACE_INCLUDE_DIRECTORIES" + || interfacePropertyName == "INTERFACE_COMPILE_DEFINITIONS") + { + const cmTarget::LinkInterface *iface = target->GetLinkInterface( + context->Config, + context->HeadTarget); + if(iface) + { + cmGeneratorExpression ge(context->Backtrace); + + std::string sep; + std::string depString; + for (std::vector::const_iterator + it = iface->Libraries.begin(); + it != iface->Libraries.end(); ++it) + { + if (*it == target->GetName()) + { + // Broken code can have a target in its own link interface. + // Don't follow such link interface entries so as not to create a + // self-referencing loop. + continue; + } + if (context->Makefile->FindTargetToUse(it->c_str())) + { + depString += + sep + "$"; + sep = ";"; + } + } + cmsys::auto_ptr cge = + ge.Parse(depString); + linkedTargetsContent = cge->Evaluate(context->Makefile, + context->Config, + context->Quiet, + context->HeadTarget, + target, + &dagChecker); + if (cge->GetHadContextSensitiveCondition()) + { + context->HadContextSensitiveCondition = true; + } + } + } + + linkedTargetsContent = + cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); + + if (!prop) + { + if (target->IsImported()) + { + return linkedTargetsContent; + } + if (target->IsLinkInterfaceDependentBoolProperty(propertyName, + context->Config)) + { + context->HadContextSensitiveCondition = true; + return target->GetLinkInterfaceDependentBoolProperty( + propertyName, + context->Config) ? "1" : "0"; + } + if (target->IsLinkInterfaceDependentStringProperty(propertyName, + context->Config)) + { + context->HadContextSensitiveCondition = true; + const char *propContent = + target->GetLinkInterfaceDependentStringProperty( + propertyName, + context->Config); + return propContent ? propContent : ""; + } + + return linkedTargetsContent; + } + + for (size_t i = 0; + i < (sizeof(targetPropertyTransitiveWhitelist) / + sizeof(*targetPropertyTransitiveWhitelist)); + ++i) + { + if (targetPropertyTransitiveWhitelist[i] == interfacePropertyName) + { + cmGeneratorExpression ge(context->Backtrace); + cmsys::auto_ptr cge = ge.Parse(prop); + std::string result = cge->Evaluate(context->Makefile, + context->Config, + context->Quiet, + context->HeadTarget, + target, + &dagChecker); + + if (cge->GetHadContextSensitiveCondition()) + { + context->HadContextSensitiveCondition = true; + } + if (!linkedTargetsContent.empty()) + { + result += (result.empty() ? "" : ";") + linkedTargetsContent; + } + return result; + } + } + return prop; + } +} targetPropertyNode; + +//---------------------------------------------------------------------------- +static const struct TargetNameNode : public cmGeneratorExpressionNode +{ + TargetNameNode() {} + + virtual bool GeneratesContent() const { return true; } + + virtual bool AcceptsSingleArbitraryContentParameter() const { return true; } + virtual bool RequiresLiteralInput() const { return true; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return parameters.front(); + } + + virtual int NumExpectedParameters() const { return 1; } + +} targetNameNode; + +//---------------------------------------------------------------------------- +static const char* targetPolicyWhitelist[] = { + "CMP0003" + , "CMP0004" + , "CMP0008" + , "CMP0020" +}; + +cmPolicies::PolicyStatus statusForTarget(cmTarget *tgt, const char *policy) +{ +#define RETURN_POLICY(POLICY) \ + if (strcmp(policy, #POLICY) == 0) \ + { \ + return tgt->GetPolicyStatus ## POLICY (); \ + } \ + + RETURN_POLICY(CMP0003) + RETURN_POLICY(CMP0004) + RETURN_POLICY(CMP0008) + RETURN_POLICY(CMP0020) + +#undef RETURN_POLICY + + assert("!Unreachable code. Not a valid policy"); + return cmPolicies::WARN; +} + +cmPolicies::PolicyID policyForString(const char *policy_id) +{ +#define RETURN_POLICY_ID(POLICY_ID) \ + if (strcmp(policy_id, #POLICY_ID) == 0) \ + { \ + return cmPolicies:: POLICY_ID; \ + } \ + + RETURN_POLICY_ID(CMP0003) + RETURN_POLICY_ID(CMP0004) + RETURN_POLICY_ID(CMP0008) + RETURN_POLICY_ID(CMP0020) + +#undef RETURN_POLICY_ID + + assert("!Unreachable code. Not a valid policy"); + return cmPolicies::CMP0002; +} + +//---------------------------------------------------------------------------- +static const struct TargetPolicyNode : public cmGeneratorExpressionNode +{ + TargetPolicyNode() {} + + virtual int NumExpectedParameters() const { return 1; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context , + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + if (!context->HeadTarget) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with targets. It may not " + "be used with add_custom_command."); + return std::string(); + } + + context->HadContextSensitiveCondition = true; + + for (size_t i = 0; + i < (sizeof(targetPolicyWhitelist) / + sizeof(*targetPolicyWhitelist)); + ++i) + { + const char *policy = targetPolicyWhitelist[i]; + if (parameters.front() == policy) + { + cmMakefile *mf = context->HeadTarget->GetMakefile(); + switch(statusForTarget(context->HeadTarget, policy)) + { + case cmPolicies::WARN: + mf->IssueMessage(cmake::AUTHOR_WARNING, + mf->GetPolicies()-> + GetPolicyWarning(policyForString(policy))); + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::OLD: + return "0"; + case cmPolicies::NEW: + return "1"; + } + } + } + reportError(context, content->GetOriginalExpression(), + "$ may only be used with a limited number of " + "policies. Currently it may be used with policies CMP0003, CMP0004, " + "CMP0008 and CMP0020." + ); + return std::string(); + } + +} targetPolicyNode; + +//---------------------------------------------------------------------------- +static const struct InstallPrefixNode : public cmGeneratorExpressionNode +{ + InstallPrefixNode() {} + + virtual bool GeneratesContent() const { return true; } + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + reportError(context, content->GetOriginalExpression(), + "INSTALL_PREFIX is a marker for install(EXPORT) only. It " + "should never be evaluated."); + return std::string(); + } + +} installPrefixNode; + +//---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content); +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + // The target soname file (.so.1). + if(target->IsDLLPlatform()) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_SONAME_FILE is not allowed " + "for DLL target platforms."); + return std::string(); + } + if(target->GetType() != cmTarget::SHARED_LIBRARY) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_SONAME_FILE is allowed only for " + "SHARED libraries."); + return std::string(); + } + std::string result = target->GetDirectory(context->Config); + result += "/"; + result += target->GetSOName(context->Config); + return result; + } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + // The file used to link to the target (.so, .lib, .a). + if(!target->IsLinkable()) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_LINKER_FILE is allowed only for libraries and " + "executables with ENABLE_EXPORTS."); + return std::string(); + } + return target->GetFullPath(context->Config, + target->HasImportLibrary()); + } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *) + { + return target->GetFullPath(context->Config, false, true); + } +}; + + +//---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result); +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result) + { return cmSystemTools::GetFilenameName(result); } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result) + { return cmSystemTools::GetFilenamePath(result); } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result) + { return result; } +}; + +//---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifact : public cmGeneratorExpressionNode +{ + TargetFilesystemArtifact() {} + + virtual int NumExpectedParameters() const { return 1; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + // Lookup the referenced target. + std::string name = *parameters.begin(); + + if (!cmGeneratorExpression::IsValidTargetName(name)) + { + ::reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + cmTarget* target = context->Makefile->FindTargetToUse(name.c_str()); + if(!target) + { + ::reportError(context, content->GetOriginalExpression(), + "No target \"" + name + "\""); + return std::string(); + } + if(target->GetType() >= cmTarget::UTILITY && + target->GetType() != cmTarget::UNKNOWN_LIBRARY) + { + ::reportError(context, content->GetOriginalExpression(), + "Target \"" + name + "\" is not an executable or library."); + return std::string(); + } + context->DependTargets.insert(target); + context->AllTargets.insert(target); + + std::string result = + TargetFilesystemArtifactResultCreator::Create( + target, + context, + content); + if (context->HadError) + { + return std::string(); + } + return + TargetFilesystemArtifactResultGetter::Get(result); + } +}; + +//---------------------------------------------------------------------------- +static const +TargetFilesystemArtifact targetFileNode; +static const +TargetFilesystemArtifact targetLinkerFileNode; +static const +TargetFilesystemArtifact targetSoNameFileNode; +static const +TargetFilesystemArtifact targetFileNameNode; +static const +TargetFilesystemArtifact targetLinkerFileNameNode; +static const +TargetFilesystemArtifact targetSoNameFileNameNode; +static const +TargetFilesystemArtifact targetFileDirNode; +static const +TargetFilesystemArtifact targetLinkerFileDirNode; +static const +TargetFilesystemArtifact targetSoNameFileDirNode; + +//---------------------------------------------------------------------------- +static const +cmGeneratorExpressionNode* GetNode(const std::string &identifier) +{ + if (identifier == "0") + return &zeroNode; + else if (identifier == "1") + return &oneNode; + else if (identifier == "AND") + return &andNode; + else if (identifier == "OR") + return &orNode; + else if (identifier == "NOT") + return ¬Node; + else if (identifier == "CONFIGURATION") + return &configurationNode; + else if (identifier == "CONFIG") + return &configurationTestNode; + else if (identifier == "TARGET_FILE") + return &targetFileNode; + else if (identifier == "TARGET_LINKER_FILE") + return &targetLinkerFileNode; + else if (identifier == "TARGET_SONAME_FILE") + return &targetSoNameFileNode; + else if (identifier == "TARGET_FILE_NAME") + return &targetFileNameNode; + else if (identifier == "TARGET_LINKER_FILE_NAME") + return &targetLinkerFileNameNode; + else if (identifier == "TARGET_SONAME_FILE_NAME") + return &targetSoNameFileNameNode; + else if (identifier == "TARGET_FILE_DIR") + return &targetFileDirNode; + else if (identifier == "TARGET_LINKER_FILE_DIR") + return &targetLinkerFileDirNode; + else if (identifier == "TARGET_SONAME_FILE_DIR") + return &targetSoNameFileDirNode; + else if (identifier == "STREQUAL") + return &strEqualNode; + else if (identifier == "BOOL") + return &boolNode; + else if (identifier == "ANGLE-R") + return &angle_rNode; + else if (identifier == "COMMA") + return &commaNode; + else if (identifier == "SEMICOLON") + return &semicolonNode; + else if (identifier == "TARGET_PROPERTY") + return &targetPropertyNode; + else if (identifier == "TARGET_NAME") + return &targetNameNode; + else if (identifier == "TARGET_POLICY") + return &targetPolicyNode; + else if (identifier == "BUILD_INTERFACE") + return &buildInterfaceNode; + else if (identifier == "INSTALL_INTERFACE") + return &installInterfaceNode; + else if (identifier == "INSTALL_PREFIX") + return &installPrefixNode; + return 0; + +} + +//---------------------------------------------------------------------------- +GeneratorExpressionContent::GeneratorExpressionContent( + const char *startContent, + unsigned int length) + : StartContent(startContent), ContentLength(length) +{ + +} + +//---------------------------------------------------------------------------- +std::string GeneratorExpressionContent::GetOriginalExpression() const +{ + return std::string(this->StartContent, this->ContentLength); +} + +//---------------------------------------------------------------------------- +std::string GeneratorExpressionContent::Evaluate( + cmGeneratorExpressionContext *context, + cmGeneratorExpressionDAGChecker *dagChecker) const +{ + std::string identifier; + { + std::vector::const_iterator it + = this->IdentifierChildren.begin(); + const std::vector::const_iterator end + = this->IdentifierChildren.end(); + for ( ; it != end; ++it) + { + identifier += (*it)->Evaluate(context, dagChecker); + if (context->HadError) + { + return std::string(); + } + } + } + + const cmGeneratorExpressionNode *node = GetNode(identifier); + + if (!node) + { + reportError(context, this->GetOriginalExpression(), + "Expression did not evaluate to a known generator expression"); + return std::string(); + } + + if (!node->GeneratesContent()) + { + if (node->AcceptsSingleArbitraryContentParameter()) + { + if (this->ParamChildren.empty()) + { + reportError(context, this->GetOriginalExpression(), + "$<" + identifier + "> expression requires a parameter."); + } + } + else + { + std::vector parameters; + this->EvaluateParameters(node, identifier, context, dagChecker, + parameters); + } + return std::string(); + } + + if (node->AcceptsSingleArbitraryContentParameter()) + { + std::string result; + std::vector >::const_iterator + pit = this->ParamChildren.begin(); + const + std::vector >::const_iterator + pend = this->ParamChildren.end(); + for ( ; pit != pend; ++pit) + { + if (!result.empty()) + { + result += ","; + } + + std::vector::const_iterator it + = pit->begin(); + const std::vector::const_iterator end + = pit->end(); + for ( ; it != end; ++it) + { + if (node->RequiresLiteralInput()) + { + if ((*it)->GetType() != cmGeneratorExpressionEvaluator::Text) + { + reportError(context, this->GetOriginalExpression(), + "$<" + identifier + "> expression requires literal input."); + return std::string(); + } + } + result += (*it)->Evaluate(context, dagChecker); + if (context->HadError) + { + return std::string(); + } + } + } + if (node->RequiresLiteralInput()) + { + std::vector parameters; + parameters.push_back(result); + return node->Evaluate(parameters, context, this, dagChecker); + } + return result; + } + + std::vector parameters; + this->EvaluateParameters(node, identifier, context, dagChecker, parameters); + if (context->HadError) + { + return std::string(); + } + + return node->Evaluate(parameters, context, this, dagChecker); +} + +//---------------------------------------------------------------------------- +std::string GeneratorExpressionContent::EvaluateParameters( + const cmGeneratorExpressionNode *node, + const std::string &identifier, + cmGeneratorExpressionContext *context, + cmGeneratorExpressionDAGChecker *dagChecker, + std::vector ¶meters) const +{ + { + std::vector >::const_iterator + pit = this->ParamChildren.begin(); + const + std::vector >::const_iterator + pend = this->ParamChildren.end(); + for ( ; pit != pend; ++pit) + { + std::string parameter; + std::vector::const_iterator it = + pit->begin(); + const std::vector::const_iterator end = + pit->end(); + for ( ; it != end; ++it) + { + parameter += (*it)->Evaluate(context, dagChecker); + if (context->HadError) + { + return std::string(); + } + } + parameters.push_back(parameter); + } + } + + int numExpected = node->NumExpectedParameters(); + if ((numExpected != -1 && (unsigned int)numExpected != parameters.size())) + { + if (numExpected == 0) + { + reportError(context, this->GetOriginalExpression(), + "$<" + identifier + "> expression requires no parameters."); + } + else if (numExpected == 1) + { + reportError(context, this->GetOriginalExpression(), + "$<" + identifier + "> expression requires " + "exactly one parameter."); + } + else + { + cmOStringStream e; + e << "$<" + identifier + "> expression requires " + << numExpected + << " comma separated parameters, but got " + << parameters.size() << " instead."; + reportError(context, this->GetOriginalExpression(), e.str()); + } + return std::string(); + } + + if (numExpected == -1 && parameters.empty()) + { + reportError(context, this->GetOriginalExpression(), "$<" + identifier + + "> expression requires at least one parameter."); + } + return std::string(); +} + +//---------------------------------------------------------------------------- +static void deleteAll(const std::vector &c) +{ + std::vector::const_iterator it + = c.begin(); + const std::vector::const_iterator end + = c.end(); + for ( ; it != end; ++it) + { + delete *it; + } +} + +//---------------------------------------------------------------------------- +GeneratorExpressionContent::~GeneratorExpressionContent() +{ + deleteAll(this->IdentifierChildren); + + typedef std::vector EvaluatorVector; + typedef std::vector TokenVector; + std::vector::const_iterator pit = + this->ParamChildren.begin(); + const std::vector::const_iterator pend = + this->ParamChildren.end(); + for ( ; pit != pend; ++pit) + { + deleteAll(*pit); + } +} diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h new file mode 100644 index 000000000..ce7ad69bb --- /dev/null +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -0,0 +1,139 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGeneratorExpressionEvaluator_h +#define cmGeneratorExpressionEvaluator_h + +#include +#include + +#include "cmListFileCache.h" + +class cmTarget; + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionContext +{ + cmListFileBacktrace Backtrace; + std::set DependTargets; + std::set AllTargets; + std::set SeenTargetProperties; + cmMakefile *Makefile; + const char *Config; + cmTarget *HeadTarget; // The target whose property is being evaluated. + cmTarget *CurrentTarget; // The dependent of HeadTarget which appears + // directly or indirectly in the property. + bool Quiet; + bool HadError; + bool HadContextSensitiveCondition; +}; + +struct cmGeneratorExpressionDAGChecker; +struct cmGeneratorExpressionNode; + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionEvaluator +{ + cmGeneratorExpressionEvaluator() {} + virtual ~cmGeneratorExpressionEvaluator() {} + + enum Type + { + Text, + Generator + }; + + virtual Type GetType() const = 0; + + virtual std::string Evaluate(cmGeneratorExpressionContext *context, + cmGeneratorExpressionDAGChecker *) const = 0; + +private: + cmGeneratorExpressionEvaluator(const cmGeneratorExpressionEvaluator &); + void operator=(const cmGeneratorExpressionEvaluator &); +}; + +struct TextContent : public cmGeneratorExpressionEvaluator +{ + TextContent(const char *start, unsigned int length) + : Content(start), Length(length) + { + + } + + std::string Evaluate(cmGeneratorExpressionContext *, + cmGeneratorExpressionDAGChecker *) const + { + return std::string(this->Content, this->Length); + } + + Type GetType() const + { + return cmGeneratorExpressionEvaluator::Text; + } + + void Extend(unsigned int length) + { + this->Length += length; + } + + unsigned int GetLength() + { + return this->Length; + } + +private: + const char *Content; + unsigned int Length; +}; + +//---------------------------------------------------------------------------- +struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator +{ + GeneratorExpressionContent(const char *startContent, unsigned int length); + void SetIdentifier(std::vector identifier) + { + this->IdentifierChildren = identifier; + } + + void SetParameters( + std::vector > parameters) + { + this->ParamChildren = parameters; + } + + Type GetType() const + { + return cmGeneratorExpressionEvaluator::Generator; + } + + std::string Evaluate(cmGeneratorExpressionContext *context, + cmGeneratorExpressionDAGChecker *) const; + + std::string GetOriginalExpression() const; + + ~GeneratorExpressionContent(); + +private: + std::string EvaluateParameters(const cmGeneratorExpressionNode *node, + const std::string &identifier, + cmGeneratorExpressionContext *context, + cmGeneratorExpressionDAGChecker *dagChecker, + std::vector ¶meters) const; + +private: + std::vector IdentifierChildren; + std::vector > ParamChildren; + const char *StartContent; + unsigned int ContentLength; +}; + +#endif diff --git a/Source/cmGeneratorExpressionLexer.cxx b/Source/cmGeneratorExpressionLexer.cxx new file mode 100644 index 000000000..cd71ec033 --- /dev/null +++ b/Source/cmGeneratorExpressionLexer.cxx @@ -0,0 +1,85 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGeneratorExpressionLexer.h" + + +//---------------------------------------------------------------------------- +cmGeneratorExpressionLexer::cmGeneratorExpressionLexer() + : SawBeginExpression(false), SawGeneratorExpression(false) +{ + +} + +//---------------------------------------------------------------------------- +static void InsertText(const char *upto, const char *c, + std::vector &result) +{ + if (upto != c) + { + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::Text, upto, c - upto)); + } +} + +//---------------------------------------------------------------------------- +std::vector +cmGeneratorExpressionLexer::Tokenize(const char *input) +{ + std::vector result; + if (!input) + return result; + + const char *c = input; + const char *upto = c; + + for ( ; *c; ++c) + { + if(c[0] == '$' && c[1] == '<') + { + InsertText(upto, c, result); + upto = c; + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::BeginExpression, upto, 2)); + upto = c + 2; + ++c; + SawBeginExpression = true; + } + else if(c[0] == '>') + { + InsertText(upto, c, result); + upto = c; + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::EndExpression, upto, 1)); + upto = c + 1; + SawGeneratorExpression = SawBeginExpression; + } + else if(c[0] == ':') + { + InsertText(upto, c, result); + upto = c; + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::ColonSeparator, upto, 1)); + upto = c + 1; + } + else if(c[0] == ',') + { + InsertText(upto, c, result); + upto = c; + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::CommaSeparator, upto, 1)); + upto = c + 1; + } + } + InsertText(upto, c, result); + + return result; +} diff --git a/Source/cmGeneratorExpressionLexer.h b/Source/cmGeneratorExpressionLexer.h new file mode 100644 index 000000000..5f16712fb --- /dev/null +++ b/Source/cmGeneratorExpressionLexer.h @@ -0,0 +1,58 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGeneratorExpressionLexer_h +#define cmGeneratorExpressionLexer_h + +#include "cmStandardIncludes.h" + +#include + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionToken +{ + cmGeneratorExpressionToken(unsigned type, const char *c, unsigned l) + : TokenType(type), Content(c), Length(l) + { + } + enum { + Text, + BeginExpression, + EndExpression, + ColonSeparator, + CommaSeparator + }; + unsigned TokenType; + const char *Content; + unsigned Length; +}; + +/** \class cmGeneratorExpressionLexer + * + */ +class cmGeneratorExpressionLexer +{ +public: + cmGeneratorExpressionLexer(); + + std::vector Tokenize(const char *input); + + bool GetSawGeneratorExpression() const + { + return this->SawGeneratorExpression; + } + +private: + bool SawBeginExpression; + bool SawGeneratorExpression; +}; + +#endif diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx new file mode 100644 index 000000000..a619cecd0 --- /dev/null +++ b/Source/cmGeneratorExpressionParser.cxx @@ -0,0 +1,284 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmGeneratorExpressionParser.h" + +#include "cmGeneratorExpressionEvaluator.h" + +#include "assert.h" + +//---------------------------------------------------------------------------- +cmGeneratorExpressionParser::cmGeneratorExpressionParser( + const std::vector &tokens) + : Tokens(tokens), NestingLevel(0) +{ +} + +//---------------------------------------------------------------------------- +void cmGeneratorExpressionParser::Parse( + std::vector &result) +{ + it = this->Tokens.begin(); + + while (this->it != this->Tokens.end()) + { + this->ParseContent(result); + } +} + +//---------------------------------------------------------------------------- +static void extendText(std::vector &result, + std::vector::const_iterator it) +{ + if (result.size() > 0 + && (*(result.end() - 1))->GetType() + == cmGeneratorExpressionEvaluator::Text) + { + TextContent *textContent = static_cast(*(result.end() - 1)); + textContent->Extend(it->Length); + } + else + { + TextContent *textContent = new TextContent(it->Content, it->Length); + result.push_back(textContent); + } +} + +//---------------------------------------------------------------------------- +static void extendResult(std::vector &result, + const std::vector &contents) +{ + if (result.size() > 0 + && (*(result.end() - 1))->GetType() + == cmGeneratorExpressionEvaluator::Text + && (*contents.begin())->GetType() + == cmGeneratorExpressionEvaluator::Text) + { + TextContent *textContent = static_cast(*(result.end() - 1)); + textContent->Extend( + static_cast(*contents.begin())->GetLength()); + delete *contents.begin(); + result.insert(result.end(), contents.begin() + 1, contents.end()); + } else { + result.insert(result.end(), contents.begin(), contents.end()); + } +} + +//---------------------------------------------------------------------------- +void cmGeneratorExpressionParser::ParseGeneratorExpression( + std::vector &result) +{ + assert(this->it != this->Tokens.end()); + unsigned int nestedLevel = this->NestingLevel; + ++this->NestingLevel; + + std::vector::const_iterator startToken + = this->it - 1; + + std::vector identifier; + while(this->it->TokenType != cmGeneratorExpressionToken::EndExpression + && this->it->TokenType != cmGeneratorExpressionToken::ColonSeparator) + { + if (this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator) + { + extendText(identifier, this->it); + ++this->it; + } + else + { + this->ParseContent(identifier); + } + if (this->it == this->Tokens.end()) + { + break; + } + } + if (identifier.empty()) + { + // ERROR + } + + if (this->it != this->Tokens.end() && + this->it->TokenType == cmGeneratorExpressionToken::EndExpression) + { + GeneratorExpressionContent *content = new GeneratorExpressionContent( + startToken->Content, this->it->Content + - startToken->Content + + this->it->Length); + assert(this->it != this->Tokens.end()); + ++this->it; + --this->NestingLevel; + content->SetIdentifier(identifier); + result.push_back(content); + return; + } + + std::vector > parameters; + std::vector::const_iterator> + commaTokens; + std::vector::const_iterator colonToken; + if (this->it != this->Tokens.end() && + this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator) + { + colonToken = this->it; + parameters.resize(parameters.size() + 1); + assert(this->it != this->Tokens.end()); + ++this->it; + + while (this->it != this->Tokens.end() && + this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator) + { + commaTokens.push_back(this->it); + parameters.resize(parameters.size() + 1); + assert(this->it != this->Tokens.end()); + ++this->it; + } + while (this->it != this->Tokens.end() && + this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator) + { + extendText(*(parameters.end() - 1), this->it); + assert(this->it != this->Tokens.end()); + ++this->it; + } + while (this->it != this->Tokens.end() && + this->it->TokenType != cmGeneratorExpressionToken::EndExpression) + { + this->ParseContent(*(parameters.end() - 1)); + if (this->it == this->Tokens.end()) + { + break; + } + while (this->it != this->Tokens.end() && + this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator) + { + commaTokens.push_back(this->it); + parameters.resize(parameters.size() + 1); + assert(this->it != this->Tokens.end()); + ++this->it; + } + while (this->it != this->Tokens.end() && + this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator) + { + extendText(*(parameters.end() - 1), this->it); + assert(this->it != this->Tokens.end()); + ++this->it; + } + } + if(this->it != this->Tokens.end() + && this->it->TokenType == cmGeneratorExpressionToken::EndExpression) + { + --this->NestingLevel; + assert(this->it != this->Tokens.end()); + ++this->it; + } + } + + if (nestedLevel != this->NestingLevel) + { + // There was a '$<' in the text, but no corresponding '>'. Rebuild to + // treat the '$<' as having been plain text, along with the + // corresponding : and , tokens that might have been found. + extendText(result, startToken); + extendResult(result, identifier); + if (!parameters.empty()) + { + extendText(result, colonToken); + + typedef std::vector EvaluatorVector; + typedef std::vector TokenVector; + std::vector::const_iterator pit = parameters.begin(); + const std::vector::const_iterator pend = + parameters.end(); + std::vector::const_iterator commaIt = + commaTokens.begin(); + assert(parameters.size() > commaTokens.size()); + for ( ; pit != pend; ++pit, ++commaIt) + { + extendResult(result, *pit); + if (commaIt != commaTokens.end()) + { + extendText(result, *commaIt); + } + else + { + break; + } + } + } + return; + } + + int contentLength = ((this->it - 1)->Content + - startToken->Content) + + (this->it - 1)->Length; + GeneratorExpressionContent *content = new GeneratorExpressionContent( + startToken->Content, contentLength); + content->SetIdentifier(identifier); + content->SetParameters(parameters); + result.push_back(content); +} + +//---------------------------------------------------------------------------- +void cmGeneratorExpressionParser::ParseContent( + std::vector &result) +{ + assert(this->it != this->Tokens.end()); + switch(this->it->TokenType) + { + case cmGeneratorExpressionToken::Text: + { + if (this->NestingLevel == 0) + { + if (result.size() > 0 + && (*(result.end() - 1))->GetType() + == cmGeneratorExpressionEvaluator::Text) + { + // A comma in 'plain text' could have split text that should + // otherwise be continuous. Extend the last text content instead of + // creating a new one. + TextContent *textContent = + static_cast(*(result.end() - 1)); + textContent->Extend(this->it->Length); + assert(this->it != this->Tokens.end()); + ++this->it; + return; + } + } + cmGeneratorExpressionEvaluator* n = new TextContent(this->it->Content, + this->it->Length); + result.push_back(n); + assert(this->it != this->Tokens.end()); + ++this->it; + return ; + } + case cmGeneratorExpressionToken::BeginExpression: + assert(this->it != this->Tokens.end()); + ++this->it; + this->ParseGeneratorExpression(result); + return; + case cmGeneratorExpressionToken::EndExpression: + case cmGeneratorExpressionToken::ColonSeparator: + case cmGeneratorExpressionToken::CommaSeparator: + if (this->NestingLevel == 0) + { + extendText(result, this->it); + } + else + { + assert(!"Got unexpected syntax token."); + } + assert(this->it != this->Tokens.end()); + ++this->it; + return; + } + assert(!"Unhandled token in generator expression."); +} diff --git a/Source/cmGeneratorExpressionParser.h b/Source/cmGeneratorExpressionParser.h new file mode 100644 index 000000000..28f14410f --- /dev/null +++ b/Source/cmGeneratorExpressionParser.h @@ -0,0 +1,45 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGeneratorExpressionParser_h +#define cmGeneratorExpressionParser_h + +#include "cmGeneratorExpressionLexer.h" + +#include +#include + +#include "cmListFileCache.h" + +class cmMakefile; +class cmTarget; +struct cmGeneratorExpressionEvaluator; + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionParser +{ + cmGeneratorExpressionParser( + const std::vector &tokens); + + void Parse(std::vector &result); + +private: + void ParseContent(std::vector &); + void ParseGeneratorExpression( + std::vector &); + +private: + std::vector::const_iterator it; + const std::vector Tokens; + unsigned int NestingLevel; +}; + +#endif diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 6e2e23da5..335ba0f25 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -16,6 +16,8 @@ #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmSourceFile.h" +#include "cmGeneratorExpression.h" +#include "cmGeneratorExpressionDAGChecker.h" //---------------------------------------------------------------------------- cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) @@ -27,6 +29,36 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) this->LookupObjectLibraries(); } +//---------------------------------------------------------------------------- +int cmGeneratorTarget::GetType() const +{ + return this->Target->GetType(); +} + +//---------------------------------------------------------------------------- +const char *cmGeneratorTarget::GetName() const +{ + return this->Target->GetName(); +} + +//---------------------------------------------------------------------------- +const char *cmGeneratorTarget::GetProperty(const char *prop) +{ + return this->Target->GetProperty(prop); +} + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::GetPropertyAsBool(const char *prop) +{ + return this->Target->GetPropertyAsBool(prop); +} + +//---------------------------------------------------------------------------- +std::vector const& cmGeneratorTarget::GetSourceFiles() +{ + return this->Target->GetSourceFiles(); +} + //---------------------------------------------------------------------------- void cmGeneratorTarget::ClassifySources() { @@ -175,3 +207,50 @@ void cmGeneratorTarget::UseObjectLibraries(std::vector& objs) } } } + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::GetAppleArchs(const char* config, + std::vector& archVec) +{ + const char* archs = 0; + if(config && *config) + { + std::string defVarName = "OSX_ARCHITECTURES_"; + defVarName += cmSystemTools::UpperCase(config); + archs = this->Target->GetProperty(defVarName.c_str()); + } + if(!archs) + { + archs = this->Target->GetProperty("OSX_ARCHITECTURES"); + } + if(archs) + { + cmSystemTools::ExpandListArgument(std::string(archs), archVec); + } +} + +//---------------------------------------------------------------------------- +const char* cmGeneratorTarget::GetCreateRuleVariable() +{ + switch(this->GetType()) + { + case cmTarget::STATIC_LIBRARY: + return "_CREATE_STATIC_LIBRARY"; + case cmTarget::SHARED_LIBRARY: + return "_CREATE_SHARED_LIBRARY"; + case cmTarget::MODULE_LIBRARY: + return "_CREATE_SHARED_MODULE"; + case cmTarget::EXECUTABLE: + return "_LINK_EXECUTABLE"; + default: + break; + } + return ""; +} + +//---------------------------------------------------------------------------- +std::vector cmGeneratorTarget::GetIncludeDirectories( + const char *config) +{ + return this->Target->GetIncludeDirectories(config); +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 5c7578d94..cbcd8a579 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -26,6 +26,12 @@ class cmGeneratorTarget public: cmGeneratorTarget(cmTarget*); + int GetType() const; + const char *GetName() const; + const char *GetProperty(const char *prop); + bool GetPropertyAsBool(const char *prop); + std::vector const& GetSourceFiles(); + cmTarget* Target; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; @@ -52,6 +58,16 @@ public: void UseObjectLibraries(std::vector& objs); + void GetAppleArchs(const char* config, + std::vector& archVec); + + ///! Return the rule variable used to create this type of target, + // need to add CMAKE_(LANG) for full name. + const char* GetCreateRuleVariable(); + + /** Get the include directories for this target. */ + std::vector GetIncludeDirectories(const char *config); + private: void ClassifySources(); void LookupObjectLibraries(); @@ -60,4 +76,6 @@ private: void operator=(cmGeneratorTarget const&); }; +typedef std::map cmGeneratorTargetsType; + #endif diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h index 0a5917cfd..b77eaae04 100644 --- a/Source/cmGetCMakePropertyCommand.h +++ b/Source/cmGetCMakePropertyCommand.h @@ -17,7 +17,7 @@ class cmGetCMakePropertyCommand : public cmCommand { public: - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmGetCMakePropertyCommand; } @@ -46,7 +46,7 @@ public: { return "Get a property of the CMake instance."; } - + /** * Longer documentation. */ @@ -63,7 +63,7 @@ public: "\n" "See also the more general get_property() command."; } - + cmTypeMacro(cmGetCMakePropertyCommand, cmCommand); }; diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index 5714b5079..9e76e1bc3 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -22,12 +22,12 @@ bool cmGetDirectoryPropertyCommand this->SetError("called with incorrect number of arguments"); return false; } - + std::vector::const_iterator i = args.begin(); std::string variable = *i; ++i; std::string output = ""; - + // get the directory argument if there is one cmMakefile *dir = this->Makefile; if (*i == "DIRECTORY") @@ -52,7 +52,7 @@ bool cmGetDirectoryPropertyCommand sd = cmSystemTools::CollapseFullPath(sd.c_str()); // lookup the makefile from the directory name - cmLocalGenerator *lg = + cmLocalGenerator *lg = this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> FindLocalGenerator(sd.c_str()); if (!lg) @@ -69,7 +69,7 @@ bool cmGetDirectoryPropertyCommand // OK, now we have the directory to process, we just get the requested // information out of it - + if ( *i == "DEFINITION" ) { ++i; diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h index 901b90cff..d0d582028 100644 --- a/Source/cmGetDirectoryPropertyCommand.h +++ b/Source/cmGetDirectoryPropertyCommand.h @@ -17,7 +17,7 @@ class cmGetDirectoryPropertyCommand : public cmCommand { public: - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmGetDirectoryPropertyCommand; } @@ -46,7 +46,7 @@ public: { return "Get a property of DIRECTORY scope."; } - + /** * Longer documentation. */ @@ -69,7 +69,7 @@ public: "\n" "See also the more general get_property() command."; } - + cmTypeMacro(cmGetDirectoryPropertyCommand, cmCommand); }; diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 1a31d5428..fd1ad601f 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -32,7 +32,7 @@ bool cmGetFilenameComponentCommand return true; } } - + std::string result; std::string filename = args[1]; if(filename.find("[HKEY") != filename.npos) @@ -79,7 +79,7 @@ bool cmGetFilenameComponentCommand } } } - cmSystemTools::SplitProgramFromArgs(filename.c_str(), + cmSystemTools::SplitProgramFromArgs(filename.c_str(), result, programArgs); } else if (args[2] == "EXT") @@ -104,7 +104,7 @@ bool cmGetFilenameComponentCommand result = cmSystemTools::GetRealPath(result.c_str()); } } - else + else { std::string err = "unknown component " + args[2]; this->SetError(err.c_str()); @@ -125,7 +125,7 @@ bool cmGetFilenameComponentCommand args[2] == "PATH" ? cmCacheManager::FILEPATH : cmCacheManager::STRING); } - else + else { if(programArgs.size() && storeArgs.size()) { diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h index 0c8e57a26..c46101625 100644 --- a/Source/cmGetFilenameComponentCommand.h +++ b/Source/cmGetFilenameComponentCommand.h @@ -18,7 +18,7 @@ * \brief Get a specific component of a filename. * * cmGetFilenameComponentCommand is a utility command used to get the path, - * name, extension or name without extension of a full filename. + * name, extension or name without extension of a full filename. */ class cmGetFilenameComponentCommand : public cmCommand { @@ -26,7 +26,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmGetFilenameComponentCommand; } @@ -55,7 +55,7 @@ public: { return "Get a specific component of a full filename."; } - + /** * More documentation. */ @@ -82,7 +82,7 @@ public: "from the program name and stored in . This is used to " "separate a program name from its arguments in a command line string."; } - + cmTypeMacro(cmGetFilenameComponentCommand, cmCommand); }; diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h index dca262725..3c597fdcf 100644 --- a/Source/cmGetPropertyCommand.h +++ b/Source/cmGetPropertyCommand.h @@ -19,7 +19,7 @@ class cmGetPropertyCommand : public cmCommand public: cmGetPropertyCommand(); - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmGetPropertyCommand; } @@ -48,7 +48,7 @@ public: { return "Get a property."; } - + /** * Longer documentation. */ @@ -92,7 +92,7 @@ public: "If documentation is requested for a property that has not been " "defined NOTFOUND is returned."; } - + cmTypeMacro(cmGetPropertyCommand, cmCommand); private: enum OutType { OutValue, OutDefined, OutBriefDoc, OutFullDoc, OutSet }; diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h index 6d52503b5..2ba81037f 100644 --- a/Source/cmGetSourceFilePropertyCommand.h +++ b/Source/cmGetSourceFilePropertyCommand.h @@ -17,7 +17,7 @@ class cmGetSourceFilePropertyCommand : public cmCommand { public: - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmGetSourceFilePropertyCommand; } @@ -41,7 +41,7 @@ public: { return "Get a property for a source file."; } - + /** * Longer documentation. */ @@ -57,7 +57,7 @@ public: "\n" "See also the more general get_property() command."; } - + cmTypeMacro(cmGetSourceFilePropertyCommand, cmCommand); }; diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h index b60abea4c..f5e1aa729 100644 --- a/Source/cmGetTargetPropertyCommand.h +++ b/Source/cmGetTargetPropertyCommand.h @@ -17,7 +17,7 @@ class cmGetTargetPropertyCommand : public cmCommand { public: - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmGetTargetPropertyCommand; } @@ -41,7 +41,7 @@ public: { return "Get a property from a target."; } - + /** * Longer documentation. */ @@ -59,7 +59,7 @@ public: "\n" "See also the more general get_property() command."; } - + cmTypeMacro(cmGetTargetPropertyCommand, cmCommand); }; diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h index af6bafaf3..01f54d951 100644 --- a/Source/cmGetTestPropertyCommand.h +++ b/Source/cmGetTestPropertyCommand.h @@ -17,7 +17,7 @@ class cmGetTestPropertyCommand : public cmCommand { public: - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmGetTestPropertyCommand; } diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index b87b7e186..2a7d61d6a 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -25,14 +25,14 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator() void cmGlobalBorlandMakefileGenerator -::EnableLanguage(std::vectorconst& l, - cmMakefile *mf, +::EnableLanguage(std::vectorconst& l, + cmMakefile *mf, bool optional) { std::string outdir = this->CMakeInstance->GetStartOutputDirectory(); mf->AddDefinition("BORLAND", "1"); mf->AddDefinition("CMAKE_GENERATOR_CC", "bcc32"); - mf->AddDefinition("CMAKE_GENERATOR_CXX", "bcc32"); + mf->AddDefinition("CMAKE_GENERATOR_CXX", "bcc32"); this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } @@ -55,9 +55,9 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalBorlandMakefileGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalBorlandMakefileGenerator::GetActualName(); entry.Brief = "Generates Borland makefiles."; entry.Full = ""; } diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index 0d3868989..bd3db3eae 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -23,23 +23,24 @@ class cmGlobalBorlandMakefileGenerator : public cmGlobalNMakeMakefileGenerator { public: cmGlobalBorlandMakefileGenerator(); - static cmGlobalGenerator* New() - { return new cmGlobalBorlandMakefileGenerator; } - + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + (); } + ///! Get the name for the generator. virtual const char* GetName() const { return cmGlobalBorlandMakefileGenerator::GetActualName();} static const char* GetActualName() {return "Borland Makefiles";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - + static void GetDocumentation(cmDocumentationEntry& entry); + ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); /** * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. + * extension, pthreads, byte order etc. */ virtual void EnableLanguage(std::vectorconst& languages, cmMakefile *, bool optional); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a47ca3677..df1433105 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -21,10 +21,11 @@ #include "cmQtAutomoc.h" #include "cmSourceFile.h" #include "cmVersion.h" -#include "cmExportInstallFileGenerator.h" +#include "cmTargetExport.h" #include "cmComputeTargetDepends.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" +#include "cmGeneratorExpression.h" #include @@ -76,12 +77,26 @@ cmGlobalGenerator::~cmGlobalGenerator() } this->ClearGeneratorTargets(); - this->ClearExportSets(); +} + +bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts) +{ + cmOStringStream e; + e << + "Generator\n" + " " << this->GetName() << "\n" + "does not support toolset specification, but toolset\n" + " " << ts << "\n" + "was specified."; + this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), + cmListFileBacktrace()); + return false; } void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, cmMakefile *mf, - bool optional) { + bool optional) +{ std::string langComp = "CMAKE_"; langComp += lang; langComp += "_COMPILER"; @@ -315,9 +330,11 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, { rootBin = this->ConfiguredFilesPath; } + rootBin += "/"; + rootBin += cmVersion::GetCMakeVersion(); // set the dir for parent files so they can be used by modules - mf->AddDefinition("CMAKE_PLATFORM_ROOT_BIN",rootBin.c_str()); + mf->AddDefinition("CMAKE_PLATFORM_INFO_DIR",rootBin.c_str()); // find and make sure CMAKE_MAKE_PROGRAM is defined this->FindMakeProgram(mf); @@ -376,21 +393,16 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, std::string loadedLang = "CMAKE_"; loadedLang += lang; loadedLang += "_COMPILER_LOADED"; - // If the existing build tree was already configured with this - // version of CMake then try to load the configured file first - // to avoid duplicate compiler tests. - unsigned int cacheMajor = mf->GetCacheMajorVersion(); - unsigned int cacheMinor = mf->GetCacheMinorVersion(); - unsigned int selfMajor = cmVersion::GetMajorVersion(); - unsigned int selfMinor = cmVersion::GetMinorVersion(); - if((this->CMakeInstance->GetIsInTryCompile() || - (selfMajor == cacheMajor && selfMinor == cacheMinor)) - && !mf->GetDefinition(loadedLang.c_str())) + if(!mf->GetDefinition(loadedLang.c_str())) { fpath = rootBin; fpath += "/CMake"; fpath += lang; fpath += "Compiler.cmake"; + + // If the existing build tree was already configured with this + // version of CMake then try to load the configured file first + // to avoid duplicate compiler tests. if(cmSystemTools::FileExists(fpath.c_str())) { if(!mf->ReadListFile(0,fpath.c_str())) @@ -820,7 +832,7 @@ void cmGlobalGenerator::Configure() { this->FirstTimeProgress = 0.0f; this->ClearGeneratorTargets(); - this->ClearExportSets(); + this->ExportSets.clear(); // Delete any existing cmLocalGenerators unsigned int i; for (i = 0; i < this->LocalGenerators.size(); ++i) @@ -830,6 +842,7 @@ void cmGlobalGenerator::Configure() this->LocalGenerators.clear(); this->TargetDependencies.clear(); this->TotalTargets.clear(); + this->ImportedTargets.clear(); this->LocalGeneratorToTargetMap.clear(); this->ProjectMap.clear(); this->RuleHashes.clear(); @@ -896,7 +909,7 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() << "The \"" << this->GetName() << "\" generator does not support " << "duplicate custom targets. " << "Consider using a Makefiles generator or fix the project to not " - << "use duplicat target names."; + << "use duplicate target names."; cmSystemTools::Error(e.str().c_str()); return false; } @@ -939,6 +952,11 @@ void cmGlobalGenerator::Generate() (*targets)[tit->first] = tit->second; (*targets)[tit->first].SetMakefile(mf); } + + for ( tit = targets->begin(); tit != targets->end(); ++ tit ) + { + tit->second.AppendBuildInterfaceIncludes(); + } } // Add generator specific helper commands @@ -976,6 +994,7 @@ void cmGlobalGenerator::Generate() // Generate project files for (i = 0; i < this->LocalGenerators.size(); ++i) { + this->LocalGenerators[i]->GetMakefile()->SetGeneratingBuildSystem(); this->SetCurrentLocalGenerator(this->LocalGenerators[i]); this->LocalGenerators[i]->Generate(); this->LocalGenerators[i]->GenerateInstallRules(); @@ -1048,6 +1067,8 @@ bool cmGlobalGenerator::CheckTargets() void cmGlobalGenerator::CreateAutomocTargets() { #ifdef CMAKE_BUILD_WITH_CMAKE + typedef std::vector > Automocs; + Automocs automocs; for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) { cmTargets& targets = @@ -1059,16 +1080,25 @@ void cmGlobalGenerator::CreateAutomocTargets() if(target.GetType() == cmTarget::EXECUTABLE || target.GetType() == cmTarget::STATIC_LIBRARY || target.GetType() == cmTarget::SHARED_LIBRARY || - target.GetType() == cmTarget::MODULE_LIBRARY) + target.GetType() == cmTarget::MODULE_LIBRARY || + target.GetType() == cmTarget::OBJECT_LIBRARY) { if(target.GetPropertyAsBool("AUTOMOC") && !target.IsImported()) { cmQtAutomoc automoc; - automoc.SetupAutomocTarget(&target); + if(automoc.InitializeMocSourceFile(&target)) + { + automocs.push_back(std::make_pair(automoc, &target)); + } } } } } + for (Automocs::iterator it = automocs.begin(); it != automocs.end(); + ++it) + { + it->first.SetupAutomocTarget(it->second); + } #endif } @@ -1078,23 +1108,56 @@ void cmGlobalGenerator::CreateGeneratorTargets() // Construct per-target generator information. for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) { - cmTargets& targets = - this->LocalGenerators[i]->GetMakefile()->GetTargets(); + cmGeneratorTargetsType generatorTargets; + + cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); + const char *noconfig_compile_definitions = + mf->GetProperty("COMPILE_DEFINITIONS"); + + std::vector configs; + mf->GetConfigurations(configs); + + cmTargets& targets = mf->GetTargets(); for(cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) { cmTarget* t = &ti->second; + + { + t->AppendProperty("COMPILE_DEFINITIONS", noconfig_compile_definitions); + for(std::vector::const_iterator ci = configs.begin(); + ci != configs.end(); ++ci) + { + std::string defPropName = "COMPILE_DEFINITIONS_"; + defPropName += cmSystemTools::UpperCase(*ci); + t->AppendProperty(defPropName.c_str(), + mf->GetProperty(defPropName.c_str())); + } + } + cmGeneratorTarget* gt = new cmGeneratorTarget(t); this->GeneratorTargets[t] = gt; this->ComputeTargetObjects(gt); + generatorTargets[t] = gt; } + + for(std::vector::const_iterator + j = mf->GetOwnedImportedTargets().begin(); + j != mf->GetOwnedImportedTargets().end(); ++j) + { + cmGeneratorTarget* gt = new cmGeneratorTarget(*j); + this->GeneratorTargets[*j] = gt; + generatorTargets[*j] = gt; + } + + mf->SetGeneratorTargets(generatorTargets); } } //---------------------------------------------------------------------------- void cmGlobalGenerator::ClearGeneratorTargets() { - for(GeneratorTargetsType::iterator i = this->GeneratorTargets.begin(); + for(cmGeneratorTargetsType::iterator i = this->GeneratorTargets.begin(); i != this->GeneratorTargets.end(); ++i) { delete i->second; @@ -1105,7 +1168,7 @@ void cmGlobalGenerator::ClearGeneratorTargets() //---------------------------------------------------------------------------- cmGeneratorTarget* cmGlobalGenerator::GetGeneratorTarget(cmTarget* t) const { - GeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t); + cmGeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t); if(ti == this->GeneratorTargets.end()) { this->CMakeInstance->IssueMessage( @@ -1132,7 +1195,7 @@ void cmGlobalGenerator::CheckLocalGenerators() { manager = this->LocalGenerators[i]->GetMakefile()->GetCacheManager(); this->LocalGenerators[i]->ConfigureFinalPass(); - cmTargets & targets = + cmTargets &targets = this->LocalGenerators[i]->GetMakefile()->GetTargets(); for (cmTargets::iterator l = targets.begin(); l != targets.end(); l++) @@ -1161,7 +1224,16 @@ void cmGlobalGenerator::CheckLocalGenerators() } } std::vector incs; - this->LocalGenerators[i]->GetIncludeDirectories(incs, &l->second); + const char *incDirProp = l->second.GetProperty("INCLUDE_DIRECTORIES"); + if (!incDirProp) + { + continue; + } + + std::string incDirs = cmGeneratorExpression::Preprocess(incDirProp, + cmGeneratorExpression::StripAllGeneratorExpressions); + + cmSystemTools::ExpandListArgument(incDirs.c_str(), incs); for( std::vector::const_iterator incDir = incs.begin(); incDir != incs.end(); ++incDir) @@ -1469,52 +1541,6 @@ void cmGlobalGenerator::AddInstallComponent(const char* component) } } -void cmGlobalGenerator::AddTargetToExports(const char* exportSetName, - cmTarget* target, - cmInstallTargetGenerator* archive, - cmInstallTargetGenerator* runTime, - cmInstallTargetGenerator* library, - cmInstallTargetGenerator* framework, - cmInstallTargetGenerator* bundle, - cmInstallFilesGenerator* headers) -{ - if ((exportSetName) && (*exportSetName) && (target)) - { - cmTargetExport* te = new cmTargetExport(target, archive, runTime, library, - framework, bundle, headers); - this->ExportSets[exportSetName].push_back(te); - } -} - -//---------------------------------------------------------------------------- -void cmGlobalGenerator::ClearExportSets() -{ - for(std::map >::iterator - setIt = this->ExportSets.begin(); - setIt != this->ExportSets.end(); ++setIt) - { - for(unsigned int i = 0; i < setIt->second.size(); ++i) - { - delete setIt->second[i]; - } - } - this->ExportSets.clear(); -} - -const std::vector* cmGlobalGenerator::GetExportSet( - const char* name) const -{ - std::map >::const_iterator - exportSetIt = this->ExportSets.find(name); - if (exportSetIt != this->ExportSets.end()) - { - return &exportSetIt->second; - } - - return 0; -} - - void cmGlobalGenerator::EnableInstallTarget() { this->InstallTargetEnabled = true; @@ -1561,14 +1587,6 @@ void cmGlobalGenerator::SetConfiguredFilesPath(cmGlobalGenerator* gen) } } -//---------------------------------------------------------------------------- -void cmGlobalGenerator::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = ""; - entry.Full = ""; -} - bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) { @@ -2060,11 +2078,43 @@ bool cmGlobalGenerator::UseFolderProperty() } // By default, this feature is OFF, since it is not supported in the - // Visual Studio Express editions: + // Visual Studio Express editions until VS11: // return false; } +//---------------------------------------------------------------------------- +void cmGlobalGenerator::EnableMinGWLanguage(cmMakefile *mf) +{ + this->FindMakeProgram(mf); + std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); + std::vector locations; + locations.push_back(cmSystemTools::GetProgramPath(makeProgram.c_str())); + locations.push_back("/mingw/bin"); + locations.push_back("c:/mingw/bin"); + std::string tgcc = cmSystemTools::FindProgram("gcc", locations); + std::string gcc = "gcc.exe"; + if(tgcc.size()) + { + gcc = tgcc; + } + std::string tgxx = cmSystemTools::FindProgram("g++", locations); + std::string gxx = "g++.exe"; + if(tgxx.size()) + { + gxx = tgxx; + } + std::string trc = cmSystemTools::FindProgram("windres", locations); + std::string rc = "windres.exe"; + if(trc.size()) + { + rc = trc; + } + mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str()); + mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str()); + mf->AddDefinition("CMAKE_GENERATOR_RC", rc.c_str()); +} + //---------------------------------------------------------------------------- cmTarget cmGlobalGenerator::CreateGlobalTarget( const char* name, const char* message, diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index ce9179379..11616e0d0 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -18,13 +18,15 @@ #include "cmTarget.h" // For cmTargets #include "cmTargetDepend.h" // For cmTargetDependSet #include "cmSystemTools.h" // for cmSystemTools::OutputOption +#include "cmExportSetMap.h" // For cmExportSetMap +#include "cmGeneratorTarget.h" + class cmake; class cmGeneratorTarget; class cmMakefile; class cmLocalGenerator; class cmExternalMakefileProjectGenerator; class cmTarget; -class cmTargetExport; class cmInstallTargetGenerator; class cmInstallFilesGenerator; @@ -47,8 +49,9 @@ public: ///! Get the name for this generator virtual const char *GetName() const { return "Generic"; }; - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + /** Set the generator-specific toolset name. Returns true if toolset + is supported and false otherwise. */ + virtual bool SetGeneratorToolset(std::string const& ts); /** * Create LocalGenerators and process the CMakeLists files. This does not @@ -127,8 +130,8 @@ public: void SetCMakeInstance(cmake *cm); ///! Get the CMake instance - cmake *GetCMakeInstance() { return this->CMakeInstance; }; - const cmake *GetCMakeInstance() const { return this->CMakeInstance; }; + cmake *GetCMakeInstance() { return this->CMakeInstance; } + const cmake *GetCMakeInstance() const { return this->CMakeInstance; } void SetConfiguredFilesPath(cmGlobalGenerator* gen); const std::vector& GetLocalGenerators() const { @@ -151,18 +154,9 @@ public: void AddInstallComponent(const char* component); const std::set* GetInstallComponents() const - { return &InstallComponents; } - - ///! Add one installed target to the sets of the exports - void AddTargetToExports(const char* exportSet, cmTarget* target, - cmInstallTargetGenerator* archive, - cmInstallTargetGenerator* runTime, - cmInstallTargetGenerator* library, - cmInstallTargetGenerator* framework, - cmInstallTargetGenerator* bundle, - cmInstallFilesGenerator* publicHeaders); - ///! Get the export target set with the given name - const std::vector* GetExportSet(const char* name) const; + { return &this->InstallComponents; } + + cmExportSetMap& GetExportSets() {return this->ExportSets;} /** Add a file to the manifest of generated targets for a configuration. */ void AddToManifest(const char* config, std::string const& f); @@ -222,7 +216,7 @@ public: /** Get the manifest of all targets that will be built for each configuration. This is valid during generation only. */ cmTargetManifest const& GetTargetManifest() const - { return this->TargetManifest; } + { return this->TargetManifest; } /** Get the content of a directory. Directory listings are loaded from disk at most once and cached. During the generation step @@ -328,15 +322,13 @@ protected: cmLocalGenerator* CurrentLocalGenerator; // map from project name to vector of local generators in that project std::map > ProjectMap; - std::map > - LocalGeneratorToTargetMap; + std::map > LocalGeneratorToTargetMap; // Set of named installation components requested by the project. std::set InstallComponents; bool InstallTargetEnabled; // Sets of named target exports - std::map > ExportSets; - void ClearExportSets(); + cmExportSetMap ExportSets; // Manifest of all targets that will be built for each configuration. // This is computed just before local generators generate. @@ -348,6 +340,7 @@ protected: virtual const char* GetPredefinedTargetsFolder(); virtual bool UseFolderProperty(); + void EnableMinGWLanguage(cmMakefile *mf); private: cmMakefile* TryCompileOuterMakefile; @@ -383,8 +376,7 @@ private: TargetDependMap TargetDependencies; // Per-target generator information. - typedef std::map GeneratorTargetsType; - GeneratorTargetsType GeneratorTargets; + cmGeneratorTargetsType GeneratorTargets; void CreateGeneratorTargets(); void ClearGeneratorTargets(); virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h new file mode 100644 index 000000000..fd1d65fb5 --- /dev/null +++ b/Source/cmGlobalGeneratorFactory.h @@ -0,0 +1,59 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmGlobalGeneratorFactory_h +#define cmGlobalGeneratorFactory_h + +#include "cmStandardIncludes.h" + +class cmGlobalGenerator; +struct cmDocumentationEntry; + +/** \class cmGlobalGeneratorFactory + * \brief Responable for creating cmGlobalGenerator instances + * + * Subclasses of this class generate instances of cmGlobalGenerator. + */ +class cmGlobalGeneratorFactory +{ +public: + virtual ~cmGlobalGeneratorFactory() {} + + /** Create a GlobalGenerator */ + virtual cmGlobalGenerator* CreateGlobalGenerator(const char* n) const = 0; + + /** Get the documentation entry for this factory */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0; + + /** Get the names of the current registered generators */ + virtual void GetGenerators(std::vector& names) const = 0; +}; + +template +class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory +{ +public: + /** Create a GlobalGenerator */ + virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { + if (strcmp(name, T::GetActualName())) return 0; + return new T; } + + /** Get the documentation entry for this factory */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const { + T::GetDocumentation(entry); } + + /** Get the names of the current registered generators */ + virtual void GetGenerators(std::vector& names) const { + names.push_back(T::GetActualName()); } +}; + +#endif diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index 411e28bf1..4af06076f 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -22,14 +22,14 @@ cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator() } void cmGlobalJOMMakefileGenerator -::EnableLanguage(std::vectorconst& l, - cmMakefile *mf, +::EnableLanguage(std::vectorconst& l, + cmMakefile *mf, bool optional) { - // pick a default + // pick a default mf->AddDefinition("CMAKE_GENERATOR_CC", "cl"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); - if(!(cmSystemTools::GetEnv("INCLUDE") && + if(!(cmSystemTools::GetEnv("INCLUDE") && cmSystemTools::GetEnv("LIB")) ) { @@ -40,7 +40,7 @@ void cmGlobalJOMMakefileGenerator mf->IssueMessage(cmake::WARNING, message); } - + this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } @@ -61,9 +61,9 @@ cmLocalGenerator *cmGlobalJOMMakefileGenerator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalJOMMakefileGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalJOMMakefileGenerator::GetActualName(); entry.Brief = "Generates JOM makefiles."; entry.Full = ""; } diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h index 08be4b4fc..28893bf27 100644 --- a/Source/cmGlobalJOMMakefileGenerator.h +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -23,8 +23,9 @@ class cmGlobalJOMMakefileGenerator : public cmGlobalUnixMakefileGenerator3 { public: cmGlobalJOMMakefileGenerator(); - static cmGlobalGenerator* New() { - return new cmGlobalJOMMakefileGenerator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + (); } ///! Get the name for the generator. virtual const char* GetName() const { return cmGlobalJOMMakefileGenerator::GetActualName();} @@ -33,14 +34,14 @@ public: static const char* GetActualName() {return "NMake Makefiles JOM";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - + static void GetDocumentation(cmDocumentationEntry& entry); + ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); /** * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. + * extension, pthreads, byte order etc. */ virtual void EnableLanguage(std::vectorconst& languages, cmMakefile *, bool optional); diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index f69944847..a81c26c0f 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -51,11 +51,11 @@ cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator() void cmGlobalKdevelopGenerator::Generate() { - // for each sub project in the project create + // for each sub project in the project create // a kdevelop project - for (std::map >::const_iterator - it = this->GlobalGenerator->GetProjectMap().begin(); - it!= this->GlobalGenerator->GetProjectMap().end(); + for (std::map >::const_iterator + it = this->GlobalGenerator->GetProjectMap().begin(); + it!= this->GlobalGenerator->GetProjectMap().end(); ++it) { cmMakefile* mf = it->second[0]->GetMakefile(); @@ -94,7 +94,7 @@ void cmGlobalKdevelopGenerator::Generate() break; } } - + // now create a project file this->CreateProjectFile(outputDir, projectDir, projectName, executable, cmakeFilePattern, fileToOpen); @@ -103,7 +103,7 @@ void cmGlobalKdevelopGenerator::Generate() bool cmGlobalKdevelopGenerator ::CreateFilelistFile(const std::vector& lgs, - const std::string& outputDir, + const std::string& outputDir, const std::string& projectDirIn, const std::string& projectname, std::string& cmakeFilePattern, @@ -115,24 +115,24 @@ bool cmGlobalKdevelopGenerator std::set files; std::string tmp; - for (std::vector::const_iterator it=lgs.begin(); + for (std::vector::const_iterator it=lgs.begin(); it!=lgs.end(); it++) { cmMakefile* makefile=(*it)->GetMakefile(); const std::vector& listFiles=makefile->GetListFiles(); - for (std::vector::const_iterator lt=listFiles.begin(); + for (std::vector::const_iterator lt=listFiles.begin(); lt!=listFiles.end(); lt++) { tmp=*lt; cmSystemTools::ReplaceString(tmp, projectDir.c_str(), ""); // make sure the file is part of this source tree - if ((tmp[0]!='/') && - (strstr(tmp.c_str(), + if ((tmp[0]!='/') && + (strstr(tmp.c_str(), cmake::GetCMakeFilesDirectoryPostSlash())==0)) { files.insert(tmp); tmp=cmSystemTools::GetFilenameName(tmp); - //add all files which dont match the default + //add all files which dont match the default // */CMakeLists.txt;*cmake; to the file pattern if ((tmp!="CMakeLists.txt") && (strstr(tmp.c_str(), ".cmake")==0)) @@ -141,7 +141,7 @@ bool cmGlobalKdevelopGenerator } } } - + //get all sources cmTargets& targets=makefile->GetTargets(); for (cmTargets::iterator ti = targets.begin(); @@ -158,8 +158,8 @@ bool cmGlobalKdevelopGenerator cmSystemTools::ReplaceString(tmp, projectDir.c_str(), ""); - if ((tmp[0]!='/') && - (strstr(tmp.c_str(), + if ((tmp[0]!='/') && + (strstr(tmp.c_str(), cmake::GetCMakeFilesDirectoryPostSlash())==0) && (cmSystemTools::GetFilenameExtension(tmp)!=".moc")) { @@ -187,8 +187,8 @@ bool cmGlobalKdevelopGenerator { tmp=*lt; cmSystemTools::ReplaceString(tmp, projectDir.c_str(), ""); - if ((tmp[0]!='/') && - (strstr(tmp.c_str(), + if ((tmp[0]!='/') && + (strstr(tmp.c_str(), cmake::GetCMakeFilesDirectoryPostSlash())==0)) { files.insert(tmp.c_str()); @@ -223,9 +223,9 @@ bool cmGlobalKdevelopGenerator { return false; } - + fileToOpen=""; - for (std::set::const_iterator it=files.begin(); + for (std::set::const_iterator it=files.begin(); it!=files.end(); it++) { // get the full path to the file @@ -257,7 +257,7 @@ existing one, otherwise create a new one */ void cmGlobalKdevelopGenerator ::CreateProjectFile(const std::string& outputDir, const std::string& projectDir, - const std::string& projectname, + const std::string& projectname, const std::string& executable, const std::string& cmakeFilePattern, const std::string& fileToOpen) @@ -271,13 +271,13 @@ void cmGlobalKdevelopGenerator if (cmSystemTools::FileExists(filename.c_str())) { - this->MergeProjectFiles(outputDir, projectDir, filename, - executable, cmakeFilePattern, + this->MergeProjectFiles(outputDir, projectDir, filename, + executable, cmakeFilePattern, fileToOpen, sessionFilename); } else { - // add all subdirectories which are cmake build directories to the + // add all subdirectories which are cmake build directories to the // kdevelop blacklist so they are not monitored for added or removed files // since this is handled by adding files to the cmake files cmsys::Directory d; @@ -295,7 +295,7 @@ void cmGlobalKdevelopGenerator if (cmSystemTools::FileIsDirectory(tmp.c_str())) { tmp += "/CMakeCache.txt"; - if ((nextFile == "CMakeFiles") + if ((nextFile == "CMakeFiles") || (cmSystemTools::FileExists(tmp.c_str()))) { this->Blacklist.push_back(nextFile); @@ -305,17 +305,17 @@ void cmGlobalKdevelopGenerator } } this->CreateNewProjectFile(outputDir, projectDir, filename, - executable, cmakeFilePattern, + executable, cmakeFilePattern, fileToOpen, sessionFilename); } } void cmGlobalKdevelopGenerator -::MergeProjectFiles(const std::string& outputDir, - const std::string& projectDir, - const std::string& filename, - const std::string& executable, +::MergeProjectFiles(const std::string& outputDir, + const std::string& projectDir, + const std::string& filename, + const std::string& executable, const std::string& cmakeFilePattern, const std::string& fileToOpen, const std::string& sessionFilename) @@ -323,8 +323,8 @@ void cmGlobalKdevelopGenerator std::ifstream oldProjectFile(filename.c_str()); if (!oldProjectFile) { - this->CreateNewProjectFile(outputDir, projectDir, filename, - executable, cmakeFilePattern, + this->CreateNewProjectFile(outputDir, projectDir, filename, + executable, cmakeFilePattern, fileToOpen, sessionFilename); return; } @@ -346,7 +346,7 @@ void cmGlobalKdevelopGenerator return; } - for (std::vector::const_iterator it=lines.begin(); + for (std::vector::const_iterator it=lines.begin(); it!=lines.end(); it++) { const char* line=(*it).c_str(); @@ -368,7 +368,7 @@ void cmGlobalKdevelopGenerator if (strstr(line, "")) { fout<< " KDevCustomProject\n"; - fout<< " " <" <\n"; //this one is important fout<<" true\n"; //and this one @@ -407,7 +407,7 @@ void cmGlobalKdevelopGenerator bool hasSvn = cmSystemTools::FileExists((projectDir + "/.svn").c_str()); bool hasCvs = cmSystemTools::FileExists((projectDir + "/CVS").c_str()); - bool enableCxx = (this->GlobalGenerator->GetLanguageEnabled("C") + bool enableCxx = (this->GlobalGenerator->GetLanguageEnabled("C") || this->GlobalGenerator->GetLanguageEnabled("CXX")); bool enableFortran = this->GlobalGenerator->GetLanguageEnabled("Fortran"); std::string primaryLanguage = "C++"; @@ -425,7 +425,7 @@ void cmGlobalKdevelopGenerator " KDevCustomProject\n" " " << primaryLanguage << "\n" " \n" - " " << projectDir.c_str() << + " " << projectDir.c_str() << "\n"; //this one is important fout<<" true\n"; //and this one @@ -472,7 +472,7 @@ void cmGlobalKdevelopGenerator " 1\n" " false\n" " " << this->GlobalGenerator->GetLocalGenerators()[0]-> - GetMakefile()->GetRequiredDefinition("CMAKE_BUILD_TOOL") + GetMakefile()->GetRequiredDefinition("CMAKE_BUILD_TOOL") << " \n" " default\n" " \n" diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index 820e7e605..d49639bef 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -22,7 +22,7 @@ cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator() this->UseLinkScript = false; } -std::string +std::string cmGlobalMSYSMakefileGenerator::FindMinGW(std::string const& makeloc) { std::string fstab = makeloc; @@ -45,8 +45,8 @@ cmGlobalMSYSMakefileGenerator::FindMinGW(std::string const& makeloc) } void cmGlobalMSYSMakefileGenerator -::EnableLanguage(std::vectorconst& l, - cmMakefile *mf, +::EnableLanguage(std::vectorconst& l, + cmMakefile *mf, bool optional) { this->FindMakeProgram(mf); @@ -106,9 +106,9 @@ cmLocalGenerator *cmGlobalMSYSMakefileGenerator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalMSYSMakefileGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalMSYSMakefileGenerator::GetActualName(); entry.Brief = "Generates MSYS makefiles."; entry.Full = "The makefiles use /bin/sh as the shell. " "They require msys to be installed on the machine."; diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h index b5294acd5..659de1186 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.h +++ b/Source/cmGlobalMSYSMakefileGenerator.h @@ -23,8 +23,9 @@ class cmGlobalMSYSMakefileGenerator : public cmGlobalUnixMakefileGenerator3 { public: cmGlobalMSYSMakefileGenerator(); - static cmGlobalGenerator* New() { - return new cmGlobalMSYSMakefileGenerator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + (); } ///! Get the name for the generator. virtual const char* GetName() const { @@ -32,14 +33,14 @@ public: static const char* GetActualName() {return "MSYS Makefiles";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - + static void GetDocumentation(cmDocumentationEntry& entry); + ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); /** * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. + * extension, pthreads, byte order etc. */ virtual void EnableLanguage(std::vectorconst& languages, cmMakefile *, bool optional); diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index a9e779847..1f374d3b8 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -22,37 +22,11 @@ cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator() } void cmGlobalMinGWMakefileGenerator -::EnableLanguage(std::vectorconst& l, - cmMakefile *mf, +::EnableLanguage(std::vectorconst& l, + cmMakefile *mf, bool optional) -{ - this->FindMakeProgram(mf); - std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); - std::vector locations; - locations.push_back(cmSystemTools::GetProgramPath(makeProgram.c_str())); - locations.push_back("/mingw/bin"); - locations.push_back("c:/mingw/bin"); - std::string tgcc = cmSystemTools::FindProgram("gcc", locations); - std::string gcc = "gcc.exe"; - if(tgcc.size()) - { - gcc = tgcc; - } - std::string tgxx = cmSystemTools::FindProgram("g++", locations); - std::string gxx = "g++.exe"; - if(tgxx.size()) - { - gxx = tgxx; - } - std::string trc = cmSystemTools::FindProgram("windres", locations); - std::string rc = "windres.exe"; - if(trc.size()) - { - rc = trc; - } - mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str()); - mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str()); - mf->AddDefinition("CMAKE_GENERATOR_RC", rc.c_str()); +{ + this->EnableMinGWLanguage(mf); this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } @@ -71,9 +45,9 @@ cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalMinGWMakefileGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalMinGWMakefileGenerator::GetActualName(); entry.Brief = "Generates a make file for use with mingw32-make."; entry.Full = "The makefiles generated use cmd.exe as the shell. " "They do not require msys or a unix shell."; diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h index 366146b0a..7951e9886 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.h +++ b/Source/cmGlobalMinGWMakefileGenerator.h @@ -23,22 +23,23 @@ class cmGlobalMinGWMakefileGenerator : public cmGlobalUnixMakefileGenerator3 { public: cmGlobalMinGWMakefileGenerator(); - static cmGlobalGenerator* New() { - return new cmGlobalMinGWMakefileGenerator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + (); } ///! Get the name for the generator. virtual const char* GetName() const { return cmGlobalMinGWMakefileGenerator::GetActualName();} static const char* GetActualName() {return "MinGW Makefiles";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - + static void GetDocumentation(cmDocumentationEntry& entry); + ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); /** * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. + * extension, pthreads, byte order etc. */ virtual void EnableLanguage(std::vectorconst& languages, cmMakefile *, bool optional); diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index c3c15e70f..7af4ee3a8 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -22,14 +22,14 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator() } void cmGlobalNMakeMakefileGenerator -::EnableLanguage(std::vectorconst& l, - cmMakefile *mf, +::EnableLanguage(std::vectorconst& l, + cmMakefile *mf, bool optional) { - // pick a default + // pick a default mf->AddDefinition("CMAKE_GENERATOR_CC", "cl"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); - if(!(cmSystemTools::GetEnv("INCLUDE") && + if(!(cmSystemTools::GetEnv("INCLUDE") && cmSystemTools::GetEnv("LIB")) ) { @@ -40,7 +40,7 @@ void cmGlobalNMakeMakefileGenerator mf->IssueMessage(cmake::WARNING, message); } - + this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } @@ -61,9 +61,9 @@ cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalNMakeMakefileGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalNMakeMakefileGenerator::GetActualName(); entry.Brief = "Generates NMake makefiles."; entry.Full = ""; } diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index 70a8c1909..5756fbd0d 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -23,22 +23,23 @@ class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator3 { public: cmGlobalNMakeMakefileGenerator(); - static cmGlobalGenerator* New() { - return new cmGlobalNMakeMakefileGenerator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + (); } ///! Get the name for the generator. virtual const char* GetName() const { return cmGlobalNMakeMakefileGenerator::GetActualName();} static const char* GetActualName() {return "NMake Makefiles";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - + static void GetDocumentation(cmDocumentationEntry& entry); + ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); /** * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. + * extension, pthreads, byte order etc. */ virtual void EnableLanguage(std::vectorconst& languages, cmMakefile *, bool optional); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 3f3cfbbb1..fa277b1d1 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -17,6 +17,8 @@ #include "cmGeneratorTarget.h" #include "cmVersion.h" +#include + const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja"; const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = "rules.ninja"; const char* cmGlobalNinjaGenerator::INDENT = " "; @@ -83,6 +85,7 @@ std::string cmGlobalNinjaGenerator::EncodeLiteral(const std::string &lit) { std::string result = lit; cmSystemTools::ReplaceString(result, "$", "$$"); + cmSystemTools::ReplaceString(result, "\n", "$\n"); return result; } @@ -106,6 +109,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, const cmNinjaDeps& implicitDeps, const cmNinjaDeps& orderOnlyDeps, const cmNinjaVars& variables, + const std::string& rspfile, int cmdLineLimit) { // Make sure there is a rule. @@ -181,12 +185,17 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, // check if a response file rule should be used std::string buildstr = build.str(); - const std::string assignments = variable_assignments.str(); + std::string assignments = variable_assignments.str(); const std::string args = arguments.str(); if (cmdLineLimit > 0 && args.size() + buildstr.size() + assignments.size() - > (size_t) cmdLineLimit) - buildstr += "_RSPFILE"; + > (size_t) cmdLineLimit) { + buildstr += "_RSP_FILE"; + variable_assignments.clear(); + cmGlobalNinjaGenerator::WriteVariable(variable_assignments, + "RSP_FILE", rspfile, "", 1); + assignments += variable_assignments.str(); + } os << buildstr << args << assignments; } @@ -446,9 +455,9 @@ cmLocalGenerator* cmGlobalNinjaGenerator::CreateLocalGenerator() } void cmGlobalNinjaGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalNinjaGenerator::GetActualName(); entry.Brief = "Generates build.ninja files (experimental)."; entry.Full = "A build.ninja file is generated into the build tree. Recent " @@ -485,69 +494,20 @@ void cmGlobalNinjaGenerator::Generate() // Used in: // Source/cmMakefile.cxx: void cmGlobalNinjaGenerator -::EnableLanguage(std::vectorconst& languages, - cmMakefile *mf, +::EnableLanguage(std::vectorconst& langs, + cmMakefile* makefile, bool optional) { - std::string path; - for(std::vector::const_iterator l = languages.begin(); - l != languages.end(); ++l) + if (makefile->IsOn("CMAKE_COMPILER_IS_MINGW")) { - std::vector language; - language.push_back(*l); - - if(*l == "NONE") - { - this->cmGlobalGenerator::EnableLanguage(language, mf, optional); - continue; - } - else if(*l == "Fortran") - { - std::string message = "The \""; - message += this->GetName(); - message += "\" generator does not support the language \""; - message += *l; - message += "\" yet."; - cmSystemTools::Error(message.c_str()); - } - else if(*l == "RC") - { - // check if mingw is used - if(mf->IsOn("CMAKE_COMPILER_IS_MINGW")) - { - UsingMinGW = true; - if(!mf->GetDefinition("CMAKE_RC_COMPILER")) - { - std::string windres = cmSystemTools::FindProgram("windres"); - if(windres.empty()) - { - std::string compiler_path; - std::string::size_type prefix = std::string::npos; - if (mf->GetDefinition("CMAKE_C_COMPILER")) - { - compiler_path = mf->GetDefinition("CMAKE_C_COMPILER"); - prefix = compiler_path.rfind("gcc"); - } - else if (mf->GetDefinition("CMAKE_CXX_COMPILER")) - { - compiler_path = mf->GetDefinition("CMAKE_CXX_COMPILER"); - prefix = compiler_path.rfind("++"); - prefix--; - } - if (prefix != std::string::npos) - { - windres = compiler_path.substr(0, prefix) + "windres"; - windres = cmSystemTools::FindProgram(windres.c_str()); - } - } - if(!windres.empty()) - mf->AddDefinition("CMAKE_RC_COMPILER", windres.c_str()); - } - } - } - this->cmGlobalGenerator::EnableLanguage(language, mf, optional); - this->ResolveLanguageCompiler(*l, mf, optional); + UsingMinGW = true; + this->EnableMinGWLanguage(makefile); + } + if (std::find(langs.begin(), langs.end(), "Fortran") != langs.end()) + { + cmSystemTools::Error("The Ninja generator does not support Fortran yet."); } + this->cmGlobalGenerator::EnableLanguage(langs, makefile, optional); } bool cmGlobalNinjaGenerator::UsingMinGW = false; diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index b2fe24327..c3df7d935 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -14,6 +14,7 @@ # define cmGlobalNinjaGenerator_h # include "cmGlobalGenerator.h" +# include "cmGlobalGeneratorFactory.h" # include "cmNinjaTypes.h" //#define NINJA_GEN_VERBOSE_FILES @@ -84,6 +85,7 @@ public: const cmNinjaDeps& implicitDeps, const cmNinjaDeps& orderOnlyDeps, const cmNinjaVars& variables, + const std::string& rspfile = std::string(), int cmdLineLimit = -1); /** @@ -159,8 +161,8 @@ public: cmGlobalNinjaGenerator(); /// Convenience method for creating an instance of this class. - static cmGlobalGenerator* New() { - return new cmGlobalNinjaGenerator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory(); } /// Destructor. virtual ~cmGlobalNinjaGenerator() { } @@ -176,7 +178,7 @@ public: static const char* GetActualName() { return "Ninja"; } /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation() - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); /// Overloaded methods. @see cmGlobalGenerator::Generate() virtual void Generate(); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index ebd82194c..e26cca940 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -61,9 +61,9 @@ cmLocalGenerator *cmGlobalUnixMakefileGenerator3::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalUnixMakefileGenerator3 -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalUnixMakefileGenerator3::GetActualName(); entry.Brief = "Generates standard UNIX makefiles."; entry.Full = "A hierarchy of UNIX makefiles is generated into the build tree. Any " diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index e6dd09d6d..385cdc4a1 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -13,6 +13,7 @@ #define cmGlobalUnixMakefileGenerator3_h #include "cmGlobalGenerator.h" +#include "cmGlobalGeneratorFactory.h" class cmGeneratedFileStream; class cmMakefileTargetGenerator; @@ -54,8 +55,9 @@ class cmGlobalUnixMakefileGenerator3 : public cmGlobalGenerator { public: cmGlobalUnixMakefileGenerator3(); - static cmGlobalGenerator* New() { - return new cmGlobalUnixMakefileGenerator3; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + (); } ///! Get the name for the generator. virtual const char* GetName() const { @@ -63,7 +65,7 @@ public: static const char* GetActualName() {return "Unix Makefiles";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator3 virtual cmLocalGenerator *CreateLocalGenerator(); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 947a1c99d..cac72fc4d 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -16,8 +16,61 @@ #include "cmSourceFile.h" #include "cmake.h" +static const char vs10Win32generatorName[] = "Visual Studio 10"; +static const char vs10Win64generatorName[] = "Visual Studio 10 Win64"; +static const char vs10IA64generatorName[] = "Visual Studio 10 IA64"; -cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator() +class cmGlobalVisualStudio10Generator::Factory + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { + if(!strcmp(name, vs10Win32generatorName)) + { + return new cmGlobalVisualStudio10Generator( + vs10Win32generatorName, NULL, NULL); + } + if(!strcmp(name, vs10Win64generatorName)) + { + return new cmGlobalVisualStudio10Generator( + vs10Win64generatorName, "x64", "CMAKE_FORCE_WIN64"); + } + if(!strcmp(name, vs10IA64generatorName)) + { + return new cmGlobalVisualStudio10Generator( + vs10IA64generatorName, "Itanium", "CMAKE_FORCE_IA64"); + } + return 0; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const { + entry.Name = "Visual Studio 10"; + entry.Brief = "Generates Visual Studio 10 project files."; + entry.Full = + "It is possible to append a space followed by the platform name " + "to create project files for a specific target platform. E.g. " + "\"Visual Studio 10 Win64\" will create project files for " + "the x64 processor; \"Visual Studio 10 IA64\" for Itanium."; + } + + virtual void GetGenerators(std::vector& names) const { + names.push_back(vs10Win32generatorName); + names.push_back(vs10Win64generatorName); + names.push_back(vs10IA64generatorName); } +}; + +//---------------------------------------------------------------------------- +cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory() +{ + return new Factory; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( + const char* name, const char* architectureId, + const char* additionalPlatformDefinition) + : cmGlobalVisualStudio8Generator(name, architectureId, + additionalPlatformDefinition) { this->FindMakeProgramFile = "CMakeVS10FindMake.cmake"; std::string vc10Express; @@ -26,12 +79,23 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator() "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32); } +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts) +{ + this->PlatformToolset = ts; + return true; +} + //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf) { - mf->AddDefinition("MSVC10", "1"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); + cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf); + if(!this->PlatformToolset.empty()) + { + mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", + this->PlatformToolset.c_str()); + } } //---------------------------------------------------------------------------- @@ -85,18 +149,16 @@ void cmGlobalVisualStudio10Generator::Generate() //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 10 project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10Generator -::EnableLanguage(std::vectorconst & lang, +::EnableLanguage(std::vectorconst & lang, cmMakefile *mf, bool optional) { + if(this->ArchitectureId == "Itanium" || this->ArchitectureId == "x64") + { + if(this->IsExpressEdition() && !this->Find64BitTools(mf)) + { + return; + } + } cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); } @@ -146,12 +208,12 @@ std::string cmGlobalVisualStudio10Generator::GetUserMacrosRegKeyBase() std::string cmGlobalVisualStudio10Generator ::GenerateBuildCommand(const char* makeProgram, - const char *projectName, + const char *projectName, const char* additionalOptions, const char *targetName, const char* config, bool ignoreErrors, bool fast) { // now build the test - std::string makeCommand + std::string makeCommand = cmSystemTools::ConvertToOutputPath(makeProgram); std::string lowerCaseCommand = makeCommand; cmSystemTools::LowerCase(lowerCaseCommand); @@ -177,7 +239,7 @@ std::string cmGlobalVisualStudio10Generator if(!targetName || strlen(targetName) == 0) { targetName = "ALL_BUILD"; - } + } bool clean = false; if ( targetName && strcmp(targetName, "clean") == 0 ) { @@ -202,6 +264,8 @@ std::string cmGlobalVisualStudio10Generator { makeCommand += "Debug"; } + makeCommand += " /p:VisualStudioVersion="; + makeCommand += this->GetIDEVersion(); if ( additionalOptions ) { makeCommand += " "; diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 060cdfff3..5926e0f21 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -20,28 +20,23 @@ * * cmGlobalVisualStudio10Generator manages UNIX build process for a tree */ -class cmGlobalVisualStudio10Generator : +class cmGlobalVisualStudio10Generator : public cmGlobalVisualStudio8Generator { public: - cmGlobalVisualStudio10Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio10Generator; } - - virtual std::string + cmGlobalVisualStudio10Generator(const char* name, + const char* architectureId, const char* additionalPlatformDefinition); + static cmGlobalGeneratorFactory* NewFactory(); + + virtual bool SetGeneratorToolset(std::string const& ts); + + virtual std::string GenerateBuildCommand(const char* makeProgram, - const char *projectName, + const char *projectName, const char* additionalOptions, const char *targetName, const char* config, bool ignoreErrors, bool); - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio10Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 10";} + virtual void AddPlatformDefinitions(cmMakefile* mf); - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; ///! create the correct local generator virtual cmLocalGenerator *CreateLocalGenerator(); @@ -50,9 +45,9 @@ public: /** * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. + * extension, pthreads, byte order etc. */ - virtual void EnableLanguage(std::vectorconst& languages, + virtual void EnableLanguage(std::vectorconst& languages, cmMakefile *, bool optional); virtual void WriteSLNHeader(std::ostream& fout); @@ -92,6 +87,7 @@ protected: bool UseFolderProperty(); private: + class Factory; struct LongestSourcePath { LongestSourcePath(): Length(0), Target(0), SourceFile(0) {} diff --git a/Source/cmGlobalVisualStudio10IA64Generator.cxx b/Source/cmGlobalVisualStudio10IA64Generator.cxx deleted file mode 100644 index 5f70f6bba..000000000 --- a/Source/cmGlobalVisualStudio10IA64Generator.cxx +++ /dev/null @@ -1,51 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "cmGlobalVisualStudio10IA64Generator.h" -#include "cmMakefile.h" -#include "cmake.h" - -//---------------------------------------------------------------------------- -cmGlobalVisualStudio10IA64Generator::cmGlobalVisualStudio10IA64Generator() -{ -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10IA64Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 10 Itanium project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10IA64Generator -::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64"); -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10IA64Generator -::EnableLanguage(std::vector const& languages, - cmMakefile* mf, bool optional) -{ - if(this->IsExpressEdition() && !this->Find64BitTools(mf)) - { - return; - } - this->cmGlobalVisualStudio10Generator - ::EnableLanguage(languages, mf, optional); -} diff --git a/Source/cmGlobalVisualStudio10IA64Generator.h b/Source/cmGlobalVisualStudio10IA64Generator.h deleted file mode 100644 index a088272ef..000000000 --- a/Source/cmGlobalVisualStudio10IA64Generator.h +++ /dev/null @@ -1,40 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmGlobalVisualStudio10IA64Generator_h -#define cmGlobalVisualStudio10IA64Generator_h - -#include "cmGlobalVisualStudio10Generator.h" - -class cmGlobalVisualStudio10IA64Generator : - public cmGlobalVisualStudio10Generator -{ -public: - cmGlobalVisualStudio10IA64Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio10IA64Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio10IA64Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 10 IA64";} - - virtual const char* GetPlatformName() const {return "Itanium";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - virtual void AddPlatformDefinitions(cmMakefile* mf); - - virtual void EnableLanguage(std::vectorconst& languages, - cmMakefile *, bool optional); -}; -#endif diff --git a/Source/cmGlobalVisualStudio10Win64Generator.cxx b/Source/cmGlobalVisualStudio10Win64Generator.cxx deleted file mode 100644 index 49dc47364..000000000 --- a/Source/cmGlobalVisualStudio10Win64Generator.cxx +++ /dev/null @@ -1,51 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "cmGlobalVisualStudio10Win64Generator.h" -#include "cmMakefile.h" -#include "cmake.h" - -//---------------------------------------------------------------------------- -cmGlobalVisualStudio10Win64Generator::cmGlobalVisualStudio10Win64Generator() -{ -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10Win64Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 10 Win64 project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10Win64Generator -::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64"); -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10Win64Generator -::EnableLanguage(std::vector const& languages, - cmMakefile* mf, bool optional) -{ - if(this->IsExpressEdition() && !this->Find64BitTools(mf)) - { - return; - } - this->cmGlobalVisualStudio10Generator - ::EnableLanguage(languages, mf, optional); -} diff --git a/Source/cmGlobalVisualStudio10Win64Generator.h b/Source/cmGlobalVisualStudio10Win64Generator.h deleted file mode 100644 index 8a2de4c0a..000000000 --- a/Source/cmGlobalVisualStudio10Win64Generator.h +++ /dev/null @@ -1,40 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmGlobalVisualStudio10Win64Generator_h -#define cmGlobalVisualStudio10Win64Generator_h - -#include "cmGlobalVisualStudio10Generator.h" - -class cmGlobalVisualStudio10Win64Generator : - public cmGlobalVisualStudio10Generator -{ -public: - cmGlobalVisualStudio10Win64Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio10Win64Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio10Win64Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 10 Win64";} - - virtual const char* GetPlatformName() const {return "x64";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - virtual void AddPlatformDefinitions(cmMakefile* mf); - - virtual void EnableLanguage(std::vectorconst& languages, - cmMakefile *, bool optional); -}; -#endif diff --git a/Source/cmGlobalVisualStudio11ARMGenerator.cxx b/Source/cmGlobalVisualStudio11ARMGenerator.cxx deleted file mode 100644 index fef1aba61..000000000 --- a/Source/cmGlobalVisualStudio11ARMGenerator.cxx +++ /dev/null @@ -1,32 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2011 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "cmGlobalVisualStudio11ARMGenerator.h" -#include "cmMakefile.h" -#include "cmake.h" - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio11ARMGenerator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 11 ARM project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio11ARMGenerator -::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio11Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "ARM"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "ARM"); -} diff --git a/Source/cmGlobalVisualStudio11ARMGenerator.h b/Source/cmGlobalVisualStudio11ARMGenerator.h deleted file mode 100644 index 77e142994..000000000 --- a/Source/cmGlobalVisualStudio11ARMGenerator.h +++ /dev/null @@ -1,37 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2011 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmGlobalVisualStudio11ARMGenerator_h -#define cmGlobalVisualStudio11ARMGenerator_h - -#include "cmGlobalVisualStudio11Generator.h" - -class cmGlobalVisualStudio11ARMGenerator : - public cmGlobalVisualStudio11Generator -{ -public: - cmGlobalVisualStudio11ARMGenerator() {} - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio11ARMGenerator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio11ARMGenerator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 11 ARM";} - - virtual const char* GetPlatformName() const {return "ARM";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - virtual void AddPlatformDefinitions(cmMakefile* mf); -}; -#endif diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index be7fd5572..b6d7d0452 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -13,20 +13,68 @@ #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +static const char vs11Win32generatorName[] = "Visual Studio 11"; +static const char vs11Win64generatorName[] = "Visual Studio 11 Win64"; +static const char vs11ARMgeneratorName[] = "Visual Studio 11 ARM"; + +class cmGlobalVisualStudio11Generator::Factory + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { + if(!strcmp(name, vs11Win32generatorName)) + { + return new cmGlobalVisualStudio11Generator( + vs11Win32generatorName, NULL, NULL); + } + if(!strcmp(name, vs11Win64generatorName)) + { + return new cmGlobalVisualStudio11Generator( + vs11Win64generatorName, "x64", "CMAKE_FORCE_WIN64"); + } + if(!strcmp(name, vs11ARMgeneratorName)) + { + return new cmGlobalVisualStudio11Generator( + vs11ARMgeneratorName, "ARM", NULL); + } + return 0; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const { + entry.Name = "Visual Studio 11"; + entry.Brief = "Generates Visual Studio 11 project files."; + entry.Full = + "It is possible to append a space followed by the platform name " + "to create project files for a specific target platform. E.g. " + "\"Visual Studio 11 Win64\" will create project files for " + "the x64 processor; \"Visual Studio 11 ARM\" for ARM."; + } + + virtual void GetGenerators(std::vector& names) const { + names.push_back(vs11Win32generatorName); + names.push_back(vs11Win64generatorName); + names.push_back(vs11ARMgeneratorName); } +}; + //---------------------------------------------------------------------------- -cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator() +cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory() { - this->FindMakeProgramFile = "CMakeVS11FindMake.cmake"; - this->ExpressEdition = false; // TODO: VS 11 Express support - this->PlatformToolset = "v110"; + return new Factory; } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio11Generator::AddPlatformDefinitions(cmMakefile* mf) +cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( + const char* name, const char* architectureId, + const char* additionalPlatformDefinition) + : cmGlobalVisualStudio10Generator(name, architectureId, + additionalPlatformDefinition) { - mf->AddDefinition("MSVC11", "1"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); + this->FindMakeProgramFile = "CMakeVS11FindMake.cmake"; + std::string vc11Express; + this->ExpressEdition = cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC;" + "ProductDir", vc11Express, cmSystemTools::KeyWOW64_32); + this->PlatformToolset = "v110"; } //---------------------------------------------------------------------------- @@ -47,10 +95,10 @@ cmLocalGenerator *cmGlobalVisualStudio11Generator::CreateLocalGenerator() } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio11Generator -::GetDocumentation(cmDocumentationEntry& entry) const +bool cmGlobalVisualStudio11Generator::UseFolderProperty() { - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 11 project files."; - entry.Full = ""; + // Intentionally skip over the parent class implementation and call the + // grand-parent class's implementation. Folders are not supported by the + // Express editions in VS10 and earlier, but they are in VS11 Express. + return cmGlobalVisualStudio8Generator::UseFolderProperty(); } diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 7e8f6aa4e..174f1ccb0 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -20,21 +20,12 @@ class cmGlobalVisualStudio11Generator: public cmGlobalVisualStudio10Generator { public: - cmGlobalVisualStudio11Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio11Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio11Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 11";} - virtual void AddPlatformDefinitions(cmMakefile* mf); + cmGlobalVisualStudio11Generator(const char* name, + const char* architectureId, const char* additionalPlatformDefinition); + static cmGlobalGeneratorFactory* NewFactory(); virtual void WriteSLNHeader(std::ostream& fout); - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - ///! create the correct local generator virtual cmLocalGenerator *CreateLocalGenerator(); @@ -42,5 +33,8 @@ public: virtual std::string GetUserMacrosDirectory() { return ""; } protected: virtual const char* GetIDEVersion() { return "11.0"; } + bool UseFolderProperty(); +private: + class Factory; }; #endif diff --git a/Source/cmGlobalVisualStudio11Win64Generator.cxx b/Source/cmGlobalVisualStudio11Win64Generator.cxx deleted file mode 100644 index 10c902753..000000000 --- a/Source/cmGlobalVisualStudio11Win64Generator.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2011 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "cmGlobalVisualStudio11Win64Generator.h" -#include "cmMakefile.h" -#include "cmake.h" - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio11Win64Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 11 Win64 project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio11Win64Generator -::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio11Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64"); -} diff --git a/Source/cmGlobalVisualStudio11Win64Generator.h b/Source/cmGlobalVisualStudio11Win64Generator.h deleted file mode 100644 index 53f19538c..000000000 --- a/Source/cmGlobalVisualStudio11Win64Generator.h +++ /dev/null @@ -1,37 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2011 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmGlobalVisualStudio11Win64Generator_h -#define cmGlobalVisualStudio11Win64Generator_h - -#include "cmGlobalVisualStudio11Generator.h" - -class cmGlobalVisualStudio11Win64Generator : - public cmGlobalVisualStudio11Generator -{ -public: - cmGlobalVisualStudio11Win64Generator() {} - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio11Win64Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio11Win64Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 11 Win64";} - - virtual const char* GetPlatformName() const {return "x64";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - virtual void AddPlatformDefinitions(cmMakefile* mf); -}; -#endif diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index fe44e200e..9f3af71bb 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -36,18 +36,13 @@ cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator() } void cmGlobalVisualStudio6Generator -::EnableLanguage(std::vectorconst& lang, - cmMakefile *mf, +::EnableLanguage(std::vectorconst& lang, + cmMakefile *mf, bool optional) { - mf->AddDefinition("CMAKE_GENERATOR_CC", "cl"); - mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); - mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); + cmGlobalVisualStudioGenerator::AddPlatformDefinitions(mf); + mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); - mf->AddDefinition("CMAKE_GENERATOR_Fortran", "ifort"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); - mf->AddDefinition("MSVC60", "1"); this->GenerateConfigurations(mf); this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); } @@ -84,10 +79,10 @@ void cmGlobalVisualStudio6Generator::GenerateConfigurations(cmMakefile* mf) std::string cmGlobalVisualStudio6Generator ::GenerateBuildCommand(const char* makeProgram, - const char *projectName, - const char* additionalOptions, + const char *projectName, + const char* additionalOptions, const char *targetName, - const char* config, + const char* config, bool ignoreErrors, bool) { @@ -100,7 +95,7 @@ std::string cmGlobalVisualStudio6Generator "\\6.0\\Setup;VsCommonDir]/MSDev98/Bin"); cmSystemTools::ExpandRegistryValues(mp[0]); std::string originalCommand = makeProgram; - std::string makeCommand = + std::string makeCommand = cmSystemTools::FindProgram(makeProgram, mp); if(makeCommand.size() == 0) { @@ -116,7 +111,7 @@ std::string cmGlobalVisualStudio6Generator // if there are spaces in the makeCommand, assume a full path // and convert it to a path with no spaces in it as the // RunSingleCommand does not like spaces -#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) if(makeCommand.find(' ') != std::string::npos) { cmSystemTools::GetShortPath(makeCommand.c_str(), makeCommand); @@ -202,7 +197,6 @@ void cmGlobalVisualStudio6Generator tt != orderedProjectTargets.end(); ++tt) { cmTarget* target = *tt; - cmMakefile* mf = target->GetMakefile(); // Write the project into the DSW file const char* expath = target->GetProperty("EXTERNAL_MSPROJECT"); if(expath) @@ -226,7 +220,7 @@ void cmGlobalVisualStudio6Generator } void cmGlobalVisualStudio6Generator -::OutputDSWFile(cmLocalGenerator* root, +::OutputDSWFile(cmLocalGenerator* root, std::vector& generators) { if(generators.size() == 0) @@ -250,7 +244,7 @@ void cmGlobalVisualStudio6Generator // output the DSW file void cmGlobalVisualStudio6Generator::OutputDSWFile() -{ +{ std::map >::iterator it; for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) { @@ -259,16 +253,16 @@ void cmGlobalVisualStudio6Generator::OutputDSWFile() } // Write a dsp file into the DSW file, -// Note, that dependencies from executables to +// Note, that dependencies from executables to // the libraries it uses are also done here -void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, +void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, const char* dspname, const char* dir, cmTarget& target) { fout << "#########################################################" "######################\n\n"; - fout << "Project: \"" << dspname << "\"=" + fout << "Project: \"" << dspname << "\"=" << dir << "\\" << dspname << ".dsp - Package Owner=<4>\n\n"; fout << "Package=<5>\n{{{\n}}}\n\n"; fout << "Package=<4>\n"; @@ -304,22 +298,22 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, // Write a dsp file into the DSW file, -// Note, that dependencies from executables to +// Note, that dependencies from executables to // the libraries it uses are also done here -void cmGlobalVisualStudio6Generator::WriteExternalProject(std::ostream& fout, +void cmGlobalVisualStudio6Generator::WriteExternalProject(std::ostream& fout, const char* name, const char* location, const std::set& dependencies) { fout << "#########################################################" "######################\n\n"; - fout << "Project: \"" << name << "\"=" + fout << "Project: \"" << name << "\"=" << location << " - Package Owner=<4>\n\n"; fout << "Package=<5>\n{{{\n}}}\n\n"; fout << "Package=<4>\n"; fout << "{{{\n"; - + std::set::const_iterator i, end; // write dependencies. i = dependencies.begin(); @@ -347,7 +341,7 @@ void cmGlobalVisualStudio6Generator::WriteDSWFooter(std::ostream& fout) "##########################\n\n"; } - + // ouput standard header for dsw file void cmGlobalVisualStudio6Generator::WriteDSWHeader(std::ostream& fout) { @@ -400,9 +394,9 @@ cmGlobalVisualStudio6Generator::WriteUtilityDepend(cmTarget* target) //---------------------------------------------------------------------------- void cmGlobalVisualStudio6Generator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalVisualStudio6Generator::GetActualName(); entry.Brief = "Generates Visual Studio 6 project files."; entry.Full = ""; } diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index da08a125b..40149e911 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -13,6 +13,7 @@ #define cmGlobalVisualStudio6Generator_h #include "cmGlobalVisualStudioGenerator.h" +#include "cmGlobalGeneratorFactory.h" class cmTarget; @@ -25,25 +26,26 @@ class cmGlobalVisualStudio6Generator : public cmGlobalVisualStudioGenerator { public: cmGlobalVisualStudio6Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio6Generator; } - + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + (); } + ///! Get the name for the generator. virtual const char* GetName() const { return cmGlobalVisualStudio6Generator::GetActualName();} static const char* GetActualName() {return "Visual Studio 6";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - + static void GetDocumentation(cmDocumentationEntry& entry); + ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); /** * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. + * extension, pthreads, byte order etc. */ - virtual void EnableLanguage(std::vectorconst& languages, + virtual void EnableLanguage(std::vectorconst& languages, cmMakefile *, bool optional); /** @@ -52,8 +54,8 @@ public: */ virtual std::string GenerateBuildCommand(const char* makeProgram, const char *projectName, - const char* additionalOptions, - const char *targetName, + const char* additionalOptions, + const char *targetName, const char* config, bool ignoreErrors, bool fast); @@ -61,7 +63,7 @@ public: /** * Generate the all required files for building this project/tree. This * basically creates a series of LocalGenerators for each directory and - * requests that they Generate. + * requests that they Generate. */ virtual void Generate(); @@ -90,9 +92,9 @@ private: void GenerateConfigurations(cmMakefile* mf); void WriteDSWFile(std::ostream& fout); void WriteDSWHeader(std::ostream& fout); - void WriteProject(std::ostream& fout, + void WriteProject(std::ostream& fout, const char* name, const char* path, cmTarget &t); - void WriteExternalProject(std::ostream& fout, + void WriteExternalProject(std::ostream& fout, const char* name, const char* path, const std::set& dependencies); void WriteDSWFooter(std::ostream& fout); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index d6b653ca6..2494f559c 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -33,14 +33,6 @@ cmLocalGenerator *cmGlobalVisualStudio71Generator::CreateLocalGenerator() return lg; } -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio71Generator::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio7Generator::AddPlatformDefinitions(mf); - mf->RemoveDefinition("MSVC70"); - mf->AddDefinition("MSVC71", "1"); -} - //---------------------------------------------------------------------------- std::string cmGlobalVisualStudio71Generator::GetUserMacrosDirectory() { @@ -99,7 +91,7 @@ void cmGlobalVisualStudio71Generator ::WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, std::vector& generators) -{ +{ // Write out the header for a SLN file this->WriteSLNHeader(fout); @@ -136,6 +128,9 @@ void cmGlobalVisualStudio71Generator fout << "\tEndGlobalSection\n"; } + // Write out global sections + this->WriteSLNGlobalSections(fout, root); + // Write the footer for the SLN file this->WriteSLNFooter(fout); } @@ -156,7 +151,7 @@ cmGlobalVisualStudio71Generator //---------------------------------------------------------------------------- // Write a dsp file into the SLN file, -// Note, that dependencies from executables to +// Note, that dependencies from executables to // the libraries it uses are also done here void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, @@ -166,11 +161,11 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, { // check to see if this is a fortran build const char* ext = ".vcproj"; - const char* project = + const char* project = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""; if(this->TargetIsFortranOnly(t)) { - ext = ".vfproj"; + ext = ".vfproj"; project = "Project(\"{6989167D-11E4-40FE-8C1A-2192A86A7E90}\") = \""; } const char* targetExt = t.GetProperty("GENERATOR_FILE_NAME_EXT"); @@ -187,7 +182,7 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, fout << "\tProjectSection(ProjectDependencies) = postProject\n"; this->WriteProjectDepends(fout, dspname, dir, t); fout << "\tEndProjectSection\n"; - + fout <<"EndProject\n"; UtilityDependsMap::iterator ui = this->UtilityDepends.find(&t); @@ -208,7 +203,7 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, //---------------------------------------------------------------------------- // Write a dsp file into the SLN file, -// Note, that dependencies from executables to +// Note, that dependencies from executables to // the libraries it uses are also done here void cmGlobalVisualStudio71Generator @@ -238,12 +233,12 @@ cmGlobalVisualStudio71Generator // Write a dsp file into the SLN file, Note, that dependencies from // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator -::WriteExternalProject(std::ostream& fout, +::WriteExternalProject(std::ostream& fout, const char* name, const char* location, const char* typeGuid, const std::set& depends) -{ +{ fout << "Project(\"{" << (typeGuid ? typeGuid : "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942") << "}\") = \"" @@ -251,7 +246,7 @@ void cmGlobalVisualStudio71Generator << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) << "}\"\n"; - + // write out the dependencies here VS 7.1 includes dependencies with the // project instead of in the global section if(!depends.empty()) @@ -262,18 +257,18 @@ void cmGlobalVisualStudio71Generator { if(it->size() > 0) { - fout << "\t\t{" - << this->GetGUID(it->c_str()) - << "} = {" - << this->GetGUID(it->c_str()) + fout << "\t\t{" + << this->GetGUID(it->c_str()) + << "} = {" + << this->GetGUID(it->c_str()) << "}\n"; } } fout << "\tEndProjectSection\n"; - } + } fout << "EndProject\n"; - + } @@ -281,18 +276,21 @@ void cmGlobalVisualStudio71Generator // Write a dsp file into the SLN file, Note, that dependencies from // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator -::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild, - const char* platformMapping) +::WriteProjectConfigurations( + std::ostream& fout, const char* name, cmTarget::TargetType, + const std::set& configsPartOfDefaultBuild, + const char* platformMapping) { std::string guid = this->GetGUID(name); for(std::vector::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { - fout << "\t\t{" << guid << "}." << *i + fout << "\t\t{" << guid << "}." << *i << ".ActiveCfg = " << *i << "|" << (platformMapping ? platformMapping : "Win32") << std::endl; - if(partOfDefaultBuild) + std::set::const_iterator + ci = configsPartOfDefaultBuild.find(*i); + if(!(ci == configsPartOfDefaultBuild.end())) { fout << "\t\t{" << guid << "}." << *i << ".Build.0 = " << *i << "|" @@ -301,17 +299,6 @@ void cmGlobalVisualStudio71Generator } } -//---------------------------------------------------------------------------- -// Standard end of dsw file -void cmGlobalVisualStudio71Generator::WriteSLNFooter(std::ostream& fout) -{ - fout << "\tGlobalSection(ExtensibilityGlobals) = postSolution\n" - << "\tEndGlobalSection\n" - << "\tGlobalSection(ExtensibilityAddIns) = postSolution\n" - << "\tEndGlobalSection\n" - << "EndGlobal\n"; -} - //---------------------------------------------------------------------------- // ouput standard header for dsw file void cmGlobalVisualStudio71Generator::WriteSLNHeader(std::ostream& fout) @@ -321,9 +308,9 @@ void cmGlobalVisualStudio71Generator::WriteSLNHeader(std::ostream& fout) //---------------------------------------------------------------------------- void cmGlobalVisualStudio71Generator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalVisualStudio71Generator::GetActualName(); entry.Brief = "Generates Visual Studio .NET 2003 project files."; entry.Full = ""; } diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 503b708e5..6d91f97fc 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -24,17 +24,18 @@ class cmGlobalVisualStudio71Generator : public cmGlobalVisualStudio7Generator { public: cmGlobalVisualStudio71Generator(); - static cmGlobalGenerator* New() - { return new cmGlobalVisualStudio71Generator; } - + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + (); } + ///! Get the name for the generator. virtual const char* GetName() const { return cmGlobalVisualStudio71Generator::GetActualName();} static const char* GetActualName() {return "Visual Studio 7 .NET 2003";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - + static void GetDocumentation(cmDocumentationEntry& entry); + ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); @@ -53,25 +54,23 @@ public: protected: virtual const char* GetIDEVersion() { return "7.1"; } - virtual void AddPlatformDefinitions(cmMakefile* mf); - virtual void WriteSLNFile(std::ostream& fout, + virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, std::vector& generators); virtual void WriteSolutionConfigurations(std::ostream& fout); - virtual void WriteProject(std::ostream& fout, + virtual void WriteProject(std::ostream& fout, const char* name, const char* path, cmTarget &t); - virtual void WriteProjectDepends(std::ostream& fout, + virtual void WriteProjectDepends(std::ostream& fout, const char* name, const char* path, cmTarget &t); - virtual void WriteProjectConfigurations(std::ostream& fout, - const char* name, - bool partOfDefaultBuild, - const char* platformMapping = NULL); + virtual void WriteProjectConfigurations( + std::ostream& fout, const char* name, cmTarget::TargetType type, + const std::set& configsPartOfDefaultBuild, + const char* platformMapping = NULL); virtual void WriteExternalProject(std::ostream& fout, const char* name, const char* path, const char* typeGuid, const std::set& depends); - virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout); std::string ProjectConfigurationSectionName; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 6332d0b10..63cbdb890 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -10,6 +10,7 @@ See the License for more information. ============================================================================*/ #include "windows.h" // this must be first to define GetCurrentDirectory +#include #include "cmGlobalVisualStudio7Generator.h" #include "cmGeneratedFileStream.h" #include "cmLocalVisualStudio7Generator.h" @@ -23,22 +24,20 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator() void cmGlobalVisualStudio7Generator -::EnableLanguage(std::vectorconst & lang, +::EnableLanguage(std::vectorconst & lang, cmMakefile *mf, bool optional) { - mf->AddDefinition("CMAKE_GENERATOR_CC", "cl"); - mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); mf->AddDefinition("CMAKE_GENERATOR_FC", "ifort"); this->AddPlatformDefinitions(mf); - + // Create list of configurations requested by user's cache, if any. this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); this->GenerateConfigurations(mf); - + // if this environment variable is set, then copy it to - // a static cache entry. It will be used by + // a static cache entry. It will be used by // cmLocalGenerator::ConstructScript, to add an extra PATH // to all custom commands. This is because the VS IDE // does not use the environment it is run in, and this allows @@ -48,23 +47,16 @@ void cmGlobalVisualStudio7Generator if(extraPath) { mf->AddCacheDefinition - ("CMAKE_MSVCIDE_RUN_PATH", extraPath, + ("CMAKE_MSVCIDE_RUN_PATH", extraPath, "Saved environment variable CMAKE_MSVCIDE_RUN_PATH", cmCacheManager::STATIC); } } -void cmGlobalVisualStudio7Generator::AddPlatformDefinitions(cmMakefile* mf) -{ - mf->AddDefinition("MSVC70", "1"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); -} - std::string cmGlobalVisualStudio7Generator ::GenerateBuildCommand(const char* makeProgram, - const char *projectName, + const char *projectName, const char* additionalOptions, const char *targetName, const char* config, bool ignoreErrors, bool) { @@ -72,7 +64,7 @@ std::string cmGlobalVisualStudio7Generator (void) ignoreErrors; // now build the test - std::string makeCommand = + std::string makeCommand = cmSystemTools::ConvertToOutputPath(makeProgram); std::string lowerCaseCommand = makeCommand; cmSystemTools::LowerCase(lowerCaseCommand); @@ -80,7 +72,7 @@ std::string cmGlobalVisualStudio7Generator // if there are spaces in the makeCommand, assume a full path // and convert it to a path with no spaces in it as the // RunSingleCommand does not like spaces -#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) if(makeCommand.find(' ') != std::string::npos) { cmSystemTools::GetShortPath(makeCommand.c_str(), makeCommand); @@ -143,7 +135,7 @@ cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator() void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf) { // process the configurations - const char* ct + const char* ct = this->CMakeInstance->GetCacheDefinition("CMAKE_CONFIGURATION_TYPES"); if ( ct ) { @@ -152,7 +144,7 @@ void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf) for(std::vector::iterator i = argsOut.begin(); i != argsOut.end(); ++i) { - if(std::find(this->Configurations.begin(), + if(std::find(this->Configurations.begin(), this->Configurations.end(), *i) == this->Configurations.end()) { @@ -166,7 +158,7 @@ void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf) this->Configurations.push_back("Debug"); this->Configurations.push_back("Release"); } - + // Reset the entry to have a semi-colon separated list. std::string configs = this->Configurations[0]; for(unsigned int i=1; i < this->Configurations.size(); ++i) @@ -237,7 +229,7 @@ void cmGlobalVisualStudio7Generator::OutputSLNFile() void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( - std::ostream& fout, + std::ostream& fout, cmLocalGenerator* root, OrderedTargetDependSet const& projectTargets) { @@ -250,20 +242,23 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( const char* expath = target->GetProperty("EXTERNAL_MSPROJECT"); if(expath) { + std::set allConfigurations(this->Configurations.begin(), + this->Configurations.end()); this->WriteProjectConfigurations( - fout, target->GetName(), - true, target->GetProperty("VS_PLATFORM_MAPPING")); + fout, target->GetName(), target->GetType(), + allConfigurations, target->GetProperty("VS_PLATFORM_MAPPING")); } else { - bool partOfDefaultBuild = this->IsPartOfDefaultBuild( - root->GetMakefile()->GetProjectName(), target); - const char *vcprojName = + const std::set& configsPartOfDefaultBuild = + this->IsPartOfDefaultBuild(root->GetMakefile()->GetProjectName(), + target); + const char *vcprojName = target->GetProperty("GENERATOR_FILE_NAME"); if (vcprojName) { - this->WriteProjectConfigurations(fout, vcprojName, - partOfDefaultBuild); + this->WriteProjectConfigurations(fout, vcprojName, target->GetType(), + configsPartOfDefaultBuild); } } } @@ -275,6 +270,8 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( cmLocalGenerator* root, OrderedTargetDependSet const& projectTargets) { + VisualStudioFolders.clear(); + for(OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { @@ -369,13 +366,13 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends( projectTargets.begin(); tt != projectTargets.end(); ++tt) { cmTarget* target = *tt; - cmMakefile* mf = target->GetMakefile(); - const char *vcprojName = + cmMakefile* mf = target->GetMakefile(); + const char *vcprojName = target->GetProperty("GENERATOR_FILE_NAME"); if (vcprojName) - { + { std::string dir = mf->GetStartDirectory(); - this->WriteProjectDepends(fout, vcprojName, + this->WriteProjectDepends(fout, vcprojName, dir.c_str(), *target); } } @@ -409,7 +406,7 @@ void cmGlobalVisualStudio7Generator // Write out the configurations information for the solution fout << "Global\n" << "\tGlobalSection(SolutionConfiguration) = preSolution\n"; - + int c = 0; for(std::vector::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) @@ -418,7 +415,7 @@ void cmGlobalVisualStudio7Generator c++; } fout << "\tEndGlobalSection\n"; - // Write out project(target) depends + // Write out project(target) depends fout << "\tGlobalSection(ProjectDependencies) = postSolution\n"; this->WriteTargetDepends(fout, orderedProjectTargets); fout << "\tEndGlobalSection\n"; @@ -436,6 +433,9 @@ void cmGlobalVisualStudio7Generator this->WriteTargetConfigurations(fout, root, orderedProjectTargets); fout << "\tEndGlobalSection\n"; + // Write out global sections + this->WriteSLNGlobalSections(fout, root); + // Write the footer for the SLN file this->WriteSLNFooter(fout); } @@ -506,12 +506,12 @@ cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path) } // Write a dsp file into the SLN file, -// Note, that dependencies from executables to +// Note, that dependencies from executables to // the libraries it uses are also done here -void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, +void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, const char* dspname, const char* dir, cmTarget& target) -{ +{ // check to see if this is a fortran build const char* ext = ".vcproj"; const char* project = @@ -544,7 +544,7 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, // Write a dsp file into the SLN file, -// Note, that dependencies from executables to +// Note, that dependencies from executables to // the libraries it uses are also done here void cmGlobalVisualStudio7Generator @@ -584,9 +584,10 @@ cmGlobalVisualStudio7Generator // Write a dsp file into the SLN file, Note, that dependencies from // executables to the libraries it uses are also done here void cmGlobalVisualStudio7Generator -::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild, - const char* platformMapping) +::WriteProjectConfigurations( + std::ostream& fout, const char* name, cmTarget::TargetType, + const std::set& configsPartOfDefaultBuild, + const char* platformMapping) { std::string guid = this->GetGUID(name); for(std::vector::iterator i = this->Configurations.begin(); @@ -595,7 +596,9 @@ void cmGlobalVisualStudio7Generator fout << "\t\t{" << guid << "}." << *i << ".ActiveCfg = " << *i << "|" << (platformMapping ? platformMapping : "Win32") << "\n"; - if(partOfDefaultBuild) + std::set::const_iterator + ci = configsPartOfDefaultBuild.find(*i); + if(!(ci == configsPartOfDefaultBuild.end())) { fout << "\t\t{" << guid << "}." << *i << ".Build.0 = " << *i << "|" @@ -607,14 +610,14 @@ void cmGlobalVisualStudio7Generator // Write a dsp file into the SLN file, -// Note, that dependencies from executables to +// Note, that dependencies from executables to // the libraries it uses are also done here -void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout, +void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout, const char* name, const char* location, const char* typeGuid, const std::set&) -{ +{ std::string d = cmSystemTools::ConvertToOutputPath(location); fout << "Project(" << "\"{" @@ -629,17 +632,76 @@ void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout, +void cmGlobalVisualStudio7Generator +::WriteSLNGlobalSections(std::ostream& fout, + cmLocalGenerator* root) +{ + bool extensibilityGlobalsOverridden = false; + bool extensibilityAddInsOverridden = false; + const cmPropertyMap& props = root->GetMakefile()->GetProperties(); + for(cmPropertyMap::const_iterator itProp = props.begin(); + itProp != props.end(); ++itProp) + { + if(itProp->first.find("VS_GLOBAL_SECTION_") == 0) + { + std::string sectionType; + std::string name = itProp->first.substr(18); + if(name.find("PRE_") == 0) + { + name = name.substr(4); + sectionType = "preSolution"; + } + else if(name.find("POST_") == 0) + { + name = name.substr(5); + sectionType = "postSolution"; + } + else + continue; + if(!name.empty()) + { + if(name == "ExtensibilityGlobals" && sectionType == "postSolution") + extensibilityGlobalsOverridden = true; + else if(name == "ExtensibilityAddIns" && sectionType == "postSolution") + extensibilityAddInsOverridden = true; + fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n"; + std::vector keyValuePairs; + cmSystemTools::ExpandListArgument(itProp->second.GetValue(), + keyValuePairs); + for(std::vector::const_iterator itPair = + keyValuePairs.begin(); itPair != keyValuePairs.end(); ++itPair) + { + const std::string::size_type posEqual = itPair->find('='); + if(posEqual != std::string::npos) + { + const std::string key = + cmSystemTools::TrimWhitespace(itPair->substr(0, posEqual)); + const std::string value = + cmSystemTools::TrimWhitespace(itPair->substr(posEqual + 1)); + fout << "\t\t" << key << " = " << value << "\n"; + } + } + fout << "\tEndGlobalSection\n"; + } + } + } + if(!extensibilityGlobalsOverridden) + fout << "\tGlobalSection(ExtensibilityGlobals) = postSolution\n" + << "\tEndGlobalSection\n"; + if(!extensibilityAddInsOverridden) + fout << "\tGlobalSection(ExtensibilityAddIns) = postSolution\n" + << "\tEndGlobalSection\n"; +} + + + // Standard end of dsw file void cmGlobalVisualStudio7Generator::WriteSLNFooter(std::ostream& fout) { - fout << "\tGlobalSection(ExtensibilityGlobals) = postSolution\n" - << "\tEndGlobalSection\n" - << "\tGlobalSection(ExtensibilityAddIns) = postSolution\n" - << "\tEndGlobalSection\n" - << "EndGlobal\n"; + fout << "EndGlobal\n"; } - + // ouput standard header for dsw file void cmGlobalVisualStudio7Generator::WriteSLNHeader(std::ostream& fout) { @@ -705,7 +767,7 @@ std::string cmGlobalVisualStudio7Generator::GetGUID(const char* name) { std::string guidStoreName = name; guidStoreName += "_GUID_CMAKE"; - const char* storedGUID = + const char* storedGUID = this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str()); if(storedGUID) { @@ -733,8 +795,8 @@ void cmGlobalVisualStudio7Generator::CreateGUID(const char* name) ret = reinterpret_cast(uidstr); RpcStringFree(&uidstr); ret = cmSystemTools::UpperCase(ret); - this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(), - ret.c_str(), "Stored GUID", + this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(), + ret.c_str(), "Stored GUID", cmCacheManager::INTERNAL); } @@ -745,9 +807,9 @@ std::vector *cmGlobalVisualStudio7Generator::GetConfigurations() //---------------------------------------------------------------------------- void cmGlobalVisualStudio7Generator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalVisualStudio7Generator::GetActualName(); entry.Brief = "Generates Visual Studio .NET 2002 project files."; entry.Full = ""; } @@ -768,26 +830,34 @@ cmGlobalVisualStudio7Generator } } -bool cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project, - cmTarget* target) +std::set +cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project, + cmTarget* target) { - if(target->GetPropertyAsBool("EXCLUDE_FROM_DEFAULT_BUILD")) - { - return false; - } - // if it is a utilitiy target then only make it part of the + std::set activeConfigs; + // if it is a utilitiy target then only make it part of the // default build if another target depends on it int type = target->GetType(); if (type == cmTarget::GLOBAL_TARGET) { - return false; + return activeConfigs; + } + if(type == cmTarget::UTILITY && !this->IsDependedOn(project, target)) + { + return activeConfigs; } - if(type == cmTarget::UTILITY) + // inspect EXCLUDE_FROM_DEFAULT_BUILD[_] properties + for(std::vector::iterator i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) { - return this->IsDependedOn(project, target); - } - // default is to be part of the build - return true; + const char* propertyValue = + target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str()); + if(cmSystemTools::IsOff(propertyValue)) + { + activeConfigs.insert(*i); + } + } + return activeConfigs; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 9b9107db7..6e786201b 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -13,6 +13,7 @@ #define cmGlobalVisualStudio7Generator_h #include "cmGlobalVisualStudioGenerator.h" +#include "cmGlobalGeneratorFactory.h" class cmTarget; struct cmIDEFlagTable; @@ -26,8 +27,9 @@ class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator { public: cmGlobalVisualStudio7Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio7Generator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + (); } ///! Get the name for the generator. virtual const char* GetName() const { @@ -38,7 +40,7 @@ public: virtual cmLocalGenerator *CreateLocalGenerator(); /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + static void GetDocumentation(cmDocumentationEntry& entry); /** * Try to determine system infomation such as shared library @@ -105,14 +107,15 @@ protected: const char* name, const char* path, cmTarget &t); virtual void WriteProjectDepends(std::ostream& fout, const char* name, const char* path, cmTarget &t); - virtual void WriteProjectConfigurations(std::ostream& fout, - const char* name, - bool partOfDefaultBuild, - const char* platformMapping = NULL); + virtual void WriteProjectConfigurations( + std::ostream& fout, const char* name, cmTarget::TargetType type, + const std::set& configsPartOfDefaultBuild, + const char* platformMapping = NULL); + virtual void WriteSLNGlobalSections(std::ostream& fout, + cmLocalGenerator* root); virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout); virtual std::string WriteUtilityDepend(cmTarget* target); - virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void WriteTargetsToSolution( std::ostream& fout, @@ -137,8 +140,8 @@ protected: std::string ConvertToSolutionPath(const char* path); - bool IsPartOfDefaultBuild(const char* project, - cmTarget* target); + std::set IsPartOfDefaultBuild(const char* project, + cmTarget* target); std::vector Configurations; std::map GUIDMap; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index e7c42327d..864e8db02 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -13,15 +13,117 @@ #include "cmGlobalVisualStudio8Generator.h" #include "cmLocalVisualStudio7Generator.h" #include "cmMakefile.h" +#include "cmVisualStudioWCEPlatformParser.h" #include "cmake.h" #include "cmGeneratedFileStream.h" +static const char vs8generatorName[] = "Visual Studio 8 2005"; + +class cmGlobalVisualStudio8Generator::Factory + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { + if(strstr(name, vs8generatorName) != name) + { + return 0; + } + + const char* p = name + sizeof(vs8generatorName) - 1; + if(p[0] == '\0') + { + return new cmGlobalVisualStudio8Generator( + name, NULL, NULL); + } + + if(p[0] != ' ') + { + return 0; + } + + ++p; + + if(!strcmp(p, "Win64")) + { + return new cmGlobalVisualStudio8Generator( + name, "x64", "CMAKE_FORCE_WIN64"); + } + + cmVisualStudioWCEPlatformParser parser(p); + parser.ParseVersion("8.0"); + if (!parser.Found()) + { + return 0; + } + + cmGlobalVisualStudio8Generator* ret = new cmGlobalVisualStudio8Generator( + name, parser.GetArchitectureFamily(), NULL); + ret->PlatformName = p; + ret->WindowsCEVersion = parser.GetOSVersion(); + return ret; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const { + entry.Name = vs8generatorName; + entry.Brief = "Generates Visual Studio 8 2005 project files."; + entry.Full = + "It is possible to append a space followed by the platform name " + "to create project files for a specific target platform. E.g. " + "\"Visual Studio 8 2005 Win64\" will create project files for " + "the x64 processor."; + } + + virtual void GetGenerators(std::vector& names) const { + names.push_back(vs8generatorName); + names.push_back(vs8generatorName + std::string(" Win64")); + cmVisualStudioWCEPlatformParser parser; + parser.ParseVersion("8.0"); + const std::vector& availablePlatforms = + parser.GetAvailablePlatforms(); + for(std::vector::const_iterator i = + availablePlatforms.begin(); i != availablePlatforms.end(); ++i) + { + names.push_back("Visual Studio 8 2005 " + *i); + } + } +}; + +//---------------------------------------------------------------------------- +cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory() +{ + return new Factory; +} + //---------------------------------------------------------------------------- -cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator() +cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator( + const char* name, const char* architectureId, + const char* additionalPlatformDefinition) { this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; - this->ArchitectureId = "X86"; + this->Name = name; + if (architectureId) + { + this->ArchitectureId = architectureId; + } + if (additionalPlatformDefinition) + { + this->AdditionalPlatformDefinition = additionalPlatformDefinition; + } +} + +//---------------------------------------------------------------------------- +const char* cmGlobalVisualStudio8Generator::GetPlatformName() const +{ + if (!this->PlatformName.empty()) + { + return this->PlatformName.c_str(); + } + if (this->ArchitectureId == "X86") + { + return "Win32"; + } + return this->ArchitectureId.c_str(); } //---------------------------------------------------------------------------- @@ -35,7 +137,20 @@ cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator() lg->SetGlobalGenerator(this); return lg; } - + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) +{ + cmGlobalVisualStudio71Generator::AddPlatformDefinitions(mf); + mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName()); + + if(this->TargetsWindowsCE()) + { + mf->AddDefinition("CMAKE_VS_WINCE_VERSION", + this->WindowsCEVersion.c_str()); + } +} + //---------------------------------------------------------------------------- // ouput standard header for dsw file void cmGlobalVisualStudio8Generator::WriteSLNHeader(std::ostream& fout) @@ -46,21 +161,13 @@ void cmGlobalVisualStudio8Generator::WriteSLNHeader(std::ostream& fout) //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio .NET 2005 project files."; + entry.Name = cmGlobalVisualStudio8Generator::GetActualName(); + entry.Brief = "Generates Visual Studio 8 2005 project files."; entry.Full = ""; } -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) -{ - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId); - mf->AddDefinition("MSVC80", "1"); -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator::Configure() { @@ -213,7 +320,6 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget() // overwritten by the CreateVCProjBuildRule. // (this could be avoided with per-target source files) const char* no_main_dependency = 0; - const char* no_working_directory = 0; if(cmSourceFile* file = mf->AddCustomCommandToOutput( stamps, listFiles, @@ -267,9 +373,10 @@ cmGlobalVisualStudio8Generator //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator -::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild, - const char* platformMapping) +::WriteProjectConfigurations( + std::ostream& fout, const char* name, cmTarget::TargetType type, + const std::set& configsPartOfDefaultBuild, + const char* platformMapping) { std::string guid = this->GetGUID(name); for(std::vector::iterator i = this->Configurations.begin(); @@ -279,13 +386,24 @@ cmGlobalVisualStudio8Generator << "|" << this->GetPlatformName() << ".ActiveCfg = " << *i << "|" << (platformMapping ? platformMapping : this->GetPlatformName()) << "\n"; - if(partOfDefaultBuild) + std::set::const_iterator + ci = configsPartOfDefaultBuild.find(*i); + if(!(ci == configsPartOfDefaultBuild.end())) { fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() << ".Build.0 = " << *i << "|" << (platformMapping ? platformMapping : this->GetPlatformName()) << "\n"; } + bool needsDeploy = (type == cmTarget::EXECUTABLE || + type == cmTarget::SHARED_LIBRARY); + if(this->TargetsWindowsCE() && needsDeploy) + { + fout << "\t\t{" << guid << "}." << *i + << "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|" + << (platformMapping ? platformMapping : this->GetPlatformName()) + << "\n"; + } } } @@ -336,7 +454,7 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies( //---------------------------------------------------------------------------- static cmVS7FlagTable cmVS8ExtraFlagTable[] = -{ +{ {"CallingConvention", "Gd", "cdecl", "0", 0 }, {"CallingConvention", "Gr", "fastcall", "1", 0 }, {"CallingConvention", "Gz", "stdcall", "2", 0 }, diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 7dae42907..bcbd7a0bd 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -23,23 +23,23 @@ class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator { public: - cmGlobalVisualStudio8Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio8Generator; } - + cmGlobalVisualStudio8Generator(const char* name, + const char* architectureId, const char* additionalPlatformDefinition); + static cmGlobalGeneratorFactory* NewFactory(); + ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio8Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 8 2005";} + virtual const char* GetName() const {return this->Name.c_str();} - virtual const char* GetPlatformName() const {return "Win32";} + const char* GetPlatformName() const; /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - + static void GetDocumentation(cmDocumentationEntry& entry); + ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); + virtual void AddPlatformDefinitions(cmMakefile* mf); + /** * Override Configure and Generate to add the build-system check * target. @@ -64,6 +64,10 @@ public: LinkLibraryDependencies and link to .sln dependencies. */ virtual bool NeedLinkLibraryDependencies(cmTarget& target); + /** Return true if building for Windows CE */ + virtual bool TargetsWindowsCE() const { + return !this->WindowsCEVersion.empty(); } + protected: virtual const char* GetIDEVersion() { return "8.0"; } @@ -72,17 +76,22 @@ protected: void AddCheckTarget(); static cmIDEFlagTable const* GetExtraFlagTableVS8(); - virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void WriteSLNHeader(std::ostream& fout); virtual void WriteSolutionConfigurations(std::ostream& fout); - virtual void WriteProjectConfigurations(std::ostream& fout, - const char* name, - bool partOfDefaultBuild, - const char* platformMapping = NULL); + virtual void WriteProjectConfigurations( + std::ostream& fout, const char* name, cmTarget::TargetType type, + const std::set& configsPartOfDefaultBuild, + const char* platformMapping = NULL); virtual bool ComputeTargetDepends(); virtual void WriteProjectDepends(std::ostream& fout, const char* name, const char* path, cmTarget &t); - const char* ArchitectureId; + std::string Name; + std::string PlatformName; + std::string WindowsCEVersion; + +private: + class Factory; + friend class Factory; }; #endif diff --git a/Source/cmGlobalVisualStudio8Win64Generator.cxx b/Source/cmGlobalVisualStudio8Win64Generator.cxx deleted file mode 100644 index 60e45b840..000000000 --- a/Source/cmGlobalVisualStudio8Win64Generator.cxx +++ /dev/null @@ -1,51 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "windows.h" // this must be first to define GetCurrentDirectory -#include "cmGlobalVisualStudio8Win64Generator.h" -#include "cmLocalVisualStudio7Generator.h" -#include "cmMakefile.h" -#include "cmake.h" - - - -cmGlobalVisualStudio8Win64Generator::cmGlobalVisualStudio8Win64Generator() -{ - this->ArchitectureId = "x64"; -} - -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio8Win64Generator::CreateLocalGenerator() -{ - cmLocalVisualStudio7Generator *lg - = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8); - lg->SetPlatformName(this->GetPlatformName()); - lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); - lg->SetGlobalGenerator(this); - return lg; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio8Win64Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio .NET 2005 Win64 project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio8Win64Generator -::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); -} diff --git a/Source/cmGlobalVisualStudio8Win64Generator.h b/Source/cmGlobalVisualStudio8Win64Generator.h deleted file mode 100644 index 084ba697c..000000000 --- a/Source/cmGlobalVisualStudio8Win64Generator.h +++ /dev/null @@ -1,50 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmGlobalVisualStudio8Win64Generator_h -#define cmGlobalVisualStudio8Win64Generator_h - -#include "cmGlobalVisualStudio8Generator.h" - - -/** \class cmGlobalVisualStudio8Win64Generator - * \brief Write a Unix makefiles. - * - * cmGlobalVisualStudio8Win64Generator manages UNIX build process for a tree - */ -class cmGlobalVisualStudio8Win64Generator : - public cmGlobalVisualStudio8Generator -{ -public: - cmGlobalVisualStudio8Win64Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio8Win64Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio8Win64Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 8 2005 Win64";} - - virtual const char* GetPlatformName() const {return "x64";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); - - /** - * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. - */ - virtual void AddPlatformDefinitions(cmMakefile *); -}; -#endif diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index f082675eb..2082384e6 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -13,21 +13,101 @@ #include "cmGlobalVisualStudio9Generator.h" #include "cmLocalVisualStudio7Generator.h" #include "cmMakefile.h" +#include "cmVisualStudioWCEPlatformParser.h" #include "cmake.h" +static const char vs9generatorName[] = "Visual Studio 9 2008"; +class cmGlobalVisualStudio9Generator::Factory + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { + if(strstr(name, vs9generatorName) != name) + { + return 0; + } + + const char* p = name + sizeof(vs9generatorName) - 1; + if(p[0] == '\0') + { + return new cmGlobalVisualStudio9Generator( + name, NULL, NULL); + } + + if(p[0] != ' ') + { + return 0; + } + + ++p; + + if(!strcmp(p, "IA64")) + { + return new cmGlobalVisualStudio9Generator( + name, "Itanium", "CMAKE_FORCE_IA64"); + } + + if(!strcmp(p, "Win64")) + { + return new cmGlobalVisualStudio9Generator( + name, "x64", "CMAKE_FORCE_WIN64"); + } + + cmVisualStudioWCEPlatformParser parser(p); + parser.ParseVersion("9.0"); + if (!parser.Found()) + { + return 0; + } + + cmGlobalVisualStudio9Generator* ret = new cmGlobalVisualStudio9Generator( + name, parser.GetArchitectureFamily(), NULL); + ret->PlatformName = p; + ret->WindowsCEVersion = parser.GetOSVersion(); + return ret; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const { + entry.Name = vs9generatorName; + entry.Brief = "Generates Visual Studio 9 2008 project files."; + entry.Full = + "It is possible to append a space followed by the platform name " + "to create project files for a specific target platform. E.g. " + "\"Visual Studio 9 2008 Win64\" will create project files for " + "the x64 processor; \"Visual Studio 9 2008 IA64\" for Itanium."; + } -cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator() + virtual void GetGenerators(std::vector& names) const { + names.push_back(vs9generatorName); + names.push_back(vs9generatorName + std::string(" Win64")); + names.push_back(vs9generatorName + std::string(" IA64")); + cmVisualStudioWCEPlatformParser parser; + parser.ParseVersion("9.0"); + const std::vector& availablePlatforms = + parser.GetAvailablePlatforms(); + for(std::vector::const_iterator i = + availablePlatforms.begin(); i != availablePlatforms.end(); ++i) + { + names.push_back("Visual Studio 9 2008 " + *i); + } + } +}; + +//---------------------------------------------------------------------------- +cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory() { - this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; + return new Factory; } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio9Generator::AddPlatformDefinitions(cmMakefile* mf) +cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator( + const char* name, const char* architectureId, + const char* additionalPlatformDefinition) + : cmGlobalVisualStudio8Generator(name, architectureId, + additionalPlatformDefinition) { - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId); - mf->AddDefinition("MSVC90", "1"); + this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; } //---------------------------------------------------------------------------- @@ -50,16 +130,7 @@ cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalVisualStudio9Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 9 2008 project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio9Generator -::EnableLanguage(std::vectorconst & lang, +::EnableLanguage(std::vectorconst & lang, cmMakefile *mf, bool optional) { cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index bfb03c4c5..1310a93ac 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -20,31 +20,22 @@ * * cmGlobalVisualStudio9Generator manages UNIX build process for a tree */ -class cmGlobalVisualStudio9Generator : +class cmGlobalVisualStudio9Generator : public cmGlobalVisualStudio8Generator { public: - cmGlobalVisualStudio9Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio9Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio9Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 9 2008";} - virtual void AddPlatformDefinitions(cmMakefile* mf); - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; + cmGlobalVisualStudio9Generator(const char* name, + const char* architectureId, const char* additionalPlatformDefinition); + static cmGlobalGeneratorFactory* NewFactory(); ///! create the correct local generator virtual cmLocalGenerator *CreateLocalGenerator(); /** * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. + * extension, pthreads, byte order etc. */ - virtual void EnableLanguage(std::vectorconst& languages, + virtual void EnableLanguage(std::vectorconst& languages, cmMakefile *, bool optional); virtual void WriteSLNHeader(std::ostream& fout); @@ -62,5 +53,8 @@ public: virtual std::string GetUserMacrosRegKeyBase(); protected: virtual const char* GetIDEVersion() { return "9.0"; } +private: + class Factory; + friend class Factory; }; #endif diff --git a/Source/cmGlobalVisualStudio9IA64Generator.cxx b/Source/cmGlobalVisualStudio9IA64Generator.cxx deleted file mode 100644 index 993340ae8..000000000 --- a/Source/cmGlobalVisualStudio9IA64Generator.cxx +++ /dev/null @@ -1,48 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "cmGlobalVisualStudio9IA64Generator.h" -#include "cmLocalVisualStudio7Generator.h" -#include "cmMakefile.h" - - -cmGlobalVisualStudio9IA64Generator::cmGlobalVisualStudio9IA64Generator() -{ - this->ArchitectureId = "Itanium"; -} - -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio9IA64Generator::CreateLocalGenerator() -{ - cmLocalVisualStudio7Generator *lg = - new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9); - lg->SetPlatformName(this->GetPlatformName()); - lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); - lg->SetGlobalGenerator(this); - return lg; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio9IA64Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 9 2008 Itanium project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio9IA64Generator -::AddPlatformDefinitions(cmMakefile* mf) -{ - cmGlobalVisualStudio9Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); -} diff --git a/Source/cmGlobalVisualStudio9IA64Generator.h b/Source/cmGlobalVisualStudio9IA64Generator.h deleted file mode 100644 index e33ee1550..000000000 --- a/Source/cmGlobalVisualStudio9IA64Generator.h +++ /dev/null @@ -1,50 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmGlobalVisualStudio9IA64Generator_h -#define cmGlobalVisualStudio9IA64Generator_h - -#include "cmGlobalVisualStudio9Generator.h" - - -/** \class cmGlobalVisualStudio8IA64Generator - * \brief Write a Unix makefiles. - * - * cmGlobalVisualStudio8IA64Generator manages UNIX build process for a tree - */ -class cmGlobalVisualStudio9IA64Generator : - public cmGlobalVisualStudio9Generator -{ -public: - cmGlobalVisualStudio9IA64Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio9IA64Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio9IA64Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 9 2008 IA64";} - - virtual const char* GetPlatformName() const {return "Itanium";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); - - /** - * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. - */ - virtual void AddPlatformDefinitions(cmMakefile *); -}; -#endif diff --git a/Source/cmGlobalVisualStudio9Win64Generator.cxx b/Source/cmGlobalVisualStudio9Win64Generator.cxx deleted file mode 100644 index 08f537d1a..000000000 --- a/Source/cmGlobalVisualStudio9Win64Generator.cxx +++ /dev/null @@ -1,48 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "cmGlobalVisualStudio9Win64Generator.h" -#include "cmLocalVisualStudio7Generator.h" -#include "cmMakefile.h" - - -cmGlobalVisualStudio9Win64Generator::cmGlobalVisualStudio9Win64Generator() -{ - this->ArchitectureId = "x64"; -} - -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio9Win64Generator::CreateLocalGenerator() -{ - cmLocalVisualStudio7Generator *lg = - new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9); - lg->SetPlatformName(this->GetPlatformName()); - lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); - lg->SetGlobalGenerator(this); - return lg; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio9Win64Generator -::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 9 2008 Win64 project files."; - entry.Full = ""; -} - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio9Win64Generator -::AddPlatformDefinitions(cmMakefile* mf) -{ - cmGlobalVisualStudio9Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); -} diff --git a/Source/cmGlobalVisualStudio9Win64Generator.h b/Source/cmGlobalVisualStudio9Win64Generator.h deleted file mode 100644 index f6dcc03cd..000000000 --- a/Source/cmGlobalVisualStudio9Win64Generator.h +++ /dev/null @@ -1,50 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmGlobalVisualStudio9Win64Generator_h -#define cmGlobalVisualStudio9Win64Generator_h - -#include "cmGlobalVisualStudio9Generator.h" - - -/** \class cmGlobalVisualStudio8Win64Generator - * \brief Write a Unix makefiles. - * - * cmGlobalVisualStudio8Win64Generator manages UNIX build process for a tree - */ -class cmGlobalVisualStudio9Win64Generator : - public cmGlobalVisualStudio9Generator -{ -public: - cmGlobalVisualStudio9Win64Generator(); - static cmGlobalGenerator* New() { - return new cmGlobalVisualStudio9Win64Generator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalVisualStudio9Win64Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 9 2008 Win64";} - - virtual const char* GetPlatformName() const {return "x64";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); - - /** - * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. - */ - virtual void AddPlatformDefinitions(cmMakefile *); -}; -#endif diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 2a918c925..808664d44 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -21,6 +21,8 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator() { + this->ArchitectureId = "X86"; + this->AdditionalPlatformDefinition = NULL; } //---------------------------------------------------------------------------- @@ -30,10 +32,17 @@ cmGlobalVisualStudioGenerator::~cmGlobalVisualStudioGenerator() //---------------------------------------------------------------------------- std::string cmGlobalVisualStudioGenerator::GetRegistryBase() +{ + return cmGlobalVisualStudioGenerator::GetRegistryBase( + this->GetIDEVersion()); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudioGenerator::GetRegistryBase( + const char* version) { std::string key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\"; - key += this->GetIDEVersion(); - return key; + return key + version; } //---------------------------------------------------------------------------- @@ -53,7 +62,7 @@ void cmGlobalVisualStudioGenerator::Generate() { // Use no actual command lines so that the target itself is not // considered always out of date. - cmTarget* allBuild = + cmTarget* allBuild = gen[0]->GetMakefile()-> AddUtilityCommand("ALL_BUILD", true, no_working_dir, no_depends, no_commands, false, @@ -74,7 +83,6 @@ void cmGlobalVisualStudioGenerator::Generate() #endif // Now make all targets depend on the ALL_BUILD target - cmTargets targets; for(std::vector::iterator i = gen.begin(); i != gen.end(); ++i) { @@ -488,6 +496,18 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) } } +//---------------------------------------------------------------------------- +void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId.c_str()); + mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId.c_str()); + + if(this->AdditionalPlatformDefinition) + { + mf->AddDefinition(this->AdditionalPlatformDefinition, "TRUE"); + } +} + //---------------------------------------------------------------------------- std::string cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget* target) { diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index b62ba229d..9d811706b 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -58,17 +58,23 @@ public: */ virtual void CallVisualStudioMacro(MacroName m, const char* vsSolutionFile = 0); - + // return true if target is fortran only bool TargetIsFortranOnly(cmTarget& t); /** Get the top-level registry key for this VS version. */ std::string GetRegistryBase(); + /** Get the top-level registry key for the given VS version. */ + static std::string GetRegistryBase(const char* version); + /** Return true if the generated build tree may contain multiple builds. i.e. "Can I build Debug and Release in the same tree?" */ virtual bool IsMultiConfig() { return true; } + /** Return true if building for Windows CE */ + virtual bool TargetsWindowsCE() const { return false; } + class TargetSet: public std::set {}; struct TargetCompare { @@ -84,6 +90,8 @@ protected: virtual const char* GetIDEVersion() = 0; + virtual void AddPlatformDefinitions(cmMakefile* mf); + virtual bool ComputeTargetDepends(); class VSDependSet: public std::set {}; class VSDependMap: public std::map {}; @@ -96,6 +104,9 @@ protected: std::string GetUtilityDepend(cmTarget* target); typedef std::map UtilityDependsMap; UtilityDependsMap UtilityDepends; + std::string ArchitectureId; + const char* AdditionalPlatformDefinition; + private: void ComputeTargetObjects(cmGeneratorTarget* gt) const; diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 8c6dff9bd..e3cebc4ac 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -23,11 +23,11 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator() } void cmGlobalWatcomWMakeGenerator -::EnableLanguage(std::vectorconst& l, - cmMakefile *mf, +::EnableLanguage(std::vectorconst& l, + cmMakefile *mf, bool optional) { - // pick a default + // pick a default mf->AddDefinition("WATCOM", "1"); mf->AddDefinition("CMAKE_QUOTE_INCLUDE_PATHS", "1"); mf->AddDefinition("CMAKE_MANGLE_OBJECT_FILE_NAMES", "1"); @@ -58,9 +58,9 @@ cmLocalGenerator *cmGlobalWatcomWMakeGenerator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalWatcomWMakeGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +::GetDocumentation(cmDocumentationEntry& entry) { - entry.Name = this->GetName(); + entry.Name = cmGlobalWatcomWMakeGenerator::GetActualName(); entry.Brief = "Generates Watcom WMake makefiles."; entry.Full = ""; } diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index b416bb181..23e60a1fc 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -23,23 +23,25 @@ class cmGlobalWatcomWMakeGenerator : public cmGlobalUnixMakefileGenerator3 { public: cmGlobalWatcomWMakeGenerator(); - static cmGlobalGenerator* New() { return new cmGlobalWatcomWMakeGenerator; } + static cmGlobalGeneratorFactory* NewFactory() { + return new cmGlobalGeneratorSimpleFactory + (); } ///! Get the name for the generator. virtual const char* GetName() const { return cmGlobalWatcomWMakeGenerator::GetActualName();} static const char* GetActualName() {return "Watcom WMake";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - + static void GetDocumentation(cmDocumentationEntry& entry); + ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); /** * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. + * extension, pthreads, byte order etc. */ - virtual void EnableLanguage(std::vectorconst& languages, + virtual void EnableLanguage(std::vectorconst& languages, cmMakefile *, bool optional); }; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 938977bfb..2222a0e9a 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -20,6 +20,7 @@ #include "cmSourceFile.h" #include "cmCustomCommandGenerator.h" #include "cmGeneratorTarget.h" +#include "cmGlobalGeneratorFactory.h" #include @@ -112,6 +113,18 @@ public: } }; +class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const; + + virtual void GetDocumentation(cmDocumentationEntry& entry) const { + cmGlobalXCodeGenerator::GetDocumentation(entry); } + + virtual void GetGenerators(std::vector& names) const { + names.push_back(cmGlobalXCodeGenerator::GetActualName()); } +}; + //---------------------------------------------------------------------------- cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version) { @@ -132,12 +145,36 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version) } //---------------------------------------------------------------------------- -cmGlobalGenerator* cmGlobalXCodeGenerator::New() +cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory() { + return new Factory; +} + +//---------------------------------------------------------------------------- +cmGlobalGenerator* cmGlobalXCodeGenerator::Factory +::CreateGlobalGenerator(const char* name) const +{ + if (strcmp(name, GetActualName())) + return 0; #if defined(CMAKE_BUILD_WITH_CMAKE) cmXcodeVersionParser parser; - if (cmSystemTools::FileExists( - "/Applications/Xcode.app/Contents/version.plist")) + std::string versionFile; + { + std::string out; + std::string::size_type pos; + if(cmSystemTools::RunSingleCommand("xcode-select --print-path", &out, 0, 0, + cmSystemTools::OUTPUT_NONE) && + (pos = out.find(".app/"), pos != out.npos)) + { + versionFile = out.substr(0, pos+5)+"Contents/version.plist"; + } + } + if(!versionFile.empty() && cmSystemTools::FileExists(versionFile.c_str())) + { + parser.ParseFile(versionFile.c_str()); + } + else if (cmSystemTools::FileExists( + "/Applications/Xcode.app/Contents/version.plist")) { parser.ParseFile ("/Applications/Xcode.app/Contents/version.plist"); @@ -163,6 +200,20 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::New() #endif } +//---------------------------------------------------------------------------- +bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts) +{ + if(this->XcodeVersion >= 30) + { + this->PlatformToolset = ts; + return true; + } + else + { + return cmGlobalGenerator::SetGeneratorToolset(ts); + } +} + //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::EnableLanguage(std::vectorconst& lang, @@ -186,9 +237,12 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vectorconst& cmCacheManager::STRING); } } - mf->AddDefinition("CMAKE_GENERATOR_CC", "gcc"); - mf->AddDefinition("CMAKE_GENERATOR_CXX", "g++"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); + if(!this->PlatformToolset.empty()) + { + mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", + this->PlatformToolset.c_str()); + } this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES"); @@ -480,8 +534,12 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( (this->CurrentReRunCMakeMakefile.c_str()); makefileStream.SetCopyIfDifferent(true); makefileStream << "# Generated by CMake, DO NOT EDIT\n"; - makefileStream << cmake::GetCMakeFilesDirectoryPostSlash(); - makefileStream << "cmake.check_cache: "; + std::string checkCache = mf->GetHomeOutputDirectory(); + checkCache += "/"; + checkCache += cmake::GetCMakeFilesDirectoryPostSlash(); + checkCache += "cmake.check_cache"; + makefileStream << this->ConvertToRelativeForMake(checkCache.c_str()) + << ": "; for(std::vector::const_iterator i = lfiles.begin(); i != lfiles.end(); ++i) { @@ -772,6 +830,10 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext, { sourcecode += ".fortran.f90"; } + else if(lang == "ASM") + { + sourcecode += ".asm"; + } //else // { // // Already specialized above or we leave sourcecode == "sourcecode" @@ -891,6 +953,15 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen) } } +//---------------------------------------------------------------------------- +struct cmSourceFilePathCompare +{ + bool operator()(cmSourceFile* l, cmSourceFile* r) + { + return l->GetFullPath() < r->GetFullPath(); + } +}; + //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, @@ -917,7 +988,9 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, } // organize the sources - std::vector const &classes = cmtarget.GetSourceFiles(); + std::vector classes = cmtarget.GetSourceFiles(); + std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare()); + std::vector externalObjFiles; std::vector headerFiles; std::vector resourceFiles; @@ -1161,7 +1234,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget) // If the language is compiled as a source trust Xcode to link with it. cmTarget::LinkImplementation const* impl = - cmtarget.GetLinkImplementation("NOCONFIG"); + cmtarget.GetLinkImplementation("NOCONFIG", &cmtarget); for(std::vector::const_iterator li = impl->Languages.begin(); li != impl->Languages.end(); ++li) { @@ -1322,16 +1395,18 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases, } //---------------------------------------------------------------------------- -// This function removes each occurence of the flag and returns the last one +// This function removes each occurrence of the flag and returns the last one // (i.e., the dominant flag in GCC) std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag, std::string& flags) { std::string retFlag; - std::string::size_type pos = flags.rfind(flag); + std::string::size_type lastOccurancePos = flags.rfind(flag); bool saved = false; - while(pos != flags.npos) + while(lastOccurancePos != flags.npos) { + //increment pos, we use lastOccurancePos to reduce search space on next inc + std::string::size_type pos = lastOccurancePos; if(pos == 0 || flags[pos-1]==' ') { while(pos < flags.size() && flags[pos] != ' ') @@ -1343,9 +1418,12 @@ std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag, flags[pos] = ' '; pos++; } - } saved = true; - pos = flags.rfind(flag); + } + //decrement lastOccurancePos while making sure we don't loop around + //and become a very large positive number since size_type is unsigned + lastOccurancePos = lastOccurancePos == 0 ? 0 : lastOccurancePos-1; + lastOccurancePos = flags.rfind(flag,lastOccurancePos); } return retFlag; } @@ -1594,14 +1672,16 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, if(strcmp(lang, "CXX") == 0) { this->CurrentLocalGenerator->AddLanguageFlags(cflags, "C", configName); - this->CurrentLocalGenerator->AddCMP0018Flags(cflags, &target, "C"); + this->CurrentLocalGenerator->AddCMP0018Flags(cflags, &target, + "C", configName); } // Add language-specific flags. this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName); // Add shared-library flags if needed. - this->CurrentLocalGenerator->AddCMP0018Flags(flags, &target, lang); + this->CurrentLocalGenerator->AddCMP0018Flags(flags, &target, + lang, configName); } else if(binary) { @@ -1628,16 +1708,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, // Add the export symbol definition for shared library objects. this->AppendDefines(ppDefs, exportMacro); } - this->AppendDefines - (ppDefs, this->CurrentMakefile->GetProperty("COMPILE_DEFINITIONS")); - this->AppendDefines(ppDefs, target.GetProperty("COMPILE_DEFINITIONS")); + cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target); + this->AppendDefines(ppDefs, target.GetCompileDefinitions().c_str()); if(configName) { - std::string defVarName = "COMPILE_DEFINITIONS_"; - defVarName += cmSystemTools::UpperCase(configName); - this->AppendDefines - (ppDefs, this->CurrentMakefile->GetProperty(defVarName.c_str())); - this->AppendDefines(ppDefs, target.GetProperty(defVarName.c_str())); + this->AppendDefines(ppDefs, + target.GetCompileDefinitions(configName).c_str()); } buildSettings->AddAttribute ("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList()); @@ -1694,7 +1770,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, // Set target-specific architectures. std::vector archs; - target.GetAppleArchs(configName, archs); + gtgt->GetAppleArchs(configName, archs); + if(!archs.empty()) { // Enable ARCHS attribute. @@ -1931,7 +2008,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, BuildObjectListOrString dirs(this, this->XcodeVersion >= 30); BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30); std::vector includes; - this->CurrentLocalGenerator->GetIncludeDirectories(includes, &target); + this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, + "C", configName); std::set emitted; emitted.insert("/System/Library/Frameworks"); for(std::vector::iterator i = includes.begin(); @@ -1954,15 +2032,20 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, dirs.Add(incpath.c_str()); } } - std::vector& frameworks = target.GetFrameworks(); - if(frameworks.size()) + if(target.GetType() != cmTarget::OBJECT_LIBRARY && + target.GetType() != cmTarget::STATIC_LIBRARY) { - for(std::vector::iterator fmIt = frameworks.begin(); - fmIt != frameworks.end(); ++fmIt) + // Add framework search paths needed for linking. + if(cmComputeLinkInformation* cli = target.GetLinkInformation(configName)) { - if(emitted.insert(*fmIt).second) + std::vector const& fwDirs = cli->GetFrameworkPaths(); + for(std::vector::const_iterator fdi = fwDirs.begin(); + fdi != fwDirs.end(); ++fdi) { - fdirs.Add(this->XCodeEscapePath(fmIt->c_str()).c_str()); + if(emitted.insert(*fdi).second) + { + fdirs.Add(this->XCodeEscapePath(fdi->c_str()).c_str()); + } } } } @@ -2027,6 +2110,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, debugStr = "NO"; } + buildSettings->AddAttribute("COMBINE_HIDPI_IMAGES", + this->CreateString("YES")); buildSettings->AddAttribute("GCC_GENERATE_DEBUGGING_SYMBOLS", this->CreateString(debugStr)); buildSettings->AddAttribute("GCC_OPTIMIZATION_LEVEL", @@ -2443,47 +2528,25 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const char* name, void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target, cmXCodeObject* dependTarget) { - // make sure a target does not depend on itself - if(target == dependTarget) - { - return; - } - // now avoid circular references if dependTarget already - // depends on target then skip it. Circular references crashes - // xcode - cmXCodeObject* dependTargetDepends = - dependTarget->GetObject("dependencies"); - if(dependTargetDepends) - { - if(dependTargetDepends->HasObject(target->GetPBXTargetDependency())) - { - return; - } - } - - cmXCodeObject* targetdep = dependTarget->GetPBXTargetDependency(); - if(!targetdep) - { - cmXCodeObject* container = - this->CreateObject(cmXCodeObject::PBXContainerItemProxy); - container->SetComment("PBXContainerItemProxy"); - container->AddAttribute("containerPortal", - this->CreateObjectReference(this->RootObject)); - container->AddAttribute("proxyType", this->CreateString("1")); - container->AddAttribute("remoteGlobalIDString", - this->CreateObjectReference(dependTarget)); - container->AddAttribute("remoteInfo", - this->CreateString( - dependTarget->GetTarget()->GetName())); - targetdep = - this->CreateObject(cmXCodeObject::PBXTargetDependency); - targetdep->SetComment("PBXTargetDependency"); - targetdep->AddAttribute("target", - this->CreateObjectReference(dependTarget)); - targetdep->AddAttribute("targetProxy", - this->CreateObjectReference(container)); - dependTarget->SetPBXTargetDependency(targetdep); - } + // This is called once for every edge in the target dependency graph. + cmXCodeObject* container = + this->CreateObject(cmXCodeObject::PBXContainerItemProxy); + container->SetComment("PBXContainerItemProxy"); + container->AddAttribute("containerPortal", + this->CreateObjectReference(this->RootObject)); + container->AddAttribute("proxyType", this->CreateString("1")); + container->AddAttribute("remoteGlobalIDString", + this->CreateObjectReference(dependTarget)); + container->AddAttribute("remoteInfo", + this->CreateString( + dependTarget->GetTarget()->GetName())); + cmXCodeObject* targetdep = + this->CreateObject(cmXCodeObject::PBXTargetDependency); + targetdep->SetComment("PBXTargetDependency"); + targetdep->AddAttribute("target", + this->CreateObjectReference(dependTarget)); + targetdep->AddAttribute("targetProxy", + this->CreateObjectReference(container)); cmXCodeObject* depends = target->GetObject("dependencies"); if(!depends) @@ -2648,25 +2711,6 @@ void cmGlobalXCodeGenerator linkDirs.c_str(), configName); } - // add the framework search paths - { - const char* sep = ""; - std::string fdirs; - std::vector const& fwDirs = cli.GetFrameworkPaths(); - for(std::vector::const_iterator fdi = fwDirs.begin(); - fdi != fwDirs.end(); ++fdi) - { - fdirs += sep; - sep = " "; - fdirs += this->XCodeEscapePath(fdi->c_str()); - } - if(!fdirs.empty()) - { - this->AppendBuildSettingAttribute(target, "FRAMEWORK_SEARCH_PATHS", - fdirs.c_str(), configName); - } - } - // now add the link libraries { std::string linkLibs; @@ -2859,7 +2903,7 @@ cmXCodeObject* cmGlobalXCodeGenerator { std::vector folders = cmSystemTools::tokenize(sg->GetFullName(), "\\"); - cmStdString curr_folder = cmtarget.GetName(); + cmStdString curr_folder = target; curr_folder += "/"; for(std::vector::size_type i = 0; i < folders.size();i++) { @@ -3099,18 +3143,14 @@ void cmGlobalXCodeGenerator const char* sysroot = this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT"); - const char* sysrootDefault = - this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT"); const char* deploymentTarget = this->CurrentMakefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); if(osxArch && sysroot) { - bool flagsUsed = false; // recompute this as it may have been changed since enable language this->Architectures.clear(); cmSystemTools::ExpandListArgument(std::string(osxArch), this->Architectures); - flagsUsed = true; buildSettings->AddAttribute("SDKROOT", this->CreateString(sysroot)); std::string archString; @@ -3125,18 +3165,17 @@ void cmGlobalXCodeGenerator } buildSettings->AddAttribute("ARCHS", this->CreateString(archString.c_str())); - if(!flagsUsed && sysrootDefault && - strcmp(sysroot, sysrootDefault) != 0) - { - buildSettings->AddAttribute("SDKROOT", - this->CreateString(sysroot)); - } } if(deploymentTarget && *deploymentTarget) { buildSettings->AddAttribute("MACOSX_DEPLOYMENT_TARGET", this->CreateString(deploymentTarget)); } + if(!this->PlatformToolset.empty()) + { + buildSettings->AddAttribute("GCC_VERSION", + this->CreateString(this->PlatformToolset.c_str())); + } // Put this last so it can override existing settings // Convert "CMAKE_XCODE_ATTRIBUTE_*" variables directly. @@ -3462,9 +3501,8 @@ const char* cmGlobalXCodeGenerator::GetCMakeCFGIntDir() const //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::GetDocumentation(cmDocumentationEntry& entry) - const { - entry.Name = this->GetName(); + entry.Name = cmGlobalXCodeGenerator::GetActualName(); entry.Brief = "Generate Xcode project files."; entry.Full = ""; } @@ -3739,7 +3777,7 @@ cmGlobalXCodeGenerator const char* configName = this->GetCMakeCFGIntDir(); std::string dir = this->GetObjectsNormalDirectory( - this->CurrentProject, configName, gt->Target); + "$(PROJECT_NAME)", configName, gt->Target); if(this->XcodeVersion >= 21) { dir += "$(CURRENT_ARCH)/"; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 800963b9c..131a6e6d5 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -15,6 +15,7 @@ #include "cmGlobalGenerator.h" #include "cmXCodeObject.h" #include "cmCustomCommand.h" +class cmGlobalGeneratorFactory; class cmTarget; class cmSourceFile; class cmSourceGroup; @@ -29,7 +30,7 @@ class cmGlobalXCodeGenerator : public cmGlobalGenerator { public: cmGlobalXCodeGenerator(std::string const& version); - static cmGlobalGenerator* New(); + static cmGlobalGeneratorFactory* NewFactory(); ///! Get the name for the generator. virtual const char* GetName() const { @@ -37,16 +38,16 @@ public: static const char* GetActualName() {return "Xcode";} /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - + static void GetDocumentation(cmDocumentationEntry& entry); + ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); /** * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. + * extension, pthreads, byte order etc. */ - virtual void EnableLanguage(std::vectorconst& languages, + virtual void EnableLanguage(std::vectorconst& languages, cmMakefile *, bool optional); /** * Try running cmake and building a file. This is used for dynalically @@ -54,16 +55,16 @@ public: */ virtual std::string GenerateBuildCommand(const char* makeProgram, const char *projectName, - const char* additionalOptions, + const char* additionalOptions, const char *targetName, - const char* config, + const char* config, bool ignoreErrors, bool fast); /** * Generate the all required files for building this project/tree. This * basically creates a series of LocalGenerators for each directory and - * requests that they Generate. + * requests that they Generate. */ virtual void Generate(); @@ -82,7 +83,8 @@ public: i.e. "Can I build Debug and Release in the same tree?" */ virtual bool IsMultiConfig(); -private: + virtual bool SetGeneratorToolset(std::string const& ts); +private: cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg); cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent, @@ -107,18 +109,18 @@ private: void AddCommandsToBuildPhase(cmXCodeObject* buildphase, cmTarget& target, - std::vector + std::vector const & commands, const char* commandFileName); - - void CreateCustomRulesMakefile(const char* makefileBasename, + + void CreateCustomRulesMakefile(const char* makefileBasename, cmTarget& target, std::vector const & commands, const char* configName, - const std::map& + const std::map& multipleOutputPairs ); - + cmXCodeObject* FindXCodeTarget(cmTarget*); std::string GetOrCreateId(const char* name, const char* id); @@ -135,9 +137,9 @@ private: const char* GetTargetFileType(cmTarget& cmtarget); const char* GetTargetProductType(cmTarget& cmtarget); std::string AddConfigurations(cmXCodeObject* target, cmTarget& cmtarget); - void AppendOrAddBuildSetting(cmXCodeObject* settings, const char* attr, + void AppendOrAddBuildSetting(cmXCodeObject* settings, const char* attr, const char* value); - void AppendBuildSettingAttribute(cmXCodeObject* target, const char* attr, + void AppendBuildSettingAttribute(cmXCodeObject* target, const char* attr, const char* value, const char* configName); cmXCodeObject* CreateUtilityTarget(cmTarget& target); void AddDependAndLinkInformation(cmXCodeObject* target); @@ -161,10 +163,10 @@ private: const std::string &lang); cmXCodeObject* CreateXCodeFileReference(cmSourceFile* sf, cmTarget& cmtarget); - cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen, + cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen, cmSourceFile* sf, cmTarget& cmtarget); - void CreateXCodeTargets(cmLocalGenerator* gen, + void CreateXCodeTargets(cmLocalGenerator* gen, std::vector&); bool IsHeaderFile(cmSourceFile*); void AddDependTarget(cmXCodeObject* target, @@ -172,9 +174,9 @@ private: void CreateXCodeDependHackTarget(std::vector& targets); bool SpecialTargetEmitted(std::string const& tname); void SetGenerationRoot(cmLocalGenerator* root); - void AddExtraTargets(cmLocalGenerator* root, + void AddExtraTargets(cmLocalGenerator* root, std::vector& gens); - cmXCodeObject* CreateBuildPhase(const char* name, + cmXCodeObject* CreateBuildPhase(const char* name, const char* name2, cmTarget& cmtarget, const std::vector&); @@ -186,6 +188,7 @@ private: const char* varNameSuffix, const char* default_flags); + class Factory; class BuildObjectListOrString; friend class BuildObjectListOrString; @@ -234,6 +237,7 @@ private: std::map TargetGroup; std::map FileRefs; std::vector Architectures; + std::string PlatformToolset; }; #endif diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 15bad5265..4816da9ea 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -15,8 +15,6 @@ #include "cmGlobalGenerator.h" #include "cmGeneratedFileStream.h" -#include - static const char* getShapeForTarget(const cmTarget* target) @@ -67,7 +65,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, cmake cm; cmGlobalGenerator ggi; ggi.SetCMakeInstance(&cm); - std::auto_ptr lg(ggi.CreateLocalGenerator()); + cmsys::auto_ptr lg(ggi.CreateLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); const char* inFileName = settingsFileName; diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx index 2ff794573..a540825ff 100644 --- a/Source/cmHexFileConverter.cxx +++ b/Source/cmHexFileConverter.cxx @@ -22,8 +22,8 @@ // might go to SystemTools ? static bool cm_IsHexChar(char c) { - return (((c >= '0') && (c <= '9')) - || ((c >= 'a') && (c <= 'f')) + return (((c >= '0') && (c <= '9')) + || ((c >= 'a') && (c <= 'f')) || ((c >= 'A') && (c <= 'F'))); } @@ -45,7 +45,7 @@ static unsigned int ChompStrlen(const char* line) return length; } -static bool OutputBin(FILE* file, const char * buf, +static bool OutputBin(FILE* file, const char * buf, unsigned int startIndex, unsigned int stopIndex) { bool success = true; @@ -77,7 +77,7 @@ static bool OutputBin(FILE* file, const char * buf, static bool ConvertMotorolaSrecLine(const char* buf, FILE* outFile) { unsigned int slen = ChompStrlen(buf); - if ((slen < MOTOROLA_SREC_MIN_LINE_LENGTH) + if ((slen < MOTOROLA_SREC_MIN_LINE_LENGTH) || (slen > MOTOROLA_SREC_MAX_LINE_LENGTH)) { return false; @@ -125,7 +125,7 @@ static bool ConvertMotorolaSrecLine(const char* buf, FILE* outFile) static bool ConvertIntelHexLine(const char* buf, FILE* outFile) { unsigned int slen = ChompStrlen(buf); - if ((slen < INTEL_HEX_MIN_LINE_LENGTH) + if ((slen < INTEL_HEX_MIN_LINE_LENGTH) || (slen > INTEL_HEX_MAX_LINE_LENGTH)) { return false; @@ -148,7 +148,7 @@ static bool ConvertIntelHexLine(const char* buf, FILE* outFile) dataStart = 9; } // ignore extra address records - else if ((buf[8] == '2') || (buf[8] == '3') || (buf[8] == '4') + else if ((buf[8] == '2') || (buf[8] == '3') || (buf[8] == '4') || (buf[8] == '5')) { return true; diff --git a/Source/cmHexFileConverter.h b/Source/cmHexFileConverter.h index 94c757f79..e11d74a2f 100644 --- a/Source/cmHexFileConverter.h +++ b/Source/cmHexFileConverter.h @@ -13,7 +13,7 @@ #define cmHexFileConverter_h /** \class cmHexFileConverter - * \brief Can detects Intel Hex and Motorola S-record files and convert them + * \brief Can detects Intel Hex and Motorola S-record files and convert them * to binary files. * */ diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index d9c0e87e9..76a60cfcd 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -177,3 +177,14 @@ void cmIDEOptions::RemoveFlag(const char* flag) { this->FlagMap.erase(flag); } + +//---------------------------------------------------------------------------- +const char* cmIDEOptions::GetFlag(const char* flag) +{ + std::map::iterator i = this->FlagMap.find(flag); + if(i != this->FlagMap.end()) + { + return i->second.c_str(); + } + return 0; +} diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h index a5be8fbd5..e556bdeca 100644 --- a/Source/cmIDEOptions.h +++ b/Source/cmIDEOptions.h @@ -29,6 +29,7 @@ public: void AddDefines(const char* defines); void AddFlag(const char* flag, const char* value); void RemoveFlag(const char* flag); + const char* GetFlag(const char* flag); protected: // create a map of xml tags to the values they should have in the output diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index ffc0f35b8..56d717031 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -409,14 +409,18 @@ namespace enum Op { OpLess, OpEqual, OpGreater }; bool HandleVersionCompare(Op op, const char* lhs_str, const char* rhs_str) { - // Parse out up to 4 components. - unsigned int lhs[4] = {0,0,0,0}; - unsigned int rhs[4] = {0,0,0,0}; - sscanf(lhs_str, "%u.%u.%u.%u", &lhs[0], &lhs[1], &lhs[2], &lhs[3]); - sscanf(rhs_str, "%u.%u.%u.%u", &rhs[0], &rhs[1], &rhs[2], &rhs[3]); + // Parse out up to 8 components. + unsigned int lhs[8] = {0,0,0,0,0,0,0,0}; + unsigned int rhs[8] = {0,0,0,0,0,0,0,0}; + sscanf(lhs_str, "%u.%u.%u.%u.%u.%u.%u.%u", + &lhs[0], &lhs[1], &lhs[2], &lhs[3], + &lhs[4], &lhs[5], &lhs[6], &lhs[7]); + sscanf(rhs_str, "%u.%u.%u.%u.%u.%u.%u.%u", + &rhs[0], &rhs[1], &rhs[2], &rhs[3], + &rhs[4], &rhs[5], &rhs[6], &rhs[7]); // Do component-wise comparison. - for(unsigned int i=0; i < 4; ++i) + for(unsigned int i=0; i < 8; ++i) { if(lhs[i] < rhs[i]) { diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 94e4d998a..f794b78b8 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -26,7 +26,7 @@ public: cmExecutionStatus &); virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); - + std::vector Args; std::vector Functions; bool IsBlocking; @@ -41,7 +41,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmIfCommand; } @@ -52,7 +52,7 @@ public: */ virtual bool InvokeInitialPass(const std::vector& args, cmExecutionStatus &); - + /** * This is called when the command is first encountered in * the CMakeLists.txt file. @@ -72,7 +72,7 @@ public: { return "Conditionally execute a group of commands."; } - + /** * This determines if the command is invoked when in script mode. */ @@ -114,7 +114,7 @@ public: "will be evaluated. Possible expressions are:\n" " if()\n" "True if the constant is 1, ON, YES, TRUE, Y, or a non-zero number. " - "False if the constant is 0, OFF, NO, FALSE, N, IGNORE, \"\", " + "False if the constant is 0, OFF, NO, FALSE, N, IGNORE, NOTFOUND, '', " "or ends in the suffix '-NOTFOUND'. " "Named boolean constants are case-insensitive. " "If the argument is not one of these constants, " @@ -149,7 +149,12 @@ public: " if(file1 IS_NEWER_THAN file2)\n" "True if file1 is newer than file2 or if one of the two files " "doesn't exist. " - "Behavior is well-defined only for full paths.\n" + "Behavior is well-defined only for full paths. " + "If the file time stamps are exactly the same, an " + "IS_NEWER_THAN comparison returns true, so that any dependent " + "build operations will occur in the event of a tie. " + "This includes the case of passing the same file name for both " + "file1 and file2.\n" " if(IS_DIRECTORY directory-name)\n" "True if the given name is a directory. " "Behavior is well-defined only for full paths.\n" @@ -238,22 +243,22 @@ public: "7) The left and right hand arguments to AND OR are " "independently tested to see if they are boolean constants, if " "so they are used as such, otherwise they are assumed to be " - "variables and are dereferenced. \n" + "variables and are dereferenced. \n" ; } // this is a shared function for both If and Else to determine if the // arguments were valid, and if so, was the response true. If there is // an error, the errorString will be set. - static bool IsTrue(const std::vector &args, - std::string &errorString, cmMakefile *mf, + static bool IsTrue(const std::vector &args, + std::string &errorString, cmMakefile *mf, cmake::MessageType &status); - + // Get a definition from the makefile. If it doesn't exist, // return the original string. static const char* GetVariableOrString(const char* str, const cmMakefile* mf); - + cmTypeMacro(cmIfCommand, cmCommand); }; diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index 9e6f4b6ef..ffb0e8086 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -36,6 +36,10 @@ bool cmIncludeDirectoryCommand ++i; } + std::vector beforeIncludes; + std::vector afterIncludes; + std::set systemIncludes; + for(; i != args.end(); ++i) { if(*i == "SYSTEM") @@ -49,12 +53,45 @@ bool cmIncludeDirectoryCommand return false; } - this->AddDirectory(i->c_str(),before,system); + std::vector includes; + + GetIncludes(*i, includes); + if (before) + { + beforeIncludes.insert(beforeIncludes.end(), + includes.begin(), + includes.end()); + } + else + { + afterIncludes.insert(afterIncludes.end(), + includes.begin(), + includes.end()); + } + if (system) + { + for (std::vector::const_iterator li = includes.begin(); + li != includes.end(); ++li) + { + systemIncludes.insert(*li); + } + } } + std::reverse(beforeIncludes.begin(), beforeIncludes.end()); + + this->Makefile->AddIncludeDirectories(afterIncludes); + this->Makefile->AddIncludeDirectories(beforeIncludes, before); + this->Makefile->AddSystemIncludeDirectories(systemIncludes); + return true; } +static bool StartsWithGeneratorExpression(const std::string &input) +{ + return input[0] == '$' && input[1] == '<'; +} + // do a lot of cleanup on the arguments because this is one place where folks // sometimes take the output of a program and pass it directly into this // command not thinking that a single argument could be filled with spaces @@ -67,54 +104,49 @@ bool cmIncludeDirectoryCommand // output from a program and passing it into a command the cleanup doesn't // always happen // -void cmIncludeDirectoryCommand::AddDirectory(const char *i, - bool before, - bool system) +void cmIncludeDirectoryCommand::GetIncludes(const std::string &arg, + std::vector &incs) { // break apart any line feed arguments - std::string ret = i; std::string::size_type pos = 0; - if((pos = ret.find('\n', pos)) != std::string::npos) + std::string::size_type lastPos = 0; + while((pos = arg.find('\n', lastPos)) != std::string::npos) { if (pos) { - this->AddDirectory(ret.substr(0,pos).c_str(), before, system); - } - if (ret.size()-pos-1) - { - this->AddDirectory(ret.substr(pos+1,ret.size()-pos-1).c_str(), - before, system); + std::string inc = arg.substr(lastPos,pos); + this->NormalizeInclude(inc); + incs.push_back(inc); } - return; + lastPos = pos + 1; } + std::string inc = arg.substr(lastPos); + this->NormalizeInclude(inc); + incs.push_back(inc); +} - // remove any leading or trailing spaces and \r - std::string::size_type b = ret.find_first_not_of(" \r"); - std::string::size_type e = ret.find_last_not_of(" \r"); - if ((b!=ret.npos) && (e!=ret.npos)) - { - ret.assign(ret, b, 1+e-b); // copy the remaining substring - } - else +void cmIncludeDirectoryCommand::NormalizeInclude(std::string &inc) +{ + std::string::size_type b = inc.find_first_not_of(" \r"); + std::string::size_type e = inc.find_last_not_of(" \r"); + if ((b!=inc.npos) && (e!=inc.npos)) { - return; // if we get here, we had only whitespace in the string + inc.assign(inc, b, 1+e-b); // copy the remaining substring } - if (!cmSystemTools::IsOff(ret.c_str())) + if (!cmSystemTools::IsOff(inc.c_str())) { - cmSystemTools::ConvertToUnixSlashes(ret); - if(!cmSystemTools::FileIsFullPath(ret.c_str())) + cmSystemTools::ConvertToUnixSlashes(inc); + + if(!cmSystemTools::FileIsFullPath(inc.c_str())) { - std::string tmp = this->Makefile->GetStartDirectory(); - tmp += "/"; - tmp += ret; - ret = tmp; + if(!StartsWithGeneratorExpression(inc)) + { + std::string tmp = this->Makefile->GetStartDirectory(); + tmp += "/"; + tmp += inc; + inc = tmp; + } } } - this->Makefile->AddIncludeDirectory(ret.c_str(), before); - if(system) - { - this->Makefile->AddSystemIncludeDirectory(ret.c_str()); - } } - diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index dcc116aa8..77a340a64 100644 --- a/Source/cmIncludeDirectoryCommand.h +++ b/Source/cmIncludeDirectoryCommand.h @@ -26,7 +26,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmIncludeDirectoryCommand; } @@ -50,7 +50,7 @@ public: { return "Add include directories to the build."; } - + /** * More documentation. */ @@ -59,8 +59,9 @@ public: return " include_directories([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)\n" "Add the given directories to those the compiler uses to search " - "for include files. " - "These directories are added to the directory property " + "for include files. Relative paths are interpreted as relative to " + "the current source directory. \n" + "The include directories are added to the directory property " "INCLUDE_DIRECTORIES for the current CMakeLists file. " "They are also added to the target property INCLUDE_DIRECTORIES " "for each target in the current CMakeLists file. " @@ -72,16 +73,20 @@ public: "CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. " "By using AFTER or BEFORE explicitly, you can select between " "appending and prepending, independent of the default. " + "\n" "If the SYSTEM option is given, the compiler will be told the " "directories are meant as system include directories on some " - "platforms."; + "platforms (signalling this setting might achieve effects such as " + "the compiler skipping warnings, or these fixed-install system files " + "not being considered in dependency calculations - see compiler docs)."; } - + cmTypeMacro(cmIncludeDirectoryCommand, cmCommand); protected: // used internally - void AddDirectory(const char *arg, bool before, bool system); + void GetIncludes(const std::string &arg, std::vector &incs); + void NormalizeInclude(std::string &inc); }; diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx index d219c169a..d40d8fe72 100644 --- a/Source/cmIncludeExternalMSProjectCommand.cxx +++ b/Source/cmIncludeExternalMSProjectCommand.cxx @@ -15,7 +15,7 @@ bool cmIncludeExternalMSProjectCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) { - if(args.size() < 2) + if(args.size() < 2) { this->SetError("INCLUDE_EXTERNAL_MSPROJECT called with incorrect " "number of arguments"); @@ -77,7 +77,7 @@ bool cmIncludeExternalMSProjectCommand } // Create a target instance for this utility. - cmTarget* target=this->Makefile->AddNewTarget(cmTarget::UTILITY, + cmTarget* target=this->Makefile->AddNewTarget(cmTarget::UTILITY, utility_name.c_str()); target->SetProperty("GENERATOR_FILE_NAME", utility_name.c_str()); diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h index 2b2ed0d15..d5cec01eb 100644 --- a/Source/cmIncludeExternalMSProjectCommand.h +++ b/Source/cmIncludeExternalMSProjectCommand.h @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmIncludeExternalMSProjectCommand; } @@ -38,7 +38,7 @@ public: */ virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - + /** * The name of the command as specified in CMakeList.txt. */ @@ -51,7 +51,7 @@ public: { return "Include an external Microsoft project file in a workspace."; } - + /** * More documentation. */ @@ -75,7 +75,7 @@ public: "(e.g. WIX projects). " "These options are not supported by the Visual Studio 6 generator."; } - + cmTypeMacro(cmIncludeExternalMSProjectCommand, cmCommand); }; diff --git a/Source/cmIncludeRegularExpressionCommand.cxx b/Source/cmIncludeRegularExpressionCommand.cxx index b0d8325d3..ef6e8c6ae 100644 --- a/Source/cmIncludeRegularExpressionCommand.cxx +++ b/Source/cmIncludeRegularExpressionCommand.cxx @@ -21,12 +21,12 @@ bool cmIncludeRegularExpressionCommand return false; } this->Makefile->SetIncludeRegularExpression(args[0].c_str()); - + if(args.size() > 1) { this->Makefile->SetComplainRegularExpression(args[1].c_str()); } - + return true; } diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h index 7c633c0a3..2e4177548 100644 --- a/Source/cmIncludeRegularExpressionCommand.h +++ b/Source/cmIncludeRegularExpressionCommand.h @@ -26,7 +26,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmIncludeRegularExpressionCommand; } @@ -37,7 +37,7 @@ public: */ virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - + /** * The name of the command as specified in CMakeList.txt. */ @@ -50,7 +50,7 @@ public: { return "Set the regular expression used for dependency checking."; } - + /** * More documentation. */ @@ -66,7 +66,7 @@ public: " regex_match = \"^.*$\" (match everything)\n" " regex_complain = \"^$\" (match empty string only)"; } - + cmTypeMacro(cmIncludeRegularExpressionCommand, cmCommand); }; diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 401673460..dcd418b45 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -17,6 +17,8 @@ #include "cmInstallTargetGenerator.h" #include "cmInstallExportGenerator.h" #include "cmInstallCommandArguments.h" +#include "cmTargetExport.h" +#include "cmExportSet.h" #include @@ -735,11 +737,16 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) // this is not a namelink-only rule. if(!exports.GetString().empty() && !namelinkOnly) { + cmTargetExport *te = new cmTargetExport; + te->Target = ⌖ + te->ArchiveGenerator = archiveGenerator; + te->BundleGenerator = bundleGenerator; + te->FrameworkGenerator = frameworkGenerator; + te->HeaderGenerator = publicHeaderGenerator; + te->LibraryGenerator = libraryGenerator; + te->RuntimeGenerator = runtimeGenerator; this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->AddTargetToExports(exports.GetCString(), &target, - archiveGenerator, runtimeGenerator, - libraryGenerator, frameworkGenerator, - bundleGenerator, publicHeaderGenerator); + ->GetExportSets()[exports.GetString()]->AddTargetExport(te); } } @@ -1264,7 +1271,9 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) // Create the export install generator. cmInstallExportGenerator* exportGenerator = new cmInstallExportGenerator( - exp.GetCString(), ica.GetDestination().c_str(), + this->Makefile->GetLocalGenerator() + ->GetGlobalGenerator()->GetExportSets()[exp.GetString()], + ica.GetDestination().c_str(), ica.GetPermissions().c_str(), ica.GetConfigurations(), ica.GetComponent().c_str(), fname.c_str(), name_space.GetCString(), this->Makefile); diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 76e622e81..7c060090d 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -70,7 +70,9 @@ public: "the directory on disk to which a file will be installed. " "If a full path (with a leading slash or drive letter) is given it " "is used directly. If a relative path is given it is interpreted " - "relative to the value of CMAKE_INSTALL_PREFIX.\n" + "relative to the value of CMAKE_INSTALL_PREFIX. The prefix can " + "be relocated at install time using DESTDIR mechanism explained in the " + "CMAKE_INSTALL_PREFIX variable documentation.\n" "PERMISSIONS arguments specify permissions for installed files. " "Valid permissions are " "OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, " diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 28a19d740..0a645a8fa 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -23,10 +23,11 @@ #include "cmInstallFilesGenerator.h" #include "cmExportInstallFileGenerator.h" +#include "cmExportSet.h" //---------------------------------------------------------------------------- cmInstallExportGenerator::cmInstallExportGenerator( - const char* name, + cmExportSet* exportSet, const char* destination, const char* file_permissions, std::vector const& configurations, @@ -34,13 +35,14 @@ cmInstallExportGenerator::cmInstallExportGenerator( const char* filename, const char* name_space, cmMakefile* mf) :cmInstallGenerator(destination, configurations, component) - ,Name(name) + ,ExportSet(exportSet) ,FilePermissions(file_permissions) ,FileName(filename) ,Namespace(name_space) ,Makefile(mf) { this->EFGen = new cmExportInstallFileGenerator(this); + exportSet->AddInstallation(this); } //---------------------------------------------------------------------------- @@ -113,16 +115,12 @@ void cmInstallExportGenerator::ComputeTempDir() //---------------------------------------------------------------------------- void cmInstallExportGenerator::GenerateScript(std::ostream& os) { - // Get the export set requested. - ExportSet const* exportSet = - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->GetExportSet(this->Name.c_str()); - // Skip empty sets. - if(!exportSet) + if(ExportSet->GetTargetExports()->empty()) { cmOStringStream e; - e << "INSTALL(EXPORT) given unknown export \"" << this->Name << "\""; + e << "INSTALL(EXPORT) given unknown export \"" + << ExportSet->GetName() << "\""; cmSystemTools::Error(e.str().c_str()); return; } @@ -137,8 +135,6 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os) this->MainImportFile += this->FileName; // Generate the import file for this export set. - this->EFGen->SetName(this->Name.c_str()); - this->EFGen->SetExportSet(exportSet); this->EFGen->SetExportFile(this->MainImportFile.c_str()); this->EFGen->SetNamespace(this->Namespace.c_str()); if(this->ConfigurationTypes->empty()) diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index 1ff6e38e6..7aff7314c 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -17,8 +17,7 @@ class cmExportInstallFileGenerator; class cmInstallFilesGenerator; class cmInstallTargetGenerator; -class cmTarget; -class cmTargetExport; +class cmExportSet; class cmMakefile; /** \class cmInstallExportGenerator @@ -27,24 +26,29 @@ class cmMakefile; class cmInstallExportGenerator: public cmInstallGenerator { public: - cmInstallExportGenerator(const char* name, + cmInstallExportGenerator(cmExportSet* exportSet, const char* dest, const char* file_permissions, const std::vector& configurations, const char* component, const char* filename, const char* name_space, cmMakefile* mf); ~cmInstallExportGenerator(); -protected: - typedef std::vector ExportSet; + cmExportSet* GetExportSet() {return this->ExportSet;} + + cmMakefile* GetMakefile() const { return this->Makefile; } + + const std::string& GetNamespace() const { return this->Namespace; } + +protected: virtual void GenerateScript(std::ostream& os); virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent); virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); - void GenerateImportFile(ExportSet const* exportSet); - void GenerateImportFile(const char* config, ExportSet const* exportSet); + void GenerateImportFile(cmExportSet const* exportSet); + void GenerateImportFile(const char* config, cmExportSet const* exportSet); void ComputeTempDir(); - std::string Name; + cmExportSet* ExportSet; std::string FilePermissions; std::string FileName; std::string Namespace; diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h index d3c7ed67f..bb0a6ccaf 100644 --- a/Source/cmInstallFilesCommand.h +++ b/Source/cmInstallFilesCommand.h @@ -18,7 +18,7 @@ * \brief Specifies where to install some files * * cmInstallFilesCommand specifies the relative path where a list of - * files should be installed. + * files should be installed. */ class cmInstallFilesCommand : public cmCommand { @@ -26,7 +26,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmInstallFilesCommand; } @@ -50,7 +50,7 @@ public: { return "Deprecated. Use the install(FILES ) command instead."; } - + /** * This is called at the end after all the information * specified by the command is accumulated. Most commands do @@ -90,7 +90,7 @@ public: "The directory is relative to the installation prefix, which " "is stored in the variable CMAKE_INSTALL_PREFIX."; } - + /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const { @@ -102,7 +102,7 @@ public: protected: void CreateInstallGenerator() const; std::string FindInstallSource(const char* name) const; - + private: std::vector FinalArgs; bool IsFilesForm; diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h index 29c84a09f..27a0498e5 100644 --- a/Source/cmInstallProgramsCommand.h +++ b/Source/cmInstallProgramsCommand.h @@ -18,7 +18,7 @@ * \brief Specifies where to install some programs * * cmInstallProgramsCommand specifies the relative path where a list of - * programs should be installed. + * programs should be installed. */ class cmInstallProgramsCommand : public cmCommand { @@ -26,7 +26,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmInstallProgramsCommand; } @@ -50,7 +50,7 @@ public: { return "Deprecated. Use the install(PROGRAMS ) command instead."; } - + /** * This is called at the end after all the information * specified by the command is accumulated. Most commands do @@ -87,7 +87,7 @@ public: "The directory is relative to the installation prefix, which " "is stored in the variable CMAKE_INSTALL_PREFIX."; } - + /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const { diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index b48d45661..8cf72f975 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -14,6 +14,7 @@ #include "cmInstallGenerator.h" #include "cmTarget.h" +#include "cmGeneratorTarget.h" /** \class cmInstallTargetGenerator * \brief Generate target installation rules. @@ -24,7 +25,7 @@ public: cmInstallTargetGenerator( cmTarget& t, const char* dest, bool implib, const char* file_permissions = "", - std::vector const& configurations + std::vector const& configurations = std::vector(), const char* component = "Unspecified", bool optional = false @@ -86,7 +87,7 @@ protected: void AddRPathCheckRule(std::ostream& os, Indent const& indent, const char* config, std::string const& toDestDirPath); - + void AddStripRule(std::ostream& os, Indent const& indent, const std::string& toDestDirPath); void AddRanlibRule(std::ostream& os, Indent const& indent, @@ -97,6 +98,7 @@ protected: std::string FilePermissions; bool Optional; NamelinkModeType NamelinkMode; + cmGeneratorTarget* GeneratorTarget; }; #endif diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h index e05462faa..c47b38700 100644 --- a/Source/cmInstallTargetsCommand.h +++ b/Source/cmInstallTargetsCommand.h @@ -19,7 +19,7 @@ * * cmInstallTargetsCommand specifies the relative path where a list of * targets should be installed. The targets can be executables or - * libraries. + * libraries. */ class cmInstallTargetsCommand : public cmCommand { @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmInstallTargetsCommand; } @@ -51,7 +51,7 @@ public: { return "Deprecated. Use the install(TARGETS ) command instead."; } - + /** * More documentation. */ @@ -67,7 +67,7 @@ public: "is specified, then on systems with special runtime files " "(Windows DLL), the files will be copied to that directory."; } - + /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const { diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index a7cd58340..9218f448d 100644 --- a/Source/cmLinkDirectoriesCommand.h +++ b/Source/cmLinkDirectoriesCommand.h @@ -18,8 +18,8 @@ * \brief Define a list of directories containing files to link. * * cmLinkDirectoriesCommand is used to specify a list - * of directories containing files to link into executable(s). - * Note that the command supports the use of CMake built-in variables + * of directories containing files to link into executable(s). + * Note that the command supports the use of CMake built-in variables * such as CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR. */ class cmLinkDirectoriesCommand : public cmCommand @@ -28,7 +28,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmLinkDirectoriesCommand; } @@ -52,7 +52,7 @@ public: { return "Specify directories in which the linker will look for libraries."; } - + /** * More documentation. */ @@ -62,10 +62,8 @@ public: " link_directories(directory1 directory2 ...)\n" "Specify the paths in which the linker should search for libraries. " "The command will apply only to targets created after it is called. " - "For historical reasons, relative paths given to this command are " - "passed to the linker unchanged " - "(unlike many CMake commands which interpret them relative to the " - "current source directory).\n" + "Relative paths given to this command are interpreted as relative to " + "the current source directory, see CMP0015. \n" "Note that this command is rarely necessary. Library locations " "returned by find_package() and find_library() are absolute paths. " "Pass these absolute library file paths directly to the " @@ -73,7 +71,7 @@ public: "them." ; } - + cmTypeMacro(cmLinkDirectoriesCommand, cmCommand); private: void AddLinkDir(std::string const& dir); diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx index c4458aa6a..2f1db2aa0 100644 --- a/Source/cmLinkLibrariesCommand.cxx +++ b/Source/cmLinkLibrariesCommand.cxx @@ -19,7 +19,7 @@ bool cmLinkLibrariesCommand { return true; } - // add libraries, nothe that there is an optional prefix + // add libraries, nothe that there is an optional prefix // of debug and optimized than can be used for(std::vector::const_iterator i = args.begin(); i != args.end(); ++i) @@ -50,10 +50,10 @@ bool cmLinkLibrariesCommand } else { - this->Makefile->AddLinkLibrary(i->c_str()); + this->Makefile->AddLinkLibrary(i->c_str()); } } - + return true; } diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h index 2c0212cef..c450a1cb9 100644 --- a/Source/cmLinkLibrariesCommand.h +++ b/Source/cmLinkLibrariesCommand.h @@ -19,7 +19,7 @@ * * cmLinkLibrariesCommand is used to specify a list of libraries to link * into executable(s) or shared objects. The names of the libraries - * should be those defined by the LIBRARY(library) command(s). + * should be those defined by the LIBRARY(library) command(s). */ class cmLinkLibrariesCommand : public cmCommand { @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmLinkLibrariesCommand; } @@ -51,7 +51,7 @@ public: { return "Deprecated. Use the target_link_libraries() command instead."; } - + /** * More documentation. */ @@ -68,7 +68,7 @@ public: "the next library listed is to be used only for that specific " "type of build."; } - + /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const { diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 908f3b060..df64695aa 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -15,13 +15,14 @@ #include // required for atoi #include +#include //---------------------------------------------------------------------------- bool cmListCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) { - if(args.size() < 1) + if(args.size() < 2) { - this->SetError("must be called with at least one argument."); + this->SetError("must be called with at least two arguments."); return false; } @@ -98,7 +99,7 @@ bool cmListCommand::GetList(std::vector& list, const char* var) { return false; } - // if the size of the list + // if the size of the list if(listString.size() == 0) { return true; @@ -107,7 +108,7 @@ bool cmListCommand::GetList(std::vector& list, const char* var) cmSystemTools::ExpandListArgument(listString, list, true); // check the list for empty values bool hasEmpty = false; - for(std::vector::iterator i = list.begin(); + for(std::vector::iterator i = list.begin(); i != list.end(); ++i) { if(i->size() == 0) @@ -116,7 +117,7 @@ bool cmListCommand::GetList(std::vector& list, const char* var) break; } } - // if no empty elements then just return + // if no empty elements then just return if(!hasEmpty) { return true; @@ -124,7 +125,7 @@ bool cmListCommand::GetList(std::vector& list, const char* var) // if we have empty elements we need to check policy CMP0007 switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0007)) { - case cmPolicies::WARN: + case cmPolicies::WARN: { // Default is to warn and use old behavior // OLD behavior is to allow compatibility, so recall @@ -243,11 +244,7 @@ bool cmListCommand::HandleGetCommand(std::vector const& args) //---------------------------------------------------------------------------- bool cmListCommand::HandleAppendCommand(std::vector const& args) { - if(args.size() < 2) - { - this->SetError("sub-command APPEND requires at least one argument."); - return false; - } + assert(args.size() >= 2); // Skip if nothing to append. if(args.size() < 3) @@ -424,9 +421,11 @@ bool cmListCommand bool cmListCommand ::HandleReverseCommand(std::vector const& args) { - if(args.size() < 2) + assert(args.size() >= 2); + if(args.size() > 2) { - this->SetError("sub-command REVERSE requires a list as an argument."); + this->SetError( + "sub-command REVERSE only takes one argument."); return false; } @@ -457,10 +456,11 @@ bool cmListCommand bool cmListCommand ::HandleRemoveDuplicatesCommand(std::vector const& args) { - if(args.size() < 2) + assert(args.size() >= 2); + if(args.size() > 2) { this->SetError( - "sub-command REMOVE_DUPLICATES requires a list as an argument."); + "sub-command REMOVE_DUPLICATES only takes one argument."); return false; } @@ -501,9 +501,11 @@ bool cmListCommand bool cmListCommand ::HandleSortCommand(std::vector const& args) { - if(args.size() < 2) + assert(args.size() >= 2); + if(args.size() > 2) { - this->SetError("sub-command SORT requires a list as an argument."); + this->SetError( + "sub-command SORT only takes one argument."); return false; } diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 84cb8fd83..36d84f3be 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -26,7 +26,7 @@ bool cmListFileCacheParseFunction(cmListFileLexer* lexer, cmListFileFunction& function, const char* filename); -bool cmListFile::ParseFile(const char* filename, +bool cmListFile::ParseFile(const char* filename, bool topLevel, cmMakefile *mf) { @@ -47,7 +47,7 @@ bool cmListFile::ParseFile(const char* filename, if(!cmListFileLexer_SetFileName(lexer, filename)) { cmListFileLexer_Delete(lexer); - cmSystemTools::Error("cmListFileCache: error can not open file ", + cmSystemTools::Error("cmListFileCache: error can not open file ", filename); return false; } @@ -119,7 +119,7 @@ bool cmListFile::ParseFile(const char* filename, { bool hasVersion = false; // search for the right policy command - for(std::vector::iterator i + for(std::vector::iterator i = this->Functions.begin(); i != this->Functions.end(); ++i) { @@ -129,7 +129,7 @@ bool cmListFile::ParseFile(const char* filename, break; } } - // if no policy command is found this is an error if they use any + // if no policy command is found this is an error if they use any // non advanced functions or a lot of functions if(!hasVersion) { @@ -152,7 +152,7 @@ bool cmListFile::ParseFile(const char* filename, allowedCommands.insert("option"); allowedCommands.insert("message"); isProblem = false; - for(std::vector::iterator i + for(std::vector::iterator i = this->Functions.begin(); i != this->Functions.end(); ++i) { @@ -161,10 +161,10 @@ bool cmListFile::ParseFile(const char* filename, { isProblem = true; break; - } + } } } - + if (isProblem) { // Tell the top level cmMakefile to diagnose @@ -181,7 +181,7 @@ bool cmListFile::ParseFile(const char* filename, { bool hasProject = false; // search for a project command - for(std::vector::iterator i + for(std::vector::iterator i = this->Functions.begin(); i != this->Functions.end(); ++i) { @@ -256,7 +256,7 @@ bool cmListFileCacheParseFunction(cmListFileLexer* lexer, parenDepth--; cmListFileArgument a(")", false, filename, token->line); - function.Arguments.push_back(a); + function.Arguments.push_back(a); } else if(token->type == cmListFileLexer_Token_Identifier || token->type == cmListFileLexer_Token_ArgumentUnquoted) @@ -276,7 +276,7 @@ bool cmListFileCacheParseFunction(cmListFileLexer* lexer, // Error. cmOStringStream error; error << "Error in cmake code at\n" - << filename << ":" << cmListFileLexer_GetCurrentLine(lexer) + << filename << ":" << cmListFileLexer_GetCurrentLine(lexer) << ":\n" << "Parse error. Function missing ending \")\". " << "Instead found " diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index ec5886dbd..fec3d07d8 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -22,7 +22,7 @@ */ class cmMakefile; - + struct cmListFileArgument { cmListFileArgument(): Value(), Quoted(false), FilePath(0), Line(0) {} @@ -64,11 +64,11 @@ class cmListFileBacktrace: public std::vector {}; struct cmListFile { - cmListFile() - :ModifiedTime(0) + cmListFile() + :ModifiedTime(0) { } - bool ParseFile(const char* path, + bool ParseFile(const char* path, bool topLevel, cmMakefile *mf); @@ -76,4 +76,13 @@ struct cmListFile std::vector Functions; }; +struct cmValueWithOrigin { + cmValueWithOrigin(const std::string &value, + const cmListFileBacktrace &bt) + : Value(value), Backtrace(bt) + {} + std::string Value; + cmListFileBacktrace Backtrace; +}; + #endif diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c index df5dc2b65..b6424d60e 100644 --- a/Source/cmListFileLexer.c +++ b/Source/cmListFileLexer.c @@ -43,7 +43,7 @@ typedef uint32_t flex_uint32_t; typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; +typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ @@ -165,7 +165,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE cmListFileLexer_yylex. + * existing scanners that call yyless() from OUTSIDE cmListFileLexer_yylex. * One obvious solution it to make yy_act a global. I tried that, and saw * a 5% performance hit in a non-yylineno scanner, because yy_act is * normally declared as a register variable-- so it is not worth it. @@ -177,7 +177,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; if ( yytext[yyl] == '\n' )\ --yylineno;\ }while(0) - + /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ @@ -242,7 +242,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -834,7 +834,7 @@ yy_find_action: int yyl; for ( yyl = 0; yyl < yyleng; ++yyl ) if ( yytext[yyl] == '\n' ) - + do{ yylineno++; yycolumn=0; }while(0) @@ -1380,7 +1380,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) yyg->yy_hold_char = *++yyg->yy_c_buf_p; if ( c == '\n' ) - + do{ yylineno++; yycolumn=0; }while(0) @@ -1463,7 +1463,7 @@ static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner) YY_BUFFER_STATE cmListFileLexer_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) { YY_BUFFER_STATE b; - + b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_create_buffer()" ); @@ -1529,7 +1529,7 @@ static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner) } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - + errno = oerrno; } @@ -1633,9 +1633,9 @@ static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner) yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); - + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + yyg->yy_buffer_stack_max = num_to_alloc; yyg->yy_buffer_stack_top = 0; return; @@ -1662,12 +1662,12 @@ static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner) * @param base the character buffer * @param size the size in bytes of the character buffer * @param yyscanner The scanner object. - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) { YY_BUFFER_STATE b; - + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) @@ -1703,7 +1703,7 @@ YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer (char * base, yy_size_t size , */ YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char * yy_str , yyscan_t yyscanner) { - + return cmListFileLexer_yy_scan_bytes(yy_str,strlen(yy_str) ,yyscanner); } @@ -1720,7 +1720,7 @@ YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char * bytes, int len , char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) cmListFileLexer_yyalloc(n ,yyscanner ); @@ -1789,10 +1789,10 @@ YY_EXTRA_TYPE cmListFileLexer_yyget_extra (yyscan_t yyscanner) int cmListFileLexer_yyget_lineno (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - + if (! YY_CURRENT_BUFFER) return 0; - + return yylineno; } @@ -1802,10 +1802,10 @@ int cmListFileLexer_yyget_lineno (yyscan_t yyscanner) int cmListFileLexer_yyget_column (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - + if (! YY_CURRENT_BUFFER) return 0; - + return yycolumn; } @@ -1866,8 +1866,8 @@ void cmListFileLexer_yyset_lineno (int line_number , yyscan_t yyscanner) /* lineno is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "cmListFileLexer_yyset_lineno called with no buffer" , yyscanner); - + yy_fatal_error( "cmListFileLexer_yyset_lineno called with no buffer" , yyscanner); + yylineno = line_number; } @@ -1881,8 +1881,8 @@ void cmListFileLexer_yyset_column (int column_no , yyscan_t yyscanner) /* column is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "cmListFileLexer_yyset_column called with no buffer" , yyscanner); - + yy_fatal_error( "cmListFileLexer_yyset_column called with no buffer" , yyscanner); + yycolumn = column_no; } diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index a239e55bf..462e086ef 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -26,7 +26,7 @@ bool cmLoadCacheCommand { return this->ReadWithPrefix(args); } - + // Cache entries to be excluded from the import list. // If this set is empty, all cache entries are brought in // and they can not be overridden. @@ -97,7 +97,7 @@ bool cmLoadCacheCommand::ReadWithPrefix(std::vector const& args) this->SetError("READ_WITH_PREFIX form must specify a prefix."); return false; } - + // Make sure the cache file exists. std::string cacheFile = args[0]+"/CMakeCache.txt"; if(!cmSystemTools::FileExists(cacheFile.c_str())) @@ -106,22 +106,22 @@ bool cmLoadCacheCommand::ReadWithPrefix(std::vector const& args) this->SetError(e.c_str()); return false; } - + // Prepare the table of variables to read. this->Prefix = args[2]; for(unsigned int i=3; i < args.size(); ++i) { this->VariablesToRead.insert(args[i]); } - + // Read the cache file. - std::ifstream fin(cacheFile.c_str()); - + std::ifstream fin(cacheFile.c_str()); + // This is a big hack read loop to overcome a buggy ifstream // implementation on HP-UX. This should work on all platforms even // for small buffer sizes. const int bufferSize = 4096; - char buffer[bufferSize]; + char buffer[bufferSize]; std::string line; while(fin) { @@ -152,7 +152,7 @@ bool cmLoadCacheCommand::ReadWithPrefix(std::vector const& args) // Completed a line. this->CheckLine(line.c_str()); line = ""; - + // Skip the newline character. ++i; } @@ -164,7 +164,7 @@ bool cmLoadCacheCommand::ReadWithPrefix(std::vector const& args) // Partial last line. this->CheckLine(line.c_str()); } - + return true; } diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h index ac50f8d39..f55cbb3c1 100644 --- a/Source/cmLoadCacheCommand.h +++ b/Source/cmLoadCacheCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmLoadCacheCommand; } @@ -49,7 +49,7 @@ public: { return "Load in the values from another project's CMake cache."; } - + /** * More documentation. */ @@ -74,13 +74,13 @@ public: "of this form of the command is strongly discouraged, but it is " "provided for backward compatibility."; } - + cmTypeMacro(cmLoadCacheCommand, cmCommand); protected: - + std::set VariablesToRead; std::string Prefix; - + bool ReadWithPrefix(std::vector const& args); void CheckLine(const char* line); }; diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 3a0115c96..b2acf06ad 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -25,23 +25,23 @@ #include extern "C" void TrapsForSignalsCFunction(int sig); - + // a class for loadabple commands class cmLoadedCommand : public cmCommand { public: cmLoadedCommand() { - memset(&this->info,0,sizeof(this->info)); + memset(&this->info,0,sizeof(this->info)); this->info.CAPI = &cmStaticCAPI; } - + ///! clean up any memory allocated by the plugin ~cmLoadedCommand(); - + /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { cmLoadedCommand *newC = new cmLoadedCommand; // we must copy when we clone @@ -53,7 +53,7 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, + virtual bool InitialPass(std::vector const& args, cmExecutionStatus &); /** @@ -70,7 +70,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const { return info.Name; } - + /** * Succinct documentation. */ @@ -79,7 +79,7 @@ public: if (this->info.GetTerseDocumentation) { cmLoadedCommand::InstallSignalHandlers(info.Name); - const char* ret = info.GetTerseDocumentation(); + const char* ret = info.GetTerseDocumentation(); cmLoadedCommand::InstallSignalHandlers(info.Name, 1); return ret; } @@ -101,7 +101,7 @@ public: { cmLoadedCommand::LastName = "????"; } - + if(!remove) { signal(SIGSEGV, TrapsForSignalsCFunction); @@ -119,7 +119,7 @@ public: signal(SIGILL, 0); } } - + /** * More documentation. */ @@ -137,7 +137,7 @@ public: return "LoadedCommand without any additional documentation"; } } - + cmTypeMacro(cmLoadedCommand, cmCommand); cmLoadedCommandInfo info; @@ -164,7 +164,7 @@ bool cmLoadedCommand::InitialPass(std::vector const& args, { free(this->info.Error); } - + // create argc and argv and then invoke the command int argc = static_cast (args.size()); char **argv = 0; @@ -179,10 +179,10 @@ bool cmLoadedCommand::InitialPass(std::vector const& args, } cmLoadedCommand::InstallSignalHandlers(info.Name); int result = info.InitialPass((void *)&info, - (void *)this->Makefile,argc,argv); + (void *)this->Makefile,argc,argv); cmLoadedCommand::InstallSignalHandlers(info.Name, 1); cmFreeArguments(argc,argv); - + if (result) { return true; @@ -249,7 +249,7 @@ bool cmLoadCommandCommand // expand variables std::string exp = args[j]; cmSystemTools::ExpandRegistryValues(exp); - + // Glob the entry in case of wildcards. cmSystemTools::GlobDirs(exp.c_str(), path); } @@ -298,7 +298,7 @@ bool cmLoadCommandCommand initFunction = (CM_INIT_FUNCTION)( cmsys::DynamicLoader::GetSymbolAddress(lib, initFuncName.c_str())); } - // if the symbol is found call it to set the name on the + // if the symbol is found call it to set the name on the // function blocker if(initFunction) { diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index 651701948..f0b34ee59 100644 --- a/Source/cmLoadCommandCommand.h +++ b/Source/cmLoadCommandCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmLoadCommandCommand; } @@ -41,7 +41,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "load_command";} - + /** * Succinct documentation. */ @@ -49,7 +49,7 @@ public: { return "Load a command into a running CMake."; } - + /** * More documentation. */ @@ -66,7 +66,7 @@ public: "will be set to the full path of the module that was loaded. " "Otherwise the variable will not be set."; } - + cmTypeMacro(cmLoadCommandCommand, cmCommand); }; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0cfb36bc3..dc39fdc8d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -554,9 +554,9 @@ void cmLocalGenerator::GenerateTargetManifest() } void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, - const char* lang, - cmSourceFile& source, - cmTarget& target) + const char* lang, + cmSourceFile& source, + cmGeneratorTarget& target) { std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname)); objectDir = this->Convert(objectDir.c_str(),START_OUTPUT,SHELL); @@ -635,7 +635,8 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, ); } -void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) +void cmLocalGenerator::AddBuildTargetRule(const char* llang, + cmGeneratorTarget& target) { cmStdString objs; std::vector objVector; @@ -669,15 +670,19 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) std::string createRule = "CMAKE_"; createRule += llang; createRule += target.GetCreateRuleVariable(); - std::string targetName = target.GetFullName(); + std::string targetName = target.Target->GetFullName(); // Executable : // Shared Library: // Static Library: // Shared Module: std::string linkLibs; // should be set + std::string frameworkPath; + std::string linkPath; std::string flags; // should be set std::string linkFlags; // should be set - this->GetTargetFlags(linkLibs, flags, linkFlags, target); + this->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags, + &target); + linkLibs = frameworkPath + linkPath + linkLibs; cmLocalGenerator::RuleVariables vars; vars.Language = llang; vars.Objects = objs.c_str(); @@ -714,7 +719,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) // Store this command line. commandLines.push_back(commandLine); } - std::string targetFullPath = target.GetFullPath(); + std::string targetFullPath = target.Target->GetFullPath(); // Generate a meaningful comment for the command. std::string comment = "Linking "; comment += llang; @@ -728,7 +733,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) comment.c_str(), this->Makefile->GetStartOutputDirectory() ); - target.AddSourceFile + target.Target->AddSourceFile (this->Makefile->GetSource(targetFullPath.c_str())); } @@ -736,11 +741,15 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) void cmLocalGenerator ::CreateCustomTargetsAndCommands(std::set const& lang) { - cmTargets &tgts = this->Makefile->GetTargets(); - for(cmTargets::iterator l = tgts.begin(); + cmGeneratorTargetsType tgts = this->Makefile->GetGeneratorTargets(); + for(cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end(); l++) { - cmTarget& target = l->second; + if (l->first->IsImported()) + { + continue; + } + cmGeneratorTarget& target = *l->second; switch(target.GetType()) { case cmTarget::STATIC_LIBRARY: @@ -748,12 +757,12 @@ void cmLocalGenerator case cmTarget::MODULE_LIBRARY: case cmTarget::EXECUTABLE: { - const char* llang = target.GetLinkerLanguage(); + const char* llang = target.Target->GetLinkerLanguage(); if(!llang) { cmSystemTools::Error ("CMake can not determine linker language for target:", - target.GetName()); + target.Target->GetName()); return; } // if the language is not in the set lang then create custom @@ -1203,7 +1212,8 @@ cmLocalGenerator::ConvertToIncludeReference(std::string const& path) //---------------------------------------------------------------------------- std::string cmLocalGenerator::GetIncludeFlags( const std::vector &includes, - const char* lang, bool forResponseFile) + const char* lang, bool forResponseFile, + const char *config) { if(!lang) { @@ -1276,7 +1286,7 @@ std::string cmLocalGenerator::GetIncludeFlags( if(!flagUsed || repeatFlag) { if(sysIncludeFlag && - this->Makefile->IsSystemIncludeDirectory(i->c_str())) + this->Makefile->IsSystemIncludeDirectory(i->c_str(), config)) { includeFlags << sysIncludeFlag; } @@ -1318,8 +1328,11 @@ std::string cmLocalGenerator::GetIncludeFlags( //---------------------------------------------------------------------------- void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, - cmTarget* target, - const char* lang) + cmGeneratorTarget* target, + const char* lang, + const char *config, + bool stripImplicitInclDirs + ) { // Need to decide whether to automatically include the source and // binary directories at the beginning of the include path. @@ -1389,27 +1402,33 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, } } - // Load implicit include directories for this language. - std::string impDirVar = "CMAKE_"; - impDirVar += lang; - impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES"; - if(const char* value = this->Makefile->GetDefinition(impDirVar.c_str())) + if(!target) + { + return; + } + + if (stripImplicitInclDirs) { - std::vector impDirVec; - cmSystemTools::ExpandListArgument(value, impDirVec); - for(std::vector::const_iterator i = impDirVec.begin(); - i != impDirVec.end(); ++i) + // Load implicit include directories for this language. + std::string impDirVar = "CMAKE_"; + impDirVar += lang; + impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES"; + if(const char* value = this->Makefile->GetDefinition(impDirVar.c_str())) { - emitted.insert(*i); + std::vector impDirVec; + cmSystemTools::ExpandListArgument(value, impDirVec); + for(std::vector::const_iterator i = impDirVec.begin(); + i != impDirVec.end(); ++i) + { + emitted.insert(*i); + } } } // Get the target-specific include directories. std::vector includes; - if(target) - { - includes = target->GetIncludeDirectories(); - } + + includes = target->GetIncludeDirectories(config); // Support putting all the in-project include directories first if // it is requested by the project. @@ -1449,7 +1468,9 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, std::string& flags, std::string& linkFlags, - cmTarget& target) + std::string& frameworkPath, + std::string& linkPath, + cmGeneratorTarget* target) { std::string buildType = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); @@ -1457,12 +1478,12 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, const char* libraryLinkVariable = "CMAKE_SHARED_LINKER_FLAGS"; // default to shared library - switch(target.GetType()) + switch(target->GetType()) { case cmTarget::STATIC_LIBRARY: { const char* targetLinkFlags = - target.GetProperty("STATIC_LIBRARY_FLAGS"); + target->GetProperty("STATIC_LIBRARY_FLAGS"); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1472,7 +1493,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string build = "STATIC_LIBRARY_FLAGS_"; build += buildType; - targetLinkFlags = target.GetProperty(build.c_str()); + targetLinkFlags = target->GetProperty(build.c_str()); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1498,7 +1519,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, if(this->Makefile->IsOn("WIN32") && !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW"))) { - const std::vector& sources = target.GetSourceFiles(); + const std::vector& sources = target->GetSourceFiles(); for(std::vector::const_iterator i = sources.begin(); i != sources.end(); ++i) { @@ -1513,7 +1534,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, } } } - const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); + const char* targetLinkFlags = target->GetProperty("LINK_FLAGS"); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1523,16 +1544,15 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string configLinkFlags = "LINK_FLAGS_"; configLinkFlags += buildType; - targetLinkFlags = target.GetProperty(configLinkFlags.c_str()); + targetLinkFlags = target->GetProperty(configLinkFlags.c_str()); if(targetLinkFlags) { linkFlags += targetLinkFlags; linkFlags += " "; } } - cmOStringStream linklibsStr; - this->OutputLinkLibraries(linklibsStr, target, false); - linkLibs = linklibsStr.str(); + this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, + *target, false); } break; case cmTarget::EXECUTABLE: @@ -1547,18 +1567,17 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, linkFlags += this->Makefile->GetSafeDefinition(build.c_str()); linkFlags += " "; } - const char* linkLanguage = target.GetLinkerLanguage(); + const char* linkLanguage = target->Target->GetLinkerLanguage(); if(!linkLanguage) { cmSystemTools::Error ("CMake can not determine linker language for target:", - target.GetName()); + target->Target->GetName()); return; } this->AddLanguageFlags(flags, linkLanguage, buildType.c_str()); - cmOStringStream linklibs; - this->OutputLinkLibraries(linklibs, target, false); - linkLibs = linklibs.str(); + this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, + *target, false); if(cmSystemTools::IsOn (this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) { @@ -1567,7 +1586,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, linkFlags += this->Makefile->GetSafeDefinition(sFlagVar.c_str()); linkFlags += " "; } - if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") ) + if ( target->GetPropertyAsBool("WIN32_EXECUTABLE") ) { linkFlags += this->Makefile->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE"); @@ -1579,7 +1598,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE"); linkFlags += " "; } - if (target.IsExecutableWithExports()) + if (target->Target->IsExecutableWithExports()) { std::string exportFlagVar = "CMAKE_EXE_EXPORTS_"; exportFlagVar += linkLanguage; @@ -1589,7 +1608,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, this->Makefile->GetSafeDefinition(exportFlagVar.c_str()); linkFlags += " "; } - const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); + const char* targetLinkFlags = target->GetProperty("LINK_FLAGS"); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1599,7 +1618,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string configLinkFlags = "LINK_FLAGS_"; configLinkFlags += buildType; - targetLinkFlags = target.GetProperty(configLinkFlags.c_str()); + targetLinkFlags = target->GetProperty(configLinkFlags.c_str()); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1650,12 +1669,15 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib) * targetLibrary should be a NULL pointer. For libraries, it should point * to the name of the library. This will not link a library against itself. */ -void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, - cmTarget& tgt, +void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, + std::string& frameworkPath, + std::string& linkPath, + cmGeneratorTarget &tgt, bool relink) { + cmOStringStream fout; const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); - cmComputeLinkInformation* pcli = tgt.GetLinkInformation(config); + cmComputeLinkInformation* pcli = tgt.Target->GetLinkInformation(config); if(!pcli) { return; @@ -1687,9 +1709,9 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, for(std::vector::const_iterator fdi = fwDirs.begin(); fdi != fwDirs.end(); ++fdi) { - linkLibs += "-F"; - linkLibs += this->Convert(fdi->c_str(), NONE, SHELL, false); - linkLibs += " "; + frameworkPath += "-F"; + frameworkPath += this->Convert(fdi->c_str(), NONE, SHELL, false); + frameworkPath += " "; } // Append the library search path flags. @@ -1698,10 +1720,10 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, libDir != libDirs.end(); ++libDir) { std::string libpath = this->ConvertToOutputForExisting(libDir->c_str()); - linkLibs += libPathFlag; - linkLibs += libpath; - linkLibs += libPathTerminator; - linkLibs += " "; + linkPath += " " + libPathFlag; + linkPath += libpath; + linkPath += libPathTerminator; + linkPath += " "; } // Append the link items. @@ -1773,12 +1795,14 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, { fout << stdLibs << " "; } + + linkLibraries = fout.str(); } //---------------------------------------------------------------------------- void cmLocalGenerator::AddArchitectureFlags(std::string& flags, - cmTarget* target, + cmGeneratorTarget* target, const char *lang, const char* config) { @@ -1792,46 +1816,34 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, { std::vector archs; target->GetAppleArchs(config, archs); - const char* sysroot = - this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT"); - const char* sysrootDefault = - this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT"); + const char* sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT"); + if(sysroot && sysroot[0] == '/' && !sysroot[1]) + { sysroot = 0; } + std::string sysrootFlagVar = + std::string("CMAKE_") + lang + "_SYSROOT_FLAG"; + const char* sysrootFlag = + this->Makefile->GetDefinition(sysrootFlagVar.c_str()); const char* deploymentTarget = this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); - std::string isysrootVar = std::string("CMAKE_") + lang + "_HAS_ISYSROOT"; - bool hasIsysroot = this->Makefile->IsOn(isysrootVar.c_str()); std::string deploymentTargetFlagVar = std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG"; const char* deploymentTargetFlag = this->Makefile->GetDefinition(deploymentTargetFlagVar.c_str()); - bool flagsUsed = false; - if(!archs.empty() && sysroot && lang && (lang[0] =='C' || lang[0] == 'F')) - { - // if there is more than one arch add the -arch and - // -isysroot flags, or if there is one arch flag, but - // it is not the default -arch flag for the system, then - // add it. Otherwize do not add -arch and -isysroot - if(archs[0] != "") + if(!archs.empty() && lang && (lang[0] =='C' || lang[0] == 'F')) + { + for(std::vector::iterator i = archs.begin(); + i != archs.end(); ++i) { - for( std::vector::iterator i = archs.begin(); - i != archs.end(); ++i) - { - flags += " -arch "; - flags += *i; - } - if(hasIsysroot) - { - flags += " -isysroot "; - flags += sysroot; - } - flagsUsed = true; + flags += " -arch "; + flags += *i; } } - if(!flagsUsed && sysroot && sysrootDefault && - strcmp(sysroot, sysrootDefault) != 0 && hasIsysroot) + if(sysrootFlag && *sysrootFlag && sysroot && *sysroot) { - flags += " -isysroot "; + flags += " "; + flags += sysrootFlag; + flags += " "; flags += sysroot; } @@ -1869,6 +1881,14 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, // modify the name so stripping down to just the file name should // produce the target name in this case. std::string name = cmSystemTools::GetFilenameName(inName); + + // If the input name is the empty string, there is no real + // dependency. Short-circuit the other checks: + if(name == "") + { + return false; + } + if(cmSystemTools::GetFilenameLastExtension(name) == ".exe") { name = cmSystemTools::GetFilenameWithoutLastExtension(name); @@ -1965,7 +1985,8 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags, //---------------------------------------------------------------------------- void cmLocalGenerator::AddCMP0018Flags(std::string &flags, cmTarget* target, - std::string const& lang) + std::string const& lang, + const char *config) { int targetType = target->GetType(); @@ -1978,8 +1999,18 @@ void cmLocalGenerator::AddCMP0018Flags(std::string &flags, cmTarget* target, } else { - // Add position independendent flags, if needed. - if (target->GetPropertyAsBool("POSITION_INDEPENDENT_CODE")) + if (target->GetType() == cmTarget::OBJECT_LIBRARY) + { + if (target->GetPropertyAsBool("POSITION_INDEPENDENT_CODE")) + { + this->AddPositionIndependentFlags(flags, lang, targetType); + } + return; + } + + if (target->GetLinkInterfaceDependentBoolProperty( + "POSITION_INDEPENDENT_CODE", + config)) { this->AddPositionIndependentFlags(flags, lang, targetType); } @@ -2101,9 +2132,8 @@ void cmLocalGenerator::AppendFlags(std::string& flags, } //---------------------------------------------------------------------------- -void cmLocalGenerator::AppendDefines(std::string& defines, - const char* defines_list, - const char* lang) +void cmLocalGenerator::AppendDefines(std::set& defines, + const char* defines_list) { // Short-circuit if there are no definitions. if(!defines_list) @@ -2115,12 +2145,23 @@ void cmLocalGenerator::AppendDefines(std::string& defines, std::vector defines_vec; cmSystemTools::ExpandListArgument(defines_list, defines_vec); - // Short-circuit if there are no definitions. - if(defines_vec.empty()) + for(std::vector::const_iterator di = defines_vec.begin(); + di != defines_vec.end(); ++di) { - return; + // Skip unsupported definitions. + if(!this->CheckDefinition(*di)) + { + continue; + } + defines.insert(*di); } +} +//---------------------------------------------------------------------------- +void cmLocalGenerator::JoinDefines(const std::set& defines, + std::string &definesString, + const char* lang) +{ // Lookup the define flag for the current language. std::string dflag = "-D"; if(lang) @@ -2135,23 +2176,13 @@ void cmLocalGenerator::AppendDefines(std::string& defines, } } - // Add each definition to the command line with appropriate escapes. - const char* dsep = defines.empty()? "" : " "; - for(std::vector::const_iterator di = defines_vec.begin(); - di != defines_vec.end(); ++di) + std::set::const_iterator defineIt = defines.begin(); + const std::set::const_iterator defineEnd = defines.end(); + const char* itemSeparator = definesString.empty() ? "" : " "; + for( ; defineIt != defineEnd; ++defineIt) { - // Skip unsupported definitions. - if(!this->CheckDefinition(*di)) - { - continue; - } - - // Separate from previous definitions. - defines += dsep; - dsep = " "; - // Append the definition with proper escaping. - defines += dflag; + std::string def = dflag; if(this->WatcomWMake) { // The Watcom compiler does its own command line parsing instead @@ -2164,27 +2195,30 @@ void cmLocalGenerator::AppendDefines(std::string& defines, // command line without any escapes. However we still have to // get the '$' and '#' characters through WMake as '$$' and // '$#'. - for(const char* c = di->c_str(); *c; ++c) + for(const char* c = defineIt->c_str(); *c; ++c) { if(*c == '$' || *c == '#') { - defines += '$'; + def += '$'; } - defines += *c; + def += *c; } } else { // Make the definition appear properly on the command line. Use // -DNAME="value" instead of -D"NAME=value" to help VS6 parser. - std::string::size_type eq = di->find("="); - defines += di->substr(0, eq); - if(eq != di->npos) + std::string::size_type eq = defineIt->find("="); + def += defineIt->substr(0, eq); + if(eq != defineIt->npos) { - defines += "="; - defines += this->EscapeForShell(di->c_str() + eq + 1, true); + def += "="; + def += this->EscapeForShell(defineIt->c_str() + eq + 1, true); } } + definesString += itemSeparator; + itemSeparator = " "; + definesString += def; } } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 39b493fb1..a1c34f076 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -16,6 +16,7 @@ class cmMakefile; class cmGlobalGenerator; +class cmGeneratorTarget; class cmTarget; class cmTargetManifest; class cmSourceFile; @@ -48,29 +49,29 @@ public: /** * Calls TraceVSDependencies() on all targets of this generator. */ - virtual void TraceDependencies(); + void TraceDependencies(); virtual void AddHelperCommands() {} /** * Perform any final calculations prior to generation */ - virtual void ConfigureFinalPass(); + void ConfigureFinalPass(); /** * Generate the install rules files in this directory. */ - virtual void GenerateInstallRules(); + void GenerateInstallRules(); /** * Generate the test files for tests. */ - virtual void GenerateTestFiles(); + void GenerateTestFiles(); /** * Generate a manifest of target files that will be built. */ - virtual void GenerateTargetManifest(); + void GenerateTargetManifest(); ///! Get the makefile for this generator cmMakefile *GetMakefile() { @@ -135,27 +136,39 @@ public: std::vector& GetChildren() { return this->Children; }; - void AddArchitectureFlags(std::string& flags, cmTarget* target, + void AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target, const char *lang, const char* config); void AddLanguageFlags(std::string& flags, const char* lang, const char* config); void AddCMP0018Flags(std::string &flags, cmTarget* target, - std::string const& lang); + std::string const& lang, const char *config); void AddConfigVariableFlags(std::string& flags, const char* var, const char* config); ///! Append flags to a string. virtual void AppendFlags(std::string& flags, const char* newFlags); ///! Get the include flags for the current makefile and language std::string GetIncludeFlags(const std::vector &includes, - const char* lang, bool forResponseFile = false); + const char* lang, bool forResponseFile = false, + const char *config = 0); /** * Encode a list of preprocessor definitions for the compiler * command line. */ - void AppendDefines(std::string& defines, const char* defines_list, - const char* lang); + void AppendDefines(std::set& defines, + const char* defines_list); + void AppendDefines(std::set& defines, + std::string defines_list) + { + this->AppendDefines(defines, defines_list.c_str()); + } + /** + * Join a set of defines into a definesString with a space separator. + */ + void JoinDefines(const std::set& defines, + std::string &definesString, + const char* lang); /** Lookup and append options associated with a particular feature. */ void AppendFeatureOptions(std::string& flags, const char* lang, @@ -199,8 +212,9 @@ public: /** Get the include flags for the current makefile and language. */ void GetIncludeDirectories(std::vector& dirs, - cmTarget* target, - const char* lang = "C"); + cmGeneratorTarget* target, + const char* lang = "C", const char *config = 0, + bool stripImplicitInclDirs = true); /** Compute the language used to compile the given source file. */ const char* GetSourceFileLanguage(const cmSourceFile& source); @@ -328,11 +342,17 @@ public: void GetTargetFlags(std::string& linkLibs, std::string& flags, std::string& linkFlags, - cmTarget&target); + std::string& frameworkPath, + std::string& linkPath, + cmGeneratorTarget* target); protected: ///! put all the libraries for a target on into the given stream - virtual void OutputLinkLibraries(std::ostream&, cmTarget&, bool relink); + virtual void OutputLinkLibraries(std::string& linkLibraries, + std::string& frameworkPath, + std::string& linkPath, + cmGeneratorTarget &, + bool relink); // Expand rule variables in CMake of the type found in language rules void ExpandRuleVariables(std::string& string, @@ -348,12 +368,12 @@ protected: /** Convert a target to a utility target for unsupported * languages of a generator */ - void AddBuildTargetRule(const char* llang, cmTarget& target); + void AddBuildTargetRule(const char* llang, cmGeneratorTarget& target); ///! add a custom command to build a .o file that is part of a target void AddCustomCommandToCreateObject(const char* ofname, const char* lang, cmSourceFile& source, - cmTarget& target); + cmGeneratorTarget& target); // Create Custom Targets and commands for unsupported languages // The set passed in should contain the languages supported by the // generator directly. Any targets containing files that are not diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index db93529dd..f6ab0d051 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -32,7 +32,6 @@ #include -#include // auto_ptr #include //---------------------------------------------------------------------------- @@ -1939,8 +1938,12 @@ void cmLocalUnixMakefileGenerator3 for(ImplicitDependFileMap::const_iterator pi = implicitPairs.begin(); pi != implicitPairs.end(); ++pi) { - cmakefileStream << " \"" << pi->second << "\" "; - cmakefileStream << "\"" << pi->first << "\"\n"; + for(cmDepends::DependencyVector::const_iterator di = pi->second.begin(); + di != pi->second.end(); ++ di) + { + cmakefileStream << " \"" << *di << "\" "; + cmakefileStream << "\"" << pi->first << "\"\n"; + } } cmakefileStream << " )\n"; @@ -1958,34 +1961,17 @@ void cmLocalUnixMakefileGenerator3 } // Build a list of preprocessor definitions for the target. - std::vector defines; - { - std::string defPropName = "COMPILE_DEFINITIONS_"; - defPropName += cmSystemTools::UpperCase(this->ConfigurationName); - if(const char* ddefs = this->Makefile->GetProperty("COMPILE_DEFINITIONS")) - { - cmSystemTools::ExpandListArgument(ddefs, defines); - } - if(const char* cdefs = target.GetProperty("COMPILE_DEFINITIONS")) - { - cmSystemTools::ExpandListArgument(cdefs, defines); - } - if(const char* dcdefs = this->Makefile->GetProperty(defPropName.c_str())) - { - cmSystemTools::ExpandListArgument(dcdefs, defines); - } - if(const char* ccdefs = target.GetProperty(defPropName.c_str())) - { - cmSystemTools::ExpandListArgument(ccdefs, defines); - } - } + std::set defines; + this->AppendDefines(defines, target.GetCompileDefinitions()); + this->AppendDefines(defines, target.GetCompileDefinitions( + this->ConfigurationName.c_str())); if(!defines.empty()) { cmakefileStream << "\n" << "# Preprocessor definitions for this target.\n" << "SET(CMAKE_TARGET_DEFINITIONS\n"; - for(std::vector::const_iterator di = defines.begin(); + for(std::set::const_iterator di = defines.begin(); di != defines.end(); ++di) { cmakefileStream @@ -2204,7 +2190,7 @@ cmLocalUnixMakefileGenerator3::AddImplicitDepends(cmTarget const& tgt, const char* obj, const char* src) { - this->ImplicitDepends[tgt.GetName()][lang][obj] = src; + this->ImplicitDepends[tgt.GetName()][lang][obj].push_back(src); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index e3749590b..703369e1c 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -209,7 +209,8 @@ public: // File pairs for implicit dependency scanning. The key of the map // is the depender and the value is the explicit dependee. - struct ImplicitDependFileMap: public std::map {}; + struct ImplicitDependFileMap: + public std::map {}; struct ImplicitDependLanguageMap: public std::map {}; struct ImplicitDependTargetMap: diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index ace7adfa1..c3789a022 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -21,9 +21,9 @@ class cmVS10XMLParser : public cmXMLParser public: virtual void EndElement(const char* /* name */) { - } + } virtual void CharacterDataHandler(const char* data, int length) - { + { if(this->DoGUID ) { this->GUID.assign(data+1, length-2); @@ -40,7 +40,7 @@ class cmVS10XMLParser : public cmXMLParser if(strcmp("ProjectGUID", name) == 0 || strcmp("ProjectGuid", name) == 0) { this->DoGUID = true; - } + } } int InitializeParser() { @@ -50,7 +50,7 @@ class cmVS10XMLParser : public cmXMLParser { return ret; } - // visual studio projects have a strange encoding, but it is + // visual studio projects have a strange encoding, but it is // really utf-8 XML_SetEncoding(static_cast(this->Parser), "utf-8"); return 1; @@ -72,7 +72,7 @@ cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator() void cmLocalVisualStudio10Generator::Generate() { - + cmTargets &tgts = this->Makefile->GetTargets(); for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) { @@ -98,7 +98,7 @@ void cmLocalVisualStudio10Generator const char* path) { cmVS10XMLParser parser; - parser.ParseFile(path); + parser.ParseFile(path); // if we can not find a GUID then create one if(parser.GUID.empty()) diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index 699de4c00..41db735b2 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -31,7 +31,7 @@ public: /** - * Generate the makefile for this directory. + * Generate the makefile for this directory. */ virtual void Generate(); virtual void ReadAndStoreExternalGUID(const char* name, diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 5ab223b7e..c35288c52 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -108,7 +108,7 @@ void cmLocalVisualStudio6Generator::Generate() } void cmLocalVisualStudio6Generator::OutputDSPFile() -{ +{ // If not an in source build, then create the output directory if(strcmp(this->Makefile->GetStartOutputDirectory(), this->Makefile->GetHomeDirectory()) != 0) @@ -126,7 +126,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() cmTargets &tgts = this->Makefile->GetTargets(); // build any targets - for(cmTargets::iterator l = tgts.begin(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { switch(l->second.GetType()) @@ -152,7 +152,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() } // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace // so don't build a projectfile for it - const char* path = + const char* path = l->second.GetProperty("EXTERNAL_MSPROJECT"); if(!path) { @@ -178,7 +178,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() // extern std::string GetVS6TargetName(const std::string& targetName); -void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname, +void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname, cmTarget &target) { // add to the list of projects @@ -210,7 +210,7 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) { std::string dspname = GetVS6TargetName(tgt.GetName()); dspname += ".dsp.cmake"; - const char* dsprule = + const char* dsprule = this->Makefile->GetRequiredDefinition("CMAKE_COMMAND"); cmCustomCommandLine commandLine; commandLine.push_back(dsprule); @@ -229,8 +229,8 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) START_OUTPUT, UNCHANGED, true); commandLine.push_back(args); args = "-B"; - args += - this->Convert(this->Makefile->GetHomeOutputDirectory(), + args += + this->Convert(this->Makefile->GetHomeOutputDirectory(), START_OUTPUT, UNCHANGED, true); commandLine.push_back(args); @@ -254,7 +254,7 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) } -void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, +void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, const char *libName, cmTarget &target) { @@ -301,21 +301,21 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, this->AddUtilityCommandHack(target, count++, depends, *cr); } } - + // We may be modifying the source groups temporarily, so make a copy. std::vector sourceGroups = this->Makefile->GetSourceGroups(); - + // get the classes from the source lists then add them to the groups std::vector const & classes = target.GetSourceFiles(); // now all of the source files have been properly assigned to the target // now stick them into source groups using the reg expressions - for(std::vector::const_iterator i = classes.begin(); + for(std::vector::const_iterator i = classes.begin(); i != classes.end(); i++) { // Add the file to the list of sources. std::string source = (*i)->GetFullPath(); - cmSourceGroup& sourceGroup = + cmSourceGroup& sourceGroup = this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); sourceGroup.AssignSource(*i); // while we are at it, if it is a .rule file then for visual studio 6 we @@ -325,19 +325,22 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, if(!cmSystemTools::FileExists(source.c_str())) { cmSystemTools::ReplaceString(source, "$(IntDir)/", ""); + // Make sure the path exists for the file + std::string path = cmSystemTools::GetFilenamePath(source); + cmSystemTools::MakeDirectory(path.c_str()); #if defined(_WIN32) || defined(__CYGWIN__) - std::ofstream fout(source.c_str(), - std::ios::binary | std::ios::out + std::ofstream sourceFout(source.c_str(), + std::ios::binary | std::ios::out | std::ios::trunc); #else - std::ofstream fout(source.c_str(), + std::ofstream sourceFout(source.c_str(), std::ios::out | std::ios::trunc); #endif - if(fout) + if(sourceFout) { - fout.write("# generated from CMake",22); - fout.flush(); - fout.close(); + sourceFout.write("# generated from CMake",22); + sourceFout.flush(); + sourceFout.close(); } } } @@ -345,14 +348,14 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, // Write the DSP file's header. this->WriteDSPHeader(fout, libName, target, sourceGroups); - + // Loop through every source group. for(std::vector::const_iterator sg = sourceGroups.begin(); sg != sourceGroups.end(); ++sg) { this->WriteGroup(&(*sg), target, fout, libName); - } + } // Write the DSP file's footer. this->WriteDSPFooter(fout); @@ -364,15 +367,15 @@ void cmLocalVisualStudio6Generator { cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&target); - const std::vector &sourceFiles = + const std::vector &sourceFiles = sg->GetSourceFiles(); // If the group is empty, don't write it at all. - + if(sourceFiles.empty() && sg->GetGroupChildren().empty()) - { - return; + { + return; } - + // If the group has a name, write the header. std::string name = sg->GetName(); if(name != "") @@ -385,7 +388,7 @@ void cmLocalVisualStudio6Generator sourceFiles.begin(); sf != sourceFiles.end(); ++sf) { std::string source = (*sf)->GetFullPath(); - const cmCustomCommand *command = + const cmCustomCommand *command = (*sf)->GetCustomCommand(); std::string compileFlags; std::vector depends; @@ -418,30 +421,47 @@ void cmLocalVisualStudio6Generator // Add per-source and per-configuration preprocessor definitions. std::map cdmap; - this->AppendDefines(compileFlags, - (*sf)->GetProperty("COMPILE_DEFINITIONS"), lang); + + { + std::set targetCompileDefinitions; + + this->AppendDefines(targetCompileDefinitions, + (*sf)->GetProperty("COMPILE_DEFINITIONS")); + this->JoinDefines(targetCompileDefinitions, compileFlags, lang); + } + if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_DEBUG")) { - this->AppendDefines(cdmap["DEBUG"], cdefs, lang); + std::set debugCompileDefinitions; + this->AppendDefines(debugCompileDefinitions, cdefs); + this->JoinDefines(debugCompileDefinitions, cdmap["DEBUG"], lang); } if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_RELEASE")) { - this->AppendDefines(cdmap["RELEASE"], cdefs, lang); + std::set releaseCompileDefinitions; + this->AppendDefines(releaseCompileDefinitions, cdefs); + this->JoinDefines(releaseCompileDefinitions, cdmap["RELEASE"], lang); } if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL")) { - this->AppendDefines(cdmap["MINSIZEREL"], cdefs, lang); + std::set minsizerelCompileDefinitions; + this->AppendDefines(minsizerelCompileDefinitions, cdefs); + this->JoinDefines(minsizerelCompileDefinitions, cdmap["MINSIZEREL"], + lang); } if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO")) { - this->AppendDefines(cdmap["RELWITHDEBINFO"], cdefs, lang); + std::set relwithdebinfoCompileDefinitions; + this->AppendDefines(relwithdebinfoCompileDefinitions, cdefs); + this->JoinDefines(relwithdebinfoCompileDefinitions, + cdmap["RELWITHDEBINFO"], lang); } bool excludedFromBuild = (lang && (*sf)->GetPropertyAsBool("HEADER_FILE_ONLY")); - + // Check for extra object-file dependencies. const char* dependsValue = (*sf)->GetProperty("OBJECT_DEPENDS"); if(dependsValue) @@ -453,10 +473,10 @@ void cmLocalVisualStudio6Generator target.GetType() == cmTarget::GLOBAL_TARGET) { fout << "# Begin Source File\n\n"; - + // Tell MS-Dev what the source is. If the compiler knows how to // build it, then it will. - fout << "SOURCE=" << + fout << "SOURCE=" << this->ConvertToOptionallyRelativeOutputPath(source.c_str()) << "\n\n"; if(!depends.empty()) { @@ -464,8 +484,8 @@ void cmLocalVisualStudio6Generator fout << "USERDEP__HACK="; for(std::vector::const_iterator d = depends.begin(); d != depends.end(); ++d) - { - fout << "\\\n\t" << + { + fout << "\\\n\t" << this->ConvertToOptionallyRelativeOutputPath(d->c_str()); } fout << "\n"; @@ -479,16 +499,16 @@ void cmLocalVisualStudio6Generator excludedFromBuild || !cdmap.empty()) { for(std::vector::iterator i - = this->Configurations.begin(); + = this->Configurations.begin(); i != this->Configurations.end(); ++i) - { + { // Strip the subdirectory name out of the configuration name. std::string config = this->GetConfigName(*i); if (i == this->Configurations.begin()) { fout << "!IF \"$(CFG)\" == " << i->c_str() << std::endl; } - else + else { fout << "!ELSEIF \"$(CFG)\" == " << i->c_str() << std::endl; } @@ -512,7 +532,7 @@ void cmLocalVisualStudio6Generator fout << "\n# PROP Intermediate_Dir \"" << config << "/" << objectNameDir << "\"\n\n"; } - } + } fout << "!ENDIF\n\n"; } fout << "# End Source File\n"; @@ -528,7 +548,7 @@ void cmLocalVisualStudio6Generator - + // If the group has a name, write the footer. if(name != "") { @@ -586,7 +606,7 @@ cmLocalVisualStudio6Generator { comment = ""; } - + // Write the rule for each configuration. std::vector::iterator i; for(i = this->Configurations.begin(); i != this->Configurations.end(); ++i) @@ -594,12 +614,12 @@ cmLocalVisualStudio6Generator std::string config = this->GetConfigName(*i); std::string script = this->ConstructScript(command, config.c_str(), "\\\n\t"); - + if (i == this->Configurations.begin()) { fout << "!IF \"$(CFG)\" == " << i->c_str() << std::endl; } - else + else { fout << "!ELSEIF \"$(CFG)\" == " << i->c_str() << std::endl; } @@ -609,9 +629,9 @@ cmLocalVisualStudio6Generator } // Write out the dependencies for the rule. fout << "USERDEP__HACK="; - for(std::vector::const_iterator d = + for(std::vector::const_iterator d = command.GetDepends().begin(); - d != command.GetDepends().end(); + d != command.GetDepends().end(); ++d) { // Lookup the real name of the dependency in case it is a CMake target. @@ -633,15 +653,15 @@ cmLocalVisualStudio6Generator fout << "\n\n"; if(command.GetOutputs().empty()) { - fout << source + fout << source << "_force : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t"; fout << script.c_str() << "\n\n"; } else { - for(std::vector::const_iterator o = + for(std::vector::const_iterator o = command.GetOutputs().begin(); - o != command.GetOutputs().end(); + o != command.GetOutputs().end(); ++o) { // Write a rule for every output generated by this command. @@ -652,12 +672,12 @@ cmLocalVisualStudio6Generator } fout << "# End Custom Build\n\n"; } - + fout << "!ENDIF\n\n"; } -void cmLocalVisualStudio6Generator::WriteDSPBeginGroup(std::ostream& fout, +void cmLocalVisualStudio6Generator::WriteDSPBeginGroup(std::ostream& fout, const char* group, const char* filter) { @@ -679,7 +699,7 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, cmTarget& target) { std::string root= this->Makefile->GetRequiredDefinition("CMAKE_ROOT"); - const char *def= + const char *def= this->Makefile->GetDefinition( "MSPROJECT_TEMPLATE_DIRECTORY"); if( def) @@ -690,9 +710,11 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, { root += "/Templates"; } - + switch(b) { + case WIN32_EXECUTABLE: + break; case STATIC_LIBRARY: this->DSPHeaderTemplate = root; this->DSPHeaderTemplate += "/staticLibHeader.dsptemplate"; @@ -740,7 +762,7 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, } // reset this->Configurations - this->Configurations.erase(this->Configurations.begin(), + this->Configurations.erase(this->Configurations.begin(), this->Configurations.end()); // now add all the configurations possible @@ -785,9 +807,9 @@ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target, } // look for custom rules on a target and collect them together -std::string -cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, - const char* configName, +std::string +cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, + const char* configName, const char * /* libName */) { if (target.GetType() >= cmTarget::UTILITY ) @@ -836,7 +858,8 @@ inline std::string removeQuotes(const std::string& s) std::string -cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target) +cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target, + const char *config) { std::string includeOptions; @@ -845,10 +868,13 @@ cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target) // the length threatens this problem. unsigned int maxIncludeLength = 3000; bool useShortPath = false; + + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); for(int j=0; j < 2; ++j) { std::vector includes; - this->GetIncludeDirectories(includes, &target); + this->GetIncludeDirectories(includes, gt, "C", config); std::vector::iterator i; for(i = includes.begin(); i != includes.end(); ++i) @@ -895,8 +921,8 @@ cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target) #define CM_USE_OLD_VS6 void cmLocalVisualStudio6Generator -::WriteDSPHeader(std::ostream& fout, - const char *libName, cmTarget &target, +::WriteDSPHeader(std::ostream& fout, + const char *libName, cmTarget &target, std::vector &) { bool targetBuilds = (target.GetType() >= cmTarget::EXECUTABLE && @@ -931,7 +957,7 @@ void cmLocalVisualStudio6Generator } std::set pathEmitted; - + // determine the link directories std::string libOptions; std::string libDebugOptions; @@ -944,14 +970,14 @@ void cmLocalVisualStudio6Generator if(libPath.size()) { - std::string lpath = + std::string lpath = this->ConvertToOptionallyRelativeOutputPath(libPath.c_str()); if(lpath.size() == 0) { lpath = "."; } std::string lpathIntDir = libPath + "$(INTDIR)"; - lpathIntDir = + lpathIntDir = this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str()); if(pathEmitted.insert(lpath).second) { @@ -977,7 +1003,7 @@ void cmLocalVisualStudio6Generator } if(exePath.size()) { - std::string lpath = + std::string lpath = this->ConvertToOptionallyRelativeOutputPath(exePath.c_str()); if(lpath.size() == 0) { @@ -986,7 +1012,7 @@ void cmLocalVisualStudio6Generator std::string lpathIntDir = exePath + "$(INTDIR)"; lpathIntDir = this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str()); - + if(pathEmitted.insert(lpath).second) { libOptions += " /LIBPATH:"; @@ -1018,7 +1044,7 @@ void cmLocalVisualStudio6Generator { path += "/"; } - std::string lpath = + std::string lpath = this->ConvertToOptionallyRelativeOutputPath(path.c_str()); if(lpath.size() == 0) { @@ -1035,7 +1061,7 @@ void cmLocalVisualStudio6Generator libOptions += " /LIBPATH:"; libOptions += lpath; libOptions += " "; - + libMultiLineOptions += "# ADD LINK32 /LIBPATH:"; libMultiLineOptions += lpathIntDir; libMultiLineOptions += " "; @@ -1059,8 +1085,8 @@ void cmLocalVisualStudio6Generator // a library in a library, bad recursion) // NEVER LINK STATIC LIBRARIES TO OTHER STATIC LIBRARIES if ((target.GetType() != cmTarget::SHARED_LIBRARY - && target.GetType() != cmTarget::STATIC_LIBRARY - && target.GetType() != cmTarget::MODULE_LIBRARY) || + && target.GetType() != cmTarget::STATIC_LIBRARY + && target.GetType() != cmTarget::MODULE_LIBRARY) || (target.GetType()==cmTarget::SHARED_LIBRARY && libName != GetVS6TargetName(j->first)) || (target.GetType()==cmTarget::MODULE_LIBRARY @@ -1090,7 +1116,7 @@ void cmLocalVisualStudio6Generator } } lib = this->ConvertToOptionallyRelativeOutputPath(lib.c_str()); - libDebug = + libDebug = this->ConvertToOptionallyRelativeOutputPath(libDebug.c_str()); if (j->second == cmTarget::GENERAL) @@ -1121,13 +1147,21 @@ void cmLocalVisualStudio6Generator libMultiLineOptimizedOptions += "# ADD LINK32 "; libMultiLineOptimizedOptions += lib; libMultiLineOptimizedOptions += "\n"; - } + } } } #endif // Get include options for this target. - std::string includeOptions = this->GetTargetIncludeOptions(target); + std::string includeOptionsDebug = this->GetTargetIncludeOptions(target, + "DEBUG"); + std::string includeOptionsRelease = this->GetTargetIncludeOptions(target, + "RELEASE"); + std::string includeOptionsRelWithDebInfo = this->GetTargetIncludeOptions( + target, + "RELWITHDEBINFO"); + std::string includeOptionsMinSizeRel = this->GetTargetIncludeOptions(target, + "MINSIZEREL"); // Get extra linker options for this target type. std::string extraLinkOptions; @@ -1137,17 +1171,17 @@ void cmLocalVisualStudio6Generator std::string extraLinkOptionsRelWithDebInfo; if(target.GetType() == cmTarget::EXECUTABLE) { - extraLinkOptions = + extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS"); } if(target.GetType() == cmTarget::SHARED_LIBRARY) { - extraLinkOptions = + extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS"); } if(target.GetType() == cmTarget::MODULE_LIBRARY) { - extraLinkOptions = + extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS"); } @@ -1229,7 +1263,7 @@ void cmLocalVisualStudio6Generator } // Compute the real name of the target. - std::string outputName = + std::string outputName = "(OUTPUT_NAME is for libraries and executables only)"; std::string outputNameDebug = outputName; std::string outputNameRelease = outputName; @@ -1380,13 +1414,13 @@ void cmLocalVisualStudio6Generator // are there any custom rules on the target itself // only if the target is a lib or exe - std::string customRuleCodeRelease + std::string customRuleCodeRelease = this->CreateTargetRules(target, "RELEASE", libName); - std::string customRuleCodeDebug + std::string customRuleCodeDebug = this->CreateTargetRules(target, "DEBUG", libName); - std::string customRuleCodeMinSizeRel + std::string customRuleCodeMinSizeRel = this->CreateTargetRules(target, "MINSIZEREL", libName); - std::string customRuleCodeRelWithDebInfo + std::string customRuleCodeRelWithDebInfo = this->CreateTargetRules(target, "RELWITHDEBINFO", libName); std::ifstream fin(this->DSPHeaderTemplate.c_str()); @@ -1400,7 +1434,7 @@ void cmLocalVisualStudio6Generator std::string staticLibOptionsMinSizeRel; std::string staticLibOptionsRelWithDebInfo; if(target.GetType() == cmTarget::STATIC_LIBRARY ) - { + { if(const char* libflags = target.GetProperty("STATIC_LIBRARY_FLAGS")) { staticLibOptions = libflags; @@ -1484,7 +1518,7 @@ void cmLocalVisualStudio6Generator staticLibOptionsRelWithDebInfo.c_str()); cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS", staticLibOptions.c_str()); - } + } if(this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")) { cmSystemTools::ReplaceString(line, "/nologo", ""); @@ -1506,8 +1540,8 @@ void cmLocalVisualStudio6Generator cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIMIZED_LIBRARIES", libMultiLineOptimizedOptions.c_str()); #endif - - // Substitute the rules for custom command. When specifying just the + + // Substitute the rules for custom command. When specifying just the // target name for the command the command can be different for // different configs cmSystemTools::ReplaceString(line, "CMAKE_CUSTOM_RULE_CODE_RELEASE", @@ -1520,28 +1554,35 @@ void cmLocalVisualStudio6Generator customRuleCodeRelWithDebInfo.c_str()); // Substitute the real output name into the template. - cmSystemTools::ReplaceString(line, "OUTPUT_NAME_DEBUG", + cmSystemTools::ReplaceString(line, "OUTPUT_NAME_DEBUG", outputNameDebug.c_str()); - cmSystemTools::ReplaceString(line, "OUTPUT_NAME_RELEASE", + cmSystemTools::ReplaceString(line, "OUTPUT_NAME_RELEASE", outputNameRelease.c_str()); cmSystemTools::ReplaceString(line, "OUTPUT_NAME_MINSIZEREL", outputNameMinSizeRel.c_str()); - cmSystemTools::ReplaceString(line, "OUTPUT_NAME_RELWITHDEBINFO", + cmSystemTools::ReplaceString(line, "OUTPUT_NAME_RELWITHDEBINFO", outputNameRelWithDebInfo.c_str()); cmSystemTools::ReplaceString(line, "OUTPUT_NAME", outputName.c_str()); // Substitute the proper link information into the template. - cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_DEBUG", + cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_DEBUG", optionsDebug.c_str()); - cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_RELEASE", + cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_RELEASE", optionsRelease.c_str()); cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_MINSIZEREL", optionsMinSizeRel.c_str()); - cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_RELWITHDEBINFO", + cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_RELWITHDEBINFO", optionsRelWithDebInfo.c_str()); - cmSystemTools::ReplaceString(line, "BUILD_INCLUDES", - includeOptions.c_str()); + cmSystemTools::ReplaceString(line, "BUILD_INCLUDES_DEBUG", + includeOptionsDebug.c_str()); + cmSystemTools::ReplaceString(line, "BUILD_INCLUDES_RELEASE", + includeOptionsRelease.c_str()); + cmSystemTools::ReplaceString(line, "BUILD_INCLUDES_MINSIZEREL", + includeOptionsMinSizeRel.c_str()); + cmSystemTools::ReplaceString(line, "BUILD_INCLUDES_RELWITHDEBINFO", + includeOptionsRelWithDebInfo.c_str()); + cmSystemTools::ReplaceString(line, "TARGET_VERSION_FLAG", targetVersionFlag.c_str()); cmSystemTools::ReplaceString(line, "TARGET_IMPLIB_FLAG_DEBUG", @@ -1588,12 +1629,12 @@ void cmLocalVisualStudio6Generator } } - cmSystemTools::ReplaceString(line, - "EXTRA_DEFINES", + cmSystemTools::ReplaceString(line, + "EXTRA_DEFINES", this->Makefile->GetDefineFlags()); const char* debugPostfix = this->Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX"); - cmSystemTools::ReplaceString(line, "DEBUG_POSTFIX", + cmSystemTools::ReplaceString(line, "DEBUG_POSTFIX", debugPostfix?debugPostfix:""); // store flags for each configuration std::string flags = " "; @@ -1601,7 +1642,7 @@ void cmLocalVisualStudio6Generator std::string flagsMinSize = " "; std::string flagsDebug = " "; std::string flagsDebugRel = " "; - if(target.GetType() >= cmTarget::EXECUTABLE && + if(target.GetType() >= cmTarget::EXECUTABLE && target.GetType() <= cmTarget::OBJECT_LIBRARY) { const char* linkLanguage = target.GetLinkerLanguage(); @@ -1617,7 +1658,7 @@ void cmLocalVisualStudio6Generator baseFlagVar += linkLanguage; baseFlagVar += "_FLAGS"; flags = this->Makefile->GetSafeDefinition(baseFlagVar.c_str()); - + std::string flagVar = baseFlagVar + "_RELEASE"; flagsRelease = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsRelease += " -DCMAKE_INTDIR=\\\"Release\\\" "; @@ -1653,70 +1694,67 @@ void cmLocalVisualStudio6Generator } // Add per-target and per-configuration preprocessor definitions. - std::string defines = " "; - std::string debugDefines = " "; - std::string releaseDefines = " "; - std::string minsizeDefines = " "; - std::string debugrelDefines = " "; + std::set definesSet; + std::set debugDefinesSet; + std::set releaseDefinesSet; + std::set minsizeDefinesSet; + std::set debugrelDefinesSet; this->AppendDefines( - defines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS"), 0); + definesSet, + target.GetCompileDefinitions()); this->AppendDefines( - debugDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_DEBUG"),0); + debugDefinesSet, + target.GetCompileDefinitions("DEBUG")); this->AppendDefines( - releaseDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0); + releaseDefinesSet, + target.GetCompileDefinitions("RELEASE")); this->AppendDefines( - minsizeDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0); + minsizeDefinesSet, + target.GetCompileDefinitions("MINSIZEREL")); this->AppendDefines( - debugrelDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0); + debugrelDefinesSet, + target.GetCompileDefinitions("RELWITHDEBINFO")); + + std::string defines = " "; + std::string debugDefines = " "; + std::string releaseDefines = " "; + std::string minsizeDefines = " "; + std::string debugrelDefines = " "; + + this->JoinDefines(definesSet, defines, 0); + this->JoinDefines(debugDefinesSet, debugDefines, 0); + this->JoinDefines(releaseDefinesSet, releaseDefines, 0); + this->JoinDefines(minsizeDefinesSet, minsizeDefines, 0); + this->JoinDefines(debugrelDefinesSet, debugrelDefines, 0); - this->AppendDefines( - defines, - target.GetProperty("COMPILE_DEFINITIONS"), 0); - this->AppendDefines( - debugDefines, - target.GetProperty("COMPILE_DEFINITIONS_DEBUG"), 0); - this->AppendDefines( - releaseDefines, - target.GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0); - this->AppendDefines( - minsizeDefines, - target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0); - this->AppendDefines( - debugrelDefines, - target.GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0); flags += defines; flagsDebug += debugDefines; flagsRelease += releaseDefines; flagsMinSize += minsizeDefines; flagsDebugRel += debugrelDefines; - + // The template files have CXX FLAGS in them, that need to be replaced. // There are not separate CXX and C template files, so we use the same // variable names. The previous code sets up flags* variables to contain // the correct C or CXX flags cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL", flagsMinSize.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG", + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG", flagsDebug.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELWITHDEBINFO", + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELWITHDEBINFO", flagsDebugRel.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", flagsRelease.c_str()); cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str()); cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_MINSIZEREL", minsizeDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_DEBUG", + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_DEBUG", debugDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELWITHDEBINFO", + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELWITHDEBINFO", debugrelDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELEASE", + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELEASE", releaseDefines.c_str()); cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS", defines.c_str()); @@ -1725,7 +1763,7 @@ void cmLocalVisualStudio6Generator } void cmLocalVisualStudio6Generator::WriteDSPFooter(std::ostream& fout) -{ +{ std::ifstream fin(this->DSPFooterTemplate.c_str()); if(!fin) { diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index 1decc3531..f45bc1758 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -37,7 +37,7 @@ public: virtual void AddCMakeListsRules(); /** - * Generate the makefile for this directory. + * Generate the makefile for this directory. */ virtual void Generate(); @@ -57,9 +57,9 @@ private: std::string DSPFooterTemplate; void CreateSingleDSP(const char *lname, cmTarget &tgt); - void WriteDSPFile(std::ostream& fout, const char *libName, + void WriteDSPFile(std::ostream& fout, const char *libName, cmTarget &tgt); - void WriteDSPBeginGroup(std::ostream& fout, + void WriteDSPBeginGroup(std::ostream& fout, const char* group, const char* filter); void WriteDSPEndGroup(std::ostream& fout); @@ -82,15 +82,15 @@ private: friend class EventWriter; cmsys::auto_ptr MaybeCreateOutputDir(cmTarget& target, const char* config); - std::string CreateTargetRules(cmTarget &target, - const char* configName, + std::string CreateTargetRules(cmTarget &target, + const char* configName, const char *libName); void ComputeLinkOptions(cmTarget& target, const char* configName, const std::string extraOptions, std::string& options); void OutputObjects(cmTarget& target, const char* tool, std::string& options); - std::string GetTargetIncludeOptions(cmTarget &target); + std::string GetTargetIncludeOptions(cmTarget &target, const char *config); std::vector Configurations; std::string GetConfigName(std::string const& configuration) const; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index f2ab79d7e..dfe828062 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -229,6 +229,9 @@ void cmLocalVisualStudio7Generator this->FortranProject = static_cast(this->GlobalGenerator) ->TargetIsFortranOnly(target); + this->WindowsCEProject = + static_cast(this->GlobalGenerator) + ->TargetsWindowsCE(); // Intel Fortran for VS10 uses VS9 format ".vfproj" files. VSVersion realVersion = this->Version; @@ -291,7 +294,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() comment += makefileIn; std::string args; args = "-H"; - args += this->Convert(this->Makefile->GetHomeDirectory(), + args += this->Convert(this->Makefile->GetHomeDirectory(), START_OUTPUT, UNCHANGED, true); commandLine.push_back(args); args = "-B"; @@ -343,8 +346,8 @@ void cmLocalVisualStudio7Generator::WriteConfigurations(std::ostream& fout, fout << "\t\n"; } cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranFlagTable[] = -{ - {"Preprocess", "fpp", "Run Preprocessor on files", "preprocessYes", 0}, +{ + {"Preprocess", "fpp", "Run Preprocessor on files", "preprocessYes", 0}, {"SuppressStartupBanner", "nologo", "SuppressStartupBanner", "true", 0}, {"SourceFileFormat", "fixed", "Use Fixed Format", "fileFormatFixed", 0}, {"SourceFileFormat", "free", "Use Free Format", "fileFormatFree", 0}, @@ -376,15 +379,15 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranFlagTable[] = {"OptimizeForProcessor", "QxO", "", "codeExclusivelyCore2StreamingSIMD", 0}, {"OptimizeForProcessor", "QxS", "", "codeExclusivelyCore2StreamingSIMD4", 0}, - {"ModulePath", "module:", "", "", + {"ModulePath", "module:", "", "", cmVS7FlagTable::UserValueRequired}, - {"LoopUnrolling", "Qunroll:", "", "", + {"LoopUnrolling", "Qunroll:", "", "", cmVS7FlagTable::UserValueRequired}, - {"AutoParallelThreshold", "Qpar-threshold:", "", "", + {"AutoParallelThreshold", "Qpar-threshold:", "", "", cmVS7FlagTable::UserValueRequired}, - {"HeapArrays", "heap-arrays:", "", "", + {"HeapArrays", "heap-arrays:", "", "", cmVS7FlagTable::UserValueRequired}, - {"ObjectText", "bintext:", "", "", + {"ObjectText", "bintext:", "", "", cmVS7FlagTable::UserValueRequired}, {"Parallelization", "Qparallel", "", "true", 0}, {"PrefetchInsertion", "Qprefetch-", "", "false", 0}, @@ -476,7 +479,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] = // boolean flags {"BufferSecurityCheck", "GS", "Buffer security check", "TRUE", 0}, {"BufferSecurityCheck", "GS-", "Turn off Buffer security check", "FALSE", 0}, - {"Detect64BitPortabilityProblems", "Wp64", + {"Detect64BitPortabilityProblems", "Wp64", "Detect 64-bit Portability Problems", "TRUE", 0}, {"EnableFiberSafeOptimizations", "GT", "Enable Fiber-safe Optimizations", "TRUE", 0}, @@ -566,7 +569,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] = {"TurnOffAssemblyGeneration", "NOASSEMBLY", "No assembly even if CLR information is present in objects.", "true", 0}, {"ModuleDefinitionFile", "DEF:", "add an export def file", "", - cmVS7FlagTable::UserValue}, + cmVS7FlagTable::UserValue}, {"GenerateMapFile", "MAP", "enable generation of map file", "TRUE", 0}, {0,0,0,0,0} }; @@ -724,10 +727,6 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, flags += targetFlags; } - std::string configUpper = cmSystemTools::UpperCase(configName); - std::string defPropName = "COMPILE_DEFINITIONS_"; - defPropName += configUpper; - // Get preprocessor definitions for this directory. std::string defineFlags = this->Makefile->GetDefineFlags(); Options::Tool t = Options::Compiler; @@ -744,11 +743,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, targetOptions.Parse(flags.c_str()); targetOptions.Parse(defineFlags.c_str()); targetOptions.ParseFinish(); - targetOptions.AddDefines - (this->Makefile->GetProperty("COMPILE_DEFINITIONS")); - targetOptions.AddDefines(target.GetProperty("COMPILE_DEFINITIONS")); - targetOptions.AddDefines(this->Makefile->GetProperty(defPropName.c_str())); - targetOptions.AddDefines(target.GetProperty(defPropName.c_str())); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); + targetOptions.AddDefines(target.GetCompileDefinitions().c_str()); + targetOptions.AddDefines(target.GetCompileDefinitions(configName).c_str()); targetOptions.SetVerboseMakefile( this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); @@ -800,7 +798,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, if(this->FortranProject) { const char* target_mod_dir = - target.GetProperty("Fortran_MODULE_DIRECTORY"); + target.GetProperty("Fortran_MODULE_DIRECTORY"); std::string modDir; if(target_mod_dir) { @@ -812,21 +810,21 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, { modDir = "."; } - fout << "\t\t\t\tModulePath=\"" + fout << "\t\t\t\tModulePath=\"" << this->ConvertToXMLOutputPath(modDir.c_str()) << "\\$(ConfigurationName)\"\n"; } targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); fout << "\t\t\t\tAdditionalIncludeDirectories=\""; std::vector includes; - this->GetIncludeDirectories(includes, &target); + this->GetIncludeDirectories(includes, gt, "C", configName); std::vector::iterator i = includes.begin(); for(;i != includes.end(); ++i) { // output the include path std::string ipath = this->ConvertToXMLOutputPath(i->c_str()); fout << ipath << ";"; - // if this is fortran then output the include with + // if this is fortran then output the include with // a ConfigurationName on the end of it. if(this->FortranProject) { @@ -847,7 +845,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // non-debug configurations because VS still creates .idb files. fout << "\t\t\t\tProgramDataBaseFileName=\"" << this->ConvertToXMLOutputPathSingle( - target.GetDirectory(configName).c_str()) + target.GetPDBDirectory(configName).c_str()) << "/" << target.GetPDBName(configName) << "\"\n"; } @@ -918,13 +916,13 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // Add a flag telling the manifest tool to use a workaround // for FAT32 file systems, which can cause an empty manifest // to be embedded into the resulting executable. See CMake - // bug #2617. - const char* tool = "VCManifestTool"; + // bug #2617. + const char* manifestTool = "VCManifestTool"; if(this->FortranProject) { - tool = "VFManifestTool"; + manifestTool = "VFManifestTool"; } - fout << "\t\t\t\n"; } @@ -941,7 +939,7 @@ cmLocalVisualStudio7Generator ::GetBuildTypeLinkerFlags(std::string rootLinkerFlags, const char* configName) { std::string configTypeUpper = cmSystemTools::UpperCase(configName); - std::string extraLinkOptionsBuildTypeDef = + std::string extraLinkOptionsBuildTypeDef = rootLinkerFlags + "_" + configTypeUpper; std::string extraLinkOptionsBuildType = @@ -962,23 +960,23 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, std::string extraLinkOptions; if(target.GetType() == cmTarget::EXECUTABLE) { - extraLinkOptions = - this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS") - + std::string(" ") + extraLinkOptions = + this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS") + + std::string(" ") + GetBuildTypeLinkerFlags("CMAKE_EXE_LINKER_FLAGS", configName); } if(target.GetType() == cmTarget::SHARED_LIBRARY) { - extraLinkOptions = - this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS") - + std::string(" ") + extraLinkOptions = + this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS") + + std::string(" ") + GetBuildTypeLinkerFlags("CMAKE_SHARED_LINKER_FLAGS", configName); } if(target.GetType() == cmTarget::MODULE_LIBRARY) { - extraLinkOptions = - this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS") - + std::string(" ") + extraLinkOptions = + this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS") + + std::string(" ") + GetBuildTypeLinkerFlags("CMAKE_MODULE_LINKER_FLAGS", configName); } @@ -1008,6 +1006,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } switch(target.GetType()) { + case cmTarget::UNKNOWN_LIBRARY: + break; case cmTarget::OBJECT_LIBRARY: { std::string libpath = this->GetTargetDirectory(target); @@ -1125,7 +1125,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, fout << "\t\t\t\tAdditionalLibraryDirectories=\""; this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; - temp = target.GetDirectory(configName); + temp = target.GetPDBDirectory(configName); temp += "/"; temp += targetNamePDB; fout << "\t\t\t\tProgramDatabaseFile=\"" << @@ -1134,6 +1134,17 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, { fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n"; } + if(this->WindowsCEProject) + { + if(this->GetVersion() < VS9) + { + fout << "\t\t\t\tSubSystem=\"9\"\n"; + } + else + { + fout << "\t\t\t\tSubSystem=\"8\"\n"; + } + } std::string stackVar = "CMAKE_"; stackVar += linkLanguage; stackVar += "_STACK_SIZE"; @@ -1172,6 +1183,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, cmComputeLinkInformation& cli = *pcli; const char* linkLanguage = cli.GetLinkLanguage(); + bool isWin32Executable = target.GetPropertyAsBool("WIN32_EXECUTABLE"); + // Compute the variable name to lookup standard libraries for this // language. std::string standardLibsVar = "CMAKE_"; @@ -1203,7 +1216,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, temp = target.GetDirectory(configName); temp += "/"; temp += targetNameFull; - fout << "\t\t\t\tOutputFile=\"" + fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; this->WriteTargetVersionAttribute(fout, target); linkOptions.OutputFlagMap(fout, "\t\t\t\t"); @@ -1211,7 +1224,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; std::string path = this->ConvertToXMLOutputPathSingle( - target.GetDirectory(configName).c_str()); + target.GetPDBDirectory(configName).c_str()); fout << "\t\t\t\tProgramDatabaseFile=\"" << path << "/" << targetNamePDB << "\"\n"; @@ -1219,15 +1232,31 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, { fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n"; } - if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") ) + if ( this->WindowsCEProject ) + { + if(this->GetVersion() < VS9) + { + fout << "\t\t\t\tSubSystem=\"9\"\n"; + } + else + { + fout << "\t\t\t\tSubSystem=\"8\"\n"; + } + fout << "\t\t\t\tEntryPointSymbol=\"" + << (isWin32Executable ? "WinMainCRTStartup" : "mainACRTStartup") + << "\"\n"; + } + else if ( this->FortranProject ) { fout << "\t\t\t\tSubSystem=\"" - << (this->FortranProject? "subSystemWindows" : "2") << "\"\n"; + << (isWin32Executable ? "subSystemWindows" : "subSystemConsole") + << "\"\n"; } else { fout << "\t\t\t\tSubSystem=\"" - << (this->FortranProject? "subSystemConsole" : "1") << "\"\n"; + << (isWin32Executable ? "2" : "1") + << "\"\n"; } std::string stackVar = "CMAKE_"; stackVar += linkLanguage; @@ -1592,17 +1621,30 @@ cmLocalVisualStudio7Generator return dir_max; } -void cmLocalVisualStudio7Generator +bool cmLocalVisualStudio7Generator ::WriteGroup(const cmSourceGroup *sg, cmTarget& target, - std::ostream &fout, const char *libName, + std::ostream &fout, const char *libName, std::vector *configs) { const std::vector &sourceFiles = sg->GetSourceFiles(); + std::vector const& children = sg->GetGroupChildren(); + + // Write the children to temporary output. + bool hasChildrenWithSources = false; + cmOStringStream tmpOut; + for(unsigned int i=0;iWriteGroup(&children[i], target, tmpOut, libName, configs)) + { + hasChildrenWithSources = true; + } + } + // If the group is empty, don't write it at all. - if(sourceFiles.empty() && sg->GetGroupChildren().empty()) + if(sourceFiles.empty() && !hasChildrenWithSources) { - return; + return false; } // If the group has a name, write the header. @@ -1652,7 +1694,7 @@ void cmLocalVisualStudio7Generator } if(ext == "rc") { - aCompilerTool = "VCResourceCompilerTool"; + aCompilerTool = "VCResourceCompilerTool"; lang = "RC"; if(this->FortranProject) { @@ -1723,11 +1765,10 @@ void cmLocalVisualStudio7Generator } } - std::vector const& children = sg->GetGroupChildren(); - - for(unsigned int i=0;iWriteGroup(&children[i], target, fout, libName, configs); + fout << tmpOut.str(); } // If the group has a name, write the footer. @@ -1735,6 +1776,8 @@ void cmLocalVisualStudio7Generator { this->WriteVCProjEndGroup(fout); } + + return true; } void cmLocalVisualStudio7Generator:: @@ -1744,7 +1787,7 @@ WriteCustomRule(std::ostream& fout, FCInfo& fcinfo) { std::string comment = this->ConstructComment(command); - + // Write the rule for each configuration. std::vector::iterator i; std::vector *configs = @@ -1780,9 +1823,9 @@ WriteCustomRule(std::ostream& fout, } fout << "\t\t\t\t\tEscapeForXML(comment.c_str()) << "\"\n" - << "\t\t\t\t\tCommandLine=\"" + << "\t\t\t\t\tCommandLine=\"" << this->EscapeForXML(script.c_str()) << "\"\n" << "\t\t\t\t\tAdditionalDependencies=\""; if(command.GetDepends().empty()) @@ -1799,9 +1842,9 @@ WriteCustomRule(std::ostream& fout, else { // Write out the dependencies for the rule. - for(std::vector::const_iterator d = + for(std::vector::const_iterator d = command.GetDepends().begin(); - d != command.GetDepends().end(); + d != command.GetDepends().end(); ++d) { // Get the real name of the dependency in case it is a CMake target. @@ -1823,9 +1866,9 @@ WriteCustomRule(std::ostream& fout, { // Write a rule for the output generated by this command. const char* sep = ""; - for(std::vector::const_iterator o = - command.GetOutputs().begin(); - o != command.GetOutputs().end(); + for(std::vector::const_iterator o = + command.GetOutputs().begin(); + o != command.GetOutputs().end(); ++o) { fout << sep << this->ConvertToXMLOutputPathSingle(o->c_str()); @@ -1922,7 +1965,7 @@ cmLocalVisualStudio7Generator const char *libName, cmTarget & target) { - + cmGlobalVisualStudio7Generator* gg = static_cast(this->GlobalGenerator); @@ -1954,7 +1997,7 @@ cmLocalVisualStudio7Generator if(!keyword) { keyword = "Console Application"; - } + } const char* projectType = 0; switch(target.GetType()) { @@ -1990,7 +2033,7 @@ cmLocalVisualStudio7Generator fout << "\tProjectType=\"" << projectType << "\"\n"; } this->WriteProjectSCC(fout, target); - fout<< "\tKeyword=\"" << keyword << "\">\n" + fout<< "\tKeyword=\"" << keyword << "\">\n" << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n" << "\t\n" << "\t\tPlatformName << "\"/>\n" @@ -2110,7 +2153,7 @@ std::string cmLocalVisualStudio7Generator // This class is used to parse an existing vs 7 project -// and extract the GUID +// and extract the GUID class cmVS7XMLParser : public cmXMLParser { public: @@ -2130,7 +2173,7 @@ public: while(atts[i]) { if(strcmp(atts[i], "ProjectGUID") == 0) - { + { if(atts[i+1]) { this->GUID = atts[i+1]; @@ -2144,7 +2187,7 @@ public: } ++i; } - } + } } int InitializeParser() { @@ -2153,7 +2196,7 @@ public: { return ret; } - // visual studio projects have a strange encoding, but it is + // visual studio projects have a strange encoding, but it is // really utf-8 XML_SetEncoding(static_cast(this->Parser), "utf-8"); return 1; diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 9aa408eda..d9e2ef0dd 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -42,7 +42,7 @@ public: virtual void AddHelperCommands(); /** - * Generate the makefile for this directory. + * Generate the makefile for this directory. */ virtual void Generate(); @@ -77,17 +77,17 @@ private: void WriteVCProjHeader(std::ostream& fout, const char *libName, cmTarget &tgt, std::vector &sgs); void WriteVCProjFooter(std::ostream& fout, cmTarget &target); - void WriteVCProjFile(std::ostream& fout, const char *libName, + void WriteVCProjFile(std::ostream& fout, const char *libName, cmTarget &tgt); void WriteConfigurations(std::ostream& fout, const char *libName, cmTarget &tgt); void WriteConfiguration(std::ostream& fout, const char* configName, - const char* libName, cmTarget &tgt); + const char* libName, cmTarget &tgt); std::string EscapeForXML(const char* s); std::string ConvertToXMLOutputPath(const char* path); std::string ConvertToXMLOutputPathSingle(const char* path); - void OutputTargetRules(std::ostream& fout, const char* configName, + void OutputTargetRules(std::ostream& fout, const char* configName, cmTarget &target, const char *libName); void OutputBuildTool(std::ostream& fout, const char* configName, cmTarget& t, bool debug); @@ -98,18 +98,18 @@ private: cmTarget &tgt, std::vector &sgs); void WriteProjectStartFortran(std::ostream& fout, const char *libName, cmTarget &tgt); - void WriteVCProjBeginGroup(std::ostream& fout, + void WriteVCProjBeginGroup(std::ostream& fout, const char* group, const char* filter); void WriteVCProjEndGroup(std::ostream& fout); - + void WriteCustomRule(std::ostream& fout, const char* source, const cmCustomCommand& command, FCInfo& fcinfo); void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target); - void WriteGroup(const cmSourceGroup *sg, + bool WriteGroup(const cmSourceGroup *sg, cmTarget& target, std::ostream &fout, const char *libName, std::vector *configs); @@ -122,7 +122,8 @@ private: cmVS7FlagTable const* ExtraFlagTable; std::string ModuleDefinitionFile; bool FortranProject; - std::string PlatformName; // Win32 or x64 + bool WindowsCEProject; + std::string PlatformName; // Win32 or x64 cmLocalVisualStudio7GeneratorInternals* Internal; }; diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 4bcf4defd..ef2bb1d99 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -84,7 +84,6 @@ cmLocalVisualStudioGenerator const char* newline_text) { bool useLocal = this->CustomCommandUseLocal(); - const cmCustomCommandLines& commandLines = cc.GetCommandLines(); const char* workingDirectory = cc.GetWorkingDirectory(); cmCustomCommandGenerator ccg(cc, configName, this->Makefile); RelativeRoot relativeRoot = workingDirectory? NONE : START_OUTPUT; diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 259922759..bd7ec004b 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -56,7 +56,7 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InvokeInitialPass(const std::vector& args, + virtual bool InvokeInitialPass(const std::vector& args, cmExecutionStatus &); virtual bool InitialPass(std::vector const&, @@ -66,7 +66,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const { return this->Args[0].c_str(); } - + /** * Succinct documentation. */ @@ -164,7 +164,7 @@ bool cmMacroHelperCommand::InvokeInitialPass { variable = "${"; variable += this->Args[j]; - variable += "}"; + variable += "}"; cmSystemTools::ReplaceString(tmps, variable.c_str(), expandedArgs[j-1].c_str()); } @@ -270,7 +270,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, else if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endmacro")) { // if this is the endmacro for this macro then execute - if (!this->Depth) + if (!this->Depth) { std::string name = this->Args[0]; std::vector::size_type cc; @@ -287,7 +287,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, f->Functions = this->Functions; mf.RecordPolicies(f->Policies); std::string newName = "_" + this->Args[0]; - mf.GetCMakeInstance()->RenameCommand(this->Args[0].c_str(), + mf.GetCMakeInstance()->RenameCommand(this->Args[0].c_str(), newName.c_str()); mf.AddCommand(f); @@ -341,7 +341,7 @@ bool cmMacroCommand::InitialPass(std::vector const& args, cmMacroFunctionBlocker *f = new cmMacroFunctionBlocker(); for(std::vector::const_iterator j = args.begin(); j != args.end(); ++j) - { + { f->Args.push_back(*j); } this->Makefile->AddFunctionBlocker(f); diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index 36e4b2f6b..aedbb4ddc 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -20,11 +20,11 @@ class cmMacroFunctionBlocker : public cmFunctionBlocker public: cmMacroFunctionBlocker() {this->Depth=0;} virtual ~cmMacroFunctionBlocker() {} - virtual bool IsFunctionBlocked(const cmListFileFunction&, + virtual bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile &mf, cmExecutionStatus &); virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile &mf); - + std::vector Args; std::vector Functions; int Depth; @@ -92,12 +92,12 @@ public: "facilitates creating macros with optional arguments. Additionally " "${ARGV} holds the list of all arguments given to the macro and " "${ARGN} " - "holds the list of argument past the last expected argument. " + "holds the list of arguments past the last expected argument. " "Note that the parameters to a macro and values such as ARGN " "are not variables in the usual CMake sense. They are string " - "replacements much like the c preprocessor would do with a " - "macro. If you want true CMake variables you should look at " - "the function command." + "replacements much like the C preprocessor would do with a macro. " + "If you want true CMake variables and/or better CMake scope control " + "you should look at the function command." "\n" "See the cmake_policy() command documentation for the behavior of " "policies inside macros." diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 6055c5585..2ae35ef14 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmMakeDepend.h" #include "cmSystemTools.h" +#include "cmGeneratorExpression.h" #include @@ -31,8 +32,8 @@ cmMakeDepend::cmMakeDepend() cmMakeDepend::~cmMakeDepend() -{ - for(DependInformationMapType::iterator i = +{ + for(DependInformationMapType::iterator i = this->DependInformationMap.begin(); i != this->DependInformationMap.end(); ++i) { @@ -58,11 +59,22 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile) // Now extract any include paths from the targets std::set uniqueIncludes; std::vector orderedAndUniqueIncludes; - cmTargets & targets = this->Makefile->GetTargets(); - for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l) + cmTargets &targets = this->Makefile->GetTargets(); + for (cmTargets::iterator l = targets.begin(); + l != targets.end(); ++l) { - const std::vector& includes = - l->second.GetIncludeDirectories(); + const char *incDirProp = l->second.GetProperty("INCLUDE_DIRECTORIES"); + if (!incDirProp) + { + continue; + } + + std::string incDirs = cmGeneratorExpression::Preprocess(incDirProp, + cmGeneratorExpression::StripAllGeneratorExpressions); + + std::vector includes; + cmSystemTools::ExpandListArgument(incDirs.c_str(), includes); + for(std::vector::const_iterator j = includes.begin(); j != includes.end(); ++j) { @@ -162,7 +174,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info) else { //try to guess which include path to use - for(std::vector::iterator t = + for(std::vector::iterator t = this->IncludeDirectories.begin(); t != this->IncludeDirectories.end(); ++t) { @@ -175,7 +187,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info) if (srcFile->GetFullPath() == incpath) { // set the path to the guessed path - info->FullPath = incpath; + info->FullPath = incpath; found=true; } } @@ -243,7 +255,7 @@ void cmMakeDepend::DependWalk(cmDependInformation* info) void cmMakeDepend::AddDependency(cmDependInformation* info, const char* file) { - cmDependInformation* dependInfo = + cmDependInformation* dependInfo = this->GetDependInformation(file, info->PathOnly.c_str()); this->GenerateDependInformation(dependInfo); info->AddDependencies(dependInfo); @@ -288,7 +300,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) { m = this->DirectoryToFileToPathMap.find(""); } - + if(m != this->DirectoryToFileToPathMap.end()) { FileToPathMapType& map = m->second; @@ -305,7 +317,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) this->DirectoryToFileToPathMap[extraPath? extraPath: ""][fname] = fp; return fp; } - + for(std::vector::iterator i = this->IncludeDirectories.begin(); i != this->IncludeDirectories.end(); ++i) { diff --git a/Source/cmMakeDepend.h b/Source/cmMakeDepend.h index 185f4e356..b6e3928e9 100644 --- a/Source/cmMakeDepend.h +++ b/Source/cmMakeDepend.h @@ -48,26 +48,26 @@ public: * to it. */ const cmSourceFile *SourceFile; - + /** * Full path to this file. */ std::string FullPath; - + /** * Full path not including file name. */ std::string PathOnly; - + /** * Name used to #include this file. */ std::string IncludeName; - + /** * This method adds the dependencies of another file to this one. */ - void AddDependencies(cmDependInformation*); + void AddDependencies(cmDependInformation*); }; @@ -85,11 +85,11 @@ public: * Destructor. */ virtual ~cmMakeDepend(); - - /** + + /** * Set the makefile that is used as a source of classes. */ - virtual void SetMakefile(cmMakefile* makefile); + virtual void SetMakefile(cmMakefile* makefile); /** * Add a directory to the search path for include files. @@ -107,26 +107,26 @@ protected: * Compute the depend information for this class. */ virtual void DependWalk(cmDependInformation* info); - + /** * Add a dependency. Possibly walk it for more dependencies. */ virtual void AddDependency(cmDependInformation* info, const char* file); - + /** * Fill in the given object with dependency information. If the * information is already complete, nothing is done. */ void GenerateDependInformation(cmDependInformation* info); - + /** * Get an instance of cmDependInformation corresponding to the given file * name. */ - cmDependInformation* GetDependInformation(const char* file, - const char *extraPath); - - /** + cmDependInformation* GetDependInformation(const char* file, + const char *extraPath); + + /** * Find the full path name for the given file name. * This uses the include directories. * TODO: Cache path conversions to reduce FileExists calls. @@ -139,9 +139,9 @@ protected: cmsys::RegularExpression ComplainFileRegularExpression; std::vector IncludeDirectories; typedef std::map FileToPathMapType; - typedef std::map + typedef std::map DirectoryToFileToPathMapType; - typedef std::map + typedef std::map DependInformationMapType; DependInformationMapType DependInformationMap; DirectoryToFileToPathMapType DirectoryToFileToPathMap; diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h index 4e6e1d5ab..a0f866a5f 100644 --- a/Source/cmMakeDirectoryCommand.h +++ b/Source/cmMakeDirectoryCommand.h @@ -29,7 +29,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmMakeDirectoryCommand; } @@ -45,7 +45,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const { return "make_directory";} - + /** * This determines if the command is invoked when in script mode. */ @@ -58,7 +58,7 @@ public: { return "Deprecated. Use the file(MAKE_DIRECTORY ) command instead."; } - + /** * More documentation. */ @@ -70,7 +70,7 @@ public: "parent directories that do not exist will also be created. Use with " "care."; } - + /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7b6c450f1..25ccbc739 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -23,6 +23,7 @@ #include "cmListFileCache.h" #include "cmCommandArgumentParserHelper.h" #include "cmDocumentCompileDefinitions.h" +#include "cmGeneratorExpression.h" #include "cmTest.h" #ifdef CMAKE_BUILD_WITH_CMAKE # include "cmVariableWatch.h" @@ -46,6 +47,7 @@ public: std::stack > VarStack; std::stack > VarInitStack; std::stack > VarUsageStack; + bool IsSourceFileTryCompile; }; // default is not to be building executables @@ -56,6 +58,7 @@ cmMakefile::cmMakefile(): Internal(new Internals) this->Internal->VarStack.push(defs); this->Internal->VarInitStack.push(globalKeys); this->Internal->VarUsageStack.push(globalKeys); + this->Internal->IsSourceFileTryCompile = false; // Initialize these first since AddDefaultDefinitions calls AddDefinition this->WarnUnused = false; @@ -97,6 +100,7 @@ cmMakefile::cmMakefile(): Internal(new Internals) this->AddDefaultDefinitions(); this->Initialize(); this->PreOrder = false; + this->GeneratingBuildSystem = false; } cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals) @@ -812,7 +816,7 @@ bool cmMakefile::NeedBackwardsCompatibility(unsigned int major, void cmMakefile::FinalPass() { // do all the variable expansions here - this->ExpandVariables(); + this->ExpandVariablesCMP0019(); // give all the commands a chance to do something // after the file has been parsed before generation @@ -1483,9 +1487,12 @@ void cmMakefile::InitializeFromParent() // Initialize definitions with the closure of the parent scope. this->Internal->VarStack.top() = parent->Internal->VarStack.top().Closure(); - // copy include paths - this->SetProperty("INCLUDE_DIRECTORIES", - parent->GetProperty("INCLUDE_DIRECTORIES")); + const std::vector parentIncludes = + parent->GetIncludeDirectoriesEntries(); + this->IncludeDirectoriesEntries.insert(this->IncludeDirectoriesEntries.end(), + parentIncludes.begin(), + parentIncludes.end()); + this->SystemIncludeDirectories = parent->SystemIncludeDirectories; // define flags @@ -1611,74 +1618,72 @@ void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath, } //---------------------------------------------------------------------------- -void AddStringToProperty(cmProperty *prop, const char* name, const char* s, - bool before) +void cmMakefile::AddIncludeDirectories(const std::vector &incs, + bool before) { - if (!prop) + if (incs.empty()) { return; } - // Don't worry about duplicates at this point. We eliminate them when - // we convert the property to a vector in GetIncludeDirectories. + std::string incString; + std::string sep; - if (before) + for(std::vector::const_iterator li = incs.begin(); + li != incs.end(); ++li) { - const char *val = prop->GetValue(); - cmOStringStream oss; - - if(val && *val) - { - oss << s << ";" << val; - } - else - { - oss << s; - } - - std::string newVal = oss.str(); - prop->Set(name, newVal.c_str()); + incString += sep + *li; + sep = ";"; } - else - { - prop->Append(name, s); - } -} -//---------------------------------------------------------------------------- -void cmMakefile::AddIncludeDirectory(const char* inc, bool before) -{ - if (!inc) - { - return; - } + std::vector::iterator position = + before ? this->IncludeDirectoriesEntries.begin() + : this->IncludeDirectoriesEntries.end(); - // Directory property: - cmProperty *prop = - this->GetProperties().GetOrCreateProperty("INCLUDE_DIRECTORIES"); - AddStringToProperty(prop, "INCLUDE_DIRECTORIES", inc, before); + cmListFileBacktrace lfbt; + this->GetBacktrace(lfbt); + cmValueWithOrigin entry(incString, lfbt); + this->IncludeDirectoriesEntries.insert(position, entry); // Property on each target: for (cmTargets::iterator l = this->Targets.begin(); l != this->Targets.end(); ++l) { cmTarget &t = l->second; - prop = t.GetProperties().GetOrCreateProperty("INCLUDE_DIRECTORIES"); - AddStringToProperty(prop, "INCLUDE_DIRECTORIES", inc, before); + t.InsertInclude(entry, before); } } //---------------------------------------------------------------------------- -void cmMakefile::AddSystemIncludeDirectory(const char* dir) +void +cmMakefile::AddSystemIncludeDirectories(const std::set &incs) { - this->SystemIncludeDirectories.insert(dir); + for(std::set::const_iterator li = incs.begin(); + li != incs.end(); ++li) + { + this->SystemIncludeDirectories.insert(*li); + } } //---------------------------------------------------------------------------- -bool cmMakefile::IsSystemIncludeDirectory(const char* dir) +bool cmMakefile::IsSystemIncludeDirectory(const char* dir, const char *config) { - return (this->SystemIncludeDirectories.find(dir) != - this->SystemIncludeDirectories.end()); + for (std::set::const_iterator + it = this->SystemIncludeDirectories.begin(); + it != this->SystemIncludeDirectories.end(); ++it) + { + cmListFileBacktrace lfbt; + cmGeneratorExpression ge(lfbt); + + std::vector incs; + cmSystemTools::ExpandListArgument(ge.Parse(*it) + ->Evaluate(this, config, false), incs); + if (std::find(incs.begin(), incs.end(), dir) != incs.end()) + { + return true; + } + } + return false; } void cmMakefile::AddDefinition(const char* name, const char* value) @@ -2120,21 +2125,33 @@ void cmMakefile::AddExtraDirectory(const char* dir) this->AuxSourceDirectories.push_back(dir); } +static bool mightExpandVariablesCMP0019(const char* s) +{ + return s && *s && strstr(s,"${") && strchr(s,'}'); +} -// expand CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR in the -// include and library directories. - -void cmMakefile::ExpandVariables() +void cmMakefile::ExpandVariablesCMP0019() { - // Now expand variables in the include and link strings + // Drop this ancient compatibility behavior with a policy. + cmPolicies::PolicyStatus pol = this->GetPolicyStatus(cmPolicies::CMP0019); + if(pol != cmPolicies::OLD && pol != cmPolicies::WARN) + { + return; + } + cmOStringStream w; - // May not be necessary anymore... But may need a policy for strict - // backwards compatibility const char *includeDirs = this->GetProperty("INCLUDE_DIRECTORIES"); - if (includeDirs) + if(mightExpandVariablesCMP0019(includeDirs)) { std::string dirs = includeDirs; this->ExpandVariablesInString(dirs, true, true); + if(pol == cmPolicies::WARN && dirs != includeDirs) + { + w << "Evaluated directory INCLUDE_DIRECTORIES\n" + << " " << includeDirs << "\n" + << "as\n" + << " " << dirs << "\n"; + } this->SetProperty("INCLUDE_DIRECTORIES", dirs.c_str()); } @@ -2144,10 +2161,17 @@ void cmMakefile::ExpandVariables() { cmTarget &t = l->second; includeDirs = t.GetProperty("INCLUDE_DIRECTORIES"); - if (includeDirs) + if(mightExpandVariablesCMP0019(includeDirs)) { std::string dirs = includeDirs; this->ExpandVariablesInString(dirs, true, true); + if(pol == cmPolicies::WARN && dirs != includeDirs) + { + w << "Evaluated target " << t.GetName() << " INCLUDE_DIRECTORIES\n" + << " " << includeDirs << "\n" + << "as\n" + << " " << dirs << "\n"; + } t.SetProperty("INCLUDE_DIRECTORIES", dirs.c_str()); } } @@ -2155,13 +2179,45 @@ void cmMakefile::ExpandVariables() for(std::vector::iterator d = this->LinkDirectories.begin(); d != this->LinkDirectories.end(); ++d) { - this->ExpandVariablesInString(*d, true, true); + if(mightExpandVariablesCMP0019(d->c_str())) + { + std::string orig = *d; + this->ExpandVariablesInString(*d, true, true); + if(pol == cmPolicies::WARN && *d != orig) + { + w << "Evaluated link directory\n" + << " " << orig << "\n" + << "as\n" + << " " << *d << "\n"; + } + } } for(cmTarget::LinkLibraryVectorType::iterator l = this->LinkLibraries.begin(); l != this->LinkLibraries.end(); ++l) { - this->ExpandVariablesInString(l->first, true, true); + if(mightExpandVariablesCMP0019(l->first.c_str())) + { + std::string orig = l->first; + this->ExpandVariablesInString(l->first, true, true); + if(pol == cmPolicies::WARN && l->first != orig) + { + w << "Evaluated link library\n" + << " " << orig << "\n" + << "as\n" + << " " << l->first << "\n"; + } + } + } + + if(!w.str().empty()) + { + cmOStringStream m; + m << this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0019) + << "\n" + << "The following variable evaluations were encountered:\n" + << w.str(); + this->IssueMessage(cmake::AUTHOR_WARNING, m.str()); } } @@ -2219,7 +2275,7 @@ bool cmMakefile::CanIWriteThisFile(const char* fileName) { return true; } - // If we are doing an in-source build, than the test will always fail + // If we are doing an in-source build, then the test will always fail if ( cmSystemTools::SameFile(this->GetHomeDirectory(), this->GetHomeOutputDirectory()) ) { @@ -2230,8 +2286,8 @@ bool cmMakefile::CanIWriteThisFile(const char* fileName) return true; } - // Check if this is subdirectory of the source tree but not a - // subdirectory of a build tree + // Check if this is a subdirectory of the source tree but not a + // subdirectory of the build tree if ( cmSystemTools::IsSubDirectory(fileName, this->GetHomeDirectory()) && !cmSystemTools::IsSubDirectory(fileName, @@ -2912,6 +2968,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, const std::vector *cmakeArgs, std::string *output) { + this->Internal->IsSourceFileTryCompile = fast; // does the binary directory exist ? If not create it... if (!cmSystemTools::FileIsDirectory(bindir)) { @@ -2937,6 +2994,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, "Internal CMake error, TryCompile bad GlobalGenerator"); // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); + this->Internal->IsSourceFileTryCompile = false; return 1; } cm.SetGlobalGenerator(gg); @@ -2947,6 +3005,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, cm.SetStartDirectory(srcdir); cm.SetStartOutputDirectory(bindir); cm.SetCMakeCommand(cmakeCommand.c_str()); + cm.SetGeneratorToolset(this->GetCMakeInstance()->GetGeneratorToolset()); cm.LoadCache(); if(!gg->IsMultiConfig()) { @@ -3009,6 +3068,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, "Internal CMake error, TryCompile configure of cmake failed"); // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); + this->Internal->IsSourceFileTryCompile = false; return 1; } @@ -3018,6 +3078,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, "Internal CMake error, TryCompile generation of cmake failed"); // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); + this->Internal->IsSourceFileTryCompile = false; return 1; } @@ -3031,9 +3092,15 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, this); cmSystemTools::ChangeDirectory(cwd.c_str()); + this->Internal->IsSourceFileTryCompile = false; return ret; } +bool cmMakefile::GetIsSourceFileTryCompile() const +{ + return this->Internal->IsSourceFileTryCompile; +} + cmake *cmMakefile::GetCMakeInstance() const { if ( this->LocalGenerator && this->LocalGenerator->GetGlobalGenerator() ) @@ -3388,6 +3455,15 @@ void cmMakefile::SetProperty(const char* prop, const char* value) this->SetLinkDirectories(varArgsExpanded); return; } + if (propname == "INCLUDE_DIRECTORIES") + { + this->IncludeDirectoriesEntries.clear(); + cmListFileBacktrace lfbt; + this->GetBacktrace(lfbt); + this->IncludeDirectoriesEntries.push_back( + cmValueWithOrigin(value, lfbt)); + return; + } if ( propname == "INCLUDE_REGULAR_EXPRESSION" ) { @@ -3419,6 +3495,14 @@ void cmMakefile::AppendProperty(const char* prop, const char* value, // handle special props std::string propname = prop; + if (propname == "INCLUDE_DIRECTORIES") + { + cmListFileBacktrace lfbt; + this->GetBacktrace(lfbt); + this->IncludeDirectoriesEntries.push_back( + cmValueWithOrigin(value, lfbt)); + return; + } if ( propname == "LINK_DIRECTORIES" ) { std::vector varArgsExpanded; @@ -3530,6 +3614,20 @@ const char *cmMakefile::GetProperty(const char* prop, output = str.str(); return output.c_str(); } + else if (!strcmp("INCLUDE_DIRECTORIES",prop)) + { + std::string sep; + for (std::vector::const_iterator + it = this->IncludeDirectoriesEntries.begin(), + end = this->IncludeDirectoriesEntries.end(); + it != end; ++it) + { + output += sep; + output += it->Value; + sep = ";"; + } + return output.c_str(); + } bool chain = false; const char *retVal = @@ -3925,6 +4023,46 @@ void cmMakefile::DefineProperties(cmake *cm) "See the global property of the same name for details. " "This overrides the global property for a directory.", true); + + cm->DefineProperty + ("VS_GLOBAL_SECTION_PRE_
", cmProperty::DIRECTORY, + "Specify a preSolution global section in Visual Studio.", + "Setting a property like this generates an entry of the following form " + "in the solution file:\n" + " GlobalSection(
) = preSolution\n" + " \n" + " EndGlobalSection\n" + "The property must be set to a semicolon-separated list of key=value " + "pairs. Each such pair will be transformed into an entry in the solution " + "global section. Whitespace around key and value is ignored. List " + "elements which do not contain an equal sign are skipped." + "\n" + "This property only works for Visual Studio 7 and above; it is ignored " + "on other generators. The property only applies when set on a directory " + "whose CMakeLists.txt conatins a project() command."); + cm->DefineProperty + ("VS_GLOBAL_SECTION_POST_
", cmProperty::DIRECTORY, + "Specify a postSolution global section in Visual Studio.", + "Setting a property like this generates an entry of the following form " + "in the solution file:\n" + " GlobalSection(
) = postSolution\n" + " \n" + " EndGlobalSection\n" + "The property must be set to a semicolon-separated list of key=value " + "pairs. Each such pair will be transformed into an entry in the solution " + "global section. Whitespace around key and value is ignored. List " + "elements which do not contain an equal sign are skipped." + "\n" + "This property only works for Visual Studio 7 and above; it is ignored " + "on other generators. The property only applies when set on a directory " + "whose CMakeLists.txt conatins a project() command." + "\n" + "Note that CMake generates postSolution sections ExtensibilityGlobals " + "and ExtensibilityAddIns by default. If you set the corresponding " + "property, it will override the default section. For example, setting " + "VS_GLOBAL_SECTION_POST_ExtensibilityGlobals will override the default " + "contents of the ExtensibilityGlobals section, while keeping " + "ExtensibilityAddIns on its default."); } //---------------------------------------------------------------------------- @@ -3972,6 +4110,12 @@ cmTarget* cmMakefile::FindTargetToUse(const char* name) return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, name); } +cmGeneratorTarget* cmMakefile::FindGeneratorTargetToUse(const char* name) +{ + cmTarget *t = this->FindTargetToUse(name); + return this->LocalGenerator->GetGlobalGenerator()->GetGeneratorTarget(t); +} + //---------------------------------------------------------------------------- bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, bool isCustom) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8a0088b1a..74a731d5b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -20,6 +20,7 @@ #include "cmSystemTools.h" #include "cmTarget.h" #include "cmNewLineStyle.h" +#include "cmGeneratorTarget.h" #include "cmake.h" #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -128,6 +129,8 @@ public: const std::vector *cmakeArgs, std::string *output); + bool GetIsSourceFileTryCompile() const; + /** * Specify the makefile generator. This is platform/compiler * dependent, although the interface is through a generic @@ -283,7 +286,8 @@ public: /** * Add an include directory to the build. */ - void AddIncludeDirectory(const char*, bool before = false); + void AddIncludeDirectories(const std::vector &incs, + bool before = false); /** * Add a variable definition to the build. This variable @@ -516,18 +520,33 @@ public: * Get the list of targets, const version */ const cmTargets &GetTargets() const { return this->Targets; } + const std::vector &GetOwnedImportedTargets() const + { + return this->ImportedTargetsOwned; + } + + const cmGeneratorTargetsType &GetGeneratorTargets() const + { + return this->GeneratorTargets; + } + + void SetGeneratorTargets(const cmGeneratorTargetsType &targets) + { + this->GeneratorTargets = targets; + } cmTarget* FindTarget(const char* name); /** Find a target to use in place of the given name. The target returned may be imported or built within the project. */ cmTarget* FindTargetToUse(const char* name); + cmGeneratorTarget* FindGeneratorTargetToUse(const char* name); /** * Mark include directories as system directories. */ - void AddSystemIncludeDirectory(const char* dir); - bool IsSystemIncludeDirectory(const char* dir); + void AddSystemIncludeDirectories(const std::set &incs); + bool IsSystemIncludeDirectory(const char* dir, const char *config); /** Expand out any arguements in the vector that have ; separated * strings into multiple arguements. A new vector is created @@ -675,7 +694,7 @@ public: /** * Expand variables in the makefiles ivars such as link directories etc */ - void ExpandVariables(); + void ExpandVariablesCMP0019(); /** * Replace variables and #cmakedefine lines in the given string. @@ -843,6 +862,14 @@ public: /** Set whether or not to report a CMP0000 violation. */ void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; } + std::vector GetIncludeDirectoriesEntries() const + { + return this->IncludeDirectoriesEntries; + } + + bool IsGeneratingBuildSystem(){ return this->GeneratingBuildSystem; } + void SetGeneratingBuildSystem(){ this->GeneratingBuildSystem = true; } + protected: // add link libraries and directories to the target void AddGlobalLinkInformation(const char* name, cmTarget& target); @@ -863,6 +890,7 @@ protected: // libraries, classes, and executables cmTargets Targets; + cmGeneratorTargetsType GeneratorTargets; std::vector SourceFiles; // Tests @@ -890,6 +918,8 @@ protected: std::vector HeaderFileExtensions; std::string DefineFlags; + std::vector IncludeDirectoriesEntries; + // Track the value of the computed DEFINITIONS property. void AddDefineFlag(const char*, std::string&); void RemoveDefineFlag(const char*, std::string::size_type, std::string&); @@ -989,6 +1019,9 @@ private: // Enforce rules about CMakeLists.txt files. void EnforceDirectoryLevelRules(); + + bool GeneratingBuildSystem; + }; //---------------------------------------------------------------------------- diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index ab5150a36..b7a454b17 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -131,9 +131,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) outpathImp += "/"; } } + + std::string pdbOutputPath = this->Target->GetPDBDirectory(); + cmSystemTools::MakeDirectory(pdbOutputPath.c_str()); + pdbOutputPath += "/"; + std::string targetFullPath = outpath + targetName; std::string targetFullPathReal = outpath + targetNameReal; - std::string targetFullPathPDB = outpath + targetNamePDB; + std::string targetFullPathPDB = pdbOutputPath + targetNamePDB; std::string targetFullPathImport = outpathImp + targetNameImport; std::string targetOutPathPDB = this->Convert(targetFullPathPDB.c_str(), @@ -210,7 +215,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Add language feature flags. this->AddFeatureFlags(flags, linkLanguage); - this->LocalGenerator->AddArchitectureFlags(flags, this->Target, + this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget, linkLanguage, this->ConfigName); // Add target-specific linker flags. @@ -318,9 +323,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) this->LocalGenerator->SetLinkScriptShell(useLinkScript); // Collect up flags to link in needed libraries. - cmOStringStream linklibs; - this->LocalGenerator->OutputLinkLibraries(linklibs, *this->Target, relink); - + std::string linkLibs; + std::string frameworkPath; + std::string linkPath; + this->LocalGenerator->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, + *this->GeneratorTarget, + relink); + linkLibs = frameworkPath + linkPath + linkLibs; // Construct object file lists that may be needed to expand the // rule. std::string buildObjs; @@ -359,8 +368,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) vars.TargetVersionMajor = targetVersionMajor.c_str(); vars.TargetVersionMinor = targetVersionMinor.c_str(); - std::string linkString = linklibs.str(); - vars.LinkLibraries = linkString.c_str(); + vars.LinkLibraries = linkLibs.c_str(); vars.Flags = flags.c_str(); vars.LinkFlags = linkFlags.c_str(); // Expand placeholders in the commands. diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 577e5fd07..5b4e4d774 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -19,8 +19,6 @@ #include "cmTarget.h" #include "cmake.h" -#include // auto_ptr - //---------------------------------------------------------------------------- cmMakefileLibraryTargetGenerator ::cmMakefileLibraryTargetGenerator(cmTarget* target): @@ -328,8 +326,12 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules } } + std::string pdbOutputPath = this->Target->GetPDBDirectory(); + cmSystemTools::MakeDirectory(pdbOutputPath.c_str()); + pdbOutputPath += "/"; + std::string targetFullPath = outpath + targetName; - std::string targetFullPathPDB = outpath + targetNamePDB; + std::string targetFullPathPDB = pdbOutputPath + targetNamePDB; std::string targetFullPathSO = outpath + targetNameSO; std::string targetFullPathReal = outpath + targetNameReal; std::string targetFullPathImport = outpathImp + targetNameImport; @@ -542,11 +544,15 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules this->LocalGenerator->SetLinkScriptShell(useLinkScript); // Collect up flags to link in needed libraries. - cmOStringStream linklibs; + std::string linkLibs; if(this->Target->GetType() != cmTarget::STATIC_LIBRARY) { + std::string frameworkPath; + std::string linkPath; this->LocalGenerator - ->OutputLinkLibraries(linklibs, *this->Target, relink); + ->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, + *this->GeneratorTarget, relink); + linkLibs = frameworkPath + linkPath + linkLibs; } // Construct object file lists that may be needed to expand the @@ -587,8 +593,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules cmLocalGenerator::SHELL); vars.ObjectDir = objdir.c_str(); vars.Target = targetOutPathReal.c_str(); - std::string linkString = linklibs.str(); - vars.LinkLibraries = linkString.c_str(); + vars.LinkLibraries = linkLibs.c_str(); vars.ObjectsQuoted = buildObjs.c_str(); if (this->Target->HasSOName(this->ConfigName)) { @@ -625,7 +630,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string langFlags; this->AddFeatureFlags(langFlags, linkLanguage); - this->LocalGenerator->AddArchitectureFlags(langFlags, this->Target, + this->LocalGenerator->AddArchitectureFlags(langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName); // remove any language flags that might not work with the diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0de182ede..d9aa7fed9 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -259,7 +259,7 @@ std::string cmMakefileTargetGenerator::GetFlags(const std::string &l) // Add language feature flags. this->AddFeatureFlags(flags, lang); - this->LocalGenerator->AddArchitectureFlags(flags, this->Target, + this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget, lang, this->ConfigName); // Fortran-specific flags computed for this target. @@ -268,7 +268,8 @@ std::string cmMakefileTargetGenerator::GetFlags(const std::string &l) this->AddFortranFlags(flags); } - this->LocalGenerator->AddCMP0018Flags(flags, this->Target, lang); + this->LocalGenerator->AddCMP0018Flags(flags, this->Target, + lang, this->ConfigName); // Add include directory flags. this->AddIncludeFlags(flags, lang); @@ -292,28 +293,26 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) ByLanguageMap::iterator i = this->DefinesByLanguage.find(l); if (i == this->DefinesByLanguage.end()) { - std::string defines; + std::set defines; const char *lang = l.c_str(); // Add the export symbol definition for shared library objects. if(const char* exportMacro = this->Target->GetExportMacro()) { - this->LocalGenerator->AppendDefines(defines, exportMacro, lang); + this->LocalGenerator->AppendDefines(defines, exportMacro); } // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AppendDefines - (defines, this->Makefile->GetProperty("COMPILE_DEFINITIONS"), lang); - this->LocalGenerator->AppendDefines - (defines, this->Target->GetProperty("COMPILE_DEFINITIONS"), lang); - std::string defPropName = "COMPILE_DEFINITIONS_"; - defPropName += - cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName); - this->LocalGenerator->AppendDefines - (defines, this->Makefile->GetProperty(defPropName.c_str()), lang); + (defines, this->Target->GetCompileDefinitions()); + this->LocalGenerator->AppendDefines - (defines, this->Target->GetProperty(defPropName.c_str()), lang); + (defines, this->Target->GetCompileDefinitions( + this->LocalGenerator->ConfigurationName.c_str())); + + std::string definesString; + this->LocalGenerator->JoinDefines(defines, definesString, lang); - ByLanguageMap::value_type entry(l, defines); + ByLanguageMap::value_type entry(l, definesString); i = this->DefinesByLanguage.insert(entry).first; } return i->second; @@ -587,14 +586,12 @@ cmMakefileTargetGenerator } // Add language-specific defines. - std::string defines = "$("; - defines += lang; - defines += "_DEFINES)"; + std::set defines; // Add source-sepcific preprocessor definitions. if(const char* compile_defs = source.GetProperty("COMPILE_DEFINITIONS")) { - this->LocalGenerator->AppendDefines(defines, compile_defs, lang); + this->LocalGenerator->AppendDefines(defines, compile_defs); *this->FlagFileStream << "# Custom defines: " << relativeObj << "_DEFINES = " << compile_defs << "\n" @@ -607,7 +604,7 @@ cmMakefileTargetGenerator if(const char* config_compile_defs = source.GetProperty(defPropName.c_str())) { - this->LocalGenerator->AppendDefines(defines, config_compile_defs, lang); + this->LocalGenerator->AppendDefines(defines, config_compile_defs); *this->FlagFileStream << "# Custom defines: " << relativeObj << "_DEFINES_" << configUpper @@ -651,7 +648,7 @@ cmMakefileTargetGenerator this->Target->GetType() == cmTarget::SHARED_LIBRARY || this->Target->GetType() == cmTarget::MODULE_LIBRARY) { - targetFullPathPDB = this->Target->GetDirectory(this->ConfigName); + targetFullPathPDB = this->Target->GetPDBDirectory(this->ConfigName); targetFullPathPDB += "/"; targetFullPathPDB += this->Target->GetPDBName(this->ConfigName); } @@ -676,7 +673,14 @@ cmMakefileTargetGenerator cmLocalGenerator::SHELL); vars.ObjectDir = objectDir.c_str(); vars.Flags = flags.c_str(); - vars.Defines = defines.c_str(); + + std::string definesString = "$("; + definesString += lang; + definesString += "_DEFINES)"; + + this->LocalGenerator->JoinDefines(defines, definesString, lang); + + vars.Defines = definesString.c_str(); bool lang_is_c_or_cxx = ((strcmp(lang, "C") == 0) || (strcmp(lang, "CXX") == 0)); @@ -1053,7 +1057,11 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << "SET(CMAKE_C_TARGET_INCLUDE_PATH\n"; std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target); + + const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, + "C", config); for(std::vector::iterator i = includes.begin(); i != includes.end(); ++i) { @@ -1538,11 +1546,15 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags() emitted.insert("/System/Library/Frameworks"); #endif std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target); - std::vector::iterator i; + + const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, + "C", config); // check all include directories for frameworks as this // will already have added a -F for the framework - for(i = includes.begin(); i != includes.end(); ++i) + for(std::vector::iterator i = includes.begin(); + i != includes.end(); ++i) { if(this->Target->NameResolvesToFramework(i->c_str())) { @@ -1554,17 +1566,21 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags() } std::string flags; - std::vector& frameworks = this->Target->GetFrameworks(); - for(i = frameworks.begin(); - i != frameworks.end(); ++i) + const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); + if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) { - if(emitted.insert(*i).second) + std::vector const& frameworks = cli->GetFrameworkPaths(); + for(std::vector::const_iterator i = frameworks.begin(); + i != frameworks.end(); ++i) { - flags += "-F"; - flags += this->Convert(i->c_str(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::SHELL, true); - flags += " "; + if(emitted.insert(*i).second) + { + flags += "-F"; + flags += this->Convert(i->c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL, true); + flags += " "; + } } } return flags; @@ -1842,7 +1858,10 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target, lang); + const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, + lang, config); std::string includeFlags = this->LocalGenerator->GetIncludeFlags(includes, lang, useResponseFile); @@ -1945,7 +1964,10 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) { std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target); + const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, + "C", config); for(std::vector::const_iterator idi = includes.begin(); idi != includes.end(); ++idi) { diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index a80f7ecd6..4236d102c 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -37,7 +37,7 @@ bool cmMarkAsAdvancedCommand { std::string variable = args[i]; cmCacheManager* manager = this->Makefile->GetCacheManager(); - cmCacheManager::CacheIterator it = + cmCacheManager::CacheIterator it = manager->GetCacheIterator(variable.c_str()); if ( it.IsAtEnd() ) { diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h index 3658dbbd3..246eb8aa3 100644 --- a/Source/cmMarkAsAdvancedCommand.h +++ b/Source/cmMarkAsAdvancedCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmMarkAsAdvancedCommand; } @@ -41,7 +41,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "mark_as_advanced";} - + /** * Succinct documentation. */ @@ -49,7 +49,7 @@ public: { return "Mark cmake cached variables as advanced."; } - + /** * More documentation. */ diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index 3c1129d04..9fc42659a 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -43,7 +43,7 @@ bool cmMathCommand::HandleExprCommand(std::vector const& args) const std::string& outputVariable = args[1]; const std::string& expression = args[2]; - + cmExprParserHelper helper; if ( !helper.ParseString(expression.c_str(), 0) ) { diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h index d62290428..dc0ceb340 100644 --- a/Source/cmMathCommand.h +++ b/Source/cmMathCommand.h @@ -21,7 +21,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmMathCommand; } @@ -50,7 +50,7 @@ public: { return "Mathematical expressions."; } - + /** * More documentation. */ @@ -58,16 +58,16 @@ public: { return " math(EXPR )\n" - "EXPR evaluates mathematical expression and return result in the " + "EXPR evaluates mathematical expression and returns result in the " "output variable. Example mathematical expression is " "'5 * ( 10 + 13 )'. Supported operators are " "+ - * / % | & ^ ~ << >> * / %. They have the same meaning " - " as they do in c code."; + " as they do in C code."; } - + cmTypeMacro(cmMathCommand, cmCommand); protected: - + bool HandleExprCommand(std::vector const& args); }; diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h index 03ab94b1c..fc61810c3 100644 --- a/Source/cmMessageCommand.h +++ b/Source/cmMessageCommand.h @@ -24,7 +24,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmMessageCommand; } @@ -53,7 +53,7 @@ public: { return "Display a message to the user."; } - + /** * More documentation. */ @@ -67,8 +67,9 @@ public: " STATUS = Incidental information\n" " WARNING = CMake Warning, continue processing\n" " AUTHOR_WARNING = CMake Warning (dev), continue processing\n" - " SEND_ERROR = CMake Error, continue but skip generation\n" - " FATAL_ERROR = CMake Error, stop all processing\n" + " SEND_ERROR = CMake Error, continue processing,\n" + " but skip generation\n" + " FATAL_ERROR = CMake Error, stop processing and generation\n" "The CMake command-line tool displays STATUS messages on stdout " "and all other message types on stderr. " "The CMake GUI displays all messages in its log area. " @@ -83,7 +84,7 @@ public: "Indented text is considered pre-formatted." ; } - + cmTypeMacro(cmMessageCommand, cmCommand); }; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index a923d6068..7e48cd716 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -153,7 +153,7 @@ cmNinjaNormalTargetGenerator cmTarget::TargetType targetType = this->GetTarget()->GetType(); std::string ruleName = this->LanguageLinkerRule(); if (useResponseFile) - ruleName += "_RSPFILE"; + ruleName += "_RSP_FILE"; // Select whether to use a response file for objects. std::string rspfile; @@ -168,20 +168,29 @@ cmNinjaNormalTargetGenerator std::string responseFlag; if (!useResponseFile) { vars.Objects = "$in"; - vars.LinkLibraries = "$LINK_LIBRARIES"; + vars.LinkLibraries = "$LINK_PATH $LINK_LIBRARIES"; } else { - // handle response file - std::string cmakeLinkVar = std::string("CMAKE_") + - this->TargetLinkLanguage + "_RESPONSE_FILE_LINK_FLAG"; + std::string cmakeVarLang = "CMAKE_"; + cmakeVarLang += this->TargetLinkLanguage; + + // build response file name + std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG"; const char * flag = GetMakefile()->GetDefinition(cmakeLinkVar.c_str()); if(flag) { responseFlag = flag; } else { responseFlag = "@"; } - rspfile = "$out.rsp"; + rspfile = "$RSP_FILE"; responseFlag += rspfile; - rspcontent = "$in $LINK_LIBRARIES"; + + // build response file content + std::string linkOptionVar = cmakeVarLang; + linkOptionVar += "_COMPILER_LINKER_OPTION_FLAG_"; + linkOptionVar += cmTarget::GetTargetTypeName(targetType); + const std::string linkOption = + GetMakefile()->GetSafeDefinition(linkOptionVar.c_str()); + rspcontent = "$in_newline "+linkOption+" $LINK_PATH $LINK_LIBRARIES"; vars.Objects = responseFlag.c_str(); vars.LinkLibraries = ""; } @@ -420,12 +429,20 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() cmNinjaDeps explicitDeps = this->GetObjects(); cmNinjaDeps implicitDeps = this->ComputeLinkDeps(); + std::string frameworkPath; + std::string linkPath; this->GetLocalGenerator()->GetTargetFlags(vars["LINK_LIBRARIES"], vars["FLAGS"], vars["LINK_FLAGS"], - *this->GetTarget()); + frameworkPath, + linkPath, + this->GetGeneratorTarget()); this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]); + vars["LINK_FLAGS"] = cmGlobalNinjaGenerator + ::EncodeLiteral(vars["LINK_FLAGS"]); + + vars["LINK_PATH"] = frameworkPath + linkPath; // Compute architecture specific link flags. Yes, these go into a different // variable for executables, probably due to a mistake made when duplicating @@ -434,7 +451,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() ? vars["FLAGS"] : vars["ARCH_FLAGS"]); this->GetLocalGenerator()->AddArchitectureFlags(flags, - this->GetTarget(), + this->GetGeneratorTarget(), this->TargetLinkLanguage, this->GetConfigName()); if (targetType == cmTarget::EXECUTABLE) { @@ -459,25 +476,16 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } } - std::string path; if (!this->TargetNameImport.empty()) { - path = this->GetLocalGenerator()->ConvertToOutputFormat( - targetOutputImplib.c_str(), cmLocalGenerator::SHELL); - vars["TARGET_IMPLIB"] = path; - EnsureParentDirectoryExists(path); + const std::string impLibPath = this->GetLocalGenerator() + ->ConvertToOutputFormat(targetOutputImplib.c_str(), + cmLocalGenerator::SHELL); + vars["TARGET_IMPLIB"] = impLibPath; + EnsureParentDirectoryExists(impLibPath); } cmMakefile* mf = this->GetMakefile(); - if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") || - mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) - { - path = this->GetTargetPDB(); - vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(path.c_str()).c_str(), - cmLocalGenerator::SHELL); - EnsureParentDirectoryExists(path); - } - else + if (!this->SetMsvcTargetPdbVariable(vars)) { // It is common to place debug symbols at a specific place, // so we need a plain target name in the rule available. @@ -494,9 +502,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() if (mf->IsOn("CMAKE_COMPILER_IS_MINGW")) { - path = GetTarget()->GetSupportDirectory(); - vars["OBJECT_DIR"] = ConvertToNinjaPath(path.c_str()); - EnsureDirectoryExists(path); + const std::string objPath = GetTarget()->GetSupportDirectory(); + vars["OBJECT_DIR"] = ConvertToNinjaPath(objPath.c_str()); + EnsureDirectoryExists(objPath); // ar.exe can't handle backslashes in rsp files (implictly used by gcc) std::string& linkLibraries = vars["LINK_LIBRARIES"]; std::replace(linkLibraries.begin(), linkLibraries.end(), '\\', '/'); @@ -527,10 +535,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // If we have any PRE_LINK commands, we need to go back to HOME_OUTPUT for // the link commands. if (!preLinkCmdLines.empty()) { - path = this->GetLocalGenerator()->ConvertToOutputFormat( - this->GetMakefile()->GetHomeOutputDirectory(), - cmLocalGenerator::SHELL); - preLinkCmdLines.push_back("cd " + path); + const std::string homeOutDir = this->GetLocalGenerator() + ->ConvertToOutputFormat(this->GetMakefile()->GetHomeOutputDirectory(), + cmLocalGenerator::SHELL); + preLinkCmdLines.push_back("cd " + homeOutDir); } vars["PRE_LINK"] = @@ -548,15 +556,25 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() int linkRuleLength = this->GetGlobalGenerator()-> GetRuleCmdLength(this->LanguageLinkerRule()); + + int commandLineLengthLimit = 1; + const char* forceRspFile = "CMAKE_NINJA_FORCE_RESPONSE_FILE"; + if (!this->GetMakefile()->IsDefinitionSet(forceRspFile) && + cmSystemTools::GetEnv(forceRspFile) == 0) { #ifdef _WIN32 - int commandLineLengthLimit = 8000 - linkRuleLength; + commandLineLengthLimit = 8000 - linkRuleLength; #elif defined(__linux) || defined(__APPLE__) - // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac - int commandLineLengthLimit = ((int)sysconf(_SC_ARG_MAX)) - - linkRuleLength - 1000; + // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac + commandLineLengthLimit = ((int)sysconf(_SC_ARG_MAX))-linkRuleLength-1000; #else - int commandLineLengthLimit = -1; + (void)linkRuleLength; + commandLineLengthLimit = -1; #endif + } + + const std::string rspfile = std::string + (cmake::GetCMakeFilesDirectoryPostSlash()) + + this->GetTarget()->GetName() + ".rsp"; // Write the build statement for this target. cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(), @@ -567,6 +585,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() implicitDeps, emptyDeps, vars, + rspfile, commandLineLengthLimit); if (targetOutput != targetOutputReal) { diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 3532c8ba4..80a1a9b94 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -134,7 +134,7 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, this->AddFeatureFlags(flags, language.c_str()); this->GetLocalGenerator()->AddArchitectureFlags(flags, - this->GetTarget(), + this->GeneratorTarget, language.c_str(), this->GetConfigName()); @@ -147,13 +147,16 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, // Add shared-library flags if needed. this->LocalGenerator->AddCMP0018Flags(flags, this->Target, - language.c_str()); + language.c_str(), + this->GetConfigName()); // Add include directory flags. { std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target, - language.c_str()); + const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, + language.c_str(), config); std::string includeFlags = this->LocalGenerator->GetIncludeFlags(includes, language.c_str(), language == "RC" ? true : false); // full include paths for RC @@ -167,11 +170,41 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, // Append old-style preprocessor definition flags. this->LocalGenerator->AppendFlags(flags, this->Makefile->GetDefineFlags()); - // Add target-specific and source-specific flags. - this->LocalGenerator->AppendFlags(flags, - this->Target->GetProperty("COMPILE_FLAGS")); - this->LocalGenerator->AppendFlags(flags, - source->GetProperty("COMPILE_FLAGS")); + // Add target-specific flags. + if(this->Target->GetProperty("COMPILE_FLAGS")) + { + std::string langIncludeExpr = "CMAKE_"; + langIncludeExpr += language; + langIncludeExpr += "_FLAG_REGEX"; + const char* regex = this->Makefile-> + GetDefinition(langIncludeExpr.c_str()); + if(regex) + { + cmsys::RegularExpression r(regex); + std::vector args; + cmSystemTools::ParseWindowsCommandLine( + this->Target->GetProperty("COMPILE_FLAGS"), + args); + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + if(r.find(i->c_str())) + { + this->LocalGenerator->AppendFlags + (flags, i->c_str()); + } + } + } + else + { + this->LocalGenerator->AppendFlags + (flags, this->Target->GetProperty("COMPILE_FLAGS")); + } + } + + // Add source file specific flags. + this->LocalGenerator->AppendFlags(flags, + source->GetProperty("COMPILE_FLAGS")); // TODO: Handle Apple frameworks. @@ -184,46 +217,37 @@ std::string cmNinjaTargetGenerator:: ComputeDefines(cmSourceFile *source, const std::string& language) { - std::string defines; + std::set defines; // Add the export symbol definition for shared library objects. if(const char* exportMacro = this->Target->GetExportMacro()) { - this->LocalGenerator->AppendDefines(defines, exportMacro, - language.c_str()); + this->LocalGenerator->AppendDefines(defines, exportMacro); } // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AppendDefines (defines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS"), - language.c_str()); + this->Target->GetCompileDefinitions()); this->LocalGenerator->AppendDefines (defines, - this->Target->GetProperty("COMPILE_DEFINITIONS"), - language.c_str()); - this->LocalGenerator->AppendDefines - (defines, - source->GetProperty("COMPILE_DEFINITIONS"), - language.c_str()); + source->GetProperty("COMPILE_DEFINITIONS")); { std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += cmSystemTools::UpperCase(this->GetConfigName()); this->LocalGenerator->AppendDefines (defines, - this->Makefile->GetProperty(defPropName.c_str()), - language.c_str()); - this->LocalGenerator->AppendDefines - (defines, - this->Target->GetProperty(defPropName.c_str()), - language.c_str()); + this->Target->GetCompileDefinitions(this->GetConfigName())); this->LocalGenerator->AppendDefines (defines, - source->GetProperty(defPropName.c_str()), - language.c_str()); + source->GetProperty(defPropName.c_str())); } - return defines; + std::string definesString; + this->LocalGenerator->JoinDefines(defines, definesString, + language.c_str()); + + return definesString; } cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const @@ -295,23 +319,33 @@ std::string cmNinjaTargetGenerator::GetTargetName() const return this->Target->GetName(); } -std::string cmNinjaTargetGenerator::GetTargetPDB() const + +bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const { - std::string targetFullPathPDB; - if(this->Target->GetType() == cmTarget::EXECUTABLE || - this->Target->GetType() == cmTarget::STATIC_LIBRARY || - this->Target->GetType() == cmTarget::SHARED_LIBRARY || - this->Target->GetType() == cmTarget::MODULE_LIBRARY) + cmMakefile* mf = this->GetMakefile(); + if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") || + mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) { - targetFullPathPDB = this->Target->GetDirectory(this->GetConfigName()); - targetFullPathPDB += "/"; - targetFullPathPDB += this->Target->GetPDBName(this->GetConfigName()); - } + std::string pdbPath; + if(this->Target->GetType() == cmTarget::EXECUTABLE || + this->Target->GetType() == cmTarget::STATIC_LIBRARY || + this->Target->GetType() == cmTarget::SHARED_LIBRARY || + this->Target->GetType() == cmTarget::MODULE_LIBRARY) + { + pdbPath = this->Target->GetPDBDirectory(this->GetConfigName()); + pdbPath += "/"; + pdbPath += this->Target->GetPDBName(this->GetConfigName()); + } - return targetFullPathPDB.c_str(); + vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( + ConvertToNinjaPath(pdbPath.c_str()).c_str(), + cmLocalGenerator::SHELL); + EnsureParentDirectoryExists(pdbPath); + return true; + } + return false; } - void cmNinjaTargetGenerator ::WriteLanguageRules(const std::string& language) @@ -337,29 +371,30 @@ cmNinjaTargetGenerator std::string flags = "$FLAGS"; vars.Defines = "$DEFINES"; vars.TargetPDB = "$TARGET_PDB"; - + vars.ObjectDir = "$OBJECT_DIR"; cmMakefile* mf = this->GetMakefile(); bool useClDeps = false; + std::string clBinary; std::string clDepsBinary; std::string clShowPrefix; if (lang == "C" || lang == "CXX" || lang == "RC") { - const char* depsPtr = mf->GetDefinition("CMAKE_CMCLDEPS_EXECUTABLE"); - const char* showPtr = mf->GetDefinition("CMAKE_CL_SHOWINCLUDE_PREFIX"); - if (depsPtr && showPtr) + clDepsBinary = mf->GetSafeDefinition("CMAKE_CMCLDEPS_EXECUTABLE"); + if (!clDepsBinary.empty() && !mf->GetIsSourceFileTryCompile()) { - // don't wrap for try_compile, - // TODO but why doesn't it work with cmcldeps? - const std::string projectName = mf->GetProjectName() ? - mf->GetProjectName() : ""; - if (projectName != "CMAKE_TRY_COMPILE") + clShowPrefix = mf->GetSafeDefinition("CMAKE_CL_SHOWINCLUDE_PREFIX"); + clBinary = mf->GetDefinition("CMAKE_C_COMPILER") ? + mf->GetSafeDefinition("CMAKE_C_COMPILER") : + mf->GetSafeDefinition("CMAKE_CXX_COMPILER"); + if (!clBinary.empty() && !clShowPrefix.empty()) { useClDeps = true; - std::string qu = "\""; - clDepsBinary = qu + depsPtr + qu; - clShowPrefix = qu + showPtr + qu; + const std::string quote = " \""; + clBinary = quote + clBinary + "\" "; + clDepsBinary = quote + clDepsBinary + "\" "; + clShowPrefix = quote + clShowPrefix + "\" "; vars.DependencyFile = "$DEP_FILE"; } } @@ -389,6 +424,13 @@ cmNinjaTargetGenerator std::vector compileCmds; cmSystemTools::ExpandListArgument(compileCmd, compileCmds); + if(useClDeps) + { + std::string cmdPrefix = clDepsBinary + lang + " $in \"$DEP_FILE\" $out " + + clShowPrefix + clBinary; + compileCmds.front().insert(0, cmdPrefix); + } + for (std::vector::iterator i = compileCmds.begin(); i != compileCmds.end(); ++i) this->GetLocalGenerator()->ExpandRuleVariables(*i, vars); @@ -396,13 +438,6 @@ cmNinjaTargetGenerator std::string cmdLine = this->GetLocalGenerator()->BuildCommandLine(compileCmds); - if(useClDeps) - { - std::string cl = mf->GetDefinition("CMAKE_C_COMPILER"); - cl = "\"" + cl + "\" "; - cmdLine = clDepsBinary + " " + lang + " $in \"$DEP_FILE\" $out " - + clShowPrefix + " " + cl + cmdLine; - } // Write the rule for compiling file of the given language. cmOStringStream comment; @@ -478,8 +513,6 @@ void cmNinjaTargetGenerator ::WriteObjectBuildStatement(cmSourceFile* source) { - cmNinjaDeps emptyDeps; - std::string comment; const std::string language = source->GetLanguage(); std::string rule = this->LanguageCompilerRule(language); @@ -503,11 +536,12 @@ cmNinjaTargetGenerator cmNinjaDeps orderOnlyDeps; this->GetLocalGenerator()->AppendTargetDepends(this->Target, orderOnlyDeps); + cmNinjaDeps implicitDeps; if(const char* objectDeps = source->GetProperty("OBJECT_DEPENDS")) { std::vector depList; cmSystemTools::ExpandListArgument(objectDeps, depList); std::transform(depList.begin(), depList.end(), - std::back_inserter(orderOnlyDeps), MapToNinjaPath()); + std::back_inserter(implicitDeps), MapToNinjaPath()); } // Add order-only dependencies on custom command outputs. @@ -537,15 +571,14 @@ cmNinjaTargetGenerator vars["DEP_FILE"] = objectFileName + ".d";; EnsureParentDirectoryExists(objectFileName); - // TODO move to GetTargetPDB - cmMakefile* mf = this->GetMakefile(); - if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") || - mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) - { - vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(GetTargetPDB().c_str()).c_str(), - cmLocalGenerator::SHELL); - } + std::string objectDir = cmSystemTools::GetFilenamePath(objectFileName); + objectDir = this->GetLocalGenerator()->Convert(objectDir.c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); + vars["OBJECT_DIR"] = objectDir; + + + this->SetMsvcTargetPdbVariable(vars); if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS")) { @@ -569,6 +602,7 @@ cmNinjaTargetGenerator compileObjectVars.Source = escapedSourceFileName.c_str(); compileObjectVars.Object = objectFileName.c_str(); + compileObjectVars.ObjectDir = objectDir.c_str(); compileObjectVars.Flags = vars["FLAGS"].c_str(); compileObjectVars.Defines = vars["DEFINES"].c_str(); @@ -597,7 +631,7 @@ cmNinjaTargetGenerator rule, outputs, explicitDeps, - emptyDeps, + implicitDeps, orderOnlyDeps, vars); @@ -641,14 +675,24 @@ cmNinjaTargetGenerator void cmNinjaTargetGenerator -::EnsureDirectoryExists(const std::string& dir) +::EnsureDirectoryExists(const std::string& path) const { - cmSystemTools::MakeDirectory(dir.c_str()); + if (cmSystemTools::FileIsFullPath(path.c_str())) + { + cmSystemTools::MakeDirectory(path.c_str()); + } + else + { + const std::string fullPath = std::string(this->GetGlobalGenerator()-> + GetCMakeInstance()->GetHomeOutputDirectory()) + + "/" + path; + cmSystemTools::MakeDirectory(fullPath.c_str()); + } } void cmNinjaTargetGenerator -::EnsureParentDirectoryExists(const std::string& path) +::EnsureParentDirectoryExists(const std::string& path) const { EnsureDirectoryExists(cmSystemTools::GetParentDirectory(path.c_str())); } diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 84573cec2..cf06bfdf5 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -40,16 +40,21 @@ public: virtual void Generate() = 0; - std::string GetTargetPDB() const; std::string GetTargetName() const; protected: + + bool SetMsvcTargetPdbVariable(cmNinjaVars&) const; + cmGeneratedFileStream& GetBuildFileStream() const; cmGeneratedFileStream& GetRulesFileStream() const; cmTarget* GetTarget() const { return this->Target; } + cmGeneratorTarget* GetGeneratorTarget() const + { return this->GeneratorTarget; } + cmLocalNinjaGenerator* GetLocalGenerator() const { return this->LocalGenerator; } @@ -112,8 +117,8 @@ protected: // Helper to add flag for windows .def file. void AddModuleDefinitionFlag(std::string& flags); - void EnsureDirectoryExists(const std::string& dir); - void EnsureParentDirectoryExists(const std::string& path); + void EnsureDirectoryExists(const std::string& dir) const; + void EnsureParentDirectoryExists(const std::string& path) const; // write rules for Mac OS X Application Bundle content. struct MacOSXContentGeneratorType : diff --git a/Source/cmObject.h b/Source/cmObject.h index 1a39aa76a..ca6a54fd0 100644 --- a/Source/cmObject.h +++ b/Source/cmObject.h @@ -27,7 +27,7 @@ public: * Need virtual destructor to destroy real command type. */ virtual ~cmObject() {} - + /** * The class name of the command. */ @@ -38,7 +38,7 @@ public: */ static bool IsTypeOf(const char *type) { return !strcmp("cmObject", type); } - + /** * Returns true if this object is an instance of the given class or * a subclass of it. diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index af9d94bcf..776a3a443 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -42,11 +42,11 @@ bool cmOptionCommand this->SetError(m.c_str()); return false; } - + std::string initialValue = "Off"; // Now check and see if the value has been stored in the cache // already, if so use that value and don't look for the program - cmCacheManager::CacheIterator it = + cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()->GetCacheIterator(args[0].c_str()); if(!it.IsAtEnd()) { diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h index da3133237..7d0240050 100644 --- a/Source/cmOptionCommand.h +++ b/Source/cmOptionCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmOptionCommand; } @@ -41,7 +41,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "option";} - + /** * Succinct documentation. */ @@ -49,7 +49,7 @@ public: { return "Provides an option that the user can optionally select."; } - + /** * More documentation. */ diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index be079c096..01fc2cf8a 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -28,7 +28,7 @@ void cmLBDepend::DependWalk(cmDependInformation* info) cmSystemTools::Error("error can not open ", info->FullPath.c_str()); return; } - + std::string line; while(cmSystemTools::GetLineFromStream(fin, line)) { @@ -45,7 +45,7 @@ void cmLBDepend::DependWalk(cmDependInformation* info) // if a < is not found then move on if(qstart == std::string::npos) { - cmSystemTools::Error("unknown include directive ", + cmSystemTools::Error("unknown include directive ", currentline.c_str() ); continue; } @@ -73,7 +73,7 @@ void cmLBDepend::DependWalk(cmDependInformation* info) } continue; } - + // Add this file and all its dependencies. this->AddDependency(info, includeFile.c_str()); /// add the cxx file if it exists @@ -89,7 +89,7 @@ void cmLBDepend::DependWalk(cmDependInformation* info) { found = true; } - for(std::vector::iterator i = + for(std::vector::iterator i = this->IncludeDirectories.begin(); i != this->IncludeDirectories.end(); ++i) { @@ -108,7 +108,7 @@ void cmLBDepend::DependWalk(cmDependInformation* info) { found = true; } - for(std::vector::iterator i = + for(std::vector::iterator i = this->IncludeDirectories.begin(); i != this->IncludeDirectories.end(); ++i) { @@ -128,7 +128,7 @@ void cmLBDepend::DependWalk(cmDependInformation* info) { found = true; } - for(std::vector::iterator i = + for(std::vector::iterator i = this->IncludeDirectories.begin(); i != this->IncludeDirectories.end(); ++i) { @@ -148,7 +148,7 @@ void cmLBDepend::DependWalk(cmDependInformation* info) { found = true; } - for(std::vector::iterator i = + for(std::vector::iterator i = this->IncludeDirectories.begin(); i != this->IncludeDirectories.end(); ++i) { @@ -183,7 +183,7 @@ bool cmOutputRequiredFilesCommand // store the arg for final pass this->File = args[0]; this->OutputFile = args[1]; - + // compute the list of files cmLBDepend md; md.SetMakefile(this->Makefile); @@ -217,7 +217,7 @@ ListDependencies(cmDependInformation const *info, // add info to the visited set visited->insert(info); // now recurse with info's dependencies - for(cmDependInformation::DependencySetType::const_iterator d = + for(cmDependInformation::DependencySetType::const_iterator d = info->DependencySet.begin(); d != info->DependencySet.end(); ++d) { diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h index 85d9095e2..1d7e39457 100644 --- a/Source/cmOutputRequiredFilesCommand.h +++ b/Source/cmOutputRequiredFilesCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmOutputRequiredFilesCommand; } @@ -49,7 +49,7 @@ public: { return "Deprecated. Approximate C preprocessor dependency scanning."; } - + /** * More documentation. */ @@ -72,7 +72,7 @@ public: return true; } - + cmTypeMacro(cmOutputRequiredFilesCommand, cmCommand); void ListDependencies(cmDependInformation const *info, FILE *fout, diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 79af4d700..831e92e92 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -457,7 +457,7 @@ cmPolicies::cmPolicies() "This makes sure that the modules belonging to " "CMake always get those files included which they expect, and against " "which they were developed and tested. " - "In call other cases, the files found in " + "In all other cases, the files found in " "CMAKE_MODULE_PATH still take precedence over the ones in " "the CMake module directory. " "The OLD behaviour is to always prefer files from CMAKE_MODULE_PATH over " @@ -491,6 +491,44 @@ cmPolicies::cmPolicies() "CMAKE_SHARED_LIBRARY__FLAGS whether it is modified or not and " "honor the POSITION_INDEPENDENT_CODE target property.", 2,8,9,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0019, "CMP0019", + "Do not re-expand variables in include and link information.", + "CMake 2.8.10 and lower re-evaluated values given to the " + "include_directories, link_directories, and link_libraries " + "commands to expand any leftover variable references at the " + "end of the configuration step. " + "This was for strict compatibility with VERY early CMake versions " + "because all variable references are now normally evaluated during " + "CMake language processing. " + "CMake 2.8.11 and higher prefer to skip the extra evaluation." + "\n" + "The OLD behavior for this policy is to re-evaluate the values " + "for strict compatibility. " + "The NEW behavior for this policy is to leave the values untouched.", + 2,8,11,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0020, "CMP0020", + "Automatically link Qt executables to qtmain target on Windows.", + "CMake 2.8.10 and lower required users of Qt to always specify a link " + "dependency to the qtmain.lib static library manually on Windows. CMake " + "2.8.11 gained the ability to evaluate generator expressions while " + "determining the link dependencies from IMPORTED targets. This allows " + "CMake itself to automatically link executables which link to Qt to the " + "qtmain.lib library when using IMPORTED Qt targets. For applications " + "already linking to qtmain.lib, this should have little impact. For " + "applications which supply their own alternative WinMain implementation " + "and for applications which use the QAxServer library, this automatic " + "linking will need to be disabled as per the documentation." + "\n" + "The OLD behavior for this policy is not to link executables to " + "qtmain.lib automatically when they link to the QtCore IMPORTED" + "target. " + "The NEW behavior for this policy is to link executables to " + "qtmain.lib automatically when they link to QtCore IMPORTED target.", + 2,8,11,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 6932565ab..c11af0714 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -68,6 +68,8 @@ public: CMP0018, ///< Ignore language flags for shared libs, and adhere to /// POSITION_INDEPENDENT_CODE property and *_COMPILE_OPTIONS_PI{E,C} /// instead. + CMP0019, ///< No variable re-expansion in include and link info + CMP0020, ///< Automatically link Qt executables to qtmain target /** \brief Always the last entry. * diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index fcf0a4903..11f9a7621 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -19,14 +19,14 @@ bool cmProjectCommand { this->SetError("PROJECT called with incorrect number of arguments"); return false; - } + } this->Makefile->SetProjectName(args[0].c_str()); std::string bindir = args[0]; bindir += "_BINARY_DIR"; std::string srcdir = args[0]; srcdir += "_SOURCE_DIR"; - + this->Makefile->AddCacheDefinition (bindir.c_str(), this->Makefile->GetCurrentOutputDirectory(), @@ -35,7 +35,7 @@ bool cmProjectCommand (srcdir.c_str(), this->Makefile->GetCurrentDirectory(), "Value Computed by CMake", cmCacheManager::STATIC); - + bindir = "PROJECT_BINARY_DIR"; srcdir = "PROJECT_SOURCE_DIR"; diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index 88a1944b4..a53cb3fb8 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -28,7 +28,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmProjectCommand; } @@ -39,7 +39,7 @@ public: */ virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - + /** * The name of the command as specified in CMakeList.txt. */ @@ -52,7 +52,7 @@ public: { return "Set a name for the entire project."; } - + /** * More documentation. */ @@ -73,7 +73,7 @@ public: "the file pointed to by that variable will be included as the last step " "of the project command."; } - + cmTypeMacro(cmProjectCommand, cmCommand); }; diff --git a/Source/cmProperty.h b/Source/cmProperty.h index e0fcd631e..bb75bb0b9 100644 --- a/Source/cmProperty.h +++ b/Source/cmProperty.h @@ -14,7 +14,7 @@ #include "cmStandardIncludes.h" -class cmProperty +class cmProperty { public: enum ScopeType { TARGET, SOURCE_FILE, DIRECTORY, GLOBAL, CACHE, diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h index 16bd148a7..296366dca 100644 --- a/Source/cmPropertyDefinition.h +++ b/Source/cmPropertyDefinition.h @@ -29,7 +29,7 @@ public: /// Define this property void DefineProperty(const char *name, cmProperty::ScopeType scope, const char *ShortDescription, - const char *FullDescription, + const char *FullDescription, const char *DocumentationSection, bool chained); @@ -44,7 +44,7 @@ public: /// Get the section if any const std::string &GetDocumentationSection() const { - return this->DocumentationSection; }; + return this->DocumentationSection; }; /// Get the scope cmProperty::ScopeType GetScope() const { @@ -56,7 +56,7 @@ public: /// Get the documentation (full version) const std::string &GetFullDescription() const { - return this->FullDescription; }; + return this->FullDescription; }; protected: std::string Name; diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx index fcdb93776..20fa07c43 100644 --- a/Source/cmPropertyDefinitionMap.cxx +++ b/Source/cmPropertyDefinitionMap.cxx @@ -30,7 +30,7 @@ void cmPropertyDefinitionMap if (it == this->end()) { prop = &(*this)[name]; - prop->DefineProperty(name,scope,ShortDescription, FullDescription, + prop->DefineProperty(name,scope,ShortDescription, FullDescription, DocumentationSection, chain); } } @@ -49,10 +49,10 @@ void cmPropertyDefinitionMap { switch (j->second.GetScope()) { - case cmProperty::GLOBAL: + case cmProperty::GLOBAL: secName = "Properties of Global Scope"; break; - case cmProperty::TARGET: + case cmProperty::TARGET: secName = "Properties on Targets"; break; case cmProperty::SOURCE_FILE: @@ -80,7 +80,7 @@ void cmPropertyDefinitionMap } if (!v[secName]) { - v[secName] = new + v[secName] = new cmDocumentationSection(secName.c_str(), cmSystemTools::UpperCase(secName).c_str()); } diff --git a/Source/cmPropertyDefinitionMap.h b/Source/cmPropertyDefinitionMap.h index c6f9d59cd..007e26515 100644 --- a/Source/cmPropertyDefinitionMap.h +++ b/Source/cmPropertyDefinitionMap.h @@ -16,7 +16,7 @@ class cmDocumentationSection; -class cmPropertyDefinitionMap : +class cmPropertyDefinitionMap : public std::map { public: diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index a4d0bf3d8..78f378ab7 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -43,7 +43,7 @@ void cmPropertyMap::SetProperty(const char *name, const char *value, #ifdef CMAKE_STRICT if (!this->CMakeInstance) { - cmSystemTools::Error("CMakeInstance not set on a property map!"); + cmSystemTools::Error("CMakeInstance not set on a property map!"); abort(); } else @@ -85,10 +85,10 @@ void cmPropertyMap::AppendProperty(const char* name, const char* value, } const char *cmPropertyMap -::GetPropertyValue(const char *name, - cmProperty::ScopeType scope, +::GetPropertyValue(const char *name, + cmProperty::ScopeType scope, bool &chain) const -{ +{ chain = false; if (!name) { @@ -99,7 +99,7 @@ const char *cmPropertyMap #ifdef CMAKE_STRICT if (!this->CMakeInstance) { - cmSystemTools::Error("CMakeInstance not set on a property map!"); + cmSystemTools::Error("CMakeInstance not set on a property map!"); abort(); } else diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index 94275e2ac..0c3aad461 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -21,13 +21,13 @@ class cmPropertyMap : public std::map public: cmProperty *GetOrCreateProperty(const char *name); - void SetProperty(const char *name, const char *value, + void SetProperty(const char *name, const char *value, cmProperty::ScopeType scope); void AppendProperty(const char* name, const char* value, cmProperty::ScopeType scope, bool asString=false); - const char *GetPropertyValue(const char *name, + const char *GetPropertyValue(const char *name, cmProperty::ScopeType scope, bool &chain) const; diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index 1f1aed72f..0d3c9941c 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -12,7 +12,7 @@ #include "cmQTWrapCPPCommand.h" // cmQTWrapCPPCommand -bool cmQTWrapCPPCommand::InitialPass(std::vector const& argsIn, +bool cmQTWrapCPPCommand::InitialPass(std::vector const& argsIn, cmExecutionStatus &) { if(argsIn.size() < 3 ) diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h index 0184927c9..4863402e4 100644 --- a/Source/cmQTWrapCPPCommand.h +++ b/Source/cmQTWrapCPPCommand.h @@ -17,9 +17,9 @@ #include "cmSourceFile.h" /** \class cmQTWrapCPPCommand - * \brief Create moc file rules for QT classes + * \brief Create moc file rules for Qt classes * - * cmQTWrapCPPCommand is used to create wrappers for QT classes into + * cmQTWrapCPPCommand is used to create wrappers for Qt classes into * normal C++ */ class cmQTWrapCPPCommand : public cmCommand @@ -30,7 +30,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmQTWrapCPPCommand; } @@ -54,7 +54,7 @@ public: { return "Create Qt Wrappers."; } - + /** * More documentation. */ diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx index bbecd8dcc..a6a4b5158 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -12,7 +12,7 @@ #include "cmQTWrapUICommand.h" // cmQTWrapUICommand -bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn, +bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn, cmExecutionStatus &) { if(argsIn.size() < 4 ) diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h index 744ae9838..b15c5cde0 100644 --- a/Source/cmQTWrapUICommand.h +++ b/Source/cmQTWrapUICommand.h @@ -17,9 +17,9 @@ #include "cmSourceFile.h" /** \class cmQTWrapUICommand - * \brief Create .h and .cxx files rules for QT user interfaces files + * \brief Create .h and .cxx files rules for Qt user interfaces files * - * cmQTWrapUICommand is used to create wrappers for QT classes into normal C++ + * cmQTWrapUICommand is used to create wrappers for Qt classes into normal C++ */ class cmQTWrapUICommand : public cmCommand { @@ -28,7 +28,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmQTWrapUICommand; } @@ -52,7 +52,7 @@ public: { return "Create Qt user interfaces Wrappers."; } - + /** * More documentation. */ diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index 65ecdf73f..5730c8c9d 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -44,14 +44,14 @@ static bool containsQ_OBJECT(const std::string& text) static std::string findMatchingHeader(const std::string& absPath, const std::string& mocSubDir, const std::string& basename, - const std::list& headerExtensions) + const std::vector& headerExtensions) { std::string header; - for(std::list::const_iterator ext = headerExtensions.begin(); + for(std::vector::const_iterator ext = headerExtensions.begin(); ext != headerExtensions.end(); ++ext) { - std::string sourceFilePath = absPath + basename + (*ext); + std::string sourceFilePath = absPath + basename + "." + (*ext); if (cmsys::SystemTools::FileExists(sourceFilePath.c_str())) { header = sourceFilePath; @@ -59,7 +59,7 @@ static std::string findMatchingHeader(const std::string& absPath, } if (!mocSubDir.empty()) { - sourceFilePath = mocSubDir + basename + (*ext); + sourceFilePath = mocSubDir + basename + "." + (*ext); if (cmsys::SystemTools::FileExists(sourceFilePath.c_str())) { header = sourceFilePath; @@ -85,6 +85,18 @@ static std::string extractSubDir(const std::string& absPath, } +static void copyTargetProperty(cmTarget* destinationTarget, + cmTarget* sourceTarget, + const char* propertyName) +{ + const char* propertyValue = sourceTarget->GetProperty(propertyName); + if (propertyValue) + { + destinationTarget->SetProperty(propertyName, propertyValue); + } +} + + cmQtAutomoc::cmQtAutomoc() :Verbose(cmsys::SystemTools::GetEnv("VERBOSE") != 0) ,ColorOutput(true) @@ -107,11 +119,9 @@ cmQtAutomoc::cmQtAutomoc() } } - -void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) +bool cmQtAutomoc::InitializeMocSourceFile(cmTarget* target) { cmMakefile* makefile = target->GetMakefile(); - const char* targetName = target->GetName(); // don't do anything if there is no Qt4 or Qt5Core (which contains moc): std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR"); if (qtMajorVersion == "") @@ -120,9 +130,30 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) } if (qtMajorVersion != "4" && qtMajorVersion != "5") { - return; + return false; } + std::string automocTargetName = target->GetName(); + automocTargetName += "_automoc"; + std::string mocCppFile = makefile->GetCurrentOutputDirectory(); + mocCppFile += "/"; + mocCppFile += automocTargetName; + mocCppFile += ".cpp"; + cmSourceFile* mocCppSource = makefile->GetOrCreateSource(mocCppFile.c_str(), + true); + makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", + mocCppFile.c_str(), false); + + target->AddSourceFile(mocCppSource); + return true; +} + +void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) +{ + cmMakefile* makefile = target->GetMakefile(); + cmLocalGenerator* localGen = makefile->GetLocalGenerator(); + const char* targetName = target->GetName(); + bool relaxedMode = makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE"); // create a custom target for running automoc at buildtime: @@ -151,9 +182,13 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) std::string automocComment = "Automoc for target "; automocComment += targetName; - makefile->AddUtilityCommand(automocTargetName.c_str(), true, + cmTarget* automocTarget = makefile->AddUtilityCommand( + automocTargetName.c_str(), true, workingDirectory.c_str(), depends, commandLines, false, automocComment.c_str()); + // inherit FOLDER property from target (#13688) + copyTargetProperty(automocTarget, target, "FOLDER"); + target->AddUtility(automocTargetName.c_str()); // configure a file to get all information to automoc at buildtime: @@ -169,7 +204,8 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) ++fileIt) { cmSourceFile* sf = *fileIt; - std::string absFile = sf->GetFullPath(); + std::string absFile = cmsys::SystemTools::GetRealPath( + sf->GetFullPath().c_str()); bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC")); bool generated = cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED")); @@ -193,12 +229,35 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) } } - const char* tmp = makefile->GetProperty("INCLUDE_DIRECTORIES"); - std::string _moc_incs = (tmp!=0 ? tmp : ""); - tmp = makefile->GetProperty("DEFINITIONS"); - std::string _moc_defs = (tmp!=0 ? tmp : ""); + + std::vector includeDirs; + cmGeneratorTarget gtgt(target); + // Get the include dirs for this target, without stripping the implicit + // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667 + localGen->GetIncludeDirectories(includeDirs, >gt, "CXX", 0, false); + std::string _moc_incs = ""; + const char* sep = ""; + for(std::vector::const_iterator incDirIt = includeDirs.begin(); + incDirIt != includeDirs.end(); + ++incDirIt) + { + _moc_incs += sep; + sep = ";"; + _moc_incs += *incDirIt; + } + + const char* tmp = target->GetProperty("COMPILE_DEFINITIONS"); + std::string _moc_compile_defs; + if (tmp) + { + _moc_compile_defs = target->GetCompileDefinitions(); + } tmp = makefile->GetProperty("COMPILE_DEFINITIONS"); - std::string _moc_compile_defs = (tmp!=0 ? tmp : ""); + if (tmp) + { + _moc_compile_defs += ";"; + _moc_compile_defs += tmp; + } tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS"); std::string _moc_options = (tmp!=0 ? tmp : ""); @@ -210,8 +269,6 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) cmLocalGenerator::EscapeForCMake(automocTargetName.c_str()).c_str()); makefile->AddDefinition("_moc_incs", cmLocalGenerator::EscapeForCMake(_moc_incs.c_str()).c_str()); - makefile->AddDefinition("_moc_defs", - cmLocalGenerator::EscapeForCMake(_moc_defs.c_str()).c_str()); makefile->AddDefinition("_moc_compile_defs", cmLocalGenerator::EscapeForCMake(_moc_compile_defs.c_str()).c_str()); makefile->AddDefinition("_moc_options", @@ -229,17 +286,6 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) outputFile += "/AutomocInfo.cmake"; makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(), false, true, false); - - std::string mocCppFile = makefile->GetCurrentOutputDirectory(); - mocCppFile += "/"; - mocCppFile += automocTargetName; - mocCppFile += ".cpp"; - cmSourceFile* mocCppSource = makefile->GetOrCreateSource(mocCppFile.c_str(), - true); - target->AddSourceFile(mocCppSource); - - makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", - mocCppFile.c_str(), false); } @@ -257,7 +303,7 @@ bool cmQtAutomoc::Run(const char* targetDirectory) if (this->QtMajorVersion == "4" || this->QtMajorVersion == "5") { - success = this->RunAutomoc(); + success = this->RunAutomoc(makefile); } this->WriteOldMocDefinitionsFile(targetDirectory); @@ -314,19 +360,37 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile, this->MocExecutable = makefile->GetSafeDefinition("AM_QT_MOC_EXECUTABLE"); this->MocCompileDefinitionsStr = makefile->GetSafeDefinition( "AM_MOC_COMPILE_DEFINITIONS"); - this->MocDefinitionsStr = makefile->GetSafeDefinition("AM_MOC_DEFINITIONS"); this->MocIncludesStr = makefile->GetSafeDefinition("AM_MOC_INCLUDES"); this->MocOptionsStr = makefile->GetSafeDefinition("AM_MOC_OPTIONS"); this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR"); this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR"); this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME"); + this->CurrentCompileSettingsStr = this->MakeCompileSettingsString(makefile); + this->RelaxedMode = makefile->IsOn("AM_RELAXED_MODE"); return true; } +std::string cmQtAutomoc::MakeCompileSettingsString(cmMakefile* makefile) +{ + std::string s; + s += makefile->GetSafeDefinition("AM_MOC_COMPILE_DEFINITIONS"); + s += " ~~~ "; + s += makefile->GetSafeDefinition("AM_MOC_INCLUDES"); + s += " ~~~ "; + s += makefile->GetSafeDefinition("AM_MOC_OPTIONS"); + s += " ~~~ "; + s += makefile->IsOn("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE") ? "TRUE" + : "FALSE"; + s += " ~~~ "; + + return s; +} + + bool cmQtAutomoc::ReadOldMocDefinitionsFile(cmMakefile* makefile, const char* targetDirectory) { @@ -336,8 +400,8 @@ bool cmQtAutomoc::ReadOldMocDefinitionsFile(cmMakefile* makefile, if (makefile->ReadListFile(0, filename.c_str())) { - this->OldMocDefinitionsStr = - makefile->GetSafeDefinition("AM_OLD_MOC_DEFINITIONS"); + this->OldCompileSettingsStr = + makefile->GetSafeDefinition("AM_OLD_COMPILE_SETTINGS"); } return true; } @@ -352,9 +416,9 @@ void cmQtAutomoc::WriteOldMocDefinitionsFile(const char* targetDirectory) std::fstream outfile; outfile.open(filename.c_str(), std::ios::out | std::ios::trunc); - outfile << "set(AM_OLD_MOC_DEFINITIONS " + outfile << "set(AM_OLD_COMPILE_SETTINGS " << cmLocalGenerator::EscapeForCMake( - this->Join(this->MocDefinitions, ' ').c_str()) << ")\n"; + this->CurrentCompileSettingsStr.c_str()) << ")\n"; outfile.close(); } @@ -368,32 +432,11 @@ void cmQtAutomoc::Init() std::vector cdefList; cmSystemTools::ExpandListArgument(this->MocCompileDefinitionsStr, cdefList); - if (!cdefList.empty()) + for(std::vector::const_iterator it = cdefList.begin(); + it != cdefList.end(); + ++it) { - for(std::vector::const_iterator it = cdefList.begin(); - it != cdefList.end(); - ++it) - { - this->MocDefinitions.push_back("-D" + (*it)); - } - } - else - { - std::string tmpMocDefs = this->MocDefinitionsStr; - cmSystemTools::ReplaceString(tmpMocDefs, " ", ";"); - - std::vector defList; - cmSystemTools::ExpandListArgument(tmpMocDefs, defList); - - for(std::vector::const_iterator it = defList.begin(); - it != defList.end(); - ++it) - { - if (this->StartsWith(*it, "-D")) - { - this->MocDefinitions.push_back(*it); - } - } + this->MocDefinitions.push_back("-D" + (*it)); } cmSystemTools::ExpandListArgument(this->MocOptionsStr, this->MocOptions); @@ -468,10 +511,10 @@ void cmQtAutomoc::Init() } -bool cmQtAutomoc::RunAutomoc() +bool cmQtAutomoc::RunAutomoc(cmMakefile* makefile) { if (!cmsys::SystemTools::FileExists(this->OutMocCppFilename.c_str()) - || (this->OldMocDefinitionsStr != this->Join(this->MocDefinitions, ' '))) + || (this->OldCompileSettingsStr != this->CurrentCompileSettingsStr)) { this->GenerateAll = true; } @@ -492,22 +535,8 @@ bool cmQtAutomoc::RunAutomoc() std::vector sourceFiles; cmSystemTools::ExpandListArgument(this->Sources, sourceFiles); - std::list headerExtensions; - headerExtensions.push_back(".h"); - headerExtensions.push_back(".hpp"); - headerExtensions.push_back(".hxx"); -#if defined(_WIN32) - // not case sensitive, don't add ".H" -#elif defined(__APPLE__) - // detect case-sensitive filesystem - long caseSensitive = pathconf(this->Srcdir.c_str(), _PC_CASE_SENSITIVE); - if (caseSensitive == 1) - { - headerExtensions.push_back(".H"); - } -#else - headerExtensions.push_back(".H"); -#endif + const std::vector& headerExtensions = + makefile->GetHeaderExtensions(); for (std::vector::const_iterator it = sourceFiles.begin(); it != sourceFiles.end(); @@ -607,7 +636,7 @@ bool cmQtAutomoc::RunAutomoc() void cmQtAutomoc::ParseCppFile(const std::string& absFilename, - const std::list& headerExtensions, + const std::vector& headerExtensions, std::map& includedMocs) { cmsys::RegularExpression mocIncludeRegExp( @@ -785,7 +814,7 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename, - const std::list& headerExtensions, + const std::vector& headerExtensions, std::map& includedMocs) { cmsys::RegularExpression mocIncludeRegExp( @@ -896,8 +925,8 @@ void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename, void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename, - const std::list& headerExtensions, - std::set& absHeaders) + const std::vector& headerExtensions, + std::set& absHeaders) { // search for header files and private header files we may need to moc: const std::string basename = @@ -905,22 +934,22 @@ void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename, const std::string absPath = cmsys::SystemTools::GetFilenamePath( cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/'; - for(std::list::const_iterator ext = headerExtensions.begin(); + for(std::vector::const_iterator ext = headerExtensions.begin(); ext != headerExtensions.end(); ++ext) { - const std::string headerName = absPath + basename + (*ext); + const std::string headerName = absPath + basename + "." + (*ext); if (cmsys::SystemTools::FileExists(headerName.c_str())) { absHeaders.insert(headerName); break; } } - for(std::list::const_iterator ext = headerExtensions.begin(); + for(std::vector::const_iterator ext = headerExtensions.begin(); ext != headerExtensions.end(); ++ext) { - const std::string privateHeaderName = absPath+basename+"_p"+(*ext); + const std::string privateHeaderName = absPath+basename+"_p."+(*ext); if (cmsys::SystemTools::FileExists(privateHeaderName.c_str())) { absHeaders.insert(privateHeaderName); @@ -1041,7 +1070,8 @@ bool cmQtAutomoc::GenerateMoc(const std::string& sourceFile, } -std::string cmQtAutomoc::Join(const std::list& lst,char separator) +std::string cmQtAutomoc::Join(const std::vector& lst, + char separator) { if (lst.empty()) { @@ -1049,11 +1079,11 @@ std::string cmQtAutomoc::Join(const std::list& lst,char separator) } std::string result; - for (std::list::const_iterator it = lst.begin(); + for (std::vector::const_iterator it = lst.begin(); it != lst.end(); ++it) { - result += (*it) + separator; + result += "." + (*it) + separator; } result.erase(result.end() - 1); return result; diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h index 8cbbac19d..01b68fc54 100644 --- a/Source/cmQtAutomoc.h +++ b/Source/cmQtAutomoc.h @@ -23,6 +23,7 @@ public: cmQtAutomoc(); bool Run(const char* targetDirectory); + bool InitializeMocSourceFile(cmTarget* target); void SetupAutomocTarget(cmTarget* target); private: @@ -35,18 +36,20 @@ private: const char* targetDirectory); void WriteOldMocDefinitionsFile(const char* targetDirectory); - bool RunAutomoc(); + std::string MakeCompileSettingsString(cmMakefile* makefile); + + bool RunAutomoc(cmMakefile* makefile); bool GenerateMoc(const std::string& sourceFile, const std::string& mocFileName); void ParseCppFile(const std::string& absFilename, - const std::list& headerExtensions, + const std::vector& headerExtensions, std::map& includedMocs); void StrictParseCppFile(const std::string& absFilename, - const std::list& headerExtensions, + const std::vector& headerExtensions, std::map& includedMocs); void SearchHeadersForCppFile(const std::string& absFilename, - const std::list& headerExtensions, - std::set& absHeaders); + const std::vector& headerExtensions, + std::set& absHeaders); void ParseHeaders(const std::set& absHeaders, const std::map& includedMocs, @@ -54,7 +57,7 @@ private: void Init(); - std::string Join(const std::list& lst, char separator); + std::string Join(const std::vector& lst, char separator); bool EndsWith(const std::string& str, const std::string& with); bool StartsWith(const std::string& str, const std::string& with); std::string ReadAll(const std::string& filename); @@ -67,14 +70,14 @@ private: std::string Builddir; std::string MocExecutable; std::string MocCompileDefinitionsStr; - std::string MocDefinitionsStr; std::string MocIncludesStr; std::string MocOptionsStr; std::string ProjectBinaryDir; std::string ProjectSourceDir; std::string TargetName; - std::string OldMocDefinitionsStr; + std::string CurrentCompileSettingsStr; + std::string OldCompileSettingsStr; std::string OutMocCppFilename; std::list MocIncludes; diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx index d80b3fe9f..bcb856438 100644 --- a/Source/cmRemoveCommand.cxx +++ b/Source/cmRemoveCommand.cxx @@ -30,13 +30,13 @@ bool cmRemoveCommand { return true; } - + // expand the variable std::vector varArgsExpanded; cmSystemTools::ExpandListArgument(cacheValue, varArgsExpanded); - + // expand the args - // check for REMOVE(VAR v1 v2 ... vn) + // check for REMOVE(VAR v1 v2 ... vn) std::vector argsExpanded; std::vector temp; for(unsigned int j = 1; j < args.size(); ++j) @@ -44,7 +44,7 @@ bool cmRemoveCommand temp.push_back(args[j]); } cmSystemTools::ExpandList(temp, argsExpanded); - + // now create the new value std::string value; for(unsigned int j = 0; j < varArgsExpanded.size(); ++j) @@ -67,7 +67,7 @@ bool cmRemoveCommand value += varArgsExpanded[j]; } } - + // add the definition this->Makefile->AddDefinition(variable, value.c_str()); diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h index c62d58f64..5aedc26e5 100644 --- a/Source/cmRemoveCommand.h +++ b/Source/cmRemoveCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmRemoveCommand; } @@ -46,7 +46,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "remove";} - + /** * Succinct documentation. */ @@ -54,7 +54,7 @@ public: { return "Deprecated. Use the list(REMOVE_ITEM ) command instead."; } - + /** * More documentation. */ @@ -66,13 +66,13 @@ public: "This is typically used to remove entries from a vector " "(e.g. semicolon separated list). VALUE is expanded."; } - + /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const { return true; } - + cmTypeMacro(cmRemoveCommand, cmCommand); }; diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h index f0e906d15..18f617124 100644 --- a/Source/cmRemoveDefinitionsCommand.h +++ b/Source/cmRemoveDefinitionsCommand.h @@ -17,9 +17,9 @@ /** \class cmRemoveDefinitionsCommand * \brief Specify a list of compiler defines * - * cmRemoveDefinitionsCommand specifies a list of compiler defines. + * cmRemoveDefinitionsCommand specifies a list of compiler defines. * These defines will - * be removed from the compile command. + * be removed from the compile command. */ class cmRemoveDefinitionsCommand : public cmCommand { @@ -27,7 +27,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmRemoveDefinitionsCommand; } @@ -43,7 +43,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "remove_definitions";} - + /** * Succinct documentation. */ @@ -51,7 +51,7 @@ public: { return "Removes -D define flags added by add_definitions."; } - + /** * More documentation. */ @@ -62,7 +62,7 @@ public: "Removes flags (added by add_definitions) from the compiler command " "line for sources in the current directory and below."; } - + cmTypeMacro(cmRemoveDefinitionsCommand, cmCommand); }; diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h index 690ab79ca..a6e87eff3 100644 --- a/Source/cmReturnCommand.h +++ b/Source/cmReturnCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmReturnCommand; } @@ -46,7 +46,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "return";} - + /** * Succinct documentation. */ @@ -54,7 +54,7 @@ public: { return "Return from a file, directory or function."; } - + /** * More documentation. */ @@ -72,7 +72,7 @@ public: "of the function. Note that a macro " "is not a function and does not handle return like a function does."; } - + cmTypeMacro(cmReturnCommand, cmCommand); }; diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h index 6a51a9223..d62baf787 100644 --- a/Source/cmSeparateArgumentsCommand.h +++ b/Source/cmSeparateArgumentsCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmSeparateArgumentsCommand; } @@ -46,16 +46,16 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "separate_arguments";} - + /** * Succinct documentation. */ virtual const char* GetTerseDocumentation() const { - return + return "Parse space-separated arguments into a semicolon-separated list."; } - + /** * More documentation. */ @@ -83,7 +83,7 @@ public: "All spaces are replaced with ';'. This helps with generating " "command lines."; } - + cmTypeMacro(cmSeparateArgumentsCommand, cmCommand); }; diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index d00fc86cf..20f38be10 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -20,7 +20,7 @@ bool cmSetCommand this->SetError("called with incorrect number of arguments"); return false; } - + // watch for ENV signatures const char* variable = args[0].c_str(); // VAR is always first if (!strncmp(variable,"ENV{",4) && strlen(variable) > 5) @@ -31,7 +31,7 @@ bool cmSetCommand varName[strlen(variable)-5] = '\0'; std::string putEnvArg = varName; putEnvArg += "="; - + // what is the current value if any const char *currValue = getenv(varName); delete [] varName; @@ -47,7 +47,7 @@ bool cmSetCommand } return true; } - + // if it will be cleared, then clear it if it isn;t already clear if (currValue) { @@ -55,7 +55,7 @@ bool cmSetCommand } return true; } - + // SET (VAR) // Removes the definition of VAR. if (args.size() == 1) { @@ -63,7 +63,7 @@ bool cmSetCommand return true; } - // here are the remaining options + // here are the remaining options // SET (VAR value ) // SET (VAR CACHE TYPE "doc String" [FORCE]) // SET (VAR value CACHE TYPE "doc string" [FORCE]) @@ -71,10 +71,10 @@ bool cmSetCommand bool cache = false; // optional bool force = false; // optional bool parentScope = false; - cmCacheManager::CacheEntryType type + cmCacheManager::CacheEntryType type = cmCacheManager::STRING; // required if cache const char* docstring = 0; // required if cache - + unsigned int ignoreLastArgs = 0; // look for PARENT_SCOPE argument if (args.size() > 1 && args[args.size()-1] == "PARENT_SCOPE") @@ -136,7 +136,7 @@ bool cmSetCommand this->SetError("given invalid arguments for CACHE mode."); return false; } - + if(cache) { std::string::size_type cacheStart = args.size() - 3 - (force ? 1 : 0); @@ -145,7 +145,7 @@ bool cmSetCommand } // see if this is already in the cache - cmCacheManager::CacheIterator it = + cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()->GetCacheIterator(variable); if(!it.IsAtEnd() && (it.GetType() != cmCacheManager::UNINITIALIZED)) { @@ -158,7 +158,7 @@ bool cmSetCommand return true; } } - + // if it is meant to be in the cache then define it in the cache if(cache) { diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h index 2dd80e37f..fe1d58df6 100644 --- a/Source/cmSetCommand.h +++ b/Source/cmSetCommand.h @@ -17,7 +17,7 @@ /** \class cmSetCommand * \brief Set a CMAKE variable * - * cmSetCommand sets a variable to a value with expansion. + * cmSetCommand sets a variable to a value with expansion. */ class cmSetCommand : public cmCommand { @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmSetCommand; } @@ -46,7 +46,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "set";} - + /** * Succinct documentation. */ @@ -54,7 +54,7 @@ public: { return "Set a CMake, cache or environment variable to a given value."; } - + /** * More documentation. */ @@ -154,7 +154,7 @@ public: "variable will use the value from the normal variable, which hides the " "cache variable."; } - + cmTypeMacro(cmSetCommand, cmCommand); }; diff --git a/Source/cmSetDirectoryPropertiesCommand.cxx b/Source/cmSetDirectoryPropertiesCommand.cxx index b956313a0..62c9b87c7 100644 --- a/Source/cmSetDirectoryPropertiesCommand.cxx +++ b/Source/cmSetDirectoryPropertiesCommand.cxx @@ -22,11 +22,11 @@ bool cmSetDirectoryPropertiesCommand this->SetError("called with incorrect number of arguments"); return false; } - + std::string errors; - bool ret = - cmSetDirectoryPropertiesCommand::RunCommand(this->Makefile, - args.begin() + 1, + bool ret = + cmSetDirectoryPropertiesCommand::RunCommand(this->Makefile, + args.begin() + 1, args.end(), errors); if (!ret) { @@ -52,19 +52,19 @@ bool cmSetDirectoryPropertiesCommand const std::string& value = *(ait+1); if ( prop == "VARIABLES" ) { - errors = + errors = "Variables and cache variables should be set using SET command"; return false; } else if ( prop == "MACROS" ) { - errors = + errors = "Commands and macros cannot be set using SET_CMAKE_PROPERTIES"; return false; } mf->SetProperty(prop.c_str(), value.c_str()); } - + return true; } diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h index ee401582a..8a50c60ff 100644 --- a/Source/cmSetDirectoryPropertiesCommand.h +++ b/Source/cmSetDirectoryPropertiesCommand.h @@ -17,7 +17,7 @@ class cmSetDirectoryPropertiesCommand : public cmCommand { public: - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmSetDirectoryPropertiesCommand; } @@ -46,7 +46,7 @@ public: { return "Set a property of the directory."; } - + /** * Static entry point for use by other commands */ @@ -69,7 +69,7 @@ public: "ADDITIONAL_MAKE_CLEAN_FILES is a list of files that will be cleaned " "as a part of \"make clean\" stage."; } - + cmTypeMacro(cmSetDirectoryPropertiesCommand, cmCommand); }; diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx index 89ff4b18b..619dfc5a5 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.cxx +++ b/Source/cmSetSourceFilesPropertiesCommand.cxx @@ -40,14 +40,14 @@ bool cmSetSourceFilesPropertiesCommand ++j; } - // now call the worker function + // now call the worker function std::string errors; - bool ret = + bool ret = cmSetSourceFilesPropertiesCommand - ::RunCommand(this->Makefile, + ::RunCommand(this->Makefile, args.begin(), args.begin() + numFiles, - args.begin() + numFiles, + args.begin() + numFiles, args.end(), errors); if (!ret) { diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h index 2a67bc09f..f7009e781 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.h +++ b/Source/cmSetSourceFilesPropertiesCommand.h @@ -17,7 +17,7 @@ class cmSetSourceFilesPropertiesCommand : public cmCommand { public: - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmSetSourceFilesPropertiesCommand; } @@ -41,7 +41,7 @@ public: { return "Source files can have properties that affect how they are built."; } - + /** * Longer documentation. */ @@ -58,7 +58,7 @@ public: "Source file properties are visible only to targets " "added in the same directory (CMakeLists.txt)."; } - + cmTypeMacro(cmSetSourceFilesPropertiesCommand, cmCommand); static bool RunCommand(cmMakefile *mf, diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index 45a305e32..a2b50a8ef 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -67,11 +67,11 @@ bool cmSetTargetPropertiesCommand "a PROPERTIES specifier?"); return false; } - + // now loop over all the targets int i; for(i = 0; i < numFiles; ++i) - { + { bool ret = cmSetTargetPropertiesCommand::SetOneTarget (args[i].c_str(),propertyPairs,this->Makefile); if (!ret) @@ -86,7 +86,7 @@ bool cmSetTargetPropertiesCommand } bool cmSetTargetPropertiesCommand -::SetOneTarget(const char *tname, +::SetOneTarget(const char *tname, std::vector &propertyPairs, cmMakefile *mf) { @@ -103,7 +103,7 @@ bool cmSetTargetPropertiesCommand } // if file is not already in the makefile, then add it else - { + { return false; } return true; diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index 1bc429cfd..9dd7848d3 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -17,7 +17,7 @@ class cmSetTargetPropertiesCommand : public cmCommand { public: - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmSetTargetPropertiesCommand; } @@ -41,12 +41,12 @@ public: { return "Targets can have properties that affect how they are built."; } - + /** * Used by this command and cmSetPropertiesCommand */ - static bool SetOneTarget(const char *tname, - std::vector &propertyPairs, + static bool SetOneTarget(const char *tname, + std::vector &propertyPairs, cmMakefile *mf); /** @@ -138,7 +138,7 @@ public: "are used to initialize these properties.\n" "PROJECT_LABEL can be used to change the name of " "the target in an IDE like visual studio. VS_KEYWORD can be set " - "to change the visual studio keyword, for example QT integration " + "to change the visual studio keyword, for example Qt integration " "works better if this is set to Qt4VSv1.0.\n" "VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER and " "VS_SCC_AUXPATH can be set " @@ -156,10 +156,12 @@ public: "\n" "The EXCLUDE_FROM_DEFAULT_BUILD property is used by the visual " "studio generators. If it is set to 1 the target will not be " - "part of the default build when you select \"Build Solution\"." + "part of the default build when you select \"Build Solution\". " + "This can also be set on a per-configuration basis using " + "EXCLUDE_FROM_DEFAULT_BUILD_." ; } - + cmTypeMacro(cmSetTargetPropertiesCommand, cmCommand); }; diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index e4fee18f1..3d52cf242 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -73,10 +73,10 @@ bool cmSetTestsPropertiesCommand // now loop over all the targets int i; for(i = 0; i < numFiles; ++i) - { + { std::string errors; - bool ret = - cmSetTestsPropertiesCommand::SetOneTest(args[i].c_str(), + bool ret = + cmSetTestsPropertiesCommand::SetOneTest(args[i].c_str(), propertyPairs, this->Makefile, errors); if (!ret) @@ -91,7 +91,7 @@ bool cmSetTestsPropertiesCommand bool cmSetTestsPropertiesCommand -::SetOneTest(const char *tname, +::SetOneTest(const char *tname, std::vector &propertyPairs, cmMakefile *mf, std::string &errors) { @@ -106,11 +106,11 @@ bool cmSetTestsPropertiesCommand } } else - { + { errors = "Can not find test to add properties to: "; errors += tname; return false; - } + } return true; } diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index 10df17dd8..3a592189b 100644 --- a/Source/cmSetTestsPropertiesCommand.h +++ b/Source/cmSetTestsPropertiesCommand.h @@ -17,7 +17,7 @@ class cmSetTestsPropertiesCommand : public cmCommand { public: - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmSetTestsPropertiesCommand; } @@ -70,7 +70,7 @@ public: cmTypeMacro(cmSetTestsPropertiesCommand, cmCommand); - static bool SetOneTest(const char *tname, + static bool SetOneTest(const char *tname, std::vector &propertyPairs, cmMakefile *mf, std::string &errors); diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx index 04e357ca8..2bdd1ad28 100644 --- a/Source/cmSiteNameCommand.cxx +++ b/Source/cmSiteNameCommand.cxx @@ -29,25 +29,25 @@ bool cmSiteNameCommand paths.push_back("/bin"); paths.push_back("/sbin"); paths.push_back("/usr/local/bin"); - + const char* cacheValue = this->Makefile->GetDefinition(args[0].c_str()); if(cacheValue) { return true; } - + const char *temp = this->Makefile->GetDefinition("HOSTNAME"); std::string hostname_cmd; if(temp) { hostname_cmd = temp; } - else + else { hostname_cmd = cmSystemTools::FindProgram("hostname", paths); } - + std::string siteName = "unknown"; #if defined(_WIN32) && !defined(__CYGWIN__) std::string host; @@ -64,7 +64,7 @@ bool cmSiteNameCommand std::string host; cmSystemTools::RunSingleCommand(hostname_cmd.c_str(), &host, 0, 0, cmSystemTools::OUTPUT_NONE); - + // got the hostname if (host.length()) { diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h index 532710cc1..52a63bc9c 100644 --- a/Source/cmSiteNameCommand.h +++ b/Source/cmSiteNameCommand.h @@ -25,7 +25,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmSiteNameCommand; } @@ -46,7 +46,7 @@ public: * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() const {return "site_name";} - + /** * Succinct documentation. */ @@ -54,7 +54,7 @@ public: { return "Set the given variable to the name of the computer."; } - + /** * More documentation. */ @@ -63,7 +63,7 @@ public: return " site_name(variable)\n"; } - + cmTypeMacro(cmSiteNameCommand, cmCommand); }; diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index cd94753cb..1d4b0c8b4 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -346,7 +346,7 @@ const char* cmSourceFile::GetProperty(const char* prop) const } bool chain = false; - const char *retVal = + const char *retVal = this->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE, chain); if (chain) { @@ -354,7 +354,7 @@ const char* cmSourceFile::GetProperty(const char* prop) const return mf->GetProperty(prop,cmProperty::SOURCE_FILE); } - return retVal; + return retVal; } //---------------------------------------------------------------------------- @@ -388,7 +388,7 @@ void cmSourceFile::DefineProperties(cmake *cm) { // define properties cm->DefineProperty - ("ABSTRACT", cmProperty::SOURCE_FILE, + ("ABSTRACT", cmProperty::SOURCE_FILE, "Is this source file an abstract class.", "A property on a source file that indicates if the source file " "represents a class that is abstract. This only makes sense for " @@ -396,7 +396,7 @@ void cmSourceFile::DefineProperties(cmake *cm) "only used by some tools that wrap classes into other languages."); cm->DefineProperty - ("COMPILE_FLAGS", cmProperty::SOURCE_FILE, + ("COMPILE_FLAGS", cmProperty::SOURCE_FILE, "Additional flags to be added when compiling this source file.", "These flags will be added to the list of compile flags when " "this source file builds. Use COMPILE_DEFINITIONS to pass additional " @@ -430,7 +430,7 @@ void cmSourceFile::DefineProperties(cmake *cm) "be ignored by the Xcode generator."); cm->DefineProperty - ("EXTERNAL_OBJECT", cmProperty::SOURCE_FILE, + ("EXTERNAL_OBJECT", cmProperty::SOURCE_FILE, "If set to true then this is an object file.", "If this property is set to true then the source file " "is really an object file and should not be compiled. " @@ -446,23 +446,23 @@ void cmSourceFile::DefineProperties(cmake *cm) "source files in a target share the same format."); cm->DefineProperty - ("GENERATED", cmProperty::SOURCE_FILE, + ("GENERATED", cmProperty::SOURCE_FILE, "Is this source file generated as part of the build process.", "If a source file is generated by the build process CMake will " "handle it differently in terms of dependency checking etc. " "Otherwise having a non-existent source file could create problems."); cm->DefineProperty - ("HEADER_FILE_ONLY", cmProperty::SOURCE_FILE, + ("HEADER_FILE_ONLY", cmProperty::SOURCE_FILE, "Is this source file only a header file.", "A property on a source file that indicates if the source file " "is a header file with no associated implementation. This is " "set automatically based on the file extension and is used by " - "CMake to determine is certain dependency information should be " + "CMake to determine if certain dependency information should be " "computed."); cm->DefineProperty - ("KEEP_EXTENSION", cmProperty::SOURCE_FILE, + ("KEEP_EXTENSION", cmProperty::SOURCE_FILE, "Make the output file have the same extension as the source file.", "If this property is set then the file extension of the output " "file will be the same as that of the source file. Normally " @@ -477,7 +477,7 @@ void cmSourceFile::DefineProperties(cmake *cm) "No other semantics are currently specified."); cm->DefineProperty - ("LANGUAGE", cmProperty::SOURCE_FILE, + ("LANGUAGE", cmProperty::SOURCE_FILE, "What programming language is the file.", "A property that can be set to indicate what programming language " "the source file is. If it is not set the language is determined " @@ -486,13 +486,13 @@ void cmSourceFile::DefineProperties(cmake *cm) "Do not set this for header or files that should not be compiled."); cm->DefineProperty - ("LOCATION", cmProperty::SOURCE_FILE, + ("LOCATION", cmProperty::SOURCE_FILE, "The full path to a source file.", "A read only property on a SOURCE FILE that contains the full path " "to the source file."); cm->DefineProperty - ("MACOSX_PACKAGE_LOCATION", cmProperty::SOURCE_FILE, + ("MACOSX_PACKAGE_LOCATION", cmProperty::SOURCE_FILE, "Place a source file inside a Mac OS X bundle, CFBundle, or framework.", "Executable targets with the MACOSX_BUNDLE property set are built " "as Mac OS X application bundles on Apple platforms. " @@ -531,7 +531,7 @@ void cmSourceFile::DefineProperties(cmake *cm) "command (if one does not already exist due to linking relationships)."); cm->DefineProperty - ("OBJECT_OUTPUTS", cmProperty::SOURCE_FILE, + ("OBJECT_OUTPUTS", cmProperty::SOURCE_FILE, "Additional outputs for a Makefile rule.", "Additional outputs created by compilation of this source file. " "If any of these outputs is missing the object will be recompiled. " @@ -539,14 +539,14 @@ void cmSourceFile::DefineProperties(cmake *cm) "on other generators."); cm->DefineProperty - ("SYMBOLIC", cmProperty::SOURCE_FILE, + ("SYMBOLIC", cmProperty::SOURCE_FILE, "Is this just a name for a rule.", "If SYMBOLIC (boolean) is set to true the build system will be " "informed that the source file is not actually created on disk but " "instead used as a symbolic name for a build rule."); - + cm->DefineProperty - ("WRAP_EXCLUDE", cmProperty::SOURCE_FILE, + ("WRAP_EXCLUDE", cmProperty::SOURCE_FILE, "Exclude this source file from any code wrapping techniques.", "Some packages can wrap source files into alternate languages " "to provide additional functionality. For example, C++ code " diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index ae012747d..6c68b8745 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -21,7 +21,7 @@ class cmake; /** \class cmSourceFile * \brief Represent a class loaded from a makefile. * - * cmSourceFile is represents a class loaded from + * cmSourceFile is represents a class loaded from * a makefile. */ class cmSourceFile diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index 2b34f2bfc..f09976f44 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -71,13 +71,13 @@ void cmSourceGroup::SetGroupRegex(const char* regex) this->GroupRegex.compile("^$"); } } - + //---------------------------------------------------------------------------- void cmSourceGroup::AddGroupFile(const char* name) { this->GroupFiles.insert(name); } - + //---------------------------------------------------------------------------- const char* cmSourceGroup::GetName() const { @@ -89,7 +89,7 @@ const char* cmSourceGroup::GetFullName() const { return this->FullName.c_str(); } - + //---------------------------------------------------------------------------- bool cmSourceGroup::MatchesRegex(const char* name) { @@ -137,12 +137,12 @@ cmSourceGroup *cmSourceGroup::lookupChild(const char* name) // st for(;iter!=end; ++iter) { - std::string sgName = iter->GetName(); + std::string sgName = iter->GetName(); // look if descenened is the one were looking for if(sgName == name) { - return &(*iter); // if it so return it + return &(*iter); // if it so return it } } @@ -182,10 +182,6 @@ cmSourceGroup *cmSourceGroup::MatchChildrenRegex(const char *name) std::vector::iterator end = this->Internal->GroupChildren.end(); - if(this->MatchesRegex(name)) - { - return this; - } for(;iter!=end; ++iter) { cmSourceGroup *result = iter->MatchChildrenRegex(name); @@ -194,6 +190,11 @@ cmSourceGroup *cmSourceGroup::MatchChildrenRegex(const char *name) return result; } } + if(this->MatchesRegex(name)) + { + return this; + } + return 0; } diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h index 641dcbd57..11a0c74ae 100644 --- a/Source/cmSourceGroup.h +++ b/Source/cmSourceGroup.h @@ -37,12 +37,12 @@ public: cmSourceGroup(cmSourceGroup const& r); ~cmSourceGroup(); cmSourceGroup& operator=(cmSourceGroup const&); - + /** * Set the regular expression for this group. */ void SetGroupRegex(const char* regex); - + /** * Add a file name to the explicit list of files for this group. */ @@ -57,7 +57,7 @@ public: * Looks up child and returns it */ cmSourceGroup *lookupChild(const char *name); - + /** * Get the name of this group. */ @@ -67,12 +67,12 @@ public: * Get the full path name for group. */ const char* GetFullName() const; - + /** * Check if the given name matches this group's regex. */ bool MatchesRegex(const char* name); - + /** * Check if the given name matches this group's explicit file list. */ @@ -88,8 +88,8 @@ public: * Check if the given name matches this group's regex in children. */ cmSourceGroup *MatchChildrenRegex(const char *name); - - /** + + /** * Assign the given source file to this group. Used only by * generators. */ @@ -100,7 +100,7 @@ public: * source group. */ const std::vector& GetSourceFiles() const; - + std::vector const& GetGroupChildren() const; private: /** @@ -109,17 +109,17 @@ private: std::string Name; // Full path to group std::string FullName; - + /** * The regular expression matching the files in the group. */ cmsys::RegularExpression GroupRegex; - + /** * Set of file names explicitly added to this group. */ std::set GroupFiles; - + /** * Vector of all source files that have been assigned to * this group. diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 8e61d0a15..9cb80f617 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -19,7 +19,7 @@ bool cmSourceGroupCommand { this->SetError("called with incorrect number of arguments"); return false; - } + } std::string delimiter = "\\"; if(this->Makefile->GetDefinition("SOURCE_GROUP_DELIMITER")) @@ -29,7 +29,7 @@ bool cmSourceGroupCommand std::vector folders = cmSystemTools::tokenize(args[0], delimiter); - + cmSourceGroup* sg = 0; sg = this->Makefile->GetSourceGroup(folders); if(!sg) @@ -50,7 +50,7 @@ bool cmSourceGroupCommand sg->SetGroupRegex(args[1].c_str()); return true; } - + // Process arguments. bool doingFiles = false; for(unsigned int i=1; i < args.size(); ++i) @@ -97,6 +97,6 @@ bool cmSourceGroupCommand return false; } } - + return true; } diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h index 6a29fc810..9f6b7e4f9 100644 --- a/Source/cmSourceGroupCommand.h +++ b/Source/cmSourceGroupCommand.h @@ -26,7 +26,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmSourceGroupCommand; } @@ -37,7 +37,7 @@ public: */ virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - + /** * The name of the command as specified in CMakeList.txt. */ @@ -50,7 +50,7 @@ public: { return "Define a grouping for sources in the makefile."; } - + /** * More documentation. */ @@ -68,11 +68,11 @@ public: "expression matches the file will be favored.\n" "The name of the group may contain backslashes to specify subgroups:\n" " source_group(outer\\\\inner ...)\n" - "For backwards compatibility, this command is also supports the " + "For backwards compatibility, this command also supports the " "format:\n" " source_group(name regex)"; } - + cmTypeMacro(cmSourceGroupCommand, cmCommand); }; diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index ea299ca90..a4aec2e12 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -152,10 +152,10 @@ extern int putenv (char *__string) __THROW; // if std:: is not supported, then just #define it away #ifdef CMAKE_NO_STD_NAMESPACE -#define std +#define std #endif -// if the compiler does not support ansi for scoping of vars use a +// if the compiler does not support ansi for scoping of vars use a // #define hack #ifdef CMAKE_NO_ANSI_FOR_SCOPE #define for if(false) {} else for @@ -178,7 +178,7 @@ namespace std { typedef ios ios_base; } #endif #ifdef __DECCXX_VER -# if __DECCXX_VER <= 60390008 +# if __DECCXX_VER <= 60390008 # define CM_HAS_STD_BUT_NOT_FOR_IOSTREAM # endif #endif @@ -200,7 +200,7 @@ using ::cerr; using ::cin; using ::ifstream; using ::ofstream; - + #if !defined(CMAKE_NO_ANSI_STRING_STREAM) using ::ostringstream; using ::istringstream; @@ -208,7 +208,7 @@ using ::ofstream; using ::ostrstream; using ::istrstream; #endif - + using ::endl; using ::ends; using ::flush; @@ -324,8 +324,8 @@ struct cmDocumentationEntry std::string Full; cmDocumentationEntry(){}; cmDocumentationEntry(const char *doc[3]) - { if (doc[0]) this->Name = doc[0]; - if (doc[1]) this->Brief = doc[1]; + { if (doc[0]) this->Name = doc[0]; + if (doc[1]) this->Brief = doc[1]; if (doc[2]) this->Full = doc[2]; }; cmDocumentationEntry(const char *n, const char *b, const char *f) { if (n) this->Name = n; if (b) this->Brief = b; if (f) this->Full = f; }; @@ -353,7 +353,7 @@ public: # pragma reset woff 1375 /* base class destructor not virtual */ #endif -// All subclasses of cmCommand or cmCTestGenericHandler should +// All subclasses of cmCommand or cmCTestGenericHandler should // invoke this macro. #define cmTypeMacro(thisClass,superclass) \ virtual const char* GetNameOfClass() { return #thisClass; } \ diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index ec10d571f..e49edd878 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -19,6 +19,8 @@ #include #include +#include + //---------------------------------------------------------------------------- bool cmStringCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) @@ -28,7 +30,7 @@ bool cmStringCommand this->SetError("must be called with at least one argument."); return false; } - + const std::string &subCommand = args[0]; if(subCommand == "REGEX") { @@ -87,6 +89,10 @@ bool cmStringCommand { return this->HandleFindCommand(args); } + else if(subCommand == "TIMESTAMP") + { + return this->HandleTimestampCommand(args); + } std::string e = "does not recognize sub-command "+subCommand; this->SetError(e.c_str()); @@ -134,11 +140,11 @@ bool cmStringCommand::HandleToUpperLowerCommand( std::string outvar = args[2]; std::string output; - if (toUpper) + if (toUpper) { output = cmSystemTools::UpperCase(args[1]); - } - else + } + else { output = cmSystemTools::LowerCase(args[1]); } @@ -266,7 +272,7 @@ bool cmStringCommand::HandleRegexCommand(std::vector const& args) } return this->RegexReplace(args); } - + std::string e = "sub-command REGEX does not recognize mode "+mode; this->SetError(e.c_str()); return false; @@ -279,25 +285,25 @@ bool cmStringCommand::RegexMatch(std::vector const& args) // ]\n" " [COPY_FILE ])\n" "Try building a source file into an executable. " @@ -90,7 +91,12 @@ public: "Some extra flags that can be included are, " "INCLUDE_DIRECTORIES, LINK_DIRECTORIES, and LINK_LIBRARIES. " "COMPILE_DEFINITIONS are -Ddefinition that will be passed to the " - "compile line. " + "compile line.\n" + "The srcfile signature also accepts a LINK_LIBRARIES argument which " + "may contain a list of libraries or IMPORTED targets which will be " + "linked to in the generated project. If LINK_LIBRARIES is specified " + "as a parameter to try_compile, then any LINK_LIBRARIES passed as " + "CMAKE_FLAGS will be ignored.\n" "try_compile creates a CMakeList.txt " "file on the fly that looks like this:\n" " add_definitions( const& args, cmExecutionStatus &) -{ +{ // expected two arguments: // arguement one: the full path to gl_mangle.h // arguement two : directory for output of edited headers @@ -55,11 +55,11 @@ bool cmUseMangledMesaCommand path += *i; this->CopyAndFullPathMesaHeader(path.c_str(), destDir); } - + return true; } -void +void cmUseMangledMesaCommand:: CopyAndFullPathMesaHeader(const char* source, const char* outdir) @@ -74,7 +74,7 @@ CopyAndFullPathMesaHeader(const char* source, std::ofstream fout(tempOutputFile.c_str()); if(!fout) { - cmSystemTools::Error("Could not open file for write in copy operation: ", + cmSystemTools::Error("Could not open file for write in copy operation: ", tempOutputFile.c_str(), outdir); cmSystemTools::ReportLastSystemError(""); return; @@ -88,7 +88,7 @@ CopyAndFullPathMesaHeader(const char* source, } // now copy input to output and expand variables in the // input file at the same time - std::string inLine; + std::string inLine; // regular expression for any #include line cmsys::RegularExpression includeLine( "^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)[\">]"); @@ -108,7 +108,7 @@ CopyAndFullPathMesaHeader(const char* source, } else if(glLine.find(includeFile.c_str())) { - fout << "#include \"" << outdir << "/" << + fout << "#include \"" << outdir << "/" << includeLine.match(1).c_str() << "\"\n"; } else diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 41c82c2ba..6ea3dfac8 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -22,7 +22,7 @@ bool cmUtilitySourceCommand } std::vector::const_iterator arg = args.begin(); - + // The first argument is the cache entry name. std::string cacheEntry = *arg++; const char* cacheValue = @@ -30,7 +30,7 @@ bool cmUtilitySourceCommand // If it exists already and appears up to date then we are done. If // the string contains "(IntDir)" but that is not the // CMAKE_CFG_INTDIR setting then the value is out of date. - const char* intDir = + const char* intDir = this->Makefile->GetRequiredDefinition("CMAKE_CFG_INTDIR"); bool haveCacheValue = false; @@ -60,21 +60,21 @@ bool cmUtilitySourceCommand { return true; } - + // The second argument is the utility's executable name, which will be // needed later. std::string utilityName = *arg++; - + // The third argument specifies the relative directory of the source // of the utility. std::string relativeSource = *arg++; std::string utilitySource = this->Makefile->GetCurrentDirectory(); utilitySource = utilitySource+"/"+relativeSource; - + // If the directory doesn't exist, the source has not been included. if(!cmSystemTools::FileExists(utilitySource.c_str())) { return true; } - + // Make sure all the files exist in the source directory. while(arg != args.end()) { @@ -82,9 +82,9 @@ bool cmUtilitySourceCommand if(!cmSystemTools::FileExists(file.c_str())) { return true; } } - + // The source exists. - std::string cmakeCFGout = + std::string cmakeCFGout = this->Makefile->GetRequiredDefinition("CMAKE_CFG_INTDIR"); std::string utilityDirectory = this->Makefile->GetCurrentOutputDirectory(); std::string exePath; @@ -100,7 +100,7 @@ bool cmUtilitySourceCommand { utilityDirectory += "/"+relativeSource; } - + // Construct the cache entry for the executable's location. std::string utilityExecutable = utilityDirectory+"/"+cmakeCFGout+"/" @@ -108,7 +108,7 @@ bool cmUtilitySourceCommand // make sure we remove any /./ in the name cmSystemTools::ReplaceString(utilityExecutable, "/./", "/"); - + // Enter the value into the cache. this->Makefile->AddCacheDefinition(cacheEntry.c_str(), utilityExecutable.c_str(), @@ -121,7 +121,7 @@ bool cmUtilitySourceCommand utilityName.c_str(), "Executable to project name.", cmCacheManager::INTERNAL); - + return true; } diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h index 32afddadc..195f605f2 100644 --- a/Source/cmUtilitySourceCommand.h +++ b/Source/cmUtilitySourceCommand.h @@ -29,7 +29,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmUtilitySourceCommand; } @@ -53,7 +53,7 @@ public: { return "Specify the source tree of a third-party utility."; } - + /** * More documentation. */ diff --git a/Source/cmVS10LinkFlagTable.h b/Source/cmVS10LinkFlagTable.h index c60e8eb20..64febbb52 100644 --- a/Source/cmVS10LinkFlagTable.h +++ b/Source/cmVS10LinkFlagTable.h @@ -182,8 +182,8 @@ static cmVS7FlagTable cmVS10LinkFlagTable[] = {"SupportUnloadOfDelayLoadedDLL", "DELAY:UNLOAD", "", "true", 0}, {"SupportNobindOfDelayLoadedDLL", "DELAY:NOBIND", "", "true", 0}, {"Profile", "PROFILE", "", "true", 0}, - {"DelaySign", "DELAYSIGN:NO", "", "false", 0}, - {"DelaySign", "DELAYSIGN", "", "true", 0}, + {"LinkDelaySign", "DELAYSIGN:NO", "", "false", 0}, + {"LinkDelaySign", "DELAYSIGN", "", "true", 0}, {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK:NO", "", "false", 0}, {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK", "", "true", 0}, {"ImageHasSafeExceptionHandlers", "SAFESEH:NO", "", "false", 0}, @@ -294,7 +294,7 @@ static cmVS7FlagTable cmVS10LinkFlagTable[] = {"MergeSections", "MERGE:", "Merge Sections", "", cmVS7FlagTable::UserValue}, - {"KeyFile", "KEYFILE:", + {"LinkKeyFile", "KEYFILE:", "Key File", "", cmVS7FlagTable::UserValue}, {"KeyContainer", "KEYCONTAINER:", diff --git a/Source/cmVS11CLFlagTable.h b/Source/cmVS11CLFlagTable.h new file mode 100644 index 000000000..5ab8ebbb3 --- /dev/null +++ b/Source/cmVS11CLFlagTable.h @@ -0,0 +1,291 @@ +static cmVS7FlagTable cmVS11CLFlagTable[] = +{ + + //Enum Properties + {"DebugInformationFormat", "", + "None", "None", 0}, + {"DebugInformationFormat", "Z7", + "C7 compatible", "OldStyle", 0}, + {"DebugInformationFormat", "Zi", + "Program Database", "ProgramDatabase", 0}, + {"DebugInformationFormat", "ZI", + "Program Database for Edit And Continue", "EditAndContinue", 0}, + + {"WarningLevel", "W0", + "Turn Off All Warnings", "TurnOffAllWarnings", 0}, + {"WarningLevel", "W1", + "Level1", "Level1", 0}, + {"WarningLevel", "W2", + "Level2", "Level2", 0}, + {"WarningLevel", "W3", + "Level3", "Level3", 0}, + {"WarningLevel", "W4", + "Level4", "Level4", 0}, + {"WarningLevel", "Wall", + "EnableAllWarnings", "EnableAllWarnings", 0}, + + {"Optimization", "Od", + "Disabled", "Disabled", 0}, + {"Optimization", "O1", + "Minimize Size", "MinSpace", 0}, + {"Optimization", "O2", + "Maximize Speed", "MaxSpeed", 0}, + {"Optimization", "Ox", + "Full Optimization", "Full", 0}, + + {"InlineFunctionExpansion", "", + "Default", "Default", 0}, + {"InlineFunctionExpansion", "Ob0", + "Disabled", "Disabled", 0}, + {"InlineFunctionExpansion", "Ob1", + "Only __inline", "OnlyExplicitInline", 0}, + {"InlineFunctionExpansion", "Ob2", + "Any Suitable", "AnySuitable", 0}, + + {"FavorSizeOrSpeed", "Os", + "Favor small code", "Size", 0}, + {"FavorSizeOrSpeed", "Ot", + "Favor fast code", "Speed", 0}, + {"FavorSizeOrSpeed", "", + "Neither", "Neither", 0}, + + {"ExceptionHandling", "EHa", + "Yes with SEH Exceptions", "Async", 0}, + {"ExceptionHandling", "EHsc", + "Yes", "Sync", 0}, + {"ExceptionHandling", "EHs", + "Yes with Extern C functions", "SyncCThrow", 0}, + {"ExceptionHandling", "", + "No", "false", 0}, + + {"BasicRuntimeChecks", "RTCs", + "Stack Frames", "StackFrameRuntimeCheck", 0}, + {"BasicRuntimeChecks", "RTCu", + "Uninitialized variables", "UninitializedLocalUsageCheck", 0}, + {"BasicRuntimeChecks", "RTC1", + "Both (/RTC1, equiv. to /RTCsu)", "EnableFastChecks", 0}, + {"BasicRuntimeChecks", "", + "Default", "Default", 0}, + + {"RuntimeLibrary", "MT", + "Multi-threaded", "MultiThreaded", 0}, + {"RuntimeLibrary", "MTd", + "Multi-threaded Debug", "MultiThreadedDebug", 0}, + {"RuntimeLibrary", "MD", + "Multi-threaded DLL", "MultiThreadedDLL", 0}, + {"RuntimeLibrary", "MDd", + "Multi-threaded Debug DLL", "MultiThreadedDebugDLL", 0}, + + {"StructMemberAlignment", "Zp1", + "1 Byte", "1Byte", 0}, + {"StructMemberAlignment", "Zp2", + "2 Bytes", "2Bytes", 0}, + {"StructMemberAlignment", "Zp4", + "4 Byte", "4Bytes", 0}, + {"StructMemberAlignment", "Zp8", + "8 Bytes", "8Bytes", 0}, + {"StructMemberAlignment", "Zp16", + "16 Bytes", "16Bytes", 0}, + {"StructMemberAlignment", "", + "Default", "Default", 0}, + + {"EnableEnhancedInstructionSet", "arch:SSE", + "Streaming SIMD Extensions", "StreamingSIMDExtensions", 0}, + {"EnableEnhancedInstructionSet", "arch:SSE2", + "Streaming SIMD Extensions 2", "StreamingSIMDExtensions2", 0}, + {"EnableEnhancedInstructionSet", "arch:AVX", + "Advanced Vector Extensions", "AdvancedVectorExtensions", 0}, + {"EnableEnhancedInstructionSet", "arch:IA32", + "No Enhanced Instructions", "NoExtensions", 0}, + {"EnableEnhancedInstructionSet", "", + "Not Set", "NotSet", 0}, + + {"FloatingPointModel", "fp:precise", + "Precise", "Precise", 0}, + {"FloatingPointModel", "fp:strict", + "Strict", "Strict", 0}, + {"FloatingPointModel", "fp:fast", + "Fast", "Fast", 0}, + + {"PrecompiledHeader", "Yc", + "Create", "Create", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeader", "Yu", + "Use", "Use", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeader", "", + "Not Using Precompiled Headers", "NotUsing", 0}, + + {"AssemblerOutput", "", + "No Listing", "NoListing", 0}, + {"AssemblerOutput", "FA", + "Assembly-Only Listing", "AssemblyCode", 0}, + {"AssemblerOutput", "FAc", + "Assembly With Machine Code", "AssemblyAndMachineCode", 0}, + {"AssemblerOutput", "FAs", + "Assembly With Source Code", "AssemblyAndSourceCode", 0}, + {"AssemblerOutput", "FAcs", + "Assembly, Machine Code and Source", "All", 0}, + + {"CallingConvention", "Gd", + "__cdecl", "Cdecl", 0}, + {"CallingConvention", "Gr", + "__fastcall", "FastCall", 0}, + {"CallingConvention", "Gz", + "__stdcall", "StdCall", 0}, + + {"CompileAs", "", + "Default", "Default", 0}, + {"CompileAs", "TC", + "Compile as C Code", "CompileAsC", 0}, + {"CompileAs", "TP", + "Compile as C++ Code", "CompileAsCpp", 0}, + + {"ErrorReporting", "errorReport:none", + "Do Not Send Report", "None", 0}, + {"ErrorReporting", "errorReport:prompt", + "Prompt Immediately", "Prompt", 0}, + {"ErrorReporting", "errorReport:queue", + "Queue For Next Login", "Queue", 0}, + {"ErrorReporting", "errorReport:send", + "Send Automatically", "Send", 0}, + + {"CompileAsManaged", "", + "No Common Language RunTime Support", "false", 0}, + {"CompileAsManaged", "clr", + "Common Language RunTime Support", "true", 0}, + {"CompileAsManaged", "clr:pure", + "Pure MSIL Common Language RunTime Support", "Pure", 0}, + {"CompileAsManaged", "clr:safe", + "Safe MSIL Common Language RunTime Support", "Safe", 0}, + {"CompileAsManaged", "clr:oldSyntax", + "Common Language RunTime Support, Old Syntax", "OldSyntax", 0}, + + + //Bool Properties + {"CompileAsWinRT", "ZW", "", "true", 0}, + {"WinRTNoStdLib", "ZW:nostdlib", "", "true", 0}, + {"SuppressStartupBanner", "nologo-", "", "false", 0}, + {"SuppressStartupBanner", "nologo", "", "true", 0}, + {"TreatWarningAsError", "WX-", "", "false", 0}, + {"TreatWarningAsError", "WX", "", "true", 0}, + {"SDLCheck", "sdl-", "", "false", 0}, + {"SDLCheck", "sdl", "", "true", 0}, + {"IntrinsicFunctions", "Oi", "", "true", 0}, + {"OmitFramePointers", "Oy-", "", "false", 0}, + {"OmitFramePointers", "Oy", "", "true", 0}, + {"EnableFiberSafeOptimizations", "GT", "", "true", 0}, + {"WholeProgramOptimization", "GL", "", "true", 0}, + {"UndefineAllPreprocessorDefinitions", "u", "", "true", 0}, + {"IgnoreStandardIncludePath", "X", "", "true", 0}, + {"PreprocessToFile", "P", "", "true", 0}, + {"PreprocessSuppressLineNumbers", "EP", "", "true", 0}, + {"PreprocessKeepComments", "C", "", "true", 0}, + {"StringPooling", "GF-", "", "false", 0}, + {"StringPooling", "GF", "", "true", 0}, + {"MinimalRebuild", "Gm-", "", "false", 0}, + {"MinimalRebuild", "Gm", "", "true", 0}, + {"SmallerTypeCheck", "RTCc", "", "true", 0}, + {"BufferSecurityCheck", "GS-", "", "false", 0}, + {"BufferSecurityCheck", "GS", "", "true", 0}, + {"FunctionLevelLinking", "Gy-", "", "false", 0}, + {"FunctionLevelLinking", "Gy", "", "true", 0}, + {"EnableParallelCodeGeneration", "Qpar-", "", "false", 0}, + {"EnableParallelCodeGeneration", "Qpar", "", "true", 0}, + {"FloatingPointExceptions", "fp:except-", "", "false", 0}, + {"FloatingPointExceptions", "fp:except", "", "true", 0}, + {"CreateHotpatchableImage", "hotpatch", "", "true", 0}, + {"DisableLanguageExtensions", "Za", "", "true", 0}, + {"TreatWChar_tAsBuiltInType", "Zc:wchar_t-", "", "false", 0}, + {"TreatWChar_tAsBuiltInType", "Zc:wchar_t", "", "true", 0}, + {"ForceConformanceInForLoopScope", "Zc:forScope-", "", "false", 0}, + {"ForceConformanceInForLoopScope", "Zc:forScope", "", "true", 0}, + {"RuntimeTypeInfo", "GR-", "", "false", 0}, + {"RuntimeTypeInfo", "GR", "", "true", 0}, + {"OpenMPSupport", "openmp-", "", "false", 0}, + {"OpenMPSupport", "openmp", "", "true", 0}, + {"ExpandAttributedSource", "Fx", "", "true", 0}, + {"UseUnicodeForAssemblerListing", "FAu", "", "true", 0}, + {"ShowIncludes", "showIncludes", "", "true", 0}, + {"EnablePREfast", "analyze-", "", "false", 0}, + {"EnablePREfast", "analyze", "", "true", 0}, + {"UseFullPaths", "FC", "", "true", 0}, + {"OmitDefaultLibName", "Zl", "", "true", 0}, + + //Bool Properties With Argument + {"MultiProcessorCompilation", "MP", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"ProcessorNumber", "MP", "Multi-processor Compilation", "", + cmVS7FlagTable::UserValueRequired}, + {"GenerateXMLDocumentationFiles", "doc", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"XMLDocumentationFileName", "doc", "Generate XML Documentation Files", "", + cmVS7FlagTable::UserValueRequired}, + {"BrowseInformation", "FR", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"BrowseInformationFile", "FR", "Enable Browse Information", "", + cmVS7FlagTable::UserValueRequired}, + + //String List Properties + {"AdditionalIncludeDirectories", "I", + "Additional Include Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AdditionalUsingDirectories", "AI", + "Additional #using Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"PreprocessorDefinitions", "D ", + "Preprocessor Definitions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"UndefinePreprocessorDefinitions", "U", + "Undefine Preprocessor Definitions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"DisableSpecificWarnings", "wd", + "Disable Specific Warnings", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ForcedIncludeFiles", "FI", + "Forced Include File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ForcedUsingFiles", "FU", + "Forced #using File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"PREfastAdditionalOptions", "analyze:", + "Additional Code Analysis Native options", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"PREfastAdditionalPlugins", "analyze:plugin", + "Additional Code Analysis Native plugins", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"TreatSpecificWarningsAsErrors", "we", + "Treat Specific Warnings As Errors", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + + //String Properties + // Skip [TrackerLogDirectory] - no command line Switch. + {"PreprocessOutputPath", "Fi", + "Preprocess Output Path", + "", cmVS7FlagTable::UserValue}, + {"PrecompiledHeaderFile", "Yc", + "Precompiled Header Name", + "", cmVS7FlagTable::UserValueRequired}, + {"PrecompiledHeaderFile", "Yu", + "Precompiled Header Name", + "", cmVS7FlagTable::UserValueRequired}, + {"PrecompiledHeaderOutputFile", "Fp", + "Precompiled Header Output File", + "", cmVS7FlagTable::UserValue}, + {"AssemblerListingLocation", "Fa", + "ASM List Location", + "", cmVS7FlagTable::UserValue}, + {"ObjectFileName", "Fo", + "Object File Name", + "", cmVS7FlagTable::UserValue}, + {"ProgramDataBaseFileName", "Fd", + "Program Database File Name", + "", cmVS7FlagTable::UserValue}, + // Skip [XMLDocumentationFileName] - no command line Switch. + // Skip [BrowseInformationFile] - no command line Switch. + {"PREfastLog", "analyze:log ", + "Code Analysis Log", + "", cmVS7FlagTable::UserValue}, + // Skip [AdditionalOptions] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVS11LibFlagTable.h b/Source/cmVS11LibFlagTable.h new file mode 100644 index 000000000..942944241 --- /dev/null +++ b/Source/cmVS11LibFlagTable.h @@ -0,0 +1,102 @@ +static cmVS7FlagTable cmVS11LibFlagTable[] = +{ + + //Enum Properties + {"ErrorReporting", "ERRORREPORT:PROMPT", + "PromptImmediately", "PromptImmediately", 0}, + {"ErrorReporting", "ERRORREPORT:QUEUE", + "Queue For Next Login", "QueueForNextLogin", 0}, + {"ErrorReporting", "ERRORREPORT:SEND", + "Send Error Report", "SendErrorReport", 0}, + {"ErrorReporting", "ERRORREPORT:NONE", + "No Error Report", "NoErrorReport", 0}, + + {"TargetMachine", "MACHINE:ARM", + "MachineARM", "MachineARM", 0}, + {"TargetMachine", "MACHINE:EBC", + "MachineEBC", "MachineEBC", 0}, + {"TargetMachine", "MACHINE:IA64", + "MachineIA64", "MachineIA64", 0}, + {"TargetMachine", "MACHINE:MIPS", + "MachineMIPS", "MachineMIPS", 0}, + {"TargetMachine", "MACHINE:MIPS16", + "MachineMIPS16", "MachineMIPS16", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", + "MachineMIPSFPU", "MachineMIPSFPU", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", + "MachineMIPSFPU16", "MachineMIPSFPU16", 0}, + {"TargetMachine", "MACHINE:SH4", + "MachineSH4", "MachineSH4", 0}, + {"TargetMachine", "MACHINE:THUMB", + "MachineTHUMB", "MachineTHUMB", 0}, + {"TargetMachine", "MACHINE:X64", + "MachineX64", "MachineX64", 0}, + {"TargetMachine", "MACHINE:X86", + "MachineX86", "MachineX86", 0}, + + {"SubSystem", "SUBSYSTEM:CONSOLE", + "Console", "Console", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", + "Windows", "Windows", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", + "Native", "Native", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", + "EFI Application", "EFI Application", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", + "EFI Boot Service Driver", "EFI Boot Service Driver", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", + "EFI ROM", "EFI ROM", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", + "EFI Runtime", "EFI Runtime", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWSCE", + "WindowsCE", "WindowsCE", 0}, + {"SubSystem", "SUBSYSTEM:POSIX", + "POSIX", "POSIX", 0}, + + + //Bool Properties + {"SuppressStartupBanner", "NOLOGO", "", "true", 0}, + {"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "", "true", 0}, + {"TreatLibWarningAsErrors", "WX:NO", "", "false", 0}, + {"TreatLibWarningAsErrors", "WX", "", "true", 0}, + {"Verbose", "VERBOSE", "", "true", 0}, + {"LinkTimeCodeGeneration", "LTCG", "", "true", 0}, + + //Bool Properties With Argument + + //String List Properties + // Skip [AdditionalDependencies] - no command line Switch. + {"AdditionalLibraryDirectories", "LIBPATH:", + "Additional Library Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"IgnoreSpecificDefaultLibraries", "NODEFAULTLIB:", + "Ignore Specific Default Libraries", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ExportNamedFunctions", "EXPORT:", + "Export Named Functions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"RemoveObjects", "REMOVE:", + "Remove Objects", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + + //String Properties + {"OutputFile", "OUT:", + "Output File", + "", cmVS7FlagTable::UserValue}, + {"ModuleDefinitionFile", "DEF:", + "Module Definition File Name", + "", cmVS7FlagTable::UserValue}, + {"ForceSymbolReferences", "INCLUDE:", + "Force Symbol References", + "", cmVS7FlagTable::UserValue}, + {"DisplayLibrary", "LIST:", + "Display Library to standard output", + "", cmVS7FlagTable::UserValue}, + // Skip [MinimumRequiredVersion] - no command line Switch. + {"Name", "NAME:", + "Name", + "", cmVS7FlagTable::UserValue}, + // Skip [AdditionalOptions] - no command line Switch. + // Skip [TrackerLogDirectory] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVS11LinkFlagTable.h b/Source/cmVS11LinkFlagTable.h new file mode 100644 index 000000000..ea0d0f0b0 --- /dev/null +++ b/Source/cmVS11LinkFlagTable.h @@ -0,0 +1,343 @@ +static cmVS7FlagTable cmVS11LinkFlagTable[] = +{ + + //Enum Properties + {"ShowProgress", "", + "Not Set", "NotSet", 0}, + {"ShowProgress", "VERBOSE", + "Display all progress messages", "LinkVerbose", 0}, + {"ShowProgress", "VERBOSE:Lib", + "For Libraries Searched", "LinkVerboseLib", 0}, + {"ShowProgress", "VERBOSE:ICF", + "About COMDAT folding during optimized linking", "LinkVerboseICF", 0}, + {"ShowProgress", "VERBOSE:REF", + "About data removed during optimized linking", "LinkVerboseREF", 0}, + {"ShowProgress", "VERBOSE:SAFESEH", + "About Modules incompatible with SEH", "LinkVerboseSAFESEH", 0}, + {"ShowProgress", "VERBOSE:CLR", + "About linker activity related to managed code", "LinkVerboseCLR", 0}, + + {"ForceFileOutput", "FORCE", + "Enabled", "Enabled", 0}, + {"ForceFileOutput", "FORCE:MULTIPLE", + "Multiply Defined Symbol Only", "MultiplyDefinedSymbolOnly", 0}, + {"ForceFileOutput", "FORCE:UNRESOLVED", + "Undefined Symbol Only", "UndefinedSymbolOnly", 0}, + + {"CreateHotPatchableImage", "FUNCTIONPADMIN", + "Enabled", "Enabled", 0}, + {"CreateHotPatchableImage", "FUNCTIONPADMIN:5", + "X86 Image Only", "X86Image", 0}, + {"CreateHotPatchableImage", "FUNCTIONPADMIN:6", + "X64 Image Only", "X64Image", 0}, + {"CreateHotPatchableImage", "FUNCTIONPADMIN:16", + "Itanium Image Only", "ItaniumImage", 0}, + + {"UACExecutionLevel", "level='asInvoker'", + "asInvoker", "AsInvoker", 0}, + {"UACExecutionLevel", "level='highestAvailable'", + "highestAvailable", "HighestAvailable", 0}, + {"UACExecutionLevel", "level='requireAdministrator'", + "requireAdministrator", "RequireAdministrator", 0}, + + {"SubSystem", "", + "Not Set", "NotSet", 0}, + {"SubSystem", "SUBSYSTEM:CONSOLE", + "Console", "Console", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", + "Windows", "Windows", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", + "Native", "Native", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", + "EFI Application", "EFI Application", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", + "EFI Boot Service Driver", "EFI Boot Service Driver", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", + "EFI ROM", "EFI ROM", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", + "EFI Runtime", "EFI Runtime", 0}, + {"SubSystem", "SUBSYSTEM:POSIX", + "POSIX", "POSIX", 0}, + + {"Driver", "", + "Not Set", "NotSet", 0}, + {"Driver", "Driver", + "Driver", "Driver", 0}, + {"Driver", "DRIVER:UPONLY", + "UP Only", "UpOnly", 0}, + {"Driver", "DRIVER:WDM", + "WDM", "WDM", 0}, + + {"LinkTimeCodeGeneration", "", + "Default", "Default", 0}, + {"LinkTimeCodeGeneration", "LTCG", + "Use Link Time Code Generation", "UseLinkTimeCodeGeneration", 0}, + {"LinkTimeCodeGeneration", "LTCG:PGInstrument", + "Profile Guided Optimization - Instrument", "PGInstrument", 0}, + {"LinkTimeCodeGeneration", "LTCG:PGOptimize", + "Profile Guided Optimization - Optimization", "PGOptimization", 0}, + {"LinkTimeCodeGeneration", "LTCG:PGUpdate", + "Profile Guided Optimization - Update", "PGUpdate", 0}, + + {"GenerateWindowsMetadata", "WINMD", + "Yes", "true", 0}, + {"GenerateWindowsMetadata", "WINMD:NO", + "No", "false", 0}, + + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA1", + "SHA1", "SHA1", 0}, + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA256", + "SHA256", "SHA256", 0}, + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA384", + "SHA384", "SHA384", 0}, + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA512", + "SHA512", "SHA512", 0}, + + {"TargetMachine", "", + "Not Set", "NotSet", 0}, + {"TargetMachine", "MACHINE:ARM", + "MachineARM", "MachineARM", 0}, + {"TargetMachine", "MACHINE:EBC", + "MachineEBC", "MachineEBC", 0}, + {"TargetMachine", "MACHINE:IA64", + "MachineIA64", "MachineIA64", 0}, + {"TargetMachine", "MACHINE:MIPS", + "MachineMIPS", "MachineMIPS", 0}, + {"TargetMachine", "MACHINE:MIPS16", + "MachineMIPS16", "MachineMIPS16", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", + "MachineMIPSFPU", "MachineMIPSFPU", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", + "MachineMIPSFPU16", "MachineMIPSFPU16", 0}, + {"TargetMachine", "MACHINE:SH4", + "MachineSH4", "MachineSH4", 0}, + {"TargetMachine", "MACHINE:THUMB", + "MachineTHUMB", "MachineTHUMB", 0}, + {"TargetMachine", "MACHINE:X64", + "MachineX64", "MachineX64", 0}, + {"TargetMachine", "MACHINE:X86", + "MachineX86", "MachineX86", 0}, + + {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:MTA", + "MTA threading attribute", "MTAThreadingAttribute", 0}, + {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:STA", + "STA threading attribute", "STAThreadingAttribute", 0}, + {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:NONE", + "Default threading attribute", "DefaultThreadingAttribute", 0}, + + {"CLRImageType", "CLRIMAGETYPE:IJW", + "Force IJW image", "ForceIJWImage", 0}, + {"CLRImageType", "CLRIMAGETYPE:PURE", + "Force Pure IL Image", "ForcePureILImage", 0}, + {"CLRImageType", "CLRIMAGETYPE:SAFE", + "Force Safe IL Image", "ForceSafeILImage", 0}, + {"CLRImageType", "", + "Default image type", "Default", 0}, + + {"SignHash", "CLRSIGNHASH:SHA1", + "SHA1", "SHA1", 0}, + {"SignHash", "CLRSIGNHASH:SHA256", + "SHA256", "SHA256", 0}, + {"SignHash", "CLRSIGNHASH:SHA384", + "SHA384", "SHA384", 0}, + {"SignHash", "CLRSIGNHASH:SHA512", + "SHA512", "SHA512", 0}, + + {"LinkErrorReporting", "ERRORREPORT:PROMPT", + "PromptImmediately", "PromptImmediately", 0}, + {"LinkErrorReporting", "ERRORREPORT:QUEUE", + "Queue For Next Login", "QueueForNextLogin", 0}, + {"LinkErrorReporting", "ERRORREPORT:SEND", + "Send Error Report", "SendErrorReport", 0}, + {"LinkErrorReporting", "ERRORREPORT:NONE", + "No Error Report", "NoErrorReport", 0}, + + {"CLRSupportLastError", "CLRSupportLastError", + "Enabled", "Enabled", 0}, + {"CLRSupportLastError", "CLRSupportLastError:NO", + "Disabled", "Disabled", 0}, + {"CLRSupportLastError", "CLRSupportLastError:SYSTEMDLL", + "System Dlls Only", "SystemDlls", 0}, + + + //Bool Properties + {"LinkIncremental", "INCREMENTAL:NO", "", "false", 0}, + {"LinkIncremental", "INCREMENTAL", "", "true", 0}, + {"SuppressStartupBanner", "NOLOGO", "", "true", 0}, + {"LinkStatus", "LTCG:NOSTATUS", "", "false", 0}, + {"LinkStatus", "LTCG:STATUS", "", "true", 0}, + {"PreventDllBinding", "ALLOWBIND:NO", "", "false", 0}, + {"PreventDllBinding", "ALLOWBIND", "", "true", 0}, + {"TreatLinkerWarningAsErrors", "WX:NO", "", "false", 0}, + {"TreatLinkerWarningAsErrors", "WX", "", "true", 0}, + {"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "", "true", 0}, + {"GenerateManifest", "MANIFEST:NO", "", "false", 0}, + {"GenerateManifest", "MANIFEST", "", "true", 0}, + {"AllowIsolation", "ALLOWISOLATION:NO", "", "false", 0}, + {"UACUIAccess", "uiAccess='false'", "", "false", 0}, + {"UACUIAccess", "uiAccess='true'", "", "true", 0}, + {"ManifestEmbed", "manifest:embed", "", "true", 0}, + {"GenerateDebugInformation", "DEBUG", "", "true", 0}, + {"MapExports", "MAPINFO:EXPORTS", "", "true", 0}, + {"AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0}, + {"AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0}, + {"LargeAddressAware", "LARGEADDRESSAWARE:NO", "", "false", 0}, + {"LargeAddressAware", "LARGEADDRESSAWARE", "", "true", 0}, + {"TerminalServerAware", "TSAWARE:NO", "", "false", 0}, + {"TerminalServerAware", "TSAWARE", "", "true", 0}, + {"SwapRunFromCD", "SWAPRUN:CD", "", "true", 0}, + {"SwapRunFromNET", "SWAPRUN:NET", "", "true", 0}, + {"OptimizeReferences", "OPT:NOREF", "", "false", 0}, + {"OptimizeReferences", "OPT:REF", "", "true", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "", "false", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "", "true", 0}, + {"IgnoreEmbeddedIDL", "IGNOREIDL", "", "true", 0}, + {"AppContainer", "APPCONTAINER", "", "true", 0}, + {"WindowsMetadataLinkDelaySign", "WINMDDELAYSIGN:NO", "", "false", 0}, + {"WindowsMetadataLinkDelaySign", "WINMDDELAYSIGN", "", "true", 0}, + {"NoEntryPoint", "NOENTRY", "", "true", 0}, + {"SetChecksum", "RELEASE", "", "true", 0}, + {"RandomizedBaseAddress", "DYNAMICBASE:NO", "", "false", 0}, + {"RandomizedBaseAddress", "DYNAMICBASE", "", "true", 0}, + {"FixedBaseAddress", "FIXED:NO", "", "false", 0}, + {"FixedBaseAddress", "FIXED", "", "true", 0}, + {"DataExecutionPrevention", "NXCOMPAT:NO", "", "false", 0}, + {"DataExecutionPrevention", "NXCOMPAT", "", "true", 0}, + {"TurnOffAssemblyGeneration", "NOASSEMBLY", "", "true", 0}, + {"SupportUnloadOfDelayLoadedDLL", "DELAY:UNLOAD", "", "true", 0}, + {"SupportNobindOfDelayLoadedDLL", "DELAY:NOBIND", "", "true", 0}, + {"Profile", "PROFILE", "", "true", 0}, + {"LinkDelaySign", "DELAYSIGN:NO", "", "false", 0}, + {"LinkDelaySign", "DELAYSIGN", "", "true", 0}, + {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK:NO", "", "false", 0}, + {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK", "", "true", 0}, + {"DetectOneDefinitionRule", "ODR", "", "true", 0}, + {"ImageHasSafeExceptionHandlers", "SAFESEH:NO", "", "false", 0}, + {"ImageHasSafeExceptionHandlers", "SAFESEH", "", "true", 0}, + {"LinkDLL", "DLL", "", "true", 0}, + + //Bool Properties With Argument + {"EnableUAC", "MANIFESTUAC:NO", "", "false", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"EnableUAC", "MANIFESTUAC:NO", "Enable User Account Control (UAC)", "", + cmVS7FlagTable::UserValueRequired}, + {"EnableUAC", "MANIFESTUAC:", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"UACUIAccess", "MANIFESTUAC:", "Enable User Account Control (UAC)", "", + cmVS7FlagTable::UserValueRequired}, + {"GenerateMapFile", "MAP", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"MapFileName", "MAP", "Generate Map File", "", + cmVS7FlagTable::UserValueRequired}, + + //String List Properties + {"AdditionalLibraryDirectories", "LIBPATH:", + "Additional Library Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + // Skip [AdditionalDependencies] - no command line Switch. + {"IgnoreSpecificDefaultLibraries", "NODEFAULTLIB:", + "Ignore Specific Default Libraries", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AddModuleNamesToAssembly", "ASSEMBLYMODULE:", + "Add Module to Assembly", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"EmbedManagedResourceFile", "ASSEMBLYRESOURCE:", + "Embed Managed Resource File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ForceSymbolReferences", "INCLUDE:", + "Force Symbol References", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"DelayLoadDLLs", "DELAYLOAD:", + "Delay Loaded Dlls", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AssemblyLinkResource", "ASSEMBLYLINKRESOURCE:", + "Assembly Link Resource", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AdditionalManifestDependencies", "MANIFESTDEPENDENCY:", + "Additional Manifest Dependencies", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ManifestInput", "manifestinput:", + "Manifest Input", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + + //String Properties + {"OutputFile", "OUT:", + "Output File", + "", cmVS7FlagTable::UserValue}, + {"Version", "VERSION:", + "Version", + "", cmVS7FlagTable::UserValue}, + {"SpecifySectionAttributes", "SECTION:", + "Specify Section Attributes", + "", cmVS7FlagTable::UserValue}, + {"MSDOSStubFileName", "STUB:", + "MS-DOS Stub File Name", + "", cmVS7FlagTable::UserValue}, + // Skip [TrackerLogDirectory] - no command line Switch. + {"ModuleDefinitionFile", "DEF:", + "Module Definition File", + "", cmVS7FlagTable::UserValue}, + {"ManifestFile", "ManifestFile:", + "Manifest File", + "", cmVS7FlagTable::UserValue}, + {"ProgramDatabaseFile", "PDB:", + "Generate Program Database File", + "", cmVS7FlagTable::UserValue}, + {"StripPrivateSymbols", "PDBSTRIPPED:", + "Strip Private Symbols", + "", cmVS7FlagTable::UserValue}, + // Skip [MapFileName] - no command line Switch. + // Skip [MinimumRequiredVersion] - no command line Switch. + {"HeapReserveSize", "HEAP:", + "Heap Reserve Size", + "", cmVS7FlagTable::UserValue}, + // Skip [HeapCommitSize] - no command line Switch. + {"StackReserveSize", "STACK:", + "Stack Reserve Size", + "", cmVS7FlagTable::UserValue}, + // Skip [StackCommitSize] - no command line Switch. + {"FunctionOrder", "ORDER:@", + "Function Order", + "", cmVS7FlagTable::UserValue}, + {"ProfileGuidedDatabase", "PGD:", + "Profile Guided Database", + "", cmVS7FlagTable::UserValue}, + {"MidlCommandFile", "MIDL:@", + "MIDL Commands", + "", cmVS7FlagTable::UserValue}, + {"MergedIDLBaseFileName", "IDLOUT:", + "Merged IDL Base File Name", + "", cmVS7FlagTable::UserValue}, + {"TypeLibraryFile", "TLBOUT:", + "Type Library", + "", cmVS7FlagTable::UserValue}, + {"WindowsMetadataFile", "WINMDFILE:", + "Windows Metadata File", + "", cmVS7FlagTable::UserValue}, + {"WindowsMetadataLinkKeyFile", "WINMDKEYFILE:", + "Windows Metadata Key File", + "", cmVS7FlagTable::UserValue}, + {"WindowsMetadataKeyContainer", "WINMDKEYCONTAINER:", + "Windows Metadata Key Container", + "", cmVS7FlagTable::UserValue}, + {"EntryPointSymbol", "ENTRY:", + "Entry Point", + "", cmVS7FlagTable::UserValue}, + {"BaseAddress", "BASE:", + "Base Address", + "", cmVS7FlagTable::UserValue}, + {"ImportLibrary", "IMPLIB:", + "Import Library", + "", cmVS7FlagTable::UserValue}, + {"MergeSections", "MERGE:", + "Merge Sections", + "", cmVS7FlagTable::UserValue}, + {"LinkKeyFile", "KEYFILE:", + "Key File", + "", cmVS7FlagTable::UserValue}, + {"KeyContainer", "KEYCONTAINER:", + "Key Container", + "", cmVS7FlagTable::UserValue}, + // Skip [AdditionalOptions] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index 0e97a832a..747e9be5e 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -22,7 +22,7 @@ bool cmVariableRequiresCommand return false; } - std::string testVariable = args[0]; + std::string testVariable = args[0]; if(!this->Makefile->IsOn(testVariable.c_str())) { return true; @@ -38,7 +38,7 @@ bool cmVariableRequiresCommand requirementsMet = false; notSet += args[i]; notSet += "\n"; - cmCacheManager::CacheIterator it = + cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()->GetCacheIterator(args[i].c_str()); if(!it.IsAtEnd() && it.GetPropertyAsBool("ADVANCED")) { @@ -47,7 +47,7 @@ bool cmVariableRequiresCommand } } const char* reqVar = this->Makefile->GetDefinition(resultVariable.c_str()); - // if reqVar is unset, then set it to requirementsMet + // if reqVar is unset, then set it to requirementsMet // if reqVar is set to true, but requirementsMet is false , then // set reqVar to false. if(!reqVar || (!requirementsMet && this->Makefile->IsOn(reqVar))) @@ -58,14 +58,14 @@ bool cmVariableRequiresCommand if(!requirementsMet) { std::string message = "Variable assertion failed:\n"; - message += testVariable + + message += testVariable + " Requires that the following unset variables are set:\n"; message += notSet; message += "\nPlease set them, or set "; message += testVariable + " to false, and re-configure.\n"; if(hasAdvanced) { - message += + message += "One or more of the required variables is advanced." " To set the variable, you must turn on advanced mode in cmake."; } diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h index 91c351e60..c86f43dc6 100644 --- a/Source/cmVariableRequiresCommand.h +++ b/Source/cmVariableRequiresCommand.h @@ -24,7 +24,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmVariableRequiresCommand; } @@ -35,7 +35,7 @@ public: */ virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - + /** * The name of the command as specified in CMakeList.txt. */ @@ -48,7 +48,7 @@ public: { return "Deprecated. Use the if() command instead."; } - + /** * More documentation. */ @@ -63,12 +63,12 @@ public: "tested, if that variable is false nothing else is done. If " "TEST_VARIABLE is true, then " "the next argument (RESULT_VARIABLE) is a variable that is set to true " - "if all the required variables are set. " + "if all the required variables are set. " "The rest of the arguments are variables that must be true or not " "set to NOTFOUND to avoid an error. If any are not true, an error " "is reported."; } - + /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const { diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx index 47bab1530..f5fdca465 100644 --- a/Source/cmVariableWatch.cxx +++ b/Source/cmVariableWatch.cxx @@ -38,7 +38,7 @@ cmVariableWatch::~cmVariableWatch() { } -void cmVariableWatch::AddWatch(const std::string& variable, +void cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method, void* client_data /*=0*/) { cmVariableWatch::Pair p; @@ -58,7 +58,7 @@ void cmVariableWatch::AddWatch(const std::string& variable, vp->push_back(p); } -void cmVariableWatch::RemoveWatch(const std::string& variable, +void cmVariableWatch::RemoveWatch(const std::string& variable, WatchMethod method) { cmVariableWatch::VectorOfPairs* vp = &this->WatchMap[variable]; @@ -73,12 +73,12 @@ void cmVariableWatch::RemoveWatch(const std::string& variable, } } -void cmVariableWatch::VariableAccessed(const std::string& variable, +void cmVariableWatch::VariableAccessed(const std::string& variable, int access_type, const char* newValue, const cmMakefile* mf) const { - cmVariableWatch::StringToVectorOfPairs::const_iterator mit = + cmVariableWatch::StringToVectorOfPairs::const_iterator mit = this->WatchMap.find(variable); if ( mit != this->WatchMap.end() ) { diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h index 83e9e9799..7dd4ac5e6 100644 --- a/Source/cmVariableWatch.h +++ b/Source/cmVariableWatch.h @@ -36,7 +36,7 @@ public: void AddWatch(const std::string& variable, WatchMethod method, void* client_data=0); void RemoveWatch(const std::string& variable, WatchMethod method); - + /** * This method is called when variable is accessed */ @@ -61,7 +61,7 @@ public: * Return the access as string */ static const char* GetAccessAsString(int access_type); - + protected: struct Pair { diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 93c05afb7..a432943ae 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -95,7 +95,7 @@ void cmVariableWatchCommand::VariableAccessed(const std::string& variable, cmListFileArgument(currentListFile, true, "unknown", 9999)); newLFF.Arguments.push_back( cmListFileArgument(stack, true, "unknown", 9999)); - newLFF.Name = command; + newLFF.Name = command; newLFF.FilePath = "Some weird path"; newLFF.Line = 9999; cmExecutionStatus status; diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h index cb80736e6..3abc08894 100644 --- a/Source/cmVariableWatchCommand.h +++ b/Source/cmVariableWatchCommand.h @@ -31,7 +31,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmVariableWatchCommand; } @@ -67,7 +67,7 @@ public: { return "Watch the CMake variable for change."; } - + /** * More documentation. */ @@ -80,7 +80,7 @@ public: "will be executed. The command will receive the following arguments:" " COMMAND( )"; } - + cmTypeMacro(cmVariableWatchCommand, cmCommand); void VariableAccessed(const std::string& variable, int access_type, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9a97ab0e3..f4984c7ed 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -22,9 +22,36 @@ #include "cmVS10CLFlagTable.h" #include "cmVS10LinkFlagTable.h" #include "cmVS10LibFlagTable.h" +#include "cmVS11CLFlagTable.h" +#include "cmVS11LinkFlagTable.h" +#include "cmVS11LibFlagTable.h" #include +static cmVS7FlagTable const* +cmVSGetCLFlagTable(cmLocalVisualStudioGenerator* lg) +{ + if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS11) + { return cmVS11CLFlagTable; } + return cmVS10CLFlagTable; +} + +static cmVS7FlagTable const* +cmVSGetLibFlagTable(cmLocalVisualStudioGenerator* lg) +{ + if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS11) + { return cmVS11LibFlagTable; } + return cmVS10LibFlagTable; +} + +static cmVS7FlagTable const* +cmVSGetLinkFlagTable(cmLocalVisualStudioGenerator* lg) +{ + if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS11) + { return cmVS11LinkFlagTable; } + return cmVS10LinkFlagTable; +} + static std::string cmVS10EscapeXML(std::string arg) { cmSystemTools::ReplaceString(arg, "&", "&"); @@ -65,7 +92,7 @@ cmVisualStudio10TargetGenerator(cmTarget* target, this->Target = target; this->GeneratorTarget = gg->GetGeneratorTarget(target); this->Makefile = target->GetMakefile(); - this->LocalGenerator = + this->LocalGenerator = (cmLocalVisualStudio7Generator*) this->Makefile->GetLocalGenerator(); this->Name = this->Target->GetName(); @@ -82,6 +109,11 @@ cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator() { delete i->second; } + for(OptionsMap::iterator i = this->LinkOptions.begin(); + i != this->LinkOptions.end(); ++i) + { + delete i->second; + } if(!this->BuildFileStream) { return; @@ -108,9 +140,9 @@ void cmVisualStudio10TargetGenerator::WritePlatformConfigTag( stream = this->BuildFileStream; } stream->fill(' '); - stream->width(indentLevel*2 ); + stream->width(indentLevel*2 ); (*stream ) << ""; - (*stream ) << "<" << tag + (*stream ) << "<" << tag << " Condition=\"'$(Configuration)|$(Platform)'=='"; (*stream ) << config << "|" << this->Platform << "'\""; if(attribute) @@ -154,6 +186,10 @@ void cmVisualStudio10TargetGenerator::Generate() { return; } + if(!this->ComputeLinkOptions()) + { + return; + } } cmMakefile* mf = this->Target->GetMakefile(); std::string path = mf->GetStartOutputDirectory(); @@ -164,7 +200,7 @@ void cmVisualStudio10TargetGenerator::Generate() new cmGeneratedFileStream(path.c_str()); this->PathToVcxproj = path; this->BuildFileStream->SetCopyIfDifferent(true); - + // Write the encoding header into the file char magic[] = {0xEF,0xBB, 0xBF}; this->BuildFileStream->write(magic, 3); @@ -368,11 +404,14 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() case cmTarget::UTILITY: configType += "Utility"; break; + case cmTarget::GLOBAL_TARGET: + case cmTarget::UNKNOWN_LIBRARY: + break; } configType += "\n"; - this->WriteString(configType.c_str(), 2); + this->WriteString(configType.c_str(), 2); - const char* mfcFlag = + const char* mfcFlag = this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG"); std::string mfcFlagValue = mfcFlag ? mfcFlag : "0"; @@ -389,8 +428,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() mfcLine += useOfMfcValue + "\n"; this->WriteString(mfcLine.c_str(), 2); - if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY && - this->ClOptions[*i]->UsingUnicode() || + if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY && + this->ClOptions[*i]->UsingUnicode()) || this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { this->WriteString("Unicode\n", 2); @@ -413,7 +452,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() } if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { - this->WriteString("true\n", 2); + this->WriteString("true" + "\n", 2); } this->WriteString("\n", 1); } @@ -453,9 +493,9 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommand(cmSourceFile* sf) } } -void +void cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, - cmCustomCommand const & + cmCustomCommand const & command) { std::string sourcePath = source->GetFullPath(); @@ -490,7 +530,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, comment = cmVS10EscapeComment(comment); std::vector *configs = static_cast - (this->GlobalGenerator)->GetConfigurations(); + (this->GlobalGenerator)->GetConfigurations(); this->WriteSource("CustomBuild", source, ">\n"); @@ -504,11 +544,11 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, this->WritePlatformConfigTag("Command", i->c_str(), 3); (*this->BuildFileStream ) << script << "\n"; this->WritePlatformConfigTag("AdditionalInputs", i->c_str(), 3); - + (*this->BuildFileStream ) << source->GetFullPath(); - for(std::vector::const_iterator d = + for(std::vector::const_iterator d = command.GetDepends().begin(); - d != command.GetDepends().end(); + d != command.GetDepends().end(); ++d) { std::string dep; @@ -521,9 +561,9 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, (*this->BuildFileStream ) << ";%(AdditionalInputs)\n"; this->WritePlatformConfigTag("Outputs", i->c_str(), 3); const char* sep = ""; - for(std::vector::const_iterator o = + for(std::vector::const_iterator o = command.GetOutputs().begin(); - o != command.GetOutputs().end(); + o != command.GetOutputs().end(); ++o) { std::string out = *o; @@ -532,6 +572,12 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, sep = ";"; } (*this->BuildFileStream ) << "\n"; + if(this->LocalGenerator->GetVersion() > cmLocalVisualStudioGenerator::VS10) + { + // VS >= 11 let us turn off linking of custom command outputs. + this->WritePlatformConfigTag("LinkObjects", i->c_str(), 3); + (*this->BuildFileStream ) << "false\n"; + } } this->WriteString("\n", 2); } @@ -559,19 +605,19 @@ void cmVisualStudio10TargetGenerator::ConvertToWindowsSlash(std::string& s) } } void cmVisualStudio10TargetGenerator::WriteGroups() -{ +{ // collect up group information - std::vector sourceGroups = + std::vector sourceGroups = this->Makefile->GetSourceGroups(); std::vector classes = this->Target->GetSourceFiles(); - + std::set groupsUsed; - for(std::vector::const_iterator s = classes.begin(); + for(std::vector::const_iterator s = classes.begin(); s != classes.end(); s++) { - cmSourceFile* sf = *s; + cmSourceFile* sf = *s; std::string const& source = sf->GetFullPath(); - cmSourceGroup& sourceGroup = + cmSourceGroup& sourceGroup = this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); groupsUsed.insert(&sourceGroup); } @@ -634,9 +680,9 @@ void cmVisualStudio10TargetGenerator::WriteGroups() guidName += name; this->GlobalGenerator->CreateGUID(guidName.c_str()); this->WriteString("", 3); - std::string guid + std::string guid = this->GlobalGenerator->GetGUID(guidName.c_str()); - (*this->BuildFileStream) + (*this->BuildFileStream) << "{" << guid << "}" << "\n"; @@ -724,10 +770,10 @@ WriteGroupSources(const char* name, { cmSourceFile* sf = s->SourceFile; std::string const& source = sf->GetFullPath(); - cmSourceGroup& sourceGroup = + cmSourceGroup& sourceGroup = this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); const char* filter = sourceGroup.GetFullName(); - this->WriteString("<", 2); + this->WriteString("<", 2); std::string path = this->ConvertPath(source, s->RelativePath); this->ConvertToWindowsSlash(path); (*this->BuildFileStream) << name << " Include=\"" @@ -839,14 +885,23 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() } } - for(std::vector::const_iterator - si = this->GeneratorTarget->ExternalObjects.begin(); - si != this->GeneratorTarget->ExternalObjects.end(); ++si) + if(this->LocalGenerator->GetVersion() > cmLocalVisualStudioGenerator::VS10) + { + // For VS >= 11 we use LinkObjects to avoid linking custom command + // outputs. Use Object for all external objects, generated or not. + this->WriteSources("Object", this->GeneratorTarget->ExternalObjects); + } + else { // If an object file is generated in this target, then vs10 will use // it in the build, and we have to list it as None instead of Object. - std::vector const* d = this->Target->GetSourceDepends(*si); - this->WriteSource((d && !d->empty())? "None":"Object", *si); + for(std::vector::const_iterator + si = this->GeneratorTarget->ExternalObjects.begin(); + si != this->GeneratorTarget->ExternalObjects.end(); ++si) + { + std::vector const* d=this->Target->GetSourceDepends(*si); + this->WriteSource((d && !d->empty())? "None":"Object", *si); + } } this->WriteSources("None", this->GeneratorTarget->ExtraSources); @@ -868,9 +923,8 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( cmSourceFile* source) -{ +{ cmSourceFile& sf = *source; - cmLocalVisualStudio7Generator* lg = this->LocalGenerator; std::string objectName; if(this->GeneratorTarget->ExplicitObjectName.find(&sf) @@ -883,7 +937,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( if(const char* cflags = sf.GetProperty("COMPILE_FLAGS")) { flags += cflags; - } + } if(const char* cdefs = sf.GetProperty("COMPILE_DEFINITIONS")) { defines += cdefs; @@ -899,7 +953,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( { needForceLang = true; lang = sourceLang; - } + } // if the source file does not match the linker language // then force c or c++ if(needForceLang || (linkLanguage && lang @@ -923,7 +977,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( if(objectName.size()) { (*this->BuildFileStream ) << firstString; - firstString = ""; + firstString = ""; hasFlags = true; this->WriteString("", 3); (*this->BuildFileStream ) @@ -934,7 +988,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( (this->GlobalGenerator)->GetConfigurations(); for( std::vector::iterator config = configs->begin(); config != configs->end(); ++config) - { + { std::string configUpper = cmSystemTools::UpperCase(*config); std::string configDefines = defines; std::string defPropName = "COMPILE_DEFINITIONS_"; @@ -947,22 +1001,22 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( } configDefines += ccdefs; } - // if we have flags or defines for this config then + // if we have flags or defines for this config then // use them if(flags.size() || configDefines.size()) { (*this->BuildFileStream ) << firstString; firstString = ""; // only do firstString once hasFlags = true; - cmVisualStudioGeneratorOptions + cmVisualStudioGeneratorOptions clOptions(this->LocalGenerator, cmVisualStudioGeneratorOptions::Compiler, - cmVS10CLFlagTable, 0, this); + cmVSGetCLFlagTable(this->LocalGenerator), 0, this); clOptions.Parse(flags.c_str()); clOptions.AddDefines(configDefines.c_str()); clOptions.SetConfiguration((*config).c_str()); clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); - clOptions.OutputFlagMap(*this->BuildFileStream, " "); + clOptions.OutputFlagMap(*this->BuildFileStream, " "); clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", "\n", lang); } @@ -1045,11 +1099,10 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() -void +void cmVisualStudio10TargetGenerator:: OutputLinkIncremental(std::string const& configName) -{ - std::string CONFIG = cmSystemTools::UpperCase(configName); +{ // static libraries and things greater than modules do not need // to set this option if(this->Target->GetType() == cmTarget::STATIC_LIBRARY @@ -1057,72 +1110,36 @@ OutputLinkIncremental(std::string const& configName) { return; } - const char* linkType = "SHARED"; - if(this->Target->GetType() == cmTarget::EXECUTABLE) - { - linkType = "EXE"; - } - - // assume incremental linking - const char* incremental = "true"; - const char* linkLanguage = - this->Target->GetLinkerLanguage(configName.c_str()); - if(!linkLanguage) - { - cmSystemTools::Error - ("CMake can not determine linker language for target:", - this->Name.c_str()); - return; - } - std::string linkFlagVarBase = "CMAKE_"; - linkFlagVarBase += linkType; - linkFlagVarBase += "_LINKER_FLAGS"; - std::string flags = this-> - Target->GetMakefile()->GetRequiredDefinition(linkFlagVarBase.c_str()); - std::string linkFlagVar = linkFlagVarBase + "_" + CONFIG; - flags += this-> - Target->GetMakefile()->GetRequiredDefinition(linkFlagVar.c_str()); - if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0 - || strcmp(linkLanguage, "Fortran") == 0) - { - std::string baseFlagVar = "CMAKE_"; - baseFlagVar += linkLanguage; - baseFlagVar += "_FLAGS"; - flags += this-> - Target->GetMakefile()->GetRequiredDefinition(baseFlagVar.c_str()); - std::string flagVar = baseFlagVar + std::string("_") + CONFIG; - flags += - Target->GetMakefile()->GetRequiredDefinition(flagVar.c_str()); - } - const char* targetLinkFlags = this->Target->GetProperty("LINK_FLAGS"); - if(targetLinkFlags) - { - flags += " "; - flags += targetLinkFlags; - } - std::string flagsProp = "LINK_FLAGS_"; - flagsProp += CONFIG; - if(const char* flagsConfig = this->Target->GetProperty(flagsProp.c_str())) - { - flags += " "; - flags += flagsConfig; - } - if(flags.find("INCREMENTAL:NO") != flags.npos) - { - incremental = "false"; - } + Options& linkOptions = *(this->LinkOptions[configName]); + + const char* incremental = linkOptions.GetFlag("LinkIncremental"); this->WritePlatformConfigTag("LinkIncremental", configName.c_str(), 3); - *this->BuildFileStream << incremental - << "\n"; + *this->BuildFileStream << (incremental?incremental:"true") + << "\n"; + linkOptions.RemoveFlag("LinkIncremental"); - const char* manifest = "true"; - if(flags.find("MANIFEST:NO") != flags.npos) - { - manifest = "false"; - } + const char* manifest = linkOptions.GetFlag("GenerateManifest"); this->WritePlatformConfigTag("GenerateManifest", configName.c_str(), 3); - *this->BuildFileStream << manifest + *this->BuildFileStream << (manifest?manifest:"true") << "\n"; + linkOptions.RemoveFlag("GenerateManifest"); + + // Some link options belong here. Use them now and remove them so that + // WriteLinkOptions does not use them. + const char* flags[] = { + "LinkDelaySign", + "LinkKeyFile", + 0}; + for(const char** f = flags; *f; ++f) + { + const char* flag = *f; + if(const char* value = linkOptions.GetFlag(flag)) + { + this->WritePlatformConfigTag(flag, configName.c_str(), 3); + *this->BuildFileStream << value << "\n"; + linkOptions.RemoveFlag(flag); + } + } } //---------------------------------------------------------------------------- @@ -1151,11 +1168,11 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( cmsys::auto_ptr pOptions( new Options(this->LocalGenerator, Options::Compiler, - cmVS10CLFlagTable)); + cmVSGetCLFlagTable(this->LocalGenerator))); Options& clOptions = *pOptions; std::string flags; - // collect up flags for + // collect up flags for if(this->Target->GetType() < cmTarget::UTILITY) { const char* linkLanguage = @@ -1197,20 +1214,16 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( flags += " "; flags += targetFlags; } - std::string configUpper = cmSystemTools::UpperCase(configName); - std::string defPropName = "COMPILE_DEFINITIONS_"; - defPropName += configUpper; - // Get preprocessor definitions for this directory. std::string defineFlags = this->Target->GetMakefile()->GetDefineFlags(); clOptions.FixExceptionHandlingDefault(); + clOptions.AddFlag("PrecompiledHeader", "NotUsing"); clOptions.Parse(flags.c_str()); clOptions.Parse(defineFlags.c_str()); - clOptions.AddDefines - (this->Makefile->GetProperty("COMPILE_DEFINITIONS")); - clOptions.AddDefines(this->Target->GetProperty("COMPILE_DEFINITIONS")); - clOptions.AddDefines(this->Makefile->GetProperty(defPropName.c_str())); - clOptions.AddDefines(this->Target->GetProperty(defPropName.c_str())); + clOptions.AddDefines( + this->Target->GetCompileDefinitions().c_str()); + clOptions.AddDefines(this->Target->GetCompileDefinitions( + configName.c_str()).c_str()); clOptions.SetVerboseMakefile( this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); @@ -1247,17 +1260,16 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( "\n", 3); } - clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", + clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", "\n", "CXX"); this->WriteString("", 3); - *this->BuildFileStream << configName + *this->BuildFileStream << configName << "\n"; this->WriteString("$(IntDir)\n", 3); if(this->Target->GetType() != cmTarget::OBJECT_LIBRARY) { - // TODO: PDB for object library? this->WriteString("", 3); - *this->BuildFileStream << this->Target->GetDirectory(configName.c_str()) + *this->BuildFileStream << this->Target->GetPDBDirectory(configName.c_str()) << "/" << this->Target->GetPDBName(configName.c_str()) << "\n"; @@ -1277,7 +1289,7 @@ OutputIncludes(std::vector const & includes) this->WriteString("%(AdditionalIncludeDirectories)" "\n", 0); } - + void cmVisualStudio10TargetGenerator:: @@ -1311,27 +1323,45 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config) cmVisualStudioGeneratorOptions libOptions(this->LocalGenerator, cmVisualStudioGeneratorOptions::Linker, - cmVS10LibFlagTable, 0, this); + cmVSGetLibFlagTable(this->LocalGenerator), 0, this); libOptions.Parse(libflags?libflags:""); libOptions.Parse(libflagsConfig?libflagsConfig:""); libOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); - libOptions.OutputFlagMap(*this->BuildFileStream, " "); + libOptions.OutputFlagMap(*this->BuildFileStream, " "); this->WriteString("\n", 2); } } - -void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& - config) +//---------------------------------------------------------------------------- +bool cmVisualStudio10TargetGenerator::ComputeLinkOptions() { - - // static libraries and things greater than modules do not need - // to set this option - if(this->Target->GetType() == cmTarget::STATIC_LIBRARY - || this->Target->GetType() > cmTarget::MODULE_LIBRARY) - { - return; + if(this->Target->GetType() == cmTarget::EXECUTABLE || + this->Target->GetType() == cmTarget::SHARED_LIBRARY || + this->Target->GetType() == cmTarget::MODULE_LIBRARY) + { + std::vector const* configs = + this->GlobalGenerator->GetConfigurations(); + for(std::vector::const_iterator i = configs->begin(); + i != configs->end(); ++i) + { + if(!this->ComputeLinkOptions(*i)) + { + return false; + } + } } + return true; +} + +//---------------------------------------------------------------------------- +bool +cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) +{ + cmsys::auto_ptr pOptions( + new Options(this->LocalGenerator, Options::Linker, + cmVSGetLinkFlagTable(this->LocalGenerator), 0, this)); + Options& linkOptions = *pOptions; + const char* linkLanguage = this->Target->GetLinkerLanguage(config.c_str()); if(!linkLanguage) @@ -1339,12 +1369,11 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& cmSystemTools::Error ("CMake can not determine linker language for target:", this->Name.c_str()); - return; + return false; } - this->WriteString("\n", 2); std::string CONFIG = cmSystemTools::UpperCase(config); - + const char* linkType = "SHARED"; if(this->Target->GetType() == cmTarget::MODULE_LIBRARY) { @@ -1361,10 +1390,9 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& std::string flags; if(stackVal) { - flags += " "; + flags += " /STACK:"; flags += stackVal; } - // assume incremental linking std::string linkFlagVarBase = "CMAKE_"; linkFlagVarBase += linkType; linkFlagVarBase += "_LINKER_FLAGS"; @@ -1388,10 +1416,6 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& flags += " "; flags += flagsConfig; } - cmVisualStudioGeneratorOptions - linkOptions(this->LocalGenerator, - cmVisualStudioGeneratorOptions::Linker, - cmVS10LinkFlagTable, 0, this); if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") ) { flags += " /SUBSYSTEM:WINDOWS"; @@ -1400,12 +1424,10 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& { flags += " /SUBSYSTEM:CONSOLE"; } - cmSystemTools::ReplaceString(flags, "/INCREMENTAL:YES", ""); - cmSystemTools::ReplaceString(flags, "/INCREMENTAL:NO", ""); std::string standardLibsVar = "CMAKE_"; standardLibsVar += linkLanguage; standardLibsVar += "_STANDARD_LIBRARIES"; - std::string + std::string libs = this->Makefile->GetSafeDefinition(standardLibsVar.c_str()); // Remove trailing spaces from libs std::string::size_type pos = libs.size()-1; @@ -1429,7 +1451,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& cmSystemTools::Error ("CMake can not compute cmComputeLinkInformation for target:", this->Name.c_str()); - return; + return false; } // add the libraries for the target to libs string cmComputeLinkInformation& cli = *pcli; @@ -1463,7 +1485,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& else { linkOptions.AddFlag("GenerateDebugInformation", "false"); - } + } std::string targetName; std::string targetNameSO; std::string targetNameFull; @@ -1472,19 +1494,18 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& if(this->Target->GetType() == cmTarget::EXECUTABLE) { this->Target->GetExecutableNames(targetName, targetNameFull, - targetNameImport, targetNamePDB, + targetNameImport, targetNamePDB, config.c_str()); } else { this->Target->GetLibraryNames(targetName, targetNameSO, targetNameFull, - targetNameImport, targetNamePDB, + targetNameImport, targetNamePDB, config.c_str()); } - std::string dir = this->Target->GetDirectory(config.c_str()); - dir += "/"; - std::string pdb = dir; + std::string pdb = this->Target->GetPDBDirectory(config.c_str()); + pdb += "/"; pdb += targetNamePDB; std::string imLib = this->Target->GetDirectory(config.c_str(), true); imLib += "/"; @@ -1499,10 +1520,25 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& this->GeneratorTarget->ModuleDefinitionFile.c_str()); } - linkOptions.RemoveFlag("GenerateManifest"); + this->LinkOptions[config] = pOptions.release(); + return true; +} + +//---------------------------------------------------------------------------- +void +cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& config) +{ + if(this->Target->GetType() == cmTarget::STATIC_LIBRARY + || this->Target->GetType() > cmTarget::MODULE_LIBRARY) + { + return; + } + Options& linkOptions = *(this->LinkOptions[config]); + this->WriteString("\n", 2); + linkOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); linkOptions.OutputFlagMap(*this->BuildFileStream, " "); - + this->WriteString("\n", 2); if(!this->GlobalGenerator->NeedLinkLibraryDependencies(*this->Target)) { @@ -1516,7 +1552,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& void cmVisualStudio10TargetGenerator::AddLibraries( cmComputeLinkInformation& cli, std::string& libstring) -{ +{ typedef cmComputeLinkInformation::ItemVector ItemVector; ItemVector libs = cli.GetItems(); const char* sep = ";"; @@ -1564,11 +1600,13 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() std::vector *configs = static_cast (this->GlobalGenerator)->GetConfigurations(); - std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target); for(std::vector::iterator i = configs->begin(); i != configs->end(); ++i) { + std::vector includes; + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, + "C", i->c_str()); this->WritePlatformConfigTag("ItemDefinitionGroup", i->c_str(), 1); *this->BuildFileStream << "\n"; // output cl compile flags @@ -1582,15 +1620,15 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() this->WriteMidlOptions(*i, includes); // write events this->WriteEvents(*i); - // output link flags + // output link flags this->WriteLinkOptions(*i); - // output lib flags + // output lib flags this->WriteLibOptions(*i); this->WriteString("\n", 1); } } -void +void cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName) { this->WriteEvent("PreLinkEvent", @@ -1618,7 +1656,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent( std::string comment; for(std::vector::iterator i = commands.begin(); i != commands.end(); ++i) - { + { cmCustomCommand& command = *i; comment += pre; comment += lg->ConstructComment(command); @@ -1675,7 +1713,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() } (*this->BuildFileStream) << path << "\">\n"; this->WriteString("", 3); - (*this->BuildFileStream) + (*this->BuildFileStream) << this->GlobalGenerator->GetGUID(name.c_str()) << "\n"; this->WriteString("\n", 2); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 2d5ec2a6b..55a850a1b 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -28,20 +28,20 @@ class cmVisualStudioGeneratorOptions; class cmVisualStudio10TargetGenerator { public: - cmVisualStudio10TargetGenerator(cmTarget* target, + cmVisualStudio10TargetGenerator(cmTarget* target, cmGlobalVisualStudio10Generator* gg); ~cmVisualStudio10TargetGenerator(); void Generate(); - // used by cmVisualStudioGeneratorOptions - void WritePlatformConfigTag( + // used by cmVisualStudioGeneratorOptions + void WritePlatformConfigTag( const char* tag, - const char* config, + const char* config, int indentLevel, const char* attribute = 0, const char* end = 0, std::ostream* strm = 0 ); - + private: struct ToolSource { @@ -68,6 +68,8 @@ private: std::vector const & includes); void WriteRCOptions(std::string const& config, std::vector const & includes); + bool ComputeLinkOptions(); + bool ComputeLinkOptions(std::string const& config); void WriteLinkOptions(std::string const& config); void WriteMidlOptions(std::string const& config, std::vector const & includes); @@ -95,6 +97,7 @@ private: typedef cmVisualStudioGeneratorOptions Options; typedef std::map OptionsMap; OptionsMap ClOptions; + OptionsMap LinkOptions; std::string PathToVcxproj; cmTarget* Target; cmGeneratorTarget* GeneratorTarget; diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 9369af60c..1df0d9ed1 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -342,10 +342,10 @@ cmVisualStudioGeneratorOptions if(!this->FlagString.empty()) { if(this->Version >= cmLocalVisualStudioGenerator::VS10) - { + { fout << prefix; if(this->Configuration.size()) - { + { this->TargetGenerator->WritePlatformConfigTag( "AdditionalOptions", this->Configuration.c_str(), diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx new file mode 100644 index 000000000..b302246ea --- /dev/null +++ b/Source/cmVisualStudioWCEPlatformParser.cxx @@ -0,0 +1,175 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmVisualStudioWCEPlatformParser.h" +#include "cmGlobalVisualStudioGenerator.h" +#include "cmXMLParser.h" + +int cmVisualStudioWCEPlatformParser::ParseVersion(const char* version) +{ + const std::string registryBase = + cmGlobalVisualStudioGenerator::GetRegistryBase(version); + const std::string vckey = registryBase + "\\Setup\\VC;ProductDir"; + const std::string vskey = registryBase + "\\Setup\\VS;ProductDir"; + + if(!cmSystemTools::ReadRegistryValue(vckey.c_str(), this->VcInstallDir) || + !cmSystemTools::ReadRegistryValue(vskey.c_str(), this->VsInstallDir)) + { + return 0; + } + cmSystemTools::ConvertToUnixSlashes(this->VcInstallDir); + cmSystemTools::ConvertToUnixSlashes(this->VsInstallDir); + this->VcInstallDir.append("/"); + this->VsInstallDir.append("/"); + + const std::string configFilename = + this->VcInstallDir + "vcpackages/WCE.VCPlatform.config"; + + return this->ParseFile(configFilename.c_str()); +} + +std::string cmVisualStudioWCEPlatformParser::GetOSVersion() const +{ + if (this->OSMinorVersion.empty()) + { + return OSMajorVersion; + } + + return OSMajorVersion + "." + OSMinorVersion; +} + +const char* cmVisualStudioWCEPlatformParser::GetArchitectureFamily() const +{ + std::map::const_iterator it = + this->Macros.find("ARCHFAM"); + if (it != this->Macros.end()) + { + return it->second.c_str(); + } + + return 0; +} + +void cmVisualStudioWCEPlatformParser::StartElement(const char* name, + const char** attributes) +{ + if(this->FoundRequiredName) + { + return; + } + + this->CharacterData = ""; + + if(strcmp(name, "PlatformData") == 0) + { + this->PlatformName = ""; + this->OSMajorVersion = ""; + this->OSMinorVersion = ""; + this->Macros.clear(); + } + + if(strcmp(name, "Macro") == 0) + { + std::string macroName; + std::string macroValue; + + for(const char** attr = attributes; *attr; attr += 2) + { + if(strcmp(attr[0], "Name") == 0) + { + macroName = attr[1]; + } + else if(strcmp(attr[0], "Value") == 0) + { + macroValue = attr[1]; + } + } + + if(!macroName.empty()) + { + this->Macros[macroName] = macroValue; + } + } + else if(strcmp(name, "Directories") == 0) + { + for(const char** attr = attributes; *attr; attr += 2) + { + if(strcmp(attr[0], "Include") == 0) + { + this->Include = attr[1]; + } + else if(strcmp(attr[0], "Library") == 0) + { + this->Library = attr[1]; + } + else if(strcmp(attr[0], "Path") == 0) + { + this->Path = attr[1]; + } + } + } +} + +void cmVisualStudioWCEPlatformParser::EndElement(const char* name) +{ + if(!this->RequiredName) + { + if(strcmp(name, "PlatformName") == 0) + { + this->AvailablePlatforms.push_back(this->CharacterData); + } + return; + } + + if(this->FoundRequiredName) + { + return; + } + + if(strcmp(name, "PlatformName") == 0) + { + this->PlatformName = this->CharacterData; + } + else if(strcmp(name, "OSMajorVersion") == 0) + { + this->OSMajorVersion = this->CharacterData; + } + else if(strcmp(name, "OSMinorVersion") == 0) + { + this->OSMinorVersion = this->CharacterData; + } + else if(strcmp(name, "Platform") == 0) + { + if(this->PlatformName == this->RequiredName) + { + this->FoundRequiredName = true; + } + } +} + +void cmVisualStudioWCEPlatformParser::CharacterDataHandler(const char* data, + int length) +{ + this->CharacterData.append(data, length); +} + +std::string cmVisualStudioWCEPlatformParser::FixPaths( + const std::string& paths) const +{ + std::string ret = paths; + cmSystemTools::ReplaceString(ret, "$(PATH)", "%PATH%"); + cmSystemTools::ReplaceString(ret, "$(VCInstallDir)", VcInstallDir.c_str()); + cmSystemTools::ReplaceString(ret, "$(VSInstallDir)", VsInstallDir.c_str()); + cmSystemTools::ReplaceString(ret, "\\", "/"); + cmSystemTools::ReplaceString(ret, "//", "/"); + cmSystemTools::ReplaceString(ret, "/", "\\"); + return ret; +} diff --git a/Source/cmVisualStudioWCEPlatformParser.h b/Source/cmVisualStudioWCEPlatformParser.h new file mode 100644 index 000000000..466e1dd43 --- /dev/null +++ b/Source/cmVisualStudioWCEPlatformParser.h @@ -0,0 +1,68 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmVisualStudioWCEPlatformParser_h +#define cmVisualStudioWCEPlatformParser_h +#include "cmStandardIncludes.h" + +#include "cmXMLParser.h" + +// This class is used to parse XML with configuration +// of installed SDKs in system +class cmVisualStudioWCEPlatformParser : public cmXMLParser +{ +public: + cmVisualStudioWCEPlatformParser(const char* name = NULL) + : RequiredName(name) + , FoundRequiredName(false) + { + } + + int ParseVersion(const char* version); + + bool Found() const {return this->FoundRequiredName;} + const char* GetArchitectureFamily() const; + std::string GetOSVersion() const; + std::string GetIncludeDirectories() const { + return this->FixPaths(this->Include); } + std::string GetLibraryDirectories() const { + return this->FixPaths(this->Library); } + std::string GetPathDirectories() const { + return this->FixPaths(this->Path); } + const std::vector& GetAvailablePlatforms() const { + return this->AvailablePlatforms; } + +protected: + virtual void StartElement(const char* name, const char** attributes); + void EndElement(const char* name); + void CharacterDataHandler(const char* data, int length); + +private: + std::string FixPaths(const std::string& paths) const; + + std::string CharacterData; + + std::string Include; + std::string Library; + std::string Path; + std::string PlatformName; + std::string OSMajorVersion; + std::string OSMinorVersion; + std::map Macros; + std::vector AvailablePlatforms; + + const char* RequiredName; + bool FoundRequiredName; + std::string VcInstallDir; + std::string VsInstallDir; +}; + +#endif diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h index e111ae40d..1bdf27af3 100644 --- a/Source/cmWhileCommand.h +++ b/Source/cmWhileCommand.h @@ -25,7 +25,7 @@ public: cmMakefile &mf, cmExecutionStatus &); virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); - + std::vector Args; std::vector Functions; private: @@ -39,7 +39,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmWhileCommand; } @@ -50,7 +50,7 @@ public: */ virtual bool InvokeInitialPass(const std::vector& args, cmExecutionStatus &); - + /** * This is called when the command is first encountered in * the CMakeLists.txt file. @@ -75,7 +75,7 @@ public: { return "Evaluate a group of commands while a condition is true"; } - + /** * More documentation. */ @@ -93,7 +93,7 @@ public: "is true. The condition is evaluated using the same logic as the " "if command."; } - + cmTypeMacro(cmWhileCommand, cmCommand); }; diff --git a/Source/cmWin32ProcessExecution.cxx b/Source/cmWin32ProcessExecution.cxx index f37e0ff4e..5752ab61c 100644 --- a/Source/cmWin32ProcessExecution.cxx +++ b/Source/cmWin32ProcessExecution.cxx @@ -11,7 +11,7 @@ ============================================================================*/ #include "cmWin32ProcessExecution.h" -#include "cmSystemTools.h" +#include "cmSystemTools.h" #include #include @@ -48,26 +48,26 @@ void DisplayErrorMessage() { LPVOID lpMsgBuf; - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, - NULL + NULL ); // Process any inserts in lpMsgBuf. - // ... + // ... // Display the string. MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION ); // Free the buffer. LocalFree( lpMsgBuf ); } - -// Code from a Borland web site with the following explaination : + +// Code from a Borland web site with the following explaination : /* In this article, I will explain how to spawn a console application * and redirect its standard input/output using anonymous pipes. An * anonymous pipe is a pipe that goes only in one direction (read @@ -93,74 +93,74 @@ void DisplayErrorMessage() * monitor the read end of the stdout pipe to check for display on our * child process. Every time there is something availabe for reading, * we will display it in our app. Consequently, we check for input in - * our app and send it off to the write end of the stdin pipe. */ + * our app and send it off to the write end of the stdin pipe. */ -inline bool IsWinNT() -//check if we're running NT +inline bool IsWinNT() +//check if we're running NT { OSVERSIONINFO osv; osv.dwOSVersionInfoSize = sizeof(osv); GetVersionEx(&osv); - return (osv.dwPlatformId == VER_PLATFORM_WIN32_NT); + return (osv.dwPlatformId == VER_PLATFORM_WIN32_NT); } -//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- bool cmWin32ProcessExecution::BorlandRunCommand( - const char* command, const char* dir, - std::string& output, int& retVal, bool verbose, int /* timeout */, - bool hideWindows) + const char* command, const char* dir, + std::string& output, int& retVal, bool verbose, int /* timeout */, + bool hideWindows) { //verbose = true; - //std::cerr << std::endl - // << "WindowsRunCommand(" << command << ")" << std::endl + //std::cerr << std::endl + // << "WindowsRunCommand(" << command << ")" << std::endl // << std::flush; const int BUFFER_SIZE = 4096; char buf[BUFFER_SIZE]; - -//i/o buffer + +//i/o buffer STARTUPINFO si; SECURITY_ATTRIBUTES sa; SECURITY_DESCRIPTOR sd; - -//security information for pipes + +//security information for pipes PROCESS_INFORMATION pi; HANDLE newstdin,newstdout,read_stdout,write_stdin; - -//pipe handles - if (IsWinNT()) -//initialize security descriptor (Windows NT) + +//pipe handles + if (IsWinNT()) +//initialize security descriptor (Windows NT) { InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(&sd, true, NULL, false); sa.lpSecurityDescriptor = &sd; - + } else sa.lpSecurityDescriptor = NULL; sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.bInheritHandle = true; - -//allow inheritable handles - if (!CreatePipe(&newstdin,&write_stdin,&sa,0)) -//create stdin pipe + +//allow inheritable handles + if (!CreatePipe(&newstdin,&write_stdin,&sa,0)) +//create stdin pipe { return false; } - if (!CreatePipe(&read_stdout,&newstdout,&sa,0)) -//create stdout pipe + if (!CreatePipe(&read_stdout,&newstdout,&sa,0)) +//create stdout pipe { CloseHandle(newstdin); CloseHandle(write_stdin); return false; - + } GetStartupInfo(&si); - -//set startupinfo for the spawned process + +//set startupinfo for the spawned process /* The dwFlags member tells CreateProcess how to make the * process. STARTF_USESTDHANDLES validates the hStd* * members. STARTF_USESHOWWINDOW validates the wShowWindow - * member. */ - + * member. */ + si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW; si.hStdOutput = newstdout; @@ -170,12 +170,12 @@ bool cmWin32ProcessExecution::BorlandRunCommand( { si.wShowWindow = SW_HIDE; } - + //set the new handles for the child process si.hStdInput = newstdin; char* commandAndArgs = strcpy(new char[strlen(command)+1], command); if (!CreateProcess(NULL,commandAndArgs,NULL,NULL,TRUE, - 0, // CREATE_NEW_CONSOLE, - NULL,dir,&si,&pi)) + 0, // CREATE_NEW_CONSOLE, + NULL,dir,&si,&pi)) { std::cerr << "CreateProcess failed " << commandAndArgs << std::endl; CloseHandle(newstdin); @@ -184,37 +184,37 @@ bool cmWin32ProcessExecution::BorlandRunCommand( CloseHandle(write_stdin); delete [] commandAndArgs; return false; - + } delete [] commandAndArgs; unsigned long exit=0; - -//process exit code unsigned + +//process exit code unsigned unsigned long bread; - -//bytes read unsigned + +//bytes read unsigned unsigned long avail; - -//bytes available + +//bytes available memset(buf, 0, sizeof(buf)); - for(;;) -//main program loop + for(;;) +//main program loop { Sleep(10); -//check to see if there is any data to read from stdout +//check to see if there is any data to read from stdout //std::cout << "Peek for data..." << std::endl; PeekNamedPipe(read_stdout,buf,1023,&bread,&avail,NULL); - if (bread != 0) + if (bread != 0) { memset(buf, 0, sizeof(buf)); - if (avail > 1023) + if (avail > 1023) { - while (bread >= 1023) + while (bread >= 1023) { //std::cout << "Read data..." << std::endl; ReadFile(read_stdout,buf,1023,&bread,NULL); - - //read the stdout pipe + + //read the stdout pipe memset(buf, 0, sizeof(buf)); output += buf; if (verbose) @@ -223,39 +223,39 @@ bool cmWin32ProcessExecution::BorlandRunCommand( } } } - else + else { ReadFile(read_stdout,buf,1023,&bread,NULL); output += buf; - if(verbose) + if(verbose) { cmSystemTools::Stdout(buf); } - + } - + } - + //std::cout << "Check for process..." << std::endl; GetExitCodeProcess(pi.hProcess,&exit); - -//while the process is running + +//while the process is running if (exit != STILL_ACTIVE) break; - + } WaitForSingleObject(pi.hProcess, INFINITE); GetExitCodeProcess(pi.hProcess,&exit); CloseHandle(pi.hThread); CloseHandle(pi.hProcess); CloseHandle(newstdin); - -//clean stuff up + +//clean stuff up CloseHandle(newstdout); CloseHandle(read_stdout); CloseHandle(write_stdin); retVal = exit; return true; - + } bool cmWin32ProcessExecution::StartProcess( @@ -271,15 +271,8 @@ bool cmWin32ProcessExecution::Wait(int timeout) return this->PrivateClose(timeout); } -/* - * Internal dictionary mapping popen* file pointers to process handles, - * for use when retrieving the process exit code. See _PyPclose() below - * for more information on this dictionary's use. - */ -static void *_PyPopenProcs = NULL; - static BOOL RealPopenCreateProcess(const char *cmdstring, - const char *path, + const char *path, const char *szConsoleSpawn, HANDLE hStdin, HANDLE hStdout, @@ -314,7 +307,7 @@ static BOOL RealPopenCreateProcess(const char *cmdstring, ++comshell; if (GetVersion() < 0x80000000 && - STRICMP(comshell, "command.com") != 0) + STRICMP(comshell, "command.com") != 0) { /* NT/2000 and not using command.com. */ x = i + (int)strlen(s3) + (int)strlen(cmdstring) + 1; @@ -323,7 +316,7 @@ static BOOL RealPopenCreateProcess(const char *cmdstring, //sprintf(s2, "%s%s%s", s1, s3, cmdstring); sprintf(s2, "%s", cmdstring); } - else + else { /* * Oh gag, we're on Win9x or using COMMAND.COM. Use @@ -337,22 +330,22 @@ static BOOL RealPopenCreateProcess(const char *cmdstring, x = i+1; modulepath[x] = '\0'; /* Create the full-name to w9xpopen, so we can test it exists */ - strncat(modulepath, - szConsoleSpawn, + strncat(modulepath, + szConsoleSpawn, (sizeof(modulepath)/sizeof(modulepath[0])) -strlen(modulepath)); - if (stat(modulepath, &statinfo) != 0) + if (stat(modulepath, &statinfo) != 0) { - /* Eeek - file-not-found - possibly an embedding - situation - see if we can locate it in sys.prefix + /* Eeek - file-not-found - possibly an embedding + situation - see if we can locate it in sys.prefix */ - strncpy(modulepath, - ".", + strncpy(modulepath, + ".", sizeof(modulepath)/sizeof(modulepath[0])); if (modulepath[strlen(modulepath)-1] != '\\') strcat(modulepath, "\\"); - strncat(modulepath, - szConsoleSpawn, + strncat(modulepath, + szConsoleSpawn, (sizeof(modulepath)/sizeof(modulepath[0])) -strlen(modulepath)); /* No where else to look - raise an easily identifiable @@ -361,20 +354,20 @@ static BOOL RealPopenCreateProcess(const char *cmdstring, unaware this shim EXE is used, and it will confuse them. (well, it confused me for a while ;-) */ - if (stat(modulepath, &statinfo) != 0) + if (stat(modulepath, &statinfo) != 0) { - std::cout + std::cout << "Can not locate '" << modulepath << "' which is needed " "for popen to work with your shell " - "or platform." << std::endl; + "or platform." << std::endl; free(s1); free(s2); return FALSE; } } x = i + (int)strlen(s3) + (int)strlen(cmdstring) + 1 + - (int)strlen(modulepath) + + (int)strlen(modulepath) + (int)strlen(szConsoleSpawn) + 1; if(s2) { @@ -399,22 +392,22 @@ static BOOL RealPopenCreateProcess(const char *cmdstring, /* Could be an else here to try cmd.exe / command.com in the path Now we'll just error out.. */ - else + else { std::cout << "Cannot locate a COMSPEC environment variable to " - << "use as the shell" << std::endl; + << "use as the shell" << std::endl; free(s2); free(s1); return FALSE; } - + ZeroMemory(&siStartInfo, sizeof(STARTUPINFO)); siStartInfo.cb = sizeof(STARTUPINFO); siStartInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; siStartInfo.hStdInput = hStdin; siStartInfo.hStdOutput = hStdout; siStartInfo.hStdError = hStderr; - siStartInfo.wShowWindow = SW_SHOWDEFAULT; + siStartInfo.wShowWindow = SW_SHOWDEFAULT; if(hideWindows) { siStartInfo.wShowWindow = SW_HIDE; @@ -430,7 +423,7 @@ static BOOL RealPopenCreateProcess(const char *cmdstring, NULL, path, &siStartInfo, - &piProcInfo) ) + &piProcInfo) ) { /* Close the handles now so anyone waiting is woken. */ CloseHandle(piProcInfo.hThread); @@ -477,9 +470,9 @@ static BOOL RealPopenCreateProcess(const char *cmdstring, /* The following code is based off of KB: Q190351 */ -bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring, +bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring, const char* path, - int mode, + int mode, int n) { HANDLE hProcess; @@ -496,11 +489,11 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring, this->hChildStdinWrDup = 0; this->hChildStdoutRdDup = 0; this->hChildStderrRdDup = 0; - + saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); saAttr.bInheritHandle = TRUE; saAttr.lpSecurityDescriptor = NULL; - + fd1 = 0; fd2 = 0; fd3 = 0; @@ -510,7 +503,7 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring, this->Output += "CreatePipeError\n"; return false; } - + /* Create new output read handle and the input write handle. Set * the inheritance properties to FALSE. Otherwise, the child inherits * the these handles; resulting in non-closeable handles to the pipes @@ -549,7 +542,7 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring, that we're using. */ CloseHandle(hChildStdoutRd); - if (n != POPEN_4) + if (n != POPEN_4) { if (!CreatePipe(&this->hChildStderrRd, &this->hChildStderrWr, &saAttr, 0)) { @@ -570,11 +563,11 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring, CloseHandle(hChildStderrRd); } - - switch (n) + + switch (n) { case POPEN_1: - switch (mode & (_O_RDONLY | _O_TEXT | _O_BINARY | _O_WRONLY)) + switch (mode & (_O_RDONLY | _O_TEXT | _O_BINARY | _O_WRONLY)) { case _O_WRONLY | _O_TEXT: /* Case for writing to child Stdin in text mode. */ @@ -606,18 +599,18 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring, break; } break; - + case POPEN_2: - case POPEN_4: - //if ( 1 ) + case POPEN_4: + //if ( 1 ) { fd1 = _open_osfhandle(TO_INTPTR(this->hChildStdinWrDup), mode); fd2 = _open_osfhandle(TO_INTPTR(this->hChildStdoutRdDup), mode); break; } - + case POPEN_3: - //if ( 1) + //if ( 1) { fd1 = _open_osfhandle(TO_INTPTR(this->hChildStdinWrDup), mode); fd2 = _open_osfhandle(TO_INTPTR(this->hChildStdoutRdDup), mode); @@ -626,7 +619,7 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring, } } - if (n == POPEN_4) + if (n == POPEN_4) { if (!RealPopenCreateProcess(cmdstring, path, @@ -652,7 +645,7 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring, return 0; } } - else + else { if (!RealPopenCreateProcess(cmdstring, path, @@ -679,18 +672,6 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring, } } - /* - * Insert the files we've created into the process dictionary - * all referencing the list with the process handle and the - * initial number of files (see description below in _PyPclose). - * Since if _PyPclose later tried to wait on a process when all - * handles weren't closed, it could create a deadlock with the - * child, we spend some energy here to try to ensure that we - * either insert all file handles into the dictionary or none - * at all. It's a little clumsy with the various popen modes - * and variable number of files involved. - */ - /* Child is launched. Close the parents copy of those pipe * handles that only the child should have open. You need to * make sure that no handles to the write end of the output pipe @@ -761,43 +742,6 @@ cmWin32ProcessExecution::~cmWin32ProcessExecution() this->CloseHandles(); } -/* - * Wrapper for fclose() to use for popen* files, so we can retrieve the - * exit code for the child process and return as a result of the close. - * - * This function uses the _PyPopenProcs dictionary in order to map the - * input file pointer to information about the process that was - * originally created by the popen* call that created the file pointer. - * The dictionary uses the file pointer as a key (with one entry - * inserted for each file returned by the original popen* call) and a - * single list object as the value for all files from a single call. - * The list object contains the Win32 process handle at [0], and a file - * count at [1], which is initialized to the total number of file - * handles using that list. - * - * This function closes whichever handle it is passed, and decrements - * the file count in the dictionary for the process handle pointed to - * by this file. On the last close (when the file count reaches zero), - * this function will wait for the child process and then return its - * exit code as the result of the close() operation. This permits the - * files to be closed in any order - it is always the close() of the - * final handle that will return the exit code. - */ - - /* RED_FLAG 31-Aug-2000 Tim - * This is always called (today!) between a pair of - * Py_BEGIN_ALLOW_THREADS/ Py_END_ALLOW_THREADS - * macros. So the thread running this has no valid thread state, as - * far as Python is concerned. However, this calls some Python API - * functions that cannot be called safely without a valid thread - * state, in particular PyDict_GetItem. - * As a temporary hack (although it may last for years ...), we - * *rely* on not having a valid thread state in this function, in - * order to create our own "from scratch". - * This will deadlock if _PyPclose is ever called by a thread - * holding the global lock. - */ - bool cmWin32ProcessExecution::PrivateClose(int /* timeout */) { HANDLE hProcess = this->ProcessHandle; @@ -852,15 +796,15 @@ bool cmWin32ProcessExecution::PrivateClose(int /* timeout */) break; } } - } + } + - if (WaitForSingleObject(hProcess, INFINITE) != WAIT_FAILED && - GetExitCodeProcess(hProcess, &exit_code)) + GetExitCodeProcess(hProcess, &exit_code)) { result = exit_code; - } - else + } + else { /* Indicate failure - this will cause the file object * to raise an I/O error and translate the last Win32 @@ -868,7 +812,7 @@ bool cmWin32ProcessExecution::PrivateClose(int /* timeout */) * last errors that overlap the normal errno table, * but that's a consistent problem with the file object. */ - if (result != EOF) + if (result != EOF) { /* If the error wasn't from the fclose(), then * set errno for the file object error handling. @@ -897,7 +841,7 @@ int cmWin32ProcessExecution::Windows9xHack(const char* command) PROCESS_INFORMATION pi; DWORD exit_code=0; - if (!command) + if (!command) { cmSystemTools::Error("Windows9xHack: Command not specified"); return 1; @@ -911,7 +855,7 @@ int cmWin32ProcessExecution::Windows9xHack(const char* command) si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); si.hStdError = GetStdHandle(STD_ERROR_HANDLE); - + char * app = 0; char* cmd = new char[ strlen(command) + 1 ]; strcpy(cmd, command); @@ -925,9 +869,9 @@ int cmWin32ProcessExecution::Windows9xHack(const char* command) ); delete [] cmd; - if (bRet) + if (bRet) { - if (WaitForSingleObject(pi.hProcess, INFINITE) != WAIT_FAILED) + if (WaitForSingleObject(pi.hProcess, INFINITE) != WAIT_FAILED) { GetExitCodeProcess(pi.hProcess, &exit_code); } diff --git a/Source/cmWin32ProcessExecution.h b/Source/cmWin32ProcessExecution.h index def69a8cc..98b6bda98 100644 --- a/Source/cmWin32ProcessExecution.h +++ b/Source/cmWin32ProcessExecution.h @@ -47,12 +47,12 @@ public: ~cmWin32ProcessExecution(); ///! If true windows will be created hidden. void SetHideWindows(bool v) { this->HideWindows = v; } - + /** * Initialize the process execution datastructure. Do not call while * running the process. */ - void Initialize() + void Initialize() { this->ProcessHandle = 0; this->ExitValue = -1; @@ -65,7 +65,7 @@ public: this->pStdOut = -1; this->pStdErr = -1; } - + /** * Start the process in the directory path. Make sure that the * executable is either in the path or specify the full path. The @@ -129,10 +129,10 @@ public: * process. Every time there is something availabe for reading, we * will display it in our app. Consequently, we check for input in * our app and send it off to the write end of the stdin pipe. - */ - static bool BorlandRunCommand(const char* command, - const char* dir, - std::string& output, int& retVal, + */ + static bool BorlandRunCommand(const char* command, + const char* dir, + std::string& output, int& retVal, bool verbose, int timeout, bool hideWindows); @@ -151,8 +151,8 @@ private: HANDLE hChildStdinWrDup; HANDLE hChildStdoutRdDup; HANDLE hChildStderrRdDup; - - + + int pStdIn; int pStdOut; int pStdErr; diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index b2acb2bc1..3642c6fba 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -71,7 +71,7 @@ bool cmWriteFileCommand } // If GetPermissions fails, pretend like it is ok. File open will fail if // the file is not writable - std::ofstream file(fileName.c_str(), + std::ofstream file(fileName.c_str(), overwrite?std::ios::out : std::ios::app); if ( !file ) { diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h index 8808d32bb..771ef5a1b 100644 --- a/Source/cmWriteFileCommand.h +++ b/Source/cmWriteFileCommand.h @@ -24,7 +24,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmWriteFileCommand; } @@ -53,7 +53,7 @@ public: { return "Deprecated. Use the file(WRITE ) command instead."; } - + /** * More documentation. */ @@ -71,7 +71,7 @@ public: "lead to an infinite loop. Use configure_file if you want to generate " "input files to CMake."; } - + /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const { diff --git a/Source/cmXCode21Object.cxx b/Source/cmXCode21Object.cxx index c679cd8bf..855e1ad2f 100644 --- a/Source/cmXCode21Object.cxx +++ b/Source/cmXCode21Object.cxx @@ -79,20 +79,20 @@ void cmXCode21Object::PrintList(std::vector const& v, cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXBuildStyle); cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXContainerItemProxy); cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXFileReference); - cmXCode21Object::PrintList(v, out, + cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXFrameworksBuildPhase); cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXGroup); cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXHeadersBuildPhase); cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXNativeTarget); cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXProject); - cmXCode21Object::PrintList(v, out, + cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXShellScriptBuildPhase); cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXResourcesBuildPhase); cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXSourcesBuildPhase); cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXCopyFilesBuildPhase); - cmXCode21Object::PrintList(v, out, + cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXApplicationReference); - cmXCode21Object::PrintList(v, out, + cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXExecutableFileReference); cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXLibraryReference); cmXCode21Object::PrintList(v, out, cmXCode21Object::PBXToolTarget); diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 30ade9637..6abf6bf00 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -16,13 +16,13 @@ //---------------------------------------------------------------------------- const char* cmXCodeObject::PBXTypeNames[] = { - "PBXGroup", "PBXBuildStyle", "PBXProject", "PBXHeadersBuildPhase", + "PBXGroup", "PBXBuildStyle", "PBXProject", "PBXHeadersBuildPhase", "PBXSourcesBuildPhase", "PBXFrameworksBuildPhase", "PBXNativeTarget", - "PBXFileReference", "PBXBuildFile", "PBXContainerItemProxy", - "PBXTargetDependency", "PBXShellScriptBuildPhase", + "PBXFileReference", "PBXBuildFile", "PBXContainerItemProxy", + "PBXTargetDependency", "PBXShellScriptBuildPhase", "PBXResourcesBuildPhase", "PBXApplicationReference", "PBXExecutableFileReference", "PBXLibraryReference", "PBXToolTarget", - "PBXLibraryTarget", "PBXAggregateTarget", "XCBuildConfiguration", + "PBXLibraryTarget", "PBXAggregateTarget", "XCBuildConfiguration", "XCConfigurationList", "PBXCopyFilesBuildPhase", "None" @@ -38,7 +38,6 @@ cmXCodeObject::~cmXCodeObject() cmXCodeObject::cmXCodeObject(PBXType ptype, Type type) { this->Version = 15; - this->PBXTargetDependencyValue = 0; this->Target = 0; this->Object =0; @@ -92,7 +91,7 @@ void cmXCodeObject::Print(std::ostream& out) { std::string separator = "\n"; int indentFactor = 1; - if(this->Version > 15 + if(this->Version > 15 && (this->IsA == PBXFileReference || this->IsA == PBXBuildFile)) { separator = " "; @@ -112,12 +111,12 @@ void cmXCodeObject::Print(std::ostream& out) std::map::iterator i; cmXCodeObject::Indent(3*indentFactor, out); out << "isa = " << PBXTypeNames[this->IsA] << ";" << separator; - for(i = this->ObjectAttributes.begin(); + for(i = this->ObjectAttributes.begin(); i != this->ObjectAttributes.end(); ++i) - { + { cmXCodeObject* object = i->second; if(i->first != "isa") - { + { cmXCodeObject::Indent(3*indentFactor, out); } else @@ -133,7 +132,7 @@ void cmXCodeObject::Print(std::ostream& out) out << i->second->List[k]->Id << " "; i->second->List[k]->PrintComment(out); out << "," << separator; - } + } cmXCodeObject::Indent(3*indentFactor, out); out << ");" << separator; } @@ -141,7 +140,7 @@ void cmXCodeObject::Print(std::ostream& out) { std::map::iterator j; out << i->first << " = {" << separator; - for(j = object->ObjectAttributes.begin(); j != + for(j = object->ObjectAttributes.begin(); j != object->ObjectAttributes.end(); ++j) { cmXCodeObject::Indent(4 *indentFactor, out); @@ -209,11 +208,11 @@ void cmXCodeObject::Print(std::ostream& out) cmXCodeObject::Indent(2*indentFactor, out); out << "};\n"; } - + //---------------------------------------------------------------------------- void cmXCodeObject::PrintList(std::vector const& objs, std::ostream& out) -{ +{ cmXCodeObject::Indent(1, out); out << "objects = {\n"; for(unsigned int i = 0; i < objs.size(); ++i) diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 2fb96f30e..b89f78cf3 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -19,13 +19,13 @@ class cmXCodeObject { public: enum Type { OBJECT_LIST, STRING, ATTRIBUTE_GROUP, OBJECT_REF, OBJECT }; - enum PBXType { PBXGroup, PBXBuildStyle, PBXProject, PBXHeadersBuildPhase, - PBXSourcesBuildPhase, PBXFrameworksBuildPhase, - PBXNativeTarget, PBXFileReference, PBXBuildFile, + enum PBXType { PBXGroup, PBXBuildStyle, PBXProject, PBXHeadersBuildPhase, + PBXSourcesBuildPhase, PBXFrameworksBuildPhase, + PBXNativeTarget, PBXFileReference, PBXBuildFile, PBXContainerItemProxy, PBXTargetDependency, PBXShellScriptBuildPhase, PBXResourcesBuildPhase, - PBXApplicationReference, PBXExecutableFileReference, - PBXLibraryReference, PBXToolTarget, PBXLibraryTarget, + PBXApplicationReference, PBXExecutableFileReference, + PBXLibraryReference, PBXToolTarget, PBXLibraryTarget, PBXAggregateTarget,XCBuildConfiguration,XCConfigurationList, PBXCopyFilesBuildPhase, None @@ -38,16 +38,16 @@ public: PBXType GetIsA() { return this->IsA;} void SetString(const char* s); - const char* GetString() + const char* GetString() { return this->String.c_str(); } - + void AddAttribute(const char* name, cmXCodeObject* value) { this->ObjectAttributes[name] = value; } - + void SetObject(cmXCodeObject* value) { this->Object = value; @@ -60,14 +60,14 @@ public: { this->List.push_back(value); } - bool HasObject(cmXCodeObject* o) + bool HasObject(cmXCodeObject* o) { - return !(std::find(this->List.begin(), this->List.end(), o) + return !(std::find(this->List.begin(), this->List.end(), o) == this->List.end()); } void AddUniqueObject(cmXCodeObject* value) { - if(std::find(this->List.begin(), this->List.end(), value) + if(std::find(this->List.begin(), this->List.end(), value) == this->List.end()) { this->List.push_back(value); @@ -77,7 +77,7 @@ public: void Print(std::ostream& out); virtual void PrintComment(std::ostream&) {}; - static void PrintList(std::vector const&, + static void PrintList(std::vector const&, std::ostream& out); const char* GetId() { @@ -119,17 +119,9 @@ public: } return 0; } - - cmXCodeObject* GetPBXTargetDependency() - { - return this->PBXTargetDependencyValue; - } - void SetPBXTargetDependency(cmXCodeObject* d) - { - this->PBXTargetDependencyValue = d; - } + void CopyAttributes(cmXCodeObject* ); - + void AddDependLibrary(const char* configName, const char* l) { @@ -170,7 +162,6 @@ protected: cmStdString Comment; cmStdString String; cmXCodeObject* Object; - cmXCodeObject* PBXTargetDependencyValue; std::vector List; std::map DependLibraries; std::map DependTargets; diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx index 46a1ca4aa..882fc172e 100644 --- a/Source/cmXMLParser.cxx +++ b/Source/cmXMLParser.cxx @@ -34,7 +34,7 @@ cmXMLParser::~cmXMLParser() int cmXMLParser::Parse(const char* string) { return (int)this->InitializeParser() && - this->ParseChunk(string, strlen(string)) && + this->ParseChunk(string, strlen(string)) && this->CleanupParser(); } @@ -79,7 +79,7 @@ int cmXMLParser::InitializeParser() } //---------------------------------------------------------------------------- -int cmXMLParser::ParseChunk(const char* inputString, +int cmXMLParser::ParseChunk(const char* inputString, std::string::size_type length) { if ( !this->Parser ) @@ -116,11 +116,11 @@ int cmXMLParser::CleanupParser() result = 0; } } - + // Clean up the parser. XML_ParserFree(static_cast(this->Parser)); this->Parser = 0; - + return result; } @@ -128,7 +128,7 @@ int cmXMLParser::CleanupParser() int cmXMLParser::ParseBuffer(const char* buffer, std::string::size_type count) { // Pass the buffer to the expat XML parser. - if(!XML_Parse(static_cast(this->Parser), buffer, + if(!XML_Parse(static_cast(this->Parser), buffer, static_cast(count), 0)) { this->ReportXmlParseError(); diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h index c72be5751..d916075e5 100644 --- a/Source/cmXMLParser.h +++ b/Source/cmXMLParser.h @@ -18,7 +18,7 @@ extern "C" { void cmXMLParserStartElement(void*, const char*, const char**); void cmXMLParserEndElement(void*, const char*); - void cmXMLParserCharacterDataHandler(void*, const char*, int); + void cmXMLParserCharacterDataHandler(void*, const char*, int); } /** \class cmXMLParser @@ -37,7 +37,7 @@ public: //! Parse given XML file virtual int ParseFile(const char* file); - + /** * When parsing fragments of XML or streaming XML, use the following * three methods. InitializeParser method initialize parser but does @@ -47,7 +47,7 @@ public: * them. */ virtual int InitializeParser(); - virtual int ParseChunk(const char* inputString, + virtual int ParseChunk(const char* inputString, std::string::size_type length); virtual int CleanupParser(); @@ -65,7 +65,7 @@ protected: * terminating condition for parsing. Parsing always stops when the end of * file is reached in the stream. */ - + virtual int ParsingComplete(); /** @@ -75,28 +75,28 @@ protected: * Even indices are attribute names, and odd indices are values. */ virtual void StartElement(const char* name, const char** atts); - + //! Called at the end of an element in the XML source opened when //StartElement was called. virtual void EndElement(const char* name); - + //! Called when there is character data to handle. - virtual void CharacterDataHandler(const char* data, int length); + virtual void CharacterDataHandler(const char* data, int length); //! Called by Parse to report an XML syntax error. - virtual void ReportXmlParseError(); + virtual void ReportXmlParseError(); /** Called by ReportXmlParseError with basic error info. */ virtual void ReportError(int line, int column, const char* msg); //! Utility for convenience of subclasses. Wraps isspace C library // routine. - static int IsSpace(char c); - + static int IsSpace(char c); + //! Send the given buffer to the XML parser. - virtual int ParseBuffer(const char* buffer, + virtual int ParseBuffer(const char* buffer, std::string::size_type length); - + //! Send the given c-style string to the XML parser. int ParseBuffer(const char* buffer); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index fdc42fa2b..e2f80d135 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -63,15 +63,8 @@ # include "cmGlobalVisualStudio71Generator.h" # include "cmGlobalVisualStudio8Generator.h" # include "cmGlobalVisualStudio9Generator.h" -# include "cmGlobalVisualStudio9IA64Generator.h" -# include "cmGlobalVisualStudio9Win64Generator.h" # include "cmGlobalVisualStudio10Generator.h" -# include "cmGlobalVisualStudio10IA64Generator.h" -# include "cmGlobalVisualStudio10Win64Generator.h" # include "cmGlobalVisualStudio11Generator.h" -# include "cmGlobalVisualStudio11Win64Generator.h" -# include "cmGlobalVisualStudio11ARMGenerator.h" -# include "cmGlobalVisualStudio8Win64Generator.h" # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" # include "cmGlobalJOMMakefileGenerator.h" @@ -89,11 +82,13 @@ #if defined(CMAKE_HAVE_VS_GENERATORS) #include "cmCallVisualStudioMacro.h" +#include "cmVisualStudioWCEPlatformParser.h" #endif #if !defined(CMAKE_BOOT_MINGW) # include "cmExtraCodeBlocksGenerator.h" #endif +#include "cmExtraSublimeTextGenerator.h" #ifdef CMAKE_USE_KDEVELOP # include "cmGlobalKdevelopGenerator.h" @@ -117,8 +112,6 @@ #include // struct stat -#include // auto_ptr - static bool cmakeCheckStampFile(const char* stampName); static bool cmakeCheckStampList(const char* stampName); @@ -222,6 +215,11 @@ cmake::~cmake() { delete (*j).second; } + for(RegisteredGeneratorsVector::iterator j = this->Generators.begin(); + j != this->Generators.end(); ++j) + { + delete *j; + } #ifdef CMAKE_BUILD_WITH_CMAKE delete this->VariableWatch; #endif @@ -521,7 +519,7 @@ void cmake::ReadListFile(const std::vector& args, // read in the list file to fill the cache if(path) { - std::auto_ptr lg(gg->CreateLocalGenerator()); + cmsys::auto_ptr lg(gg->CreateLocalGenerator()); lg->GetMakefile()->SetHomeOutputDirectory (cmSystemTools::GetCurrentWorkingDirectory().c_str()); lg->GetMakefile()->SetStartOutputDirectory @@ -560,7 +558,7 @@ bool cmake::FindPackage(const std::vector& args) this->SetGlobalGenerator(gg); // read in the list file to fill the cache - std::auto_ptr lg(gg->CreateLocalGenerator()); + cmsys::auto_ptr lg(gg->CreateLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); mf->SetHomeOutputDirectory (cmSystemTools::GetCurrentWorkingDirectory().c_str()); @@ -628,9 +626,14 @@ bool cmake::FindPackage(const std::vector& args) std::string linkLibs; + std::string frameworkPath; + std::string linkPath; std::string flags; std::string linkFlags; - lg->GetTargetFlags(linkLibs, flags, linkFlags, *tgt); + cmGeneratorTarget gtgt(tgt); + lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags, + >gt); + linkLibs = frameworkPath + linkPath + linkLibs; printf("%s\n", linkLibs.c_str() ); @@ -657,6 +660,7 @@ void cmake::SetArgs(const std::vector& args, bool directoriesSetBefore) { bool directoriesSet = directoriesSetBefore; + bool haveToolset = false; for(unsigned int i=1; i < args.size(); ++i) { std::string arg = args[i]; @@ -785,6 +789,27 @@ void cmake::SetArgs(const std::vector& args, "uninitialized variables.\n"; this->SetCheckSystemVars(true); } + else if(arg.find("-T",0) == 0) + { + std::string value = arg.substr(2); + if(value.size() == 0) + { + ++i; + if(i >= args.size()) + { + cmSystemTools::Error("No toolset specified for -T"); + return; + } + value = args[i]; + } + if(haveToolset) + { + cmSystemTools::Error("Multiple -T options not allowed"); + return; + } + this->GeneratorToolset = value; + haveToolset = true; + } else if(arg.find("-G",0) == 0) { std::string value = arg.substr(2); @@ -951,7 +976,7 @@ int cmake::AddCMakePaths() cMakeSelf = cmSystemTools::GetRealPath(cMakeSelf.c_str()); cMakeSelf += "/cmake"; cMakeSelf += cmSystemTools::GetExecutableExtension(); -#if __APPLE__ +#ifdef __APPLE__ // on the apple this might be the gui bundle if(!cmSystemTools::FileExists(cMakeSelf.c_str())) { @@ -1043,7 +1068,7 @@ int cmake::AddCMakePaths() { cMakeRoot = cMakeRoot.substr(0, slashPos); } - // is there no Modules direcory there? + // is there no Modules directory there? modules = cMakeRoot + "/Modules/CMake.cmake"; } @@ -1072,7 +1097,7 @@ int cmake::AddCMakePaths() { // next try exe cMakeRoot = cmSystemTools::GetProgramPath(cMakeSelf.c_str()); - // is there no Modules direcory there? + // is there no Modules directory there? modules = cMakeRoot + "/Modules/CMake.cmake"; } if (!cmSystemTools::FileExists(modules.c_str())) @@ -1142,6 +1167,10 @@ void CMakeCommandUsage(const char* program) << "Available on Windows only:\n" << " comspec - on windows 9x use this for RunCommand\n" << " delete_regv key - delete registry value\n" + << " env_vs8_wince sdkname - displays a batch file which sets the " + "environment for the provided Windows CE SDK installed in VS2005\n" + << " env_vs9_wince sdkname - displays a batch file which sets the " + "environment for the provided Windows CE SDK installed in VS2008\n" << " write_regv key value - write registry value\n" #else << "Available on UNIX only:\n" @@ -1421,7 +1450,7 @@ int cmake::ExecuteCMakeCommand(std::vector& args) int retval = 0; int timeout = 0; if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval, - directory.c_str(), cmSystemTools::OUTPUT_MERGE, timeout) ) + directory.c_str(), cmSystemTools::OUTPUT_NORMAL, timeout) ) { return retval; } @@ -1651,7 +1680,7 @@ int cmake::ExecuteCMakeCommand(std::vector& args) if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen.c_str())) { cm.SetGlobalGenerator(ggd); - std::auto_ptr lgd(ggd->CreateLocalGenerator()); + cmsys::auto_ptr lgd(ggd->CreateLocalGenerator()); lgd->GetMakefile()->SetStartDirectory(startDir.c_str()); lgd->GetMakefile()->SetStartOutputDirectory(startOutDir.c_str()); lgd->GetMakefile()->MakeStartDirectoriesCurrent(); @@ -1807,6 +1836,14 @@ int cmake::ExecuteCMakeCommand(std::vector& args) } return cmWin32ProcessExecution::Windows9xHack(command.c_str()); } + else if (args[1] == "env_vs8_wince" && args.size() == 3) + { + return cmake::WindowsCEEnvironment("8.0", args[2]); + } + else if (args[1] == "env_vs9_wince" && args.size() == 3) + { + return cmake::WindowsCEEnvironment("9.0", args[2]); + } #endif } @@ -1842,6 +1879,8 @@ void cmake::AddDefaultExtraGenerators() this->AddExtraGenerator(cmExtraCodeBlocksGenerator::GetActualName(), &cmExtraCodeBlocksGenerator::New); + this->AddExtraGenerator(cmExtraSublimeTextGenerator::GetActualName(), + &cmExtraSublimeTextGenerator::New); #ifdef CMAKE_USE_ECLIPSE this->AddExtraGenerator(cmExtraEclipseCDT4Generator::GetActualName(), @@ -1864,10 +1903,10 @@ void cmake::AddDefaultExtraGenerators() //---------------------------------------------------------------------------- void cmake::GetRegisteredGenerators(std::vector& names) { - for(RegisteredGeneratorsMap::const_iterator i = this->Generators.begin(); + for(RegisteredGeneratorsVector::const_iterator i = this->Generators.begin(); i != this->Generators.end(); ++i) { - names.push_back(i->first); + (*i)->GetGenerators(names); } for(RegisteredExtraGeneratorsMap::const_iterator i = this->ExtraGenerators.begin(); @@ -1879,29 +1918,36 @@ void cmake::GetRegisteredGenerators(std::vector& names) cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name) { - cmGlobalGenerator* generator = 0; cmExternalMakefileProjectGenerator* extraGenerator = 0; - RegisteredGeneratorsMap::const_iterator genIt = this->Generators.find(name); - if(genIt == this->Generators.end()) + RegisteredExtraGeneratorsMap::const_iterator extraGenIt = + this->ExtraGenerators.find(name); + if (extraGenIt != this->ExtraGenerators.end()) { - RegisteredExtraGeneratorsMap::const_iterator extraGenIt = - this->ExtraGenerators.find(name); - if (extraGenIt == this->ExtraGenerators.end()) - { - return 0; - } extraGenerator = (extraGenIt->second)(); - genIt=this->Generators.find(extraGenerator->GetGlobalGeneratorName(name)); - if(genIt == this->Generators.end()) + name = extraGenerator->GetGlobalGeneratorName(name); + } + + cmGlobalGenerator* generator = 0; + for (RegisteredGeneratorsVector::const_iterator i = + this->Generators.begin(); i != this->Generators.end(); ++i) + { + generator = (*i)->CreateGlobalGenerator(name); + if (generator) { - delete extraGenerator; - return 0; + break; } - } + } + + if (generator) + { + generator->SetCMakeInstance(this); + generator->SetExternalMakefileProjectGenerator(extraGenerator); + } + else + { + delete extraGenerator; + } - generator = (genIt->second)(); - generator->SetCMakeInstance(this); - generator->SetExternalMakefileProjectGenerator(extraGenerator); return generator; } @@ -2041,7 +2087,7 @@ struct SaveCacheEntry int cmake::HandleDeleteCacheVariables(const char* var) { std::vector argsSplit; - cmSystemTools::ExpandListArgument(std::string(var), argsSplit); + cmSystemTools::ExpandListArgument(std::string(var), argsSplit, true); // erase the property to avoid infinite recursion this->SetProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_", ""); if(this->GetIsInTryCompile()) @@ -2184,6 +2230,7 @@ int cmake::ActualConfigure() std::vector vsVerions; vsVerions.push_back("VisualStudio\\"); vsVerions.push_back("VCExpress\\"); + vsVerions.push_back("WDExpress\\"); struct VSRegistryEntryName { const char* MSVersion; @@ -2196,10 +2243,11 @@ int cmake::ActualConfigure() {"8.0", "Visual Studio 8 2005"}, {"9.0", "Visual Studio 9 2008"}, {"10.0", "Visual Studio 10"}, + {"11.0", "Visual Studio 11"}, {0, 0}}; - for(size_t b=0; b < vsVerions.size() && installedCompiler.empty(); b++) + for(int i=0; version[i].MSVersion != 0; i++) { - for(int i =0; version[i].MSVersion != 0; i++) + for(size_t b=0; b < vsVerions.size(); b++) { std::string reg = vsregBase + vsVerions[b] + version[i].MSVersion; reg += ";InstallDir]"; @@ -2208,6 +2256,7 @@ int cmake::ActualConfigure() if (!(reg == "/registry")) { installedCompiler = version[i].GeneratorName; + break; } } } @@ -2258,6 +2307,39 @@ int cmake::ActualConfigure() cmCacheManager::INTERNAL); } + if(const char* tsName = + this->CacheManager->GetCacheValue("CMAKE_GENERATOR_TOOLSET")) + { + if(this->GeneratorToolset.empty()) + { + this->GeneratorToolset = tsName; + } + else if(this->GeneratorToolset != tsName) + { + std::string message = "Error: generator toolset: "; + message += this->GeneratorToolset; + message += "\nDoes not match the toolset used previously: "; + message += tsName; + message += + "\nEither remove the CMakeCache.txt file or choose a different" + " binary directory."; + cmSystemTools::Error(message.c_str()); + return -2; + } + } + else + { + this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_TOOLSET", + this->GeneratorToolset.c_str(), + "Name of generator toolset.", + cmCacheManager::INTERNAL); + } + if(!this->GeneratorToolset.empty() && + !this->GlobalGenerator->SetGeneratorToolset(this->GeneratorToolset)) + { + return -2; + } + // reset any system configuration information, except for when we are // InTryCompile. With TryCompile the system info is taken from the parent's // info to save time @@ -2326,6 +2408,17 @@ int cmake::ActualConfigure() this->CacheManager->RemoveCacheEntry("CMAKE_GENERATOR"); this->CacheManager->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR"); } + + cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); + if (mf->IsOn("CTEST_USE_LAUNCHERS") + && !this->GetProperty("RULE_LAUNCH_COMPILE", cmProperty::GLOBAL)) + { + cmSystemTools::Error("CTEST_USE_LAUNCHERS is enabled, but the " + "RULE_LAUNCH_COMPILE global property is not defined.\n" + "Did you forget to include(CTest) in the toplevel " + "CMakeLists.txt ?"); + } + // only save the cache if there were no fatal errors if ( this->GetWorkingMode() == NORMAL_MODE ) { @@ -2438,9 +2531,6 @@ int cmake::Run(const std::vector& args, bool noconfigure) this->PreLoadCMakeFiles(); - std::string systemFile = this->GetHomeOutputDirectory(); - systemFile += "/CMakeSystem.cmake"; - if ( noconfigure ) { return 0; @@ -2554,55 +2644,41 @@ void cmake::AddDefaultGenerators() { #if defined(_WIN32) && !defined(__CYGWIN__) # if !defined(CMAKE_BOOT_MINGW) - this->Generators[cmGlobalVisualStudio6Generator::GetActualName()] = - &cmGlobalVisualStudio6Generator::New; - this->Generators[cmGlobalVisualStudio7Generator::GetActualName()] = - &cmGlobalVisualStudio7Generator::New; - this->Generators[cmGlobalVisualStudio10Generator::GetActualName()] = - &cmGlobalVisualStudio10Generator::New; - this->Generators[cmGlobalVisualStudio10IA64Generator::GetActualName()] = - &cmGlobalVisualStudio10IA64Generator::New; - this->Generators[cmGlobalVisualStudio10Win64Generator::GetActualName()] = - &cmGlobalVisualStudio10Win64Generator::New; - this->Generators[cmGlobalVisualStudio11Generator::GetActualName()] = - &cmGlobalVisualStudio11Generator::New; - this->Generators[cmGlobalVisualStudio11Win64Generator::GetActualName()] = - &cmGlobalVisualStudio11Win64Generator::New; - this->Generators[cmGlobalVisualStudio11ARMGenerator::GetActualName()] = - &cmGlobalVisualStudio11ARMGenerator::New; - this->Generators[cmGlobalVisualStudio71Generator::GetActualName()] = - &cmGlobalVisualStudio71Generator::New; - this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] = - &cmGlobalVisualStudio8Generator::New; - this->Generators[cmGlobalVisualStudio9Generator::GetActualName()] = - &cmGlobalVisualStudio9Generator::New; - this->Generators[cmGlobalVisualStudio9IA64Generator::GetActualName()] = - &cmGlobalVisualStudio9IA64Generator::New; - this->Generators[cmGlobalVisualStudio9Win64Generator::GetActualName()] = - &cmGlobalVisualStudio9Win64Generator::New; - this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] = - &cmGlobalVisualStudio8Win64Generator::New; - this->Generators[cmGlobalBorlandMakefileGenerator::GetActualName()] = - &cmGlobalBorlandMakefileGenerator::New; - this->Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] = - &cmGlobalNMakeMakefileGenerator::New; - this->Generators[cmGlobalJOMMakefileGenerator::GetActualName()] = - &cmGlobalJOMMakefileGenerator::New; - this->Generators[cmGlobalWatcomWMakeGenerator::GetActualName()] = - &cmGlobalWatcomWMakeGenerator::New; + this->Generators.push_back( + cmGlobalVisualStudio6Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio7Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio10Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio11Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio71Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio8Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio9Generator::NewFactory()); + this->Generators.push_back( + cmGlobalBorlandMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalNMakeMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalJOMMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalWatcomWMakeGenerator::NewFactory()); # endif - this->Generators[cmGlobalMSYSMakefileGenerator::GetActualName()] = - &cmGlobalMSYSMakefileGenerator::New; - this->Generators[cmGlobalMinGWMakefileGenerator::GetActualName()] = - &cmGlobalMinGWMakefileGenerator::New; + this->Generators.push_back( + cmGlobalMSYSMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalMinGWMakefileGenerator::NewFactory()); #endif - this->Generators[cmGlobalUnixMakefileGenerator3::GetActualName()] = - &cmGlobalUnixMakefileGenerator3::New; - this->Generators[cmGlobalNinjaGenerator::GetActualName()] = - &cmGlobalNinjaGenerator::New; + this->Generators.push_back( + cmGlobalUnixMakefileGenerator3::NewFactory()); + this->Generators.push_back( + cmGlobalNinjaGenerator::NewFactory()); #ifdef CMAKE_USE_XCODE - this->Generators[cmGlobalXCodeGenerator::GetActualName()] = - &cmGlobalXCodeGenerator::New; + this->Generators.push_back( + cmGlobalXCodeGenerator::NewFactory()); #endif } @@ -2696,17 +2772,15 @@ void cmake::GetPropertiesDocumentation(std::map& v) { - for(RegisteredGeneratorsMap::const_iterator i = this->Generators.begin(); - i != this->Generators.end(); ++i) + for(RegisteredGeneratorsVector::const_iterator i = + this->Generators.begin(); i != this->Generators.end(); ++i) { cmDocumentationEntry e; - cmGlobalGenerator* generator = (i->second)(); - generator->GetDocumentation(e); - delete generator; + (*i)->GetDocumentation(e); v.push_back(e); } - for(RegisteredExtraGeneratorsMap::const_iterator - i = this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i) + for(RegisteredExtraGeneratorsMap::const_iterator i = + this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i) { cmDocumentationEntry e; cmExternalMakefileProjectGenerator* generator = (i->second)(); @@ -2789,7 +2863,7 @@ int cmake::CheckBuildSystem() cmake cm; cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - std::auto_ptr lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr lg(gg.CreateLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); if(!mf->ReadListFile(0, this->CheckBuildSystemArgument.c_str()) || cmSystemTools::GetErrorOccuredFlag()) @@ -2815,11 +2889,11 @@ int cmake::CheckBuildSystem() } // Create the generator and use it to clear the dependencies. - std::auto_ptr + cmsys::auto_ptr ggd(this->CreateGlobalGenerator(genName)); if(ggd.get()) { - std::auto_ptr lgd(ggd->CreateLocalGenerator()); + cmsys::auto_ptr lgd(ggd->CreateLocalGenerator()); lgd->ClearDependencies(mf, verbose); } } @@ -3062,7 +3136,7 @@ void cmake::MarkCliAsUsed(const std::string& variable) void cmake::GenerateGraphViz(const char* fileName) const { #ifdef CMAKE_BUILD_WITH_CMAKE - std::auto_ptr gvWriter( + cmsys::auto_ptr gvWriter( new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators())); std::string settingsFile = this->GetHomeOutputDirectory(); @@ -3283,6 +3357,12 @@ int cmake::ExecuteLinkScript(std::vector& args) int result = 0; while(result == 0 && cmSystemTools::GetLineFromStream(fin, command)) { + // Skip empty command lines. + if(command.find_first_not_of(" \t") == command.npos) + { + continue; + } + // Setup this command line. const char* cmd[2] = {command.c_str(), 0}; cmsysProcess_SetCommand(cp, cmd); @@ -3536,6 +3616,13 @@ void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope, chained); } +bool cmake::GetIsPropertyDefined(const char *name, + cmProperty::ScopeType scope) +{ + return this->PropertyDefinitions[scope].find(name) != + this->PropertyDefinitions[scope].end(); +} + cmPropertyDefinition *cmake ::GetPropertyDefinition(const char *name, cmProperty::ScopeType scope) @@ -3949,10 +4036,18 @@ static bool cmakeCheckStampFile(const char* stampName) } // The build system is up to date. The stamp file has been removed - // by the VS IDE due to a "rebuild" request. Just restore it. - std::ofstream stamp(stampName); + // by the VS IDE due to a "rebuild" request. Restore it atomically. + cmOStringStream stampTempStream; + stampTempStream << stampName << ".tmp" << cmSystemTools::RandomSeed(); + std::string stampTempString = stampTempStream.str(); + const char* stampTemp = stampTempString.c_str(); + { + // TODO: Teach cmGeneratedFileStream to use a random temp file (with + // multiple tries in unlikely case of conflict) and use that here. + std::ofstream stamp(stampTemp); stamp << "# CMake generation timestamp file this directory.\n"; - if(stamp) + } + if(cmSystemTools::RenameFile(stampTemp, stampName)) { // Notify the user why CMake is not re-running. It is safe to // just print to stdout here because this code is only reachable @@ -3963,6 +4058,7 @@ static bool cmakeCheckStampFile(const char* stampName) } else { + cmSystemTools::RemoveFile(stampTemp); cmSystemTools::Error("Cannot restore timestamp ", stampName); return false; } @@ -3998,6 +4094,29 @@ static bool cmakeCheckStampList(const char* stampList) return true; } +//---------------------------------------------------------------------------- +int cmake::WindowsCEEnvironment(const char* version, const std::string& name) +{ +#if defined(CMAKE_HAVE_VS_GENERATORS) + cmVisualStudioWCEPlatformParser parser(name.c_str()); + parser.ParseVersion(version); + if (parser.Found()) + { + std::cout << "@echo off" << std::endl; + std::cout << "echo Environment Selection: " << name << std::endl; + std::cout << "set PATH=" << parser.GetPathDirectories() << std::endl; + std::cout << "set INCLUDE=" << parser.GetIncludeDirectories() < gen( + cmsys::auto_ptr gen( this->CreateGlobalGenerator(it.GetValue())); std::string output; std::string projName; diff --git a/Source/cmake.h b/Source/cmake.h index 94c6f128f..63065a17c 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -17,6 +17,7 @@ #include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" +class cmGlobalGeneratorFactory; class cmGlobalGenerator; class cmLocalGenerator; class cmCacheManager; @@ -186,6 +187,14 @@ class cmake ///! Get the names of the current registered generators void GetRegisteredGenerators(std::vector& names); + ///! Set the name of the selected generator-specific toolset. + void SetGeneratorToolset(std::string const& ts) + { this->GeneratorToolset = ts; } + + ///! Get the name of the selected generator-specific toolset. + std::string const& GetGeneratorToolset() const + { return this->GeneratorToolset; } + ///! get the cmCachemManager used by this invocation of cmake cmCacheManager *GetCacheManager() { return this->CacheManager; } @@ -340,6 +349,8 @@ class cmake bool chain = false, const char *variableGroup = 0); + bool GetIsPropertyDefined(const char *name, cmProperty::ScopeType scope); + // get property definition cmPropertyDefinition *GetPropertyDefinition (const char *name, cmProperty::ScopeType scope); @@ -396,12 +407,9 @@ protected: cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)(); typedef std::map RegisteredExtraGeneratorsMap; - - typedef cmGlobalGenerator* (*CreateGeneratorFunctionType)(); - typedef std::map RegisteredGeneratorsMap; + typedef std::vector RegisteredGeneratorsVector; RegisteredCommandsMap Commands; - RegisteredGeneratorsMap Generators; + RegisteredGeneratorsVector Generators; RegisteredExtraGeneratorsMap ExtraGenerators; void AddDefaultCommands(); void AddDefaultGenerators(); @@ -418,6 +426,7 @@ protected: std::string StartOutputDirectory; bool SuppressDevWarnings; bool DoSuppressDevWarnings; + std::string GeneratorToolset; ///! read in a cmake list file to initialize the cache void ReadListFile(const std::vector& args, const char *path); @@ -447,6 +456,8 @@ protected: std::string const& link); static int ExecuteEchoColor(std::vector& args); static int ExecuteLinkScript(std::vector& args); + static int WindowsCEEnvironment(const char* version, + const std::string& name); static int VisualStudioLink(std::vector& args, int type); static int VisualStudioLinkIncremental(std::vector& args, int type, @@ -526,6 +537,13 @@ private: "A makefile generator is responsible for generating a particular build " \ "system. Possible generator names are specified in the Generators " \ "section."},\ + {"-T ", "Specify toolset name if supported by generator.", \ + "Some CMake generators support a toolset name to be given to the " \ + "native build system to choose a compiler. " \ + "This is supported only on specific generators:\n" \ + " Visual Studio >= 10\n" \ + " Xcode >= 3.0\n" \ + "See native build system documentation for allowed toolset names."}, \ {"-Wno-dev", "Suppress developer warnings.",\ "Suppress warnings that are meant for the author"\ " of the CMakeLists.txt files."},\ diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 11a426753..42678419e 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -344,19 +344,17 @@ int main(int ac, char** av) int do_cmake(int ac, char** av) { - int nocwd = 0; - if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 ) { std::cerr << "Current working directory cannot be established." << std::endl; - nocwd = 1; + return 1; } #ifdef CMAKE_BUILD_WITH_CMAKE cmDocumentation doc; doc.addCMakeStandardDocSections(); - if(doc.CheckOptions(ac, av, "-E") || nocwd) + if(doc.CheckOptions(ac, av, "-E")) { // Construct and print requested documentation. cmake hcm; @@ -424,7 +422,7 @@ int do_cmake(int ac, char** av) return result; } #else - if ( nocwd || ac == 1 ) + if ( ac == 1 ) { std::cout << "Bootstrap CMake should not be used outside CMake build process." diff --git a/Source/cmakewizard.cxx b/Source/cmakewizard.cxx index cd427cb40..749f669d0 100644 --- a/Source/cmakewizard.cxx +++ b/Source/cmakewizard.cxx @@ -137,7 +137,7 @@ int cmakewizard::RunWizard(std::vector const& args) } } else - { + { if(this->ShowAdvanced || !i.GetPropertyAsBool("ADVANCED")) { this->AskUser(key.c_str(), i); diff --git a/Source/cmakewizard.h b/Source/cmakewizard.h index fcb2c7ae2..0c8dba93c 100644 --- a/Source/cmakewizard.h +++ b/Source/cmakewizard.h @@ -18,24 +18,24 @@ class cmakewizard public: cmakewizard(); virtual ~cmakewizard() {} - /** + /** * Prompt the user to see if they want to see advanced entries. */ virtual bool AskAdvanced(); - + /** * Prompt the User for a new value for key, the answer is put in entry. */ virtual void AskUser(const char* key, cmCacheManager::CacheIterator& iter); ///! Show a message to wait for cmake to run. virtual void ShowMessage(const char*); - - /** - * Run cmake in wizard mode. This will coninue to ask the user questions + + /** + * Run cmake in wizard mode. This will coninue to ask the user questions * until there are no more entries in the cache. */ int RunWizard(std::vectorconst& args); - + private: bool ShowAdvanced; }; diff --git a/Source/cmakexbuild.cxx b/Source/cmakexbuild.cxx index 8eaae4795..9aaeeaa4d 100644 --- a/Source/cmakexbuild.cxx +++ b/Source/cmakexbuild.cxx @@ -33,7 +33,7 @@ int RunXCode(std::vector& argv, bool& hitbug) int pipe = cmSystemTools::WaitForLine(cp, line, 100.0, out, err); while(pipe != cmsysProcess_Pipe_None) { - if(line.find("/bin/sh: bad interpreter: Text file busy") + if(line.find("/bin/sh: bad interpreter: Text file busy") != line.npos) { hitbug = true; @@ -69,7 +69,7 @@ int RunXCode(std::vector& argv, bool& hitbug) } int main(int ac, char*av[]) -{ +{ std::vector argv; argv.push_back("xcodebuild"); for(int i =1; i < ac; i++) diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx index 69df88d2a..04dab59d0 100644 --- a/Source/cmcldeps.cxx +++ b/Source/cmcldeps.cxx @@ -237,10 +237,14 @@ int main() { // needed to suppress filename output of msvc tools std::string srcfilename; + { std::string::size_type pos = srcfile.rfind("\\"); - if (pos != std::string::npos) { + if (pos == std::string::npos) { + srcfilename = srcfile; + } else { srcfilename = srcfile.substr(pos + 1); } + } std::string nol = " /nologo "; std::string show = " /showIncludes "; @@ -264,10 +268,12 @@ int main() { // call cl in object dir so the .i is generated there std::string objdir; + { std::string::size_type pos = objfile.rfind("\\"); if (pos != std::string::npos) { objdir = objfile.substr(0, pos); } + } // extract dependencies with cl.exe int exit_code = process(srcfilename, dfile, objfile, diff --git a/Source/cmparseMSBuildXML.py b/Source/cmparseMSBuildXML.py index 4877e5913..35b55ca25 100755 --- a/Source/cmparseMSBuildXML.py +++ b/Source/cmparseMSBuildXML.py @@ -6,10 +6,13 @@ # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/cl.xml" # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/lib.xml" # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/link.xml" +# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/cl.xml" +# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/lib.xml" +# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/link.xml" # # BoolProperty true|false # simple example: -# # # @@ -67,7 +70,7 @@ # MaxSpeed # example for O1 would be this: # MinSpace -# +# # StringListProperty # # @@ -130,7 +133,7 @@ class Property: if document is not None: self.populate(document) pass - + #document = the dom file that's root node is the Property node (ex. if you were parsing a BoolProperty the root node should be something like #spaces = do not use def populate(self,document, spaces = ""): @@ -148,16 +151,16 @@ class Property: self.argumentProperty = child.getAttribute("Property") self.argumentIsRequired = child.getAttribute("IsRequired") if child.nodeName == self.prefix_type+"Value": - va = Property(self.prefix_type,["Name","Switch"]) + va = Property(self.prefix_type,["Name","DisplayName","Switch"]) va.suffix_type = "Value" va.populate(child) self.values.append(va) self.populate(child,spaces+"----") pass - #toString function + #toString function def __str__(self): - toReturn = self.prefix_type+self.suffix_type+":" + toReturn = self.prefix_type+self.suffix_type+":" for i in self.attributeNames: toReturn += "\n "+i+": "+self.attributes[i] if self.argumentProperty != "": @@ -191,7 +194,7 @@ class MSBuildToCMake: # self.Properties.append(Property("",[],child)) # #Replace with the name of the new property (ex. if property is StringProperty replace with String) - #Replace with a list of attributes in your property's root node + #Replace with a list of attributes in your property's root node #in the __init__ function add the line self.Properties = [] # #That is all that is required to add new properties @@ -203,11 +206,11 @@ class MSBuildToCMake: if child.nodeName == "EnumProperty": self.enumProperties.append(Property("Enum",["Name","Category"],child)) if child.nodeName == "StringProperty": - self.stringProperties.append(Property("String",["Name","Subtype","Separator","Category","Visible","IncludeInCommandLine","Switch","ReadOnly"],child)) + self.stringProperties.append(Property("String",["Name","Subtype","Separator","Category","Visible","IncludeInCommandLine","Switch","DisplayName","ReadOnly"],child)) if child.nodeName == "StringListProperty": - self.stringListProperties.append(Property("StringList",["Name","Category","Switch","Subtype"],child)) + self.stringListProperties.append(Property("StringList",["Name","Category","Switch","DisplayName","Subtype"],child)) if child.nodeName == "BoolProperty": - self.boolProperties.append(Property("Bool",["ReverseSwitch","Name","Category","Switch","SwitchPrefix","IncludeInCommandLine"],child)) + self.boolProperties.append(Property("Bool",["ReverseSwitch","Name","Category","Switch","DisplayName","SwitchPrefix","IncludeInCommandLine"],child)) if child.nodeName == "IntProperty": self.intProperties.append(Property("Int",["Name","Category","Visible"],child)) self.populate(child,spaces+"----") @@ -226,17 +229,17 @@ class MSBuildToCMake: for j in i.values: #hardcore Brad King's manual fixes for cmVS10CLFlagTable.h if i.attributes["Name"] == "PrecompiledHeader" and j.attributes["Switch"] != "": - toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.DisplayName+"\", \""+j.attributes["Name"]+"\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n" + toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.attributes["DisplayName"]+"\", \""+j.attributes["Name"]+"\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n" else: #default (normal, non-hardcoded) case - toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.DisplayName+"\", \""+j.attributes["Name"]+"\", 0},\n" + toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.attributes["DisplayName"]+"\", \""+j.attributes["Name"]+"\", 0},\n" toReturn += "\n" if lastProp != {}: for j in lastProp.values: - toReturn+=" {\""+lastProp.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.DisplayName+"\", \""+j.attributes["Name"]+"\", 0},\n" + toReturn+=" {\""+lastProp.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.attributes["DisplayName"]+"\", \""+j.attributes["Name"]+"\", 0},\n" toReturn += "\n" - + toReturn += "\n //Bool Properties\n" for i in self.boolProperties: if i.argumentProperty == "": @@ -250,17 +253,17 @@ class MSBuildToCMake: if i.argumentProperty != "": if i.attributes["ReverseSwitch"] != "": toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \"\", \"false\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n" - toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \""+i.DisplayName+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n" + toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \""+i.attributes["DisplayName"]+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n" if i.attributes["Switch"] != "": toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\", \"\", \"true\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n" - toReturn += " {\""+i.argumentProperty+"\", \""+i.attributes["Switch"]+"\", \""+i.DisplayName+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n" - + toReturn += " {\""+i.argumentProperty+"\", \""+i.attributes["Switch"]+"\", \""+i.attributes["DisplayName"]+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n" + toReturn += "\n //String List Properties\n" for i in self.stringListProperties: if i.attributes["Switch"] == "": toReturn += " // Skip [" + i.attributes["Name"] + "] - no command line Switch.\n"; else: - toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\",\n \""+i.DisplayName+"\",\n \"\", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},\n" + toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\",\n \""+i.attributes["DisplayName"]+"\",\n \"\", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},\n" toReturn += "\n //String Properties\n" for i in self.stringProperties: @@ -276,7 +279,7 @@ class MSBuildToCMake: else: toReturn += " // Skip [" + i.attributes["Name"] + "] - no command line Switch.\n"; else: - toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+i.attributes["Separator"]+"\",\n \""+i.DisplayName+"\",\n \"\", cmVS7FlagTable::UserValue},\n" + toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+i.attributes["Separator"]+"\",\n \""+i.attributes["DisplayName"]+"\",\n \"\", cmVS7FlagTable::UserValue},\n" toReturn += " {0,0,0,0,0}\n};" return toReturn @@ -289,7 +292,7 @@ class MSBuildToCMake: for p in allList: for i in p: toReturn += "==================================================\n"+str(i).replace("\n","\n ")+"\n==================================================\n" - + return toReturn ########################################################################################### @@ -305,8 +308,8 @@ def main(argv): for i in range(0,len(argv)): if argv[i] == "-x": xml_file = argv[i+1] - if argv[i] == "-h": - print help + if argv[i] == "-h": + print help sys.exit(0) pass if xml_file == None: diff --git a/Source/cmw9xcom.cxx b/Source/cmw9xcom.cxx index 4ba274965..ab238d539 100644 --- a/Source/cmw9xcom.cxx +++ b/Source/cmw9xcom.cxx @@ -22,7 +22,7 @@ int main (int argc, char *argv[]) return 1; } std::string arg = argv[1]; - if ( (arg.find_first_of(" ") != arg.npos) && + if ( (arg.find_first_of(" ") != arg.npos) && (arg.find_first_of("\"") == arg.npos) ) { arg = "\"" + arg + "\""; @@ -31,14 +31,14 @@ int main (int argc, char *argv[]) int cc; for ( cc = 2; cc < argc; cc ++ ) { - std::string arg = argv[cc]; - if ( (arg.find_first_of(" ") != arg.npos) && - (arg.find_first_of("\"") == arg.npos) ) + std::string nextArg = argv[cc]; + if ( (nextArg.find_first_of(" ") != nextArg.npos) && + (nextArg.find_first_of("\"") == nextArg.npos) ) { - arg = "\"" + arg + "\""; + nextArg = "\"" + nextArg + "\""; } command += " "; - command += arg; + command += nextArg; } return cmWin32ProcessExecution::Windows9xHack(command.c_str()); diff --git a/Source/ctest.cxx b/Source/ctest.cxx index d65077748..3e63183eb 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -187,6 +187,7 @@ static const char * cmDocumentationOptions[][3] = {"--build-two-config", "Run CMake twice", "" }, {"--build-exe-dir", "Specify the directory for the executable.", "" }, {"--build-generator", "Specify the generator to use.", "" }, + {"--build-generator-toolset", "Specify the generator-specific toolset.",""}, {"--build-project", "Specify the name of the project to build.", "" }, {"--build-makeprogram", "Specify the make program to use.", "" }, {"--build-noclean", "Skip the make clean step.", "" }, @@ -273,14 +274,13 @@ int main (int argc, char *argv[]) return cmCTestLaunch::Main(argc, argv); } - int nocwd = 0; cmCTest inst; if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 ) { cmCTestLog(&inst, ERROR_MESSAGE, "Current working directory cannot be established." << std::endl); - nocwd = 1; + return 1; } // If there is a testing input file, check for documentation options @@ -298,7 +298,7 @@ int main (int argc, char *argv[]) } cmDocumentation doc; doc.addCTestStandardDocSections(); - if(doc.CheckOptions(argc, argv) || nocwd) + if(doc.CheckOptions(argc, argv)) { // Construct and print requested documentation. std::vector commands; diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index a132357f3..124b8aca0 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -116,7 +116,6 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) SET(KWSYS_USE_MD5 1) SET(KWSYS_USE_Process 1) SET(KWSYS_USE_RegularExpression 1) - SET(KWSYS_USE_Registry 1) SET(KWSYS_USE_System 1) SET(KWSYS_USE_SystemTools 1) SET(KWSYS_USE_CommandLineArguments 1) @@ -509,19 +508,28 @@ ENDIF(KWSYS_USE_FundamentalType) IF(KWSYS_USE_IOStream) # Determine whether iostreams support long long. + SET(KWSYS_PLATFORM_CXX_TEST_DEFINES + -DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI} + -DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD}) IF(KWSYS_CXX_HAS_LONG_LONG) - SET(KWSYS_PLATFORM_CXX_TEST_DEFINES - -DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI} - -DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD}) KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_ISTREAM_LONG_LONG "Checking if istream supports long long" DIRECT) KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_OSTREAM_LONG_LONG "Checking if ostream supports long long" DIRECT) - SET(KWSYS_PLATFORM_CXX_TEST_DEFINES) ELSE() SET(KWSYS_IOS_HAS_ISTREAM_LONG_LONG 0) SET(KWSYS_IOS_HAS_OSTREAM_LONG_LONG 0) ENDIF() + IF(KWSYS_CXX_HAS___INT64) + KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_ISTREAM___INT64 + "Checking if istream supports __int64" DIRECT) + KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_OSTREAM___INT64 + "Checking if ostream supports __int64" DIRECT) + ELSE() + SET(KWSYS_IOS_HAS_ISTREAM___INT64 0) + SET(KWSYS_IOS_HAS_OSTREAM___INT64 0) + ENDIF() + SET(KWSYS_PLATFORM_CXX_TEST_DEFINES) ENDIF(KWSYS_USE_IOStream) IF(KWSYS_NAMESPACE MATCHES "^kwsys$") @@ -566,9 +574,106 @@ IF(KWSYS_USE_SystemTools) ENDIF() IF(KWSYS_USE_SystemInformation) - SET_PROPERTY(SOURCE SystemInformation.cxx PROPERTY - COMPILE_DEFINITIONS KWSYS_USE_LONG_LONG=${KWSYS_USE_LONG_LONG} - KWSYS_USE___INT64=${KWSYS_USE___INT64}) + SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P}) + IF(NOT CYGWIN) + INCLUDE(CheckIncludeFiles) + CHECK_INCLUDE_FILES("sys/types.h;ifaddrs.h" KWSYS_SYS_HAS_IFADDRS_H) + IF(KWSYS_SYS_HAS_IFADDRS_H) + SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_SYS_HAS_IFADDRS_H=1) + ENDIF() + ENDIF() + IF(WIN32) + INCLUDE(CheckSymbolExists) + SET(CMAKE_REQUIRED_LIBRARIES Psapi) + CHECK_SYMBOL_EXISTS(GetProcessMemoryInfo "windows.h;psapi.h" KWSYS_SYS_HAS_PSAPI) + UNSET(CMAKE_REQUIRED_LIBRARIES) + IF(KWSYS_SYS_HAS_PSAPI) + SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_SYS_HAS_PSAPI=1) + IF(MSVC70 OR MSVC71) + # Suppress LNK4089: all references to 'PSAPI.DLL' discarded by /OPT:REF + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /IGNORE:4089") + ENDIF() + ENDIF() + ENDIF() + IF(CMAKE_SYSTEM MATCHES "HP-UX") + CHECK_INCLUDE_FILES("sys/mpctl.h" KWSYS_SYS_HAS_MPCTL_H) + IF(KWSYS_SYS_HAS_MPCTL_H) + SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_SYS_HAS_MPCTL_H=1) + ENDIF() + ENDIF() + IF(CMAKE_SYSTEM MATCHES "BSD") + CHECK_INCLUDE_FILES("machine/cpu.h" KWSYS_SYS_HAS_MACHINE_CPU_H) + IF(KWSYS_SYS_HAS_MACHINE_CPU_H) + SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_SYS_HAS_MACHINE_CPU_H=1) + ENDIF() + ENDIF() + IF(KWSYS_LFS_AVAILABLE AND NOT KWSYS_LFS_DISABLE) + SET(KWSYS_PLATFORM_CXX_TEST_DEFINES -DKWSYS_HAS_LFS=1) + ENDIF() + KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_RLIMIT64 + "Checking whether CXX compiler has rlimit64" DIRECT) + SET(KWSYS_PLATFORM_CXX_TEST_DEFINES) + IF(KWSYS_CXX_HAS_RLIMIT64) + SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_CXX_HAS_RLIMIT64=1) + ENDIF() + KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ATOL + "Checking whether CXX compiler has atol" DIRECT) + IF(KWSYS_CXX_HAS_ATOL) + SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_CXX_HAS_ATOL=1) + ENDIF() + KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ATOLL + "Checking whether CXX compiler has atoll" DIRECT) + IF(KWSYS_CXX_HAS_ATOLL) + SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_CXX_HAS_ATOLL=1) + ENDIF() + KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS__ATOI64 + "Checking whether CXX compiler has _atoi64" DIRECT) + IF(KWSYS_CXX_HAS__ATOI64) + SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_CXX_HAS__ATOI64=1) + ENDIF() + IF(BORLAND) + KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_BORLAND_ASM + "Checking whether Borland CXX compiler supports assembler instructions" DIRECT) + IF(KWSYS_CXX_HAS_BORLAND_ASM) + SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_CXX_HAS_BORLAND_ASM=1) + KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_BORLAND_ASM_CPUID + "Checking whether Borland CXX compiler supports CPUID assembler instruction" DIRECT) + IF(KWSYS_CXX_HAS_BORLAND_ASM_CPUID) + SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_CXX_HAS_BORLAND_ASM_CPUID=1) + ENDIF() + ENDIF() + ENDIF() + IF(KWSYS_USE___INT64) + SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_USE___INT64=1) + ENDIF() + IF(KWSYS_USE_LONG_LONG) + SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_USE_LONG_LONG=1) + ENDIF() + IF(KWSYS_IOS_HAS_OSTREAM_LONG_LONG) + SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_IOS_HAS_OSTREAM_LONG_LONG=1) + ENDIF() + IF(KWSYS_IOS_HAS_OSTREAM___INT64) + SET_PROPERTY(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_IOS_HAS_OSTREAM___INT64=1) + ENDIF() + IF(KWSYS_BUILD_SHARED) + SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY + COMPILE_DEFINITIONS KWSYS_BUILD_SHARED=1) + ENDIF() ENDIF() #----------------------------------------------------------------------------- @@ -686,7 +791,7 @@ SET(KWSYS_HXX_FILES Configure String # Add selected C++ classes. SET(cppclasses Directory DynamicLoader Glob RegularExpression SystemTools - CommandLineArguments Registry IOStream SystemInformation + CommandLineArguments IOStream SystemInformation ) FOREACH(cpp ${cppclasses}) IF(KWSYS_USE_${cpp}) @@ -724,12 +829,8 @@ SET(KWSYS_CXX_SRCS) # Add the proper sources for this platform's Process implementation. IF(KWSYS_USE_Process) IF(NOT UNIX) - # Use the Windows implementation. We need the encoded forwarding executable. - SET(KWSYS_C_SRCS ${KWSYS_C_SRCS} ProcessWin32.c - ${PROJECT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c) - SET_SOURCE_FILES_PROPERTIES( - ${PROJECT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c - PROPERTIES GENERATED 1) + # Use the Windows implementation. + SET(KWSYS_C_SRCS ${KWSYS_C_SRCS} ProcessWin32.c) ELSE(NOT UNIX) # Use the UNIX implementation. SET(KWSYS_C_SRCS ${KWSYS_C_SRCS} ProcessUNIX.c) @@ -802,9 +903,12 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS) TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ${CMAKE_DL_LIBS}) ENDIF(UNIX) ENDIF(KWSYS_USE_DynamicLoader) - + IF(KWSYS_USE_SystemInformation AND WIN32) TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ws2_32) + IF(KWSYS_SYS_HAS_PSAPI) + TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} Psapi) + ENDIF() ENDIF(KWSYS_USE_SystemInformation AND WIN32) # Apply user-defined target properties to the library. @@ -842,49 +946,22 @@ ENDIF(KWSYS_ENABLE_C AND KWSYS_C_SRCS) # line to configure the namespace in the C and C++ source files. ADD_DEFINITIONS("-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}") +# Disable deprecation warnings for standard C functions. +IF(MSVC OR (WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")) + ADD_DEFINITIONS( + -D_CRT_NONSTDC_NO_DEPRECATE + -D_CRT_SECURE_NO_DEPRECATE + -D_CRT_SECURE_NO_WARNINGS + -D_SCL_SECURE_NO_DEPRECATE + ) +ENDIF() + IF(KWSYS_USE_String) # Activate code in "String.c". See the comment in the source. SET_SOURCE_FILES_PROPERTIES(String.c PROPERTIES COMPILE_FLAGS "-DKWSYS_STRING_C") ENDIF(KWSYS_USE_String) -#----------------------------------------------------------------------------- -# Process execution on windows needs to build a forwarding executable -# that works around a Win9x bug. We encode the executable into a C -# file and build it into the library. Win9x platforms reproduce the -# executable into a temporary directory when it is needed. -IF(KWSYS_USE_Process) - IF(NOT UNIX) - # Build the forwarding executable itself and a program that will - # encode it into a C file. - ADD_EXECUTABLE(${KWSYS_NAMESPACE}ProcessFwd9x ProcessFwd9x.c) - ADD_EXECUTABLE(${KWSYS_NAMESPACE}EncodeExecutable EncodeExecutable.c) - SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}ProcessFwd9x PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}EncodeExecutable PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}ProcessFwd9x PROPERTY LABELS ${KWSYS_LABELS_EXE}) - SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}EncodeExecutable PROPERTY LABELS ${KWSYS_LABELS_EXE}) - - SET(CFG_INTDIR "/${CMAKE_CFG_INTDIR}") - IF(CMAKE_BUILD_TOOL MATCHES "make") - SET(CFG_INTDIR "") - ENDIF(CMAKE_BUILD_TOOL MATCHES "make") - - # Take advantage of a better custom command syntax if possible. - SET(CMD ${CMAKE_CURRENT_BINARY_DIR}${CFG_INTDIR}/${KWSYS_NAMESPACE}EncodeExecutable.exe) - SET(FWD ${CMAKE_CURRENT_BINARY_DIR}${CFG_INTDIR}/${KWSYS_NAMESPACE}ProcessFwd9x.exe) - ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c - COMMAND ${CMD} - ARGS ${FWD} ${CMAKE_CURRENT_BINARY_DIR}/${KWSYS_NAMESPACE}ProcessFwd9xEnc.c - ${KWSYS_NAMESPACE} ProcessFwd9x - DEPENDS ${CMD} ${FWD}) - - # Make sure build occurs in proper order. - ADD_DEPENDENCIES(${KWSYS_NAMESPACE} ${KWSYS_NAMESPACE}ProcessFwd9x - ${KWSYS_NAMESPACE}EncodeExecutable) - ENDIF(NOT UNIX) -ENDIF(KWSYS_USE_Process) - #----------------------------------------------------------------------------- # Setup testing if not being built as part of another project. IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) @@ -923,7 +1000,6 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) ) ENDIF(NOT WATCOM) SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} - testRegistry testIOS testSystemTools testCommandLineArguments @@ -1027,8 +1103,6 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) # We expect test to fail SET_TESTS_PROPERTIES(kwsys.testFail PROPERTIES WILL_FAIL ON) GET_TEST_PROPERTY(kwsys.testFail WILL_FAIL wfv) - SET_TESTS_PROPERTIES(kwsys.testRegistry PROPERTIES FAIL_REGULAR_EXPRESSION "ERROR_NOT_VALGRIND;FAIL;Test failed") - SET_TESTS_PROPERTIES(kwsys.testRegistry PROPERTIES PASS_REGULAR_EXPRESSION "Test passed") SET_TESTS_PROPERTIES(kwsys.testFail PROPERTIES MEASUREMENT "Some Key=Some Value") MESSAGE(STATUS "GET_TEST_PROPERTY returned: ${wfv}") ENDIF() diff --git a/Source/kwsys/CPU.h.in b/Source/kwsys/CPU.h.in index ecd29d133..2e1a584b1 100644 --- a/Source/kwsys/CPU.h.in +++ b/Source/kwsys/CPU.h.in @@ -98,6 +98,14 @@ #elif defined(__SYSC_ZARCH__) # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG +/* Aarch64 */ +#elif defined(__aarch64__) +# if !defined(__AARCH64EB__) +# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE +# else +# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG +# endif + /* Unknown CPU */ #else # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID 0 diff --git a/Source/kwsys/CTestConfig.cmake b/Source/kwsys/CTestConfig.cmake index 9ab6ed86c..d977b472a 100644 --- a/Source/kwsys/CTestConfig.cmake +++ b/Source/kwsys/CTestConfig.cmake @@ -1,6 +1,6 @@ #============================================================================= # KWSys - Kitware System Library -# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium +# Copyright 2000-2012 Kitware, Inc., Insight Software Consortium # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -9,10 +9,9 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -set (CTEST_PROJECT_NAME "kwsys") -set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_PROJECT_NAME "KWSys") +set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "www.cdash.org") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Source/kwsys/Configure.h.in b/Source/kwsys/Configure.h.in index 15986cfea..70cf8442b 100644 --- a/Source/kwsys/Configure.h.in +++ b/Source/kwsys/Configure.h.in @@ -37,20 +37,6 @@ /* Whether kwsys namespace is "kwsys". */ #define @KWSYS_NAMESPACE@_NAME_IS_KWSYS @KWSYS_NAME_IS_KWSYS@ -/* If we are building a kwsys .c or .cxx file, suppress the Microsoft - deprecation warnings. */ -#if defined(KWSYS_NAMESPACE) -# ifndef _CRT_NONSTDC_NO_DEPRECATE -# define _CRT_NONSTDC_NO_DEPRECATE -# endif -# ifndef _CRT_SECURE_NO_DEPRECATE -# define _CRT_SECURE_NO_DEPRECATE -# endif -# ifndef _SCL_SECURE_NO_DEPRECATE -# define _SCL_SECURE_NO_DEPRECATE -# endif -#endif - /* Whether Large File Support is requested. */ #define @KWSYS_NAMESPACE@_LFS_REQUESTED @KWSYS_LFS_REQUESTED@ diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx index c4ee09551..fd83752c0 100644 --- a/Source/kwsys/DynamicLoader.cxx +++ b/Source/kwsys/DynamicLoader.cxx @@ -428,6 +428,58 @@ const char* DynamicLoader::LastError() } // namespace KWSYS_NAMESPACE #endif +#ifdef __MINT__ +#define DYNAMICLOADER_DEFINED 1 +#define _GNU_SOURCE /* for program_invocation_name */ +#include +#include +#include +#include + +namespace KWSYS_NAMESPACE +{ + +//---------------------------------------------------------------------------- +DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const char* libname ) +{ + char *name = (char *)calloc(1, strlen(libname) + 1); + dld_init(program_invocation_name); + strncpy(name, libname, strlen(libname)); + dld_link(libname); + return (void *)name; +} + +//---------------------------------------------------------------------------- +int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) +{ + dld_unlink_by_file((char *)lib, 0); + free(lib); + return 0; +} + +//---------------------------------------------------------------------------- +DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( + DynamicLoader::LibraryHandle lib, const char* sym) +{ + // Hack to cast pointer-to-data to pointer-to-function. + union + { + void* pvoid; + DynamicLoader::SymbolPointer psym; + } result; + result.pvoid = dld_get_symbol(sym); + return result.psym; +} + +//---------------------------------------------------------------------------- +const char* DynamicLoader::LastError() +{ + return dld_strerror(dld_errno); +} + +} // namespace KWSYS_NAMESPACE +#endif + // --------------------------------------------------------------- // 6. Implementation for default UNIX machines. // if nothing has been defined then use this diff --git a/Source/kwsys/EncodeExecutable.c b/Source/kwsys/EncodeExecutable.c deleted file mode 100644 index bc30568ff..000000000 --- a/Source/kwsys/EncodeExecutable.c +++ /dev/null @@ -1,114 +0,0 @@ -/*============================================================================ - KWSys - Kitware System Library - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include -#ifdef __WATCOMC__ -#define _unlink unlink -#endif -int main(int argc, char* argv[]) -{ - FILE* ifp; - FILE* ofp; - int i; - int n; - int count = 0; - unsigned char buffer[1024]; - - /* Check arguments. */ - if(argc != 5) - { - fprintf(stderr, "Usage: %s \n", - argv[0]); - return 1; - } - - /* Open the input file. */ - ifp = fopen(argv[1], "rb"); - if(!ifp) - { - fprintf(stderr, "Cannot open input file: \"%s\"\n", argv[1]); - return 2; - } - ofp = fopen(argv[2], "w"); - if(!ofp) - { - fprintf(stderr, "Cannot open output file: \"%s\"\n", argv[2]); - fclose(ifp); - return 2; - } - - /* Prepend header comment. */ - fprintf(ofp, "/*\n * DO NOT EDIT\n * This file is generated by:\n"); - fprintf(ofp, " * %s\n */\n\n", argv[0]); - fprintf(ofp, "#include \"kwsysPrivate.h\"\n"); - fprintf(ofp, "#include KWSYS_HEADER(Configure.h)\n\n"); - fprintf(ofp, "#include \n\n"); - fprintf(ofp, "#if defined(_WIN32)\n"); - fprintf(ofp, "# include \n"); - fprintf(ofp, "#else\n"); - fprintf(ofp, "# include \n"); - fprintf(ofp, "#endif\n"); - fprintf(ofp, "\n"); - fprintf(ofp, "static void kwsys_unlink(const char* fname)\n"); - fprintf(ofp, "{\n"); - fprintf(ofp, "#if defined(__WATCOMC__)\n"); - fprintf(ofp, " unlink(fname);\n"); - fprintf(ofp, "#else\n"); - fprintf(ofp, " _unlink(fname);\n"); - fprintf(ofp, "#endif\n"); - fprintf(ofp, "}\n"); - fprintf(ofp, "\n"); - - /* Split file up in 1024-byte chunks. */ - while((n = (int)fread(buffer, 1, 1024, ifp)) > 0) - { - fprintf(ofp, "static unsigned char kwsysEncodedArray%s_%d[%d] = {\n", - argv[4], count++, n); - for(i=0; i < n-1; ++i) - { - fprintf(ofp, "0x%02X", buffer[i]); - if(i%10 == 9) - { - fprintf(ofp, ",\n"); - } - else - { - fprintf(ofp, ", "); - } - } - fprintf(ofp, "0x%02X};\n\n", buffer[n-1]); - } - fclose(ifp); - - /* Provide a function to write the data to a file. */ - fprintf(ofp, "extern %s_EXPORT int %sEncodedWriteArray%s(const char* fname)\n", - argv[3], argv[3], argv[4]); - fprintf(ofp, "{\n"); - fprintf(ofp, " FILE* ofp = fopen(fname, \"wb\");\n"); - fprintf(ofp, " if(!ofp) { return 0; }\n"); - for(i=0; i < count; ++i) - { - fprintf(ofp, " if(fwrite(kwsysEncodedArray%s_%d, 1,\n" - " sizeof(kwsysEncodedArray%s_%d), ofp) !=\n" - " sizeof(kwsysEncodedArray%s_%d))\n", - argv[4], i, argv[4], i, argv[4], i); - fprintf(ofp, " {\n"); - fprintf(ofp, " fclose(ofp);\n"); - fprintf(ofp, " kwsys_unlink(fname);\n"); - fprintf(ofp, " return 0;\n"); - fprintf(ofp, " }\n"); - } - fprintf(ofp, " fclose(ofp);\n"); - fprintf(ofp, " return 1;\n"); - fprintf(ofp, "}\n"); - fclose(ofp); - return 0; -} diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx index 513eb6408..46a7e4f44 100644 --- a/Source/kwsys/Glob.cxx +++ b/Source/kwsys/Glob.cxx @@ -399,7 +399,7 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr) if ( last_slash > 0 ) { //kwsys_ios::cout << "I can skip: " << fexpr.substr(0, last_slash) - //<< kwsys_ios::endl; + // << kwsys_ios::endl; skip = last_slash; } if ( skip == 0 ) diff --git a/Source/kwsys/IOStream.cxx b/Source/kwsys/IOStream.cxx index 57b696eb3..a31f8c846 100644 --- a/Source/kwsys/IOStream.cxx +++ b/Source/kwsys/IOStream.cxx @@ -272,6 +272,7 @@ namespace KWSYS_NAMESPACE // Create one public symbol in this object file to avoid warnings from // archivers. +void IOStreamSymbolToAvoidWarning(); void IOStreamSymbolToAvoidWarning() { } diff --git a/Source/kwsys/IOStream.hxx.in b/Source/kwsys/IOStream.hxx.in index 9eb99e058..2eeedf2ff 100644 --- a/Source/kwsys/IOStream.hxx.in +++ b/Source/kwsys/IOStream.hxx.in @@ -26,12 +26,9 @@ /* Whether ostream supports long long. */ #define @KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG @KWSYS_IOS_HAS_OSTREAM_LONG_LONG@ -/* Size of type long long and 0 if not available. */ -#define @KWSYS_NAMESPACE@_IOS_SIZEOF_LONG_LONG @KWSYS_SIZEOF_LONG_LONG@ - /* Determine whether we need to define the streaming operators for long long or __int64. */ -#if @KWSYS_NAMESPACE@_IOS_SIZEOF_LONG_LONG +#if @KWSYS_USE_LONG_LONG@ # if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG || \ !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG # define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1 @@ -136,7 +133,6 @@ operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value) /* If building a C++ file in kwsys itself, give the source file access to the macros without a configured namespace. */ #if defined(KWSYS_NAMESPACE) -# define KWSYS_IOS_SIZEOF_LONG_LONG @KWSYS_NAMESPACE@_IOS_SIZEOF_LONG_LONG # define KWSYS_IOS_HAS_ISTREAM_LONG_LONG @KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG # define KWSYS_IOS_HAS_OSTREAM_LONG_LONG @KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG # define KWSYS_IOS_NEED_OPERATORS_LL @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL diff --git a/Source/kwsys/ProcessFwd9x.c b/Source/kwsys/ProcessFwd9x.c deleted file mode 100644 index 536c54b67..000000000 --- a/Source/kwsys/ProcessFwd9x.c +++ /dev/null @@ -1,211 +0,0 @@ -/*============================================================================ - KWSys - Kitware System Library - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ - -/* - On Windows9x platforms, this executable is spawned between a parent - process and the child it is invoking to work around a bug. See the - Win32 implementation file for details. - - Future Work: This executable must be linked statically against the C - runtime library before being encoded into the library. Building it - in this way may be hard because CMake has limited abilities to build - different targets with different configurations in the same - directory. We may just have to create and encode the executable - once instead of generating it during the build. This would be an - acceptable solution because the forwarding executable should not - change very often and is pretty simple. -*/ - -#ifdef _MSC_VER -#pragma warning (push, 1) -#endif -#include -#include - -void ReportLastError(HANDLE errorPipe); - -int main() -{ - /* Process startup information for the real child. */ - STARTUPINFO si; - PROCESS_INFORMATION pi; - - /* The result of waiting for the child to exit. */ - DWORD waitResult; - - /* The child's process return code. */ - DWORD retVal; - - /* The command line used to invoke this process. */ - LPSTR commandLine = GetCommandLine(); - - /* Pointer that will be advanced to the beginning of the command - line of the real child process. */ - LPSTR cmdLine = commandLine; - - /* Handle to the error reporting pipe provided by the parent. This - is parsed off the command line. */ - HANDLE errorPipe = 0; - HANDLE errorPipeOrig = 0; - - /* Handle to the event the parent uses to tell us to resume the child. - This is parsed off the command line. */ - HANDLE resumeEvent = 0; - - /* Handle to the event the parent uses to tell us to kill the child. - This is parsed off the command line. */ - HANDLE killEvent = 0; - - /* Flag for whether to hide window of child process. */ - int hideWindow = 0; - - /* An array of the handles on which we wait when the child is - running. */ - HANDLE waitHandles[2] = {0, 0}; - - /* Move the pointer past the name of this executable. */ - if(*cmdLine == '"') - { - ++cmdLine; - while(*cmdLine && *cmdLine != '"') { ++cmdLine; } - if(*cmdLine) { ++cmdLine; } - } - else - { - while(*cmdLine && *cmdLine != ' ') { ++cmdLine; } - } - - /* Parse the error pipe handle. */ - while(*cmdLine && *cmdLine == ' ') { ++cmdLine; } - sscanf(cmdLine, "%p", &errorPipeOrig); - - /* Parse the resume event handle. */ - while(*cmdLine && *cmdLine != ' ') { ++cmdLine; } - while(*cmdLine && *cmdLine == ' ') { ++cmdLine; } - sscanf(cmdLine, "%p", &resumeEvent); - - /* Parse the kill event handle. */ - while(*cmdLine && *cmdLine != ' ') { ++cmdLine; } - while(*cmdLine && *cmdLine == ' ') { ++cmdLine; } - sscanf(cmdLine, "%p", &killEvent); - - /* Parse the hide window flag. */ - while(*cmdLine && *cmdLine != ' ') { ++cmdLine; } - while(*cmdLine && *cmdLine == ' ') { ++cmdLine; } - sscanf(cmdLine, "%d", &hideWindow); - - /* Skip to the beginning of the command line of the real child. */ - while(*cmdLine && *cmdLine != ' ') { ++cmdLine; } - while(*cmdLine && *cmdLine == ' ') { ++cmdLine; } - - /* Create a non-inherited copy of the error pipe. We do not want - the child to get it. */ - if(DuplicateHandle(GetCurrentProcess(), errorPipeOrig, - GetCurrentProcess(), &errorPipe, - 0, FALSE, DUPLICATE_SAME_ACCESS)) - { - /* Have a non-inherited duplicate. Close the inherited one. */ - CloseHandle(errorPipeOrig); - } - else - { - /* Could not duplicate handle. Report the error. */ - ReportLastError(errorPipeOrig); - return 1; - } - - /* Create the subprocess. */ - ZeroMemory(&si, sizeof(si)); - ZeroMemory(&pi, sizeof(pi)); - si.cb = sizeof(si); - si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW; - si.wShowWindow = hideWindow?SW_HIDE:SW_SHOWDEFAULT; - si.hStdInput = GetStdHandle(STD_INPUT_HANDLE); - si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); - si.hStdError = GetStdHandle(STD_ERROR_HANDLE); - if(CreateProcess(0, cmdLine, 0, 0, TRUE, CREATE_SUSPENDED, 0, 0, &si, &pi)) - { - /* Process created successfully. Close the error reporting pipe - to notify the parent of success. */ - CloseHandle(errorPipe); - } - else - { - /* Error creating the process. Report the error to the parent - process through the special error reporting pipe. */ - ReportLastError(errorPipe); - return 1; - } - - /* Wait for resume or kill event from parent. */ - waitHandles[0] = killEvent; - waitHandles[1] = resumeEvent; - waitResult = WaitForMultipleObjects(2, waitHandles, 0, INFINITE); - - /* Check what happened. */ - if(waitResult == WAIT_OBJECT_0) - { - /* We were asked to kill the child. */ - TerminateProcess(pi.hProcess, 255); - WaitForSingleObject(pi.hProcess, INFINITE); - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - return 1; - } - else - { - /* We were asked to resume the child. */ - ResumeThread(pi.hThread); - CloseHandle(pi.hThread); - } - - /* Wait for subprocess to exit or for kill event from parent. */ - waitHandles[0] = killEvent; - waitHandles[1] = pi.hProcess; - waitResult = WaitForMultipleObjects(2, waitHandles, 0, INFINITE); - - /* Check what happened. */ - if(waitResult == WAIT_OBJECT_0) - { - /* We were asked to kill the child. */ - TerminateProcess(pi.hProcess, 255); - WaitForSingleObject(pi.hProcess, INFINITE); - CloseHandle(pi.hProcess); - return 1; - } - else - { - /* The child exited. Get the return code. */ - GetExitCodeProcess(pi.hProcess, &retVal); - CloseHandle(pi.hProcess); - return retVal; - } -} - -void ReportLastError(HANDLE errorPipe) -{ - LPVOID lpMsgBuf; - DWORD n; - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR) &lpMsgBuf, - 0, - NULL - ); - WriteFile(errorPipe, lpMsgBuf, strlen(lpMsgBuf)+1, &n, 0); - LocalFree( lpMsgBuf ); -} diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index 9c66a4486..fc9e8bf67 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -63,10 +63,6 @@ do. #include /* DIR, dirent */ #include /* isspace */ -#ifdef __HAIKU__ -#undef __BEOS__ -#endif - #if defined(__VMS) # define KWSYSPE_VMS_NONBLOCK , O_NONBLOCK #else @@ -106,7 +102,7 @@ static inline void kwsysProcess_usleep(unsigned int msec) * pipes' file handles to be non-blocking and just poll them directly * without select(). */ -#if !defined(__BEOS__) && !defined(__VMS) +#if !defined(__BEOS__) && !defined(__VMS) && !defined(__MINT__) # define KWSYSPE_USE_SELECT 1 #endif @@ -422,9 +418,10 @@ int kwsysProcess_AddCommand(kwsysProcess* cp, char const* const* command) parse it. */ newCommands[cp->NumberOfCommands] = kwsysSystem_Parse_CommandForUnix(*command, 0); - if(!newCommands[cp->NumberOfCommands]) + if(!newCommands[cp->NumberOfCommands] || + !newCommands[cp->NumberOfCommands][0]) { - /* Out of memory. */ + /* Out of memory or no command parsed. */ free(newCommands); return 0; } @@ -2732,6 +2729,7 @@ static void kwsysProcessesSignalHandler(int signum kwsysProcess* cp = kwsysProcesses.Processes[i]; kwsysProcess_ssize_t status= read(cp->PipeReadEnds[KWSYSPE_PIPE_SIGNAL], &buf, 1); + (void)status; status=write(cp->SignalPipe, &buf, 1); (void)status; } diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c index 5aa4d8bf6..c836f9b08 100644 --- a/Source/kwsys/ProcessWin32.c +++ b/Source/kwsys/ProcessWin32.c @@ -28,14 +28,6 @@ On windows, a thread is created to wait for data on each pipe. The threads are synchronized with the main thread to simulate the use of a UNIX-style select system call. -On Windows9x platforms, a small WIN32 console application is spawned -in-between the calling process and the actual child to be executed. -This is to work-around a problem with connecting pipes from WIN16 -console applications to WIN32 applications. - -For more information, please check Microsoft Knowledge Base Articles -Q190351 and Q150956. - */ #ifdef _MSC_VER @@ -91,18 +83,12 @@ Q190351 and Q150956. # define KWSYSPE_DEBUG(x) (void)1 #endif -#define kwsysEncodedWriteArrayProcessFwd9x kwsys_ns(EncodedWriteArrayProcessFwd9x) - typedef LARGE_INTEGER kwsysProcessTime; typedef struct kwsysProcessCreateInformation_s { /* Windows child startup control data. */ STARTUPINFO StartupInfo; - - /* Special error reporting pipe for Win9x forwarding executable. */ - HANDLE ErrorPipeRead; - HANDLE ErrorPipeWrite; } kwsysProcessCreateInformation; /*--------------------------------------------------------------------------*/ @@ -146,7 +132,6 @@ static kwsysProcessTime kwsysProcessTimeSubtract(kwsysProcessTime in1, kwsysProc static void kwsysProcessSetExitException(kwsysProcess* cp, int code); static void kwsysProcessKillTree(int pid); static void kwsysProcessDisablePipeThreads(kwsysProcess* cp); -extern kwsysEXPORT int kwsysEncodedWriteArrayProcessFwd9x(const char* fname); /*--------------------------------------------------------------------------*/ /* A structure containing synchronization data for each thread. */ @@ -233,15 +218,6 @@ struct kwsysProcess_s /* Whether to treat command lines as verbatim. */ int Verbatim; - /* On Win9x platforms, the path to the forwarding executable. */ - char* Win9x; - - /* On Win9x platforms, the resume event for the forwarding executable. */ - HANDLE Win9xResumeEvent; - - /* On Win9x platforms, the kill event for the forwarding executable. */ - HANDLE Win9xKillEvent; - /* Mutex to protect the shared index used by threads to report data. */ HANDLE SharedIndexMutex; @@ -269,9 +245,6 @@ struct kwsysProcess_s HANDLE PipeNativeSTDOUT[2]; HANDLE PipeNativeSTDERR[2]; - /* Handle to automatically delete the Win9x forwarding executable. */ - HANDLE Win9xHandle; - /* ------------- Data managed per call to Execute ------------- */ /* The exceptional behavior that terminated the process, if any. */ @@ -311,7 +284,7 @@ struct kwsysProcess_s for pipes to close after process termination. */ int PipesLeft; - /* Buffer for error messages (possibly from Win9x child). */ + /* Buffer for error messages. */ char ErrorMessage[KWSYSPE_PIPE_BUFFER_SIZE+1]; /* Description for the ExitException. */ @@ -337,9 +310,6 @@ kwsysProcess* kwsysProcess_New(void) /* Process control structure. */ kwsysProcess* cp; - /* Path to Win9x forwarding executable. */ - char* win9x = 0; - /* Windows version number data. */ OSVERSIONINFO osv; @@ -365,73 +335,11 @@ kwsysProcess* kwsysProcess_New(void) GetVersionEx(&osv); if(osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { - /* This is Win9x. We need the console forwarding executable to - work-around a Windows 9x bug. */ - char fwdName[_MAX_FNAME+1] = ""; - char tempDir[_MAX_PATH+1] = ""; - - /* We will try putting the executable in the system temp - directory. Note that the returned path already has a trailing - slash. */ - DWORD length = GetTempPath(_MAX_PATH+1, tempDir); - - /* Construct the executable name from the process id and kwsysProcess - instance. This should be unique. */ - sprintf(fwdName, KWSYS_NAMESPACE_STRING "pew9xfwd_%ld_%p.exe", - GetCurrentProcessId(), cp); - - /* If we have a temp directory, use it. */ - if(length > 0 && length <= _MAX_PATH) - { - /* Allocate a buffer to hold the forwarding executable path. */ - size_t tdlen = strlen(tempDir); - win9x = (char*)malloc(tdlen + strlen(fwdName) + 2); - if(!win9x) - { - kwsysProcess_Delete(cp); - return 0; - } - - /* Construct the full path to the forwarding executable. */ - sprintf(win9x, "%s%s", tempDir, fwdName); - } - - /* If we found a place to put the forwarding executable, try to - write it. */ - if(win9x) - { - if(!kwsysEncodedWriteArrayProcessFwd9x(win9x)) - { - /* Failed to create forwarding executable. Give up. */ - free(win9x); - kwsysProcess_Delete(cp); - return 0; - } - - /* Get a handle to the file that will delete it when closed. */ - cp->Win9xHandle = CreateFile(win9x, GENERIC_READ, FILE_SHARE_READ, 0, - OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0); - if(cp->Win9xHandle == INVALID_HANDLE_VALUE) - { - /* We were not able to get a read handle for the forwarding - executable. It will not be deleted properly. Give up. */ - _unlink(win9x); - free(win9x); - kwsysProcess_Delete(cp); - return 0; - } - } - else - { - /* Failed to find a place to put forwarding executable. */ - kwsysProcess_Delete(cp); - return 0; - } + /* Win9x no longer supported. */ + kwsysProcess_Delete(cp); + return 0; } - /* Save the path to the forwarding executable. */ - cp->Win9x = win9x; - /* Initially no thread owns the mutex. Initialize semaphore to 1. */ if(!(cp->SharedIndexMutex = CreateSemaphore(0, 1, 1, 0))) { @@ -446,30 +354,6 @@ kwsysProcess* kwsysProcess_New(void) return 0; } - if(cp->Win9x) - { - SECURITY_ATTRIBUTES sa; - ZeroMemory(&sa, sizeof(sa)); - sa.nLength = sizeof(sa); - sa.bInheritHandle = TRUE; - - /* Create an event to tell the forwarding executable to resume the - child. */ - if(!(cp->Win9xResumeEvent = CreateEvent(&sa, TRUE, 0, 0))) - { - kwsysProcess_Delete(cp); - return 0; - } - - /* Create an event to tell the forwarding executable to kill the - child. */ - if(!(cp->Win9xKillEvent = CreateEvent(&sa, TRUE, 0, 0))) - { - kwsysProcess_Delete(cp); - return 0; - } - } - /* Create the thread to read each pipe. */ for(i=0; i < KWSYSPE_PIPE_COUNT; ++i) { @@ -620,13 +504,6 @@ void kwsysProcess_Delete(kwsysProcess* cp) kwsysProcessCleanupHandle(&cp->SharedIndexMutex); kwsysProcessCleanupHandle(&cp->Full); - /* Close the Win9x resume and kill event handles. */ - if(cp->Win9x) - { - kwsysProcessCleanupHandle(&cp->Win9xResumeEvent); - kwsysProcessCleanupHandle(&cp->Win9xKillEvent); - } - /* Free memory. */ kwsysProcess_SetCommand(cp, 0); kwsysProcess_SetWorkingDirectory(cp, 0); @@ -637,12 +514,6 @@ void kwsysProcess_Delete(kwsysProcess* cp) { free(cp->CommandExitCodes); } - if(cp->Win9x) - { - /* Close our handle to the forwarding executable file. This will - cause it to be deleted. */ - kwsysProcessCleanupHandle(&cp->Win9xHandle); - } free(cp); } @@ -1017,21 +888,6 @@ void kwsysProcess_Execute(kwsysProcess* cp) SetCurrentDirectory(cp->WorkingDirectory); } - /* Reset the Win9x resume and kill events. */ - if(cp->Win9x) - { - if(!ResetEvent(cp->Win9xResumeEvent)) - { - kwsysProcessCleanup(cp, 1); - return; - } - if(!ResetEvent(cp->Win9xKillEvent)) - { - kwsysProcessCleanup(cp, 1); - return; - } - } - /* Initialize startup info data. */ ZeroMemory(&si, sizeof(si)); si.StartupInfo.cb = sizeof(si.StartupInfo); @@ -1130,8 +986,6 @@ void kwsysProcess_Execute(kwsysProcess* cp) STD_OUTPUT_HANDLE); kwsysProcessCleanupHandleSafe(&si.StartupInfo.hStdError, STD_ERROR_HANDLE); - kwsysProcessCleanupHandle(&si.ErrorPipeRead); - kwsysProcessCleanupHandle(&si.ErrorPipeWrite); return; } } @@ -1160,16 +1014,9 @@ void kwsysProcess_Execute(kwsysProcess* cp) /* All processes in the pipeline have been started in suspended mode. Resume them all now. */ - if(cp->Win9x) - { - SetEvent(cp->Win9xResumeEvent); - } - else + for(i=0; i < cp->NumberOfCommands; ++i) { - for(i=0; i < cp->NumberOfCommands; ++i) - { - ResumeThread(cp->ProcessInformation[i].hThread); - } + ResumeThread(cp->ProcessInformation[i].hThread); } /* ---- It is no longer safe to call kwsysProcessCleanup. ----- */ @@ -1480,21 +1327,12 @@ void kwsysProcess_Kill(kwsysProcess* cp) /* Kill the children. */ cp->Killed = 1; - if(cp->Win9x) - { - /* Windows 9x. Tell the forwarding executable to kill the child. */ - SetEvent(cp->Win9xKillEvent); - } - else + for(i=0; i < cp->NumberOfCommands; ++i) { - /* Not Windows 9x. Just terminate the children. */ - for(i=0; i < cp->NumberOfCommands; ++i) - { - kwsysProcessKillTree(cp->ProcessInformation[i].dwProcessId); - // close the handle if we kill it - kwsysProcessCleanupHandle(&cp->ProcessInformation[i].hThread); - kwsysProcessCleanupHandle(&cp->ProcessInformation[i].hProcess); - } + kwsysProcessKillTree(cp->ProcessInformation[i].dwProcessId); + // close the handle if we kill it + kwsysProcessCleanupHandle(&cp->ProcessInformation[i].hThread); + kwsysProcessCleanupHandle(&cp->ProcessInformation[i].hProcess); } /* We are killing the children and ignoring all data. Do not wait @@ -1815,97 +1653,13 @@ int kwsysProcessCreate(kwsysProcess* cp, int index, } } - /* Create the child process. */ - { - BOOL r; - char* realCommand; - if(cp->Win9x) - { - /* Create an error reporting pipe for the forwarding executable. - Neither end is directly inherited. */ - if(!CreatePipe(&si->ErrorPipeRead, &si->ErrorPipeWrite, 0, 0)) - { - return 0; - } - - /* Create an inherited duplicate of the write end. This also closes - the non-inherited version. */ - if(!DuplicateHandle(GetCurrentProcess(), si->ErrorPipeWrite, - GetCurrentProcess(), &si->ErrorPipeWrite, - 0, TRUE, (DUPLICATE_CLOSE_SOURCE | - DUPLICATE_SAME_ACCESS))) - { - return 0; - } - - /* The forwarding executable is given a handle to the error pipe - and resume and kill events. */ - realCommand = (char*)malloc(strlen(cp->Win9x)+strlen(cp->Commands[index])+100); - if(!realCommand) - { - return 0; - } - sprintf(realCommand, "%s %p %p %p %d %s", cp->Win9x, - si->ErrorPipeWrite, cp->Win9xResumeEvent, cp->Win9xKillEvent, - cp->HideWindow, cp->Commands[index]); - } - else - { - realCommand = cp->Commands[index]; - } - /* Create the child in a suspended state so we can wait until all children have been created before running any one. */ - r = CreateProcess(0, realCommand, 0, 0, TRUE, - cp->Win9x? 0 : CREATE_SUSPENDED, 0, 0, - &si->StartupInfo, &cp->ProcessInformation[index]); - if(cp->Win9x) - { - /* Free memory. */ - free(realCommand); - - /* Close the error pipe write end so we can detect when the - forwarding executable closes it. */ - kwsysProcessCleanupHandle(&si->ErrorPipeWrite); - if(r) - { - /* Wait for the forwarding executable to report an error or - close the error pipe to report success. */ - DWORD total = 0; - DWORD n = 1; - while(total < KWSYSPE_PIPE_BUFFER_SIZE && n > 0) - { - if(ReadFile(si->ErrorPipeRead, cp->ErrorMessage+total, - KWSYSPE_PIPE_BUFFER_SIZE-total, &n, 0)) - { - total += n; - } - else - { - n = 0; - } - } - if(total > 0 || GetLastError() != ERROR_BROKEN_PIPE) - { - /* The forwarding executable could not run the process, or - there was an error reading from its error pipe. Preserve - the last error while cleaning up the forwarding executable - so the cleanup our caller does reports the proper error. */ - DWORD error = GetLastError(); - kwsysProcessCleanupHandle(&cp->ProcessInformation[index].hThread); - kwsysProcessCleanupHandle(&cp->ProcessInformation[index].hProcess); - SetLastError(error); - return 0; - } - } - kwsysProcessCleanupHandle(&si->ErrorPipeRead); - } - - if(!r) + if(!CreateProcess(0, cp->Commands[index], 0, 0, TRUE, CREATE_SUSPENDED, 0, + 0, &si->StartupInfo, &cp->ProcessInformation[index])) { return 0; } - } /* Successfully created this child process. Close the current process's copies of the inherited stdout and stdin handles. The @@ -2152,19 +1906,12 @@ void kwsysProcessCleanup(kwsysProcess* cp, int error) /* Cleanup any processes already started in a suspended state. */ if(cp->ProcessInformation) { - if(cp->Win9x) - { - SetEvent(cp->Win9xKillEvent); - } - else + for(i=0; i < cp->NumberOfCommands; ++i) { - for(i=0; i < cp->NumberOfCommands; ++i) + if(cp->ProcessInformation[i].hProcess) { - if(cp->ProcessInformation[i].hProcess) - { - TerminateProcess(cp->ProcessInformation[i].hProcess, 255); - WaitForSingleObject(cp->ProcessInformation[i].hProcess, INFINITE); - } + TerminateProcess(cp->ProcessInformation[i].hProcess, 255); + WaitForSingleObject(cp->ProcessInformation[i].hProcess, INFINITE); } } for(i=0; i < cp->NumberOfCommands; ++i) diff --git a/Source/kwsys/Registry.cxx b/Source/kwsys/Registry.cxx deleted file mode 100644 index cd521c966..000000000 --- a/Source/kwsys/Registry.cxx +++ /dev/null @@ -1,818 +0,0 @@ -/*============================================================================ - KWSys - Kitware System Library - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "kwsysPrivate.h" -#include KWSYS_HEADER(Registry.hxx) - -#include KWSYS_HEADER(Configure.hxx) -#include KWSYS_HEADER(ios/iostream) -#include KWSYS_HEADER(stl/string) -#include KWSYS_HEADER(stl/map) -#include KWSYS_HEADER(ios/iostream) -#include KWSYS_HEADER(ios/fstream) -#include KWSYS_HEADER(ios/sstream) -// Work-around CMake dependency scanning limitation. This must -// duplicate the above list of headers. -#if 0 -# include "Registry.hxx.in" -# include "Configure.hxx.in" -# include "kwsys_stl.hxx.in" -# include "kwsys_stl_string.hxx.in" -# include "kwsys_stl_map.hxx.in" -# include "kwsys_ios_iostream.h.in" -# include "kwsys_ios_fstream.h.in" -# include "kwsys_ios_sstream.h.in" -#endif - -#include // for isspace -#include -#include /* strlen, strncpy */ -#include /* getenv */ - -#ifdef _WIN32 -# include -#endif - - -namespace KWSYS_NAMESPACE -{ -class RegistryHelper { -public: - RegistryHelper(Registry::RegistryType registryType); - virtual ~RegistryHelper(); - - // Read a value from the registry. - virtual bool ReadValue(const char *key, const char **value); - - // Delete a key from the registry. - virtual bool DeleteKey(const char *key); - - // Delete a value from a given key. - virtual bool DeleteValue(const char *key); - - // Set value in a given key. - virtual bool SetValue(const char *key, const char *value); - - // Open the registry at toplevel/subkey. - virtual bool Open(const char *toplevel, const char *subkey, - int readonly); - - // Close the registry. - virtual bool Close(); - - // Set the value of changed - void SetChanged(bool b) { m_Changed = b; } - void SetTopLevel(const char* tl); - const char* GetTopLevel() { return m_TopLevel.c_str(); } - - //! Read from local or global scope. On Windows this mean from local machine - // or local user. On unix this will read from $HOME/.Projectrc or - // /etc/Project - void SetGlobalScope(bool b); - bool GetGlobalScope(); - - kwsys_stl::string EncodeKey(const char* str); - kwsys_stl::string EncodeValue(const char* str); - kwsys_stl::string DecodeValue(const char* str); - -protected: - bool m_Changed; - kwsys_stl::string m_TopLevel; - bool m_GlobalScope; - -#ifdef _WIN32 - HKEY HKey; -#endif - // Strip trailing and ending spaces. - char *Strip(char *str); - void SetSubKey(const char* sk); - kwsys_stl::string CreateKey(const char *key); - - typedef kwsys_stl::map StringToStringMap; - StringToStringMap EntriesMap; - kwsys_stl::string m_SubKey; - bool m_Empty; - bool m_SubKeySpecified; - kwsys_stl::string m_HomeDirectory; - - Registry::RegistryType m_RegistryType; -}; - -//---------------------------------------------------------------------------- -#define Registry_BUFFER_SIZE 8192 - -//---------------------------------------------------------------------------- -Registry::Registry(Registry::RegistryType registryType) -{ - m_Opened = false; - m_Locked = false; - this->Helper = 0; - this->Helper = new RegistryHelper(registryType); -} - -//---------------------------------------------------------------------------- -Registry::~Registry() -{ - if ( m_Opened ) - { - kwsys_ios::cerr << "Registry::Close should be " - "called here. The registry is not closed." - << kwsys_ios::endl; - } - delete this->Helper; -} - -//---------------------------------------------------------------------------- -void Registry::SetGlobalScope(bool b) -{ - this->Helper->SetGlobalScope(b); -} - -//---------------------------------------------------------------------------- -bool Registry::GetGlobalScope() -{ - return this->Helper->GetGlobalScope(); -} - -//---------------------------------------------------------------------------- -bool Registry::Open(const char *toplevel, - const char *subkey, int readonly) -{ - bool res = false; - if ( m_Locked ) - { - return res; - } - if ( m_Opened ) - { - if ( !this->Close() ) - { - return res; - } - } - if ( !toplevel || !*toplevel ) - { - kwsys_ios::cerr << "Registry::Opened() Toplevel not defined" - << kwsys_ios::endl; - return res; - } - - if ( isspace(toplevel[0]) || - isspace(toplevel[strlen(toplevel)-1]) ) - { - kwsys_ios::cerr << "Toplevel has to start with letter or number and end" - " with one" << kwsys_ios::endl; - return res; - } - - res = this->Helper->Open(toplevel, subkey, readonly); - if ( readonly != Registry::READONLY ) - { - m_Locked = true; - } - - if ( res ) - { - m_Opened = true; - this->Helper->SetTopLevel(toplevel); - } - return res; -} - -//---------------------------------------------------------------------------- -bool Registry::Close() -{ - bool res = false; - if ( m_Opened ) - { - res = this->Helper->Close(); - } - - if ( res ) - { - m_Opened = false; - m_Locked = false; - this->Helper->SetChanged(false); - } - return res; -} - -//---------------------------------------------------------------------------- -bool Registry::ReadValue(const char *subkey, - const char *key, - const char **value) -{ - bool res = false; - bool open = false; - if ( ! value ) - { - return res; - } - *value = 0; - if ( !m_Opened ) - { - if ( !this->Open(this->GetTopLevel(), subkey, - Registry::READONLY) ) - { - return res; - } - open = true; - } - res = this->Helper->ReadValue(key, value); - - if ( open ) - { - if ( !this->Close() ) - { - res = false; - } - } - return res; -} - -//---------------------------------------------------------------------------- -bool Registry::DeleteKey(const char *subkey, const char *key) -{ - bool res = false; - bool open = false; - if ( !m_Opened ) - { - if ( !this->Open(this->GetTopLevel(), subkey, - Registry::READWRITE) ) - { - return res; - } - open = true; - } - - res = this->Helper->DeleteKey(key); - if ( res ) - { - this->Helper->SetChanged(true); - } - - if ( open ) - { - if ( !this->Close() ) - { - res = false; - } - } - return res; -} - -//---------------------------------------------------------------------------- -bool Registry::DeleteValue(const char *subkey, const char *key) -{ - bool res = false; - bool open = false; - if ( !m_Opened ) - { - if ( !this->Open(this->GetTopLevel(), subkey, - Registry::READWRITE) ) - { - return res; - } - open = true; - } - - res = this->Helper->DeleteValue(key); - if ( res ) - { - this->Helper->SetChanged(true); - } - - if ( open ) - { - if ( !this->Close() ) - { - res = false; - } - } - return res; -} - -//---------------------------------------------------------------------------- -bool Registry::SetValue(const char *subkey, const char *key, - const char *value) -{ - bool res = false; - bool open = false; - if ( !m_Opened ) - { - if ( !this->Open(this->GetTopLevel(), subkey, - Registry::READWRITE) ) - { - return res; - } - open = true; - } - - res = this->Helper->SetValue( key, value ); - if ( res ) - { - this->Helper->SetChanged(true); - } - - if ( open ) - { - if ( !this->Close() ) - { - res = false; - } - } - return res; -} - -//---------------------------------------------------------------------------- -const char* Registry::GetTopLevel() -{ - return this->Helper->GetTopLevel(); -} - -//---------------------------------------------------------------------------- -void Registry::SetTopLevel(const char* tl) -{ - this->Helper->SetTopLevel(tl); -} - -//---------------------------------------------------------------------------- -void RegistryHelper::SetTopLevel(const char* tl) -{ - if ( tl ) - { - m_TopLevel = tl; - } - else - { - m_TopLevel = ""; - } -} - -//---------------------------------------------------------------------------- -RegistryHelper::RegistryHelper(Registry::RegistryType registryType) -{ - m_Changed = false; - m_TopLevel = ""; - m_SubKey = ""; - m_SubKeySpecified = false; - m_Empty = true; - m_GlobalScope = false; - m_RegistryType = registryType; -} - -//---------------------------------------------------------------------------- -RegistryHelper::~RegistryHelper() -{ -} - - -//---------------------------------------------------------------------------- -bool RegistryHelper::Open(const char *toplevel, const char *subkey, - int readonly) -{ - this->EntriesMap.clear(); - m_Empty = 1; - -#ifdef _WIN32 - if ( m_RegistryType == Registry::WIN32_REGISTRY) - { - HKEY scope = HKEY_CURRENT_USER; - if ( this->GetGlobalScope() ) - { - scope = HKEY_LOCAL_MACHINE; - } - int res = 0; - kwsys_ios::ostringstream str; - DWORD dwDummy; - str << "Software\\Kitware\\" << toplevel << "\\" << subkey; - if ( readonly == Registry::READONLY ) - { - res = ( RegOpenKeyEx(scope, str.str().c_str(), - 0, KEY_READ, &this->HKey) == ERROR_SUCCESS ); - } - else - { - char lpClass[] = ""; - res = ( RegCreateKeyEx(scope, str.str().c_str(), - 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_READ|KEY_WRITE, - NULL, &this->HKey, &dwDummy) == ERROR_SUCCESS ); - } - if ( res != 0 ) - { - this->SetSubKey( subkey ); - } - return (res != 0); - } -#endif - if ( m_RegistryType == Registry::FILE_REGISTRY ) - { - bool res = false; - int cc; - kwsys_ios::ostringstream str; - const char* homeDirectory; - if ( (homeDirectory = getenv("HOME")) == 0 ) - { - if ( (homeDirectory = getenv("USERPROFILE")) == 0 ) - { - return false; - } - } - m_HomeDirectory = homeDirectory; - str << m_HomeDirectory.c_str() << "/." << toplevel << "rc"; - if ( readonly == Registry::READWRITE ) - { - kwsys_ios::ofstream ofs( str.str().c_str(), kwsys_ios::ios::out|kwsys_ios::ios::app ); - if ( ofs.fail() ) - { - return false; - } - ofs.close(); - } - - kwsys_ios::ifstream *ifs = new kwsys_ios::ifstream(str.str().c_str(), kwsys_ios::ios::in -#ifndef KWSYS_IOS_USE_ANSI - | kwsys_ios::ios::nocreate -#endif - ); - if ( !ifs ) - { - return false; - } - if ( ifs->fail()) - { - delete ifs; - return false; - } - - res = true; - char buffer[Registry_BUFFER_SIZE]; - while( !ifs->fail() ) - { - ifs->getline(buffer, Registry_BUFFER_SIZE); - if ( ifs->fail() || ifs->eof() ) - { - break; - } - char *line = this->Strip(buffer); - if ( *line == '#' || *line == 0 ) - { - // Comment - continue; - } - int linelen = static_cast(strlen(line)); - for ( cc = 0; cc < linelen; cc++ ) - { - if ( line[cc] == '=' ) - { - char *key = new char[ cc+1 ]; - strncpy( key, line, cc ); - key[cc] = 0; - char *value = line + cc + 1; - char *nkey = this->Strip(key); - char *nvalue = this->Strip(value); - this->EntriesMap[nkey] = this->DecodeValue(nvalue); - m_Empty = 0; - delete [] key; - break; - } - } - } - ifs->close(); - this->SetSubKey( subkey ); - delete ifs; - return res; - } - return false; -} - -//---------------------------------------------------------------------------- -bool RegistryHelper::Close() -{ -#ifdef _WIN32 - if ( m_RegistryType == Registry::WIN32_REGISTRY) - { - int res; - res = ( RegCloseKey(this->HKey) == ERROR_SUCCESS ); - return (res != 0); - } -#endif - if ( m_RegistryType == Registry::FILE_REGISTRY ) - { - if ( !m_Changed ) - { - this->SetSubKey(0); - return true; - } - - kwsys_ios::ostringstream str; - str << m_HomeDirectory.c_str() << "/." << this->GetTopLevel() << "rc"; - kwsys_ios::ofstream *ofs = new kwsys_ios::ofstream(str.str().c_str(), kwsys_ios::ios::out); - if ( !ofs ) - { - return false; - } - if ( ofs->fail()) - { - delete ofs; - return false; - } - *ofs << "# This file is automatically generated by the application" << kwsys_ios::endl - << "# If you change any lines or add new lines, note that all" << kwsys_ios::endl - << "# comments and empty lines will be deleted. Every line has" << kwsys_ios::endl - << "# to be in format: " << kwsys_ios::endl - << "# key = value" << kwsys_ios::endl - << "#" << kwsys_ios::endl; - - if ( !this->EntriesMap.empty() ) - { - RegistryHelper::StringToStringMap::iterator it; - for ( it = this->EntriesMap.begin(); - it != this->EntriesMap.end(); - ++ it ) - { - *ofs << it->first.c_str() << " = " << this->EncodeValue(it->second.c_str()).c_str() << kwsys_ios::endl; - } - } - this->EntriesMap.clear(); - ofs->close(); - delete ofs; - this->SetSubKey(0); - m_Empty = 1; - return true; - } - return false; -} - -//---------------------------------------------------------------------------- -bool RegistryHelper::ReadValue(const char *skey, const char **value) - -{ -#ifdef _WIN32 - if ( m_RegistryType == Registry::WIN32_REGISTRY) - { - kwsys_stl::string key = this->CreateKey( skey ); - if ( key.empty() ) - { - return false; - } - DWORD dwType, dwSize; - dwType = REG_SZ; - char buffer[1024]; // Replace with RegQueryInfoKey - dwSize = sizeof(buffer); - int res = ( RegQueryValueEx(this->HKey, skey, NULL, &dwType, - (BYTE *)buffer, &dwSize) == ERROR_SUCCESS ); - if ( !res ) - { - return false; - } - this->EntriesMap[key] = buffer; - RegistryHelper::StringToStringMap::iterator it - = this->EntriesMap.find(key); - *value = it->second.c_str(); - return true; - } -#endif - if ( m_RegistryType == Registry::FILE_REGISTRY ) - { - bool res = false; - kwsys_stl::string key = this->CreateKey( skey ); - if ( key.empty() ) - { - return false; - } - - RegistryHelper::StringToStringMap::iterator it - = this->EntriesMap.find(key); - if ( it != this->EntriesMap.end() ) - { - *value = it->second.c_str(); - res = true; - } - return res; - } - return false; -} - -//---------------------------------------------------------------------------- -bool RegistryHelper::DeleteKey(const char* skey) -{ -#ifdef _WIN32 - if ( m_RegistryType == Registry::WIN32_REGISTRY) - { - int res = ( RegDeleteKey( this->HKey, skey ) == ERROR_SUCCESS ); - return (res != 0); - } -#endif - if ( m_RegistryType == Registry::FILE_REGISTRY ) - { - kwsys_stl::string key = this->CreateKey( skey ); - if ( key.empty() ) - { - return false; - } - this->EntriesMap.erase(key); - return true; - } - return false; -} - -//---------------------------------------------------------------------------- -bool RegistryHelper::DeleteValue(const char *skey) -{ -#ifdef _WIN32 - if ( m_RegistryType == Registry::WIN32_REGISTRY) - { - int res = ( RegDeleteValue( this->HKey, skey ) == ERROR_SUCCESS ); - return (res != 0); - } -#endif - if ( m_RegistryType == Registry::FILE_REGISTRY ) - { - kwsys_stl::string key = this->CreateKey( skey ); - if ( key.empty() ) - { - return false; - } - this->EntriesMap.erase(key); - return true; - } - return false; -} - -//---------------------------------------------------------------------------- -bool RegistryHelper::SetValue(const char *skey, const char *value) -{ -#ifdef _WIN32 - if ( m_RegistryType == Registry::WIN32_REGISTRY) - { - DWORD len = (DWORD)(value ? strlen(value) : 0); - int res = ( RegSetValueEx(this->HKey, skey, 0, REG_SZ, - (CONST BYTE *)(const char *)value, - len+1) == ERROR_SUCCESS ); - return (res != 0); - } -#endif - if ( m_RegistryType == Registry::FILE_REGISTRY ) - { - kwsys_stl::string key = this->CreateKey( skey ); - if ( key.empty() ) - { - return 0; - } - this->EntriesMap[key] = value; - return 1; - } - return false; -} - -//---------------------------------------------------------------------------- -kwsys_stl::string RegistryHelper::CreateKey( const char *key ) -{ - if ( !m_SubKeySpecified || m_SubKey.empty() || !key ) - { - return ""; - } - kwsys_ios::ostringstream ostr; - ostr << this->EncodeKey(this->m_SubKey.c_str()).c_str() - << "\\" << this->EncodeKey(key).c_str(); - return ostr.str(); -} - -//---------------------------------------------------------------------------- -void RegistryHelper::SetSubKey(const char* sk) -{ - if ( !sk ) - { - m_SubKey = ""; - m_SubKeySpecified = false; - } - else - { - m_SubKey = sk; - m_SubKeySpecified = true; - } -} - -//---------------------------------------------------------------------------- -char *RegistryHelper::Strip(char *str) -{ - int cc; - size_t len; - char *nstr; - if ( !str ) - { - return NULL; - } - len = strlen(str); - nstr = str; - for( cc=0; cc < static_cast(len); cc++ ) - { - if ( !isspace( *nstr ) ) - { - break; - } - nstr ++; - } - for( cc= static_cast(strlen(nstr))-1; cc>=0; cc-- ) - { - if ( !isspace( nstr[cc] ) ) - { - nstr[cc+1] = 0; - break; - } - } - return nstr; -} - -//---------------------------------------------------------------------------- -void RegistryHelper::SetGlobalScope(bool b) -{ - m_GlobalScope = b; -} - -//---------------------------------------------------------------------------- -bool RegistryHelper::GetGlobalScope() -{ - return m_GlobalScope; -} - -//---------------------------------------------------------------------------- -kwsys_stl::string RegistryHelper::EncodeKey(const char* str) -{ - kwsys_ios::ostringstream ostr; - while ( *str ) - { - switch ( *str ) - { - case '%': case '=': case '\n': case '\r': case '\t': - char buffer[4]; - sprintf(buffer, "%%%02X", *str); - ostr << buffer; - break; - default: - ostr << *str; - } - str ++; - } - return ostr.str(); -} - -//---------------------------------------------------------------------------- -kwsys_stl::string RegistryHelper::EncodeValue(const char* str) -{ - kwsys_ios::ostringstream ostr; - while ( *str ) - { - switch ( *str ) - { - case '%': case '=': case '\n': case '\r': case '\t': - char buffer[4]; - sprintf(buffer, "%%%02X", *str); - ostr << buffer; - break; - default: - ostr << *str; - } - str ++; - } - return ostr.str(); -} - -//---------------------------------------------------------------------------- -kwsys_stl::string RegistryHelper::DecodeValue(const char* str) -{ - kwsys_ios::ostringstream ostr; - while ( *str ) - { - unsigned int val; - switch ( *str ) - { - case '%': - if ( *(str+1) && *(str+2) && sscanf(str+1, "%x", &val) == 1 ) - { - ostr << static_cast(val); - str += 2; - } - else - { - ostr << *str; - } - break; - default: - ostr << *str; - } - str ++; - } - return ostr.str(); -} - -} // namespace KWSYS_NAMESPACE diff --git a/Source/kwsys/Registry.hxx.in b/Source/kwsys/Registry.hxx.in deleted file mode 100644 index ed9b01072..000000000 --- a/Source/kwsys/Registry.hxx.in +++ /dev/null @@ -1,107 +0,0 @@ -/*============================================================================ - KWSys - Kitware System Library - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef @KWSYS_NAMESPACE@_Registry_hxx -#define @KWSYS_NAMESPACE@_Registry_hxx - -#include <@KWSYS_NAMESPACE@/Configure.h> - -#include <@KWSYS_NAMESPACE@/stl/string> - -namespace @KWSYS_NAMESPACE@ -{ - -class RegistryHelper; - -/** \class Registry - * \brief Portable registry class - * - * This class abstracts the storing of data that can be restored - * when the program executes again. On Win32 platform it is - * implemented using the registry and on unix as a file in - * the user's home directory. - */ -class @KWSYS_NAMESPACE@_EXPORT Registry -{ -public: - enum RegistryType - { -#ifdef _WIN32 - WIN32_REGISTRY, -#endif - FILE_REGISTRY - }; - -#ifdef _WIN32 - Registry(RegistryType registryType = WIN32_REGISTRY); -#else - Registry(RegistryType registryType = FILE_REGISTRY); -#endif - - virtual ~Registry(); - - //! Read a value from the registry. - bool ReadValue(const char *subkey, const char *key, const char **value); - - //! Delete a key from the registry. - bool DeleteKey(const char *subkey, const char *key); - - //! Delete a value from a given key. - bool DeleteValue(const char *subkey, const char *key); - - //! Set value in a given key. - bool SetValue(const char *subkey, const char *key, - const char *value); - - //! Open the registry at toplevel/subkey. - bool Open(const char *toplevel, const char *subkey, - int readonly); - - //! Close the registry. - bool Close(); - - //! Read from local or global scope. On Windows this mean from local machine - // or local user. On unix this will read from $HOME/.Projectrc or - // /etc/Project - void GlobalScopeOn() { this->SetGlobalScope(1); } - void GlobalScopeOff() { this->SetGlobalScope(0); } - void SetGlobalScope(bool b); - bool GetGlobalScope(); - - // Set or get the toplevel registry key. - void SetTopLevel(const char* tl); - const char* GetTopLevel(); - - // Return true if registry opened - bool GetOpened() { return m_Opened; } - - // Should the registry be locked? - bool GetLocked() { return m_Locked; } - - enum { - READONLY, - READWRITE - }; - - // Return true if the character is space. - int IsSpace(char c); - -private: - RegistryHelper* Helper; - - bool m_Opened; - - bool m_Locked; -}; // End Class: Registry - -} // namespace @KWSYS_NAMESPACE@ - -#endif diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index e1ee873b4..f057e0fcb 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -9,7 +9,12 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifdef _WIN32 + +#if defined(_WIN32) +# define NOMINMAX // use our min,max +# if !defined(_WIN32_WINNT) && !(defined(_MSC_VER) && _MSC_VER < 1300) +# define _WIN32_WINNT 0x0501 +# endif # include // WSADATA, include before sys/types.h #endif @@ -33,6 +38,7 @@ #include KWSYS_HEADER(Process.h) #include KWSYS_HEADER(ios/iostream) #include KWSYS_HEADER(ios/sstream) +#include KWSYS_HEADER(ios/fstream) // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. @@ -45,66 +51,257 @@ # include "kwsys_stl_iosfwd.in" # include "kwsys_ios_sstream.h.in" # include "kwsys_ios_iostream.h.in" +# include "kwsys_ios_fstream.h.in" #endif -#ifndef WIN32 +#if defined(_WIN32) +# include +# include +# if defined(KWSYS_SYS_HAS_PSAPI) +# include +# endif +# if !defined(siginfo_t) +typedef int siginfo_t; +# endif +#else +# include +# include # include // int uname(struct utsname *buf); +# include // getrlimit +# include +# include +# include +# include // extern int errno; #endif -#ifdef _WIN32 -# include +#ifdef __FreeBSD__ +# include +# include +# include +# include +# include +# if defined(KWSYS_SYS_HAS_IFADDRS_H) +# include +# define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN +# endif +#endif + +#if defined(__OpenBSD__) || defined(__NetBSD__) +# include +# include +#endif + +#if defined(KWSYS_SYS_HAS_MACHINE_CPU_H) +# include +#endif + +#if defined(__DragonFly__) +# include #endif #ifdef __APPLE__ -#include -#include -#include -#include -#include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# if defined(KWSYS_SYS_HAS_IFADDRS_H) +# include +# define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN +# endif +# if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 >= 1050 +# include +# define KWSYS_SYSTEMINFORMATION_HAVE_BACKTRACE +# endif #endif #ifdef __linux -# include -# include -# include -# include // int isdigit(int c); -# include // extern int errno; -# include +# include +# include +# include +# include +# if defined(KWSYS_SYS_HAS_IFADDRS_H) +# include +# if !defined(__LSB_VERSION__) /* LSB has no getifaddrs */ +# define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN +# endif +# endif +# if defined(__GNUG__) +# include +# if !(defined(__LSB_VERSION__) && __LSB_VERSION__ < 41) +# define KWSYS_SYSTEMINFORMATION_HAVE_BACKTRACE +# endif +# endif +# if defined(KWSYS_CXX_HAS_RLIMIT64) +typedef struct rlimit64 ResourceLimitType; +# define GetResourceLimit getrlimit64 +# else +typedef struct rlimit ResourceLimitType; +# define GetResourceLimit getrlimit +# endif #elif defined( __hpux ) # include # include +# if defined(KWSYS_SYS_HAS_MPCTL_H) +# include +# endif #endif #ifdef __HAIKU__ -#include +# include #endif #include #include #include #include +#include // int isdigit(int c); + +#if defined(KWSYS_USE_LONG_LONG) +# if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG) +# define iostreamLongLong(x) (x) +# else +# define iostreamLongLong(x) ((long)x) +# endif +#elif defined(KWSYS_USE___INT64) +# if defined(KWSYS_IOS_HAS_OSTREAM___INT64) +# define iostreamLongLong(x) (x) +# else +# define iostreamLongLong(x) ((long)x) +# endif +#else +# error "No Long Long" +#endif +#if defined(KWSYS_CXX_HAS_ATOLL) +# define atoLongLong atoll +#else +# if defined(KWSYS_CXX_HAS__ATOI64) +# define atoLongLong _atoi64 +# elif defined(KWSYS_CXX_HAS_ATOL) +# define atoLongLong atol +# else +# define atoLongLong atoi +# endif +#endif -namespace KWSYS_NAMESPACE -{ +#if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(_WIN64) +#define USE_ASM_INSTRUCTIONS 1 +#else +#define USE_ASM_INSTRUCTIONS 0 +#endif -// Create longlong -#if KWSYS_USE_LONG_LONG - typedef long long LongLong; -#elif KWSYS_USE___INT64 - typedef __int64 LongLong; +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#include +#define USE_CPUID_INTRINSICS 1 #else -# error "No Long Long" +#define USE_CPUID_INTRINSICS 0 +#endif + +#if USE_ASM_INSTRUCTIONS || USE_CPUID_INTRINSICS || defined(KWSYS_CXX_HAS_BORLAND_ASM_CPUID) +# define USE_CPUID 1 +#else +# define USE_CPUID 0 +#endif + +#if USE_CPUID + +#define CPUID_AWARE_COMPILER + +/** + * call CPUID instruction + * + * Will return false if the instruction failed. + */ +static bool call_cpuid(int select, int result[4]) +{ +#if USE_CPUID_INTRINSICS + __cpuid(result, select); + return true; +#else + int tmp[4]; +#if defined(_MSC_VER) + // Use SEH to determine CPUID presence + __try { + _asm { +#ifdef CPUID_AWARE_COMPILER + ; we must push/pop the registers <> writes to, as the + ; optimiser doesn't know about <>, and so doesn't expect + ; these registers to change. + push eax + push ebx + push ecx + push edx +#endif + ; <> + mov eax, select +#ifdef CPUID_AWARE_COMPILER + cpuid +#else + _asm _emit 0x0f + _asm _emit 0xa2 +#endif + mov tmp[0 * TYPE int], eax + mov tmp[1 * TYPE int], ebx + mov tmp[2 * TYPE int], ecx + mov tmp[3 * TYPE int], edx + +#ifdef CPUID_AWARE_COMPILER + pop edx + pop ecx + pop ebx + pop eax +#endif + } + } + __except(1) + { + return false; + } + + memcpy(result, tmp, sizeof(tmp)); +#elif defined(KWSYS_CXX_HAS_BORLAND_ASM_CPUID) + unsigned int a, b, c, d; + __asm { + mov EAX, select; + cpuid + mov a, EAX; + mov b, EBX; + mov c, ECX; + mov d, EDX; + } + + result[0] = a; + result[1] = b; + result[2] = c; + result[3] = d; +#endif + + // The cpuid instruction succeeded. + return true; +#endif +} #endif +namespace KWSYS_NAMESPACE +{ +template +T min(T a, T b){ return a args); @@ -266,8 +486,26 @@ protected: bool QueryQNXMemory(); bool QueryQNXProcessor(); + //For OpenBSD, FreeBSD, NetBSD, DragonFly + bool QueryBSDMemory(); + bool QueryBSDProcessor(); + + //For HP-UX + bool QueryHPUXMemory(); + bool QueryHPUXProcessor(); + + //For Microsoft Windows + bool QueryWindowsMemory(); + + //For AIX + bool QueryAIXMemory(); + + bool QueryProcessorBySysconf(); + bool QueryProcessor(); + // Evaluate the memory information. - int QueryMemory(); + bool QueryMemoryBySysconf(); + bool QueryMemory(); size_t TotalVirtualMemory; size_t AvailableVirtualMemory; size_t TotalPhysicalMemory; @@ -281,7 +519,7 @@ protected: kwsys_stl::string Hostname; kwsys_stl::string OSRelease; kwsys_stl::string OSVersion; - kwsys_stl::string OSPlatform; + kwsys_stl::string OSPlatform; }; @@ -320,6 +558,11 @@ kwsys_stl::string SystemInformation::GetModelID() return this->Implementation->GetModelID(); } +kwsys_stl::string SystemInformation::GetModelName() +{ + return this->Implementation->GetModelName(); +} + kwsys_stl::string SystemInformation::GetSteppingCode() { return this->Implementation->GetSteppingCode(); @@ -365,6 +608,37 @@ bool SystemInformation::DoesCPUSupportFeature(long int i) return this->Implementation->DoesCPUSupportFeature(i); } +kwsys_stl::string SystemInformation::GetCPUDescription() +{ + kwsys_ios::ostringstream oss; + oss + << this->GetNumberOfPhysicalCPU() + << " core "; + if (this->GetModelName().empty()) + { + oss + << this->GetProcessorClockFrequency() + << " MHz " + << this->GetVendorString() + << " " + << this->GetExtendedProcessorName(); + } + else + { + oss << this->GetModelName(); + } + + // remove extra spaces + kwsys_stl::string tmp=oss.str(); + size_t pos; + while( (pos=tmp.find(" "))!=kwsys_stl::string::npos) + { + tmp.replace(pos,2," "); + } + + return tmp; +} + const char * SystemInformation::GetOSName() { return this->Implementation->GetOSName(); @@ -375,6 +649,13 @@ const char * SystemInformation::GetHostname() return this->Implementation->GetHostname(); } +kwsys_stl::string SystemInformation::GetFullyQualifiedDomainName() +{ + kwsys_stl::string fqdn; + this->Implementation->GetFullyQualifiedDomainName(fqdn); + return fqdn; +} + const char * SystemInformation::GetOSRelease() { return this->Implementation->GetOSRelease(); @@ -390,6 +671,46 @@ const char * SystemInformation::GetOSPlatform() return this->Implementation->GetOSPlatform(); } +int SystemInformation::GetOSIsWindows() +{ +#if defined(_WIN32) + return 1; +#else + return 0; +#endif +} + +int SystemInformation::GetOSIsLinux() +{ +#if defined(__linux) + return 1; +#else + return 0; +#endif +} + +int SystemInformation::GetOSIsApple() +{ +#if defined(__APPLE__) + return 1; +#else + return 0; +#endif +} + +kwsys_stl::string SystemInformation::GetOSDescription() +{ + kwsys_ios::ostringstream oss; + oss + << this->GetOSName() + << " " + << this->GetOSRelease() + << " " + << this->GetOSVersion(); + + return oss.str(); +} + bool SystemInformation::Is64Bits() { return this->Implementation->Is64Bits(); @@ -431,6 +752,66 @@ size_t SystemInformation::GetAvailablePhysicalMemory() return this->Implementation->GetAvailablePhysicalMemory(); } +kwsys_stl::string SystemInformation::GetMemoryDescription( + const char *hostLimitEnvVarName, + const char *procLimitEnvVarName) +{ + kwsys_ios::ostringstream oss; + oss + << "Host Total: " + << iostreamLongLong(this->GetHostMemoryTotal()) + << " KiB, Host Available: " + << iostreamLongLong(this->GetHostMemoryAvailable(hostLimitEnvVarName)) + << " KiB, Process Available: " + << iostreamLongLong( + this->GetProcMemoryAvailable(hostLimitEnvVarName,procLimitEnvVarName)) + << " KiB"; + return oss.str(); +} + +// host memory info in units of KiB. +SystemInformation::LongLong SystemInformation::GetHostMemoryTotal() +{ + return this->Implementation->GetHostMemoryTotal(); +} + +SystemInformation::LongLong +SystemInformation::GetHostMemoryAvailable(const char *hostLimitEnvVarName) +{ + return this->Implementation->GetHostMemoryAvailable(hostLimitEnvVarName); +} + +SystemInformation::LongLong SystemInformation::GetHostMemoryUsed() +{ + return this->Implementation->GetHostMemoryUsed(); +} + +// process memory info in units of KiB. +SystemInformation::LongLong +SystemInformation::GetProcMemoryAvailable( + const char *hostLimitEnvVarName, + const char *procLimitEnvVarName) +{ + return this->Implementation->GetProcMemoryAvailable( + hostLimitEnvVarName, + procLimitEnvVarName); +} + +SystemInformation::LongLong SystemInformation::GetProcMemoryUsed() +{ + return this->Implementation->GetProcMemoryUsed(); +} + +SystemInformation::LongLong SystemInformation::GetProcessId() +{ + return this->Implementation->GetProcessId(); +} + +void SystemInformation::SetStackTraceOnError(int enable) +{ + SystemInformationImplementation::SetStackTraceOnError(enable); +} + /** Run the different checks */ void SystemInformation::RunCPUCheck() { @@ -451,24 +832,11 @@ void SystemInformation::RunMemoryCheck() // -------------------------------------------------------------- // SystemInformationImplementation starts here -#if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(_WIN64) -#define USE_ASM_INSTRUCTIONS 1 -#else -#define USE_ASM_INSTRUCTIONS 0 -#endif - #define STORE_TLBCACHE_INFO(x,y) x = (x < y) ? y : x #define TLBCACHE_INFO_UNITS (15) #define CLASSICAL_CPU_FREQ_LOOP 10000000 #define RDTSC_INSTRUCTION _asm _emit 0x0f _asm _emit 0x31 -#define CPUID_AWARE_COMPILER -#ifdef CPUID_AWARE_COMPILER - #define CPUID_INSTRUCTION cpuid -#else - #define CPUID_INSTRUCTION _asm _emit 0x0f _asm _emit 0xa2 -#endif - #define MMX_FEATURE 0x00000001 #define MMX_PLUS_FEATURE 0x00000002 #define SSE_FEATURE 0x00000004 @@ -501,94 +869,438 @@ void SystemInformation::RunMemoryCheck() #define HT_CANNOT_DETECT 4 // EDX[28] Bit 28 is set if HT is supported -#define HT_BIT 0x10000000 +#define HT_BIT 0x10000000 // EAX[11:8] Bit 8-11 contains family processor ID. #define FAMILY_ID 0x0F00 -#define PENTIUM4_ID 0x0F00 +#define PENTIUM4_ID 0x0F00 // EAX[23:20] Bit 20-23 contains extended family processor ID -#define EXT_FAMILY_ID 0x0F00000 +#define EXT_FAMILY_ID 0x0F00000 // EBX[23:16] Bit 16-23 in ebx contains the number of logical -#define NUM_LOGICAL_BITS 0x00FF0000 -// processors per physical processor when execute cpuid with +#define NUM_LOGICAL_BITS 0x00FF0000 +// processors per physical processor when execute cpuid with // eax set to 1 -// EBX[31:24] Bits 24-31 (8 bits) return the 8-bit unique -#define INITIAL_APIC_ID_BITS 0xFF000000 +// EBX[31:24] Bits 24-31 (8 bits) return the 8-bit unique +#define INITIAL_APIC_ID_BITS 0xFF000000 // initial APIC ID for the processor this code is running on. // Default value = 0xff if HT is not supported - -SystemInformationImplementation::SystemInformationImplementation() +// Hide implementation details in an anonymous namespace. +namespace { +// ***************************************************************************** +#if defined(__linux) || defined(__APPLE__) +int LoadLines( + FILE *file, + kwsys_stl::vector &lines) { - this->TotalVirtualMemory = 0; - this->AvailableVirtualMemory = 0; - this->TotalPhysicalMemory = 0; - this->AvailablePhysicalMemory = 0; - this->CurrentPositionInFile = 0; - this->ChipManufacturer = UnknownManufacturer; - memset(&this->Features, 0, sizeof(CPUFeatures)); - this->ChipID.Type = 0; - this->ChipID.Family = 0; - this->ChipID.Model = 0; - this->ChipID.Revision = 0; - this->ChipID.ExtendedFamily = 0; - this->ChipID.ExtendedModel = 0; - this->CPUSpeedInMHz = 0; - this->NumberOfLogicalCPU = 0; - this->NumberOfPhysicalCPU = 0; - this->OSName = ""; - this->Hostname = ""; - this->OSRelease = ""; - this->OSVersion = ""; - this->OSPlatform = ""; + // Load each line in the given file into a the vector. + int nRead=0; + const int bufSize=1024; + char buf[bufSize]={'\0'}; + while (!feof(file) && !ferror(file)) + { + errno=0; + if (fgets(buf,bufSize,file) == 0) + { + if (ferror(file) && (errno==EINTR)) + { + clearerr(file); + } + continue; + } + lines.push_back(buf); + ++nRead; + } + if (ferror(file)) + { + return 0; + } + return nRead; } -SystemInformationImplementation::~SystemInformationImplementation() +# if defined(__linux) +// ***************************************************************************** +int LoadLines( + const char *fileName, + kwsys_stl::vector &lines) { + FILE *file=fopen(fileName,"r"); + if (file==0) + { + return 0; + } + int nRead=LoadLines(file,lines); + fclose(file); + return nRead; } +# endif -void SystemInformationImplementation::RunCPUCheck() +// **************************************************************************** +template +int NameValue( + kwsys_stl::vector &lines, + kwsys_stl::string name, T &value) { -#ifdef WIN32 - // Check to see if this processor supports CPUID. - bool supportsCPUID = DoesCPUSupportCPUID(); - - if (supportsCPUID) + size_t nLines=lines.size(); + for (size_t i=0; i> value; + return 0; } + return -1; +} +#endif - // These two may be called without support for the CPUID instruction. - // (But if the instruction is there, they should be called *after* - // the above call to RetrieveCPUIdentity... that's why the two if - // blocks exist with the same "if (supportsCPUID)" logic... - // - if (!RetrieveCPUClockSpeed()) +#if defined(__linux) +// **************************************************************************** +template +int GetFieldsFromFile( + const char *fileName, + const char **fieldNames, + T *values) +{ + kwsys_stl::vector fields; + if (!LoadLines(fileName,fields)) { - RetrieveClassicalCPUClockSpeed(); + return -1; } - - if (supportsCPUID) + int i=0; + while (fieldNames[i]!=NULL) { - // Retrieve cache information. - if (!RetrieveCPUCacheDetails()) - { - RetrieveClassicalCPUCacheDetails(); - } - - // Retrieve the extended CPU details. - if (!RetrieveExtendedCPUIdentity()) + int ierr=NameValue(fields,fieldNames[i],values[i]); + if (ierr) { - RetrieveClassicalCPUIdentity(); + return -(i+2); } - - RetrieveExtendedCPUFeatures(); - RetrieveCPUPowerManagement(); - - // Now attempt to retrieve the serial number (if possible). - RetrieveProcessorSerialNumber(); + i+=1; + } + return 0; +} + +// **************************************************************************** +template +int GetFieldFromFile( + const char *fileName, + const char *fieldName, + T &value) +{ + const char *fieldNames[2]={fieldName,NULL}; + T values[1]={T(0)}; + int ierr=GetFieldsFromFile(fileName,fieldNames,values); + if (ierr) + { + return ierr; + } + value=values[0]; + return 0; +} +#endif + +// **************************************************************************** +#if defined(__APPLE__) +template +int GetFieldsFromCommand( + const char *command, + const char **fieldNames, + T *values) +{ + FILE *file=popen(command,"r"); + if (file==0) + { + return -1; + } + kwsys_stl::vector fields; + int nl=LoadLines(file,fields); + pclose(file); + if (nl==0) + { + return -1; + } + int i=0; + while (fieldNames[i]!=NULL) + { + int ierr=NameValue(fields,fieldNames[i],values[i]); + if (ierr) + { + return -(i+2); + } + i+=1; + } + return 0; +} +#endif + +// **************************************************************************** +#if !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) +void StacktraceSignalHandler( + int sigNo, + siginfo_t *sigInfo, + void * /*sigContext*/) +{ +#if defined(__linux) || defined(__APPLE__) + kwsys_ios::ostringstream oss; + oss + << "=========================================================" << kwsys_ios::endl + << "Process id " << getpid() << " "; + switch (sigNo) + { + case SIGFPE: + oss << "Caught SIGFPE "; + switch (sigInfo->si_code) + { +# if defined(FPE_INTDIV) + case FPE_INTDIV: + oss << "integer division by zero"; + break; +# endif + +# if defined(FPE_INTOVF) + case FPE_INTOVF: + oss << "integer overflow"; + break; +# endif + + case FPE_FLTDIV: + oss << "floating point divide by zero"; + break; + + case FPE_FLTOVF: + oss << "floating point overflow"; + break; + + case FPE_FLTUND: + oss << "floating point underflow"; + break; + + case FPE_FLTRES: + oss << "floating point inexact result"; + break; + + case FPE_FLTINV: + oss << "floating point invalid operation"; + break; + +#if defined(FPE_FLTSUB) + case FPE_FLTSUB: + oss << "floating point subscript out of range"; + break; +#endif + + default: + oss << "code " << sigInfo->si_code; + break; + } + break; + + case SIGSEGV: + oss << "Caught SIGSEGV "; + switch (sigInfo->si_code) + { + case SEGV_MAPERR: + oss << "address not mapped to object"; + break; + + case SEGV_ACCERR: + oss << "invalid permission for mapped object"; + break; + + default: + oss << "code " << sigInfo->si_code; + break; + } + break; + + case SIGINT: + oss << "Caught SIGTERM"; + break; + + case SIGTERM: + oss << "Caught SIGTERM"; + break; + + case SIGBUS: + oss << "Caught SIGBUS type "; + switch (sigInfo->si_code) + { + case BUS_ADRALN: + oss << "invalid address alignment"; + break; + +# if defined(BUS_ADRERR) + case BUS_ADRERR: + oss << "non-exestent physical address"; + break; +# endif + +# if defined(BUS_OBJERR) + case BUS_OBJERR: + oss << "object specific hardware error"; + break; +# endif + + default: + oss << "code " << sigInfo->si_code; + break; + } + break; + + case SIGILL: + oss << "Caught SIGILL "; + switch (sigInfo->si_code) + { + case ILL_ILLOPC: + oss << "illegal opcode"; + break; + +# if defined(ILL_ILLOPN) + case ILL_ILLOPN: + oss << "illegal operand"; + break; +# endif + +# if defined(ILL_ILLADR) + case ILL_ILLADR: + oss << "illegal addressing mode."; + break; +# endif + + case ILL_ILLTRP: + oss << "illegal trap"; + + case ILL_PRVOPC: + oss << "privileged opcode"; + break; + +# if defined(ILL_PRVREG) + case ILL_PRVREG: + oss << "privileged register"; + break; +# endif + +# if defined(ILL_COPROC) + case ILL_COPROC: + oss << "co-processor error"; + break; +# endif + +# if defined(ILL_BADSTK) + case ILL_BADSTK: + oss << "internal stack error"; + break; +# endif + + default: + oss << "code " << sigInfo->si_code; + break; + } + break; + + default: + oss << "Caught " << sigNo << " code " << sigInfo->si_code; + break; + } + oss << kwsys_ios::endl; +#if defined(KWSYS_SYSTEMINFORMATION_HAVE_BACKTRACE) + oss << "Program Stack:" << kwsys_ios::endl; + void *stackSymbols[128]; + int n=backtrace(stackSymbols,128); + char **stackText=backtrace_symbols(stackSymbols,n); + for (int i=0; iTotalVirtualMemory = 0; + this->AvailableVirtualMemory = 0; + this->TotalPhysicalMemory = 0; + this->AvailablePhysicalMemory = 0; + this->CurrentPositionInFile = 0; + this->ChipManufacturer = UnknownManufacturer; + memset(&this->Features, 0, sizeof(CPUFeatures)); + this->ChipID.Type = 0; + this->ChipID.Family = 0; + this->ChipID.Model = 0; + this->ChipID.Revision = 0; + this->ChipID.ExtendedFamily = 0; + this->ChipID.ExtendedModel = 0; + this->CPUSpeedInMHz = 0; + this->NumberOfLogicalCPU = 0; + this->NumberOfPhysicalCPU = 0; + this->OSName = ""; + this->Hostname = ""; + this->OSRelease = ""; + this->OSVersion = ""; + this->OSPlatform = ""; +} + +SystemInformationImplementation::~SystemInformationImplementation() +{ +} + +void SystemInformationImplementation::RunCPUCheck() +{ +#ifdef WIN32 + // Check to see if this processor supports CPUID. + bool supportsCPUID = DoesCPUSupportCPUID(); + + if (supportsCPUID) + { + // Retrieve the CPU details. + RetrieveCPUIdentity(); + this->FindManufacturer(); + RetrieveCPUFeatures(); + } + + // These two may be called without support for the CPUID instruction. + // (But if the instruction is there, they should be called *after* + // the above call to RetrieveCPUIdentity... that's why the two if + // blocks exist with the same "if (supportsCPUID)" logic... + // + if (!RetrieveCPUClockSpeed()) + { + RetrieveClassicalCPUClockSpeed(); + } + + if (supportsCPUID) + { + // Retrieve cache information. + if (!RetrieveCPUCacheDetails()) + { + RetrieveClassicalCPUCacheDetails(); + } + + // Retrieve the extended CPU details. + if (!RetrieveExtendedCPUIdentity()) + { + RetrieveClassicalCPUIdentity(); + } + + RetrieveExtendedCPUFeatures(); + RetrieveCPUPowerManagement(); + + // Now attempt to retrieve the serial number (if possible). + RetrieveProcessorSerialNumber(); } this->CPUCount(); @@ -596,13 +1308,19 @@ void SystemInformationImplementation::RunCPUCheck() #elif defined(__APPLE__) this->ParseSysCtl(); #elif defined (__SVR4) && defined (__sun) - this->QuerySolarisInfo(); + this->QuerySolarisProcessor(); #elif defined(__HAIKU__) this->QueryHaikuInfo(); #elif defined(__QNX__) this->QueryQNXProcessor(); -#else +#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) + this->QueryBSDProcessor(); +#elif defined(__hpux) + this->QueryHPUXProcessor(); +#elif defined(__linux) || defined(__CYGWIN__) this->RetreiveInformationFromCpuInfoFile(); +#else + this->QueryProcessor(); #endif } @@ -616,11 +1334,23 @@ void SystemInformationImplementation::RunMemoryCheck() #if defined(__APPLE__) this->ParseSysCtl(); #elif defined (__SVR4) && defined (__sun) - this->QuerySolarisInfo(); + this->QuerySolarisMemory(); #elif defined(__HAIKU__) this->QueryHaikuInfo(); #elif defined(__QNX__) this->QueryQNXMemory(); +#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) + this->QueryBSDMemory(); +#elif defined(__CYGWIN__) + this->QueryCygwinMemory(); +#elif defined(_WIN32) + this->QueryWindowsMemory(); +#elif defined(__hpux) + this->QueryHPUXMemory(); +#elif defined(__linux) + this->QueryLinuxMemory(); +#elif defined(_AIX) + this->QueryAIXMemory(); #else this->QueryMemory(); #endif @@ -641,9 +1371,145 @@ const char * SystemInformationImplementation::GetOSName() /** Get the hostname */ const char* SystemInformationImplementation::GetHostname() { + if (this->Hostname.empty()) + { + this->Hostname="localhost"; +#if defined(_WIN32) + WORD wVersionRequested; + WSADATA wsaData; + char name[255]; + wVersionRequested = MAKEWORD(2,0); + if ( WSAStartup( wVersionRequested, &wsaData ) == 0 ) + { + gethostname(name,sizeof(name)); + WSACleanup( ); + } + this->Hostname = name; +#else + struct utsname unameInfo; + int errorFlag = uname(&unameInfo); + if(errorFlag == 0) + { + this->Hostname = unameInfo.nodename; + } +#endif + } return this->Hostname.c_str(); } +/** Get the FQDN */ +int SystemInformationImplementation::GetFullyQualifiedDomainName( + kwsys_stl::string &fqdn) +{ + // in the event of absolute failure return localhost. + fqdn="localhost"; + +#if defined(_WIN32) + int ierr; + // TODO - a more robust implementation for windows, see comments + // in unix implementation. + WSADATA wsaData; + WORD ver=MAKEWORD(2,0); + ierr=WSAStartup(ver,&wsaData); + if (ierr) + { + return -1; + } + + char base[256]={'\0'}; + ierr=gethostname(base,256); + if (ierr) + { + WSACleanup(); + return -2; + } + fqdn=base; + + HOSTENT *hent=gethostbyname(base); + if (hent) + { + fqdn=hent->h_name; + } + + WSACleanup(); + return 0; + +#elif defined(KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN) + // gethostname typical returns an alias for loopback interface + // we want the fully qualified domain name. Because there are + // any number of interfaces on this system we look for the + // first of these that contains the name returned by gethostname + // and is longer. failing that we return gethostname and indicate + // with a failure code. Return of a failure code is not necessarilly + // an indication of an error. for instance gethostname may return + // the fully qualified domain name, or there may not be one if the + // system lives on a private network such as in the case of a cluster + // node. + + int ierr=0; + char base[NI_MAXHOST]; + ierr=gethostname(base,NI_MAXHOST); + if (ierr) + { + return -1; + } + size_t baseSize=strlen(base); + fqdn=base; + + struct ifaddrs *ifas; + struct ifaddrs *ifa; + ierr=getifaddrs(&ifas); + if (ierr) + { + return -2; + } + + for (ifa=ifas; ifa!=NULL; ifa=ifa->ifa_next) + { + int fam = ifa->ifa_addr? ifa->ifa_addr->sa_family : -1; + if ((fam==AF_INET) || (fam==AF_INET6)) + { + char host[NI_MAXHOST]={'\0'}; + + int addrlen + = (fam==AF_INET?sizeof(struct sockaddr_in):sizeof(struct sockaddr_in6)); + + ierr=getnameinfo( + ifa->ifa_addr, + addrlen, + host, + NI_MAXHOST, + NULL, + 0, + NI_NAMEREQD); + if (ierr) + { + // don't report the failure now since we may succeed on another + // interface. If all attempts fail then return the failure code. + ierr=-3; + continue; + } + + kwsys_stl::string candidate=host; + if ((candidate.find(base)!=kwsys_stl::string::npos) && baseSizeGetHostname(); + return -1; +#endif +} + /** Get the OS release */ const char* SystemInformationImplementation::GetOSRelease() { @@ -692,6 +1558,8 @@ const char * SystemInformationImplementation::GetVendorID() return "IBM"; case Motorola: return "Motorola"; + case HP: + return "Hewlett-Packard"; default: return "Unknown Manufacturer"; } @@ -721,9 +1589,15 @@ kwsys_stl::string SystemInformationImplementation::GetModelID() return str.str(); } +// Return the model name of CPU present */ +kwsys_stl::string SystemInformationImplementation::GetModelName() +{ + return this->ChipID.ModelName; +} + /** Return the stepping code of the CPU present. */ kwsys_stl::string SystemInformationImplementation::GetSteppingCode() -{ +{ kwsys_ios::ostringstream str; str << this->ChipID.Revision; return str.str(); @@ -734,8 +1608,8 @@ const char * SystemInformationImplementation::GetExtendedProcessorName() { return this->ChipID.ProcessorName.c_str(); } - -/** Return the serial number of the processor + +/** Return the serial number of the processor * in hexadecimal: xxxx-xxxx-xxxx-xxxx-xxxx-xxxx. */ const char * SystemInformationImplementation::GetProcessorSerialNumber() { @@ -870,7 +1744,7 @@ void SystemInformationImplementation::Delay(unsigned int uiMS) QueryPerformanceCounter (&StartCounter); do { - // Get the ending position of the counter. + // Get the ending position of the counter. QueryPerformanceCounter (&EndCounter); } while (EndCounter.QuadPart - StartCounter.QuadPart < x); #endif @@ -880,140 +1754,89 @@ void SystemInformationImplementation::Delay(unsigned int uiMS) bool SystemInformationImplementation::DoesCPUSupportCPUID() { +#if USE_CPUID + int dummy[4] = { 0, 0, 0, 0 }; + #if USE_ASM_INSTRUCTIONS - // Use SEH to determine CPUID presence - __try { - _asm { -#ifdef CPUID_AWARE_COMPILER - ; we must push/pop the registers <> writes to, as the - ; optimiser doesn't know about <>, and so doesn't expect - ; these registers to change. - push eax - push ebx - push ecx - push edx + return call_cpuid(0, dummy); +#else + call_cpuid(0, dummy); + return dummy[0] || dummy[1] || dummy[2] || dummy[3]; #endif - ; <> - mov eax, 0 - CPUID_INSTRUCTION - -#ifdef CPUID_AWARE_COMPILER - pop edx - pop ecx - pop ebx - pop eax -#endif - } - } - __except(1) - { - // Stop the class from trying to use CPUID again! - return false; - } - - // The cpuid instruction succeeded. - return true; - -#else - // Assume no cpuid instruction. - return false; +#else + // Assume no cpuid instruction. + return false; #endif } bool SystemInformationImplementation::RetrieveCPUFeatures() { -#if USE_ASM_INSTRUCTIONS - int localCPUFeatures = 0; - int localCPUAdvanced = 0; - - // Use assembly to detect CPUID information... - __try { - _asm { -#ifdef CPUID_AWARE_COMPILER - ; we must push/pop the registers <> writes to, as the - ; optimiser doesn't know about <>, and so doesn't expect - ; these registers to change. - push eax - push ebx - push ecx - push edx -#endif - ; <> - ; eax = 1 --> eax: CPU ID - bits 31..16 - unused, bits 15..12 - type, bits 11..8 - family, bits 7..4 - model, bits 3..0 - mask revision - ; ebx: 31..24 - default APIC ID, 23..16 - logical processsor ID, 15..8 - CFLUSH chunk size , 7..0 - brand ID - ; edx: CPU feature flags - mov eax,1 - CPUID_INSTRUCTION - mov localCPUFeatures, edx - mov localCPUAdvanced, ebx +#if USE_CPUID + int cpuinfo[4] = { 0, 0, 0, 0 }; -#ifdef CPUID_AWARE_COMPILER - pop edx - pop ecx - pop ebx - pop eax -#endif - } - } - __except(1) + if (!call_cpuid(1, cpuinfo)) { return false; } // Retrieve the features of CPU present. - this->Features.HasFPU = ((localCPUFeatures & 0x00000001) != 0); // FPU Present --> Bit 0 - this->Features.HasTSC = ((localCPUFeatures & 0x00000010) != 0); // TSC Present --> Bit 4 - this->Features.HasAPIC = ((localCPUFeatures & 0x00000200) != 0); // APIC Present --> Bit 9 - this->Features.HasMTRR = ((localCPUFeatures & 0x00001000) != 0); // MTRR Present --> Bit 12 - this->Features.HasCMOV = ((localCPUFeatures & 0x00008000) != 0); // CMOV Present --> Bit 15 - this->Features.HasSerial = ((localCPUFeatures & 0x00040000) != 0); // Serial Present --> Bit 18 - this->Features.HasACPI = ((localCPUFeatures & 0x00400000) != 0); // ACPI Capable --> Bit 22 - this->Features.HasMMX = ((localCPUFeatures & 0x00800000) != 0); // MMX Present --> Bit 23 - this->Features.HasSSE = ((localCPUFeatures & 0x02000000) != 0); // SSE Present --> Bit 25 - this->Features.HasSSE2 = ((localCPUFeatures & 0x04000000) != 0); // SSE2 Present --> Bit 26 - this->Features.HasThermal = ((localCPUFeatures & 0x20000000) != 0); // Thermal Monitor Present --> Bit 29 - this->Features.HasIA64 = ((localCPUFeatures & 0x40000000) != 0); // IA64 Present --> Bit 30 + this->Features.HasFPU = ((cpuinfo[3] & 0x00000001) != 0); // FPU Present --> Bit 0 + this->Features.HasTSC = ((cpuinfo[3] & 0x00000010) != 0); // TSC Present --> Bit 4 + this->Features.HasAPIC = ((cpuinfo[3] & 0x00000200) != 0); // APIC Present --> Bit 9 + this->Features.HasMTRR = ((cpuinfo[3] & 0x00001000) != 0); // MTRR Present --> Bit 12 + this->Features.HasCMOV = ((cpuinfo[3] & 0x00008000) != 0); // CMOV Present --> Bit 15 + this->Features.HasSerial = ((cpuinfo[3] & 0x00040000) != 0); // Serial Present --> Bit 18 + this->Features.HasACPI = ((cpuinfo[3] & 0x00400000) != 0); // ACPI Capable --> Bit 22 + this->Features.HasMMX = ((cpuinfo[3] & 0x00800000) != 0); // MMX Present --> Bit 23 + this->Features.HasSSE = ((cpuinfo[3] & 0x02000000) != 0); // SSE Present --> Bit 25 + this->Features.HasSSE2 = ((cpuinfo[3] & 0x04000000) != 0); // SSE2 Present --> Bit 26 + this->Features.HasThermal = ((cpuinfo[3] & 0x20000000) != 0); // Thermal Monitor Present --> Bit 29 + this->Features.HasIA64 = ((cpuinfo[3] & 0x40000000) != 0); // IA64 Present --> Bit 30 +#if USE_ASM_INSTRUCTIONS // Retrieve extended SSE capabilities if SSE is available. if (this->Features.HasSSE) { - + // Attempt to __try some SSE FP instructions. - __try + __try { // Perform: orps xmm0, xmm0 - _asm + _asm { _emit 0x0f _emit 0x56 - _emit 0xc0 + _emit 0xc0 } // SSE FP capable processor. this->Features.HasSSEFP = true; - } - __except(1) + } + __except(1) { // bad instruction - processor or OS cannot handle SSE FP. this->Features.HasSSEFP = false; } - } - else + } + else { // Set the advanced SSE capabilities to not available. this->Features.HasSSEFP = false; } +#else + this->Features.HasSSEFP = false; +#endif // Retrieve Intel specific extended features. - if (this->ChipManufacturer == Intel) + if (this->ChipManufacturer == Intel) { - this->Features.ExtendedFeatures.SupportsHyperthreading = ((localCPUFeatures & 0x10000000) != 0); // Intel specific: Hyperthreading --> Bit 28 - this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical = (this->Features.ExtendedFeatures.SupportsHyperthreading) ? ((localCPUAdvanced & 0x00FF0000) >> 16) : 1; - + this->Features.ExtendedFeatures.SupportsHyperthreading = ((cpuinfo[3] & 0x10000000) != 0); // Intel specific: Hyperthreading --> Bit 28 + this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical = (this->Features.ExtendedFeatures.SupportsHyperthreading) ? ((cpuinfo[1] & 0x00FF0000) >> 16) : 1; + if ((this->Features.ExtendedFeatures.SupportsHyperthreading) && (this->Features.HasAPIC)) { // Retrieve APIC information if there is one present. - this->Features.ExtendedFeatures.APIC_ID = ((localCPUAdvanced & 0xFF000000) >> 24); + this->Features.ExtendedFeatures.APIC_ID = ((cpuinfo[1] & 0xFF000000) >> 24); } } @@ -1026,7 +1849,7 @@ bool SystemInformationImplementation::RetrieveCPUFeatures() /** Find the manufacturer given the vendor id */ -void SystemInformationImplementation::FindManufacturer() +void SystemInformationImplementation::FindManufacturer(const kwsys_stl::string& family) { if (this->ChipID.Vendor == "GenuineIntel") this->ChipManufacturer = Intel; // Intel Corp. else if (this->ChipID.Vendor == "UMC UMC UMC ") this->ChipManufacturer = UMC; // United Microelectronics Corp. @@ -1041,7 +1864,9 @@ void SystemInformationImplementation::FindManufacturer() else if (this->ChipID.Vendor == "Geode By NSC") this->ChipManufacturer = NSC; // National Semiconductor else if (this->ChipID.Vendor == "Sun") this->ChipManufacturer = Sun; // Sun Microelectronics else if (this->ChipID.Vendor == "IBM") this->ChipManufacturer = IBM; // IBM Microelectronics + else if (this->ChipID.Vendor == "Hewlett-Packard") this->ChipManufacturer = HP; // Hewlett-Packard else if (this->ChipID.Vendor == "Motorola") this->ChipManufacturer = Motorola; // Motorola Microelectronics + else if (family.substr(0, 7) == "PA-RISC") this->ChipManufacturer = HP; // Hewlett-Packard else this->ChipManufacturer = UnknownManufacturer; // Unknown manufacturer } @@ -1049,73 +1874,41 @@ void SystemInformationImplementation::FindManufacturer() /** */ bool SystemInformationImplementation::RetrieveCPUIdentity() { -#if USE_ASM_INSTRUCTIONS - int localCPUVendor[3]; - int localCPUSignature; +#if USE_CPUID + int localCPUVendor[4]; + int localCPUSignature[4]; - // Use assembly to detect CPUID information... - __try + if (!call_cpuid(0, localCPUVendor)) { - _asm - { -#ifdef CPUID_AWARE_COMPILER - ; we must push/pop the registers <> writes to, as the - ; optimiser doesn't know about <>, and so doesn't expect - ; these registers to change. - push eax - push ebx - push ecx - push edx -#endif - ; <> - ; eax = 0 --> eax: maximum value of CPUID instruction. - ; ebx: part 1 of 3; CPU signature. - ; edx: part 2 of 3; CPU signature. - ; ecx: part 3 of 3; CPU signature. - mov eax, 0 - CPUID_INSTRUCTION - mov localCPUVendor[0 * TYPE int], ebx - mov localCPUVendor[1 * TYPE int], edx - mov localCPUVendor[2 * TYPE int], ecx - - ; <> - ; eax = 1 --> eax: CPU ID - bits 31..16 - unused, bits 15..12 - type, bits 11..8 - family, bits 7..4 - model, bits 3..0 - mask revision - ; ebx: 31..24 - default APIC ID, 23..16 - logical processsor ID, 15..8 - CFLUSH chunk size , 7..0 - brand ID - ; edx: CPU feature flags - mov eax,1 - CPUID_INSTRUCTION - mov localCPUSignature, eax - -#ifdef CPUID_AWARE_COMPILER - pop edx - pop ecx - pop ebx - pop eax -#endif + return false; } - } - __except(1) + if (!call_cpuid(1, localCPUSignature)) { return false; } // Process the returned information. + // ; eax = 0 --> eax: maximum value of CPUID instruction. + // ; ebx: part 1 of 3; CPU signature. + // ; edx: part 2 of 3; CPU signature. + // ; ecx: part 3 of 3; CPU signature. char vbuf[13]; - memcpy (&(vbuf[0]), &(localCPUVendor[0]), sizeof (int)); - memcpy (&(vbuf[4]), &(localCPUVendor[1]), sizeof (int)); + memcpy (&(vbuf[0]), &(localCPUVendor[1]), sizeof (int)); + memcpy (&(vbuf[4]), &(localCPUVendor[3]), sizeof (int)); memcpy (&(vbuf[8]), &(localCPUVendor[2]), sizeof (int)); vbuf[12] = '\0'; this->ChipID.Vendor = vbuf; - this->FindManufacturer(); - // Retrieve the family of CPU present. - this->ChipID.ExtendedFamily = ((localCPUSignature & 0x0FF00000) >> 20); // Bits 27..20 Used - this->ChipID.ExtendedModel = ((localCPUSignature & 0x000F0000) >> 16); // Bits 19..16 Used - this->ChipID.Type = ((localCPUSignature & 0x0000F000) >> 12); // Bits 15..12 Used - this->ChipID.Family = ((localCPUSignature & 0x00000F00) >> 8); // Bits 11..8 Used - this->ChipID.Model = ((localCPUSignature & 0x000000F0) >> 4); // Bits 7..4 Used - this->ChipID.Revision = ((localCPUSignature & 0x0000000F) >> 0); // Bits 3..0 Used + // ; eax = 1 --> eax: CPU ID - bits 31..16 - unused, bits 15..12 - type, bits 11..8 - family, bits 7..4 - model, bits 3..0 - mask revision + // ; ebx: 31..24 - default APIC ID, 23..16 - logical processor ID, 15..8 - CFLUSH chunk size , 7..0 - brand ID + // ; edx: CPU feature flags + this->ChipID.ExtendedFamily = ((localCPUSignature[0] & 0x0FF00000) >> 20); // Bits 27..20 Used + this->ChipID.ExtendedModel = ((localCPUSignature[0] & 0x000F0000) >> 16); // Bits 19..16 Used + this->ChipID.Type = ((localCPUSignature[0] & 0x0000F000) >> 12); // Bits 15..12 Used + this->ChipID.Family = ((localCPUSignature[0] & 0x00000F00) >> 8); // Bits 11..8 Used + this->ChipID.Model = ((localCPUSignature[0] & 0x000000F0) >> 4); // Bits 7..4 Used + this->ChipID.Revision = ((localCPUSignature[0] & 0x0000000F) >> 0); // Bits 3..0 Used return true; @@ -1128,111 +1921,43 @@ bool SystemInformationImplementation::RetrieveCPUIdentity() /** */ bool SystemInformationImplementation::RetrieveCPUCacheDetails() { -#if USE_ASM_INSTRUCTIONS +#if USE_CPUID int L1Cache[4] = { 0, 0, 0, 0 }; int L2Cache[4] = { 0, 0, 0, 0 }; // Check to see if what we are about to do is supported... - if (RetrieveCPUExtendedLevelSupport (0x80000005)) + if (RetrieveCPUExtendedLevelSupport (0x80000005)) { - // Use assembly to retrieve the L1 cache information ... - __try - { - _asm - { -#ifdef CPUID_AWARE_COMPILER - ; we must push/pop the registers <> writes to, as the - ; optimiser doesn't know about <>, and so doesn't expect - ; these registers to change. - push eax - push ebx - push ecx - push edx -#endif - ; <> - ; eax = 0x80000005 --> eax: L1 cache information - Part 1 of 4. - ; ebx: L1 cache information - Part 2 of 4. - ; edx: L1 cache information - Part 3 of 4. - ; ecx: L1 cache information - Part 4 of 4. - mov eax, 0x80000005 - CPUID_INSTRUCTION - mov L1Cache[0 * TYPE int], eax - mov L1Cache[1 * TYPE int], ebx - mov L1Cache[2 * TYPE int], ecx - mov L1Cache[3 * TYPE int], edx - -#ifdef CPUID_AWARE_COMPILER - pop edx - pop ecx - pop ebx - pop eax -#endif - } - } - __except(1) + if (!call_cpuid(0x80000005, L1Cache)) { return false; } // Save the L1 data cache size (in KB) from ecx: bits 31..24 as well as data cache size from edx: bits 31..24. this->Features.L1CacheSize = ((L1Cache[2] & 0xFF000000) >> 24); this->Features.L1CacheSize += ((L1Cache[3] & 0xFF000000) >> 24); - } - else + } + else { // Store -1 to indicate the cache could not be queried. this->Features.L1CacheSize = -1; } // Check to see if what we are about to do is supported... - if (RetrieveCPUExtendedLevelSupport (0x80000006)) + if (RetrieveCPUExtendedLevelSupport (0x80000006)) { - // Use assembly to retrieve the L2 cache information ... - __try - { - _asm - { -#ifdef CPUID_AWARE_COMPILER - ; we must push/pop the registers <> writes to, as the - ; optimiser doesn't know about <>, and so doesn't expect - ; these registers to change. - push eax - push ebx - push ecx - push edx -#endif - ; <> - ; eax = 0x80000006 --> eax: L2 cache information - Part 1 of 4. - ; ebx: L2 cache information - Part 2 of 4. - ; edx: L2 cache information - Part 3 of 4. - ; ecx: L2 cache information - Part 4 of 4. - mov eax, 0x80000006 - CPUID_INSTRUCTION - mov L2Cache[0 * TYPE int], eax - mov L2Cache[1 * TYPE int], ebx - mov L2Cache[2 * TYPE int], ecx - mov L2Cache[3 * TYPE int], edx - -#ifdef CPUID_AWARE_COMPILER - pop edx - pop ecx - pop ebx - pop eax -#endif - } - } - __except(1) + if (!call_cpuid(0x80000006, L2Cache)) { return false; } // Save the L2 unified cache size (in KB) from ecx: bits 31..16. this->Features.L2CacheSize = ((L2Cache[2] & 0xFFFF0000) >> 16); - } + } else { // Store -1 to indicate the cache could not be queried. this->Features.L2CacheSize = -1; } - + // Define L3 as being not present as we cannot test for it. this->Features.L3CacheSize = -1; @@ -1246,7 +1971,7 @@ bool SystemInformationImplementation::RetrieveCPUCacheDetails() /** */ bool SystemInformationImplementation::RetrieveClassicalCPUCacheDetails() { -#if USE_ASM_INSTRUCTIONS +#if USE_CPUID int TLBCode = -1, TLBData = -1, L1Code = -1, L1Data = -1, L1Trace = -1, L2Unified = -1, L3Unified = -1; int TLBCacheData[4] = { 0, 0, 0, 0 }; int TLBPassCounter = 0; @@ -1254,39 +1979,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUCacheDetails() do { - // Use assembly to retrieve the L2 cache information ... - __try { - _asm { -#ifdef CPUID_AWARE_COMPILER - ; we must push/pop the registers <> writes to, as the - ; optimiser doesn't know about <>, and so doesn't expect - ; these registers to change. - push eax - push ebx - push ecx - push edx -#endif - ; <> - ; eax = 2 --> eax: TLB and cache information - Part 1 of 4. - ; ebx: TLB and cache information - Part 2 of 4. - ; ecx: TLB and cache information - Part 3 of 4. - ; edx: TLB and cache information - Part 4 of 4. - mov eax, 2 - CPUID_INSTRUCTION - mov TLBCacheData[0 * TYPE int], eax - mov TLBCacheData[1 * TYPE int], ebx - mov TLBCacheData[2 * TYPE int], ecx - mov TLBCacheData[3 * TYPE int], edx - -#ifdef CPUID_AWARE_COMPILER - pop edx - pop ecx - pop ebx - pop eax -#endif - } - } - __except(1) + if (!call_cpuid(2, TLBCacheData)) { return false; } @@ -1294,10 +1987,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUCacheDetails() int bob = ((TLBCacheData[0] & 0x00FF0000) >> 16); (void)bob; // Process the returned TLB and cache information. - for (int nCounter = 0; nCounter < TLBCACHE_INFO_UNITS; nCounter ++) + for (int nCounter = 0; nCounter < TLBCACHE_INFO_UNITS; nCounter ++) { // First of all - decide which unit we are dealing with. - switch (nCounter) + switch (nCounter) { // eax: bits 8..15 : bits 16..23 : bits 24..31 case 0: TLBCacheUnit = ((TLBCacheData[0] & 0x0000FF00) >> 8); break; @@ -1327,7 +2020,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUCacheDetails() } // Now process the resulting unit to see what it means.... - switch (TLBCacheUnit) + switch (TLBCacheUnit) { case 0x00: break; case 0x01: STORE_TLBCACHE_INFO (TLBCode, 4); break; @@ -1383,7 +2076,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUCacheDetails() case 0x90: STORE_TLBCACHE_INFO (TLBCode, 262144); break; // <-- FIXME: IA-64 Only case 0x96: STORE_TLBCACHE_INFO (TLBCode, 262144); break; // <-- FIXME: IA-64 Only case 0x9b: STORE_TLBCACHE_INFO (TLBCode, 262144); break; // <-- FIXME: IA-64 Only - + // Default case - an error has occured. default: return false; } @@ -1394,47 +2087,47 @@ bool SystemInformationImplementation::RetrieveClassicalCPUCacheDetails() } while ((TLBCacheData[0] & 0x000000FF) > TLBPassCounter); // Ok - we now have the maximum TLB, L1, L2, and L3 sizes... - if ((L1Code == -1) && (L1Data == -1) && (L1Trace == -1)) + if ((L1Code == -1) && (L1Data == -1) && (L1Trace == -1)) { this->Features.L1CacheSize = -1; } - else if ((L1Code == -1) && (L1Data == -1) && (L1Trace != -1)) + else if ((L1Code == -1) && (L1Data == -1) && (L1Trace != -1)) { this->Features.L1CacheSize = L1Trace; } - else if ((L1Code != -1) && (L1Data == -1)) + else if ((L1Code != -1) && (L1Data == -1)) { this->Features.L1CacheSize = L1Code; } - else if ((L1Code == -1) && (L1Data != -1)) + else if ((L1Code == -1) && (L1Data != -1)) { this->Features.L1CacheSize = L1Data; } - else if ((L1Code != -1) && (L1Data != -1)) + else if ((L1Code != -1) && (L1Data != -1)) { this->Features.L1CacheSize = L1Code + L1Data; } - else + else { this->Features.L1CacheSize = -1; } // Ok - we now have the maximum TLB, L1, L2, and L3 sizes... - if (L2Unified == -1) + if (L2Unified == -1) { this->Features.L2CacheSize = -1; } - else + else { this->Features.L2CacheSize = L2Unified; } // Ok - we now have the maximum TLB, L1, L2, and L3 sizes... - if (L3Unified == -1) + if (L3Unified == -1) { this->Features.L3CacheSize = -1; } - else + else { this->Features.L3CacheSize = L3Unified; } @@ -1453,11 +2146,40 @@ bool SystemInformationImplementation::RetrieveCPUClockSpeed() bool retrieved = false; #if defined(_WIN32) - // First of all we check to see if the RDTSC (0x0F, 0x31) instruction is - // supported. If not, we fallback to trying to read this value from the - // registry: - // - if (!this->Features.HasTSC) + unsigned int uiRepetitions = 1; + unsigned int uiMSecPerRepetition = 50; + __int64 i64Total = 0; + __int64 i64Overhead = 0; + + // Check if the TSC implementation works at all + if (this->Features.HasTSC && + GetCyclesDifference(SystemInformationImplementation::Delay, + uiMSecPerRepetition) > 0) + { + for (unsigned int nCounter = 0; nCounter < uiRepetitions; nCounter ++) + { + i64Total += GetCyclesDifference (SystemInformationImplementation::Delay, + uiMSecPerRepetition); + i64Overhead += + GetCyclesDifference (SystemInformationImplementation::DelayOverhead, + uiMSecPerRepetition); + } + + // Calculate the MHz speed. + i64Total -= i64Overhead; + i64Total /= uiRepetitions; + i64Total /= uiMSecPerRepetition; + i64Total /= 1000; + + // Save the CPU speed. + this->CPUSpeedInMHz = (float) i64Total; + + retrieved = true; + } + + // If RDTSC is not supported, we fallback to trying to read this value + // from the registry: + if (!retrieved) { HKEY hKey = NULL; LONG err = RegOpenKeyEx(HKEY_LOCAL_MACHINE, @@ -1482,34 +2204,7 @@ bool SystemInformationImplementation::RetrieveCPUClockSpeed() RegCloseKey(hKey); hKey = NULL; } - - return retrieved; } - - unsigned int uiRepetitions = 1; - unsigned int uiMSecPerRepetition = 50; - __int64 i64Total = 0; - __int64 i64Overhead = 0; - - for (unsigned int nCounter = 0; nCounter < uiRepetitions; nCounter ++) - { - i64Total += GetCyclesDifference (SystemInformationImplementation::Delay, - uiMSecPerRepetition); - i64Overhead += - GetCyclesDifference (SystemInformationImplementation::DelayOverhead, - uiMSecPerRepetition); - } - - // Calculate the MHz speed. - i64Total -= i64Overhead; - i64Total /= uiRepetitions; - i64Total /= uiMSecPerRepetition; - i64Total /= 1000; - - // Save the CPU speed. - this->CPUSpeedInMHz = (float) i64Total; - - retrieved = true; #endif return retrieved; @@ -1526,19 +2221,19 @@ bool SystemInformationImplementation::RetrieveClassicalCPUClockSpeed() // Attempt to get a starting tick count. QueryPerformanceCounter (&liStart); - __try + __try { - _asm + _asm { mov eax, 0x80000000 mov ebx, CLASSICAL_CPU_FREQ_LOOP - Timer_Loop: + Timer_Loop: bsf ecx,eax dec ebx jnz Timer_Loop - } + } } - __except(1) + __except(1) { return false; } @@ -1551,22 +2246,22 @@ bool SystemInformationImplementation::RetrieveClassicalCPUClockSpeed() dDifference = (((double) liEnd.QuadPart - (double) liStart.QuadPart) / (double) liCountsPerSecond.QuadPart); // Calculate the clock speed. - if (this->ChipID.Family == 3) + if (this->ChipID.Family == 3) { // 80386 processors.... Loop time is 115 cycles! dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 115) / dDifference) / 1000000); - } - else if (this->ChipID.Family == 4) + } + else if (this->ChipID.Family == 4) { // 80486 processors.... Loop time is 47 cycles! dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 47) / dDifference) / 1000000); - } - else if (this->ChipID.Family == 5) + } + else if (this->ChipID.Family == 5) { // Pentium processors.... Loop time is 43 cycles! dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 43) / dDifference) / 1000000); } - + // Save the clock speed. this->Features.CPUSpeed = (int) dFrequency; @@ -1581,9 +2276,9 @@ bool SystemInformationImplementation::RetrieveClassicalCPUClockSpeed() /** */ bool SystemInformationImplementation::RetrieveCPUExtendedLevelSupport(int CPULevelToCheck) { - int MaxCPUExtendedLevel = 0; + int cpuinfo[4] = { 0, 0, 0, 0 }; - // The extended CPUID is supported by various vendors starting with the following CPU models: + // The extended CPUID is supported by various vendors starting with the following CPU models: // // Manufacturer & Chip Name | Family Model Revision // @@ -1596,27 +2291,27 @@ bool SystemInformationImplementation::RetrieveCPUExtendedLevelSupport(int CPULev // // We check to see if a supported processor is present... - if (this->ChipManufacturer == AMD) + if (this->ChipManufacturer == AMD) { if (this->ChipID.Family < 5) return false; if ((this->ChipID.Family == 5) && (this->ChipID.Model < 6)) return false; - } - else if (this->ChipManufacturer == Cyrix) + } + else if (this->ChipManufacturer == Cyrix) { if (this->ChipID.Family < 5) return false; if ((this->ChipID.Family == 5) && (this->ChipID.Model < 4)) return false; if ((this->ChipID.Family == 6) && (this->ChipID.Model < 5)) return false; - } - else if (this->ChipManufacturer == IDT) + } + else if (this->ChipManufacturer == IDT) { if (this->ChipID.Family < 5) return false; if ((this->ChipID.Family == 5) && (this->ChipID.Model < 8)) return false; - } - else if (this->ChipManufacturer == Transmeta) + } + else if (this->ChipManufacturer == Transmeta) { if (this->ChipID.Family < 5) return false; - } - else if (this->ChipManufacturer == Intel) + } + else if (this->ChipManufacturer == Intel) { if (this->ChipID.Family < 0xf) { @@ -1624,35 +2319,8 @@ bool SystemInformationImplementation::RetrieveCPUExtendedLevelSupport(int CPULev } } -#if USE_ASM_INSTRUCTIONS - - // Use assembly to detect CPUID information... - __try { - _asm { -#ifdef CPUID_AWARE_COMPILER - ; we must push/pop the registers <> writes to, as the - ; optimiser doesn't know about <>, and so doesn't expect - ; these registers to change. - push eax - push ebx - push ecx - push edx -#endif - ; <> - ; eax = 0x80000000 --> eax: maximum supported extended level - mov eax,0x80000000 - CPUID_INSTRUCTION - mov MaxCPUExtendedLevel, eax - -#ifdef CPUID_AWARE_COMPILER - pop edx - pop ecx - pop ebx - pop eax -#endif - } - } - __except(1) +#if USE_CPUID + if (!call_cpuid(0x80000000, cpuinfo)) { return false; } @@ -1660,7 +2328,7 @@ bool SystemInformationImplementation::RetrieveCPUExtendedLevelSupport(int CPULev // Now we have to check the level wanted vs level returned... int nLevelWanted = (CPULevelToCheck & 0x7FFFFFFF); - int nLevelReturn = (MaxCPUExtendedLevel & 0x7FFFFFFF); + int nLevelReturn = (cpuinfo[0] & 0x7FFFFFFF); // Check to see if the level provided is supported... if (nLevelWanted > nLevelReturn) @@ -1677,7 +2345,7 @@ bool SystemInformationImplementation::RetrieveExtendedCPUFeatures() { // Check that we are not using an Intel processor as it does not support this. - if (this->ChipManufacturer == Intel) + if (this->ChipManufacturer == Intel) { return false; } @@ -1688,60 +2356,30 @@ bool SystemInformationImplementation::RetrieveExtendedCPUFeatures() return false; } -#if USE_ASM_INSTRUCTIONS - int localCPUExtendedFeatures = 0; - - // Use assembly to detect CPUID information... - __try - { - _asm - { -#ifdef CPUID_AWARE_COMPILER - ; we must push/pop the registers <> writes to, as the - ; optimiser doesn't know about <>, and so doesn't expect - ; these registers to change. - push eax - push ebx - push ecx - push edx -#endif - ; <> - ; eax = 0x80000001 --> eax: CPU ID - bits 31..16 - unused, bits 15..12 - type, bits 11..8 - family, bits 7..4 - model, bits 3..0 - mask revision - ; ebx: 31..24 - default APIC ID, 23..16 - logical processsor ID, 15..8 - CFLUSH chunk size , 7..0 - brand ID - ; edx: CPU feature flags - mov eax,0x80000001 - CPUID_INSTRUCTION - mov localCPUExtendedFeatures, edx +#if USE_CPUID + int localCPUExtendedFeatures[4] = { 0, 0, 0, 0 }; -#ifdef CPUID_AWARE_COMPILER - pop edx - pop ecx - pop ebx - pop eax -#endif - } - } - __except(1) + if (!call_cpuid(0x80000001, localCPUExtendedFeatures)) { return false; } // Retrieve the extended features of CPU present. - this->Features.ExtendedFeatures.Has3DNow = ((localCPUExtendedFeatures & 0x80000000) != 0); // 3DNow Present --> Bit 31. - this->Features.ExtendedFeatures.Has3DNowPlus = ((localCPUExtendedFeatures & 0x40000000) != 0); // 3DNow+ Present -- > Bit 30. - this->Features.ExtendedFeatures.HasSSEMMX = ((localCPUExtendedFeatures & 0x00400000) != 0); // SSE MMX Present --> Bit 22. - this->Features.ExtendedFeatures.SupportsMP = ((localCPUExtendedFeatures & 0x00080000) != 0); // MP Capable -- > Bit 19. - + this->Features.ExtendedFeatures.Has3DNow = ((localCPUExtendedFeatures[3] & 0x80000000) != 0); // 3DNow Present --> Bit 31. + this->Features.ExtendedFeatures.Has3DNowPlus = ((localCPUExtendedFeatures[3] & 0x40000000) != 0); // 3DNow+ Present -- > Bit 30. + this->Features.ExtendedFeatures.HasSSEMMX = ((localCPUExtendedFeatures[3] & 0x00400000) != 0); // SSE MMX Present --> Bit 22. + this->Features.ExtendedFeatures.SupportsMP = ((localCPUExtendedFeatures[3] & 0x00080000) != 0); // MP Capable -- > Bit 19. + // Retrieve AMD specific extended features. - if (this->ChipManufacturer == AMD) + if (this->ChipManufacturer == AMD) { - this->Features.ExtendedFeatures.HasMMXPlus = ((localCPUExtendedFeatures & 0x00400000) != 0); // AMD specific: MMX-SSE --> Bit 22 + this->Features.ExtendedFeatures.HasMMXPlus = ((localCPUExtendedFeatures[3] & 0x00400000) != 0); // AMD specific: MMX-SSE --> Bit 22 } // Retrieve Cyrix specific extended features. - if (this->ChipManufacturer == Cyrix) + if (this->ChipManufacturer == Cyrix) { - this->Features.ExtendedFeatures.HasMMXPlus = ((localCPUExtendedFeatures & 0x01000000) != 0); // Cyrix specific: Extended MMX --> Bit 24 + this->Features.ExtendedFeatures.HasMMXPlus = ((localCPUExtendedFeatures[3] & 0x01000000) != 0); // Cyrix specific: Extended MMX --> Bit 24 } return true; @@ -1761,51 +2399,20 @@ bool SystemInformationImplementation::RetrieveProcessorSerialNumber() return false; } -#if USE_ASM_INSTRUCTIONS - int SerialNumber[3]; - - // Use assembly to detect CPUID information... - __try { - _asm { -#ifdef CPUID_AWARE_COMPILER - ; we must push/pop the registers <> writes to, as the - ; optimiser doesn't know about <>, and so doesn't expect - ; these registers to change. - push eax - push ebx - push ecx - push edx -#endif - ; <> - ; eax = 3 --> ebx: top 32 bits are the processor signature bits --> NB: Transmeta only ?!? - ; ecx: middle 32 bits are the processor signature bits - ; edx: bottom 32 bits are the processor signature bits - mov eax, 3 - CPUID_INSTRUCTION - mov SerialNumber[0 * TYPE int], ebx - mov SerialNumber[1 * TYPE int], ecx - mov SerialNumber[2 * TYPE int], edx +#if USE_CPUID + int SerialNumber[4]; -#ifdef CPUID_AWARE_COMPILER - pop edx - pop ecx - pop ebx - pop eax -#endif - } - } - __except(1) + if (!call_cpuid(3, SerialNumber)) { return false; } // Process the returned information. + // ; eax = 3 --> ebx: top 32 bits are the processor signature bits --> NB: Transmeta only ?!? + // ; ecx: middle 32 bits are the processor signature bits + // ; edx: bottom 32 bits are the processor signature bits char sn[128]; sprintf (sn, "%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x", - ((SerialNumber[0] & 0xff000000) >> 24), - ((SerialNumber[0] & 0x00ff0000) >> 16), - ((SerialNumber[0] & 0x0000ff00) >> 8), - ((SerialNumber[0] & 0x000000ff) >> 0), ((SerialNumber[1] & 0xff000000) >> 24), ((SerialNumber[1] & 0x00ff0000) >> 16), ((SerialNumber[1] & 0x0000ff00) >> 8), @@ -1813,7 +2420,11 @@ bool SystemInformationImplementation::RetrieveProcessorSerialNumber() ((SerialNumber[2] & 0xff000000) >> 24), ((SerialNumber[2] & 0x00ff0000) >> 16), ((SerialNumber[2] & 0x0000ff00) >> 8), - ((SerialNumber[2] & 0x000000ff) >> 0)); + ((SerialNumber[2] & 0x000000ff) >> 0), + ((SerialNumber[3] & 0xff000000) >> 24), + ((SerialNumber[3] & 0x00ff0000) >> 16), + ((SerialNumber[3] & 0x0000ff00) >> 8), + ((SerialNumber[3] & 0x000000ff) >> 0)); this->ChipID.SerialNumber = sn; return true; @@ -1835,45 +2446,18 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement() return false; } -#if USE_ASM_INSTRUCTIONS - int localCPUPowerManagement = 0; - +#if USE_CPUID + int localCPUPowerManagement[4] = { 0, 0, 0, 0 }; - // Use assembly to detect CPUID information... - __try { - _asm { -#ifdef CPUID_AWARE_COMPILER - ; we must push/pop the registers <> writes to, as the - ; optimiser doesn't know about <>, and so doesn't expect - ; these registers to change. - push eax - push ebx - push ecx - push edx -#endif - ; <> - ; eax = 0x80000007 --> edx: get processor power management - mov eax,0x80000007 - CPUID_INSTRUCTION - mov localCPUPowerManagement, edx - -#ifdef CPUID_AWARE_COMPILER - pop edx - pop ecx - pop ebx - pop eax -#endif - } - } - __except(1) + if (!call_cpuid(0x80000007, localCPUPowerManagement)) { return false; } // Check for the power management capabilities of the CPU. - this->Features.ExtendedFeatures.PowerManagement.HasTempSenseDiode = ((localCPUPowerManagement & 0x00000001) != 0); - this->Features.ExtendedFeatures.PowerManagement.HasFrequencyID = ((localCPUPowerManagement & 0x00000002) != 0); - this->Features.ExtendedFeatures.PowerManagement.HasVoltageID = ((localCPUPowerManagement & 0x00000004) != 0); + this->Features.ExtendedFeatures.PowerManagement.HasTempSenseDiode = ((localCPUPowerManagement[3] & 0x00000001) != 0); + this->Features.ExtendedFeatures.PowerManagement.HasFrequencyID = ((localCPUPowerManagement[3] & 0x00000002) != 0); + this->Features.ExtendedFeatures.PowerManagement.HasVoltageID = ((localCPUPowerManagement[3] & 0x00000004) != 0); return true; @@ -1882,7 +2466,9 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement() #endif } -void SystemInformationStripLeadingSpace(kwsys_stl::string& str) +#if USE_CPUID +// Used only in USE_CPUID implementation below. +static void SystemInformationStripLeadingSpace(kwsys_stl::string& str) { // Because some manufacturers have leading white space - we have to post-process the name. kwsys_stl::string::size_type pos = str.find_first_not_of(" "); @@ -1891,6 +2477,7 @@ void SystemInformationStripLeadingSpace(kwsys_stl::string& str) str = str.substr(pos); } } +#endif /** */ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity() @@ -1903,57 +2490,18 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity() if (!RetrieveCPUExtendedLevelSupport(static_cast(0x80000004))) return false; -#if USE_ASM_INSTRUCTIONS +#if USE_CPUID int CPUExtendedIdentity[12]; - // Use assembly to detect CPUID information... - __try { - _asm { -#ifdef CPUID_AWARE_COMPILER - ; we must push/pop the registers <> writes to, as the - ; optimiser doesn't know about <>, and so doesn't expect - ; these registers to change. - push eax - push ebx - push ecx - push edx -#endif - ; <> - ; eax = 0x80000002 --> eax, ebx, ecx, edx: get processor name string (part 1) - mov eax,0x80000002 - CPUID_INSTRUCTION - mov CPUExtendedIdentity[0 * TYPE int], eax - mov CPUExtendedIdentity[1 * TYPE int], ebx - mov CPUExtendedIdentity[2 * TYPE int], ecx - mov CPUExtendedIdentity[3 * TYPE int], edx - - ; <> - ; eax = 0x80000003 --> eax, ebx, ecx, edx: get processor name string (part 2) - mov eax,0x80000003 - CPUID_INSTRUCTION - mov CPUExtendedIdentity[4 * TYPE int], eax - mov CPUExtendedIdentity[5 * TYPE int], ebx - mov CPUExtendedIdentity[6 * TYPE int], ecx - mov CPUExtendedIdentity[7 * TYPE int], edx - - ; <> - ; eax = 0x80000004 --> eax, ebx, ecx, edx: get processor name string (part 3) - mov eax,0x80000004 - CPUID_INSTRUCTION - mov CPUExtendedIdentity[8 * TYPE int], eax - mov CPUExtendedIdentity[9 * TYPE int], ebx - mov CPUExtendedIdentity[10 * TYPE int], ecx - mov CPUExtendedIdentity[11 * TYPE int], edx - -#ifdef CPUID_AWARE_COMPILER - pop edx - pop ecx - pop ebx - pop eax -#endif + if (!call_cpuid(0x80000002, CPUExtendedIdentity)) + { + return false; } - } - __except(1) + if (!call_cpuid(0x80000003, CPUExtendedIdentity + 4)) + { + return false; + } + if (!call_cpuid(0x80000004, CPUExtendedIdentity + 8)) { return false; } @@ -1974,6 +2522,7 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity() memcpy (&(nbuf[44]), &(CPUExtendedIdentity[11]), sizeof (int)); nbuf[48] = '\0'; this->ChipID.ProcessorName = nbuf; + this->ChipID.ModelName = nbuf; // Because some manufacturers have leading white space - we have to post-process the name. SystemInformationStripLeadingSpace(this->ChipID.ProcessorName); @@ -1988,13 +2537,13 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity() bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() { // Start by decided which manufacturer we are using.... - switch (this->ChipManufacturer) + switch (this->ChipManufacturer) { case Intel: // Check the family / model / revision to determine the CPU ID. switch (this->ChipID.Family) { case 3: - this->ChipID.ProcessorName = "Newer i80386 family"; + this->ChipID.ProcessorName = "Newer i80386 family"; break; case 4: switch (this->ChipID.Model) { @@ -2011,7 +2560,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() } break; case 5: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 0: this->ChipID.ProcessorName = "P5 A-Step"; break; case 1: this->ChipID.ProcessorName = "P5"; break; @@ -2024,7 +2573,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() } break; case 6: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 0: this->ChipID.ProcessorName = "P6 A-Step"; break; case 1: this->ChipID.ProcessorName = "P6"; break; @@ -2044,10 +2593,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() break; case 0xf: // Check the extended family bits... - switch (this->ChipID.ExtendedFamily) + switch (this->ChipID.ExtendedFamily) { case 0: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 0: this->ChipID.ProcessorName = "Pentium IV (0.18 micron)"; break; case 1: this->ChipID.ProcessorName = "Pentium IV (0.18 micron)"; break; @@ -2070,10 +2619,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case AMD: // Check the family / model / revision to determine the CPU ID. - switch (this->ChipID.Family) + switch (this->ChipID.Family) { case 4: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 3: this->ChipID.ProcessorName = "80486DX2"; break; case 7: this->ChipID.ProcessorName = "80486DX2 WriteBack"; break; @@ -2085,7 +2634,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() } break; case 5: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 0: this->ChipID.ProcessorName = "SSA5 (PR75, PR90 = PR100)"; break; case 1: this->ChipID.ProcessorName = "5k86 (PR120 = PR133)"; break; @@ -2100,7 +2649,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() } break; case 6: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 1: this->ChipID.ProcessorName = "Athlon- (0.25 micron)"; break; case 2: this->ChipID.ProcessorName = "Athlon- (0.18 micron)"; break; @@ -2108,9 +2657,9 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 4: this->ChipID.ProcessorName = "Athlon- (Thunderbird core)"; break; case 6: this->ChipID.ProcessorName = "Athlon- (Palomino core)"; break; case 7: this->ChipID.ProcessorName = "Duron- (Morgan core)"; break; - case 8: + case 8: if (this->Features.ExtendedFeatures.SupportsMP) - this->ChipID.ProcessorName = "Athlon - MP (Thoroughbred core)"; + this->ChipID.ProcessorName = "Athlon - MP (Thoroughbred core)"; else this->ChipID.ProcessorName = "Athlon - XP (Thoroughbred core)"; break; default: this->ChipID.ProcessorName = "Unknown K7 family"; return false; @@ -2123,10 +2672,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() break; case Transmeta: - switch (this->ChipID.Family) - { + switch (this->ChipID.Family) + { case 5: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 4: this->ChipID.ProcessorName = "Crusoe TM3x00 and TM5x00"; break; default: this->ChipID.ProcessorName = "Unknown Crusoe family"; return false; @@ -2139,10 +2688,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() break; case Rise: - switch (this->ChipID.Family) - { + switch (this->ChipID.Family) + { case 5: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 0: this->ChipID.ProcessorName = "mP6 (0.25 micron)"; break; case 2: this->ChipID.ProcessorName = "mP6 (0.18 micron)"; break; @@ -2156,10 +2705,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() break; case UMC: - switch (this->ChipID.Family) - { + switch (this->ChipID.Family) + { case 4: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 1: this->ChipID.ProcessorName = "U5D"; break; case 2: this->ChipID.ProcessorName = "U5S"; break; @@ -2173,10 +2722,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() break; case IDT: - switch (this->ChipID.Family) - { + switch (this->ChipID.Family) + { case 5: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 4: this->ChipID.ProcessorName = "C6"; break; case 8: this->ChipID.ProcessorName = "C2"; break; @@ -2185,7 +2734,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() } break; case 6: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 6: this->ChipID.ProcessorName = "VIA Cyrix III - Samuel"; break; default: this->ChipID.ProcessorName = "Unknown IDT\\Centaur family"; return false; @@ -2198,10 +2747,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() break; case Cyrix: - switch (this->ChipID.Family) - { + switch (this->ChipID.Family) + { case 4: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 4: this->ChipID.ProcessorName = "MediaGX GX = GXm"; break; case 9: this->ChipID.ProcessorName = "5x86"; break; @@ -2209,7 +2758,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() } break; case 5: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 2: this->ChipID.ProcessorName = "Cx6x86"; break; case 4: this->ChipID.ProcessorName = "MediaGX GXm"; break; @@ -2217,7 +2766,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() } break; case 6: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 0: this->ChipID.ProcessorName = "6x86MX"; break; case 5: this->ChipID.ProcessorName = "Cyrix M2 Core"; break; @@ -2234,10 +2783,10 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() break; case NexGen: - switch (this->ChipID.Family) - { + switch (this->ChipID.Family) + { case 5: - switch (this->ChipID.Model) + switch (this->ChipID.Model) { case 0: this->ChipID.ProcessorName = "Nx586 or Nx586FPU"; break; default: this->ChipID.ProcessorName = "Unknown NexGen family"; return false; @@ -2272,6 +2821,16 @@ kwsys_stl::string SystemInformationImplementation::ExtractValueFromCpuInfoFile(k size_t pos2 = buffer.find("\n",pos); if(pos!=buffer.npos && pos2!=buffer.npos) { + // It may happen that the beginning matches, but this is still not the requested key. + // An example is looking for "cpu" when "cpu family" comes first. So we check that + // we have only spaces from here to pos, otherwise we search again. + for(size_t i=this->CurrentPositionInFile+strlen(word); i < pos; ++i) + { + if(buffer[i] != ' ' && buffer[i] != '\t') + { + return this->ExtractValueFromCpuInfoFile(buffer, word, pos2); + } + } return buffer.substr(pos+2,pos2-pos-2); } } @@ -2280,19 +2839,19 @@ kwsys_stl::string SystemInformationImplementation::ExtractValueFromCpuInfoFile(k } /** Query for the cpu status */ -int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() +bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() { this->NumberOfLogicalCPU = 0; this->NumberOfPhysicalCPU = 0; kwsys_stl::string buffer; FILE *fd = fopen("/proc/cpuinfo", "r" ); - if ( !fd ) + if ( !fd ) { kwsys_ios::cout << "Problem opening /proc/cpuinfo" << kwsys_ios::endl; - return 0; + return false; } - + size_t fileSize = 0; while(!feof(fd)) { @@ -2336,14 +2895,14 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() #else // __CYGWIN__ // does not have "physical id" entries, neither "cpu cores" - // this has to be fixed for hyper-threading. + // this has to be fixed for hyper-threading. kwsys_stl::string cpucount = this->ExtractValueFromCpuInfoFile(buffer,"cpu count"); this->NumberOfPhysicalCPU= this->NumberOfLogicalCPU = atoi(cpucount.c_str()); #endif - // gotta have one, and if this is 0 then we get a / by 0n - // beter to have a bad answer than a crash + // gotta have one, and if this is 0 then we get a / by 0n + // better to have a bad answer than a crash if(this->NumberOfPhysicalCPU <= 0) { this->NumberOfPhysicalCPU = 1; @@ -2352,49 +2911,500 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical= this->NumberOfLogicalCPU/this->NumberOfPhysicalCPU; - // CPU speed (checking only the first proc + // CPU speed (checking only the first processor) kwsys_stl::string CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"cpu MHz"); this->CPUSpeedInMHz = static_cast(atof(CPUSpeed.c_str())); // Chip family - this->ChipID.Family = atoi(this->ExtractValueFromCpuInfoFile(buffer,"cpu family").c_str()); - + kwsys_stl::string familyStr = + this->ExtractValueFromCpuInfoFile(buffer,"cpu family"); + if(familyStr.empty()) + { + familyStr = this->ExtractValueFromCpuInfoFile(buffer,"CPU architecture"); + } + this->ChipID.Family = atoi(familyStr.c_str()); + // Chip Vendor this->ChipID.Vendor = this->ExtractValueFromCpuInfoFile(buffer,"vendor_id"); - this->FindManufacturer(); - + this->FindManufacturer(familyStr); + + // second try for setting family + if (this->ChipID.Family == 0 && this->ChipManufacturer == HP) + { + if (familyStr == "PA-RISC 1.1a") + this->ChipID.Family = 0x11a; + else if (familyStr == "PA-RISC 2.0") + this->ChipID.Family = 0x200; + // If you really get CMake to work on a machine not belonging to + // any of those families I owe you a dinner if you get it to + // contribute nightly builds regularly. + } + // Chip Model this->ChipID.Model = atoi(this->ExtractValueFromCpuInfoFile(buffer,"model").c_str()); - this->RetrieveClassicalCPUIdentity(); + if(!this->RetrieveClassicalCPUIdentity()) + { + // Some platforms (e.g. PA-RISC) tell us their CPU name here. + // Note: x86 does not. + kwsys_stl::string cpuname = this->ExtractValueFromCpuInfoFile(buffer,"cpu"); + if(!cpuname.empty()) + { + this->ChipID.ProcessorName = cpuname; + } + } + + // Chip revision + kwsys_stl::string cpurev = this->ExtractValueFromCpuInfoFile(buffer,"stepping"); + if(cpurev.empty()) + { + cpurev = this->ExtractValueFromCpuInfoFile(buffer,"CPU revision"); + } + this->ChipID.Revision = atoi(cpurev.c_str()); + + // Chip Model Name + this->ChipID.ModelName = this->ExtractValueFromCpuInfoFile(buffer,"model name").c_str(); // L1 Cache size - kwsys_stl::string cacheSize = this->ExtractValueFromCpuInfoFile(buffer,"cache size"); - pos = cacheSize.find(" KB"); - if(pos!=cacheSize.npos) + // Different architectures may show different names for the caches. + // Sum up everything we find. + kwsys_stl::vector cachename; + cachename.clear(); + + cachename.push_back("cache size"); // e.g. x86 + cachename.push_back("I-cache"); // e.g. PA-RISC + cachename.push_back("D-cache"); // e.g. PA-RISC + + this->Features.L1CacheSize = 0; + for (size_t index = 0; index < cachename.size(); index ++) { - cacheSize = cacheSize.substr(0,pos); + kwsys_stl::string cacheSize = this->ExtractValueFromCpuInfoFile(buffer,cachename[index]); + if (!cacheSize.empty()) + { + pos = cacheSize.find(" KB"); + if(pos!=cacheSize.npos) + { + cacheSize = cacheSize.substr(0,pos); + } + this->Features.L1CacheSize += atoi(cacheSize.c_str()); + } } - this->Features.L1CacheSize = atoi(cacheSize.c_str()); - return 1; + + // processor feature flags (probably x86 specific) + kwsys_stl::string cpuflags = this->ExtractValueFromCpuInfoFile(buffer,"flags"); + if(!cpurev.empty()) + { + // now we can match every flags as space + flag + space + cpuflags = " " + cpuflags + " "; + if ((cpuflags.find(" fpu ")!=kwsys_stl::string::npos)) + { + this->Features.HasFPU = true; + } + if ((cpuflags.find(" tsc ")!=kwsys_stl::string::npos)) + { + this->Features.HasTSC = true; + } + if ((cpuflags.find(" mmx ")!=kwsys_stl::string::npos)) + { + this->Features.HasMMX = true; + } + if ((cpuflags.find(" sse ")!=kwsys_stl::string::npos)) + { + this->Features.HasSSE = true; + } + if ((cpuflags.find(" sse2 ")!=kwsys_stl::string::npos)) + { + this->Features.HasSSE2 = true; + } + if ((cpuflags.find(" apic ")!=kwsys_stl::string::npos)) + { + this->Features.HasAPIC = true; + } + if ((cpuflags.find(" cmov ")!=kwsys_stl::string::npos)) + { + this->Features.HasCMOV = true; + } + if ((cpuflags.find(" mtrr ")!=kwsys_stl::string::npos)) + { + this->Features.HasMTRR = true; + } + if ((cpuflags.find(" acpi ")!=kwsys_stl::string::npos)) + { + this->Features.HasACPI = true; + } + if ((cpuflags.find(" 3dnow ")!=kwsys_stl::string::npos)) + { + this->Features.ExtendedFeatures.Has3DNow = true; + } + } + + return true; } -/** Query for the memory status */ -int SystemInformationImplementation::QueryMemory() +bool SystemInformationImplementation::QueryProcessorBySysconf() { - this->TotalVirtualMemory = 0; - this->TotalPhysicalMemory = 0; - this->AvailableVirtualMemory = 0; - this->AvailablePhysicalMemory = 0; -#ifdef __CYGWIN__ +#if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) +// IRIX names this slightly different +# define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN +#endif + +#ifdef _SC_NPROCESSORS_ONLN + long c = sysconf(_SC_NPROCESSORS_ONLN); + if (c <= 0) + { + return false; + } + + this->NumberOfPhysicalCPU = static_cast(c); + this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU; + + return true; +#else + return false; +#endif +} + +bool SystemInformationImplementation::QueryProcessor() +{ + return this->QueryProcessorBySysconf(); +} + +/** +Get total system RAM in units of KiB. +*/ +SystemInformation::LongLong +SystemInformationImplementation::GetHostMemoryTotal() +{ +#if defined(_WIN32) +# if defined(_MSC_VER) && _MSC_VER < 1300 + MEMORYSTATUS stat; + stat.dwLength = sizeof(stat); + GlobalMemoryStatus(&stat); + return stat.dwTotalPhys/1024; +# else + MEMORYSTATUSEX statex; + statex.dwLength=sizeof(statex); + GlobalMemoryStatusEx(&statex); + return statex.ullTotalPhys/1024; +# endif +#elif defined(__linux) + SystemInformation::LongLong memTotal=0; + int ierr=GetFieldFromFile("/proc/meminfo","MemTotal:",memTotal); + if (ierr) + { + return -1; + } + return memTotal; +#elif defined(__APPLE__) + uint64_t mem; + size_t len = sizeof(mem); + int ierr=sysctlbyname("hw.memsize", &mem, &len, NULL, 0); + if (ierr) + { + return -1; + } + return mem/1024; +#else return 0; -#elif defined(_WIN32) -#if _MSC_VER < 1300 +#endif +} + +/** +Get total system RAM in units of KiB. This may differ from the +host total if a host-wide resource limit is applied. +*/ +SystemInformation::LongLong +SystemInformationImplementation::GetHostMemoryAvailable(const char *hostLimitEnvVarName) +{ + SystemInformation::LongLong memTotal=this->GetHostMemoryTotal(); + + // the following mechanism is provided for systems that + // apply resource limits across groups of processes. + // this is of use on certain SMP systems (eg. SGI UV) + // where the host has a large amount of ram but a given user's + // access to it is severly restricted. The system will + // apply a limit across a set of processes. Units are in KiB. + if (hostLimitEnvVarName) + { + const char *hostLimitEnvVarValue=getenv(hostLimitEnvVarName); + if (hostLimitEnvVarValue) + { + SystemInformation::LongLong hostLimit=atoLongLong(hostLimitEnvVarValue); + if (hostLimit>0) + { + memTotal=min(hostLimit,memTotal); + } + } + } + + return memTotal; +} + +/** +Get total system RAM in units of KiB. This may differ from the +host total if a per-process resource limit is applied. +*/ +SystemInformation::LongLong +SystemInformationImplementation::GetProcMemoryAvailable( + const char *hostLimitEnvVarName, + const char *procLimitEnvVarName) +{ + SystemInformation::LongLong memAvail + = this->GetHostMemoryAvailable(hostLimitEnvVarName); + + // the following mechanism is provide for systems where rlimits + // are not employed. Units are in KiB. + if (procLimitEnvVarName) + { + const char *procLimitEnvVarValue=getenv(procLimitEnvVarName); + if (procLimitEnvVarValue) + { + SystemInformation::LongLong procLimit=atoLongLong(procLimitEnvVarValue); + if (procLimit>0) + { + memAvail=min(procLimit,memAvail); + } + } + } + +#if defined(__linux) + int ierr; + ResourceLimitType rlim; + ierr=GetResourceLimit(RLIMIT_DATA,&rlim); + if ((ierr==0) && (rlim.rlim_cur != RLIM_INFINITY)) + { + memAvail=min((SystemInformation::LongLong)rlim.rlim_cur/1024,memAvail); + } + + ierr=GetResourceLimit(RLIMIT_AS,&rlim); + if ((ierr==0) && (rlim.rlim_cur != RLIM_INFINITY)) + { + memAvail=min((SystemInformation::LongLong)rlim.rlim_cur/1024,memAvail); + } +#elif defined(__APPLE__) + struct rlimit rlim; + int ierr; + ierr=getrlimit(RLIMIT_DATA,&rlim); + if ((ierr==0) && (rlim.rlim_cur != RLIM_INFINITY)) + { + memAvail=min((SystemInformation::LongLong)rlim.rlim_cur/1024,memAvail); + } + + ierr=getrlimit(RLIMIT_RSS,&rlim); + if ((ierr==0) && (rlim.rlim_cur != RLIM_INFINITY)) + { + memAvail=min((SystemInformation::LongLong)rlim.rlim_cur/1024,memAvail); + } +#endif + + return memAvail; +} + +/** +Get RAM used by all processes in the host, in units of KiB. +*/ +SystemInformation::LongLong +SystemInformationImplementation::GetHostMemoryUsed() +{ +#if defined(_WIN32) +# if defined(_MSC_VER) && _MSC_VER < 1300 + MEMORYSTATUS stat; + stat.dwLength = sizeof(stat); + GlobalMemoryStatus(&stat); + return (stat.dwTotalPhys - stat.dwAvailPhys)/1024; +# else + MEMORYSTATUSEX statex; + statex.dwLength=sizeof(statex); + GlobalMemoryStatusEx(&statex); + return (statex.ullTotalPhys - statex.ullAvailPhys)/1024; +# endif +#elif defined(__linux) + const char *names[3]={"MemTotal:","MemFree:",NULL}; + SystemInformation::LongLong values[2]={SystemInformation::LongLong(0)}; + int ierr=GetFieldsFromFile("/proc/meminfo",names,values); + if (ierr) + { + return ierr; + } + SystemInformation::LongLong &memTotal=values[0]; + SystemInformation::LongLong &memFree=values[1]; + return memTotal - memFree; +#elif defined(__APPLE__) + SystemInformation::LongLong psz=getpagesize(); + if (psz<1) + { + return -1; + } + const char *names[4]={"Pages active:","Pages inactive:","Pages wired down:",NULL}; + SystemInformation::LongLong values[3]={SystemInformation::LongLong(0)}; + int ierr=GetFieldsFromCommand("vm_stat", names, values); + if (ierr) + { + return -1; + } + SystemInformation::LongLong &vmActive=values[0]; + SystemInformation::LongLong &vmInactive=values[1]; + SystemInformation::LongLong &vmWired=values[2]; + return ((vmActive+vmInactive+vmWired)*psz)/1024; +#else + return 0; +#endif +} + +/** +Get system RAM used by the process associated with the given +process id in units of KiB. +*/ +SystemInformation::LongLong +SystemInformationImplementation::GetProcMemoryUsed() +{ +#if defined(_WIN32) && defined(KWSYS_SYS_HAS_PSAPI) + long pid=GetCurrentProcessId(); + HANDLE hProc; + hProc=OpenProcess( + PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, + false, + pid); + if (hProc==0) + { + return -1; + } + PROCESS_MEMORY_COUNTERS pmc; + int ok=GetProcessMemoryInfo(hProc,&pmc,sizeof(pmc)); + CloseHandle(hProc); + if (!ok) + { + return -2; + } + return pmc.WorkingSetSize/1024; +#elif defined(__linux) + SystemInformation::LongLong memUsed=0; + int ierr=GetFieldFromFile("/proc/self/status","VmRSS:",memUsed); + if (ierr) + { + return -1; + } + return memUsed; +#elif defined(__APPLE__) + SystemInformation::LongLong memUsed=0; + pid_t pid=getpid(); + kwsys_ios::ostringstream oss; + oss << "ps -o rss= -p " << pid; + FILE *file=popen(oss.str().c_str(),"r"); + if (file==0) + { + return -1; + } + oss.str(""); + while (!feof(file) && !ferror(file)) + { + char buf[256]={'\0'}; + errno=0; + size_t nRead=fread(buf,1,256,file); + if (ferror(file) && (errno==EINTR)) + { + clearerr(file); + } + if (nRead) oss << buf; + } + int ierr=ferror(file); + pclose(file); + if (ierr) + { + return -2; + } + kwsys_ios::istringstream iss(oss.str()); + iss >> memUsed; + return memUsed; +#else + return 0; +#endif +} + +/** +Get the process id of the running process. +*/ +SystemInformation::LongLong +SystemInformationImplementation::GetProcessId() +{ +#if defined(_WIN32) + return GetCurrentProcessId(); +#elif defined(__linux) || defined(__APPLE__) + return getpid(); +#else + return -1; +#endif +} + +/** +when set print stack trace in response to common signals. +*/ +void SystemInformationImplementation::SetStackTraceOnError(int enable) +{ +#if !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) + static int saOrigValid=0; + static struct sigaction saSEGVOrig; + static struct sigaction saTERMOrig; + static struct sigaction saINTOrig; + static struct sigaction saILLOrig; + static struct sigaction saBUSOrig; + static struct sigaction saFPEOrig; + + if (enable && !saOrigValid) + { + // save the current actions + sigaction(SIGSEGV,0,&saSEGVOrig); + sigaction(SIGTERM,0,&saTERMOrig); + sigaction(SIGINT,0,&saINTOrig); + sigaction(SIGILL,0,&saILLOrig); + sigaction(SIGBUS,0,&saBUSOrig); + sigaction(SIGFPE,0,&saFPEOrig); + + // enable read, disable write + saOrigValid=1; + + // install ours + struct sigaction sa; + sa.sa_sigaction=(SigAction)StacktraceSignalHandler; + sa.sa_flags=SA_SIGINFO|SA_RESTART; + sigemptyset(&sa.sa_mask); + + sigaction(SIGSEGV,&sa,0); + sigaction(SIGTERM,&sa,0); + sigaction(SIGINT,&sa,0); + sigaction(SIGILL,&sa,0); + sigaction(SIGBUS,&sa,0); + sigaction(SIGFPE,&sa,0); + } + else + if (!enable && saOrigValid) + { + // restore previous actions + sigaction(SIGSEGV,&saSEGVOrig,0); + sigaction(SIGTERM,&saTERMOrig,0); + sigaction(SIGINT,&saINTOrig,0); + sigaction(SIGILL,&saILLOrig,0); + sigaction(SIGBUS,&saBUSOrig,0); + sigaction(SIGFPE,&saFPEOrig,0); + + // enable write, disable read + saOrigValid=0; + } +#else + // avoid warning C4100 + (void)enable; +#endif +} + +bool SystemInformationImplementation::QueryWindowsMemory() +{ +#if defined(_WIN32) +# if defined(_MSC_VER) && _MSC_VER < 1300 MEMORYSTATUS ms; unsigned long tv, tp, av, ap; ms.dwLength = sizeof(ms); GlobalMemoryStatus(&ms); - #define MEM_VAL(value) dw##value -#else +# define MEM_VAL(value) dw##value +# else MEMORYSTATUSEX ms; DWORDLONG tv, tp, av, ap; ms.dwLength = sizeof(ms); @@ -2402,8 +3412,8 @@ int SystemInformationImplementation::QueryMemory() { return 0; } -#define MEM_VAL(value) ull##value -#endif +# define MEM_VAL(value) ull##value +# endif tv = ms.MEM_VAL(TotalVirtual); tp = ms.MEM_VAL(TotalPhys); av = ms.MEM_VAL(AvailVirtual); @@ -2412,51 +3422,58 @@ int SystemInformationImplementation::QueryMemory() this->TotalPhysicalMemory = tp>>10>>10; this->AvailableVirtualMemory = av>>10>>10; this->AvailablePhysicalMemory = ap>>10>>10; - return 1; -#elif defined(__linux) + return true; +#else + return false; +#endif +} + +bool SystemInformationImplementation::QueryLinuxMemory() +{ +#if defined(__linux) unsigned long tv=0; unsigned long tp=0; unsigned long av=0; unsigned long ap=0; - + char buffer[1024]; // for reading lines - + int linuxMajor = 0; int linuxMinor = 0; - + // Find the Linux kernel version first struct utsname unameInfo; int errorFlag = uname(&unameInfo); if( errorFlag!=0 ) { kwsys_ios::cout << "Problem calling uname(): " << strerror(errno) << kwsys_ios::endl; - return 0; + return false; } - + if( unameInfo.release!=0 && strlen(unameInfo.release)>=3 ) { // release looks like "2.6.3-15mdk-i686-up-4GB" char majorChar=unameInfo.release[0]; char minorChar=unameInfo.release[2]; - + if( isdigit(majorChar) ) { linuxMajor=majorChar-'0'; } - + if( isdigit(minorChar) ) { linuxMinor=minorChar-'0'; } } - + FILE *fd = fopen("/proc/meminfo", "r" ); - if ( !fd ) + if ( !fd ) { kwsys_ios::cout << "Problem opening /proc/meminfo" << kwsys_ios::endl; - return 0; + return false; } - + if( linuxMajor>=3 || ( (linuxMajor>=2) && (linuxMinor>=6) ) ) { // new /proc/meminfo format since kernel 2.6.x @@ -2493,13 +3510,13 @@ int SystemInformationImplementation::QueryMemory() { kwsys_ios::cout << "Problem parsing /proc/meminfo" << kwsys_ios::endl; fclose(fd); - return 0; + return false; } } else { // /proc/meminfo format for kernel older than 2.6.x - + unsigned long temp; unsigned long cachedMem; unsigned long buffersMem; @@ -2525,72 +3542,132 @@ int SystemInformationImplementation::QueryMemory() { kwsys_ios::cout << "Problem parsing /proc/meminfo" << kwsys_ios::endl; fclose(fd); - return 0; + return false; } } fclose( fd ); - return 1; -#elif defined(__hpux) - unsigned long tv=0; - unsigned long tp=0; - unsigned long av=0; - unsigned long ap=0; - struct pst_static pst; - struct pst_dynamic pdy; - - unsigned long ps = 0; - if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) != -1) + + return true; +#else + return false; +#endif +} + +bool SystemInformationImplementation::QueryCygwinMemory() +{ +#ifdef __CYGWIN__ + // _SC_PAGE_SIZE does return the mmap() granularity on Cygwin, + // see http://cygwin.com/ml/cygwin/2006-06/msg00350.html + // Therefore just use 4096 as the page size of Windows. + long m = sysconf(_SC_PHYS_PAGES); + if (m < 0) { - ps = pst.page_size; - tp = pst.physical_memory *ps; - tv = (pst.physical_memory + pst.pst_maxmem) * ps; - if (pstat_getdynamic(&pdy, sizeof(pdy), (size_t) 1, 0) != -1) - { - ap = tp - pdy.psd_rm * ps; - av = tv - pdy.psd_vm; - this->TotalVirtualMemory = tv>>10>>10; - this->TotalPhysicalMemory = tp>>10>>10; - this->AvailableVirtualMemory = av>>10>>10; - this->AvailablePhysicalMemory = ap>>10>>10; - return 1; - } + return false; } - return 0; + this->TotalPhysicalMemory = m >> 8; + return true; #else - return 0; + return false; #endif +} +bool SystemInformationImplementation::QueryAIXMemory() +{ +#if defined(_AIX) + long c = sysconf(_SC_AIX_REALMEM); + if (c <= 0) + { + return false; + } + this->TotalPhysicalMemory = c / 1024; + + return true; +#else + return false; +#endif +} + +bool SystemInformationImplementation::QueryMemoryBySysconf() +{ +#if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE) + // Assume the mmap() granularity as returned by _SC_PAGESIZE is also + // the system page size. The only known system where this isn't true + // is Cygwin. + long p = sysconf(_SC_PHYS_PAGES); + long m = sysconf(_SC_PAGESIZE); + + if (p < 0 || m < 0) + { + return false; + } + + // assume pagesize is a power of 2 and smaller 1 MiB + size_t pagediv = (1024 * 1024 / m); + + this->TotalPhysicalMemory = p; + this->TotalPhysicalMemory /= pagediv; + +#if defined(_SC_AVPHYS_PAGES) + p = sysconf(_SC_AVPHYS_PAGES); + if (p < 0) + { + return false; + } + + this->AvailablePhysicalMemory = p; + this->AvailablePhysicalMemory /= pagediv; +#endif + + return true; +#else + return false; +#endif +} + +/** Query for the memory status */ +bool SystemInformationImplementation::QueryMemory() +{ + return this->QueryMemoryBySysconf(); } /** */ -size_t SystemInformationImplementation::GetTotalVirtualMemory() -{ - return this->TotalVirtualMemory; +size_t SystemInformationImplementation::GetTotalVirtualMemory() +{ + return this->TotalVirtualMemory; } /** */ -size_t SystemInformationImplementation::GetAvailableVirtualMemory() -{ - return this->AvailableVirtualMemory; +size_t SystemInformationImplementation::GetAvailableVirtualMemory() +{ + return this->AvailableVirtualMemory; } -size_t SystemInformationImplementation::GetTotalPhysicalMemory() -{ - return this->TotalPhysicalMemory; +size_t SystemInformationImplementation::GetTotalPhysicalMemory() +{ + return this->TotalPhysicalMemory; } /** */ -size_t SystemInformationImplementation::GetAvailablePhysicalMemory() -{ - return this->AvailablePhysicalMemory; +size_t SystemInformationImplementation::GetAvailablePhysicalMemory() +{ + return this->AvailablePhysicalMemory; } /** Get Cycle differences */ -LongLong SystemInformationImplementation::GetCyclesDifference (DELAY_FUNC DelayFunction, +SystemInformation::LongLong +SystemInformationImplementation::GetCyclesDifference (DELAY_FUNC DelayFunction, unsigned int uiParameter) { -#if USE_ASM_INSTRUCTIONS +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + unsigned __int64 stamp1, stamp2; + + stamp1 = __rdtsc(); + DelayFunction(uiParameter); + stamp2 = __rdtsc(); + + return stamp2 - stamp1; +#elif USE_ASM_INSTRUCTIONS unsigned int edx1, eax1; unsigned int edx2, eax2; @@ -2619,7 +3696,7 @@ LongLong SystemInformationImplementation::GetCyclesDifference (DELAY_FUNC DelayF mov eax1, esi ; eax2 = esi } } - __except(1) + __except(1) { return -1; } @@ -2642,7 +3719,7 @@ void SystemInformationImplementation::DelayOverhead(unsigned int uiMS) __int64 x; // Get the frequency of the high performance counter. - if(!QueryPerformanceFrequency (&Frequency)) + if(!QueryPerformanceFrequency (&Frequency)) { return; } @@ -2650,9 +3727,9 @@ void SystemInformationImplementation::DelayOverhead(unsigned int uiMS) // Get the starting position of the counter. QueryPerformanceCounter (&StartCounter); - + do { - // Get the ending position of the counter. + // Get the ending position of the counter. QueryPerformanceCounter (&EndCounter); } while (EndCounter.QuadPart - StartCounter.QuadPart == x); #endif @@ -2672,61 +3749,53 @@ unsigned char SystemInformationImplementation::LogicalCPUPerPhysicalCPU(void) } return static_cast(cores_per_package); #else - unsigned int Regebx = 0; -#if USE_ASM_INSTRUCTIONS + int Regs[4] = { 0, 0, 0, 0 }; +#if USE_CPUID if (!this->IsHyperThreadingSupported()) { - return static_cast(1); // HT not supported - } - __asm - { - mov eax, 1 - cpuid - mov Regebx, ebx + return static_cast(1); // HT not supported } + call_cpuid(1, Regs); #endif - return static_cast ((Regebx & NUM_LOGICAL_BITS) >> 16); + return static_cast ((Regs[1] & NUM_LOGICAL_BITS) >> 16); #endif } /** Works only for windows */ -unsigned int SystemInformationImplementation::IsHyperThreadingSupported() +bool SystemInformationImplementation::IsHyperThreadingSupported() { -#if USE_ASM_INSTRUCTIONS - unsigned int Regedx = 0, - Regeax = 0, - VendorId[3] = {0, 0, 0}; - __try // Verify cpuid instruction is supported + if (this->Features.ExtendedFeatures.SupportsHyperthreading) { - __asm - { - xor eax, eax // call cpuid with eax = 0 - cpuid // Get vendor id string - mov VendorId, ebx - mov VendorId + 4, edx - mov VendorId + 8, ecx - - mov eax, 1 // call cpuid with eax = 1 - cpuid - mov Regeax, eax // eax contains family processor type - mov Regedx, edx // edx has info about the availability of hyper-Threading - } + return true; + } + +#if USE_CPUID + int Regs[4] = { 0, 0, 0, 0 }, + VendorId[4] = { 0, 0, 0, 0 }; + // Get vendor id string + if (!call_cpuid(0, VendorId)) + { + return false; } - __except (EXCEPTION_EXECUTE_HANDLER) + // eax contains family processor type + // edx has info about the availability of hyper-Threading + if (!call_cpuid(1, Regs)) { - return(0); // cpuid is unavailable + return false; } - if (((Regeax & FAMILY_ID) == PENTIUM4_ID) || (Regeax & EXT_FAMILY_ID)) + if (((Regs[0] & FAMILY_ID) == PENTIUM4_ID) || (Regs[0] & EXT_FAMILY_ID)) { - if (VendorId[0] == 'uneG') + if (VendorId[1] == 0x756e6547) // 'uneG' { - if (VendorId[1] == 'Ieni') + if (VendorId[3] == 0x49656e69) // 'Ieni' { - if (VendorId[2] == 'letn') + if (VendorId[2] == 0x6c65746e) // 'letn' { - return(Regedx & HT_BIT); // Genuine Intel with hyper-Threading technology + // Genuine Intel with hyper-Threading technology + this->Features.ExtendedFeatures.SupportsHyperthreading = ((Regs[3] & HT_BIT) != 0); + return this->Features.ExtendedFeatures.SupportsHyperthreading; } } } @@ -2740,22 +3809,17 @@ unsigned int SystemInformationImplementation::IsHyperThreadingSupported() /** Return the APIC Id. Works only for windows. */ unsigned char SystemInformationImplementation::GetAPICId() { - unsigned int Regebx = 0; + int Regs[4] = { 0, 0, 0, 0 }; -#if USE_ASM_INSTRUCTIONS - if (!this->IsHyperThreadingSupported()) +#if USE_CPUID + if (!this->IsHyperThreadingSupported()) { return static_cast(-1); // HT not supported } // Logical processor = 1 - __asm - { - mov eax, 1 - cpuid - mov Regebx, ebx - } + call_cpuid(1, Regs); #endif - return static_cast((Regebx & INITIAL_APIC_ID_BITS) >> 24); + return static_cast((Regs[1] & INITIAL_APIC_ID_BITS) >> 24); } @@ -2773,7 +3837,7 @@ int SystemInformationImplementation::CPUCount() // Number of physical processors in a non-Intel system // or in a 32-bit Intel system with Hyper-Threading technology disabled - this->NumberOfPhysicalCPU = (unsigned char) info.dwNumberOfProcessors; + this->NumberOfPhysicalCPU = (unsigned char) info.dwNumberOfProcessors; if (this->IsHyperThreadingSupported()) { @@ -2789,7 +3853,7 @@ int SystemInformationImplementation::CPUCount() DWORD_PTR dwSystemAffinity; DWORD dwAffinityMask; - // Calculate the appropriate shifts and mask based on the + // Calculate the appropriate shifts and mask based on the // number of logical processors. unsigned int i = 1; unsigned char PHY_ID_MASK = 0xFF; @@ -2801,7 +3865,7 @@ int SystemInformationImplementation::CPUCount() PHY_ID_MASK <<= 1; // PHY_ID_SHIFT++; } - + hCurrentProcessHandle = GetCurrentProcess(); GetProcessAffinityMask(hCurrentProcessHandle, &dwProcessAffinity, &dwSystemAffinity); @@ -2829,8 +3893,8 @@ int SystemInformationImplementation::CPUCount() APIC_ID = GetAPICId(); LOG_ID = APIC_ID & ~PHY_ID_MASK; - - if (LOG_ID != 0) + + if (LOG_ID != 0) { HT_Enabled = 1; } @@ -2840,7 +3904,7 @@ int SystemInformationImplementation::CPUCount() } // Reset the processor affinity SetProcessAffinityMask(hCurrentProcessHandle, dwProcessAffinity); - + if (this->NumberOfLogicalCPU == 1) // Normal P4 : HT is disabled in hardware { StatusFlag = HT_DISABLED; @@ -2853,7 +3917,7 @@ int SystemInformationImplementation::CPUCount() this->NumberOfPhysicalCPU /= (this->NumberOfLogicalCPU); StatusFlag = HT_ENABLED; } - else + else { StatusFlag = HT_SUPPORTED_NOT_ENABLED; } @@ -2891,6 +3955,7 @@ unsigned int SystemInformationImplementation::GetNumberOfPhysicalCPU() bool SystemInformationImplementation::ParseSysCtl() { #if defined(__APPLE__) + char retBuf[128]; int err = 0; uint64_t value = 0; size_t len = sizeof(value); @@ -2901,9 +3966,10 @@ bool SystemInformationImplementation::ParseSysCtl() this->AvailablePhysicalMemory = 0; vm_statistics_data_t vmstat; mach_msg_type_number_t count = HOST_VM_INFO_COUNT; - if ( host_statistics(mach_host_self(), HOST_VM_INFO, + if ( host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t) &vmstat, &count) == KERN_SUCCESS ) { + len = sizeof(value); err = sysctlbyname("hw.pagesize", &value, &len, NULL, 0); int64_t available_memory = vmstat.free_count * value; this->AvailablePhysicalMemory = static_cast< size_t >( available_memory / 1048576 ); @@ -2914,7 +3980,7 @@ bool SystemInformationImplementation::ParseSysCtl() int mib[2] = { CTL_VM, VM_SWAPUSAGE }; size_t miblen = sizeof(mib) / sizeof(mib[0]); struct xsw_usage swap; - len = sizeof(struct xsw_usage); + len = sizeof(swap); err = sysctl(mib, miblen, &swap, &len, NULL, 0); if (err == 0) { @@ -2929,8 +3995,9 @@ bool SystemInformationImplementation::ParseSysCtl() // CPU Info len = sizeof(this->NumberOfPhysicalCPU); sysctlbyname("hw.physicalcpu", &this->NumberOfPhysicalCPU, &len, NULL, 0); + len = sizeof(this->NumberOfLogicalCPU); sysctlbyname("hw.logicalcpu", &this->NumberOfLogicalCPU, &len, NULL, 0); - this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical = + this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical = this->LogicalCPUPerPhysicalCPU(); len = sizeof(value); @@ -2947,16 +4014,16 @@ bool SystemInformationImplementation::ParseSysCtl() if (err != 0) // Go back to names we know but are less descriptive { this->ChipID.Family = 0; - char retBuf[32]; - ::memset(retBuf, 0, 32); + ::memset(retBuf, 0, 128); len = 32; - err = sysctlbyname("hw.machine", &retBuf, &len, NULL, 0); + err = sysctlbyname("hw.machine", &retBuf, &len, NULL, 0); kwsys_stl::string machineBuf(retBuf); if (machineBuf.find_first_of("Power") != kwsys_stl::string::npos) { this->ChipID.Vendor = "IBM"; - len = 4; + len = sizeof(this->ChipID.Family); err = sysctlbyname("hw.cputype", &this->ChipID.Family, &len, NULL, 0); + len = sizeof(this->ChipID.Model); err = sysctlbyname("hw.cpusubtype", &this->ChipID.Model, &len, NULL, 0); this->FindManufacturer(); } @@ -2964,35 +4031,115 @@ bool SystemInformationImplementation::ParseSysCtl() else // Should be an Intel Chip. { len = sizeof(this->ChipID.Family); - err = + err = sysctlbyname("machdep.cpu.family", &this->ChipID.Family, &len, NULL, 0); - - char retBuf[128]; + ::memset(retBuf, 0, 128); len = 128; err = sysctlbyname("machdep.cpu.vendor", retBuf, &len, NULL, 0); // Chip Vendor this->ChipID.Vendor = retBuf; this->FindManufacturer(); - - ::memset(retBuf, 0, 128); - err = - sysctlbyname("machdep.cpu.brand_string", - retBuf, &len, NULL, 0); - this->ChipID.ProcessorName = retBuf; // Chip Model len = sizeof(value); err = sysctlbyname("machdep.cpu.model", &value, &len, NULL, 0); this->ChipID.Model = static_cast< int >( value ); + + // Chip Stepping + len = sizeof(value); + value = 0; + err = sysctlbyname("machdep.cpu.stepping", &value, &len, NULL, 0); + if (!err) + { + this->ChipID.Revision = static_cast< int >( value ); + } + + // feature string + char *buf = 0; + size_t allocSize = 128; + + err = 0; + len = 0; + + // sysctlbyname() will return with err==0 && len==0 if the buffer is too small + while (err == 0 && len == 0) + { + delete[] buf; + allocSize *= 2; + buf = new char[allocSize]; + if (!buf) + { + break; + } + buf[0] = ' '; + len = allocSize - 2; // keep space for leading and trailing space + err = sysctlbyname("machdep.cpu.features", buf + 1, &len, NULL, 0); + } + if (!err && buf && len) + { + // now we can match every flags as space + flag + space + buf[len + 1] = ' '; + kwsys_stl::string cpuflags(buf, len + 2); + + if ((cpuflags.find(" FPU ")!=kwsys_stl::string::npos)) + { + this->Features.HasFPU = true; + } + if ((cpuflags.find(" TSC ")!=kwsys_stl::string::npos)) + { + this->Features.HasTSC = true; + } + if ((cpuflags.find(" MMX ")!=kwsys_stl::string::npos)) + { + this->Features.HasMMX = true; + } + if ((cpuflags.find(" SSE ")!=kwsys_stl::string::npos)) + { + this->Features.HasSSE = true; + } + if ((cpuflags.find(" SSE2 ")!=kwsys_stl::string::npos)) + { + this->Features.HasSSE2 = true; + } + if ((cpuflags.find(" APIC ")!=kwsys_stl::string::npos)) + { + this->Features.HasAPIC = true; + } + if ((cpuflags.find(" CMOV ")!=kwsys_stl::string::npos)) + { + this->Features.HasCMOV = true; + } + if ((cpuflags.find(" MTRR ")!=kwsys_stl::string::npos)) + { + this->Features.HasMTRR = true; + } + if ((cpuflags.find(" ACPI ")!=kwsys_stl::string::npos)) + { + this->Features.HasACPI = true; + } + } + delete[] buf; } + + // brand string + ::memset(retBuf, 0, sizeof(retBuf)); + len = sizeof(retBuf); + err = sysctlbyname("machdep.cpu.brand_string", retBuf, &len, NULL, 0); + if (!err) + { + this->ChipID.ProcessorName = retBuf; + this->ChipID.ModelName = retBuf; + } + // Cache size len = sizeof(value); err = sysctlbyname("hw.l1icachesize", &value, &len, NULL, 0); this->Features.L1CacheSize = static_cast< int >( value ); + len = sizeof(value); err = sysctlbyname("hw.l2cachesize", &value, &len, NULL, 0); this->Features.L2CacheSize = static_cast< int >( value ); - + return true; #else return false; @@ -3019,7 +4166,7 @@ kwsys_stl::string SystemInformationImplementation::ExtractValueFromSysCtl(const /** Run a given process */ kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector args) -{ +{ kwsys_stl::string buffer = ""; // Run the application @@ -3032,13 +4179,12 @@ kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector< char* data = NULL; int length; double timeout = 255; + int pipe; // pipe id as returned by kwsysProcess_WaitForData() - while(kwsysProcess_WaitForData(gp,&data,&length,&timeout)) // wait for 1s + while( ( pipe = kwsysProcess_WaitForData(gp,&data,&length,&timeout), + (pipe == kwsysProcess_Pipe_STDOUT || pipe == kwsysProcess_Pipe_STDERR) ) ) // wait for 1s { - for(int i=0;iNumberOfPhysicalCPU = static_cast( - atoi(this->ParseValueFromKStat("-n syste_misc -s ncpus").c_str())); - this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU; - - if(this->NumberOfPhysicalCPU!=0) +#if defined (__SVR4) && defined (__sun) + // Solaris allows querying this value by sysconf, but if this is + // a 32 bit process on a 64 bit host the returned memory will be + // limited to 4GiB. So if this is a 32 bit process or if the sysconf + // method fails use the kstat interface. +#if SIZEOF_VOID_P == 8 + if (this->QueryMemoryBySysconf()) + { + return true; + } +#endif + + char* tail; + unsigned long totalMemory = + strtoul(this->ParseValueFromKStat("-s physmem").c_str(),&tail,0); + this->TotalPhysicalMemory = totalMemory/128; + + return true; +#else + return false; +#endif +} + +bool SystemInformationImplementation::QuerySolarisProcessor() +{ + if (!this->QueryProcessorBySysconf()) { - this->NumberOfLogicalCPU /= this->NumberOfPhysicalCPU; + return false; } + // Parse values this->CPUSpeedInMHz = static_cast(atoi(this->ParseValueFromKStat("-s clock_MHz").c_str())); // Chip family - this->ChipID.Family = 0; - - // Chip Vendor - this->ChipID.Vendor = "Sun"; - this->FindManufacturer(); - + this->ChipID.Family = 0; + // Chip Model this->ChipID.ProcessorName = this->ParseValueFromKStat("-s cpu_type"); this->ChipID.Model = 0; - // Cache size - this->Features.L1CacheSize = 0; - this->Features.L2CacheSize = 0; - - char* tail; - unsigned long totalMemory = - strtoul(this->ParseValueFromKStat("-s physmem").c_str(),&tail,0); - this->TotalPhysicalMemory = totalMemory/1024; - this->TotalPhysicalMemory *= 8192; - this->TotalPhysicalMemory /= 1024; - - // Undefined values (for now at least) - this->TotalVirtualMemory = 0; - this->AvailablePhysicalMemory = 0; - this->AvailableVirtualMemory = 0; + // Chip Vendor + if (this->ChipID.ProcessorName != "i386") + { + this->ChipID.Vendor = "Sun"; + this->FindManufacturer(); + } return true; } @@ -3200,16 +4353,16 @@ bool SystemInformationImplementation::QueryHaikuInfo() system_info info; get_system_info(&info); - + this->NumberOfPhysicalCPU = info.cpu_count; this->CPUSpeedInMHz = info.cpu_clock_speed / 1000000.0F; // Physical Memory this->TotalPhysicalMemory = (info.max_pages * B_PAGE_SIZE) / (1024 * 1024) ; - this->AvailablePhysicalMemory = this->TotalPhysicalMemory - + this->AvailablePhysicalMemory = this->TotalPhysicalMemory - ((info.used_pages * B_PAGE_SIZE) / (1024 * 1024)); - + // NOTE: get_system_info_etc is currently a private call so just set to 0 // until it becomes public this->TotalVirtualMemory = 0; @@ -3237,8 +4390,8 @@ bool SystemInformationImplementation::QueryHaikuInfo() this->ChipID.Type = cpu_info.eax_1.type; // Chip family - this->ChipID.Family = cpu_info.eax_1.family; - + this->ChipID.Family = cpu_info.eax_1.family; + // Chip Model this->ChipID.Model = cpu_info.eax_1.model; @@ -3296,6 +4449,31 @@ bool SystemInformationImplementation::QueryQNXMemory() return false; } +bool SystemInformationImplementation::QueryBSDMemory() +{ +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) + int ctrl[2] = { CTL_HW, HW_PHYSMEM }; +#if defined(HW_PHYSMEM64) + int64_t k; + ctrl[1] = HW_PHYSMEM64; +#else + int k; +#endif + size_t sz = sizeof(k); + + if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0) + { + return false; + } + + this->TotalPhysicalMemory = k>>10>>10; + + return true; +#else + return false; +#endif +} + bool SystemInformationImplementation::QueryQNXProcessor() { #if defined(__QNX__) @@ -3349,6 +4527,163 @@ bool SystemInformationImplementation::QueryQNXProcessor() #endif } +bool SystemInformationImplementation::QueryBSDProcessor() +{ +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) + int k; + size_t sz = sizeof(k); + int ctrl[2] = { CTL_HW, HW_NCPU }; + + if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0) + { + return false; + } + + this->NumberOfPhysicalCPU = k; + this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU; + +#if defined(HW_CPUSPEED) + ctrl[1] = HW_CPUSPEED; + + if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0) + { + return false; + } + + this->CPUSpeedInMHz = (float) k; +#endif + +#if defined(CPU_SSE) + ctrl[0] = CTL_MACHDEP; + ctrl[1] = CPU_SSE; + + if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0) + { + return false; + } + + this->Features.HasSSE = (k > 0); +#endif + +#if defined(CPU_SSE2) + ctrl[0] = CTL_MACHDEP; + ctrl[1] = CPU_SSE2; + + if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0) + { + return false; + } + + this->Features.HasSSE2 = (k > 0); +#endif + +#if defined(CPU_CPUVENDOR) + ctrl[0] = CTL_MACHDEP; + ctrl[1] = CPU_CPUVENDOR; + char vbuf[25]; + ::memset(vbuf, 0, sizeof(vbuf)); + sz = sizeof(vbuf) - 1; + if (sysctl(ctrl, 2, vbuf, &sz, NULL, 0) != 0) + { + return false; + } + + this->ChipID.Vendor = vbuf; + this->FindManufacturer(); +#endif + + return true; +#else + return false; +#endif +} + +bool SystemInformationImplementation::QueryHPUXMemory() +{ +#if defined(__hpux) + unsigned long tv=0; + unsigned long tp=0; + unsigned long av=0; + unsigned long ap=0; + struct pst_static pst; + struct pst_dynamic pdy; + + unsigned long ps = 0; + if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) + { + return false; + } + + ps = pst.page_size; + tp = pst.physical_memory *ps; + tv = (pst.physical_memory + pst.pst_maxmem) * ps; + if (pstat_getdynamic(&pdy, sizeof(pdy), (size_t) 1, 0) == -1) + { + return false; + } + + ap = tp - pdy.psd_rm * ps; + av = tv - pdy.psd_vm; + this->TotalVirtualMemory = tv>>10>>10; + this->TotalPhysicalMemory = tp>>10>>10; + this->AvailableVirtualMemory = av>>10>>10; + this->AvailablePhysicalMemory = ap>>10>>10; + return true; +#else + return false; +#endif +} + +bool SystemInformationImplementation::QueryHPUXProcessor() +{ +#if defined(__hpux) +# if defined(KWSYS_SYS_HAS_MPCTL_H) + int c = mpctl(MPC_GETNUMSPUS_SYS, 0, 0); + if (c <= 0) + { + return false; + } + + this->NumberOfPhysicalCPU = c; + this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU; + + long t = sysconf(_SC_CPU_VERSION); + + if (t == -1) + { + return false; + } + + switch (t) + { + case CPU_PA_RISC1_0: + this->ChipID.Vendor = "Hewlett-Packard"; + this->ChipID.Family = 0x100; + case CPU_PA_RISC1_1: + this->ChipID.Vendor = "Hewlett-Packard"; + this->ChipID.Family = 0x110; + case CPU_PA_RISC2_0: + this->ChipID.Vendor = "Hewlett-Packard"; + this->ChipID.Family = 0x200; + case CPU_IA64_ARCHREV_0: + this->ChipID.Vendor = "GenuineIntel"; + this->Features.HasIA64 = true; + break; + default: + return false; + } + + this->FindManufacturer(); + + return true; +# else + return false; +# endif +#else + return false; +#endif +} + /** Query the operating system information */ bool SystemInformationImplementation::QueryOSInformation() { @@ -3365,16 +4700,16 @@ bool SystemInformationImplementation::QueryOSInformation() ZeroMemory (&osvi, sizeof (OSVERSIONINFOEX)); osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX); bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi); - if (!bOsVersionInfoEx) + if (!bOsVersionInfoEx) { osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); - if (!GetVersionEx ((OSVERSIONINFO *) &osvi)) + if (!GetVersionEx ((OSVERSIONINFO *) &osvi)) { return false; } } - switch (osvi.dwPlatformId) + switch (osvi.dwPlatformId) { case VER_PLATFORM_WIN32_NT: // Test for the product. @@ -3417,40 +4752,40 @@ bool SystemInformationImplementation::QueryOSInformation() { this->OSRelease += " Personal"; } - else + else { this->OSRelease += " Professional"; } } #endif - } + } else if (osvi.wProductType == VER_NT_SERVER) { // Check for .NET Server instead of Windows XP. - if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) + if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) { this->OSRelease = ".NET"; } // Continue with the type detection. - if (osvi.wSuiteMask & VER_SUITE_DATACENTER) + if (osvi.wSuiteMask & VER_SUITE_DATACENTER) { this->OSRelease += " DataCenter Server"; } - else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) + else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) { this->OSRelease += " Advanced Server"; } - else + else { this->OSRelease += " Server"; } } sprintf (operatingSystem, "%s (Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); - this->OSVersion = operatingSystem; + this->OSVersion = operatingSystem; } - else + else #endif // VER_NT_WORKSTATION { HKEY hKey; @@ -3473,7 +4808,7 @@ bool SystemInformationImplementation::QueryOSInformation() { this->OSRelease += " Standard Server"; } - else + else { this->OSRelease += " Server"; } @@ -3485,7 +4820,7 @@ bool SystemInformationImplementation::QueryOSInformation() { this->OSRelease += " Enterprise Server"; } - else + else { this->OSRelease += " Advanced Server"; } @@ -3493,7 +4828,7 @@ bool SystemInformationImplementation::QueryOSInformation() } // Display version, service pack (if any), and build number. - if (osvi.dwMajorVersion <= 4) + if (osvi.dwMajorVersion <= 4) { // NB: NT 4.0 and earlier. sprintf (operatingSystem, "version %ld.%ld %s (Build %ld)", @@ -3502,30 +4837,30 @@ bool SystemInformationImplementation::QueryOSInformation() osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); this->OSVersion = operatingSystem; - } - else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) + } + else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) { // Windows XP and .NET server. typedef BOOL (CALLBACK* LPFNPROC) (HANDLE, BOOL *); - HINSTANCE hKernelDLL; + HINSTANCE hKernelDLL; LPFNPROC DLLProc; - + // Load the Kernel32 DLL. hKernelDLL = LoadLibrary ("kernel32"); - if (hKernelDLL != NULL) { + if (hKernelDLL != NULL) { // Only XP and .NET Server support IsWOW64Process so... Load dynamically! - DLLProc = (LPFNPROC) GetProcAddress (hKernelDLL, "IsWow64Process"); - + DLLProc = (LPFNPROC) GetProcAddress (hKernelDLL, "IsWow64Process"); + // If the function address is valid, call the function. if (DLLProc != NULL) (DLLProc) (GetCurrentProcess (), &bIsWindows64Bit); else bIsWindows64Bit = false; - + // Free the DLL module. - FreeLibrary (hKernelDLL); - } - } - else - { + FreeLibrary (hKernelDLL); + } + } + else + { // Windows 2000 and everything else. sprintf (operatingSystem,"%s (Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); this->OSVersion = operatingSystem; @@ -3534,32 +4869,32 @@ bool SystemInformationImplementation::QueryOSInformation() case VER_PLATFORM_WIN32_WINDOWS: // Test for the product. - if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) + if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) { this->OSRelease = "95"; - if(osvi.szCSDVersion[1] == 'C') + if(osvi.szCSDVersion[1] == 'C') { this->OSRelease += "OSR 2.5"; } - else if(osvi.szCSDVersion[1] == 'B') + else if(osvi.szCSDVersion[1] == 'B') { this->OSRelease += "OSR 2"; } - } + } - if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10) + if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10) { this->OSRelease = "98"; - if (osvi.szCSDVersion[1] == 'A' ) + if (osvi.szCSDVersion[1] == 'A' ) { this->OSRelease += "SE"; } - } + } - if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) + if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) { this->OSRelease = "Me"; - } + } break; case VER_PLATFORM_WIN32s: @@ -3583,7 +4918,7 @@ bool SystemInformationImplementation::QueryOSInformation() WSACleanup( ); } this->Hostname = name; - + const char* arch = getenv("PROCESSOR_ARCHITECTURE"); if(arch) { @@ -3604,51 +4939,41 @@ bool SystemInformationImplementation::QueryOSInformation() } #ifdef __APPLE__ - this->CallSwVers(); + this->OSName="Unknown Apple OS"; + this->OSRelease="Unknown product version"; + this->OSVersion="Unknown build version"; + + this->CallSwVers("-productName",this->OSName); + this->CallSwVers("-productVersion",this->OSRelease); + this->CallSwVers("-buildVersion",this->OSVersion); #endif #endif return true; - } - -void SystemInformationImplementation::CallSwVers() +int SystemInformationImplementation::CallSwVers( + const char *arg, + kwsys_stl::string &ver) { #ifdef __APPLE__ - kwsys_stl::string output; kwsys_stl::vector args; - args.clear(); - - args.push_back("sw_vers"); - args.push_back("-productName"); - args.push_back(0); - output = this->RunProcess(args); - this->TrimNewline(output); - this->OSName = output; - args.clear(); - args.push_back("sw_vers"); - args.push_back("-productVersion"); + args.push_back(arg); args.push_back(0); - output = this->RunProcess(args); - this->TrimNewline(output); - this->OSRelease = output; - args.clear(); - - args.push_back("sw_vers"); - args.push_back("-buildVersion"); - args.push_back(0); - output = this->RunProcess(args); - this->TrimNewline(output); - this->OSVersion = output; + ver = this->RunProcess(args); + this->TrimNewline(ver); +#else + // avoid C4100 + (void)arg; + (void)ver; #endif + return 0; } - void SystemInformationImplementation::TrimNewline(kwsys_stl::string& output) -{ +{ // remove \r kwsys_stl::string::size_type pos=0; while((pos = output.find("\r", pos)) != kwsys_stl::string::npos) diff --git a/Source/kwsys/SystemInformation.hxx.in b/Source/kwsys/SystemInformation.hxx.in index b6ebe6aee..8f4cb4e5a 100644 --- a/Source/kwsys/SystemInformation.hxx.in +++ b/Source/kwsys/SystemInformation.hxx.in @@ -24,14 +24,22 @@ namespace @KWSYS_NAMESPACE@ { - -// forward declare the implementation class +// forward declare the implementation class class SystemInformationImplementation; - -class @KWSYS_NAMESPACE@_EXPORT SystemInformation -{ +class @KWSYS_NAMESPACE@_EXPORT SystemInformation +{ +#if @KWSYS_USE_LONG_LONG@ + typedef long long LongLong; +#elif @KWSYS_USE___INT64@ + typedef __int64 LongLong; +#else +# error "No Long Long" +#endif + friend class SystemInformationImplementation; + SystemInformationImplementation* Implementation; public: + SystemInformation (); ~SystemInformation (); @@ -40,6 +48,7 @@ public: kwsys_stl::string GetTypeID(); kwsys_stl::string GetFamilyID(); kwsys_stl::string GetModelID(); + kwsys_stl::string GetModelName(); kwsys_stl::string GetSteppingCode(); const char * GetExtendedProcessorName(); const char * GetProcessorSerialNumber(); @@ -49,13 +58,27 @@ public: int GetProcessorAPICID(); int GetProcessorCacheXSize(long int); bool DoesCPUSupportFeature(long int); - - const char * GetOSName(); + + // returns an informative general description of the cpu + // on this system. + kwsys_stl::string GetCPUDescription(); + const char * GetHostname(); + kwsys_stl::string GetFullyQualifiedDomainName(); + + const char * GetOSName(); const char * GetOSRelease(); const char * GetOSVersion(); const char * GetOSPlatform(); + int GetOSIsWindows(); + int GetOSIsLinux(); + int GetOSIsApple(); + + // returns an informative general description of the os + // on this system. + kwsys_stl::string GetOSDescription(); + bool Is64Bits(); unsigned int GetNumberOfLogicalCPU(); // per physical cpu @@ -63,20 +86,62 @@ public: bool DoesCPUSupportCPUID(); + // Retrieve id of the current running process + LongLong GetProcessId(); + // Retrieve memory information in megabyte. size_t GetTotalVirtualMemory(); size_t GetAvailableVirtualMemory(); size_t GetTotalPhysicalMemory(); - size_t GetAvailablePhysicalMemory(); + size_t GetAvailablePhysicalMemory(); + + // returns an informative general description if the installed and + // available ram on this system. See the GetHostMmeoryTotal, and + // Get{Host,Proc}MemoryAvailable methods for more information. + kwsys_stl::string GetMemoryDescription( + const char *hostLimitEnvVarName=NULL, + const char *procLimitEnvVarName=NULL); + + // Retrieve amount of physical memory installed on the system in KiB + // units. + LongLong GetHostMemoryTotal(); + + // Get total system RAM in units of KiB available colectivley to all + // processes in a process group. An example of a process group + // are the processes comprising an mpi program which is running in + // parallel. The amount of memory reported may differ from the host + // total if a host wide resource limit is applied. Such reource limits + // are reported to us via an applicaiton specified environment variable. + LongLong GetHostMemoryAvailable(const char *hostLimitEnvVarName=NULL); + + // Get total system RAM in units of KiB available to this process. + // This may differ from the host available if a per-process resource + // limit is applied. per-process memory limits are applied on unix + // system via rlimit api. Resource limits that are not imposed via + // rlimit api may be reported to us via an application specified + // environment variable. + LongLong GetProcMemoryAvailable( + const char *hostLimitEnvVarName=NULL, + const char *procLimitEnvVarName=NULL); + + // Get the system RAM used by all processes on the host, in units of KiB. + LongLong GetHostMemoryUsed(); + + // Get system RAM used by this process id in units of KiB. + LongLong GetProcMemoryUsed(); + + // enable/disable stack trace signal handler. In order to + // produce an informative stack trace the application should + // be dynamically linked and compiled with debug symbols. + static + void SetStackTraceOnError(int enable); /** Run the different checks */ void RunCPUCheck(); void RunOSCheck(); void RunMemoryCheck(); -private: - SystemInformationImplementation* Implementation; - }; + } // namespace @KWSYS_NAMESPACE@ /* Undefine temporary macros. */ diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 66850e9ac..22bf193b0 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -157,7 +157,7 @@ public: #include #endif -#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) +#if defined(__BEOS__) && !defined(__ZETA__) #include #include @@ -196,18 +196,16 @@ inline int Rmdir(const char* dir) } inline const char* Getcwd(char* buf, unsigned int len) { - const char* ret = _getcwd(buf, len); - if(!ret) + if(const char* ret = _getcwd(buf, len)) { - fprintf(stderr, "No current working directory.\n"); - abort(); - } - // make sure the drive letter is capital - if(strlen(buf) > 1 && buf[1] == ':') - { - buf[0] = toupper(buf[0]); + // make sure the drive letter is capital + if(strlen(buf) > 1 && buf[1] == ':') + { + buf[0] = toupper(buf[0]); + } + return ret; } - return ret; + return 0; } inline int Chdir(const char* dir) { @@ -245,13 +243,7 @@ inline int Rmdir(const char* dir) } inline const char* Getcwd(char* buf, unsigned int len) { - const char* ret = getcwd(buf, len); - if(!ret) - { - fprintf(stderr, "No current working directory\n"); - abort(); - } - return ret; + return getcwd(buf, len); } inline int Chdir(const char* dir) @@ -622,11 +614,7 @@ bool SystemTools::MakeDirectory(const char* path) } SystemTools::ConvertToUnixSlashes(dir); - kwsys_stl::string::size_type pos = dir.find(':'); - if(pos == kwsys_stl::string::npos) - { - pos = 0; - } + kwsys_stl::string::size_type pos = 0; kwsys_stl::string topdir; while((pos = dir.find('/', pos)) != kwsys_stl::string::npos) { @@ -634,14 +622,7 @@ bool SystemTools::MakeDirectory(const char* path) Mkdir(topdir.c_str()); pos++; } - if(dir[dir.size()-1] == '/') - { - topdir = dir.substr(0, dir.size()); - } - else - { - topdir = dir; - } + topdir = dir; if(Mkdir(topdir.c_str()) != 0) { // There is a bug in the Borland Run time library which makes MKDIR @@ -1665,7 +1646,7 @@ kwsys_stl::string SystemTools::EscapeChars( kwsys_stl::string n; if (str) { - if (!chars_to_escape | !*chars_to_escape) + if (!chars_to_escape || !*chars_to_escape) { n.append(str); } @@ -2754,9 +2735,15 @@ kwsys_stl::string SystemTools::GetRealPath(const char* path) bool SystemTools::FileIsDirectory(const char* name) { + size_t length = strlen(name); + if (length == 0) + { + return false; + } + // Remove any trailing slash from the name. char buffer[KWSYS_SYSTEMTOOLS_MAXPATH]; - size_t last = strlen(name)-1; + size_t last = length-1; if(last > 0 && (name[last] == '/' || name[last] == '\\') && strcmp(name, "/") !=0) { @@ -3042,7 +3029,7 @@ void SystemTools::CheckTranslationPath(kwsys_stl::string & path) path.erase(path.end()-1, path.end()); } -void +static void SystemToolsAppendComponents( kwsys_stl::vector& out_components, kwsys_stl::vector::const_iterator first, @@ -3094,7 +3081,7 @@ kwsys_stl::string SystemTools::CollapseFullPath(const char* in_path, } else { - // ?? + base_components.push_back(""); } } @@ -4048,7 +4035,7 @@ kwsys_stl::string SystemTools::GetCurrentDateTime(const char* format) return kwsys_stl::string(buf); } -kwsys_stl::string SystemTools::MakeCindentifier(const char* s) +kwsys_stl::string SystemTools::MakeCidentifier(const char* s) { kwsys_stl::string str(s); if (str.find_first_of("0123456789") == 0) @@ -4709,7 +4696,7 @@ bool SystemTools::ParseURL( const kwsys_stl::string& URL, // ---------------------------------------------------------------------- // These must NOT be initialized. Default initialization to zero is // necessary. -unsigned int SystemToolsManagerCount; +static unsigned int SystemToolsManagerCount; SystemToolsTranslationMap *SystemTools::TranslationMap; SystemToolsTranslationMap *SystemTools::LongPathMap; #ifdef __CYGWIN__ diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 5171125ce..9c56e96b0 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -91,8 +91,13 @@ public: * then an underscore is prepended. Note that this can produce * identifiers that the standard reserves (_[A-Z].* and __.*). */ - static kwsys_stl::string MakeCindentifier(const char* s); - + static kwsys_stl::string MakeCidentifier(const char* s); + + static kwsys_stl::string MakeCindentifier(const char* s) + { + return MakeCidentifier(s); + } + /** * Replace replace all occurences of the string in the source string. */ diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx index 7b73d06df..48976c442 100644 --- a/Source/kwsys/kwsysPlatformTestsCXX.cxx +++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx @@ -358,6 +358,30 @@ int main() } #endif +#ifdef TEST_KWSYS_IOS_HAS_ISTREAM___INT64 +int test_istream(kwsys_ios::istream& is, __int64& x) +{ + return (is >> x)? 1:0; +} +int main() +{ + __int64 x = 0; + return test_istream(kwsys_ios::cin, x); +} +#endif + +#ifdef TEST_KWSYS_IOS_HAS_OSTREAM___INT64 +int test_ostream(kwsys_ios::ostream& os, __int64 x) +{ + return (os << x)? 1:0; +} +int main() +{ + __int64 x = 0; + return test_ostream(kwsys_ios::cout, x); +} +#endif + #ifdef TEST_KWSYS_CHAR_IS_SIGNED /* Return 0 for char signed and 1 for char unsigned. */ int main() @@ -428,6 +452,48 @@ int main() } #endif +#ifdef TEST_KWSYS_CXX_HAS_RLIMIT64 +# if defined(KWSYS_HAS_LFS) +# define _LARGEFILE_SOURCE +# define _LARGEFILE64_SOURCE +# define _LARGE_FILES +# define _FILE_OFFSET_BITS 64 +# endif +# include +int main() +{ + struct rlimit64 rlim; + return getrlimit64(0,&rlim); +} +#endif + +#ifdef TEST_KWSYS_CXX_HAS_ATOLL +#include +int main() +{ + const char *str="1024"; + return static_cast(atoll(str)); +} +#endif + +#ifdef TEST_KWSYS_CXX_HAS_ATOL +#include +int main() +{ + const char *str="1024"; + return static_cast(atol(str)); +} +#endif + +#ifdef TEST_KWSYS_CXX_HAS__ATOI64 +#include +int main() +{ + const char *str="1024"; + return static_cast(_atoi64(str)); +} +#endif + #ifdef TEST_KWSYS_CXX_TYPE_INFO /* Collect fundamental type information and save it to a CMake script. */ @@ -514,3 +580,30 @@ int main() } } #endif + +#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM +int main() +{ + int a = 1; + __asm { + xor EBX, EBX; + mov a, EBX; + } + + return a; +} +#endif + +#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM_CPUID +int main() +{ + int a = 0; + __asm { + xor EAX, EAX; + cpuid; + mov a, EAX; + } + + return a; +} +#endif diff --git a/Source/kwsys/testCommandLineArguments.cxx b/Source/kwsys/testCommandLineArguments.cxx index e75a87e86..72e65447b 100644 --- a/Source/kwsys/testCommandLineArguments.cxx +++ b/Source/kwsys/testCommandLineArguments.cxx @@ -24,9 +24,9 @@ #include /* size_t */ #include /* strcmp */ -void* random_ptr = reinterpret_cast(0x123); +static void* random_ptr = reinterpret_cast(0x123); -int argument(const char* arg, const char* value, void* call_data) +static int argument(const char* arg, const char* value, void* call_data) { kwsys_ios::cout << "Got argument: \"" << arg << "\" value: \"" << (value?value:"(null)") << "\"" << kwsys_ios::endl; if ( call_data != random_ptr ) @@ -37,7 +37,7 @@ int argument(const char* arg, const char* value, void* call_data) return 1; } -int unknown_argument(const char* argument, void* call_data) +static int unknown_argument(const char* argument, void* call_data) { kwsys_ios::cout << "Got unknown argument: \"" << argument << "\"" << kwsys_ios::endl; if ( call_data != random_ptr ) @@ -48,12 +48,12 @@ int unknown_argument(const char* argument, void* call_data) return 1; } -bool CompareTwoItemsOnList(bool i1, bool i2) { return i1 == i2; } -bool CompareTwoItemsOnList(int i1, int i2) { return i1 == i2; } -bool CompareTwoItemsOnList(double i1, double i2) { return i1 == i2; } -bool CompareTwoItemsOnList(const char* i1, +static bool CompareTwoItemsOnList(bool i1, bool i2) { return i1 == i2; } +static bool CompareTwoItemsOnList(int i1, int i2) { return i1 == i2; } +static bool CompareTwoItemsOnList(double i1, double i2) { return i1 == i2; } +static bool CompareTwoItemsOnList(const char* i1, const char* i2) { return strcmp(i1, i2) == 0; } -bool CompareTwoItemsOnList(const kwsys_stl::string& i1, +static bool CompareTwoItemsOnList(const kwsys_stl::string& i1, const kwsys_stl::string& i2) { return i1 == i2; } int testCommandLineArguments(int argc, char* argv[]) diff --git a/Source/kwsys/testDynamicLoader.cxx b/Source/kwsys/testDynamicLoader.cxx index a7adbcad9..61c157291 100644 --- a/Source/kwsys/testDynamicLoader.cxx +++ b/Source/kwsys/testDynamicLoader.cxx @@ -15,7 +15,7 @@ #include KWSYS_HEADER(ios/iostream) #include KWSYS_HEADER(stl/string) -#if defined(__BEOS__) && !defined(__HAIKU__) +#if defined(__BEOS__) #include /* disable_debugger() API. */ #endif @@ -35,7 +35,7 @@ // left on disk. #include -kwsys_stl::string GetLibName(const char* lname) +static kwsys_stl::string GetLibName(const char* lname) { // Construct proper name of lib kwsys_stl::string slname; diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c index 877002a14..6d5eb71fd 100644 --- a/Source/kwsys/testProcess.c +++ b/Source/kwsys/testProcess.c @@ -32,7 +32,7 @@ # pragma warn -8060 /* possibly incorrect assignment */ #endif -#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) +#if defined(__BEOS__) && !defined(__ZETA__) /* BeOS 5 doesn't have usleep(), but it has snooze(), which is identical. */ # include static inline void testProcess_usleep(unsigned int msec) @@ -47,7 +47,7 @@ int runChild(const char* cmd[], int state, int exception, int value, int share, int output, int delay, double timeout, int poll, int repeat, int disown); -int test1(int argc, const char* argv[]) +static int test1(int argc, const char* argv[]) { (void)argc; (void)argv; fprintf(stdout, "Output on stdout from test returning 0.\n"); @@ -55,7 +55,7 @@ int test1(int argc, const char* argv[]) return 0; } -int test2(int argc, const char* argv[]) +static int test2(int argc, const char* argv[]) { (void)argc; (void)argv; fprintf(stdout, "Output on stdout from test returning 123.\n"); @@ -63,7 +63,7 @@ int test2(int argc, const char* argv[]) return 123; } -int test3(int argc, const char* argv[]) +static int test3(int argc, const char* argv[]) { (void)argc; (void)argv; fprintf(stdout, "Output before sleep on stdout from timeout test.\n"); @@ -80,8 +80,16 @@ int test3(int argc, const char* argv[]) return 0; } -int test4(int argc, const char* argv[]) +static int test4(int argc, const char* argv[]) { + /* Prepare a pointer to an invalid address. Don't use null, because + dereferencing null is undefined behaviour and compilers are free to + do whatever they want. ex: Clang will warn at compile time, or even + optimize away the write. We hope to 'outsmart' them by using + 'volatile' and a slightly larger address, based on a runtime value. */ + volatile int* invalidAddress = 0; + invalidAddress += argc?1:2; + #if defined(_WIN32) /* Avoid error diagnostic popups since we are crashing on purpose. */ SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); @@ -94,17 +102,14 @@ int test4(int argc, const char* argv[]) fprintf(stderr, "Output before crash on stderr from crash test.\n"); fflush(stdout); fflush(stderr); -#if defined(__clang__) - *(int*)1 = 0; /* Clang warns about 0-ptr; undefined behavior. */ -#else - *(int*)0 = 0; -#endif + /* Provoke deliberate crash by writing to the invalid address. */ + *invalidAddress = 0; fprintf(stdout, "Output after crash on stdout from crash test.\n"); fprintf(stderr, "Output after crash on stderr from crash test.\n"); return 0; } -int test5(int argc, const char* argv[]) +static int test5(int argc, const char* argv[]) { int r; const char* cmd[4]; @@ -127,7 +132,7 @@ int test5(int argc, const char* argv[]) } #define TEST6_SIZE (4096*2) -void test6(int argc, const char* argv[]) +static void test6(int argc, const char* argv[]) { int i; char runaway[TEST6_SIZE+1]; @@ -151,7 +156,7 @@ void test6(int argc, const char* argv[]) delaying 1/10th of a second should ever have to poll. */ #define MINPOLL 5 #define MAXPOLL 20 -int test7(int argc, const char* argv[]) +static int test7(int argc, const char* argv[]) { (void)argc; (void)argv; fprintf(stdout, "Output on stdout before sleep.\n"); @@ -171,7 +176,7 @@ int test7(int argc, const char* argv[]) return 0; } -int test8(int argc, const char* argv[]) +static int test8(int argc, const char* argv[]) { /* Create a disowned grandchild to test handling of processes that exit before their children. */ @@ -195,7 +200,7 @@ int test8(int argc, const char* argv[]) return r; } -int test8_grandchild(int argc, const char* argv[]) +static int test8_grandchild(int argc, const char* argv[]) { (void)argc; (void)argv; fprintf(stdout, "Output on stdout from grandchild before sleep.\n"); @@ -216,7 +221,7 @@ int test8_grandchild(int argc, const char* argv[]) return 0; } -int runChild2(kwsysProcess* kp, +static int runChild2(kwsysProcess* kp, const char* cmd[], int state, int exception, int value, int share, int output, int delay, double timeout, int poll, int disown) @@ -500,7 +505,7 @@ int main(int argc, const char* argv[]) fprintf(stderr, "Output on stderr after test %d.\n", n); fflush(stdout); fflush(stderr); -#if _WIN32 +#if defined(_WIN32) if(argv0) { free(argv0); } #endif return r; diff --git a/Source/kwsys/testRegistry.cxx b/Source/kwsys/testRegistry.cxx deleted file mode 100644 index 7e9b0d49b..000000000 --- a/Source/kwsys/testRegistry.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/*============================================================================ - KWSys - Kitware System Library - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "kwsysPrivate.h" - -#include KWSYS_HEADER(Registry.hxx) -#include KWSYS_HEADER(ios/iostream) -#include - -// Work-around CMake dependency scanning limitation. This must -// duplicate the above list of headers. -#if 0 -# include "Registry.hxx.in" -# include "kwsys_ios_iostream.h.in" -#endif - -#define IFT(x,res) if ( !x ) \ - { \ - res = 1; \ - kwsys_ios::cout << "Error in: " << #x << kwsys_ios::endl; \ - } -#define IFNT(x,res) if ( x ) \ - { \ - res = 1; \ - kwsys_ios::cout << "Error in: " << #x << kwsys_ios::endl; \ - } - -#define CHE(x,y,res) if ( x && strcmp(x,y) ) \ - { \ - res = 1; \ - kwsys_ios::cout << "Error, " << x << " != " << y << kwsys_ios::endl; \ - } - -int testRegistry(int, char*[]) -{ - int res = 0; - - kwsys::Registry reg; - reg.SetTopLevel("TestRegistry"); - - IFT(reg.SetValue("TestSubkey", "TestKey1", "Test Value 1"), res); - IFT(reg.SetValue("TestSubkey1", "TestKey2", "Test Value 2"), res); - IFT(reg.SetValue("TestSubkey", "TestKey3", "Test Value 3"), res); - IFT(reg.SetValue("TestSubkey2", "TestKey4", "Test Value 4"), res); - - const char *buffer; - IFT(reg.ReadValue("TestSubkey", "TestKey1", &buffer), res); - CHE(buffer, "Test Value 1", res); - IFT(reg.ReadValue("TestSubkey1", "TestKey2", &buffer), res); - CHE(buffer, "Test Value 2", res); - IFT(reg.ReadValue("TestSubkey", "TestKey3", &buffer), res); - CHE(buffer, "Test Value 3", res); - IFT(reg.ReadValue("TestSubkey2", "TestKey4", &buffer), res); - CHE(buffer, "Test Value 4", res); - - IFT(reg.SetValue("TestSubkey", "TestKey1", "New Test Value 1"), res); - IFT(reg.SetValue("TestSubkey1", "TestKey2", "New Test Value 2"), res); - IFT(reg.SetValue("TestSubkey", "TestKey3", "New Test Value 3"), res); - IFT(reg.SetValue("TestSubkey2", "TestKey4", "New Test Value 4"), res); - - IFT(reg.ReadValue("TestSubkey", "TestKey1", &buffer), res); - CHE(buffer, "New Test Value 1", res); - IFT(reg.ReadValue("TestSubkey1", "TestKey2", &buffer), res); - CHE(buffer, "New Test Value 2", res); - IFT(reg.ReadValue("TestSubkey", "TestKey3", &buffer), res); - CHE(buffer, "New Test Value 3", res); - IFT(reg.ReadValue("TestSubkey2", "TestKey4", &buffer), res); - CHE(buffer, "New Test Value 4", res); - - IFT( reg.DeleteValue("TestSubkey", "TestKey1"), res); - IFNT(reg.ReadValue( "TestSubkey", "TestKey1", &buffer), res); - IFT( reg.DeleteValue("TestSubkey1", "TestKey2"), res); - IFNT(reg.ReadValue( "TestSubkey1", "TestKey2", &buffer), res); - IFT( reg.DeleteValue("TestSubkey", "TestKey3"), res); - IFNT(reg.ReadValue( "TestSubkey", "TestKey3", &buffer), res); - IFT( reg.DeleteValue("TestSubkey2", "TestKey4"), res); - IFNT(reg.ReadValue( "TestSubkey2", "TestKey5", &buffer), res); - - const char* longStringWithNewLines = "Value with embedded CR and LF characters CR='\015' LF='\012' CRLF='\015\012'"; - IFT(reg.SetValue("TestSubkeyWithVeryLongInFactSoLongItsHardToImagineAnybodyWouldReallyDoItLongName", "TestKey1", longStringWithNewLines), res); - IFT(reg.ReadValue("TestSubkeyWithVeryLongInFactSoLongItsHardToImagineAnybodyWouldReallyDoItLongName", "TestKey1", &buffer), res); - CHE(buffer, longStringWithNewLines, res); - IFT(reg.DeleteValue("TestSubkeyWithVeryLongInFactSoLongItsHardToImagineAnybodyWouldReallyDoItLongName", "TestKey1"), res); - IFNT(reg.ReadValue("TestSubkeyWithVeryLongInFactSoLongItsHardToImagineAnybodyWouldReallyDoItLongName", "TestKey1", &buffer), res); - - IFT(reg.SetValue("TestSubkeyWith = EqualSignChar", "TestKey = 1", "Some value"), res); - IFT(reg.ReadValue("TestSubkeyWith = EqualSignChar", "TestKey = 1", &buffer), res); - CHE(buffer, "Some value", res); - IFT(reg.DeleteValue("TestSubkeyWith = EqualSignChar", "TestKey = 1"), res); - IFNT(reg.ReadValue("TestSubkeyWith = EqualSignChar", "TestKey = 1", &buffer), res); - - if ( res ) - { - kwsys_ios::cout << "Test failed" << kwsys_ios::endl; - } - else - { - kwsys_ios::cout << "Test passed" << kwsys_ios::endl; - } - return res; -} diff --git a/Source/kwsys/testSystemInformation.cxx b/Source/kwsys/testSystemInformation.cxx index b3afc9de9..49a686c17 100644 --- a/Source/kwsys/testSystemInformation.cxx +++ b/Source/kwsys/testSystemInformation.cxx @@ -13,8 +13,6 @@ #include KWSYS_HEADER(SystemInformation.hxx) #include KWSYS_HEADER(ios/iostream) - - // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 @@ -22,20 +20,45 @@ # include "kwsys_ios_iostream.h.in" #endif -#define printMethod(inof, m) kwsys_ios::cout << #m << ": " \ +#if defined(KWSYS_USE_LONG_LONG) +# if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG) +# define iostreamLongLong(x) (x) +# else +# define iostreamLongLong(x) ((long)x) +# endif +#elif defined(KWSYS_USE___INT64) +# if defined(KWSYS_IOS_HAS_OSTREAM___INT64) +# define iostreamLongLong(x) (x) +# else +# define iostreamLongLong(x) ((long)x) +# endif +#else +# error "No Long Long" +#endif + +#define printMethod(info, m) kwsys_ios::cout << #m << ": " \ << info.m() << "\n" -#define printMethod2(inof, m, unit) kwsys_ios::cout << #m << ": " \ +#define printMethod2(info, m, unit) kwsys_ios::cout << #m << ": " \ << info.m() << " " << unit << "\n" +#define printMethod3(info, m, unit) kwsys_ios::cout << #m << ": " \ +<< iostreamLongLong(info.m) << " " << unit << "\n" + int testSystemInformation(int, char*[]) { + kwsys_ios::cout << "CTEST_FULL_OUTPUT\n"; // avoid truncation + kwsys::SystemInformation info; info.RunCPUCheck(); info.RunOSCheck(); info.RunMemoryCheck(); printMethod(info, GetOSName); + printMethod(info, GetOSIsLinux); + printMethod(info, GetOSIsApple); + printMethod(info, GetOSIsWindows); printMethod(info, GetHostname); + printMethod(info, GetFullyQualifiedDomainName); printMethod(info, GetOSRelease); printMethod(info, GetOSVersion); printMethod(info, GetOSPlatform); @@ -45,6 +68,7 @@ int testSystemInformation(int, char*[]) printMethod(info, GetFamilyID); printMethod(info, GetModelID); printMethod(info, GetExtendedProcessorName); + printMethod(info, GetSteppingCode); printMethod(info, GetProcessorSerialNumber); printMethod2(info, GetProcessorCacheSize, "KB"); printMethod(info, GetLogicalProcessorsPerPhysical); @@ -58,7 +82,19 @@ int testSystemInformation(int, char*[]) printMethod2(info, GetAvailableVirtualMemory, "MB"); printMethod2(info, GetTotalPhysicalMemory, "MB"); printMethod2(info, GetAvailablePhysicalMemory, "MB"); + printMethod3(info, GetHostMemoryTotal(), "KiB"); + printMethod3(info, GetHostMemoryAvailable("KWSHL"), "KiB"); + printMethod3(info, GetProcMemoryAvailable("KWSHL","KWSPL"), "KiB"); + printMethod3(info, GetHostMemoryUsed(), "KiB"); + printMethod3(info, GetProcMemoryUsed(), "KiB"); + for (int i = 0; i <= 31; i++) + { + if (info.DoesCPUSupportFeature(1 << i)) + { + kwsys_ios::cout << "CPU feature " << i << "\n"; + } + } //int GetProcessorCacheXSize(long int); // bool DoesCPUSupportFeature(long int); return 0; diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index 3ac0cb399..1690fd51a 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -32,7 +32,7 @@ #include /* strcmp */ //---------------------------------------------------------------------------- -const char* toUnixPaths[][2] = +static const char* toUnixPaths[][2] = { { "/usr/local/bin/passwd", "/usr/local/bin/passwd" }, { "/usr/lo cal/bin/pa sswd", "/usr/lo cal/bin/pa sswd" }, @@ -52,8 +52,8 @@ const char* toUnixPaths[][2] = {0, 0} }; -bool CheckConvertToUnixSlashes(kwsys_stl::string input, - kwsys_stl::string output) +static bool CheckConvertToUnixSlashes(kwsys_stl::string input, + kwsys_stl::string output) { kwsys_stl::string result = input; kwsys::SystemTools::ConvertToUnixSlashes(result); @@ -69,17 +69,17 @@ bool CheckConvertToUnixSlashes(kwsys_stl::string input, } //---------------------------------------------------------------------------- -const char* checkEscapeChars[][4] = +static const char* checkEscapeChars[][4] = { { "1 foo 2 bar 2", "12", "\\", "\\1 foo \\2 bar \\2"}, { " {} ", "{}", "#", " #{#} "}, {0, 0, 0, 0} }; -bool CheckEscapeChars(kwsys_stl::string input, - const char *chars_to_escape, - char escape_char, - kwsys_stl::string output) +static bool CheckEscapeChars(kwsys_stl::string input, + const char *chars_to_escape, + char escape_char, + kwsys_stl::string output) { kwsys_stl::string result = kwsys::SystemTools::EscapeChars( input.c_str(), chars_to_escape, escape_char); @@ -95,7 +95,7 @@ bool CheckEscapeChars(kwsys_stl::string input, } //---------------------------------------------------------------------------- -bool CheckFileOperations() +static bool CheckFileOperations() { bool res = true; @@ -129,7 +129,7 @@ bool CheckFileOperations() } //---------------------------------------------------------------------------- -bool CheckStringOperations() +static bool CheckStringOperations() { bool res = true; @@ -329,7 +329,7 @@ bool CheckStringOperations() //---------------------------------------------------------------------------- -bool CheckPutEnv(const char* env, const char* name, const char* value) +static bool CheckPutEnv(const char* env, const char* name, const char* value) { if(!kwsys::SystemTools::PutEnv(env)) { @@ -348,7 +348,7 @@ bool CheckPutEnv(const char* env, const char* name, const char* value) return true; } -bool CheckUnPutEnv(const char* env, const char* name) +static bool CheckUnPutEnv(const char* env, const char* name) { if(!kwsys::SystemTools::UnPutEnv(env)) { @@ -365,7 +365,7 @@ bool CheckUnPutEnv(const char* env, const char* name) return true; } -bool CheckEnvironmentOperations() +static bool CheckEnvironmentOperations() { bool res = true; res &= CheckPutEnv("A=B", "A", "B"); diff --git a/Templates/CMakeVisualStudio6Configurations.cmake b/Templates/CMakeVisualStudio6Configurations.cmake index a9db2eeba..6355969ab 100644 --- a/Templates/CMakeVisualStudio6Configurations.cmake +++ b/Templates/CMakeVisualStudio6Configurations.cmake @@ -1,3 +1,3 @@ -# When the dll templates are changed, this list should be +# When the dll templates are changed, this list should be # updated with the list of possible configurations. -SET(CMAKE_CONFIGURATION_TYPES Debug Release MinSizeRel RelWithDebInfo) +set(CMAKE_CONFIGURATION_TYPES Debug Release MinSizeRel RelWithDebInfo) diff --git a/Templates/CTestScript.cmake.in b/Templates/CTestScript.cmake.in index 63bd26f47..5fb3529e4 100644 --- a/Templates/CTestScript.cmake.in +++ b/Templates/CTestScript.cmake.in @@ -1,26 +1,26 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.4) +cmake_minimum_required(VERSION 2.4) # This is a template for the CTest script for this system -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "@BUILDNAME@") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "@BUILDNAME@") # --- -SET(CTEST_SOURCE_DIRECTORY "@CMAKE_SOURCE_DIR@") -SET(CTEST_BINARY_DIRECTORY "@CMAKE_BINARY_DIR@") -SET(CTEST_UPDATE_COMMAND "@UPDATE_COMMAND@") -SET(CTEST_UPDATE_OPTIONS "@UPDATE_OPTIONS@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "Release") -#SET(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@") -#SET(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@") -#SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@") -#SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMAKE_SOURCE_DIR@") +set(CTEST_BINARY_DIRECTORY "@CMAKE_BINARY_DIR@") +set(CTEST_UPDATE_COMMAND "@UPDATE_COMMAND@") +set(CTEST_UPDATE_OPTIONS "@UPDATE_OPTIONS@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_BUILD_CONFIGURATION "Release") +#set(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@") +#set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@") +#set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@") +#set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") #CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) -SET(CTEST_DROP_METHOD "@DROP_METHOD@") +set(CTEST_DROP_METHOD "@DROP_METHOD@") CTEST_START(Experimental TRACK Weekly) CTEST_UPDATE(SOURCE "${CTEST_SOURCE_DIRECTORY}") diff --git a/Templates/DLLHeader.dsptemplate b/Templates/DLLHeader.dsptemplate index c752fdbf4..d9bccaf56 100644 --- a/Templates/DLLHeader.dsptemplate +++ b/Templates/DLLHeader.dsptemplate @@ -59,13 +59,13 @@ RSC=rc.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /D "WIN32" /D "_WINDOWS" /D "_USRDLL" OUTPUT_LIBNAME_EXPORTS /FD /c # ADD CPP /nologo /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /FD /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS +# ADD CPP BUILD_INCLUDES_RELEASE EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_RELEASE # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC BUILD_INCLUDES_RELEASE /l 0x409 /d "NDEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_RELEASE BSC32=bscmake.exe @@ -93,13 +93,13 @@ CMAKE_CUSTOM_RULE_CODE_RELEASE # PROP Target_Dir "" # ADD BASE CPP /nologo /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" OUTPUT_LIBNAME_EXPORTS /FD /c # ADD CPP /nologo /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /FD /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS +# ADD CPP BUILD_INCLUDES_DEBUG EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_DEBUG # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "_DEBUG" +# ADD RSC BUILD_INCLUDES_DEBUG /l 0x409 /d "_DEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_DEBUG BSC32=bscmake.exe @@ -129,13 +129,13 @@ CMAKE_CUSTOM_RULE_CODE_DEBUG # ADD BASE CPP /nologo /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /FD /c OUTPUT_LIBNAME_EXPORTS # SUBTRACT BASE CPP /YX # ADD CPP /nologo /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /FD /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS +# ADD CPP BUILD_INCLUDES_MINSIZEREL EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_MINSIZEREL # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC BUILD_INCLUDES_MINSIZEREL /l 0x409 /d "NDEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_MINSIZEREL BSC32=bscmake.exe @@ -163,13 +163,13 @@ CMAKE_CUSTOM_RULE_CODE_MINSIZEREL # PROP Target_Dir "" # ADD BASE CPP /nologo /D "WIN32" /D "_WINDOWS" /D "_USRDLL" OUTPUT_LIBNAME_EXPORTS /FD /c # ADD CPP /nologo /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /FD /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS +# ADD CPP BUILD_INCLUDES_RELWITHDEBINFO EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_RELWITHDEBINFO # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC BUILD_INCLUDES_RELWITHDEBINFO /l 0x409 /d "NDEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_RELWITHDEBINFO BSC32=bscmake.exe diff --git a/Templates/EXEHeader.dsptemplate b/Templates/EXEHeader.dsptemplate index f48eaccbc..3a6d2feb1 100644 --- a/Templates/EXEHeader.dsptemplate +++ b/Templates/EXEHeader.dsptemplate @@ -58,11 +58,11 @@ RSC=rc.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FD /c # ADD CPP /nologo /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FD /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS +# ADD CPP BUILD_INCLUDES_RELEASE EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_RELEASE # ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC BUILD_INCLUDES_RELEASE /l 0x409 /d "NDEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_RELEASE BSC32=bscmake.exe @@ -90,13 +90,13 @@ CMAKE_CUSTOM_RULE_CODE_RELEASE # PROP Target_Dir "" # ADD BASE CPP /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /GZ /c # ADD CPP /nologo /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /GZ /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS +# ADD CPP BUILD_INCLUDES_DEBUG EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_DEBUG # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "_DEBUG" +# ADD RSC BUILD_INCLUDES_DEBUG /l 0x409 /d "_DEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_DEBUG BSC32=bscmake.exe @@ -122,12 +122,12 @@ CMAKE_CUSTOM_RULE_CODE_DEBUG # PROP Intermediate_Dir "MinSizeRel" # PROP Target_Dir "" # ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FD /c -# ADD CPP /nologo /D "WIN32" BUILD_INCLUDES EXTRA_DEFINES /D "NDEBUG" /D "_CONSOLE" /FD /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS +# ADD CPP /nologo /D "WIN32" BUILD_INCLUDES_MINSIZEREL EXTRA_DEFINES /D "NDEBUG" /D "_CONSOLE" /FD /c +# ADD CPP BUILD_INCLUDES_MINSIZEREL EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_MINSIZEREL # ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC BUILD_INCLUDES_MINSIZEREL /l 0x409 /d "NDEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_MINSIZEREL BSC32=bscmake.exe @@ -155,11 +155,11 @@ CMAKE_CUSTOM_RULE_CODE_MINSIZEREL # PROP Target_Dir "" # ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FD /c # ADD CPP /nologo /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FD /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS +# ADD CPP BUILD_INCLUDES_RELWITHDEBINFO EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_RELWITHDEBINFO # ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC BUILD_INCLUDES_RELWITHDEBINFO /l 0x409 /d "NDEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_RELWITHDEBINFO BSC32=bscmake.exe diff --git a/Templates/EXEWinHeader.dsptemplate b/Templates/EXEWinHeader.dsptemplate index e0d226479..350e3ea00 100644 --- a/Templates/EXEWinHeader.dsptemplate +++ b/Templates/EXEWinHeader.dsptemplate @@ -58,13 +58,13 @@ RSC=rc.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c # ADD CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS +# ADD CPP BUILD_INCLUDES_RELEASE EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_RELEASE # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC BUILD_INCLUDES_RELEASE /l 0x409 /d "NDEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_RELEASE BSC32=bscmake.exe @@ -92,13 +92,13 @@ CMAKE_CUSTOM_RULE_CODE_RELEASE # PROP Target_Dir "" # ADD BASE CPP /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c # ADD CPP /nologo /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /GZ /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS +# ADD CPP BUILD_INCLUDES_DEBUG EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_DEBUG # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "_DEBUG" +# ADD RSC BUILD_INCLUDES_DEBUG /l 0x409 /d "_DEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_DEBUG BSC32=bscmake.exe @@ -125,11 +125,11 @@ CMAKE_CUSTOM_RULE_CODE_DEBUG # PROP Target_Dir "" # ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c # ADD CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS +# ADD CPP BUILD_INCLUDES_MINSIZEREL EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_MINSIZEREL # ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC BUILD_INCLUDES_MINSIZEREL /l 0x409 /d "NDEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_MINSIZEREL BSC32=bscmake.exe @@ -157,13 +157,13 @@ CMAKE_CUSTOM_RULE_CODE_MINSIZEREL # PROP Target_Dir "" # ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c # ADD CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS +# ADD CPP BUILD_INCLUDES_RELWITHDEBINFO EXTRA_DEFINES OUTPUT_LIBNAME_EXPORTS # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_RELWITHDEBINFO # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC BUILD_INCLUDES_RELWITHDEBINFO /l 0x409 /d "NDEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_RELWITHDEBINFO BSC32=bscmake.exe diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in index 9e5303004..f4510bb55 100644 --- a/Templates/TestDriver.cxx.in +++ b/Templates/TestDriver.cxx.in @@ -64,7 +64,7 @@ int main(int ac, char *av[]) int testToRun = -1; @CMAKE_TESTDRIVER_ARGVC_FUNCTION@ - + for(count =0; cmakeGeneratedFunctionMapEntries[count].name != 0; count++) { } @@ -141,8 +141,8 @@ int main(int ac, char *av[]) @CMAKE_TESTDRIVER_AFTER_TESTMAIN@ return result; } - - + + /* Nothing was run, display the test names. */ printf("Available tests:\n"); for (i =0; i < NumTests; ++i) @@ -150,6 +150,6 @@ int main(int ac, char *av[]) printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name); } printf("Failed: %s is an invalid test name.\n", av[1]); - + return -1; } diff --git a/Templates/cygwin-package.sh.in b/Templates/cygwin-package.sh.in index 8482e7e4d..69b6c0f6f 100755 --- a/Templates/cygwin-package.sh.in +++ b/Templates/cygwin-package.sh.in @@ -10,11 +10,11 @@ TOP_DIR=`cd \`echo "$0" | sed -n '/\//{s/\/[^\/]*$//;p;}'\`;pwd` mkdirs() { ( - mkdir -p "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" + mkdir -p "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" ) } -# cd into +# cd into # untar source tree and apply patch prep() { @@ -31,7 +31,7 @@ prep() conf() { ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && + cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && cmake .. ) } @@ -60,8 +60,8 @@ pkg() { ( cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - cpack && - mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.tar.bz2 "$TOP_DIR" + cpack && + mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.tar.bz2 "$TOP_DIR" ) } @@ -71,7 +71,7 @@ spkg() ( cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && cpack --config CPackSourceConfig.cmake && - mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 "$TOP_DIR" + mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 "$TOP_DIR" ) } diff --git a/Templates/staticLibHeader.dsptemplate b/Templates/staticLibHeader.dsptemplate index 16b784e17..a8892e124 100644 --- a/Templates/staticLibHeader.dsptemplate +++ b/Templates/staticLibHeader.dsptemplate @@ -55,11 +55,11 @@ RSC=rc.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_LIB" /FD /c # ADD CPP /nologo /D "NDEBUG" /D "WIN32" /D "_LIB" /FD /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES +# ADD CPP BUILD_INCLUDES_RELEASE EXTRA_DEFINES # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_RELEASE # ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC BUILD_INCLUDES_RELEASE /l 0x409 /d "NDEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_RELEASE BSC32=bscmake.exe @@ -85,11 +85,11 @@ CMAKE_CUSTOM_RULE_CODE_RELEASE # PROP Target_Dir "" # ADD BASE CPP /nologo /D "WIN32" /D "_DEBUG" /D "_LIB" /FD /c # ADD CPP /nologo /D "_DEBUG" /D "WIN32" /D "_LIB" /FD /GZ /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES +# ADD CPP BUILD_INCLUDES_DEBUG EXTRA_DEFINES # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_DEBUG # ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "_DEBUG" +# ADD RSC BUILD_INCLUDES_DEBUG /l 0x409 /d "_DEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_DEBUG BSC32=bscmake.exe @@ -116,11 +116,11 @@ CMAKE_CUSTOM_RULE_CODE_DEBUG # PROP Target_Dir "" # ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_ATL_DLL" /FD /c # ADD CPP /nologo /D "NDEBUG" /D "_ATL_DLL" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /FD /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES +# ADD CPP BUILD_INCLUDES_MINSIZEREL EXTRA_DEFINES # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_MINSIZEREL # ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC BUILD_INCLUDES_MINSIZEREL /l 0x409 /d "NDEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_MINSIZEREL BSC32=bscmake.exe @@ -146,11 +146,11 @@ CMAKE_CUSTOM_RULE_CODE_MINSIZEREL # PROP Target_Dir "" # ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_LIB" /FD /c # ADD CPP /nologo /D "NDEBUG" /D "WIN32" /D "_LIB" /FD /c -# ADD CPP BUILD_INCLUDES EXTRA_DEFINES +# ADD CPP BUILD_INCLUDES_RELWITHDEBINFO EXTRA_DEFINES # ADD CPP CMAKE_CXX_FLAGS # ADD CPP CMAKE_CXX_FLAGS_RELWITHDEBINFO # ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC BUILD_INCLUDES /l 0x409 /d "NDEBUG" +# ADD RSC BUILD_INCLUDES_RELWITHDEBINFO /l 0x409 /d "NDEBUG" # ADD RSC COMPILE_DEFINITIONS # ADD RSC COMPILE_DEFINITIONS_RELWITHDEBINFO BSC32=bscmake.exe diff --git a/Tests/ArgumentExpansion/CMakeLists.txt b/Tests/ArgumentExpansion/CMakeLists.txt index a24636f58..173540067 100644 --- a/Tests/ArgumentExpansion/CMakeLists.txt +++ b/Tests/ArgumentExpansion/CMakeLists.txt @@ -8,7 +8,7 @@ function (argument_tester expected expected_len) if (NOT ${expected_received_len} EQUAL ${expected_len}) message(STATUS "Unexpected: Expanding expected values isn't working") - endif (NOT ${expected_received_len} EQUAL ${expected_len}) + endif () if (${argn_len} EQUAL ${expected_len}) set(i 0) @@ -23,13 +23,13 @@ function (argument_tester expected expected_len) endif () math(EXPR i "${i} + 1") - endwhile (i LESS ${argn_len}) - else (${argn_len} EQUAL ${expected_len}) + endwhile () + else () message(STATUS "Unexpected: Lengths of arguments don't match") message(STATUS " Expected: ${expected_len}") message(STATUS " Received: ${argn_len}") - endif (${argn_len} EQUAL ${expected_len}) -endfunction (argument_tester expected) + endif () +endfunction () set(empty_test) message(STATUS "Test: Empty arguments") diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt index 456e4961f..bb4bcccbe 100644 --- a/Tests/Assembler/CMakeLists.txt +++ b/Tests/Assembler/CMakeLists.txt @@ -7,10 +7,14 @@ set(SRCS) # (at least) the following toolchains can process assembler files directly # and also generate assembler files from C: -if("${CMAKE_GENERATOR}" MATCHES "Makefile") - if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX)) +if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode" AND + NOT CMAKE_OSX_ARCHITECTURES) + if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|Clang|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX)) set(C_FLAGS "${CMAKE_C_FLAGS}") separate_arguments(C_FLAGS) + if(CMAKE_OSX_SYSROOT AND CMAKE_C_SYSROOT_FLAG AND NOT ";${C_FLAGS};" MATCHES ";${CMAKE_C_SYSROOT_FLAG};") + list(APPEND C_FLAGS ${CMAKE_C_SYSROOT_FLAG} ${CMAKE_OSX_SYSROOT}) + endif() set(SRCS main.s) add_custom_command( OUTPUT main.s @@ -18,16 +22,16 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile") DEPENDS main.c VERBATIM ) - endif(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX)) -endif("${CMAKE_GENERATOR}" MATCHES "Makefile") + endif() +endif() if(SRCS) set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS}") enable_language(ASM OPTIONAL) -else(SRCS) +else() message(STATUS "No assembler enabled, using C") set(SRCS main.c) -endif(SRCS) +endif() add_executable(HelloAsm ${SRCS}) diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 5e36d11b4..27927512a 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -1,9 +1,9 @@ # this test creates a static library and an executable -# the source to the library is then changed +# the source to the library is then changed # and the build is done on the executable and if things # are working the executable should relink with the new # value. The subdir Project contains the CMakelists.txt -# and source files for the test project. +# and source files for the test project. cmake_minimum_required (VERSION 2.6) project(BuildDepends) @@ -15,7 +15,7 @@ set(CMAKE_SUPPRESS_REGENERATION 1) # Xcode needs some help with the fancy dependencies in this test. if("${CMAKE_GENERATOR}" MATCHES "Xcode") set(HELP_XCODE 1) -endif("${CMAKE_GENERATOR}" MATCHES "Xcode") +endif() function(help_xcode_depends) if(HELP_XCODE) file(GLOB_RECURSE MACRO_OBJS @@ -24,9 +24,9 @@ function(help_xcode_depends) if(MACRO_OBJS) message("Helping Xcode by removing objects [${MACRO_OBJS}]") file(REMOVE ${MACRO_OBJS}) - endif(MACRO_OBJS) - endif(HELP_XCODE) -endfunction(help_xcode_depends) + endif() + endif() +endfunction() if("${CMAKE_GENERATOR}" MATCHES "Ninja") set(HELP_NINJA 1) # TODO Why is this needed? @@ -48,7 +48,7 @@ list(APPEND _cmake_options "-DCMAKE_FORCE_DEPFILES=1") file(MAKE_DIRECTORY ${BuildDepends_BINARY_DIR}/Project) message("Creating Project/foo.cxx") -write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx +write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx "const char* foo() { return \"foo\";}" ) file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot.hxx.in @@ -60,49 +60,53 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_dir.hxx file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_tgt.hxx "static const char* zot_macro_tgt = \"zot_macro_tgt\";\n") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_lib.h + "#define link_depends_no_shared_lib_value 1\n") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_exe.h + "#define link_depends_no_shared_exe_value 0\n") +set(link_depends_no_shared_check_txt ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_check.txt) + help_xcode_depends() message("Building project first time") -try_compile(RESULT +try_compile(RESULT ${BuildDepends_BINARY_DIR}/Project ${BuildDepends_SOURCE_DIR}/Project testRebuild CMAKE_FLAGS ${_cmake_options} OUTPUT_VARIABLE OUTPUT) if(HELP_XCODE) - try_compile(RESULT + try_compile(RESULT ${BuildDepends_BINARY_DIR}/Project ${BuildDepends_SOURCE_DIR}/Project testRebuild OUTPUT_VARIABLE OUTPUT) - try_compile(RESULT + try_compile(RESULT ${BuildDepends_BINARY_DIR}/Project ${BuildDepends_SOURCE_DIR}/Project testRebuild OUTPUT_VARIABLE OUTPUT) -endif(HELP_XCODE) +endif() message("Output from first build:\n${OUTPUT}") if(NOT RESULT) message(SEND_ERROR "Could not build test project (1)!") -endif(NOT RESULT) +endif() set(bar ${BuildDepends_BINARY_DIR}/Project/bar${CMAKE_EXECUTABLE_SUFFIX}) -if(EXISTS +if(EXISTS "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}" ) message("found debug") - set(bar + set(bar "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}") -endif(EXISTS - "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}") +endif() set(zot ${BuildDepends_BINARY_DIR}/Project/zot${CMAKE_EXECUTABLE_SUFFIX}) -if(EXISTS +if(EXISTS "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}" ) message("found debug") - set(zot + set(zot "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}") -endif(EXISTS - "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}") +endif() message("Running ${bar} ") execute_process(COMMAND ${bar} OUTPUT_VARIABLE out RESULT_VARIABLE runResult) @@ -111,9 +115,9 @@ message("Run result: ${runResult} Output: \"${out}\"") if("${out}" STREQUAL "foo ") message("Worked!") -else("${out}" STREQUAL "foo ") +else() message(SEND_ERROR "Project did not initially build properly: ${out}") -endif("${out}" STREQUAL "foo ") +endif() message("Running ${zot} ") execute_process(COMMAND ${zot} OUTPUT_VARIABLE out RESULT_VARIABLE runResult) @@ -123,9 +127,22 @@ message("Run result: ${runResult} Output: \"${out}\"") set(VALUE_UNCHANGED "[zot] [zot_custom] [zot_macro_dir] [zot_macro_tgt] ") if("${out}" STREQUAL "${VALUE_UNCHANGED}") message("Worked!") -else("${out}" STREQUAL "${VALUE_UNCHANGED}") +else() message(SEND_ERROR "Project did not initially build properly: ${out}") -endif("${out}" STREQUAL "${VALUE_UNCHANGED}") +endif() + +if(EXISTS "${link_depends_no_shared_check_txt}") + file(STRINGS "${link_depends_no_shared_check_txt}" link_depends_no_shared_check LIMIT_COUNT 1) + if("${link_depends_no_shared_check}" STREQUAL "1") + message(STATUS "link_depends_no_shared_exe is newer than link_depends_no_shared_lib as expected.") + else() + message(SEND_ERROR "Project did not initially build properly: " + "link_depends_no_shared_exe is older than link_depends_no_shared_lib.") + endif() +else() + message(SEND_ERROR "Project did not initially build properly: " + "Targets link_depends_no_shared_lib and link_depends_no_shared_exe not both built.") +endif() message("Waiting 3 seconds...") # any additional argument will cause ${bar} to wait forever @@ -143,6 +160,9 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_dir.hxx file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_tgt.hxx "static const char* zot_macro_tgt = \"zot_macro_tgt changed\";\n") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_lib.h + "#define link_depends_no_shared_lib_value 0\n") + if(TEST_LINK_DEPENDS) file(WRITE ${TEST_LINK_DEPENDS} "2") endif() @@ -150,7 +170,7 @@ endif() help_xcode_depends() message("Building project second time") -try_compile(RESULT +try_compile(RESULT ${BuildDepends_BINARY_DIR}/Project ${BuildDepends_SOURCE_DIR}/Project testRebuild @@ -159,12 +179,12 @@ try_compile(RESULT # Xcode is in serious need of help here if(HELP_XCODE OR HELP_NINJA) - try_compile(RESULT + try_compile(RESULT ${BuildDepends_BINARY_DIR}/Project ${BuildDepends_SOURCE_DIR}/Project testRebuild OUTPUT_VARIABLE OUTPUT) - try_compile(RESULT + try_compile(RESULT ${BuildDepends_BINARY_DIR}/Project ${BuildDepends_SOURCE_DIR}/Project testRebuild @@ -174,17 +194,15 @@ endif() message("Output from second build:\n${OUTPUT}") if(NOT RESULT) message(SEND_ERROR "Could not build test project (2)!") -endif(NOT RESULT) -if(EXISTS +endif() +if(EXISTS "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}" ) message("found debug") -endif(EXISTS - "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}") -if(EXISTS +endif() +if(EXISTS "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}" ) message("found debug") -endif(EXISTS - "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}") +endif() message("Running ${bar} ") execute_process(COMMAND ${bar} OUTPUT_VARIABLE out RESULT_VARIABLE runResult) @@ -193,9 +211,9 @@ message("Run result: ${runResult} Output: \"${out}\"") if("${out}" STREQUAL "foo changed ") message("Worked!") -else("${out}" STREQUAL "foo changed ") +else() message(SEND_ERROR "Project did not rebuild properly!") -endif("${out}" STREQUAL "foo changed ") +endif() message("Running ${zot} ") execute_process(COMMAND ${zot} OUTPUT_VARIABLE out RESULT_VARIABLE runResult) @@ -207,9 +225,9 @@ set(VALUE_CHANGED ) if("${out}" STREQUAL "${VALUE_CHANGED}") message("Worked!") -else("${out}" STREQUAL "${VALUE_CHANGED}") +else() message(SEND_ERROR "Project did not rebuild properly!") -endif("${out}" STREQUAL "${VALUE_CHANGED}") +endif() if(TEST_LINK_DEPENDS) set(linkdep ${BuildDepends_BINARY_DIR}/Project/linkdep${CMAKE_EXECUTABLE_SUFFIX}) @@ -223,3 +241,15 @@ is not newer than dependency ") endif() endif() + +if(EXISTS "${link_depends_no_shared_check_txt}") + file(STRINGS "${link_depends_no_shared_check_txt}" link_depends_no_shared_check LIMIT_COUNT 1) + if("${link_depends_no_shared_check}" STREQUAL "0") + message(STATUS "link_depends_no_shared_exe is older than link_depends_no_shared_lib as expected.") + else() + message(SEND_ERROR "Project did not rebuild properly: link_depends_no_shared_exe is newer than link_depends_no_shared_lib.") + endif() +else() + message(SEND_ERROR "Project did not rebuild properly. " + "Targets link_depends_no_shared_lib and link_depends_no_shared_exe not both built.") +endif() diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index ed8b8bf5d..f8a3d1550 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -27,7 +27,7 @@ if(APPLE) set(CMAKE_OSX_ARCHITECTURES i386 x86_64) endif() endif() -endif(APPLE) +endif() add_library(foo STATIC ${testRebuild_BINARY_DIR}/foo.cxx) set_target_properties(foo PROPERTIES OUTPUT_NAME "foolib") @@ -60,16 +60,17 @@ add_executable(bar bar.cxx ) #----------------------------------------------------------------------------- -IF("${CMAKE_GENERATOR}" MATCHES "Make") +if("${CMAKE_GENERATOR}" MATCHES "Make") # Test the IMPLICIT_DEPENDS feature. - SET(ZOT_DEPENDS IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep.cxx) - SET(ZOT_CUSTOM_DEP - IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep_custom.cxx) -ELSE("${CMAKE_GENERATOR}" MATCHES "Make") + set(ZOT_DEPENDS IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep.cxx) + set(ZOT_CUSTOM_DEP + IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep_custom.cxx + CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep_custom2.cxx ) +else() # No IMPLICIT_DEPENDS...just depend directly. - SET(ZOT_DEPENDS DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zot.hxx.in) - SET(ZOT_CUSTOM_DEP DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zot_custom.hxx.in) -ENDIF("${CMAKE_GENERATOR}" MATCHES "Make") + set(ZOT_DEPENDS DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zot.hxx.in) + set(ZOT_CUSTOM_DEP DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zot_custom.hxx.in) +endif() add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zot.hxx COMMAND ${CMAKE_COMMAND} -E copy @@ -107,3 +108,18 @@ if(TEST_LINK_DEPENDS) add_executable(linkdep linkdep.cxx) set_property(TARGET linkdep PROPERTY LINK_DEPENDS ${TEST_LINK_DEPENDS}) endif() + +add_library(link_depends_no_shared_lib SHARED link_depends_no_shared_lib.c + ${CMAKE_CURRENT_BINARY_DIR}/link_depends_no_shared_lib.h) +add_executable(link_depends_no_shared_exe link_depends_no_shared_exe.c + ${CMAKE_CURRENT_BINARY_DIR}/link_depends_no_shared_exe.h) +target_link_libraries(link_depends_no_shared_exe link_depends_no_shared_lib) +set_property(TARGET link_depends_no_shared_exe PROPERTY LINK_DEPENDS_NO_SHARED 1) +add_custom_target(link_depends_no_shared_check ALL + COMMAND ${CMAKE_COMMAND} + -Dlib=$ + -Dexe=$ + -Dout=${CMAKE_CURRENT_BINARY_DIR}/link_depends_no_shared_check.txt + -P ${CMAKE_CURRENT_SOURCE_DIR}/link_depends_no_shared_check.cmake + ) +add_dependencies(link_depends_no_shared_check link_depends_no_shared_exe) diff --git a/Tests/BuildDepends/Project/dep_custom2.cxx b/Tests/BuildDepends/Project/dep_custom2.cxx new file mode 100644 index 000000000..ac9dee120 --- /dev/null +++ b/Tests/BuildDepends/Project/dep_custom2.cxx @@ -0,0 +1,2 @@ +#include +// some comment diff --git a/Tests/BuildDepends/Project/link_depends_no_shared_check.cmake b/Tests/BuildDepends/Project/link_depends_no_shared_check.cmake new file mode 100644 index 000000000..3a611370f --- /dev/null +++ b/Tests/BuildDepends/Project/link_depends_no_shared_check.cmake @@ -0,0 +1,7 @@ +if(NOT EXISTS "${lib}" OR NOT EXISTS "${exe}") + file(REMOVE "${out}") +elseif("${exe}" IS_NEWER_THAN "${lib}") + file(WRITE "${out}" "1\n") +else() + file(WRITE "${out}" "0\n") +endif() diff --git a/Tests/BuildDepends/Project/link_depends_no_shared_exe.c b/Tests/BuildDepends/Project/link_depends_no_shared_exe.c new file mode 100644 index 000000000..e9113a21d --- /dev/null +++ b/Tests/BuildDepends/Project/link_depends_no_shared_exe.c @@ -0,0 +1,9 @@ +#include "link_depends_no_shared_exe.h" +#ifdef _WIN32 +__declspec(dllimport) +#endif +int link_depends_no_shared_lib(void); +int main() +{ + return link_depends_no_shared_lib() + link_depends_no_shared_exe_value; +} diff --git a/Tests/BuildDepends/Project/link_depends_no_shared_lib.c b/Tests/BuildDepends/Project/link_depends_no_shared_lib.c new file mode 100644 index 000000000..d2262894b --- /dev/null +++ b/Tests/BuildDepends/Project/link_depends_no_shared_lib.c @@ -0,0 +1,8 @@ +#include "link_depends_no_shared_lib.h" +#ifdef _WIN32 +__declspec(dllexport) +#endif +int link_depends_no_shared_lib(void) +{ + return link_depends_no_shared_lib_value; +} diff --git a/Tests/BundleGeneratorTest/CMakeLists.txt b/Tests/BundleGeneratorTest/CMakeLists.txt index e1fc2c1d4..037df09c1 100644 --- a/Tests/BundleGeneratorTest/CMakeLists.txt +++ b/Tests/BundleGeneratorTest/CMakeLists.txt @@ -1,23 +1,23 @@ -PROJECT(BundleGeneratorTest) +project(BundleGeneratorTest) -CMAKE_MINIMUM_REQUIRED(VERSION 2.7) +cmake_minimum_required(VERSION 2.7) # Build a shared library and install it in lib/ -ADD_LIBRARY(Library SHARED Library.cxx) -INSTALL(TARGETS Library DESTINATION lib) +add_library(Library SHARED Library.cxx) +install(TARGETS Library DESTINATION lib) # Build an executable and install it in bin/ -ADD_EXECUTABLE(Executable Executable.cxx) -TARGET_LINK_LIBRARIES(Executable Library) -INSTALL(TARGETS Executable DESTINATION bin) +add_executable(Executable Executable.cxx) +target_link_libraries(Executable Library) +install(TARGETS Executable DESTINATION bin) # Use the bundle-generator for packaging ... -SET(CPACK_GENERATOR "Bundle") -SET(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/BundleIcon.icns") -SET(CPACK_BUNDLE_NAME "BundleGeneratorTest") -SET(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist") -SET(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/StartupCommand") -SET(CPACK_PACKAGE_DESCRIPTION "Project for testing OSX bundle generation") +set(CPACK_GENERATOR "Bundle") +set(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/BundleIcon.icns") +set(CPACK_BUNDLE_NAME "BundleGeneratorTest") +set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist") +set(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/StartupCommand") +set(CPACK_PACKAGE_DESCRIPTION "Project for testing OSX bundle generation") # The custom volume icon is a copy of the normal Mac OSX volume icon, but # on a white background. This is to differentiate it from the normal one @@ -25,9 +25,9 @@ SET(CPACK_PACKAGE_DESCRIPTION "Project for testing OSX bundle generation") # visual inspection of the mounted volume... This was added when fixing # issue #7523... # -SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/CustomVolumeIcon.icns") +set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/CustomVolumeIcon.icns") -SET(CPACK_PACKAGE_NAME "BundleGeneratorTest") -SET(CPACK_PACKAGE_VERSION "0.1") +set(CPACK_PACKAGE_NAME "BundleGeneratorTest") +set(CPACK_PACKAGE_VERSION "0.1") -INCLUDE(CPack) +include(CPack) diff --git a/Tests/BundleTest/BundleSubDir/CMakeLists.txt b/Tests/BundleTest/BundleSubDir/CMakeLists.txt index 322b2a7d2..1921ce095 100644 --- a/Tests/BundleTest/BundleSubDir/CMakeLists.txt +++ b/Tests/BundleTest/BundleSubDir/CMakeLists.txt @@ -1,36 +1,36 @@ -ADD_CUSTOM_COMMAND( +add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist" COMMAND /bin/cp ARGS "${BundleTest_SOURCE_DIR}/randomResourceFile.plist.in" "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist") -SET_SOURCE_FILES_PROPERTIES( +set_source_files_properties( "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist" PROPERTIES MACOSX_PACKAGE_LOCATION Resources ) -SET_SOURCE_FILES_PROPERTIES( +set_source_files_properties( "${BundleTest_SOURCE_DIR}/SomeRandomFile.txt" "${BundleTest_SOURCE_DIR}/../../ChangeLog.txt" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS ) -ADD_EXECUTABLE(SecondBundle +add_executable(SecondBundle MACOSX_BUNDLE "${BundleTest_SOURCE_DIR}/BundleTest.cxx" "${BundleTest_SOURCE_DIR}/SomeRandomFile.txt" "${BundleTest_SOURCE_DIR}/../../ChangeLog.txt" "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist" ) -TARGET_LINK_LIBRARIES(SecondBundle BundleTestLib) +target_link_libraries(SecondBundle BundleTestLib) # Test bundle installation. -INSTALL(TARGETS SecondBundle DESTINATION Applications) +install(TARGETS SecondBundle DESTINATION Applications) # Test whether bundles respect the output name. Since the library is # installed into a location that uses this output name this will fail if the # bundle does not respect the name. Also the executable will not be found by # the test driver if this does not work. -SET_TARGET_PROPERTIES(SecondBundle PROPERTIES OUTPUT_NAME SecondBundleExe) +set_target_properties(SecondBundle PROPERTIES OUTPUT_NAME SecondBundleExe) diff --git a/Tests/BundleTest/CMakeLists.txt b/Tests/BundleTest/CMakeLists.txt index 5342f49bd..de69d7555 100644 --- a/Tests/BundleTest/CMakeLists.txt +++ b/Tests/BundleTest/CMakeLists.txt @@ -1,28 +1,28 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(BundleTest) -SET(MACOSX_BUNDLE_INFO_STRING "bundle_info_string") -SET(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different ") +project(BundleTest) +set(MACOSX_BUNDLE_INFO_STRING "bundle_info_string") +set(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different ") -ADD_CUSTOM_COMMAND( +add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist" COMMAND /bin/cp ARGS "${CMAKE_CURRENT_SOURCE_DIR}/randomResourceFile.plist.in" "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist") -SET_SOURCE_FILES_PROPERTIES( +set_source_files_properties( "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist" PROPERTIES MACOSX_PACKAGE_LOCATION Resources ) -SET_SOURCE_FILES_PROPERTIES( +set_source_files_properties( SomeRandomFile.txt "${BundleTest_SOURCE_DIR}/../../ChangeLog.txt" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS ) -SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/foobar") +set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/foobar") # Test building a bundle linking to a shared library where the # shared library links to CoreFoundation, but the executable does not @@ -31,74 +31,74 @@ SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/foobar") # if CMake's dependency chaining for libraries with "-framework # blah" style dependencies gets broken... # -ADD_LIBRARY(BundleTestLib SHARED BundleLib.cxx) -TARGET_LINK_LIBRARIES(BundleTestLib "-framework CoreFoundation") +add_library(BundleTestLib SHARED BundleLib.cxx) +target_link_libraries(BundleTestLib "-framework CoreFoundation") -ADD_EXECUTABLE(BundleTest +add_executable(BundleTest MACOSX_BUNDLE BundleTest.cxx SomeRandomFile.txt "${BundleTest_SOURCE_DIR}/../../ChangeLog.txt" "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist" ) -TARGET_LINK_LIBRARIES(BundleTest BundleTestLib) +target_link_libraries(BundleTest BundleTestLib) # -# DO NOT: TARGET_LINK_LIBRARIES(BundleTest "-framework CoreFoundation") +# DO NOT: target_link_libraries(BundleTest "-framework CoreFoundation") # (see above comments about CoreFoundation) # # Test bundle installation. -#INSTALL(TARGETS BundleTestLib DESTINATION Applications/BundleTestExe.app/Contents/Plugins) -INSTALL(TARGETS BundleTestLib DESTINATION Applications/SecondBundleExe.app/Contents/Plugins) -INSTALL(TARGETS BundleTest DESTINATION Applications) +#install(TARGETS BundleTestLib DESTINATION Applications/BundleTestExe.app/Contents/Plugins) +install(TARGETS BundleTestLib DESTINATION Applications/SecondBundleExe.app/Contents/Plugins) +install(TARGETS BundleTest DESTINATION Applications) # Test whether bundles respect the output name. Since the library is # installed into a location that uses this output name this will fail if the # bundle does not respect the name. Also the executable will not be found by # the test driver if this does not work. -SET_TARGET_PROPERTIES(BundleTest PROPERTIES OUTPUT_NAME BundleTestExe) +set_target_properties(BundleTest PROPERTIES OUTPUT_NAME BundleTestExe) # Test executable versioning if it is supported. -IF(NOT XCODE) - SET_TARGET_PROPERTIES(BundleTest PROPERTIES VERSION 1) -ENDIF(NOT XCODE) +if(NOT XCODE) + set_target_properties(BundleTest PROPERTIES VERSION 1) +endif() # Make sure the executable can find its installed library. -SET_TARGET_PROPERTIES(BundleTestLib PROPERTIES +set_target_properties(BundleTestLib PROPERTIES INSTALL_NAME_DIR "@executable_path/../Plugins") -INCLUDE(CPack) +include(CPack) # test the framework find stuff -IF(EXISTS /usr/lib/libtcl.dylib +if(EXISTS /usr/lib/libtcl.dylib AND EXISTS /System/Library/Frameworks/Tcl.framework) - SET(TCL NOTFOUND) - FIND_LIBRARY(TCL tcl) - MESSAGE("frame: ${TCL}") - IF(NOT "${TCL}" MATCHES .framework) - MESSAGE(FATAL_ERROR "Could not find tcl framework, found ${TCL}") - ENDIF(NOT "${TCL}" MATCHES .framework) - SET(TCL NOTFOUND) - SET(CMAKE_FIND_FRAMEWORK LAST) - FIND_LIBRARY(TCL tcl) - IF("${TCL}" MATCHES .framework) - MESSAGE(FATAL_ERROR "Found framework and should have found dylib ${TCL}") - ENDIF("${TCL}" MATCHES .framework) - SET(TCL NOTFOUND) - SET(CMAKE_FIND_FRAMEWORK NEVER) - FIND_LIBRARY(TCL tcl) - IF("${TCL}" MATCHES .framework) - MESSAGE(FATAL_ERROR "Found framework and should have found dylib ${TCL}") - ENDIF("${TCL}" MATCHES .framework) - MESSAGE("not frame: ${TCL}") - SET(TCL NOTFOUND) - SET(CMAKE_FIND_FRAMEWORK FIRST) - FIND_LIBRARY(TCL tcl) - IF(NOT "${TCL}" MATCHES .framework) - MESSAGE(FATAL_ERROR "Could not find tcl framework, found ${TCL}") - ENDIF(NOT "${TCL}" MATCHES .framework) - MESSAGE("frame: ${TCL}") -ENDIF(EXISTS /usr/lib/libtcl.dylib + set(TCL NOTFOUND) + find_library(TCL tcl) + message("frame: ${TCL}") + if(NOT "${TCL}" MATCHES .framework) + message(FATAL_ERROR "Could not find tcl framework, found ${TCL}") + endif() + set(TCL NOTFOUND) + set(CMAKE_FIND_FRAMEWORK LAST) + find_library(TCL tcl) + if("${TCL}" MATCHES .framework) + message(FATAL_ERROR "Found framework and should have found dylib ${TCL}") + endif() + set(TCL NOTFOUND) + set(CMAKE_FIND_FRAMEWORK NEVER) + find_library(TCL tcl) + if("${TCL}" MATCHES .framework) + message(FATAL_ERROR "Found framework and should have found dylib ${TCL}") + endif() + message("not frame: ${TCL}") + set(TCL NOTFOUND) + set(CMAKE_FIND_FRAMEWORK FIRST) + find_library(TCL tcl) + if(NOT "${TCL}" MATCHES .framework) + message(FATAL_ERROR "Could not find tcl framework, found ${TCL}") + endif() + message("frame: ${TCL}") +endif(EXISTS /usr/lib/libtcl.dylib AND EXISTS /System/Library/Frameworks/Tcl.framework) -SUBDIRS(BundleSubDir) +subdirs(BundleSubDir) diff --git a/Tests/BundleUtilities/bundleutils.cmake b/Tests/BundleUtilities/bundleutils.cmake index 46765e733..cc89347ad 100644 --- a/Tests/BundleUtilities/bundleutils.cmake +++ b/Tests/BundleUtilities/bundleutils.cmake @@ -31,7 +31,7 @@ configure_file("${MODULE}" "${OUTPUT_MODULE}" COPYONLY) # this shouldn't be necessary except for the non-bundle case on Mac function(gp_item_default_embedded_path_override item path) set(path "@executable_path" PARENT_SCOPE) -endfunction(gp_item_default_embedded_path_override) +endfunction() include(BundleUtilities) fixup_bundle("${OUTPUT}" "${OUTPUT_MODULE}" "${INPUTDIR}") @@ -42,4 +42,4 @@ execute_process(COMMAND "${OUTPUT}" RESULT_VARIABLE result OUTPUT_VARIABLE out E if(NOT result STREQUAL "0") message(FATAL_ERROR " failed to execute test program\n${out}") -endif(NOT result STREQUAL "0") +endif() diff --git a/Tests/CMakeBuildTest.cmake.in b/Tests/CMakeBuildTest.cmake.in index a8bb75090..0f7074b2f 100644 --- a/Tests/CMakeBuildTest.cmake.in +++ b/Tests/CMakeBuildTest.cmake.in @@ -7,53 +7,54 @@ make_directory("@CMAKE_BUILD_TEST_BINARY_DIR@") message("Remove: @CMAKE_BUILD_TEST_SOURCE_DIR@/CMakeCache.txt") file(REMOVE "@CMAKE_BUILD_TEST_SOURCE_DIR@/CMakeCache.txt") -# run cmake in the binary directory +# run cmake in the binary directory message("running: ${CMAKE_COMMAND}") execute_process(COMMAND "${CMAKE_COMMAND}" - "@CMAKE_BUILD_TEST_SOURCE_DIR@" + "@CMAKE_BUILD_TEST_SOURCE_DIR@" "-G@CMAKE_TEST_GENERATOR@" + -T "@CMAKE_TEST_GENERATOR_TOOLSET@" WORKING_DIRECTORY "@CMAKE_BUILD_TEST_BINARY_DIR@" RESULT_VARIABLE RESULT) if(RESULT) message(FATAL_ERROR "Error running cmake command") -endif(RESULT) +endif() # Now use the --build option to build the project message("running: ${CMAKE_COMMAND} --build") -execute_process(COMMAND "${CMAKE_COMMAND}" +execute_process(COMMAND "${CMAKE_COMMAND}" --build "@CMAKE_BUILD_TEST_BINARY_DIR@" --config Debug RESULT_VARIABLE RESULT) if(RESULT) message(FATAL_ERROR "Error running cmake --build") -endif(RESULT) +endif() # check for configuration types set(CMAKE_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@) -# run the executable out of the Debug directory if there +# run the executable out of the Debug directory if there # are configuration types if(CMAKE_CONFIGURATION_TYPES) set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/Debug/@CMAKE_BUILD_TEST_EXE@") -else(CMAKE_CONFIGURATION_TYPES) +else() set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/@CMAKE_BUILD_TEST_EXE@") -endif(CMAKE_CONFIGURATION_TYPES) +endif() # run the test results message("running [${RUN_TEST}]") execute_process(COMMAND "${RUN_TEST}" RESULT_VARIABLE RESULT) if(RESULT) message(FATAL_ERROR "Error running test @CMAKE_BUILD_TEST_EXE@") -endif(RESULT) +endif() # build it again with clean and only @CMAKE_BUILD_TEST_EXE@ target -execute_process(COMMAND "${CMAKE_COMMAND}" - --build "@CMAKE_BUILD_TEST_BINARY_DIR@" --config Debug +execute_process(COMMAND "${CMAKE_COMMAND}" + --build "@CMAKE_BUILD_TEST_BINARY_DIR@" --config Debug --clean-first --target @CMAKE_BUILD_TEST_EXE@ RESULT_VARIABLE RESULT) if(RESULT) message(FATAL_ERROR "Error running cmake --build") -endif(RESULT) +endif() -# run it again after clean +# run it again after clean execute_process(COMMAND "${RUN_TEST}" RESULT_VARIABLE RESULT) if(RESULT) message(FATAL_ERROR "Error running test @CMAKE_BUILD_TEST_EXE@ after clean ") -endif(RESULT) +endif() diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt new file mode 100644 index 000000000..6d0e64615 --- /dev/null +++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt @@ -0,0 +1,22 @@ + +cmake_minimum_required(VERSION 2.8) + +project(target_compile_definitions) + +add_executable(target_compile_definitions + "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp" +) +target_compile_definitions(target_compile_definitions + PRIVATE MY_PRIVATE_DEFINE + PUBLIC MY_PUBLIC_DEFINE + INTERFACE MY_INTERFACE_DEFINE +) + +add_executable(consumer + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" +) + +target_compile_definitions(consumer + PRIVATE $ + -DDASH_D_DEFINE +) diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp new file mode 100644 index 000000000..a39111416 --- /dev/null +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp @@ -0,0 +1,18 @@ + +#ifdef MY_PRIVATE_DEFINE +#error Unexpected MY_PRIVATE_DEFINE +#endif + +#ifndef MY_PUBLIC_DEFINE +#error Expected MY_PUBLIC_DEFINE +#endif + +#ifndef MY_INTERFACE_DEFINE +#error Expected MY_INTERFACE_DEFINE +#endif + +#ifndef DASH_D_DEFINE +#error Expected DASH_D_DEFINE +#endif + +int main() { return 0; } diff --git a/Tests/CMakeCommands/target_compile_definitions/main.cpp b/Tests/CMakeCommands/target_compile_definitions/main.cpp new file mode 100644 index 000000000..addb33cf9 --- /dev/null +++ b/Tests/CMakeCommands/target_compile_definitions/main.cpp @@ -0,0 +1,14 @@ + +#ifndef MY_PRIVATE_DEFINE +#error Expected MY_PRIVATE_DEFINE +#endif + +#ifndef MY_PUBLIC_DEFINE +#error Expected MY_PUBLIC_DEFINE +#endif + +#ifdef MY_INTERFACE_DEFINE +#error Unexpected MY_INTERFACE_DEFINE +#endif + +int main() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt new file mode 100644 index 000000000..c03f0f84b --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt @@ -0,0 +1,49 @@ +cmake_minimum_required(VERSION 2.8) + +project(target_include_directories) + +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/privateinclude") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/privateinclude/privateinclude.h" "#define PRIVATEINCLUDE_DEFINE\n") + +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/publicinclude") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/publicinclude/publicinclude.h" "#define PUBLICINCLUDE_DEFINE\n") + +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/interfaceinclude") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/interfaceinclude/interfaceinclude.h" "#define INTERFACEINCLUDE_DEFINE\n") + +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/poison") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/poison/common.h" "#error Should not be included\n") + +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cure") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cure/common.h" "#define CURE_DEFINE\n") + +add_executable(target_include_directories + "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp" +) +target_include_directories(target_include_directories + PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/privateinclude" + PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/publicinclude" + INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/interfaceinclude" +) + +target_include_directories(target_include_directories + PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/poison" +) +target_include_directories(target_include_directories + BEFORE PUBLIC "$<$,EXECUTABLE>:${CMAKE_CURRENT_BINARY_DIR}/cure>" +) + +# Has no effect because the target type is not SHARED_LIBRARY: +target_include_directories(target_include_directories + BEFORE PUBLIC "$<$,SHARED_LIBRARY>:${CMAKE_CURRENT_BINARY_DIR}/poison>" +) + +add_executable(consumer + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" +) + +target_include_directories(consumer + PRIVATE + $ + relative_dir +) diff --git a/Tests/CMakeCommands/target_include_directories/consumer.cpp b/Tests/CMakeCommands/target_include_directories/consumer.cpp new file mode 100644 index 000000000..82b800a40 --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/consumer.cpp @@ -0,0 +1,27 @@ + +#include "common.h" +#include "publicinclude.h" +#include "interfaceinclude.h" +#include "relative_dir.h" + +#ifdef PRIVATEINCLUDE_DEFINE +#error Unexpected PRIVATEINCLUDE_DEFINE +#endif + +#ifndef PUBLICINCLUDE_DEFINE +#error Expected PUBLICINCLUDE_DEFINE +#endif + +#ifndef INTERFACEINCLUDE_DEFINE +#error Expected INTERFACEINCLUDE_DEFINE +#endif + +#ifndef CURE_DEFINE +#error Expected CURE_DEFINE +#endif + +#ifndef RELATIVE_DIR_DEFINE +#error Expected RELATIVE_DIR_DEFINE +#endif + +int main() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/main.cpp b/Tests/CMakeCommands/target_include_directories/main.cpp new file mode 100644 index 000000000..8434b97d8 --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/main.cpp @@ -0,0 +1,22 @@ + +#include "common.h" +#include "privateinclude.h" +#include "publicinclude.h" + +#ifndef PRIVATEINCLUDE_DEFINE +#error Expected PRIVATEINCLUDE_DEFINE +#endif + +#ifndef PUBLICINCLUDE_DEFINE +#error Expected PUBLICINCLUDE_DEFINE +#endif + +#ifdef INTERFACEINCLUDE_DEFINE +#error Unexpected INTERFACEINCLUDE_DEFINE +#endif + +#ifndef CURE_DEFINE +#error Expected CURE_DEFINE +#endif + +int main() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/relative_dir/relative_dir.h b/Tests/CMakeCommands/target_include_directories/relative_dir/relative_dir.h new file mode 100644 index 000000000..7017b61a8 --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/relative_dir/relative_dir.h @@ -0,0 +1,2 @@ + +#define RELATIVE_DIR_DEFINE diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt index 1faa88848..388164455 100644 --- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt @@ -34,6 +34,13 @@ generate_export_header(depB) target_link_libraries(depB LINK_PRIVATE depA) +add_library(libgenex SHARED libgenex.cpp) +generate_export_header(libgenex) + +set_property(TARGET depB APPEND PROPERTY + LINK_LIBRARIES $<1:libgenex> +) + add_library(depC SHARED depC.cpp) generate_export_header(depC) @@ -53,6 +60,57 @@ set_target_properties(targetA PROPERTIES LINK_INTERFACE_LIBRARIES "") assert_property(targetA LINK_INTERFACE_LIBRARIES "") +add_subdirectory(subdir) +target_link_libraries(targetA subdirlib) + target_link_libraries(targetA depB depC) assert_property(targetA LINK_INTERFACE_LIBRARIES "") + +# Exclude depIfaceOnly from ALL so that it will only be built if something +# depends on it. As it is in the link interface of depB, targetA +# will depend on it. That dependency is what is being tested here. +add_library(depIfaceOnly SHARED EXCLUDE_FROM_ALL depIfaceOnly.cpp) +generate_export_header(depIfaceOnly) +set_property(TARGET depB APPEND PROPERTY LINK_INTERFACE_LIBRARIES depIfaceOnly) + +add_library(depD SHARED depD.cpp) +generate_export_header(depD) +set_property(TARGET depD APPEND PROPERTY + LINK_INTERFACE_LIBRARIES + $<$,EXECUTABLE>:depA> +) + +add_executable(targetB targetB.cpp) +target_link_libraries(targetB depD) + +macro(create_header _name) + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_name}") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_name}/${_name}.h" "//${_name}.h\n") +endmacro() + +create_header(foo) +create_header(bar) + +add_library(depG SHARED depG.cpp) +generate_export_header(depG) +target_include_directories(depG INTERFACE + "${CMAKE_CURRENT_BINARY_DIR}/foo" + "${CMAKE_CURRENT_BINARY_DIR}/bar" +) +target_compile_definitions(depG INTERFACE + TEST_DEF +) + + +add_executable(targetC targetC.cpp) +if(NOT BORLAND AND NOT WATCOM) + # Linking to a target containing a + should be non-fatal, though it does + # not work at all on Borland or watcom + add_library(wrapc++ empty.cpp) + target_link_libraries(targetC wrapc++) +endif() +# The TARGET_PROPERTY expression is duplicated below to test that there is no +# shortcutting of the evaluation by returning an empty string. +set(_exe_test $,EXECUTABLE>) +target_link_libraries(targetC $<$:depG>) diff --git a/Tests/CMakeCommands/target_link_libraries/depB.cpp b/Tests/CMakeCommands/target_link_libraries/depB.cpp index 97e5be274..4f46552d7 100644 --- a/Tests/CMakeCommands/target_link_libraries/depB.cpp +++ b/Tests/CMakeCommands/target_link_libraries/depB.cpp @@ -3,9 +3,13 @@ #include "depA.h" +#include "libgenex.h" + int DepB::foo() { DepA a; - return 0; + LibGenex lg; + + return a.foo() + lg.foo(); } diff --git a/Tests/CMakeCommands/target_link_libraries/depD.cpp b/Tests/CMakeCommands/target_link_libraries/depD.cpp new file mode 100644 index 000000000..b02c76cf3 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/depD.cpp @@ -0,0 +1,13 @@ + +#include "depD.h" + +int DepD::foo() +{ + return 0; +} + +DepA DepD::getA() +{ + DepA a; + return a; +} diff --git a/Tests/CMakeCommands/target_link_libraries/depD.h b/Tests/CMakeCommands/target_link_libraries/depD.h new file mode 100644 index 000000000..d24ff5f7c --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/depD.h @@ -0,0 +1,11 @@ + +#include "depd_export.h" + +#include "depA.h" + +struct DEPD_EXPORT DepD +{ + int foo(); + + DepA getA(); +}; diff --git a/Tests/CMakeCommands/target_link_libraries/depG.cpp b/Tests/CMakeCommands/target_link_libraries/depG.cpp new file mode 100644 index 000000000..65b9655c5 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/depG.cpp @@ -0,0 +1,7 @@ + +#include "depG.h" + +int DepG::foo() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_link_libraries/depG.h b/Tests/CMakeCommands/target_link_libraries/depG.h new file mode 100644 index 000000000..1a3658914 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/depG.h @@ -0,0 +1,7 @@ + +#include "depg_export.h" + +struct DEPG_EXPORT DepG +{ + int foo(); +}; diff --git a/Tests/CMakeCommands/target_link_libraries/depIfaceOnly.cpp b/Tests/CMakeCommands/target_link_libraries/depIfaceOnly.cpp new file mode 100644 index 000000000..3b90af008 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/depIfaceOnly.cpp @@ -0,0 +1,7 @@ + +#include "depIfaceOnly.h" + +int DepIfaceOnly::foo() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_link_libraries/depIfaceOnly.h b/Tests/CMakeCommands/target_link_libraries/depIfaceOnly.h new file mode 100644 index 000000000..dddf6a5e4 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/depIfaceOnly.h @@ -0,0 +1,7 @@ + +#include "depifaceonly_export.h" + +struct DEPIFACEONLY_EXPORT DepIfaceOnly +{ + int foo(); +}; diff --git a/Tests/CMakeCommands/target_link_libraries/empty.cpp b/Tests/CMakeCommands/target_link_libraries/empty.cpp new file mode 100644 index 000000000..ab32cf6c8 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/empty.cpp @@ -0,0 +1 @@ +// No content diff --git a/Tests/CMakeCommands/target_link_libraries/libgenex.cpp b/Tests/CMakeCommands/target_link_libraries/libgenex.cpp new file mode 100644 index 000000000..c925c0821 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/libgenex.cpp @@ -0,0 +1,7 @@ + +#include "libgenex.h" + +int LibGenex::foo() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_link_libraries/libgenex.h b/Tests/CMakeCommands/target_link_libraries/libgenex.h new file mode 100644 index 000000000..733f9b6df --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/libgenex.h @@ -0,0 +1,12 @@ + +#include "libgenex_export.h" + +#ifndef LIBGENEX_H +#define LIBGENEX_H + +struct LIBGENEX_EXPORT LibGenex +{ + int foo(); +}; + +#endif diff --git a/Tests/CMakeCommands/target_link_libraries/subdir/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/subdir/CMakeLists.txt new file mode 100644 index 000000000..61a1a5988 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/subdir/CMakeLists.txt @@ -0,0 +1,5 @@ + +set(CMAKE_BUILD_INTERFACE_INCLUDES ON) + +add_library(subdirlib SHARED subdirlib.cpp) +generate_export_header(subdirlib) diff --git a/Tests/CMakeCommands/target_link_libraries/subdir/subdirlib.cpp b/Tests/CMakeCommands/target_link_libraries/subdir/subdirlib.cpp new file mode 100644 index 000000000..cd2f1a23a --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/subdir/subdirlib.cpp @@ -0,0 +1,7 @@ + +#include "subdirlib.h" + +int SubDirLibObject::foo() const +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_link_libraries/subdir/subdirlib.h b/Tests/CMakeCommands/target_link_libraries/subdir/subdirlib.h new file mode 100644 index 000000000..e386f87b2 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/subdir/subdirlib.h @@ -0,0 +1,12 @@ + +#ifndef SUBDIRLIB_H +#define SUBDIRLIB_H + +#include "subdirlib_export.h" + +struct SUBDIRLIB_EXPORT SubDirLibObject +{ + int foo() const; +}; + +#endif diff --git a/Tests/CMakeCommands/target_link_libraries/targetA.cpp b/Tests/CMakeCommands/target_link_libraries/targetA.cpp index 3c6472e9a..d1321a15f 100644 --- a/Tests/CMakeCommands/target_link_libraries/targetA.cpp +++ b/Tests/CMakeCommands/target_link_libraries/targetA.cpp @@ -1,12 +1,19 @@ #include "depB.h" #include "depC.h" +#include "depIfaceOnly.h" -int main(int argc, char **argv) +#include "subdirlib.h" + +int main(int, char **) { DepA a; DepB b; DepC c; - return a.foo() + b.foo() + c.foo(); + DepIfaceOnly iface_only; + + SubDirLibObject sd; + + return a.foo() + b.foo() + c.foo() + iface_only.foo() + sd.foo(); } diff --git a/Tests/CMakeCommands/target_link_libraries/targetB.cpp b/Tests/CMakeCommands/target_link_libraries/targetB.cpp new file mode 100644 index 000000000..0913a57b0 --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/targetB.cpp @@ -0,0 +1,10 @@ + +#include "depD.h" + +int main(int, char **) +{ + DepD d; + DepA a = d.getA(); + + return d.foo() + a.foo(); +} diff --git a/Tests/CMakeCommands/target_link_libraries/targetC.cpp b/Tests/CMakeCommands/target_link_libraries/targetC.cpp new file mode 100644 index 000000000..a4ef6369d --- /dev/null +++ b/Tests/CMakeCommands/target_link_libraries/targetC.cpp @@ -0,0 +1,16 @@ + +#include "depG.h" + +#include "foo.h" +#include "bar.h" + +#ifndef TEST_DEF +#error Expected TEST_DEF definition +#endif + +int main(int, char **) +{ + DepG g; + + return g.foo(); +} diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 27ae3a072..e07bb69db 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1,81 +1,107 @@ # a macro for tests that have a simple format where the name matches the # directory and project -MACRO(ADD_TEST_MACRO NAME COMMAND) - STRING(REPLACE "." "/" dir "${NAME}") - STRING(REGEX REPLACE "[^.]*\\." "" proj "${NAME}") - ADD_TEST(${NAME} ${CMAKE_CTEST_COMMAND} +macro(ADD_TEST_MACRO NAME COMMAND) + string(REPLACE "." "/" dir "${NAME}") + string(REGEX REPLACE "[^.]*\\." "" proj "${NAME}") + add_test(${NAME} ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/${dir}" "${CMake_BINARY_DIR}/Tests/${dir}" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project ${proj} ${${NAME}_EXTRA_OPTIONS} --test-command ${COMMAND} ${ARGN}) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}") -ENDMACRO(ADD_TEST_MACRO) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}") +endmacro() -MACRO(REGEX_ESCAPE_STRING _OUT _IN) +macro(REGEX_ESCAPE_STRING _OUT _IN) # Escape special regex metacharacters with a backslash string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" ${_OUT} "${_IN}") -ENDMACRO(REGEX_ESCAPE_STRING _OUT _IN) +endmacro() -INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake) # Fake a user home directory to avoid polluting the real one. -IF(DEFINED ENV{HOME} AND NOT CTEST_NO_TEST_HOME) - SET(TEST_HOME "${CMake_BINARY_DIR}/Tests/CMakeFiles/TestHome") - FILE(MAKE_DIRECTORY "${TEST_HOME}") - FILE(WRITE "${TEST_HOME}/.cvspass" ":pserver:anoncvs@www.cmake.org:/cvsroot/KWSys A\n") - SET(TEST_HOME_ENV_CODE "# Fake a user home directory to avoid polluting the real one. +if(DEFINED ENV{HOME} AND NOT CTEST_NO_TEST_HOME) + set(TEST_HOME "${CMake_BINARY_DIR}/Tests/CMakeFiles/TestHome") + file(MAKE_DIRECTORY "${TEST_HOME}") + file(WRITE "${TEST_HOME}/.cvspass" ":pserver:anoncvs@www.cmake.org:/cvsroot/KWSys A\n") + set(TEST_HOME_ENV_CODE "# Fake a user home directory to avoid polluting the real one. # But provide original ENV{HOME} value in ENV{CTEST_REAL_HOME} for tests that # need access to the real HOME directory. -SET(ENV{CTEST_REAL_HOME} \"\$ENV{HOME}\") -SET(ENV{HOME} \"${TEST_HOME}\") +set(ENV{CTEST_REAL_HOME} \"\$ENV{HOME}\") +set(ENV{HOME} \"${TEST_HOME}\") ") -ENDIF() +endif() # Choose a default configuration for CTest tests. -SET(CTestTest_CONFIG Debug) -IF(NOT CMAKE_CONFIGURATION_TYPES AND CMAKE_BUILD_TYPE) - SET(CTestTest_CONFIG ${CMAKE_BUILD_TYPE}) -ENDIF() +set(CTestTest_CONFIG Debug) +if(NOT CMAKE_CONFIGURATION_TYPES AND CMAKE_BUILD_TYPE) + set(CTestTest_CONFIG ${CMAKE_BUILD_TYPE}) +endif() -CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in +configure_file(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in ${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake @ONLY) # Testing -IF(BUILD_TESTING) - IF("${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_TEST_GENERATOR}" MATCHES Ninja AND NOT WIN32)) - SET(TEST_CompileCommandOutput 1) - ENDIF() +if(BUILD_TESTING) + if("${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_TEST_GENERATOR}" MATCHES Ninja AND NOT WIN32)) + set(TEST_CompileCommandOutput 1) + endif() + + set(MAKE_IS_GNU ) + if(${CMAKE_TEST_MAKEPROGRAM} MATCHES make) + execute_process(COMMAND ${CMAKE_TEST_MAKEPROGRAM} no_such_target --version + RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out) + if("${res}" STREQUAL "0") + if("${out}" MATCHES "GNU") + set(MAKE_IS_GNU 1) + endif() + endif() + endif() + + # some old versions of make simply cannot handle spaces in paths + if (MAKE_IS_GNU OR + "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR + "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland") + set(MAKE_SUPPORTS_SPACES 1) + else() + set(MAKE_SUPPORTS_SPACES 0) + endif() + + set(build_generator_args + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ) + if(CMAKE_TEST_GENERATOR_TOOLSET) + list(APPEND build_generator_args + --build-generator-toolset ${CMAKE_TEST_GENERATOR_TOOLSET} + ) + endif() + + add_subdirectory(CMakeLib) + add_subdirectory(CMakeOnly) + add_subdirectory(RunCMake) - ADD_SUBDIRECTORY(CMakeLib) - ADD_SUBDIRECTORY(CMakeOnly) - ADD_SUBDIRECTORY(RunCMake) + add_subdirectory(FindPackageModeMakefileTest) - ADD_SUBDIRECTORY(FindPackageModeMakefileTest) + add_subdirectory(CTestTestMemcheck) # Collect a list of all test build directories. - SET(TEST_BUILD_DIRS) + set(TEST_BUILD_DIRS) # Should the long tests be run? - OPTION(CMAKE_RUN_LONG_TESTS + option(CMAKE_RUN_LONG_TESTS "Should the long tests be run (such as Bootstrap)." ON) - MARK_AS_ADVANCED(CMAKE_RUN_LONG_TESTS) + mark_as_advanced(CMAKE_RUN_LONG_TESTS) - IF (CMAKE_RUN_LONG_TESTS) - OPTION(CTEST_TEST_CTEST + if (CMAKE_RUN_LONG_TESTS) + option(CTEST_TEST_CTEST "Should the tests that run a full sub ctest process be run?" OFF) - MARK_AS_ADVANCED(CTEST_TEST_CTEST) - - OPTION(TEST_KDE4_STABLE_BRANCH - "Should the KDE4 stable branch test be run?" - OFF) - MARK_AS_ADVANCED(TEST_KDE4_STABLE_BRANCH) - ENDIF (CMAKE_RUN_LONG_TESTS) + mark_as_advanced(CTEST_TEST_CTEST) + endif () # Should tests that use CVS be run? # @@ -83,19 +109,19 @@ IF(BUILD_TESTING) if(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) find_package(CVS QUIET) - else(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) + else() find_program(CVS_EXECUTABLE NAMES cvs) - endif(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) + endif() if(CVS_EXECUTABLE) set(do_cvs_tests 1) - endif(CVS_EXECUTABLE) + endif() if(do_cvs_tests AND NOT UNIX) if("${CVS_EXECUTABLE}" MATCHES "cygwin") set(do_cvs_tests 0) - endif("${CVS_EXECUTABLE}" MATCHES "cygwin") - endif(do_cvs_tests AND NOT UNIX) + endif() + endif() # Should CPack tests be run? By default, yes, but... # @@ -108,35 +134,35 @@ IF(BUILD_TESTING) # well-known bug in kwsys process execution that I would love to get # time to fix. # - OPTION(CTEST_TEST_CPACK + option(CTEST_TEST_CPACK "Should the tests that use '--build-target package' be run?" ON) - MARK_AS_ADVANCED(CTEST_TEST_CPACK) - SET(CTEST_TEST_OSX_ARCH 0) - IF(APPLE) - EXECUTE_PROCESS( + mark_as_advanced(CTEST_TEST_CPACK) + set(CTEST_TEST_OSX_ARCH 0) + if(APPLE) + execute_process( COMMAND sw_vers -productVersion OUTPUT_VARIABLE OSX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) - IF(OSX_VERSION MATCHES "^10\\.[0123]" OR OSX_VERSION MATCHES "ProductVersion:\t10\\.[0123]") - MESSAGE(STATUS "Forcing CTEST_TEST_CPACK=OFF on OSX < 10.4") - MESSAGE(STATUS "OSX_VERSION='${OSX_VERSION}'") - SET(CTEST_TEST_CPACK OFF) - ELSE(OSX_VERSION MATCHES "^10\\.[0123]" OR OSX_VERSION MATCHES "ProductVersion:\t10\\.[0123]") - SET(CTEST_TEST_OSX_ARCH 1) - ENDIF(OSX_VERSION MATCHES "^10\\.[0123]" OR OSX_VERSION MATCHES "ProductVersion:\t10\\.[0123]") - ENDIF(APPLE) + if(OSX_VERSION MATCHES "^10\\.[0123]" OR OSX_VERSION MATCHES "ProductVersion:\t10\\.[0123]") + message(STATUS "Forcing CTEST_TEST_CPACK=OFF on OSX < 10.4") + message(STATUS "OSX_VERSION='${OSX_VERSION}'") + set(CTEST_TEST_CPACK OFF) + else() + set(CTEST_TEST_OSX_ARCH 1) + endif() + endif() # Use 1500 or CTEST_TEST_TIMEOUT for long test timeout value, # whichever is greater. - SET(CMAKE_LONG_TEST_TIMEOUT 1500) - IF(CTEST_TEST_TIMEOUT) - SET(CMAKE_LONG_TEST_TIMEOUT ${CTEST_TEST_TIMEOUT}) - ENDIF(CTEST_TEST_TIMEOUT) - IF(CMAKE_LONG_TEST_TIMEOUT LESS 1500) - SET(CMAKE_LONG_TEST_TIMEOUT 1500) - ENDIF(CMAKE_LONG_TEST_TIMEOUT LESS 1500) + set(CMAKE_LONG_TEST_TIMEOUT 1500) + if(CTEST_TEST_TIMEOUT) + set(CMAKE_LONG_TEST_TIMEOUT ${CTEST_TEST_TIMEOUT}) + endif() + if(CMAKE_LONG_TEST_TIMEOUT LESS 1500) + set(CMAKE_LONG_TEST_TIMEOUT 1500) + endif() # add a bunch of standard build-and-test style tests ADD_TEST_MACRO(CommandLineTest CommandLineTest) @@ -148,53 +174,53 @@ IF(BUILD_TESTING) ADD_TEST_MACRO(SystemInformation SystemInformation) ADD_TEST_MACRO(MathTest MathTest) # assume no resources building to test - SET(TEST_RESOURCES FALSE) + set(TEST_RESOURCES FALSE) # for windows and cygwin assume we have resources - IF(WIN32 OR CYGWIN) - SET(TEST_RESOURCES TRUE) - ENDIF() + if(WIN32 OR CYGWIN) + set(TEST_RESOURCES TRUE) + endif() # for borland and watcom there is no resource support - IF("${CMAKE_TEST_GENERATOR}" MATCHES "WMake" OR + if("${CMAKE_TEST_GENERATOR}" MATCHES "WMake" OR "${CMAKE_TEST_GENERATOR}" MATCHES "Borland") - SET(TEST_RESOURCES FALSE) - ENDIF() - IF(TEST_RESOURCES) + set(TEST_RESOURCES FALSE) + endif() + if(TEST_RESOURCES) ADD_TEST_MACRO(VSResource VSResource) - ENDIF() + endif() ADD_TEST_MACRO(Simple Simple) ADD_TEST_MACRO(PreOrder PreOrder) ADD_TEST_MACRO(MissingSourceFile MissingSourceFile) - SET_TESTS_PROPERTIES(MissingSourceFile PROPERTIES + set_tests_properties(MissingSourceFile PROPERTIES PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file:[ \r\n]*DoesNotExist/MissingSourceFile.c") - IF(CMAKE_Fortran_COMPILER) + if(CMAKE_Fortran_COMPILER) ADD_TEST_MACRO(FortranOnly FortranOnly) - ENDIF() + endif() # test Visual Studio GNU Fortran mixing with cmake_add_fortran_subdirectory # run this project if we have a working fortran compiler or # the test is enabled with CMAKE_TEST_CMAKE_ADD_FORTRAN cache variable. # If you enable the test, CMake should find the MinGW fortran install, # or in some cases you might need to set the PATH so that cmake can find # the gfortran from mingw. - IF(CMAKE_Fortran_COMPILER OR CMAKE_TEST_CMAKE_ADD_FORTRAN) - SET(CMAKE_SKIP_VSGNUFortran FALSE) + if(CMAKE_Fortran_COMPILER OR CMAKE_TEST_CMAKE_ADD_FORTRAN) + set(CMAKE_SKIP_VSGNUFortran FALSE) # disable test for apple builds using ifort if they are building # more than one architecture, as ifort does not support that. - IF(APPLE AND (CMAKE_Fortran_COMPILER MATCHES ifort)) - LIST(LENGTH CMAKE_OSX_ARCHITECTURES len) - IF("${len}" GREATER 1) - MESSAGE(STATUS "Skip VSGNUFortran for ifort dual cpu mac build") - SET(CMAKE_SKIP_VSGNUFortran TRUE) - ENDIF() - ENDIF() - IF((CMAKE_C_COMPILER MATCHES lsb) + if(APPLE AND (CMAKE_Fortran_COMPILER MATCHES ifort)) + list(LENGTH CMAKE_OSX_ARCHITECTURES len) + if("${len}" GREATER 1) + message(STATUS "Skip VSGNUFortran for ifort dual cpu mac build") + set(CMAKE_SKIP_VSGNUFortran TRUE) + endif() + endif() + if((CMAKE_C_COMPILER MATCHES lsb) AND (CMAKE_Fortran_COMPILER MATCHES ifort)) - MESSAGE(STATUS "Skip VSGNUFortran for ifort and lsb compilers") - SET(CMAKE_SKIP_VSGNUFortran TRUE) - ENDIF() - IF(NOT CMAKE_SKIP_VSGNUFortran) + message(STATUS "Skip VSGNUFortran for ifort and lsb compilers") + set(CMAKE_SKIP_VSGNUFortran TRUE) + endif() + if(NOT CMAKE_SKIP_VSGNUFortran) ADD_TEST_MACRO(VSGNUFortran ${CMAKE_COMMAND} -P runtest.cmake) - ENDIF() - ENDIF() + endif() + endif() ADD_TEST_MACRO(COnly COnly) ADD_TEST_MACRO(CxxOnly CxxOnly) ADD_TEST_MACRO(IPO COnly/COnly) @@ -218,101 +244,115 @@ IF(BUILD_TESTING) ADD_TEST_MACRO(Unset Unset) ADD_TEST_MACRO(PolicyScope PolicyScope) ADD_TEST_MACRO(EmptyLibrary EmptyLibrary) - SET_TESTS_PROPERTIES(EmptyLibrary PROPERTIES + ADD_TEST_MACRO(CompileDefinitions CompileDefinitions) + ADD_TEST_MACRO(CompatibleInterface CompatibleInterface) + set_tests_properties(EmptyLibrary PROPERTIES PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target:test") ADD_TEST_MACRO(CrossCompile CrossCompile) - SET_TESTS_PROPERTIES(CrossCompile PROPERTIES + set_tests_properties(CrossCompile PROPERTIES PASS_REGULAR_EXPRESSION "TRY_RUN.. invoked in cross-compiling mode") - IF("${CMAKE_TEST_GENERATOR}" MATCHES "Make") + if("${CMAKE_TEST_GENERATOR}" MATCHES "Make") ADD_TEST_MACRO(Policy0002 Policy0002) - ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES "Make") - IF(CTEST_TEST_OSX_ARCH) + endif() + if(CTEST_TEST_OSX_ARCH) ADD_TEST_MACRO(Architecture Architecture) - SET_TESTS_PROPERTIES(Architecture PROPERTIES + set_tests_properties(Architecture PROPERTIES PASS_REGULAR_EXPRESSION "(file is not of required architecture|does not match cputype|not the architecture being linked)") - ENDIF(CTEST_TEST_OSX_ARCH) + endif() - LIST(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX}) + list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX}) - IF(NOT QT4_FOUND) - FIND_PACKAGE(Qt4) - ENDIF(NOT QT4_FOUND) + if(NOT QT4_FOUND) + find_package(Qt4) + endif() - IF(QT4_FOUND) + if(QT4_FOUND) # test whether the Qt4 which has been found works, on some machines # which run nightly builds there were errors like "wrong file format" # for libQtCore.so. So first check it works, and only if it does add # the automoc test. - INCLUDE(CheckCXXSourceCompiles) - SET(_save_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}") - SET(_save_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") + include(CheckCXXSourceCompiles) + set(_save_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}") + set(_save_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - SET(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES}) - SET(CMAKE_REQUIRED_LIBRARIES ${QT_QTCORE_LIBRARIES}) + set(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES}) + set(CMAKE_REQUIRED_LIBRARIES ${QT_QTCORE_LIBRARIES}) CHECK_CXX_SOURCE_COMPILES("#include \n int main() {return (qApp == 0 ? 0 : 1); }\n" QT4_WORKS) - SET(CMAKE_REQUIRED_INCLUDES "${_save_CMAKE_REQUIRED_INCLUDES}") - SET(CMAKE_REQUIRED_LIBRARIES "${_save_CMAKE_REQUIRED_LIBRARIES}") - ENDIF() + set(CMAKE_REQUIRED_INCLUDES "${_save_CMAKE_REQUIRED_INCLUDES}") + set(CMAKE_REQUIRED_LIBRARIES "${_save_CMAKE_REQUIRED_LIBRARIES}") + endif() # run test for BundleUtilities on supported platforms/compilers if(MSVC OR + MINGW OR CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin") if(NOT "${CMAKE_TEST_GENERATOR}" STREQUAL "Watcom WMake") - ADD_TEST(BundleUtilities ${CMAKE_CTEST_COMMAND} + add_test(BundleUtilities ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/BundleUtilities" "${CMake_BINARY_DIR}/Tests/BundleUtilities" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project BundleUtilities ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleUtilities") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleUtilities") # run test for DeployQt4 on supported platforms/compilers (which depends on BundleUtilities) # this test also depends on the existence of the standard qtiff plugin if(QT4_WORKS AND QT_QTSQL_FOUND) - ADD_TEST(Qt4Deploy ${CMAKE_CTEST_COMMAND} + add_test(Qt4Deploy ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Qt4Deploy" "${CMake_BINARY_DIR}/Tests/Qt4Deploy" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project Qt4Deploy --build-options -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Deploy") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Deploy") endif() endif() endif() - SET(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/COnly") - SET(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/CMakeBuildCOnly") - SET(CMAKE_BUILD_TEST_EXE COnly) - CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in" + set(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/COnly") + set(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/CMakeBuildCOnly") + set(CMAKE_BUILD_TEST_EXE COnly) + configure_file("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in" "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake" @ONLY) - ADD_TEST(CMakeBuildTest ${CMAKE_CMAKE_COMMAND} -P + add_test(CMakeBuildTest ${CMAKE_CMAKE_COMMAND} -P "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake") - LIST(APPEND TEST_BUILD_DIRS ${CMAKE_BUILD_TEST_BINARY_DIR}) + list(APPEND TEST_BUILD_DIRS ${CMAKE_BUILD_TEST_BINARY_DIR}) # now do it again for a project that has two project commands - SET(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/DoubleProject") - SET(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/DoubleProject") - SET(CMAKE_BUILD_TEST_EXE just_silly) - CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in" + set(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/DoubleProject") + set(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/DoubleProject") + set(CMAKE_BUILD_TEST_EXE just_silly) + configure_file("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in" "${CMake_BINARY_DIR}/Tests/CMakeBuildDoubleProjectTest.cmake" @ONLY) - ADD_TEST(CMakeDoubleProject ${CMAKE_CMAKE_COMMAND} -P + add_test(CMakeDoubleProject ${CMAKE_CMAKE_COMMAND} -P "${CMake_BINARY_DIR}/Tests/CMakeBuildDoubleProjectTest.cmake") - LIST(APPEND TEST_BUILD_DIRS ${CMAKE_BUILD_TEST_BINARY_DIR}) + list(APPEND TEST_BUILD_DIRS ${CMAKE_BUILD_TEST_BINARY_DIR}) ADD_TEST_MACRO(Module.CheckTypeSize CheckTypeSize) + add_test(Module.ExternalData ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Module/ExternalData" + "${CMake_BINARY_DIR}/Tests/Module/ExternalData" + ${build_generator_args} + --build-project ExternalDataTest + --build-noclean + --force-new-ctest-process + --build-options -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES} + --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Module/ExternalData") + ADD_TEST_MACRO(Module.GenerateExportHeader GenerateExportHeader) if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") @@ -333,27 +373,26 @@ IF(BUILD_TESTING) ADD_TEST_MACRO(PositionIndependentTargets PositionIndependentTargets) endif() - ADD_TEST(LinkFlags-prepare + add_test(LinkFlags-prepare ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} --build-and-test "${CMake_SOURCE_DIR}/Tests/LinkFlags" "${CMake_BINARY_DIR}/Tests/LinkFlags" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project LinkFlags --build-target LinkFlags --build-options -DTEST_CONFIG=\${CTEST_CONFIGURATION_TYPE} ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkFlags") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkFlags") - MACRO(ADD_LINK_FLAGS_TEST name depends) - ADD_TEST(LinkFlags-${name} + macro(ADD_LINK_FLAGS_TEST name depends) + add_test(LinkFlags-${name} ${CMAKE_CMAKE_COMMAND} --build "${CMake_BINARY_DIR}/Tests/LinkFlags" --target LinkFlags_${name} --config \${CTEST_CONFIGURATION_TYPE} ) - SET_TESTS_PROPERTIES(LinkFlags-${name} PROPERTIES + set_tests_properties(LinkFlags-${name} PROPERTIES PASS_REGULAR_EXPRESSION "BADFLAG" DEPENDS LinkFlags-${depends}) - ENDMACRO() + endmacro() ADD_LINK_FLAGS_TEST(lib prepare) ADD_LINK_FLAGS_TEST(dll lib) ADD_LINK_FLAGS_TEST(exe dll) @@ -365,116 +404,118 @@ IF(BUILD_TESTING) # build the "Simple" test with the ExtraGenerators, if available # This doesn't test whether the generated project files work (unfortunately), # mainly it tests that cmake doesn't crash when generating these project files. - IF(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop") + if(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop") # check which generators we have - EXEC_PROGRAM(${CMAKE_CMAKE_COMMAND} ARGS --help OUTPUT_VARIABLE cmakeOutput ) + execute_process(COMMAND ${CMAKE_CMAKE_COMMAND} --help + OUTPUT_VARIABLE cmakeOutput ERROR_VARIABLE cmakeOutput) # check for the Eclipse generator - IF ("${cmakeOutput}" MATCHES Eclipse) - ADD_TEST(Simple_EclipseGenerator ${CMAKE_CTEST_COMMAND} + if ("${cmakeOutput}" MATCHES Eclipse) + add_test(Simple_EclipseGenerator ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Simple" "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator" --build-two-config --build-generator "Eclipse CDT4 - Unix Makefiles" + --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Simple --test-command Simple) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator") - ENDIF ("${cmakeOutput}" MATCHES Eclipse) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator") + endif () # check for the CodeBlocks generator - IF ("${cmakeOutput}" MATCHES CodeBlocks) - ADD_TEST(Simple_CodeBlocksGenerator ${CMAKE_CTEST_COMMAND} + if ("${cmakeOutput}" MATCHES CodeBlocks) + add_test(Simple_CodeBlocksGenerator ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Simple" "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator" --build-two-config --build-generator "CodeBlocks - Unix Makefiles" + --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Simple --test-command Simple) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator") - ENDIF ("${cmakeOutput}" MATCHES CodeBlocks) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator") + endif () # check for the KDevelop3 generator - IF ("${cmakeOutput}" MATCHES KDevelop3) - ADD_TEST(Simple_KDevelop3Generator ${CMAKE_CTEST_COMMAND} + if ("${cmakeOutput}" MATCHES KDevelop3) + add_test(Simple_KDevelop3Generator ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Simple" "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator" --build-two-config --build-generator "KDevelop3 - Unix Makefiles" + --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Simple --test-command Simple) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator") - ENDIF ("${cmakeOutput}" MATCHES KDevelop3) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator") + endif () - ENDIF(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop") + endif() # test for correct sub-project generation # not implemented in VS6 or Xcode - IF(NOT MSVC60 AND NOT XCODE AND NOT MSVC70) + if(NOT MSVC60 AND NOT XCODE AND NOT MSVC70) # run cmake and configure all of SubProject # but only build the independent executable car - ADD_TEST(SubProject ${CMAKE_CTEST_COMMAND} + add_test(SubProject ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubProject" "${CMake_BINARY_DIR}/Tests/SubProject" --build-project SubProject - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-target car --test-command car ) - IF(${CMAKE_TEST_GENERATOR} MATCHES "Ninja") + if(${CMAKE_TEST_GENERATOR} MATCHES "Ninja") # The Ninja generator does not create a recursive build system. Start # from the root directory. - SET(SubProject_SUBDIR) - ELSE() - SET(SubProject_SUBDIR "/foo") - ENDIF() + set(SubProject_SUBDIR) + else() + set(SubProject_SUBDIR "/foo") + endif() # For stage 2, do not run cmake again. # Then build the foo sub project which should build # the bar library which should be referenced because # foo links to the static library bar, but bar is not # directly in the foo sub project - ADD_TEST(SubProject-Stage2 ${CMAKE_CTEST_COMMAND} + add_test(SubProject-Stage2 ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubProject${SubProject_SUBDIR}" "${CMake_BINARY_DIR}/Tests/SubProject${SubProject_SUBDIR}" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-nocmake --build-project foo --build-target foo --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubProject/foo" --test-command foo ) - SET_TESTS_PROPERTIES ( SubProject-Stage2 PROPERTIES DEPENDS SubProject) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubProject") - ENDIF(NOT MSVC60 AND NOT XCODE AND NOT MSVC70) + set_tests_properties ( SubProject-Stage2 PROPERTIES DEPENDS SubProject) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubProject") + endif() - IF (CMAKE_STRICT) + if (CMAKE_STRICT) ADD_TEST_MACRO(DocTest DocTest) - ENDIF (CMAKE_STRICT) + endif () # macro to add a test that will build a nightly release # of CMake for given platform using the release scripts - MACRO(ADD_NIGHTLY_BUILD_TEST name script) - SET(_TEST_DIR "${CMake_BINARY_DIR}/Tests/${name}") - FILE(MAKE_DIRECTORY "${_TEST_DIR}") - FILE(WRITE "${_TEST_DIR}/nightly-cmake.sh" + macro(ADD_NIGHTLY_BUILD_TEST name script) + set(_TEST_DIR "${CMake_BINARY_DIR}/Tests/${name}") + file(MAKE_DIRECTORY "${_TEST_DIR}") + file(WRITE "${_TEST_DIR}/nightly-cmake.sh" "cd ${_TEST_DIR} ${CMake_BINARY_DIR}/bin/cmake -DCMAKE_CREATE_VERSION=nightly -P ${CMake_SOURCE_DIR}/Utilities/Release/${script} ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/Release/upload_release.cmake ") - ADD_TEST(${name} /bin/sh ${_TEST_DIR}/nightly-cmake.sh) - IF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY) - SET_TESTS_PROPERTIES (${name} PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) - ENDIF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY) - ENDMACRO(ADD_NIGHTLY_BUILD_TEST) - IF(CMAKE_BUILD_NIGHTLY_RELEASES) + add_test(${name} /bin/sh ${_TEST_DIR}/nightly-cmake.sh) + if(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY) + set_tests_properties (${name} PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) + endif() + endmacro() + if(CMAKE_BUILD_NIGHTLY_RELEASES) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWindows dash2win64_release.cmake) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyMac @@ -483,106 +524,110 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ dashmacmini5_release.cmake) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux magrathea_release.cmake) - ENDIF(CMAKE_BUILD_NIGHTLY_RELEASES) + endif() # add tests with more complex invocations - ADD_TEST(Framework ${CMAKE_CTEST_COMMAND} + add_test(Framework ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Framework" "${CMake_BINARY_DIR}/Tests/Framework" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project Framework --build-options "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/Framework/Install" --test-command bar) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Framework") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Framework") - ADD_TEST(TargetName ${CMAKE_CTEST_COMMAND} + add_test(TargetName ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/TargetName" "${CMake_BINARY_DIR}/Tests/TargetName" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project TargetName --test-command ${CMAKE_CMAKE_COMMAND} -E compare_files ${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world ${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TargetName") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TargetName") - ADD_TEST(LibName ${CMAKE_CTEST_COMMAND} + add_test(LibName ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/LibName" "${CMake_BINARY_DIR}/Tests/LibName" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project LibName --build-exe-dir "${CMake_BINARY_DIR}/Tests/LibName/lib" --test-command foobar ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LibName") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LibName") - ADD_TEST(CustComDepend ${CMAKE_CTEST_COMMAND} + add_test(CustComDepend ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CustComDepend" "${CMake_BINARY_DIR}/Tests/CustComDepend" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project CustComDepend --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustComDepend/bin" --test-command foo bar.c ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustComDepend") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustComDepend") - ADD_TEST(ArgumentExpansion ${CMAKE_CTEST_COMMAND} + add_test(ArgumentExpansion ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/ArgumentExpansion" "${CMake_BINARY_DIR}/Tests/ArgumentExpansion" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project ArgumentExpansion - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/ArgumentExpansion/bin" ) - SET_TESTS_PROPERTIES(ArgumentExpansion PROPERTIES + set_tests_properties(ArgumentExpansion PROPERTIES FAIL_REGULAR_EXPRESSION "Unexpected: ") - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ArgumentExpansion") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ArgumentExpansion") + + add_test(GeneratorExpression ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/GeneratorExpression" + "${CMake_BINARY_DIR}/Tests/GeneratorExpression" + ${build_generator_args} + --build-project GeneratorExpression + --build-options -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE} + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GeneratorExpression") - ADD_TEST(CustomCommand ${CMAKE_CTEST_COMMAND} + add_test(CustomCommand ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CustomCommand" "${CMake_BINARY_DIR}/Tests/CustomCommand" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project CustomCommand - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin" --test-command CustomCommand ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommand") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommand") - ADD_TEST(CustomCommandWorkingDirectory ${CMAKE_CTEST_COMMAND} + ADD_TEST_MACRO(EmptyDepends ${CMAKE_CTEST_COMMAND}) + + add_test(CustomCommandWorkingDirectory ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CustomCommandWorkingDirectory" "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project TestWorkingDir - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command working ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory") - #ADD_TEST(SimpleExclude ${CMAKE_CTEST_COMMAND} + #add_test(SimpleExclude ${CMAKE_CTEST_COMMAND} # --build-and-test # "${CMake_SOURCE_DIR}/Tests/SimpleExclude" # "${CMake_BINARY_DIR}/Tests/SimpleExclude" - # --build-generator ${CMAKE_TEST_GENERATOR} + # ${build_generator_args} # --build-project SimpleExclude - # --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} # --build-two-config # --test-command t4 #--test-command "${CMAKE_COMMAND}" @@ -590,69 +635,64 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ #-P "${CMake_BINARY_DIR}/Tests/SimpleExclude/run.cmake" #) -# ADD_TEST(SameName ${CMAKE_CTEST_COMMAND} +# add_test(SameName ${CMAKE_CTEST_COMMAND} # --build-and-test # "${CMake_SOURCE_DIR}/Tests/SameName" # "${CMake_BINARY_DIR}/Tests/SameName" -# --build-generator ${CMAKE_TEST_GENERATOR} +# ${build_generator_args} # --build-project SameName -# --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} # --build-two-config # --test-command # "${CMake_BINARY_DIR}/Tests/SameName/Exe1/mytest2") - ADD_TEST(OutOfSource ${CMAKE_CTEST_COMMAND} + add_test(OutOfSource ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/OutOfSource" "${CMake_BINARY_DIR}/Tests/OutOfSource" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project OutOfSource - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --test-command "${CMake_BINARY_DIR}/Tests/OutOfSource/SubDir/OutOfSourceSubdir/simple") - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSource") - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSourceDeep") - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfBinary") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSource") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSourceDeep") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfBinary") - ADD_TEST(BuildDepends ${CMAKE_CTEST_COMMAND} + add_test(BuildDepends ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/BuildDepends" "${CMake_BINARY_DIR}/Tests/BuildDepends" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project BuildDepends - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends") - SET(SimpleInstallInstallDir + set(SimpleInstallInstallDir "${CMake_BINARY_DIR}/Tests/SimpleInstall/InstallDirectory") - ADD_TEST(SimpleInstall ${CMAKE_CTEST_COMMAND} + add_test(SimpleInstall ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SimpleInstall" "${CMake_BINARY_DIR}/Tests/SimpleInstall" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project TestSimpleInstall - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --build-options "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}" "-DCTEST_TEST_CPACK:BOOL=${CTEST_TEST_CPACK}" --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExe) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstall") - ADD_TEST(SimpleInstall-Stage2 ${CMAKE_CTEST_COMMAND} + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstall") + add_test(SimpleInstall-Stage2 ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SimpleInstallS2" "${CMake_BINARY_DIR}/Tests/SimpleInstallS2" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project TestSimpleInstall - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --build-options "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}" "-DSTAGE2:BOOL=1" --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExeS2) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstallS2") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstallS2") # By default, run the CPackComponents test if the CTEST_TEST_CPACK # option is ON: @@ -663,11 +703,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") find_program(RPMBUILD NAMES rpmbuild) - endif(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") + endif() # Do not try to build RPM if (NOT RPMBUILD) set(CPACK_BINARY_RPM OFF) - endif(NOT RPMBUILD) + endif() find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS] @@ -680,29 +720,50 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ if(WIN32) if(NSIS_MAKENSIS_EXECUTABLE) set(CTEST_RUN_CPackComponents ON) - else(NSIS_MAKENSIS_EXECUTABLE) + else() set(CTEST_RUN_CPackComponents OFF) set(CTEST_package_X11_TEST OFF) - endif(NSIS_MAKENSIS_EXECUTABLE) - endif(WIN32) + endif() + endif() + + # On Windows run the CPackWiXGenerator test + # if the WiX Toolset seems to be available + if(WIN32) + file(TO_CMAKE_PATH "$ENV{WIX}" WIX_ROOT) - IF(CTEST_RUN_CPackComponents) + find_program(WIX_LIGHT_EXECUTABLE light + PATHS "${WIX_ROOT}/bin" + DOC "WiX Toolset light.exe location") + + if(WIX_LIGHT_EXECUTABLE) + add_test(CPackWiXGenerator ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator" + "${CMake_BINARY_DIR}/Tests/CPackWiXGenerator" + ${build_generator_args} + --build-project CPackWiXGenerator + --test-command ${CMAKE_CMAKE_COMMAND} + "-DCPackWiXGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackWiXGenerator" + -P "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake") + endif() + endif() + + if(CTEST_RUN_CPackComponents) set(CPackComponents_EXTRA_OPTIONS) if(APPLE) set(CPackComponents_EXTRA_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON) - endif(APPLE) + endif() if(NSIS_MAKENSIS_EXECUTABLE) set(CPackComponents_EXTRA_OPTIONS ${CPackComponents_EXTRA_OPTIONS} -DCPACK_BINARY_NSIS:BOOL=ON) - endif(NSIS_MAKENSIS_EXECUTABLE) + endif() - ADD_TEST(CPackComponents ${CMAKE_CTEST_COMMAND} + add_test(CPackComponents ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CPackComponents" "${CMake_BINARY_DIR}/Tests/CPackComponents" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project CPackComponents - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --build-target package --build-options @@ -713,42 +774,41 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --test-command ${CMAKE_CMAKE_COMMAND} "-DCPackComponents_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponents" -P "${CMake_SOURCE_DIR}/Tests/CPackComponents/VerifyResult.cmake") - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponents") - ENDIF(CTEST_RUN_CPackComponents) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponents") + endif() - IF(CTEST_RUN_CPackComponentsForAll) + if(CTEST_RUN_CPackComponentsForAll) # Check whether if rpmbuild command is found # before adding RPM tests find_program(RPMBUILD_EXECUTABLE NAMES rpmbuild) if(RPMBUILD_EXECUTABLE) list(APPEND ACTIVE_CPACK_GENERATORS RPM) - endif(RPMBUILD_EXECUTABLE) + endif() # Check whether if dpkg command is found # before adding DEB tests find_program(DPKG_EXECUTABLE NAMES dpkg) if(DPKG_EXECUTABLE) list(APPEND ACTIVE_CPACK_GENERATORS DEB) - endif(DPKG_EXECUTABLE) + endif() # ACTIVE_CPACK_GENERATORS variable # now contains the list of 'active generators' set(CPackComponentsForAll_EXTRA_OPTIONS) - set(CPackRun_CPackCommand "-DCPackCommand=${CMAKE_CPACK_COMMAND}") # set up list of CPack generators list(APPEND GENLST "ZIP") if(APPLE) list(APPEND GENLST "DragNDrop") - endif(APPLE) + endif() if (NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") list(FIND ACTIVE_CPACK_GENERATORS "RPM" RPM_ACTIVE) if (NOT ${RPM_ACTIVE} EQUAL -1) list(APPEND GENLST "RPM") - endif(NOT ${RPM_ACTIVE} EQUAL -1) - endif(NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") + endif() + endif() list(FIND ACTIVE_CPACK_GENERATORS "DEB" DEB_ACTIVE) if (NOT ${DEB_ACTIVE} EQUAL -1) list(APPEND GENLST "DEB") - endif(NOT ${DEB_ACTIVE} EQUAL -1) + endif() # set up list of component packaging ways list(APPEND CWAYLST "default") @@ -759,13 +819,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ set(CPackRun_CPackGen "-DCPackGen=${CPackGen}") foreach(CPackComponentWay ${CWAYLST}) set(CPackRun_CPackComponentWay "-DCPackComponentWay=${CPackComponentWay}") - ADD_TEST(CPackComponentsForAll-${CPackGen}-${CPackComponentWay} ${CMAKE_CTEST_COMMAND} + add_test(CPackComponentsForAll-${CPackGen}-${CPackComponentWay} ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll" "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project CPackComponentsForAll - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-options -DCPACK_BINARY_${CPackGen}:BOOL=ON ${CPackRun_CPackComponentWay} @@ -773,14 +832,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --graphviz=CPackComponentsForAll.dot --test-command ${CMAKE_CMAKE_COMMAND} "-DCPackComponentsForAll_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}" - "${CPackRun_CPackCommand}" "${CPackRun_CPackGen}" "${CPackRun_CPackComponentWay}" -P "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake") - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}") - endforeach(CPackComponentWay) - endforeach(CPackGen) - ENDIF(CTEST_RUN_CPackComponentsForAll) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}") + endforeach() + endforeach() + endif() # By default, turn this test off (because it takes a long time...) # @@ -794,283 +852,317 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ NOT "$ENV{COVFILE}" STREQUAL "" OR CMAKE_RUN_LONG_TESTS) set(CTEST_RUN_CPackTestAllGenerators ${CTEST_TEST_CPACK}) - endif(CMAKE_CXX_FLAGS MATCHES "-ftest-coverage" OR - NOT "$ENV{COVFILE}" STREQUAL "" OR - CMAKE_RUN_LONG_TESTS) - endif(NOT DEFINED CTEST_RUN_CPackTestAllGenerators) + endif() + endif() - IF(CTEST_RUN_CPackTestAllGenerators) - ADD_TEST(CPackTestAllGenerators ${CMAKE_CTEST_COMMAND} + if(CTEST_RUN_CPackTestAllGenerators) + add_test(CPackTestAllGenerators ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CPackTestAllGenerators" "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project CPackTestAllGenerators - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command ${CMAKE_CMAKE_COMMAND} -D dir=${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators - -D cpack=${CMAKE_CPACK_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/CPackTestAllGenerators/RunCPack.cmake ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators") - ENDIF(CTEST_RUN_CPackTestAllGenerators) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators") + endif() - IF(CTEST_package_X11_TEST) - SET(X11_build_target_arg --build-target package) - ELSE(CTEST_package_X11_TEST) - SET(X11_build_target_arg) - ENDIF(CTEST_package_X11_TEST) + if(CTEST_package_X11_TEST) + set(X11_build_target_arg --build-target package) + else() + set(X11_build_target_arg) + endif() - ADD_TEST(X11 ${CMAKE_CTEST_COMMAND} + add_test(X11 ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/X11" "${CMake_BINARY_DIR}/Tests/X11" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project UseX11 - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config ${X11_build_target_arg} --test-command UseX11) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/X11") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/X11") if(NOT DEFINED CTEST_RUN_CMakeTestAllGenerators) set(CTEST_RUN_CMakeTestAllGenerators ON) - endif(NOT DEFINED CTEST_RUN_CMakeTestAllGenerators) + endif() - IF(CTEST_RUN_CMakeTestAllGenerators) - ADD_TEST(CMakeTestAllGenerators ${CMAKE_CMAKE_COMMAND} + if(CTEST_RUN_CMakeTestAllGenerators) + add_test(CMakeTestAllGenerators ${CMAKE_CMAKE_COMMAND} -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestAllGenerators -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR} -P ${CMake_SOURCE_DIR}/Tests/CMakeTestAllGenerators/RunCMake.cmake ) - LIST(APPEND TEST_BUILD_DIRS + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CMakeTestAllGenerators") - ENDIF(CTEST_RUN_CMakeTestAllGenerators) + endif() if(NOT DEFINED CTEST_RUN_CMakeTestBadCommandLines) set(CTEST_RUN_CMakeTestBadCommandLines ON) - endif(NOT DEFINED CTEST_RUN_CMakeTestBadCommandLines) + endif() - IF(CTEST_RUN_CMakeTestBadCommandLines) - ADD_TEST(CMakeTestBadCommandLines ${CMAKE_CMAKE_COMMAND} + if(CTEST_RUN_CMakeTestBadCommandLines) + add_test(CMakeTestBadCommandLines ${CMAKE_CMAKE_COMMAND} -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestBadCommandLines -D gen=${CMAKE_TEST_GENERATOR} -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR} -P ${CMake_SOURCE_DIR}/Tests/CMakeTestBadCommandLines/RunCMake.cmake ) - LIST(APPEND TEST_BUILD_DIRS + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CMakeTestBadCommandLines") - ENDIF(CTEST_RUN_CMakeTestBadCommandLines) + endif() if(NOT DEFINED CTEST_RUN_CMakeTestMultipleConfigures) set(CTEST_RUN_CMakeTestMultipleConfigures ON) - endif(NOT DEFINED CTEST_RUN_CMakeTestMultipleConfigures) + endif() - IF(CTEST_RUN_CMakeTestMultipleConfigures) - ADD_TEST(CMakeTestMultipleConfigures ${CMAKE_CMAKE_COMMAND} + if(CTEST_RUN_CMakeTestMultipleConfigures) + add_test(CMakeTestMultipleConfigures ${CMAKE_CMAKE_COMMAND} -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestMultipleConfigures -D gen=${CMAKE_TEST_GENERATOR} -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR} -P ${CMake_SOURCE_DIR}/Tests/CMakeTestMultipleConfigures/RunCMake.cmake ) - LIST(APPEND TEST_BUILD_DIRS + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CMakeTestMultipleConfigures") - ENDIF(CTEST_RUN_CMakeTestMultipleConfigures) + endif() - ADD_TEST(LoadedCommandOneConfig ${CMAKE_CTEST_COMMAND} + add_test(LoadedCommandOneConfig ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig" "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project LoadCommand - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command LoadedCommand ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig") - ADD_TEST(complex ${CMAKE_CTEST_COMMAND} + add_test(complex ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Complex" "${CMake_BINARY_DIR}/Tests/Complex" --build-two-config --build-config-sample "${CMAKE_CTEST_COMMAND}" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project Complex - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin" --build-options -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} --test-command complex ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Complex") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Complex") - ADD_TEST(complexOneConfig ${CMAKE_CTEST_COMMAND} + add_test(complexOneConfig ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/ComplexOneConfig" "${CMake_BINARY_DIR}/Tests/ComplexOneConfig" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project Complex - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin" --build-options -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} --test-command complex) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig") # because of the registry write these tests depend on each other - SET_TESTS_PROPERTIES ( complex PROPERTIES DEPENDS complexOneConfig) + set_tests_properties ( complex PROPERTIES DEPENDS complexOneConfig) - ADD_TEST(Example ${CMAKE_CTEST_COMMAND} + add_test(Example ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Example" "${CMake_BINARY_DIR}/Example" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project HELLO - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Example/Demo" --test-command helloDemo ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Example") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Example") - ADD_TEST(Environment ${CMAKE_CTEST_COMMAND} + add_test(Environment ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Environment" "${CMake_BINARY_DIR}/Tests/Environment" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project EnvironmentProj - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Environment" --force-new-ctest-process --test-command ${CMAKE_CTEST_COMMAND} -V ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Environment") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Environment") + + add_test(QtAutomocNoQt ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/QtAutomocNoQt" + "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt" + ${build_generator_args} + --build-project QtAutomocNoQt + --build-options -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE} + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt") - IF(QT4_WORKS AND QT_QTGUI_FOUND) - ADD_TEST(QtAutomoc ${CMAKE_CTEST_COMMAND} + if(QT4_WORKS AND QT_QTGUI_FOUND) + add_test(QtAutomoc ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutomoc" "${CMake_BINARY_DIR}/Tests/QtAutomoc" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project QtAutomoc - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/QtAutomoc" --force-new-ctest-process --build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} --test-command ${CMAKE_CTEST_COMMAND} -V ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomoc") - ENDIF() + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomoc") + endif() + if(QT4_WORKS AND QT_QTGUI_FOUND) + add_test(Qt4Targets ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Qt4Targets" + "${CMake_BINARY_DIR}/Tests/Qt4Targets" + ${build_generator_args} + --build-project Qt4Targets + --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Targets" + --force-new-ctest-process + --build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} + --test-command ${CMAKE_CTEST_COMMAND} -V + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Targets") + endif() - ADD_TEST(ExternalProject ${CMAKE_CTEST_COMMAND} + add_test(ExternalProject ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/ExternalProject" "${CMake_BINARY_DIR}/Tests/ExternalProject" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project ExternalProjectTest - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProject" --force-new-ctest-process --test-command ${CMAKE_CTEST_COMMAND} -V ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProject") - SET_TESTS_PROPERTIES(ExternalProject PROPERTIES + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProject") + set_tests_properties(ExternalProject PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) + add_test(ExternalProjectUpdateSetup ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate" + "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate" + ${build_generator_args} + --build-project ExternalProjectUpdateTest + --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate") + set_tests_properties(ExternalProjectUpdateSetup PROPERTIES + TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) + + add_test(NAME ExternalProjectUpdate + COMMAND ${CMAKE_CMAKE_COMMAND} + -DExternalProjectUpdate_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate + -DExternalProjectUpdate_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate + -DCMAKE_TEST_GENERATOR=${CMAKE_TEST_GENERATOR} + -DCMAKE_TEST_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET} + -DCMAKE_TEST_MAKEPROGRAM=${CMAKE_TEST_MAKEPROGRAM} + -DCMAKE_CTEST_COMMAND=${CMAKE_CTEST_COMMAND} + -P ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate") + set_tests_properties(ExternalProjectUpdate PROPERTIES + TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT} + WORKING_DIRECTORY ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate + DEPENDS ExternalProjectUpdateSetup ) + # do each of the tutorial steps - FOREACH(STP RANGE 1 7) - ADD_TEST(TutorialStep${STP} ${CMAKE_CTEST_COMMAND} + foreach(STP RANGE 1 7) + add_test(TutorialStep${STP} ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Tutorial/Step${STP}" "${CMake_BINARY_DIR}/Tests/Tutorial/Step${STP}" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project Tutorial --test-command Tutorial 25.0) - ENDFOREACH(STP) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Tutorial") + endforeach() + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Tutorial") - ADD_TEST(testing ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} + add_test(testing ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} --build-and-test "${CMake_SOURCE_DIR}/Tests/Testing" "${CMake_BINARY_DIR}/Tests/Testing" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project Testing - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} ) - SET_TESTS_PROPERTIES(testing PROPERTIES PASS_REGULAR_EXPRESSION "Passed") - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Testing") + set_tests_properties(testing PROPERTIES PASS_REGULAR_EXPRESSION "Passed") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Testing") - ADD_TEST(wrapping ${CMAKE_CTEST_COMMAND} + add_test(wrapping ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Wrapping" "${CMake_BINARY_DIR}/Tests/Wrapping" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project Wrapping - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --test-command wrapping ) - ADD_TEST(qtwrapping ${CMAKE_CTEST_COMMAND} + add_test(qtwrapping ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Wrapping" "${CMake_BINARY_DIR}/Tests/Wrapping" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project Wrapping - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --test-command qtwrapping ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Wrapping") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Wrapping") - ADD_TEST(testdriver1 ${CMAKE_CTEST_COMMAND} + add_test(testdriver1 ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/TestDriver" "${CMake_BINARY_DIR}/Tests/TestDriver" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --build-project TestDriverTest --test-command TestDriverTest test1 ) - ADD_TEST(testdriver2 ${CMAKE_CTEST_COMMAND} + add_test(testdriver2 ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/TestDriver" "${CMake_BINARY_DIR}/Tests/TestDriver" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --build-project TestDriverTest --test-command TestDriverTest test2 ) - ADD_TEST(testdriver3 ${CMAKE_CTEST_COMMAND} + add_test(testdriver3 ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/TestDriver" "${CMake_BINARY_DIR}/Tests/TestDriver" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --build-project TestDriverTest --test-command TestDriverTest subdir/test3 ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestDriver") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestDriver") - ADD_TEST(Dependency ${CMAKE_CTEST_COMMAND} + add_test(Dependency ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Dependency" "${CMake_BINARY_DIR}/Tests/Dependency" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/Exec" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project Dependency --test-command exec ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Dependency") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Dependency") - IF("${CMAKE_SYSTEM_NAME}" MATCHES syllable) + if("${CMAKE_SYSTEM_NAME}" MATCHES syllable) # RPATH isn't supported under Syllable, so the tests don't # find their libraries. In order to fix that LIBRARY_OUTPUT_DIR @@ -1078,202 +1170,174 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # For now we just require on Syllable that the user adjusts the DLL_PATH # environment variable, so except the two tests below all other tests will succeed. - SET(_DLL_PATH "$ENV{DLL_PATH}") - IF(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.(:.*)?$") - MESSAGE(FATAL_ERROR "In order to successfully run the CMake test suite on Syllable you need to add \"\\@bindir\\@/.\" to the DLL_PATH environment variable") - ENDIF(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.(:.*)?$") - IF(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.\\./lib(:.*)?$") - MESSAGE(FATAL_ERROR "In order to successfully run the CMake test suite on Syllable you need to add \"\\@bindir\\@/../lib\" to the DLL_PATH environment variable") - ENDIF(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.\\./lib(:.*)?$") + set(_DLL_PATH "$ENV{DLL_PATH}") + if(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.(:.*)?$") + message(FATAL_ERROR "In order to successfully run the CMake test suite on Syllable you need to add \"\\@bindir\\@/.\" to the DLL_PATH environment variable") + endif() + if(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.\\./lib(:.*)?$") + message(FATAL_ERROR "In order to successfully run the CMake test suite on Syllable you need to add \"\\@bindir\\@/../lib\" to the DLL_PATH environment variable") + endif() - ELSE("${CMAKE_SYSTEM_NAME}" MATCHES syllable) + else() - ADD_TEST(JumpWithLibOut ${CMAKE_CTEST_COMMAND} + add_test(JumpWithLibOut ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Jump" "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Executable" --build-project Jump - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-options -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Lib --test-command jumpExecutable ) - ADD_TEST(JumpNoLibOut ${CMAKE_CTEST_COMMAND} + add_test(JumpNoLibOut ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Jump" "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable" --build-run-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable" --build-project Jump - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --test-command jumpExecutable ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Jump") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Jump") - ADD_TEST(Plugin ${CMAKE_CTEST_COMMAND} + add_test(Plugin ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Plugin" "${CMake_BINARY_DIR}/Tests/Plugin" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project Plugin - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --test-command bin/example) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Plugin") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Plugin") - IF(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG) + if(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG) ADD_TEST_MACRO(RuntimePath RuntimePath) - ENDIF(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG) - ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES syllable) + endif() + endif() - ADD_TEST(linkorder1 ${CMAKE_CTEST_COMMAND} + add_test(linkorder1 ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/LinkLineOrder" "${CMake_BINARY_DIR}/Tests/LinkLineOrder" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project LinkLineOrder --test-command Exec1 ) - ADD_TEST(linkorder2 ${CMAKE_CTEST_COMMAND} + add_test(linkorder2 ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/LinkLineOrder" "${CMake_BINARY_DIR}/Tests/LinkLineOrder" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project LinkLineOrder --test-command Exec2 ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkLineOrder") - SET_TESTS_PROPERTIES ( qtwrapping PROPERTIES DEPENDS wrapping) - SET_TESTS_PROPERTIES ( testdriver1 PROPERTIES DEPENDS qtwrapping) - SET_TESTS_PROPERTIES ( testdriver2 PROPERTIES DEPENDS testdriver1) - SET_TESTS_PROPERTIES ( testdriver3 PROPERTIES DEPENDS testdriver2) - SET_TESTS_PROPERTIES ( linkorder2 PROPERTIES DEPENDS linkorder1) - SET_TESTS_PROPERTIES ( SimpleInstall-Stage2 PROPERTIES DEPENDS SimpleInstall) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkLineOrder") + set_tests_properties ( qtwrapping PROPERTIES DEPENDS wrapping) + set_tests_properties ( testdriver1 PROPERTIES DEPENDS qtwrapping) + set_tests_properties ( testdriver2 PROPERTIES DEPENDS testdriver1) + set_tests_properties ( testdriver3 PROPERTIES DEPENDS testdriver2) + set_tests_properties ( linkorder2 PROPERTIES DEPENDS linkorder1) + set_tests_properties ( SimpleInstall-Stage2 PROPERTIES DEPENDS SimpleInstall) # Test static linking on toolchains known to support it. - IF("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU)$" + if("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU)$" AND NOT APPLE AND NOT WIN32 AND NOT CYGWIN AND EXISTS "/usr/lib/libm.a") - ADD_TEST(LinkStatic ${CMAKE_CTEST_COMMAND} + add_test(LinkStatic ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/LinkStatic" "${CMake_BINARY_DIR}/Tests/LinkStatic" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project LinkStatic --build-options -DMATH_LIBRARY:FILEPATH=/usr/lib/libm.a --test-command LinkStatic ) - ENDIF() + endif() - IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) - ADD_TEST(kwsys ${CMAKE_CTEST_COMMAND} + if(NOT CMAKE_TEST_DIFFERENT_GENERATOR) + add_test(kwsys ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Source/kwsys" "${CMake_BINARY_DIR}/Tests/kwsys" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project kwsys --test-command kwsysTestsCxx testIOS ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/kwsys") - ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) - SET(MAKE_IS_GNU ) - IF(${CMAKE_TEST_MAKEPROGRAM} MATCHES make) - EXEC_PROGRAM( - ${CMAKE_TEST_MAKEPROGRAM} ARGS no_such_target --version - RETURN_VALUE res OUTPUT_VARIABLE out - ) - IF("${res}" EQUAL 0) - IF("${out}" MATCHES "GNU") - SET(MAKE_IS_GNU 1) - ENDIF("${out}" MATCHES "GNU") - ENDIF("${res}" EQUAL 0) - ENDIF(${CMAKE_TEST_MAKEPROGRAM} MATCHES make) - - # only add this test on platforms that support it - # some old versions of make simply cannot handle spaces in paths - IF (MAKE_IS_GNU OR - "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR - "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland") - ADD_TEST(SubDirSpaces ${CMAKE_CTEST_COMMAND} + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/kwsys") + endif() + + if(MAKE_SUPPORTS_SPACES) + add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDirSpaces" "${CMake_BINARY_DIR}/Tests/SubDirSpaces" --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDirSpaces/Executable Sources" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project SUBDIR --test-command test "${CMake_BINARY_DIR}/Tests/SubDirSpaces/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDirSpaces/testfromsubdir.obj" ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDirSpaces") - ENDIF (MAKE_IS_GNU OR - "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR - "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDirSpaces") + endif () - IF (WIN32) - ADD_TEST(SubDir ${CMAKE_CTEST_COMMAND} + if (WIN32) + add_test(SubDir ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDir" "${CMake_BINARY_DIR}/Tests/SubDir" --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project SUBDIR --test-command test "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.obj" ) - ELSE (WIN32) - ADD_TEST(SubDir ${CMAKE_CTEST_COMMAND} + else () + add_test(SubDir ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDir" "${CMake_BINARY_DIR}/Tests/SubDir" --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project SUBDIR --test-command test "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.o" ) - ENDIF (WIN32) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir") + endif () + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir") - IF(CMAKE_TEST_MSVC) + if(CMAKE_TEST_MSVC) ADD_TEST_MACRO(ForceInclude foo) + ADD_TEST_MACRO(PDBDirectoryAndName myexe) ADD_TEST_MACRO(PrecompiledHeader foo) - ENDIF() - IF(CMAKE_TEST_MSVC OR + endif() + if(CMAKE_TEST_MSVC OR "${CMAKE_TEST_GENERATOR}" MATCHES "(MSYS|MinGW) Makefiles") ADD_TEST_MACRO(ModuleDefinition example_exe) - ENDIF() + endif() ADD_TEST_MACRO(CheckCompilerRelatedVariables CheckCompilerRelatedVariables) - IF("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile") - ADD_TEST(MakeClean ${CMAKE_CTEST_COMMAND} + if("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile") + add_test(MakeClean ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/MakeClean" "${CMake_BINARY_DIR}/Tests/MakeClean" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project MakeClean - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/MakeClean" --test-command check_clean ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MakeClean") - ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MakeClean") + endif() if(NOT DEFINED CTEST_RUN_MFC) set(CTEST_RUN_MFC OFF) @@ -1372,53 +1436,77 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_SOURCE_DIR}/Tests/MFC" "${CMake_BINARY_DIR}/Tests/MFC" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project mfc_driver - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -VV) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MFC") endif() - IF(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio") - IF(NOT MSVC60) + if(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio") + if(NOT MSVC60) ADD_TEST_MACRO(SBCS SBCS) - ENDIF(NOT MSVC60) + endif() - ADD_TEST(VSExternalInclude ${CMAKE_CTEST_COMMAND} + add_test(VSExternalInclude ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VSExternalInclude" "${CMake_BINARY_DIR}/Tests/VSExternalInclude" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project VSExternalInclude - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command VSExternalInclude) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSExternalInclude") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSExternalInclude") - ADD_TEST(VSMidl ${CMAKE_CTEST_COMMAND} + add_test(VSMidl ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VSMidl" "${CMake_BINARY_DIR}/Tests/VSMidl" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project VSMidl - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command VSMidl) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSMidl") - ENDIF(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSMidl") + + if(NOT MSVC60 AND NOT CMAKE_TEST_MAKEPROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]") + # The test (and tested property) works with .sln files, so it's skipped when: + # * Using VS6, which doesn't use .sln files + # * cmake --build is set up to use MSBuild, since the MSBuild invocation does not use the .sln file + set(_last_test "") + foreach(config ${CMAKE_CONFIGURATION_TYPES}) + add_test(NAME VSExcludeFromDefaultBuild-${config} COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/VSExcludeFromDefaultBuild" + "${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild" + --build-config ${config} + --build-two-config + ${build_generator_args} + --build-project VSExcludeFromDefaultBuild + --test-command ${CMAKE_COMMAND} + -D "activeConfig=${config}" + -D "allConfigs=${CMAKE_CONFIGURATION_TYPES}" + -D "dir=${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild" + -P "${CMake_SOURCE_DIR}/Tests/VSExcludeFromDefaultBuild/ResultTest.cmake") + if(_last_test) + set_property(TEST VSExcludeFromDefaultBuild-${config} PROPERTY DEPENDS ${_last_test}) + endif() + set(_last_test "VSExcludeFromDefaultBuild-${config}") + endforeach() + unset(_last_test) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild") + endif() + endif() - IF (APPLE) + if (APPLE) if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - SET(BundleTestInstallDir + set(BundleTestInstallDir "${CMake_BINARY_DIR}/Tests/BundleTest/InstallDirectory") - ADD_TEST(BundleTest ${CMAKE_CTEST_COMMAND} + add_test(BundleTest ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/BundleTest" "${CMake_BINARY_DIR}/Tests/BundleTest" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project BundleTest --build-target install # --build-target package @@ -1426,318 +1514,310 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}" --test-command ${BundleTestInstallDir}/Applications/SecondBundleExe.app/Contents/MacOS/SecondBundleExe) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleTest") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleTest") - ADD_TEST(CFBundleTest ${CMAKE_CTEST_COMMAND} + add_test(CFBundleTest ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CFBundleTest" "${CMake_BINARY_DIR}/Tests/CFBundleTest" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project CFBundleTest --test-command ${CMAKE_CMAKE_COMMAND} -DCTEST_CONFIGURATION_TYPE=\${CTEST_CONFIGURATION_TYPE} -Ddir=${CMake_BINARY_DIR}/Tests/CFBundleTest -Dgen=${CMAKE_TEST_GENERATOR} -P ${CMake_SOURCE_DIR}/Tests/CFBundleTest/VerifyResult.cmake) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CFBundleTest") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CFBundleTest") ADD_TEST_MACRO(ObjC++ ObjC++) - ENDIF (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - ENDIF (APPLE) + endif () + endif () - IF(APPLE AND CTEST_TEST_CPACK) - ADD_TEST(BundleGeneratorTest ${CMAKE_CTEST_COMMAND} + if(APPLE AND CTEST_TEST_CPACK) + add_test(BundleGeneratorTest ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/BundleGeneratorTest" "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-project BundleGeneratorTest --build-target package --build-options "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/BundleGeneratorTest/InstallDirectory" ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest") - ENDIF(APPLE AND CTEST_TEST_CPACK) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest") + endif() - ADD_TEST(WarnUnusedUnusedViaSet ${CMAKE_CTEST_COMMAND} + add_test(WarnUnusedUnusedViaSet ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VariableUnusedViaSet" "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaSet" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-noclean --build-project WarnUnusedUnusedViaSet --build-options "--warn-unused-vars") - SET_TESTS_PROPERTIES(WarnUnusedUnusedViaSet PROPERTIES + set_tests_properties(WarnUnusedUnusedViaSet PROPERTIES PASS_REGULAR_EXPRESSION "unused variable \\(changing definition\\) 'UNUSED_VARIABLE'") - SET_TESTS_PROPERTIES(WarnUnusedUnusedViaSet PROPERTIES + set_tests_properties(WarnUnusedUnusedViaSet PROPERTIES FAIL_REGULAR_EXPRESSION "unused variable \\(unsetting\\) 'UNUSED_VARIABLE'") - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaSet") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaSet") - ADD_TEST(WarnUnusedUnusedViaUnset ${CMAKE_CTEST_COMMAND} + add_test(WarnUnusedUnusedViaUnset ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VariableUnusedViaUnset" "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-noclean --build-project WarnUnusedUnusedViaUnset --build-options "--warn-unused-vars") - SET_TESTS_PROPERTIES(WarnUnusedUnusedViaUnset PROPERTIES - PASS_REGULAR_EXPRESSION "CMake Warning .*:7 \\(set\\):") - SET_TESTS_PROPERTIES(WarnUnusedUnusedViaUnset PROPERTIES - FAIL_REGULAR_EXPRESSION "CMake Warning .*:5 \\(set\\):") - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset") + set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES + PASS_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:7 \\(set\\):") + set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES + FAIL_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:5 \\(set\\):") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset") - ADD_TEST(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND} + add_test(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VariableUsage" "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-noclean --build-project WarnUnusedCliUnused --build-options "-DUNUSED_CLI_VARIABLE=Unused") - SET_TESTS_PROPERTIES(WarnUnusedCliUnused PROPERTIES + set_tests_properties(WarnUnusedCliUnused PROPERTIES PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.* UNUSED_CLI_VARIABLE") - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused") - ADD_TEST(WarnUnusedCliUsed ${CMAKE_CTEST_COMMAND} + add_test(WarnUnusedCliUsed ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VariableUsage" "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUsed" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-noclean --build-project WarnUnusedCliUsed --build-options "-DUSED_VARIABLE=Usage proven") - SET_TESTS_PROPERTIES(WarnUnusedCliUsed PROPERTIES + set_tests_properties(WarnUnusedCliUsed PROPERTIES PASS_REGULAR_EXPRESSION "Usage proven") - SET_TESTS_PROPERTIES(WarnUnusedCliUsed PROPERTIES + set_tests_properties(WarnUnusedCliUsed PROPERTIES FAIL_REGULAR_EXPRESSION "CMake Warning: The variable, 'USED_VARIABLE'") - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUsed") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUsed") - ADD_TEST(WarnUninitialized ${CMAKE_CTEST_COMMAND} + add_test(WarnUninitialized ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VariableUsage" "${CMake_BINARY_DIR}/Tests/WarnUninitialized" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ${build_generator_args} --build-noclean --build-project WarnUninitialized --build-options "--warn-uninitialized") - SET_TESTS_PROPERTIES(WarnUninitialized PROPERTIES + set_tests_properties(WarnUninitialized PROPERTIES PASS_REGULAR_EXPRESSION "uninitialized variable 'USED_VARIABLE'") - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUninitialized") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUninitialized") - ADD_TEST(TestsWorkingDirectory ${CMAKE_CTEST_COMMAND} + add_test(TestsWorkingDirectory ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/TestsWorkingDirectory" "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project TestsWorkingDirectoryProj - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory" --force-new-ctest-process --test-command ${CMAKE_CTEST_COMMAND} -V -C \${CTEST_CONFIGURATION_TYPE} ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory") # Make sure CTest can handle a test with no newline in output. - ADD_TEST(CTest.NoNewline + add_test(CTest.NoNewline ${CMAKE_CMAKE_COMMAND} -E echo_append "This line has no newline!") # A simple test for ctest in script mode - CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in" + configure_file("${CMake_SOURCE_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake" @ONLY) -# ADD_TEST(CTest.ScriptMode ${CMAKE_CTEST_COMMAND} +# add_test(CTest.ScriptMode ${CMAKE_CTEST_COMMAND} # -S "${CMake_BINARY_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake" # ) - SET(CTEST_TEST_UPDATE 1) - IF(CTEST_TEST_UPDATE) + set(CTEST_TEST_UPDATE 1) + if(CTEST_TEST_UPDATE) # Test CTest Update with Subversion - FIND_PACKAGE(Subversion QUIET) - IF(Subversion_FOUND) - GET_FILENAME_COMPONENT(_Subversion_BIN_DIR + find_package(Subversion QUIET) + if(Subversion_FOUND) + get_filename_component(_Subversion_BIN_DIR ${Subversion_SVN_EXECUTABLE} PATH) - FIND_PROGRAM(Subversion_SVNADMIN_EXECUTABLE svnadmin + find_program(Subversion_SVNADMIN_EXECUTABLE svnadmin HINTS ${_Subversion_BIN_DIR} ) - MARK_AS_ADVANCED(Subversion_SVNADMIN_EXECUTABLE) - IF(NOT Subversion_SVNADMIN_EXECUTABLE) - SET(Subversion_FOUND FALSE) - ENDIF(NOT Subversion_SVNADMIN_EXECUTABLE) - ENDIF(Subversion_FOUND) - IF(Subversion_FOUND) - SET(CTestUpdateSVN_DIR "CTest UpdateSVN") - CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateSVN.cmake.in" + mark_as_advanced(Subversion_SVNADMIN_EXECUTABLE) + if(NOT Subversion_SVNADMIN_EXECUTABLE) + set(Subversion_FOUND FALSE) + endif() + endif() + if(Subversion_FOUND) + set(CTestUpdateSVN_DIR "CTest UpdateSVN") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateSVN.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestUpdateSVN.cmake" @ONLY) - ADD_TEST(CTest.UpdateSVN ${CMAKE_CMAKE_COMMAND} + add_test(CTest.UpdateSVN ${CMAKE_CMAKE_COMMAND} -P "${CMake_BINARY_DIR}/Tests/CTestUpdateSVN.cmake" ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateSVN_DIR}") - ENDIF(Subversion_FOUND) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateSVN_DIR}") + endif() # Test CTest Update with CVS - IF(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) - FIND_PACKAGE(CVS QUIET) - ELSE(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) - FIND_PROGRAM(CVS_EXECUTABLE NAMES cvs) - SET(CVS_FOUND ${CVS_EXECUTABLE}) - ENDIF(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) - SET(CTEST_TEST_UPDATE_CVS ${CVS_FOUND}) - IF(CTEST_TEST_UPDATE_CVS AND NOT UNIX) - IF("${CVS_EXECUTABLE}" MATCHES "cygwin") - MESSAGE(STATUS "No CTest.UpdateCVS test with cygwin cvs.exe outside cygwin!") - SET(CTEST_TEST_UPDATE_CVS 0) - ENDIF("${CVS_EXECUTABLE}" MATCHES "cygwin") - ENDIF(CTEST_TEST_UPDATE_CVS AND NOT UNIX) - IF(CTEST_TEST_UPDATE_CVS) - SET(CTestUpdateCVS_DIR "CTest UpdateCVS") - CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateCVS.cmake.in" + if(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) + find_package(CVS QUIET) + else() + find_program(CVS_EXECUTABLE NAMES cvs) + set(CVS_FOUND ${CVS_EXECUTABLE}) + endif() + set(CTEST_TEST_UPDATE_CVS ${CVS_FOUND}) + if(CTEST_TEST_UPDATE_CVS AND NOT UNIX) + if("${CVS_EXECUTABLE}" MATCHES "cygwin") + message(STATUS "No CTest.UpdateCVS test with cygwin cvs.exe outside cygwin!") + set(CTEST_TEST_UPDATE_CVS 0) + endif() + endif() + if(CTEST_TEST_UPDATE_CVS) + set(CTestUpdateCVS_DIR "CTest UpdateCVS") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateCVS.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake" @ONLY) - ADD_TEST(CTest.UpdateCVS ${CMAKE_CMAKE_COMMAND} + add_test(CTest.UpdateCVS ${CMAKE_CMAKE_COMMAND} -P "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake" ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateCVS_DIR}") - ENDIF(CTEST_TEST_UPDATE_CVS) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateCVS_DIR}") + endif() # Test CTest Update with BZR - FIND_PROGRAM(BZR_EXECUTABLE NAMES bzr) - MARK_AS_ADVANCED(BZR_EXECUTABLE) - SET(CTEST_TEST_UPDATE_BZR 0) - IF(BZR_EXECUTABLE) - IF(NOT "${BZR_EXECUTABLE}" MATCHES "cygwin" OR UNIX) - SET(CTEST_TEST_UPDATE_BZR 1) - ENDIF(NOT "${BZR_EXECUTABLE}" MATCHES "cygwin" OR UNIX) - ENDIF(BZR_EXECUTABLE) - IF(CTEST_TEST_UPDATE_BZR) + find_program(BZR_EXECUTABLE NAMES bzr) + mark_as_advanced(BZR_EXECUTABLE) + set(CTEST_TEST_UPDATE_BZR 0) + if(BZR_EXECUTABLE) + if(NOT "${BZR_EXECUTABLE}" MATCHES "cygwin" OR UNIX) + set(CTEST_TEST_UPDATE_BZR 1) + endif() + endif() + if(CTEST_TEST_UPDATE_BZR) # Check if xmloutput plugin is there - EXECUTE_PROCESS(COMMAND ${BZR_EXECUTABLE} xmlplugins RESULT_VARIABLE xmlplugres + execute_process(COMMAND ${BZR_EXECUTABLE} xmlplugins RESULT_VARIABLE xmlplugres OUTPUT_QUIET ERROR_QUIET) - IF( NOT ${xmlplugres} ) - SET(CTestUpdateBZR_DIR "CTest UpdateBZR") - CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateBZR.cmake.in" + if( NOT ${xmlplugres} ) + set(CTestUpdateBZR_DIR "CTest UpdateBZR") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateBZR.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR.cmake" @ONLY) - ADD_TEST(CTest.UpdateBZR ${CMAKE_CMAKE_COMMAND} + add_test(CTest.UpdateBZR ${CMAKE_CMAKE_COMMAND} -P "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR.cmake" ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateBZR_DIR}") - SET(CTestUpdateBZR_DIR "CTest UpdateBZR_CLocale") - CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateBZR.cmake.in" + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateBZR_DIR}") + set(CTestUpdateBZR_DIR "CTest UpdateBZR_CLocale") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateBZR.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR_CLocale.cmake" @ONLY) - ADD_TEST(CTest.UpdateBZR.CLocale ${CMAKE_CMAKE_COMMAND} + add_test(CTest.UpdateBZR.CLocale ${CMAKE_CMAKE_COMMAND} -P "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR_CLocale.cmake" ) - SET_TESTS_PROPERTIES(CTest.UpdateBZR.CLocale PROPERTIES ENVIRONMENT LC_ALL=C) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateBZR_DIR}") - ENDIF( NOT ${xmlplugres} ) - ENDIF(CTEST_TEST_UPDATE_BZR) + set_tests_properties(CTest.UpdateBZR.CLocale PROPERTIES ENVIRONMENT LC_ALL=C) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateBZR_DIR}") + endif() + endif() # Test CTest Update with GIT - FIND_PROGRAM(GIT_EXECUTABLE NAMES git) - MARK_AS_ADVANCED(GIT_EXECUTABLE) - SET(CTEST_TEST_UPDATE_GIT 0) - IF(GIT_EXECUTABLE) - IF(NOT "${GIT_EXECUTABLE}" MATCHES "cygwin" OR UNIX) - SET(CTEST_TEST_UPDATE_GIT 1) - ENDIF(NOT "${GIT_EXECUTABLE}" MATCHES "cygwin" OR UNIX) - ENDIF(GIT_EXECUTABLE) - IF(CTEST_TEST_UPDATE_GIT) - SET(CTestUpdateGIT_DIR "CTest UpdateGIT") - CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateGIT.cmake.in" + find_program(GIT_EXECUTABLE NAMES git) + mark_as_advanced(GIT_EXECUTABLE) + set(CTEST_TEST_UPDATE_GIT 0) + if(GIT_EXECUTABLE) + if(NOT "${GIT_EXECUTABLE}" MATCHES "cygwin" OR UNIX) + set(CTEST_TEST_UPDATE_GIT 1) + endif() + endif() + if(CTEST_TEST_UPDATE_GIT) + set(CTestUpdateGIT_DIR "CTest UpdateGIT") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateGIT.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestUpdateGIT.cmake" @ONLY) - ADD_TEST(CTest.UpdateGIT ${CMAKE_CMAKE_COMMAND} + add_test(CTest.UpdateGIT ${CMAKE_CMAKE_COMMAND} -P "${CMake_BINARY_DIR}/Tests/CTestUpdateGIT.cmake" ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateGIT_DIR}") - ENDIF(CTEST_TEST_UPDATE_GIT) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateGIT_DIR}") + endif() # Test CTest Update with HG - FIND_PROGRAM(HG_EXECUTABLE NAMES hg) - MARK_AS_ADVANCED(HG_EXECUTABLE) - SET(CTEST_TEST_UPDATE_HG 0) - IF(HG_EXECUTABLE) - IF(NOT "${HG_EXECUTABLE}" MATCHES "cygwin" OR UNIX) - SET(CTEST_TEST_UPDATE_HG 1) - ENDIF(NOT "${HG_EXECUTABLE}" MATCHES "cygwin" OR UNIX) - ENDIF(HG_EXECUTABLE) - IF(CTEST_TEST_UPDATE_HG) - SET(CTestUpdateHG_DIR "CTest UpdateHG") - CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateHG.cmake.in" + find_program(HG_EXECUTABLE NAMES hg) + mark_as_advanced(HG_EXECUTABLE) + set(CTEST_TEST_UPDATE_HG 0) + if(HG_EXECUTABLE) + if(NOT "${HG_EXECUTABLE}" MATCHES "cygwin" OR UNIX) + set(CTEST_TEST_UPDATE_HG 1) + endif() + endif() + if(CTEST_TEST_UPDATE_HG) + set(CTestUpdateHG_DIR "CTest UpdateHG") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateHG.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestUpdateHG.cmake" @ONLY) - ADD_TEST(CTest.UpdateHG ${CMAKE_CMAKE_COMMAND} + add_test(CTest.UpdateHG ${CMAKE_CMAKE_COMMAND} -P "${CMake_BINARY_DIR}/Tests/CTestUpdateHG.cmake" ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateHG_DIR}") - ENDIF(CTEST_TEST_UPDATE_HG) - ENDIF(CTEST_TEST_UPDATE) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateHG_DIR}") + endif() + endif() - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestFailure/testNoBuild.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testNoBuild.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestNoBuild ${CMAKE_CTEST_COMMAND} + add_test(CTestTestNoBuild ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testNoBuild.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testOut1.log" ) - SET_TESTS_PROPERTIES(CTestTestNoBuild PROPERTIES + set_tests_properties(CTestTestNoBuild PROPERTIES FAIL_REGULAR_EXPRESSION "Error" WILL_FAIL true) - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestFailure/testNoExe.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testNoExe.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestNoExe ${CMAKE_CTEST_COMMAND} + add_test(CTestTestNoExe ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testNoExe.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testOut2.log" ) - SET_TESTS_PROPERTIES(CTestTestNoExe PROPERTIES DEPENDS CTestTestNoBuild + set_tests_properties(CTestTestNoExe PROPERTIES DEPENDS CTestTestNoBuild PASS_REGULAR_EXPRESSION "Could not find executable" FAIL_REGULAR_EXPRESSION "SegFault") - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestUpload/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestUpload/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestUpload ${CMAKE_CTEST_COMMAND} + add_test(CTestTestUpload ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestUpload/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestUpload/testOut.log" ) - SET_TESTS_PROPERTIES(CTestTestUpload PROPERTIES + set_tests_properties(CTestTestUpload PROPERTIES PASS_REGULAR_EXPRESSION "Upload\\.xml") - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/test1.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestConfigFileInBuildDir1 ${CMAKE_CTEST_COMMAND} + add_test(CTestTestConfigFileInBuildDir1 ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/test1.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/testOut1.log" ) REGEX_ESCAPE_STRING(CTEST_TEST_ESCAPED_SOURCE_DIR "${CMake_SOURCE_DIR}") - SET_TESTS_PROPERTIES(CTestTestConfigFileInBuildDir1 PROPERTIES DEPENDS CTestTestNoBuild + set_tests_properties(CTestTestConfigFileInBuildDir1 PROPERTIES DEPENDS CTestTestNoBuild PASS_REGULAR_EXPRESSION "Reading ctest configuration file: ${CTEST_TEST_ESCAPED_SOURCE_DIR}.Tests.CTestTestConfigFileInBuildDir.CTestConfig.cmake") - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/test2.cmake" @ONLY ESCAPE_QUOTES) - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/CTestConfig.cmake" "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/CTestConfig.cmake" @ONLY ESCAPE_QUOTES COPYONLY) - ADD_TEST(CTestTestConfigFileInBuildDir2 ${CMAKE_CTEST_COMMAND} + add_test(CTestTestConfigFileInBuildDir2 ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/test2.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/testOut2.log" ) REGEX_ESCAPE_STRING(CTEST_TEST_ESCAPED_BINARY_DIR "${CMake_BINARY_DIR}") - SET_TESTS_PROPERTIES(CTestTestConfigFileInBuildDir2 PROPERTIES DEPENDS CTestTestNoBuild + set_tests_properties(CTestTestConfigFileInBuildDir2 PROPERTIES DEPENDS CTestTestNoBuild REQUIRED_FILES ${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/CTestConfig.cmake PASS_REGULAR_EXPRESSION "Reading ctest configuration file: ${CTEST_TEST_ESCAPED_BINARY_DIR}.Tests.CTestTestConfigFileInBuildDir2.CTestConfig.cmake") @@ -1828,176 +1908,182 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ) ADD_TEST_MACRO(CMakeCommands.target_link_libraries target_link_libraries) + ADD_TEST_MACRO(CMakeCommands.target_include_directories target_include_directories) + ADD_TEST_MACRO(CMakeCommands.target_compile_definitions target_compile_definitions) - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestCrash/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestCrash/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestCrash ${CMAKE_CTEST_COMMAND} + add_test(CTestTestCrash ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestCrash/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestCrash/testOutput.log" ) # with watcom the SEGFAULT is not found, it just fails - IF(CMAKE_TEST_GENERATOR MATCHES "Watcom WMake") - SET_TESTS_PROPERTIES(CTestTestCrash PROPERTIES + if(CMAKE_TEST_GENERATOR MATCHES "Watcom WMake") + set_tests_properties(CTestTestCrash PROPERTIES PASS_REGULAR_EXPRESSION "Failed") - ELSE(CMAKE_TEST_GENERATOR MATCHES "Watcom WMake") - SET_TESTS_PROPERTIES(CTestTestCrash PROPERTIES + else() + set_tests_properties(CTestTestCrash PROPERTIES PASS_REGULAR_EXPRESSION "(Illegal|SegFault)") - ENDIF(CMAKE_TEST_GENERATOR MATCHES "Watcom WMake") + endif() - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestBadExe/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestBadExe/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestBadExe ${CMAKE_CTEST_COMMAND} + add_test(CTestTestBadExe ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestBadExe/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestBadExe/testOutput.log" ) - SET(CTestTestBadExe_REGEX "BAD_COMMAND") + set(CTestTestBadExe_REGEX "BAD_COMMAND") # some cygwin can not be made to produce a BAD_COMMAND error # the best we can get from it is a failed test - IF(CYGWIN) - SET(CTestTestBadExe_REGEX "(\\*\\*\\*Failed)|BAD_COMMAND") - ENDIF() - SET_TESTS_PROPERTIES(CTestTestBadExe PROPERTIES + if(CYGWIN) + set(CTestTestBadExe_REGEX "(\\*\\*\\*Failed)|BAD_COMMAND") + endif() + set_tests_properties(CTestTestBadExe PROPERTIES PASS_REGULAR_EXPRESSION "${CTestTestBadExe_REGEX}") - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestParallel/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestParallel/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestParallel ${CMAKE_CTEST_COMMAND} + add_test(CTestTestParallel ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestParallel/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestParallel/testOutput.log" ) - ADD_TEST(CTestTestPrintLabels ${CMAKE_CTEST_COMMAND} --print-labels) - SET_TESTS_PROPERTIES(CTestTestPrintLabels PROPERTIES LABELS "Label1;Label2") - SET_TESTS_PROPERTIES(CTestTestPrintLabels PROPERTIES PASS_REGULAR_EXPRESSION + set(CTestLimitDashJ_EXTRA_OPTIONS --force-new-ctest-process) + add_test_macro(CTestLimitDashJ ${CMAKE_CTEST_COMMAND} -j 4 + --output-on-failure -C "\${CTestTest_CONFIG}") + + add_test(CTestTestPrintLabels ${CMAKE_CTEST_COMMAND} --print-labels) + set_tests_properties(CTestTestPrintLabels PROPERTIES LABELS "Label1;Label2") + set_tests_properties(CTestTestPrintLabels PROPERTIES PASS_REGULAR_EXPRESSION "All Labels:.* Label1.* Label2") - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestResourceLock/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestResourceLock/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestResourceLock ${CMAKE_CTEST_COMMAND} + add_test(CTestTestResourceLock ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestResourceLock/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestResourceLock/output.log" ) - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestScheduler/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestScheduler/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestScheduler ${CMAKE_CTEST_COMMAND} + add_test(CTestTestScheduler ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestScheduler/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestScheduler/testOutput.log" ) - SET_TESTS_PROPERTIES(CTestTestScheduler PROPERTIES + set_tests_properties(CTestTestScheduler PROPERTIES PASS_REGULAR_EXPRESSION "Start 1.*Start 2.*Start 3.*Start 4.*Start 4.*Start 3.*Start 2.*Start 1" RESOURCE_LOCK "CostData") - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestCostSerial/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestCostSerial/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestCostSerial ${CMAKE_CTEST_COMMAND} + add_test(CTestTestCostSerial ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestCostSerial/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestCostSerial/testOutput.log" ) - SET_TESTS_PROPERTIES(CTestTestCostSerial PROPERTIES + set_tests_properties(CTestTestCostSerial PROPERTIES PASS_REGULAR_EXPRESSION "Start 2.*Start 3.*Start 1.*Start 2.*Start 3.*Start 1" RESOURCE_LOCK "CostData") - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestStopTime/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestStopTime/test.cmake" @ONLY ESCAPE_QUOTES) - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestStopTime/GetDate.cmake" "${CMake_BINARY_DIR}/Tests/CTestTestStopTime/GetDate.cmake" COPYONLY) - ADD_TEST(CTestTestStopTime ${CMAKE_CTEST_COMMAND} + add_test(CTestTestStopTime ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestStopTime/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestStopTime/testOutput.log" ) - SET_TESTS_PROPERTIES(CTestTestStopTime PROPERTIES + set_tests_properties(CTestTestStopTime PROPERTIES PASS_REGULAR_EXPRESSION "The stop time has been passed") - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestSubdir/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestSubdir ${CMAKE_CTEST_COMMAND} + add_test(CTestTestSubdir ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/testOutput.log" ) #make sure all 3 subdirs were added - SET_TESTS_PROPERTIES(CTestTestSubdir PROPERTIES + set_tests_properties(CTestTestSubdir PROPERTIES PASS_REGULAR_EXPRESSION "0 tests failed out of 3") - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestTimeout/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestTimeout ${CMAKE_CTEST_COMMAND} + add_test(CTestTestTimeout ${CMAKE_CTEST_COMMAND} -C "\${CTestTest_CONFIG}" -S "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/testOutput.log" ) - SET_TESTS_PROPERTIES(CTestTestTimeout PROPERTIES + set_tests_properties(CTestTestTimeout PROPERTIES PASS_REGULAR_EXPRESSION "TestTimeout *\\.+ *\\*\\*\\*Timeout.*CheckChild *\\.+ *Passed") - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestZeroTimeout/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestZeroTimeout ${CMAKE_CTEST_COMMAND} + add_test(CTestTestZeroTimeout ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/testOutput.log") - SET_TESTS_PROPERTIES(CTestTestZeroTimeout PROPERTIES + set_tests_properties(CTestTestZeroTimeout PROPERTIES FAIL_REGULAR_EXPRESSION "\\*\\*\\*Timeout") - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestDepends/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestDepends/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestDepends ${CMAKE_CTEST_COMMAND} + add_test(CTestTestDepends ${CMAKE_CTEST_COMMAND} -C "\${CTestTest_CONFIG}" -S "${CMake_BINARY_DIR}/Tests/CTestTestDepends/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestDepends/testOutput.log" ) - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestCycle/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestCycle/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestCycle ${CMAKE_CTEST_COMMAND} + add_test(CTestTestCycle ${CMAKE_CTEST_COMMAND} -C "\${CTestTest_CONFIG}" -S "${CMake_BINARY_DIR}/Tests/CTestTestCycle/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestCycle/testOutput.log" ) - SET_TESTS_PROPERTIES(CTestTestCycle PROPERTIES + set_tests_properties(CTestTestCycle PROPERTIES PASS_REGULAR_EXPRESSION "a cycle exists in the test dependency graph") - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestRunScript/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/test.cmake" @ONLY ESCAPE_QUOTES) - CONFIGURE_FILE( + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestRunScript/hello.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/hello.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestRunScript ${CMAKE_CTEST_COMMAND} + add_test(CTestTestRunScript ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/testOutput.log" ) - ADD_TEST(CTestTestShowOnly ${CMAKE_CTEST_COMMAND} -N) + add_test(CTestTestShowOnly ${CMAKE_CTEST_COMMAND} -N) - ADD_TEST(CTestBatchTest ${CMAKE_CTEST_COMMAND} -B) + add_test(CTestBatchTest ${CMAKE_CTEST_COMMAND} -B) # Use macro, not function so that build can still be driven by CMake 2.4. # After 2.6 is required, this could be a function without the extra 'set' @@ -2048,120 +2134,83 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ endforeach() - IF (CMAKE_TESTS_CDASH_SERVER) - SET(regex "^([^:]+)://([^/]+)(/.*)$") + if (CMAKE_TESTS_CDASH_SERVER) + set(regex "^([^:]+)://([^/]+)(/.*)$") - IF ("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}") - SET(protocol "${CMAKE_MATCH_1}") - SET(server "${CMAKE_MATCH_2}") - SET(path "${CMAKE_MATCH_3}") - ELSE ("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}") - SET(protocol "http") - SET(server "www.cdash.org") - SET(path "/CDash") - MESSAGE("warning: CMAKE_TESTS_CDASH_SERVER does not match expected regex...") - MESSAGE(" ...using default url='${protocol}://${server}${path}' for CTestTest[23]") - ENDIF ("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}") - ENDIF (CMAKE_TESTS_CDASH_SERVER) + if ("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}") + set(protocol "${CMAKE_MATCH_1}") + set(server "${CMAKE_MATCH_2}") + set(path "${CMAKE_MATCH_3}") + else () + set(protocol "http") + set(server "www.cdash.org") + set(path "/CDash") + message("warning: CMAKE_TESTS_CDASH_SERVER does not match expected regex...") + message(" ...using default url='${protocol}://${server}${path}' for CTestTest[23]") + endif () + endif () - IF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER) - CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in" + if (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER) + configure_file("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTest ${CMAKE_CTEST_COMMAND} + add_test(CTestTest ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTest/testOutput.log" ) - CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest2/test.cmake.in" + configure_file("${CMake_SOURCE_DIR}/Tests/CTestTest2/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTest2/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTest2 ${CMAKE_CTEST_COMMAND} + add_test(CTestTest2 ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTest2/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log" ) - CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTestChecksum/test.cmake.in" + configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestChecksum/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestChecksum/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTestChecksum ${CMAKE_CTEST_COMMAND} + add_test(CTestTestChecksum ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestChecksum/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestChecksum/testOutput.log" ) - SET_TESTS_PROPERTIES(CTestTestChecksum PROPERTIES PASS_REGULAR_EXPRESSION + set_tests_properties(CTestTestChecksum PROPERTIES PASS_REGULAR_EXPRESSION "Submission failed: Checksum failed for file") # these tests take a long time, make sure they have it # if timeouts have not already been set - GET_TEST_PROPERTY(CTestTest TIMEOUT PREVIOUS_TIMEOUT) - IF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - SET_TESTS_PROPERTIES ( CTestTest + get_test_property(CTestTest TIMEOUT PREVIOUS_TIMEOUT) + if ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) + set_tests_properties ( CTestTest PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) - ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) + endif () - GET_TEST_PROPERTY(CTestTest2 TIMEOUT PREVIOUS_TIMEOUT) - IF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - SET_TESTS_PROPERTIES ( CTestTest2 + get_test_property(CTestTest2 TIMEOUT PREVIOUS_TIMEOUT) + if ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) + set_tests_properties ( CTestTest2 PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) - ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - ENDIF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER) - - IF (CMAKE_RUN_LONG_TESTS AND TEST_KDE4_STABLE_BRANCH) - IF(UNIX) - IF(NOT QT4_FOUND) - FIND_PACKAGE(Qt4) - ENDIF(NOT QT4_FOUND) - - SET(TRY_BUILD_KDE4 TRUE) - IF(QT4_FOUND) - # check whether it's Qt 4.5 in a cmake 2.4. compatible way: - IF(NOT EXISTS "${QT_QTNETWORK_INCLUDE_DIR}/QAbstractNetworkCache") - SET(TRY_BUILD_KDE4 FALSE) - ENDIF(NOT EXISTS "${QT_QTNETWORK_INCLUDE_DIR}/QAbstractNetworkCache") - ELSE(QT4_FOUND) - SET(TRY_BUILD_KDE4 FALSE) - ENDIF(QT4_FOUND) - - FIND_PACKAGE(Perl) - IF(NOT PERL_FOUND) - SET(TRY_BUILD_KDE4 FALSE) - ENDIF(NOT PERL_FOUND) - - FIND_PACKAGE(ZLIB) - IF(NOT ZLIB_FOUND) - SET(TRY_BUILD_KDE4 FALSE) - ENDIF(NOT ZLIB_FOUND) - - IF(TRY_BUILD_KDE4) - FILE(MAKE_DIRECTORY ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest) - SET(TEST_KDE4_BASE_DIR ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest) - CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh.in ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh @ONLY) - EXECUTE_PROCESS(COMMAND chmod 755 ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh ) - ADD_TEST(KDE4StableBranchTest ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh) - ENDIF(TRY_BUILD_KDE4) - - ENDIF(UNIX) - ENDIF (CMAKE_RUN_LONG_TESTS AND TEST_KDE4_STABLE_BRANCH) - - IF("${CMAKE_TEST_GENERATOR}" MATCHES Xcode) - SET(CMAKE_SKIP_BOOTSTRAP_TEST 1) - ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES Xcode) - IF(EXISTS "${CMake_BINARY_DIR}/CMakeLists.txt") + endif () + endif () + + if("${CMAKE_TEST_GENERATOR}" MATCHES Xcode) + set(CMAKE_SKIP_BOOTSTRAP_TEST 1) + endif() + if(EXISTS "${CMake_BINARY_DIR}/CMakeLists.txt") # If there is CMakeLists.txt in the binary tree, assume in-source build - SET(CMAKE_SKIP_BOOTSTRAP_TEST 1) - ENDIF(EXISTS "${CMake_BINARY_DIR}/CMakeLists.txt") - SET(bootstrap "") - IF(CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST) - IF(UNIX) - SET(bootstrap ${CMake_SOURCE_DIR}/bootstrap) - ELSEIF(MSYS) - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/bootstrap.bat.in + set(CMAKE_SKIP_BOOTSTRAP_TEST 1) + endif() + set(bootstrap "") + if(CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST) + if(UNIX) + set(bootstrap ${CMake_SOURCE_DIR}/bootstrap) + elseif(MSYS) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/bootstrap.bat.in ${CMAKE_CURRENT_BINARY_DIR}/bootstrap.bat @ONLY) - SET(bootstrap ${CMAKE_CURRENT_BINARY_DIR}/bootstrap.bat) - ENDIF() - ENDIF() - IF(bootstrap) - ADD_TEST(BootstrapTest ${CMAKE_CTEST_COMMAND} + set(bootstrap ${CMAKE_CURRENT_BINARY_DIR}/bootstrap.bat) + endif() + endif() + if(bootstrap) + add_test(BootstrapTest ${CMAKE_CTEST_COMMAND} --build-and-test ${CMake_SOURCE_DIR} ${CMake_BINARY_DIR}/Tests/BootstrapTest @@ -2171,172 +2220,167 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-generator "${CMAKE_TEST_GENERATOR}" --test-command ${CMake_BINARY_DIR}/Tests/BootstrapTest/Bootstrap.cmk/cmake) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BootstrapTest") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BootstrapTest") # Make this test run early during parallel execution - SET_TESTS_PROPERTIES(BootstrapTest PROPERTIES COST 5000) + set_tests_properties(BootstrapTest PROPERTIES COST 5000) # provide more time for the bootstrap test - GET_TEST_PROPERTY(BootstrapTest TIMEOUT PREVIOUS_TIMEOUT) - IF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - SET_TESTS_PROPERTIES ( BootstrapTest + get_test_property(BootstrapTest TIMEOUT PREVIOUS_TIMEOUT) + if ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) + set_tests_properties ( BootstrapTest PROPERTIES TIMEOUT 5400) - ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - ENDIF() + endif () + endif() - IF(CMAKE_Fortran_COMPILER) - ADD_TEST(Fortran ${CMAKE_CTEST_COMMAND} + if(CMAKE_Fortran_COMPILER) + add_test(Fortran ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Fortran" "${CMake_BINARY_DIR}/Tests/Fortran" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project testf - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --test-command testf) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Fortran") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Fortran") # FortranCInterface tests. - IF(UNIX) - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/FortranC/Flags.cmake.in + if(UNIX) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FortranC/Flags.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FortranC/Flags.cmake @ONLY) - ADD_TEST(FortranC.Flags ${CMAKE_CMAKE_COMMAND} -P + add_test(FortranC.Flags ${CMAKE_CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/FortranC/Flags.cmake) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranC/Flags") - ELSE() - ADD_TEST(FortranC ${CMAKE_CTEST_COMMAND} + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranC/Flags") + else() + add_test(FortranC ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/FortranC" "${CMake_BINARY_DIR}/Tests/FortranC" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project FortranC - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --test-command CMakeFiles/FortranCInterface/FortranCInterface) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranC") - ENDIF() - ENDIF() + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranC") + endif() + endif() find_package(Java COMPONENTS Development QUIET) - IF(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE AND Java_JAR_EXECUTABLE AND NOT MINGW + if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE AND Java_JAR_EXECUTABLE AND NOT MINGW AND NOT "${CMAKE_TEST_GENERATOR}" MATCHES "Xcode") - GET_FILENAME_COMPONENT(JNIPATH ${JAVA_COMPILE} PATH) - FIND_FILE(JNI_H jni.h + get_filename_component(JNIPATH ${JAVA_COMPILE} PATH) + find_file(JNI_H jni.h "${JNIPATH}/../include" "${JNIPATH}/../java/include") - IF(JNI_H AND EXISTS "${JNI_H}") # in case jni.h is a broken symlink - FILE(READ "${JNI_H}" JNI_FILE) - IF("${JNI_FILE}" MATCHES "JDK1_2") - ADD_TEST(Java ${CMAKE_CTEST_COMMAND} + if(JNI_H AND EXISTS "${JNI_H}") # in case jni.h is a broken symlink + file(READ "${JNI_H}" JNI_FILE) + if("${JNI_FILE}" MATCHES "JDK1_2") + add_test(Java ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Java" "${CMake_BINARY_DIR}/Tests/Java" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project hello - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --build-run-dir "${CMake_BINARY_DIR}/Tests/Java/" --test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Java") - ENDIF("${JNI_FILE}" MATCHES "JDK1_2") - ENDIF() - ENDIF() + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Java") + endif() + endif() + endif() # add some cross compiler tests, for now only with makefile based generators - IF(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop") + if(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop") # if sdcc is found, build the SimpleCOnly project with sdcc - FIND_PROGRAM(SDCC_EXECUTABLE sdcc) - MARK_AS_ADVANCED(SDCC_EXECUTABLE) - IF(SDCC_EXECUTABLE) - ADD_TEST(SimpleCOnly_sdcc ${CMAKE_CTEST_COMMAND} + find_program(SDCC_EXECUTABLE sdcc) + mark_as_advanced(SDCC_EXECUTABLE) + if(SDCC_EXECUTABLE) + add_test(SimpleCOnly_sdcc ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SimpleCOnly" "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project SimpleC - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-options "-DCMAKE_SYSTEM_NAME=Generic" "-DCMAKE_C_COMPILER=${SDCC_EXECUTABLE}") - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc") - ENDIF(SDCC_EXECUTABLE) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc") + endif() # If a Linux -> MinGW cross compiler is found then try it - FIND_PROGRAM(MINGW_CC_LINUX2WIN_EXECUTABLE i586-mingw32msvc-gcc) - FIND_PROGRAM(MINGW_CXX_LINUX2WIN_EXECUTABLE i586-mingw32msvc-g++) - FIND_PROGRAM(MINGW_RC_LINUX2WIN_EXECUTABLE i586-mingw32msvc-windres) - MARK_AS_ADVANCED(MINGW_CC_LINUX2WIN_EXECUTABLE MINGW_CXX_LINUX2WIN_EXECUTABLE MINGW_RC_LINUX2WIN_EXECUTABLE) - IF(MINGW_CC_LINUX2WIN_EXECUTABLE AND MINGW_CXX_LINUX2WIN_EXECUTABLE AND MINGW_RC_LINUX2WIN_EXECUTABLE) - ADD_TEST(Simple_Mingw_Linux2Win ${CMAKE_CTEST_COMMAND} + find_program(MINGW_CC_LINUX2WIN_EXECUTABLE i586-mingw32msvc-gcc) + find_program(MINGW_CXX_LINUX2WIN_EXECUTABLE i586-mingw32msvc-g++) + find_program(MINGW_RC_LINUX2WIN_EXECUTABLE i586-mingw32msvc-windres) + mark_as_advanced(MINGW_CC_LINUX2WIN_EXECUTABLE MINGW_CXX_LINUX2WIN_EXECUTABLE MINGW_RC_LINUX2WIN_EXECUTABLE) + if(MINGW_CC_LINUX2WIN_EXECUTABLE AND MINGW_CXX_LINUX2WIN_EXECUTABLE AND MINGW_RC_LINUX2WIN_EXECUTABLE) + add_test(Simple_Mingw_Linux2Win ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Simple" "${CMake_BINARY_DIR}/Tests/Simple_Mingw_Linux2Win" - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project Simple - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-options "-DCMAKE_SYSTEM_NAME=Windows" "-DCMAKE_C_COMPILER=${MINGW_CC_LINUX2WIN_EXECUTABLE}" "-DCMAKE_CXX_COMPILER=${MINGW_CXX_LINUX2WIN_EXECUTABLE}" "-DCMAKE_RC_COMPILER=${MINGW_RC_LINUX2WIN_EXECUTABLE}" ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_Mingw_Linux2Win") - ENDIF() - ENDIF(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_Mingw_Linux2Win") + endif() + endif() - IF(UNIX) - STRING(COMPARE EQUAL "${CMAKE_INSTALL_PREFIX}" "${CMake_BINARY_DIR}/Tests/TestShellInstall/Prefix" + if(UNIX) + string(COMPARE EQUAL "${CMAKE_INSTALL_PREFIX}" "${CMake_BINARY_DIR}/Tests/TestShellInstall/Prefix" PREFIX_IS_FOR_TEST) - IF(PREFIX_IS_FOR_TEST) - CONFIGURE_FILE( + if(PREFIX_IS_FOR_TEST) + configure_file( ${CMake_SOURCE_DIR}/Tests/TestInstall.sh.in ${CMake_BINARY_DIR}/Tests/TestShellInstall/TestInstall.sh @ONLY IMMEDIATE ) - ADD_TEST(ShellInstall /bin/sh ${CMake_BINARY_DIR}/Tests/TestShellInstall/TestShellInstall.sh) - ENDIF(PREFIX_IS_FOR_TEST) - ENDIF(UNIX) - - IF(CMAKE_TEST_PROJECT_CSE_DIR) - SET(script "${CMAKE_TEST_PROJECT_CSE_DIR}/BuildProjectCSE.cmake") - IF(NOT EXISTS "${script}") - SET(script "${CMAKE_TEST_PROJECT_CSE_DIR}/cse_build.cmake") - ENDIF(NOT EXISTS "${script}") - IF(NOT EXISTS "${script}") - MESSAGE("warning: CMAKE_TEST_PROJECT_CSE_DIR set, but no build script found...") - ENDIF(NOT EXISTS "${script}") - - ADD_TEST(BuildCSE ${CMAKE_CTEST_COMMAND} -V -S "${script}") - SET_TESTS_PROPERTIES(BuildCSE PROPERTIES TIMEOUT 5400) - ENDIF(CMAKE_TEST_PROJECT_CSE_DIR) - - IF(CMAKE_TEST_PLPLOT_DIR) - ADD_TEST(plplot ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_PLPLOT_DIR}/../../EasyDashboardScripts/plplot.cmake ) - SET_TESTS_PROPERTIES ( plplot PROPERTIES TIMEOUT 5400) - ENDIF(CMAKE_TEST_PLPLOT_DIR) - - IF(CMAKE_TEST_CHICKEN_DIR) - ADD_TEST(Chicken ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_CHICKEN_DIR}/../../EasyDashboardScripts/Chicken.cmake ) - SET_TESTS_PROPERTIES ( Chicken PROPERTIES TIMEOUT 5400) - ENDIF(CMAKE_TEST_CHICKEN_DIR) - - IF(CMAKE_TEST_KDELIBS_ALPHA_1_DIR) - ADD_TEST(KDELibsAlpha1 ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_KDELIBS_ALPHA_1_DIR}/../../EasyDashboardScripts/kdelibs.cmake ) - SET_TESTS_PROPERTIES ( KDELibsAlpha1 PROPERTIES TIMEOUT 5400) - ENDIF(CMAKE_TEST_KDELIBS_ALPHA_1_DIR) + add_test(ShellInstall /bin/sh ${CMake_BINARY_DIR}/Tests/TestShellInstall/TestShellInstall.sh) + endif() + endif() + + if(CMAKE_TEST_PROJECT_CSE_DIR) + set(script "${CMAKE_TEST_PROJECT_CSE_DIR}/BuildProjectCSE.cmake") + if(NOT EXISTS "${script}") + set(script "${CMAKE_TEST_PROJECT_CSE_DIR}/cse_build.cmake") + endif() + if(NOT EXISTS "${script}") + message("warning: CMAKE_TEST_PROJECT_CSE_DIR set, but no build script found...") + endif() + + add_test(BuildCSE ${CMAKE_CTEST_COMMAND} -V -S "${script}") + set_tests_properties(BuildCSE PROPERTIES TIMEOUT 5400) + endif() + + if(CMAKE_TEST_PLPLOT_DIR) + add_test(plplot ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_PLPLOT_DIR}/../../EasyDashboardScripts/plplot.cmake ) + set_tests_properties ( plplot PROPERTIES TIMEOUT 5400) + endif() + + if(CMAKE_TEST_CHICKEN_DIR) + add_test(Chicken ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_CHICKEN_DIR}/../../EasyDashboardScripts/Chicken.cmake ) + set_tests_properties ( Chicken PROPERTIES TIMEOUT 5400) + endif() + + if(CMAKE_TEST_KDELIBS_ALPHA_1_DIR) + add_test(KDELibsAlpha1 ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_KDELIBS_ALPHA_1_DIR}/../../EasyDashboardScripts/kdelibs.cmake ) + set_tests_properties ( KDELibsAlpha1 PROPERTIES TIMEOUT 5400) + endif() # If this is not an in-source build, provide a target to wipe out # all the test build directories. - IF(NOT EXISTS "${CMake_BINARY_DIR}/CMakeLists.txt") - CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/test_clean.cmake.in + if(NOT EXISTS "${CMake_BINARY_DIR}/CMakeLists.txt") + configure_file(${CMake_SOURCE_DIR}/Tests/test_clean.cmake.in ${CMake_BINARY_DIR}/Tests/test_clean.cmake @ONLY) - ADD_CUSTOM_TARGET(test_clean + add_custom_target(test_clean COMMAND ${CMAKE_COMMAND} -P ${CMake_BINARY_DIR}/Tests/test_clean.cmake COMMENT "Removing test build directories." ) - ENDIF(NOT EXISTS "${CMake_BINARY_DIR}/CMakeLists.txt") + endif() - ADD_TEST(CMakeWizardTest ${CMAKE_CMAKE_COMMAND} + add_test(CMakeWizardTest ${CMAKE_CMAKE_COMMAND} -D build_dir:STRING=${CMAKE_CURRENT_BINARY_DIR}/CMakeWizardTest -D source_dir:STRING=${CMAKE_CURRENT_SOURCE_DIR}/Tutorial/Step3 -D CMAKE_CTEST_COMMAND:STRING=${CMAKE_CTEST_COMMAND} @@ -2349,56 +2393,55 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # with at least one CMakeLists.txt file that uses ExternalProject # to download and configure the project. The directory should also # contain a RunTest.cmake file that has a single set of the format: - # SET(project_RUN_TEST testToRun) + # set(project_RUN_TEST testToRun) # The testToRun should be a test executable that can be run to # smoke test the build. - FOREACH(project ${CMAKE_CONTRACT_PROJECTS}) - INCLUDE(Contracts/${project}/RunTest.cmake) + foreach(project ${CMAKE_CONTRACT_PROJECTS}) + include(Contracts/${project}/RunTest.cmake) ADD_TEST_MACRO(Contracts.${project} ${${project}_RUN_TEST}) # Contract test timeout in seconds. # Default to 6 hours. - IF(DEFINED ${project}_TEST_TIMEOUT) - SET(timeout ${${project}_TEST_TIMEOUT}) - ELSEIF(CMAKE_CONTRACT_TEST_TIMEOUT_DEFAULT) - SET(timeout ${CMAKE_CONTRACT_TEST_TIMEOUT_DEFAULT}) - ELSE() - SET(timeout 21600) - ENDIF() - SET_TESTS_PROPERTIES(Contracts.${project} PROPERTIES TIMEOUT ${timeout}) - ENDFOREACH() - - IF(TEST_CompileCommandOutput) - SET(CompileCommandOutput_EXTRA_OPTIONS - --build-options -DMAKE_SUPPORTS_SPACES=${MAKE_IS_GNU}) + if(DEFINED ${project}_TEST_TIMEOUT) + set(timeout ${${project}_TEST_TIMEOUT}) + elseif(CMAKE_CONTRACT_TEST_TIMEOUT_DEFAULT) + set(timeout ${CMAKE_CONTRACT_TEST_TIMEOUT_DEFAULT}) + else() + set(timeout 21600) + endif() + set_tests_properties(Contracts.${project} PROPERTIES TIMEOUT ${timeout}) + endforeach() + + if(TEST_CompileCommandOutput) + set(CompileCommandOutput_EXTRA_OPTIONS + --build-options -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES}) ADD_TEST_MACRO(CompileCommandOutput "${CMake_BINARY_DIR}/Tests/CMakeLib/runcompilecommands") - ENDIF() + endif() - ADD_TEST(IncludeDirectories ${CMAKE_CTEST_COMMAND} + add_test(IncludeDirectories ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/IncludeDirectories" "${CMake_BINARY_DIR}/Tests/IncludeDirectories" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} + ${build_generator_args} --build-project IncludeDirectories - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command IncludeDirectories) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/IncludeDirectories") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/IncludeDirectories") - IF(CMAKE_USE_KWSTYLE AND KWSTYLE_EXECUTABLE) + if(CMAKE_USE_KWSTYLE AND KWSTYLE_EXECUTABLE) # The "make StyleCheck" command line as a test. If the test fails, look # for lines like "Error #0 (624) Line length exceed 88 (max=79)" in the # output to find where the style errors are... - ADD_TEST(KWStyle ${KWSTYLE_EXECUTABLE} + add_test(KWStyle ${KWSTYLE_EXECUTABLE} -xml ${CMake_BINARY_DIR}/CMake.kws.xml -o ${CMake_SOURCE_DIR}/Utilities/KWStyle/CMakeOverwrite.txt -v -D ${CMake_BINARY_DIR}/CMakeKWSFiles.txt ) - SET_TESTS_PROPERTIES(KWStyle PROPERTIES + set_tests_properties(KWStyle PROPERTIES WORKING_DIRECTORY ${CMake_BINARY_DIR}/Utilities/KWStyle) - ENDIF() -ENDIF(BUILD_TESTING) + endif() -SUBDIRS(CMakeTests) + add_subdirectory(CMakeTests) +endif() diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 551cee3bc..739593cc9 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -13,7 +13,7 @@ file(GLOB FIND_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../Modules/Find*.cmake macro(do_find MODULE_NAME) message(STATUS " Checking Find${MODULE_NAME}") find_package(${MODULE_NAME}) -endmacro(do_find) +endmacro() # It is only possible to use either Qt3 or Qt4 in one project. # Since FindQt will complain if both are found we explicitly request Qt4 here @@ -35,15 +35,15 @@ foreach(FIND_MODULE ${FIND_MODULES}) do_find(${MODULE_NAME}) endif () -endforeach(FIND_MODULE) +endforeach() # Qt4 is not present, so we can check Qt3 if (NOT QT4_FOUND) set(DESIRED_QT_VERSION 3) foreach(FIND_MODULE ${NO_QT4_MODULES} "Qt") do_find(${FIND_MODULE}) - endforeach(FIND_MODULE) -endif (NOT QT4_FOUND) + endforeach() +endif () macro(check_version_string MODULE_NAME VERSION_VAR) if (${MODULE_NAME}_FOUND) @@ -65,20 +65,21 @@ macro(check_version_string MODULE_NAME VERSION_VAR) message(SEND_ERROR "${MODULE_NAME}_FOUND is set but version number variable ${VERSION_VAR} is NOT DEFINED") endif() endif () -endmacro(check_version_string) +endmacro() # If any of these modules reported that it was found a version number should have been # reported. -foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HSPELL - JASPER LIBLZMA LIBXML2 LIBXSLT PERL PKG_CONFIG PostgreSQL TIFF ZLIB) +foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG + HSPELL ICOTOOL JASPER LIBLZMA LIBXML2 LIBXSLT PERL PKG_CONFIG + PostgreSQL TIFF ZLIB) check_version_string(${VTEST} ${VTEST}_VERSION_STRING) -endforeach(VTEST) +endforeach() foreach(VTEST BISON Boost CUDA DOXYGEN FLEX GIF GTK2 LibArchive OPENSCENEGRAPH RUBY SWIG) check_version_string(${VTEST} ${VTEST}_VERSION) -endforeach(VTEST) +endforeach() check_version_string(PYTHONINTERP PYTHON_VERSION_STRING) check_version_string(SUBVERSION Subversion_VERSION_SVN) diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index a1551ca03..be7ddbc21 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -19,12 +19,42 @@ add_CMakeOnly_test(CheckCXXCompilerFlag) add_CMakeOnly_test(CheckLanguage) +add_CMakeOnly_test(CompilerIdC) +add_CMakeOnly_test(CompilerIdCXX) +if(CMAKE_Fortran_COMPILER) + add_CMakeOnly_test(CompilerIdFortran) +endif() + add_CMakeOnly_test(AllFindModules) +add_CMakeOnly_test(SelectLibraryConfigurations) + add_CMakeOnly_test(TargetScope) +add_CMakeOnly_test(find_library) +add_CMakeOnly_test(find_path) + add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND} -DTEST=ProjectInclude -DCMAKE_ARGS=-DCMAKE_PROJECT_ProjectInclude_INCLUDE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectInclude/include.cmake -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake ) + +include(${CMAKE_SOURCE_DIR}/Modules/CMakeParseArguments.cmake) + +function(add_major_test module) + cmake_parse_arguments(MAJOR_TEST "NOLANG" "VERSION_VAR" "VERSIONS" ${ARGN}) + foreach (_version IN LISTS MAJOR_TEST_VERSIONS) + add_test(CMakeOnly.MajorVersionSelection-${module}_${_version} + ${CMAKE_CMAKE_COMMAND} + -DTEST=MajorVersionSelection-${module}_${_version} + -DTEST_SOURCE=MajorVersionSelection + "-DCMAKE_ARGS=-DMAJOR_TEST_MODULE=${module};-DMAJOR_TEST_VERSION=${_version};-DMAJOR_TEST_NO_LANGUAGES=${MAJOR_TEST_NOLANG};-DMAJOR_TEST_VERSION_VAR=${MAJOR_TEST_VERSION_VAR}" + -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake + ) + endforeach () +endfunction() + +add_major_test(PythonLibs VERSIONS 2 3 VERSION_VAR PYTHONLIBS_VERSION_STRING) +add_major_test(PythonInterp NOLANG VERSIONS 2 3 VERSION_VAR PYTHON_VERSION_STRING) +add_major_test(Qt VERSIONS 3 4 VERSION_VAR QT_VERSION_STRING) diff --git a/Tests/CMakeOnly/CheckCXXSymbolExists/CMakeLists.txt b/Tests/CMakeOnly/CheckCXXSymbolExists/CMakeLists.txt index 1c978c181..9528aa357 100644 --- a/Tests/CMakeOnly/CheckCXXSymbolExists/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckCXXSymbolExists/CMakeLists.txt @@ -7,56 +7,56 @@ # If you change this test do not forget to change the CheckSymbolExists # test, too. -PROJECT(CheckCXXSymbolExists CXX) +project(CheckCXXSymbolExists CXX) -CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) +cmake_minimum_required(VERSION 2.8 FATAL_ERROR) -SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/../CheckSymbolExists") +set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/../CheckSymbolExists") -INCLUDE(CheckCXXSymbolExists) +include(CheckCXXSymbolExists) foreach(_config_type Release RelWithDebInfo MinSizeRel Debug) set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type}) unset(CSE_RESULT_${_config_type} CACHE) - MESSAGE(STATUS "Testing configuration ${_config_type}") + message(STATUS "Testing configuration ${_config_type}") check_cxx_symbol_exists(non_existent_function_for_symbol_test "cm_cse.h" CSE_RESULT_${_config_type}) - IF (CSE_RESULT_${_config_type}) - MESSAGE(SEND_ERROR "CheckCXXSymbolExists reported a nonexistent symbol as existing in configuration ${_config_type}") - ENDIF (CSE_RESULT_${_config_type}) + if (CSE_RESULT_${_config_type}) + message(SEND_ERROR "CheckCXXSymbolExists reported a nonexistent symbol as existing in configuration ${_config_type}") + endif () endforeach() set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE}) unset(CSE_RESULT_ERRNO_CERRNO CACHE) -MESSAGE(STATUS "Checking ") +message(STATUS "Checking ") check_cxx_symbol_exists(errno "cerrno" CSE_RESULT_ERRNO_CERRNO) -IF (NOT CSE_RESULT_ERRNO_CERRNO) +if (NOT CSE_RESULT_ERRNO_CERRNO) unset(CSE_RESULT_ERRNO_ERRNOH CACHE) - MESSAGE(STATUS "Checking ") + message(STATUS "Checking ") check_cxx_symbol_exists(errno "errno.h" CSE_RESULT_ERRNO_ERRNOH) - IF (NOT CSE_RESULT_ERRNO_ERRNOH) - MESSAGE(SEND_ERROR "CheckCXXSymbolExists did not find errno in and ") - ELSE (NOT CSE_RESULT_ERRNO_ERRNOH) - MESSAGE(STATUS "errno found in ") - ENDIF (NOT CSE_RESULT_ERRNO_ERRNOH) -ELSE (NOT CSE_RESULT_ERRNO_CERRNO) - MESSAGE(STATUS "errno found in ") -ENDIF (NOT CSE_RESULT_ERRNO_CERRNO) + if (NOT CSE_RESULT_ERRNO_ERRNOH) + message(SEND_ERROR "CheckCXXSymbolExists did not find errno in and ") + else () + message(STATUS "errno found in ") + endif () +else () + message(STATUS "errno found in ") +endif () -IF (CMAKE_COMPILER_IS_GNUCXX) +if (CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") unset(CSE_RESULT_O3 CACHE) - MESSAGE(STATUS "Testing with optimization -O3") + message(STATUS "Testing with optimization -O3") check_cxx_symbol_exists(non_existent_function_for_symbol_test "cm_cse.h" CSE_RESULT_O3) - IF (CSE_RESULT_O3) - MESSAGE(SEND_ERROR "CheckCXXSymbolExists reported a nonexistent symbol as existing with optimization -O3") - ENDIF (CSE_RESULT_O3) -ENDIF (CMAKE_COMPILER_IS_GNUCXX) + if (CSE_RESULT_O3) + message(SEND_ERROR "CheckCXXSymbolExists reported a nonexistent symbol as existing with optimization -O3") + endif () +endif () diff --git a/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt b/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt index 7c969d3be..765657712 100644 --- a/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt @@ -7,24 +7,24 @@ # If you change this test do not forget to change the CheckCXXSymbolExists # test, too. -PROJECT(CheckSymbolExists C) +project(CheckSymbolExists C) -CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) +cmake_minimum_required(VERSION 2.8 FATAL_ERROR) -SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}") +set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}") -INCLUDE(CheckSymbolExists) +include(CheckSymbolExists) foreach(_config_type Release RelWithDebInfo MinSizeRel Debug) set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type}) unset(CSE_RESULT_${_config_type} CACHE) - MESSAGE(STATUS "Testing configuration ${_config_type}") + message(STATUS "Testing configuration ${_config_type}") check_symbol_exists(non_existent_function_for_symbol_test "cm_cse.h" CSE_RESULT_${_config_type}) - IF (CSE_RESULT_${_config_type}) - MESSAGE(SEND_ERROR "CheckSymbolExists reported a nonexistent symbol as existing in configuration ${_config_type}") - ENDIF (CSE_RESULT_${_config_type}) + if (CSE_RESULT_${_config_type}) + message(SEND_ERROR "CheckSymbolExists reported a nonexistent symbol as existing in configuration ${_config_type}") + endif () endforeach() set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE}) @@ -32,20 +32,20 @@ unset(CSE_RESULT_ERRNO CACHE) check_symbol_exists(errno "errno.h" CSE_RESULT_ERRNO) -IF (NOT CSE_RESULT_ERRNO) - MESSAGE(SEND_ERROR "CheckSymbolExists did not find errno in ") -ELSE (NOT CSE_RESULT_ERRNO) - MESSAGE(STATUS "errno found as expected") -ENDIF (NOT CSE_RESULT_ERRNO) +if (NOT CSE_RESULT_ERRNO) + message(SEND_ERROR "CheckSymbolExists did not find errno in ") +else () + message(STATUS "errno found as expected") +endif () -IF (CMAKE_COMPILER_IS_GNUCC) +if (CMAKE_COMPILER_IS_GNUCC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3") unset(CSE_RESULT_O3 CACHE) - MESSAGE(STATUS "Testing with optimization -O3") + message(STATUS "Testing with optimization -O3") check_symbol_exists(non_existent_function_for_symbol_test "cm_cse.h" CSE_RESULT_O3) - IF (CSE_RESULT_O3) - MESSAGE(SEND_ERROR "CheckSymbolExists reported a nonexistent symbol as existing with optimization -O3") - ENDIF (CSE_RESULT_O3) -ENDIF (CMAKE_COMPILER_IS_GNUCC) + if (CSE_RESULT_O3) + message(SEND_ERROR "CheckSymbolExists reported a nonexistent symbol as existing with optimization -O3") + endif () +endif () diff --git a/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt new file mode 100644 index 000000000..848ffdd36 --- /dev/null +++ b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CompilerIdC C) + +foreach(v + CMAKE_C_COMPILER + CMAKE_C_COMPILER_ID + CMAKE_C_COMPILER_VERSION + ) + if(${v}) + message(STATUS "${v}=[${${v}}]") + else() + message(SEND_ERROR "${v} not set!") + endif() +endforeach() diff --git a/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt new file mode 100644 index 000000000..94ac31e4c --- /dev/null +++ b/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CompilerIdCXX CXX) + +foreach(v + CMAKE_CXX_COMPILER + CMAKE_CXX_COMPILER_ID + CMAKE_CXX_COMPILER_VERSION + ) + if(${v}) + message(STATUS "${v}=[${${v}}]") + else() + message(SEND_ERROR "${v} not set!") + endif() +endforeach() diff --git a/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt new file mode 100644 index 000000000..3a2bdebd6 --- /dev/null +++ b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CompilerIdFortran Fortran) + +foreach(v + CMAKE_Fortran_COMPILER + CMAKE_Fortran_COMPILER_ID + ) + if(${v}) + message(STATUS "${v}=[${${v}}]") + else() + message(SEND_ERROR "${v} not set!") + endif() +endforeach() +foreach(v + CMAKE_Fortran_COMPILER_VERSION + ) + if(${v}) + message(STATUS "${v}=[${${v}}]") + else() + message(WARNING "${v} not set!") + endif() +endforeach() diff --git a/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt b/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt new file mode 100644 index 000000000..74f54514e --- /dev/null +++ b/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 2.8) + +if (NOT MAJOR_TEST_MODULE OR NOT MAJOR_TEST_VERSION) + message(FATAL_ERROR "test selection variables not set up") +endif () + +if (MAJOR_TEST_NO_LANGUAGES) + project(major_detect_${MAJOR_TEST_MODULE}_${MAJOR_TEST_VERSION} NONE) +else () + project(major_detect_${MAJOR_TEST_MODULE}_${MAJOR_TEST_VERSION}) +endif () + +find_package(${MAJOR_TEST_MODULE} ${MAJOR_TEST_VERSION}) + +if (MAJOR_TEST_VERSION_VAR) + set(VERSION_VAR "${MAJOR_TEST_VERSION_VAR}") +else () + set(VERSION_VAR "${MAJOR_TEST_MODULE}_VERSION_STRING") +endif () + +string(TOUPPER "${MAJOR_TEST_MODULE}" MODULE_UPPER) + +if ( ( ${MAJOR_TEST_MODULE}_FOUND OR ${MODULE_UPPER}_FOUND ) AND "${VERSION_VAR}") + message(STATUS "${VERSION_VAR} is '${${VERSION_VAR}}'") + if ("${VERSION_VAR}" VERSION_LESS MAJOR_TEST_VERSION) + message(SEND_ERROR "Found version ${${VERSION_VAR}} is less than requested major version ${MAJOR_TEST_VERSION}") + endif () + math(EXPR V_PLUS_ONE "${MAJOR_TEST_VERSION} + 1") + if ("${VERSION_VAR}" VERSION_GREATER V_PLUS_ONE) + message(SEND_ERROR "Found version ${${VERSION_VAR}} is greater than requested major version ${MAJOR_TEST_VERSION}") + endif () +endif () + +if ( ( ${MAJOR_TEST_MODULE}_FOUND OR ${MODULE_UPPER}_FOUND ) AND ${MAJOR_TEST_MODULE}_VERSION_MAJOR) + message(STATUS "${MAJOR_TEST_MODULE}_VERSION_MAJOR is '${${MAJOR_TEST_MODULE}_VERSION_MAJOR}'") + if (NOT ${MAJOR_TEST_VERSION} EQUAL ${MAJOR_TEST_MODULE}_VERSION_MAJOR) + message(SEND_ERROR "We requested major version ${MAJOR_TEST_VERSION} but ${MAJOR_TEST_MODULE} set ${MAJOR_TEST_MODULE}_VERSION_MAJOR to ${${MAJOR_TEST_MODULE}_VERSION_MAJOR}") + endif () +endif () + +if ( ( ${MAJOR_TEST_MODULE}_FOUND OR ${MODULE_UPPER}_FOUND ) AND ${MODULE_UPPER}_VERSION_MAJOR) + message(STATUS "${MODULE_UPPER}_VERSION_MAJOR is '${${MODULE_UPPER}_VERSION_MAJOR}'") + if (NOT ${MAJOR_TEST_VERSION} EQUAL ${MODULE_UPPER}_VERSION_MAJOR) + message(SEND_ERROR "We requested major version ${MAJOR_TEST_VERSION} but ${MAJOR_TEST_MODULE} set ${MODULE_UPPER}_VERSION_MAJOR to ${${MODULE_UPPER}_VERSION_MAJOR}") + endif () +endif () diff --git a/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt b/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt new file mode 100644 index 000000000..5bf0f8abc --- /dev/null +++ b/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt @@ -0,0 +1,64 @@ +cmake_minimum_required(VERSION 2.8) + +project(SelectLibraryConfigurations NONE) + +include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) + +macro(check_slc basename expect) + message(STATUS "checking select_library_configurations(${basename})") + select_library_configurations(${basename}) + if (NOT ${basename}_LIBRARY STREQUAL "${expect}") + message(SEND_ERROR "select_library_configurations(${basename}) returned '${${basename}_LIBRARY}' but '${expect}' was expected") + endif () + if (NOT ${basename}_LIBRARY STREQUAL "${${basename}_LIBRARIES}") + message(SEND_ERROR "select_library_configurations(${basename}) LIBRARY: '${${basename}_LIBRARY}' LIBRARIES: '${${basename}_LIBRARIES}'") + endif () +endmacro(check_slc) + +if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + set(NOTYPE_RELONLY_LIBRARY_RELEASE "opt") + check_slc(NOTYPE_RELONLY "opt") + + set(NOTYPE_DBGONLY_LIBRARY_DEBUG "dbg") + check_slc(NOTYPE_DBGONLY "dbg") + + set(NOTYPE_RELDBG_LIBRARY_RELEASE "opt") + set(NOTYPE_RELDBG_LIBRARY_DEBUG "dbg") + check_slc(NOTYPE_RELDBG "opt") + + set(CMAKE_BUILD_TYPE Debug) +endif () + +check_slc(empty "") + +set(OPTONLY_LIBRARY_RELEASE "opt") +check_slc(OPTONLY "opt") + +set(DBGONLY_LIBRARY_RELEASE "dbg") +check_slc(DBGONLY "dbg") + +set(SAME_LIBRARY_RELEASE "same") +set(SAME_LIBRARY_DEBUG "same") +check_slc(SAME "same") + +set(OPTONLYLIST_LIBRARY_RELEASE "opt1;opt2") +check_slc(OPTONLYLIST "opt1;opt2") + +set(DBGONLYLIST_LIBRARY_RELEASE "dbg1;dbg2") +check_slc(DBGONLYLIST "dbg1;dbg2") + +set(OPT1DBG1_LIBRARY_RELEASE "opt") +set(OPT1DBG1_LIBRARY_DEBUG "dbg") +check_slc(OPT1DBG1 "optimized;opt;debug;dbg") + +set(OPT1DBG2_LIBRARY_RELEASE "opt") +set(OPT1DBG2_LIBRARY_DEBUG "dbg1;dbg2") +check_slc(OPT1DBG2 "optimized;opt;debug;dbg1;debug;dbg2") + +set(OPT2DBG1_LIBRARY_RELEASE "opt1;opt2") +set(OPT2DBG1_LIBRARY_DEBUG "dbg") +check_slc(OPT2DBG1 "optimized;opt1;optimized;opt2;debug;dbg") + +set(OPT2DBG2_LIBRARY_RELEASE "opt1;opt2") +set(OPT2DBG2_LIBRARY_DEBUG "dbg1;dbg2") +check_slc(OPT2DBG2 "optimized;opt1;optimized;opt2;debug;dbg1;debug;dbg2") diff --git a/Tests/CMakeOnly/Test.cmake.in b/Tests/CMakeOnly/Test.cmake.in index 42af06891..a266415f7 100644 --- a/Tests/CMakeOnly/Test.cmake.in +++ b/Tests/CMakeOnly/Test.cmake.in @@ -1,10 +1,15 @@ -set(source_dir "@CMAKE_CURRENT_SOURCE_DIR@/${TEST}") +if (NOT TEST_SOURCE) + set(TEST_SOURCE "${TEST}") +endif () + +set(source_dir "@CMAKE_CURRENT_SOURCE_DIR@/${TEST_SOURCE}") set(binary_dir "@CMAKE_CURRENT_BINARY_DIR@/${TEST}-build") file(REMOVE_RECURSE "${binary_dir}") file(MAKE_DIRECTORY "${binary_dir}") execute_process( COMMAND ${CMAKE_COMMAND} ${CMAKE_ARGS} "${source_dir}" -G "@CMAKE_TEST_GENERATOR@" + -T "@CMAKE_TEST_GENERATOR_TOOLSET@" WORKING_DIRECTORY "${binary_dir}" RESULT_VARIABLE result ) diff --git a/Tests/CMakeOnly/find_library/A/libtestA.a b/Tests/CMakeOnly/find_library/A/libtestA.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/B/libtestB.a b/Tests/CMakeOnly/find_library/B/libtestB.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/CMakeLists.txt b/Tests/CMakeOnly/find_library/CMakeLists.txt new file mode 100644 index 000000000..2d4ecaf14 --- /dev/null +++ b/Tests/CMakeOnly/find_library/CMakeLists.txt @@ -0,0 +1,74 @@ +cmake_minimum_required(VERSION 2.8) +project(FindLibraryTest NONE) + +set(CMAKE_FIND_DEBUG_MODE 1) + +macro(test_find_library desc expected) + unset(LIB CACHE) + find_library(LIB ${ARGN} NO_DEFAULT_PATH) + if(LIB) + # Convert to relative path for comparison to expected location. + file(RELATIVE_PATH REL_LIB "${CMAKE_CURRENT_SOURCE_DIR}" "${LIB}") + + # Check and report failure. + if(NOT "${REL_LIB}" STREQUAL "${expected}") + message(SEND_ERROR "Library ${expected} found as [${REL_LIB}]${desc}") + elseif(CMAKE_FIND_DEBUG_MODE) + message(STATUS "Library ${expected} found as [${REL_LIB}]${desc}") + endif() + else() + message(SEND_ERROR "Library ${expected} NOT FOUND${desc}") + endif() +endmacro() + +macro(test_find_library_subst expected) + get_filename_component(dir ${expected} PATH) + get_filename_component(name ${expected} NAME) + string(REGEX REPLACE "lib/?64" "lib" dir "${dir}") + test_find_library(", searched as ${dir}" "${expected}" + NAMES ${name} + PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${dir} + ) +endmacro() + +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) + +set(CMAKE_SIZEOF_VOID_P 4) +foreach(lib + lib/A/lib/libtest1.a + lib/A/libtest1.a + lib/libtest1.a + lib/libtest2.a + lib/libtest3.a + lib/libtest3.a + ) + test_find_library_subst(${lib}) +endforeach() + +set(CMAKE_SIZEOF_VOID_P 8) +foreach(lib64 + lib/64/libtest2.a + lib/A/lib64/libtest3.a + lib/libtest3.a + lib64/A/lib/libtest2.a + lib64/A/lib64/libtest1.a + lib64/A/libtest1.a + lib64/libtest1.a + ) + test_find_library_subst(${lib64}) +endforeach() + +test_find_library("" A/libtestA.a + NAMES testA testB + PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B + ) +test_find_library("" B/libtestB.a + NAMES testB testA + PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B + ) +test_find_library("" A/libtestA.a + NAMES testB testA NAMES_PER_DIR + PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B + ) diff --git a/Tests/CMakeOnly/find_library/lib/64/libtest2.a b/Tests/CMakeOnly/find_library/lib/64/libtest2.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib/A/lib/libtest1.a b/Tests/CMakeOnly/find_library/lib/A/lib/libtest1.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib/A/lib64/libtest3.a b/Tests/CMakeOnly/find_library/lib/A/lib64/libtest3.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib/A/libtest1.a b/Tests/CMakeOnly/find_library/lib/A/libtest1.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib/libtest1.a b/Tests/CMakeOnly/find_library/lib/libtest1.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib/libtest2.a b/Tests/CMakeOnly/find_library/lib/libtest2.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib/libtest3.a b/Tests/CMakeOnly/find_library/lib/libtest3.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib64/A/lib/libtest2.a b/Tests/CMakeOnly/find_library/lib64/A/lib/libtest2.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib64/A/lib64/libtest1.a b/Tests/CMakeOnly/find_library/lib64/A/lib64/libtest1.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib64/A/libtest1.a b/Tests/CMakeOnly/find_library/lib64/A/libtest1.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_library/lib64/libtest1.a b/Tests/CMakeOnly/find_library/lib64/libtest1.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_path/CMakeLists.txt b/Tests/CMakeOnly/find_path/CMakeLists.txt new file mode 100644 index 000000000..0e64ed467 --- /dev/null +++ b/Tests/CMakeOnly/find_path/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 2.8) +project(FindPathTest NONE) + +set(CMAKE_FIND_DEBUG_MODE 1) + +macro(test_find_path expected) + unset(HDR CACHE) + find_path(HDR ${ARGN} + NO_CMAKE_ENVIRONMENT_PATH + NO_SYSTEM_ENVIRONMENT_PATH + ) + if(HDR) + # Convert to relative path for comparison to expected location. + file(RELATIVE_PATH REL_HDR "${CMAKE_CURRENT_SOURCE_DIR}" "${HDR}") + + # Check and report failure. + if(NOT "${REL_HDR}" STREQUAL "${expected}") + message(SEND_ERROR "Header ${expected} found as [${REL_HDR}]") + elseif(CMAKE_FIND_DEBUG_MODE) + message(STATUS "Header ${expected} found as [${REL_HDR}]") + endif() + else() + message(SEND_ERROR "Header ${expected} NOT FOUND") + endif() +endmacro() + +set(CMAKE_SYSTEM_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}) +set(CMAKE_LIBRARY_ARCHITECTURE arch) + +test_find_path(include NAMES test1.h) +test_find_path(include/arch NAMES test1arch.h) diff --git a/Tests/CMakeOnly/find_path/include/arch/test1arch.h b/Tests/CMakeOnly/find_path/include/arch/test1arch.h new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeOnly/find_path/include/test1.h b/Tests/CMakeOnly/find_path/include/test1.h new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CMakeTestMultipleConfigures/RunCMake.cmake b/Tests/CMakeTestMultipleConfigures/RunCMake.cmake index 19391d7f1..96326646b 100644 --- a/Tests/CMakeTestMultipleConfigures/RunCMake.cmake +++ b/Tests/CMakeTestMultipleConfigures/RunCMake.cmake @@ -143,7 +143,7 @@ function(analyze_directory_diffs d1 d2 diff_count_var) endif() set(${diff_count_var} ${diffs} PARENT_SCOPE) -endfunction(analyze_directory_diffs) +endfunction() # Analyze diffs between b1:b2, b2:b3, b3:b4, b4:b5 ... bN-1:bN. diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index c42c490b0..b0499954b 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -1,12 +1,13 @@ -SET(CMAKE_EXECUTABLE "${CMake_BIN_DIR}/cmake") +set(CMAKE_EXECUTABLE "${CMake_BIN_DIR}/cmake") -MACRO(AddCMakeTest TestName PreArgs) - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/${TestName}Test.cmake.in" +macro(AddCMakeTest TestName PreArgs) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${TestName}Test.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/${TestName}Test.cmake" @ONLY IMMEDIATE) - ADD_TEST(CMake.${TestName} ${CMAKE_EXECUTABLE} ${PreArgs} + add_test(NAME CMake.${TestName} + COMMAND ${CMAKE_EXECUTABLE} ${PreArgs} -P "${CMAKE_CURRENT_BINARY_DIR}/${TestName}Test.cmake" ${ARGN}) -ENDMACRO(AddCMakeTest) +endmacro() AddCMakeTest(List "") @@ -28,7 +29,7 @@ AddCMakeTest(String "") AddCMakeTest(Math "") AddCMakeTest(CMakeMinimumRequired "") AddCMakeTest(CompilerIdVendor "") -AddCMakeTest(ProcessorCount "") +AddCMakeTest(ProcessorCount "-DKWSYS_TEST_EXE=$") AddCMakeTest(PushCheckState "") AddCMakeTest(While "") @@ -43,12 +44,12 @@ if(HAVE_ELF_H) AddCMakeTest(ELF "") endif() -SET(EndStuff_PreArgs +set(EndStuff_PreArgs "-Ddir:STRING=${CMAKE_CURRENT_BINARY_DIR}/EndStuffTest" ) AddCMakeTest(EndStuff "${EndStuff_PreArgs}") -SET(GetPrerequisites_PreArgs +set(GetPrerequisites_PreArgs "-DCTEST_CONFIGURATION_TYPE:STRING=\\\${CTEST_CONFIGURATION_TYPE}" ) AddCMakeTest(GetPrerequisites "${GetPrerequisites_PreArgs}") diff --git a/Tests/CMakeTests/CheckCMakeTest.cmake b/Tests/CMakeTests/CheckCMakeTest.cmake index db9290522..7be7b30f0 100644 --- a/Tests/CMakeTests/CheckCMakeTest.cmake +++ b/Tests/CMakeTests/CheckCMakeTest.cmake @@ -1,30 +1,35 @@ get_filename_component(CMakeTests_SRC_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) + +function(check_cmake_test_single prefix test testfile) + message(STATUS "Test ${prefix}-${test}...") + execute_process( + COMMAND ${CMAKE_COMMAND} -P "${testfile}" + WORKING_DIRECTORY "${CMakeTests_BIN_DIR}" + OUTPUT_VARIABLE stdout + ERROR_VARIABLE stderr + RESULT_VARIABLE result + ) + string(REGEX REPLACE "\n" "\n out> " out " out> ${stdout}") + string(REGEX REPLACE "\n" "\n err> " err " err> ${stderr}") + if(NOT "${result}" STREQUAL "${${test}-RESULT}") + message(FATAL_ERROR + "Test ${test} result is [${result}], not [${${test}-RESULT}].\n" + "Test ${test} output:\n" + "${out}\n" + "${err}") + endif() + if(${test}-STDERR AND NOT "${err}" MATCHES "${${test}-STDERR}") + message(FATAL_ERROR + "Test ${test} stderr does not match\n ${${test}-STDERR}\n" + "Test ${test} output:\n" + "${out}\n" + "${err}") + endif() +endfunction() + function(check_cmake_test prefix) get_filename_component(CMakeTests_BIN_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) foreach(test ${ARGN}) - message(STATUS "Test ${prefix}-${test}...") - execute_process( - COMMAND ${CMAKE_COMMAND} -P "${CMakeTests_SRC_DIR}/${prefix}-${test}.cmake" - WORKING_DIRECTORY "${CMakeTests_BIN_DIR}" - OUTPUT_VARIABLE stdout - ERROR_VARIABLE stderr - RESULT_VARIABLE result - ) - string(REGEX REPLACE "\n" "\n out> " out " out> ${stdout}") - string(REGEX REPLACE "\n" "\n err> " err " err> ${stderr}") - if(NOT "${result}" STREQUAL "${${test}-RESULT}") - message(FATAL_ERROR - "Test ${test} result is [${result}], not [${${test}-RESULT}].\n" - "Test ${test} output:\n" - "${out}\n" - "${err}") - endif() - if(${test}-STDERR AND NOT "${err}" MATCHES "${${test}-STDERR}") - message(FATAL_ERROR - "Test ${test} stderr does not match\n ${${test}-STDERR}\n" - "Test ${test} output:\n" - "${out}\n" - "${err}") - endif() + check_cmake_test_single("${prefix}" "${test}" "${CMakeTests_SRC_DIR}/${prefix}-${test}.cmake") endforeach() endfunction() diff --git a/Tests/CMakeTests/File-Glob-NoArg.cmake b/Tests/CMakeTests/File-Glob-NoArg.cmake new file mode 100644 index 000000000..486f366c1 --- /dev/null +++ b/Tests/CMakeTests/File-Glob-NoArg.cmake @@ -0,0 +1,2 @@ +# Checking that the call without arguments get caught by the file global protection. +file(GLOB) diff --git a/Tests/CMakeTests/File-TIMESTAMP-BadArg1.cmake b/Tests/CMakeTests/File-TIMESTAMP-BadArg1.cmake new file mode 100644 index 000000000..cc15c77a8 --- /dev/null +++ b/Tests/CMakeTests/File-TIMESTAMP-BadArg1.cmake @@ -0,0 +1 @@ +file(TIMESTAMP "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt") diff --git a/Tests/CMakeTests/File-TIMESTAMP-NoFile.cmake b/Tests/CMakeTests/File-TIMESTAMP-NoFile.cmake new file mode 100644 index 000000000..62390e792 --- /dev/null +++ b/Tests/CMakeTests/File-TIMESTAMP-NoFile.cmake @@ -0,0 +1,2 @@ +file(TIMESTAMP "${CMAKE_CURRENT_LIST_DIR}/DoesNotExist.cmake" output) +message("~${output}~") diff --git a/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake b/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake new file mode 100644 index 000000000..d0e5fe35f --- /dev/null +++ b/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake @@ -0,0 +1,24 @@ +set(STAMP_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/FileTimestamp-Stamp") +set(STAMP_FORMAT "%Y-%m-%d") + +string(TIMESTAMP timestamp1 "${STAMP_FORMAT}") + +file(WRITE "${STAMP_FILENAME}" "foo") +file(TIMESTAMP "${STAMP_FILENAME}" timestamp2 "${STAMP_FORMAT}") + +string(TIMESTAMP timestamp3 "${STAMP_FORMAT}") + +message(STATUS "timestamp1 [${timestamp1}]") +message(STATUS "timestamp2 [${timestamp2}]") +message(STATUS "timestamp3 [${timestamp3}]") + +if(timestamp1 STREQUAL timestamp3) + if(NOT timestamp1 STREQUAL timestamp2) + message(FATAL_ERROR + "timestamp mismatch [${timestamp1}] != [${timestamp2}]") + else() + message("all timestamps match") + endif() +else() + message(WARNING "this test may race when run at midnight") +endif() diff --git a/Tests/CMakeTests/File-TIMESTAMP-Works.cmake b/Tests/CMakeTests/File-TIMESTAMP-Works.cmake new file mode 100644 index 000000000..4351b19dd --- /dev/null +++ b/Tests/CMakeTests/File-TIMESTAMP-Works.cmake @@ -0,0 +1,2 @@ +file(TIMESTAMP "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" output UTC) +message("~${output}~") diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in index 9dc2ebb27..91086c6d7 100644 --- a/Tests/CMakeTests/FileDownloadTest.cmake.in +++ b/Tests/CMakeTests/FileDownloadTest.cmake.in @@ -33,6 +33,59 @@ file(DOWNLOAD ) message(STATUS "FileDownload:4") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA1=50c614fc28b39c1281d0517bb6d5858b4359c9b7 + ) + +message(STATUS "FileDownload:5") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA224=73cd5f442b04e8320e4f907f8e1b21d4befff98b5bd77bc32526ea68 + ) + +message(STATUS "FileDownload:6") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA256=2e067f6c09cbc7cd619c8fbcc44eb64cd6b45a95e4cddb3a585eee1f731c4da9 + ) + +message(STATUS "FileDownload:7") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA384=398bf41902a7251c30e522b307e3e41e3fb617c765b3feaa99b2f7d063894708ad399267ccc25d877437a10e5e890d35 + ) + +message(STATUS "FileDownload:8") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA512=c51854d21052713968b849c2b4263cf54be03bc3a7e9847a6c71c6c8d1d13cd805fe1b9fa95f9ba1d0a5631513974f6fae21e34ab5b171d94bad48df5f073e48 + ) +message(STATUS "FileDownload:9") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH MD5=d16778650db435bda3a8c3435c3ff5d1 + ) + +message(STATUS "FileDownload:10") file(DOWNLOAD ${url} ${dir}/file3.png diff --git a/Tests/CMakeTests/FileTest.cmake.in b/Tests/CMakeTests/FileTest.cmake.in index 3c3d85ddc..61523e6f6 100644 --- a/Tests/CMakeTests/FileTest.cmake.in +++ b/Tests/CMakeTests/FileTest.cmake.in @@ -12,6 +12,10 @@ set(Copy-NoDest-RESULT 1) set(Copy-NoDest-STDERR "given no DESTINATION") set(Copy-NoFile-RESULT 1) set(Copy-NoFile-STDERR "COPY cannot find.*/does_not_exist\\.txt") +set(Glob-NoArg-RESULT 1) +set(Glob-NoArg-STDERR "file must be called with at least two arguments") +set(Make_Directory-NoArg-RESULT 1) +set(Make-Directory-NoArg-STDERR "file must be called with at least two arguments") set(MD5-NoFile-RESULT 1) set(MD5-NoFile-STDERR "file MD5 failed to read file") set(MD5-BadArg1-RESULT 1) @@ -32,6 +36,14 @@ set(SHA384-Works-RESULT 0) set(SHA384-Works-STDERR "1de9560b4e030e02051ea408200ffc55d70c97ac64ebf822461a5c786f495c36df43259b14483bc8d364f0106f4971ee") set(SHA512-Works-RESULT 0) set(SHA512-Works-STDERR "3982a1b4e651768bec70ab1fb97045cb7a659f4ba7203d501c52ab2e803071f9d5fd272022df15f27727fc67f8cd022e710e29010b2a9c0b467c111e2f6abf51") +set(TIMESTAMP-NoFile-RESULT 0) +set(TIMESTAMP-NoFile-STDERR "~~") +set(TIMESTAMP-BadArg1-RESULT 1) +set(TIMESTAMP-BadArg1-STDERR "file sub-command TIMESTAMP requires at least two arguments") +set(TIMESTAMP-NotBogus-RESULT 0) +set(TIMESTAMP-NotBogus-STDERR "all timestamps match") +set(TIMESTAMP-Works-RESULT 0) +set(TIMESTAMP-Works-STDERR "~[0-9]*-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-6][0-9]Z~") include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") check_cmake_test(File @@ -42,6 +54,8 @@ check_cmake_test(File Copy-LateArg Copy-NoDest Copy-NoFile + Glob-NoArg + Make_Directory-NoArg MD5-NoFile MD5-BadArg1 MD5-BadArg2 @@ -52,8 +66,17 @@ check_cmake_test(File SHA256-Works SHA384-Works SHA512-Works + TIMESTAMP-NoFile + TIMESTAMP-BadArg1 + TIMESTAMP-NotBogus + TIMESTAMP-Works ) +file(GLOB hum) +if (NOT hum STREQUAL "") + message(FATAL_ERROR "file(GLOB hum) did not return an empty string.") +endif() + # Also execute each test listed in FileTestScript.cmake: # set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/FileTestScript.cmake") diff --git a/Tests/CMakeTests/FindBaseTest.cmake.in b/Tests/CMakeTests/FindBaseTest.cmake.in index 47c1692db..658b35022 100644 --- a/Tests/CMakeTests/FindBaseTest.cmake.in +++ b/Tests/CMakeTests/FindBaseTest.cmake.in @@ -12,7 +12,7 @@ set(_HEADER_FULL_A "${MY_SOURCE_DIR}/A/include/${_HEADER}") find_file(FOO_H_1 ${_HEADER}) if(FOO_H_1) message(FATAL_ERROR "${_HEADER} found: ${FOO_H_1}, it should not exist !") -endif(FOO_H_1) +endif() # The HINTS option should override the system but the PATHS option # should not. @@ -21,10 +21,10 @@ find_file(TEST_H_1 ${_HEADER} HINTS ${MY_SOURCE_DIR}/A/include) find_file(TEST_H_2 ${_HEADER} PATHS ${MY_SOURCE_DIR}/A/include) if(NOT "${TEST_H_1}" STREQUAL "${_HEADER_FULL_A}") message(FATAL_ERROR "Did not find \"${_HEADER_FULL_A}\"\ngot \"${TEST_H_1}\" instead!") -endif(NOT "${TEST_H_1}" STREQUAL "${_HEADER_FULL_A}") +endif() if(NOT "${TEST_H_2}" STREQUAL "${_HEADER_FULL}") message(FATAL_ERROR "Did not find \"${_HEADER_FULL}\"\ngot \"${TEST_H_2}\" instead!") -endif(NOT "${TEST_H_2}" STREQUAL "${_HEADER_FULL}") +endif() set(CMAKE_SYSTEM_PREFIX_PATH) # with this it still should not be found, since the include/ subdir is still missing @@ -32,20 +32,20 @@ set(CMAKE_INCLUDE_PATH "${MY_SOURCE_DIR}") find_file(FOO_H_2 ${_HEADER}) if(FOO_H_2) message(FATAL_ERROR "${_HEADER} found: ${FOO_H_2}, it should not exist !") -endif(FOO_H_2) +endif() # now with the PATH_SUFFIX it should be found find_file(FOO_H_3 NAMES ${_HEADER} PATH_SUFFIXES include ) if(NOT "${FOO_H_3}" STREQUAL "${_HEADER_FULL}") message(FATAL_ERROR "Did not find \"${_HEADER_FULL}\"\ngot ${FOO_H_3} instead !") -endif(NOT "${FOO_H_3}" STREQUAL "${_HEADER_FULL}") +endif() # without PATH_SUFFIX, but with a CMAKE_INCLUDE_PATH it should not be found set(CMAKE_INCLUDE_PATH /include) find_file(FOO_H_4 ${_HEADER}) if(FOO_H_4) message(FATAL_ERROR "${_HEADER} found: ${FOO_H_4}, it should not exist !") -endif(FOO_H_4) +endif() # when setting CMAKE_FIND_ROOT_PATH to the current source dir, # together with the CMAKE_INCLUDE_PATH it should be found @@ -53,10 +53,10 @@ set(CMAKE_FIND_ROOT_PATH blub "${MY_SOURCE_DIR}") find_file(FOO_H_5 ${_HEADER}) if(NOT "${FOO_H_5}" STREQUAL "${_HEADER_FULL}") message(FATAL_ERROR "Did not find \"${_HEADER_FULL}\"\ngot ${FOO_H_5} instead !") -endif(NOT "${FOO_H_5}" STREQUAL "${_HEADER_FULL}") +endif() # by explicitly disabling CMAKE_FIND_ROOT_PATH again it shouldn't be found find_file(FOO_H_6 ${_HEADER} NO_CMAKE_FIND_ROOT_PATH) if(FOO_H_6) message(FATAL_ERROR "${_HEADER} found: ${FOO_H_6}, it should not exist !") -endif(FOO_H_6) +endif() diff --git a/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in b/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in index 7adc240f0..22f6afd3b 100644 --- a/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in +++ b/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in @@ -66,7 +66,7 @@ if(UNIX) if(EXISTS file1 OR EXISTS file2) message(FATAL_ERROR "removal of file1 or file2 failed") endif() - endif(LN) + endif() file(REMOVE ${bindir}/file3) endif() diff --git a/Tests/CMakeTests/GetPrerequisitesTest.cmake.in b/Tests/CMakeTests/GetPrerequisitesTest.cmake.in index daf467bcc..89ca735d3 100644 --- a/Tests/CMakeTests/GetPrerequisitesTest.cmake.in +++ b/Tests/CMakeTests/GetPrerequisitesTest.cmake.in @@ -58,7 +58,7 @@ function(stresstest_list_prerequisites file) message(STATUS "=============================================================================") message(STATUS "") -endfunction(stresstest_list_prerequisites) +endfunction() function(test_cmake_executables) @@ -68,7 +68,7 @@ function(test_cmake_executables) get_filename_component(cmake_bin_dir "${CMAKE_COMMAND}" PATH) list_prerequisites_by_glob(GLOB "${cmake_bin_dir}/*" 0 0 1) -endfunction(test_cmake_executables) +endfunction() message(STATUS "=============================================================================") @@ -93,7 +93,7 @@ if(do_testdefaults) message(STATUS "") list_prerequisites("${CMAKE_COMMAND}") message(STATUS "") -endif(do_testdefaults) +endif() set(do_stresstest 0) @@ -103,7 +103,7 @@ if(do_stresstest) message(STATUS "") stresstest_list_prerequisites("${CMAKE_COMMAND}") message(STATUS "") -endif(do_stresstest) +endif() test_cmake_executables() @@ -141,7 +141,7 @@ message(STATUS "") get_cmake_property(vs VARIABLES) foreach(v ${vs}) message(STATUS "${v}='${${v}}'") -endforeach(v) +endforeach() message(STATUS "") message(STATUS "=============================================================================") diff --git a/Tests/CMakeTests/GetProperty-Doc-Properties.cmake b/Tests/CMakeTests/GetProperty-Doc-Properties.cmake deleted file mode 100644 index 6c2c3620e..000000000 --- a/Tests/CMakeTests/GetProperty-Doc-Properties.cmake +++ /dev/null @@ -1,10 +0,0 @@ -get_property(FOO_BRIEF GLOBAL PROPERTY FOO BRIEF_DOCS) -get_property(FOO_FULL GLOBAL PROPERTY FOO FULL_DOCS) - -if (NOT FOO_BRIEF STREQUAL "NOTFOUND") - message(SEND_ERROR "property FOO has BRIEF_DOCS set to '${FOO_BRIEF}'") -endif () - -if (NOT FOO_FULL STREQUAL "NOTFOUND") - message(SEND_ERROR "property FOO has FULL_DOCS set to '${FOO_FULL}'") -endif () diff --git a/Tests/CMakeTests/GetPropertyTest.cmake.in b/Tests/CMakeTests/GetPropertyTest.cmake.in index ab96e5b52..306ab7269 100644 --- a/Tests/CMakeTests/GetPropertyTest.cmake.in +++ b/Tests/CMakeTests/GetPropertyTest.cmake.in @@ -1,5 +1,33 @@ include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") +get_property(FOO_BRIEF GLOBAL PROPERTY FOO BRIEF_DOCS) +get_property(FOO_FULL GLOBAL PROPERTY FOO FULL_DOCS) + +if (NOT FOO_BRIEF STREQUAL "NOTFOUND") + message(SEND_ERROR "property FOO has BRIEF_DOCS set to '${FOO_BRIEF}'") +endif () + +if (NOT FOO_FULL STREQUAL "NOTFOUND") + message(SEND_ERROR "property FOO has FULL_DOCS set to '${FOO_FULL}'") +endif () + +get_property(test_brief GLOBAL PROPERTY ENABLED_FEATURES BRIEF_DOCS) +get_property(test_full GLOBAL PROPERTY ENABLED_FEATURES FULL_DOCS) + +if(test_brief STREQUAL "NOTFOUND") + message(SEND_ERROR "property ENABLED_FEATURES has no BRIEF_DOCS") +endif() + +if(test_full STREQUAL "NOTFOUND") + message(SEND_ERROR "property ENABLED_FEATURES has no FULL_DOCS") +endif() + +set(test_var alpha) +get_property(result VARIABLE PROPERTY test_var) +if(NOT result STREQUAL "alpha") + message(SEND_ERROR "bad value of VARIABLE PROPERTY test_var: got '${result}' instead of 'alpha'") +endif() + set(Missing-Argument-RESULT 1) set(Missing-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Missing-Argument.cmake:1 \\(get_property\\):.*get_property called with incorrect number of arguments.*") @@ -28,12 +56,6 @@ check_cmake_test(GetProperty No-Property ) -set(Doc-Properties-RESULT 0) - -check_cmake_test(GetProperty - Doc-Properties -) - set(Global-Name-RESULT 1) set(Global-Name-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Global-Name.cmake:1 \\(get_property\\):.*get_property given name for GLOBAL scope\\..*") diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in index dbe95005e..e28d102c2 100644 --- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in @@ -99,33 +99,141 @@ set(linux64_test1_libs "${linux64_gcc_libs}") set(linux64_test1_dirs "${linux64_gcc_dirs}") list(APPEND platforms linux64_test1) +# sunCC dummy.cxx -v # extra slashes +set(linux64_test2_text "/usr/bin/ld --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/sun/sunstudio12/prod/lib/amd64//crti.o /opt/sun/sunstudio12/prod/lib/amd64/crt1x.o /opt/sun/sunstudio12/prod/lib/amd64/values-xa.o dummy.o -Y \"/opt/sun/sunstudio12/prod/lib//amd64:/lib64:/usr//lib64\" -Qy -lc /opt/sun/sunstudio12/prod/lib/amd64//libc_supp.a /opt/sun/sunstudio12/prod/lib/amd64/crtn.o") +set(linux64_test2_libs "c;/opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a") +set(linux64_test2_dirs "/opt/sun/sunstudio12/prod/lib/amd64;/lib64;/usr/lib64") +list(APPEND platforms linux64_test2) + #----------------------------------------------------------------------------- # Mac +# gcc -arch i686 dummy.c -v -Wl,-v +set(mac_i686_gcc_Wlv_text " /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/tmp//ccnhXAGL.o -lSystem -lgcc -lSystem +collect2 version 4.2.1 (Apple Inc. build 5646) (i686 Darwin) +/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/tmp//ccSiuUhD.o -v -lSystem -lgcc -lSystem +@(#)PROGRAM:ld PROJECT:ld64-95.2.12 +Library search paths: + /usr/lib/i686-apple-darwin10/4.2.1 + /usr/lib/gcc/i686-apple-darwin10/4.2.1 + /usr/lib/gcc/i686-apple-darwin10/4.2.1 + /usr/lib/i686-apple-darwin10/4.2.1 + /usr/lib + /usr/lib + /usr/local/lib +Framework search paths: + /Library/Frameworks/ + /System/Library/Frameworks/") +set(mac_i686_gcc_Wlv_libs "") +set(mac_i686_gcc_Wlv_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib") +set(mac_i686_gcc_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") +list(APPEND platforms mac_i686_gcc_Wlv) + # gcc -arch i686 dummy.c -v set(mac_i686_gcc_text " /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/tmp//ccnhXAGL.o -lSystem -lgcc -lSystem") set(mac_i686_gcc_libs "") set(mac_i686_gcc_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib") list(APPEND platforms mac_i686_gcc) +# g++ -arch i686 dummy.cxx -v -Wl,-v +set(mac_i686_g++_Wlv_text " /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/tmp//ccEXXICh.o -lstdc++ -lSystem -lgcc -lSystem +collect2 version 4.2.1 (Apple Inc. build 5646) (i686 Darwin) +/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/tmp//ccWrBoVl.o -v -lstdc++ -lSystem -lgcc -lSystem +@(#)PROGRAM:ld PROJECT:ld64-95.2.12 +Library search paths: + /usr/lib/i686-apple-darwin10/4.2.1 + /usr/lib/gcc/i686-apple-darwin10/4.2.1 + /usr/lib/gcc/i686-apple-darwin10/4.2.1 + /usr/lib/i686-apple-darwin10/4.2.1 + /usr/lib + /usr/lib + /usr/local/lib +Framework search paths: + /Library/Frameworks/ + /System/Library/Frameworks/") +set(mac_i686_g++_Wlv_libs "stdc++") +set(mac_i686_g++_Wlv_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib") +set(mac_i686_g++_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") +list(APPEND platforms mac_i686_g++_Wlv) + # g++ -arch i686 dummy.cxx -v set(mac_i686_g++_text " /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/tmp//ccEXXICh.o -lstdc++ -lSystem -lgcc -lSystem") set(mac_i686_g++_libs "stdc++") set(mac_i686_g++_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib") list(APPEND platforms mac_i686_g++) +# gfortran dummy.f -v -Wl,-v +set(mac_i686_gfortran_Wlv_text " /usr/local/libexec/gcc/i386-apple-darwin9.7.0/4.4.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/local/lib/gcc/i386-apple-darwin9.7.0/4.4.1 -L/usr/local/lib/gcc/i386-apple-darwin9.7.0/4.4.1/../../.. /var/tmp//cc9zXNax.o -v -lgfortranbegin -lgfortran -lgcc_s.10.5 -lgcc -lSystem +collect2 version 4.4.1 20090623 (prerelease) (i686 Darwin) +/usr/bin/ld -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/local/lib/gcc/i386-apple-darwin9.7.0/4.4.1 -L/usr/local/lib/gcc/i386-apple-darwin9.7.0/4.4.1/../../.. /var/tmp//cc9zXNax.o -v -lgfortranbegin -lgfortran -lgcc_s.10.5 -lgcc -lSystem +@(#)PROGRAM:ld PROJECT:ld64-95.2.12 +Library search paths: + /usr/local/lib/gcc/i386-apple-darwin9.7.0/4.4.1 + /usr/local/lib + /usr/lib + /usr/local/lib +Framework search paths: + /Library/Frameworks/ + /System/Library/Frameworks/") +set(mac_i686_gfortran_Wlv_libs "gfortranbegin;gfortran") +set(mac_i686_gfortran_Wlv_dirs "/usr/local/lib/gcc/i386-apple-darwin9.7.0/4.4.1;/usr/local/lib;/usr/lib") +set(mac_i686_gfortran_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") +list(APPEND platforms mac_i686_gfortran_Wlv) + # gfortran dummy.f -v set(mac_i686_gfortran_text " /usr/libexec/gcc/i386-apple-darwin9.7.0/4.4.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/gcc/i386-apple-darwin9.7.0/4.4.1 -L/usr/lib/gcc -L/usr/lib/gcc/i386-apple-darwin9.7.0/4.4.1/../../.. /var/tmp//ccgqbX5P.o -lgfortranbegin -lgfortran -lgcc_s.10.5 -lgcc -lSystem") set(mac_i686_gfortran_libs "gfortranbegin;gfortran") set(mac_i686_gfortran_dirs "/usr/lib/gcc/i386-apple-darwin9.7.0/4.4.1;/usr/lib/gcc;/usr/lib") list(APPEND platforms mac_i686_gfortran) +# gcc -arch ppc dummy.c -v -Wl,-v +set(mac_ppc_gcc_Wlv_text " /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/collect2 -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//cclziQY4.o -v -lgcc -lSystemStubs -lSystem +collect2 version 4.2.1 (Apple Inc. build 5646) (Darwin/PowerPC) +/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/ld -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//cclziQY4.o -v -lgcc -lSystemStubs -lSystem +@(#)PROGRAM:ld PROJECT:ld64-95.2.12 +Library search paths: + /usr/lib/powerpc-apple-darwin10/4.2.1 + /usr/lib/gcc/powerpc-apple-darwin10/4.2.1 + /usr/lib/gcc/powerpc-apple-darwin10/4.2.1 + /usr/lib/powerpc-apple-darwin10/4.2.1 + /usr/lib + /usr/lib + /usr/local/lib +Framework search paths: + /Library/Frameworks/ + /System/Library/Frameworks/") +set(mac_ppc_gcc_Wlv_libs "") +set(mac_ppc_gcc_Wlv_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib") +set(mac_ppc_gcc_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") +list(APPEND platforms mac_ppc_gcc_Wlv) + # gcc -arch ppc dummy.c -v set(mac_ppc_gcc_text " /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/collect2 -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//ccdcolsP.o -lgcc -lSystemStubs -lSystem") set(mac_ppc_gcc_libs "") set(mac_ppc_gcc_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib") list(APPEND platforms mac_ppc_gcc) +# g++ -arch ppc dummy.cxx -v -Wl,-v +set(mac_ppc_g++_Wlv_text " /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/collect2 -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//ccaFTkwq.o -v -lstdc++ -lgcc -lSystemStubs -lSystem +collect2 version 4.2.1 (Apple Inc. build 5646) (Darwin/PowerPC) +/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/ld -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//ccaFTkwq.o -v -lstdc++ -lgcc -lSystemStubs -lSystem +@(#)PROGRAM:ld PROJECT:ld64-95.2.12 +Library search paths: + /usr/lib/powerpc-apple-darwin10/4.2.1 + /usr/lib/gcc/powerpc-apple-darwin10/4.2.1 + /usr/lib/gcc/powerpc-apple-darwin10/4.2.1 + /usr/lib/powerpc-apple-darwin10/4.2.1 + /usr/lib + /usr/lib + /usr/local/lib +Framework search paths: + /Library/Frameworks/ + /System/Library/Frameworks/") +set(mac_ppc_g++_Wlv_libs "stdc++") +set(mac_ppc_g++_Wlv_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib") +set(mac_ppc_g++_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks") +list(APPEND platforms mac_ppc_g++_Wlv) + # g++ -arch ppc dummy.cxx -v set(mac_ppc_g++_text " /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/collect2 -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//ccbjB6Lj.o -lstdc++ -lgcc -lSystemStubs -lSystem") set(mac_ppc_g++_libs "stdc++") @@ -402,10 +510,10 @@ list(APPEND platforms msys_g77) # Test parsing for all above examples. foreach(p IN LISTS platforms) - cmake_parse_implicit_link_info("${${p}_text}" libs dirs log "${${p}_obj_regex}") + cmake_parse_implicit_link_info("${${p}_text}" libs dirs fwks log "${${p}_obj_regex}") - foreach(v libs dirs) - if(NOT "${${v}}" STREQUAL "${${p}_${v}}") + foreach(v libs dirs fwks) + if(DEFINED "${p}_${v}" AND NOT "${${v}}" STREQUAL "${${p}_${v}}") message(FATAL_ERROR "cmake_parse_implicit_link_info failed\n" "Expected '${p}' implicit ${v}\n" diff --git a/Tests/CMakeTests/IncludeTest.cmake.in b/Tests/CMakeTests/IncludeTest.cmake.in index eca679b4a..985333c4b 100644 --- a/Tests/CMakeTests/IncludeTest.cmake.in +++ b/Tests/CMakeTests/IncludeTest.cmake.in @@ -9,18 +9,18 @@ set(fileTwo "${CMAKE_ROOT}/Modules/CMake.cmake") if(WIN32) string(TOLOWER "${fileOne}" fileOne) string(TOLOWER "${fileTwo}" fileTwo) -endif(WIN32) +endif() if(NOT "${fileOne}" STREQUAL "${fileTwo}") message(FATAL_ERROR "Wrong CMake.cmake was included: \"${fileOne}\" expected \"${fileTwo}\"") -endif(NOT "${fileOne}" STREQUAL "${fileTwo}") +endif() # this one must return NOTFOUND in _includedFile include(I_do_not_exist OPTIONAL RESULT_VARIABLE _includedFile) if(_includedFile) message(FATAL_ERROR "File \"I_do_not_exist\" was included, although it shouldn't exist,\nIncluded file is \"${_includedFile}\"") -endif(_includedFile) +endif() # and this one must succeed too include(CMake OPTIONAL RESULT_VARIABLE _includedFile) @@ -29,11 +29,11 @@ set(fileTwo "${CMAKE_ROOT}/Modules/CMake.cmake") if(WIN32) string(TOLOWER "${fileOne}" fileOne) string(TOLOWER "${fileTwo}" fileTwo) -endif(WIN32) +endif() if(NOT "${fileOne}" STREQUAL "${fileTwo}") message(FATAL_ERROR "Wrong CMake.cmake was included: \"${fileOne}\" expected \"${fileTwo}\"") -endif(NOT "${fileOne}" STREQUAL "${fileTwo}") +endif() # Check that CMAKE_CURRENT_LIST_DIR is working: # Needs to be a file in the build tree, which is correct cmake script diff --git a/Tests/CMakeTests/List-Get-CMP0007-Warn.cmake b/Tests/CMakeTests/List-Get-CMP0007-Warn.cmake new file mode 100644 index 000000000..0a9264fdc --- /dev/null +++ b/Tests/CMakeTests/List-Get-CMP0007-Warn.cmake @@ -0,0 +1,6 @@ +set(thelist "" NEW OLD) + +list(GET thelist 1 thevalue) +if (NOT thevalue STREQUAL "OLD") + message(SEND_ERROR "returned element '${thevalue}', but expected 'OLD'") +endif() diff --git a/Tests/CMakeTests/List-Get-Invalid-Index.cmake b/Tests/CMakeTests/List-Get-Invalid-Index.cmake new file mode 100644 index 000000000..178295a20 --- /dev/null +++ b/Tests/CMakeTests/List-Get-Invalid-Index.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(GET mylist 3 result) diff --git a/Tests/CMakeTests/List-Insert-Invalid-Index.cmake b/Tests/CMakeTests/List-Insert-Invalid-Index.cmake new file mode 100644 index 000000000..4103d974b --- /dev/null +++ b/Tests/CMakeTests/List-Insert-Invalid-Index.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(INSERT mylist 3 delta) diff --git a/Tests/CMakeTests/List-Invalid-Subcommand.cmake b/Tests/CMakeTests/List-Invalid-Subcommand.cmake new file mode 100644 index 000000000..f35a1181e --- /dev/null +++ b/Tests/CMakeTests/List-Invalid-Subcommand.cmake @@ -0,0 +1 @@ +list(NO_SUCH_SUBCOMMAND mylist) diff --git a/Tests/CMakeTests/List-Length-Too-Many-Arguments.cmake b/Tests/CMakeTests/List-Length-Too-Many-Arguments.cmake new file mode 100644 index 000000000..327db6a84 --- /dev/null +++ b/Tests/CMakeTests/List-Length-Too-Many-Arguments.cmake @@ -0,0 +1 @@ +list(LENGTH mylist result one_too_many) diff --git a/Tests/CMakeTests/List-No-Arguments.cmake b/Tests/CMakeTests/List-No-Arguments.cmake new file mode 100644 index 000000000..7916aaaec --- /dev/null +++ b/Tests/CMakeTests/List-No-Arguments.cmake @@ -0,0 +1 @@ +list() diff --git a/Tests/CMakeTests/List-Remove_At-Invalid-Index.cmake b/Tests/CMakeTests/List-Remove_At-Invalid-Index.cmake new file mode 100644 index 000000000..d4f392126 --- /dev/null +++ b/Tests/CMakeTests/List-Remove_At-Invalid-Index.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(REMOVE_AT mylist 3) diff --git a/Tests/CMakeTests/List-Remove_At-Nonexistent-List.cmake b/Tests/CMakeTests/List-Remove_At-Nonexistent-List.cmake new file mode 100644 index 000000000..5266c7fe9 --- /dev/null +++ b/Tests/CMakeTests/List-Remove_At-Nonexistent-List.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(REMOVE_AT nosuchlist 0) diff --git a/Tests/CMakeTests/List-Remove_Duplicates-Nonexistent-List.cmake b/Tests/CMakeTests/List-Remove_Duplicates-Nonexistent-List.cmake new file mode 100644 index 000000000..218f2272c --- /dev/null +++ b/Tests/CMakeTests/List-Remove_Duplicates-Nonexistent-List.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(REMOVE_DUPLICATES nosuchlist) diff --git a/Tests/CMakeTests/List-Remove_Duplicates-Too-Many-Arguments.cmake b/Tests/CMakeTests/List-Remove_Duplicates-Too-Many-Arguments.cmake new file mode 100644 index 000000000..b5eb46e64 --- /dev/null +++ b/Tests/CMakeTests/List-Remove_Duplicates-Too-Many-Arguments.cmake @@ -0,0 +1 @@ +list(REMOVE_DUPLICATES mylist one_too_many) diff --git a/Tests/CMakeTests/List-Remove_Item-Nonexistent-List.cmake b/Tests/CMakeTests/List-Remove_Item-Nonexistent-List.cmake new file mode 100644 index 000000000..079e7fbce --- /dev/null +++ b/Tests/CMakeTests/List-Remove_Item-Nonexistent-List.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(REMOVE_ITEM nosuchlist alpha) diff --git a/Tests/CMakeTests/List-Reverse-Nonexistent-List.cmake b/Tests/CMakeTests/List-Reverse-Nonexistent-List.cmake new file mode 100644 index 000000000..977e2ccac --- /dev/null +++ b/Tests/CMakeTests/List-Reverse-Nonexistent-List.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(REVERSE nosuchlist) diff --git a/Tests/CMakeTests/List-Reverse-Too-Many-Arguments.cmake b/Tests/CMakeTests/List-Reverse-Too-Many-Arguments.cmake new file mode 100644 index 000000000..3a554a01a --- /dev/null +++ b/Tests/CMakeTests/List-Reverse-Too-Many-Arguments.cmake @@ -0,0 +1 @@ +list(REVERSE mylist one_too_many) diff --git a/Tests/CMakeTests/List-Sort-Nonexistent-List.cmake b/Tests/CMakeTests/List-Sort-Nonexistent-List.cmake new file mode 100644 index 000000000..8f48e1043 --- /dev/null +++ b/Tests/CMakeTests/List-Sort-Nonexistent-List.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(SORT nosuchlist) diff --git a/Tests/CMakeTests/List-Sort-Too-Many-Arguments.cmake b/Tests/CMakeTests/List-Sort-Too-Many-Arguments.cmake new file mode 100644 index 000000000..81b195d67 --- /dev/null +++ b/Tests/CMakeTests/List-Sort-Too-Many-Arguments.cmake @@ -0,0 +1 @@ +list(SORT mylist one_too_many) diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in index cf6f91a70..f0ed70f02 100644 --- a/Tests/CMakeTests/ListTest.cmake.in +++ b/Tests/CMakeTests/ListTest.cmake.in @@ -1,88 +1,187 @@ -MACRO(TEST command expected) - IF("x${result}" STREQUAL "x${expected}") - #MESSAGE("TEST \"${command}\" success: \"${result}\" expected: \"${expected}\"") - ELSE("x${result}" STREQUAL "x${expected}") - MESSAGE(SEND_ERROR "${CMAKE_CURRENT_LIST_LINE}: TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"") - ENDIF("x${result}" STREQUAL "x${expected}") -ENDMACRO(TEST command expected) +include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") -SET(mylist andy bill ken brad) +macro(TEST command expected) + if("x${result}" STREQUAL "x${expected}") + #message("TEST \"${command}\" success: \"${result}\" expected: \"${expected}\"") + else() + message(SEND_ERROR "${CMAKE_CURRENT_LIST_LINE}: TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"") + endif() +endmacro() -LIST(LENGTH mylist result) +set(mylist andy bill ken brad) + +list(LENGTH mylist result) TEST("LENGTH mylist result" "4") -LIST(LENGTH "mylist" result) +list(LENGTH "mylist" result) TEST("LENGTH \"mylist\" result" "4") -LIST(LENGTH "nonexiting_list1" result) +list(LENGTH "nonexiting_list1" result) TEST("LENGTH \"nonexiting_list1\" result" "0") -LIST(GET mylist 3 2 1 0 result) +list(GET mylist 3 2 1 0 result) TEST("GET mylist 3 2 1 0 result" "brad;ken;bill;andy") -LIST(GET mylist 0 item0) -LIST(GET mylist 1 item1) -LIST(GET mylist 2 item2) -LIST(GET mylist 3 item3) -SET(result "${item3}" "${item0}" "${item1}" "${item2}") +list(GET mylist 0 item0) +list(GET mylist 1 item1) +list(GET mylist 2 item2) +list(GET mylist 3 item3) +set(result "${item3}" "${item0}" "${item1}" "${item2}") TEST("GET individual 3 2 1 0 result" "brad;andy;bill;ken") -LIST(GET mylist -1 -2 -3 -4 result) +list(GET mylist -1 -2 -3 -4 result) TEST("GET mylist -1 -2 -3 -4 result" "brad;ken;bill;andy") -LIST(GET mylist -1 2 -3 0 result) +list(GET mylist -1 2 -3 0 result) TEST("GET mylist -1 2 -3 0 ${result}" "brad;ken;bill;andy") -LIST(GET "nonexiting_list2" 1 result) +list(GET "nonexiting_list2" 1 result) TEST("GET \"nonexiting_list2\" 1 result" "NOTFOUND") -SET(result andy) -LIST(APPEND result brad) +set(result andy) +list(APPEND result brad) TEST("APPEND result brad" "andy;brad") -LIST(APPEND "nonexiting_list3" brad) -SET(result "${nonexiting_list3}") +list(APPEND "nonexiting_list3" brad) +set(result "${nonexiting_list3}") TEST("APPEND \"nonexiting_list3\" brad" "brad") -LIST(INSERT "nonexiting_list4" 0 andy bill brad ken) -SET(result "${nonexiting_list4}") +list(INSERT "nonexiting_list4" 0 andy bill brad ken) +set(result "${nonexiting_list4}") TEST("APPEND \"nonexiting_list4\" andy bill brad ken" "andy;bill;brad;ken") -SET(result andy brad) -LIST(INSERT result -1 bill ken) +set(result andy brad) +list(INSERT result -1 bill ken) TEST("INSERT result -1 bill ken" "andy;bill;ken;brad") -SET(result andy bill brad ken bob) -LIST(REMOVE_ITEM result bob) +set(result andy bill brad ken bob) +list(REMOVE_ITEM result bob) TEST("REMOVE_ITEM result bob" "andy;bill;brad;ken") -SET(result andy bill bob brad ken peter) -LIST(REMOVE_ITEM result peter bob) +set(result andy bill bob brad ken peter) +list(REMOVE_ITEM result peter bob) TEST("REMOVE_ITEM result peter bob" "andy;bill;brad;ken") -SET(result bob andy bill bob brad ken bob) -LIST(REMOVE_ITEM result bob) +set(result bob andy bill bob brad ken bob) +list(REMOVE_ITEM result bob) TEST("REMOVE_ITEM result bob" "andy;bill;brad;ken") -SET(result andy bill bob brad ken peter) -LIST(REMOVE_AT result 2 -1) +set(result andy bill bob brad ken peter) +list(REMOVE_AT result 2 -1) TEST("REMOVE_AT result 2 -1" "andy;bill;brad;ken") # ken is at index 2, nobody is not in the list so -1 should be returned -SET(mylist andy bill ken brad) -LIST(FIND mylist ken result) +set(mylist andy bill ken brad) +list(FIND mylist ken result) TEST("FIND mylist ken result" "2") -LIST(FIND mylist nobody result) +list(FIND mylist nobody result) TEST("FIND mylist nobody result" "-1") -SET(result ken bill andy brad) -LIST(SORT result) +set(result ken bill andy brad) +list(SORT result) TEST("SORT result" "andy;bill;brad;ken") -SET(result andy bill brad ken) -LIST(REVERSE result) +set(result andy bill brad ken) +list(REVERSE result) TEST("REVERSE result" "ken;brad;bill;andy") -SET(result bill andy bill brad ken ken ken) -LIST(REMOVE_DUPLICATES result) +set(result bill andy bill brad ken ken ken) +list(REMOVE_DUPLICATES result) TEST("REMOVE_DUPLICATES result" "bill;andy;brad;ken") + +# these commands should just do nothing if the list is already empty +set(result "") +list(REMOVE_DUPLICATES result) +TEST("REMOVE_DUPLICATES empty result" "") + +list(REVERSE result) +TEST("REVERSE empty result" "") + +list(SORT result) +TEST("SORT empty result" "") + +set(No-Arguments-RESULT 1) +set(No-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-No-Arguments.cmake:1 \\(list\\):.*list must be called with at least two arguments.*") + +# these trigger top-level condition +foreach(cmd IN ITEMS Append Find Get Insert Length Reverse Remove_At Remove_Duplicates Remove_Item Sort) + set(${cmd}-No-Arguments-RESULT 1) + set(${cmd}-No-Arguments-STDERR ".*CMake Error at List-${cmd}-No-Arguments.cmake:1 \\(list\\):.*list must be called with at least two arguments.*") + string(TOUPPER ${cmd} cmd_upper) + set(_test_file_name "${CMAKE_CURRENT_BINARY_DIR}/List-${cmd}-No-Arguments.cmake") + file(WRITE "${_test_file_name}" "list(${cmd_upper})\n") + check_cmake_test_single(List "${cmd}-No-Arguments" "${_test_file_name}") +endforeach() + +set(Get-List-Only-STDERR "at least three") +set(Find-List-Only-STDERR "three") +set(Insert-List-Only-STDERR "at least three") +set(Length-List-Only-STDERR "two") +set(Remove_At-List-Only-STDERR "at least two") +set(Remove_Item-List-Only-STDERR "two or more") + +foreach(cmd IN ITEMS Find Get Insert Length Remove_At Remove_Item) + string(TOUPPER ${cmd} cmd_upper) + set(${cmd}-List-Only-RESULT 1) + set(${cmd}-List-Only-STDERR ".*CMake Error at List-${cmd}-List-Only.cmake:1 \\(list\\):.*list sub-command ${cmd_upper} requires ${${cmd}-List-Only-STDERR} arguments.*") + set(_test_file_name "${CMAKE_CURRENT_BINARY_DIR}/List-${cmd}-List-Only.cmake") + file(WRITE "${_test_file_name}" "list(${cmd_upper} mylist)\n") + check_cmake_test_single(List "${cmd}-List-Only" "${_test_file_name}") +endforeach() + +set(Length-Too-Many-Arguments-RESULT 1) +set(Length-Too-Many-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Length-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command LENGTH requires two arguments.*") + +set(Reverse-Too-Many-Arguments-RESULT 1) +set(Reverse-Too-Many-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Reverse-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command REVERSE only takes one argument.*") + +set(Remove_Duplicates-Too-Many-Arguments-RESULT 1) +set(Remove_Duplicates-Too-Many-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Remove_Duplicates-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command REMOVE_DUPLICATES only takes one argument.*") + +set(Sort-Too-Many-Arguments-RESULT 1) +set(Sort-Too-Many-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Sort-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command SORT only takes one argument.*") + +set(Invalid-Subcommand-RESULT 1) +set(Invalid-Subcommand-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Invalid-Subcommand.cmake:1 \\(list\\):.*list does not recognize sub-command NO_SUCH_SUBCOMMAND.*") + +foreach(cmd Get Insert Remove_At) + set(${cmd}-Invalid-Index-RESULT 1) + set(${cmd}-Invalid-Index-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-${cmd}-Invalid-Index.cmake:2 \\(list\\):.*list index: 3 out of range \\(-3, 2\\).*") +endforeach() + +foreach(cmd Remove_Item Reverse Remove_Duplicates Sort Remove_At) + string(TOUPPER ${cmd} Cmd) + set(${cmd}-Nonexistent-List-RESULT 1) + set(${cmd}-Nonexistent-List-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-${cmd}-Nonexistent-List.cmake:2 \\(list\\):.*sub-command ${Cmd} requires list to be present.*") +endforeach() + +set(Get-CMP0007-Warn-RESULT 0) +set(Get-CMP0007-Warn-STDERR ".*CMake Warning \\(dev\\) at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Get-CMP0007-Warn.cmake:3 \\(list\\):.*Policy CMP0007 is not set:.*") + +check_cmake_test(List + No-Arguments + Length-Too-Many-Arguments + Reverse-Too-Many-Arguments + Remove_Duplicates-Too-Many-Arguments + Sort-Too-Many-Arguments + Invalid-Subcommand + Get-Invalid-Index + Insert-Invalid-Index + Remove_Item-Nonexistent-List + Reverse-Nonexistent-List + Remove_Duplicates-Nonexistent-List + Sort-Nonexistent-List + Remove_At-Nonexistent-List + Remove_At-Invalid-Index + Get-CMP0007-Warn +) + +set(thelist "" NEW OLD) + +foreach (_pol ${thelist}) + cmake_policy(SET CMP0007 ${_pol}) + list(GET thelist 1 thevalue) + if (NOT thevalue STREQUAL _pol) + message(SEND_ERROR "returned element '${thevalue}', but expected '${_pol}'") + endif() +endforeach (_pol) diff --git a/Tests/CMakeTests/Make_Directory-NoArg.cmake b/Tests/CMakeTests/Make_Directory-NoArg.cmake new file mode 100644 index 000000000..25b6f8984 --- /dev/null +++ b/Tests/CMakeTests/Make_Directory-NoArg.cmake @@ -0,0 +1 @@ +file(MAKE_DIRECTORY) diff --git a/Tests/CMakeTests/ProcessorCountTest.cmake.in b/Tests/CMakeTests/ProcessorCountTest.cmake.in index 98f6ab16d..f92dcc44c 100644 --- a/Tests/CMakeTests/ProcessorCountTest.cmake.in +++ b/Tests/CMakeTests/ProcessorCountTest.cmake.in @@ -9,10 +9,17 @@ message("### 3. ProcessorCount(...) function call is emitting output that it sho message("processor_count='${processor_count}'") execute_process( - COMMAND "@CMAKE_BINARY_DIR@/Source/kwsys/$ENV{CMAKE_CONFIG_TYPE}/cmsysTestsCxx" + COMMAND "${KWSYS_TEST_EXE}" testSystemInformation OUTPUT_VARIABLE tsi_out - ERROR_VARIABLE tsi_err) + ERROR_VARIABLE tsi_err + RESULT_VARIABLE tsi_res +) +if (tsi_res) + message("executing \"${KWSYS_TEST_EXE}\" failed") + message(FATAL_ERROR "output: ${tsi_res}") +endif () + string(REGEX REPLACE "(.*)GetNumberOfPhysicalCPU:.([0-9]*)(.*)" "\\2" system_info_processor_count "${tsi_out}") diff --git a/Tests/CMakeTests/String-TIMESTAMP-AllSpecifiers.cmake b/Tests/CMakeTests/String-TIMESTAMP-AllSpecifiers.cmake new file mode 100644 index 000000000..2d0fcc89c --- /dev/null +++ b/Tests/CMakeTests/String-TIMESTAMP-AllSpecifiers.cmake @@ -0,0 +1,11 @@ +string(TIMESTAMP output "%d;%H;%I;%j;%m;%M;%S;%U;%w;%y;%Y") +message("~${output}~") + +list(LENGTH output output_length) + +set(expected_output_length 11) + +if(NOT output_length EQUAL ${expected_output_length}) + message(FATAL_ERROR "expected ${expected_output_length} entries in output " + "with all specifiers; found ${output_length}") +endif() diff --git a/Tests/CMakeTests/String-TIMESTAMP-BadArg1.cmake b/Tests/CMakeTests/String-TIMESTAMP-BadArg1.cmake new file mode 100644 index 000000000..8f2d9f8b4 --- /dev/null +++ b/Tests/CMakeTests/String-TIMESTAMP-BadArg1.cmake @@ -0,0 +1 @@ +string(TIMESTAMP) diff --git a/Tests/CMakeTests/String-TIMESTAMP-BadArg2.cmake b/Tests/CMakeTests/String-TIMESTAMP-BadArg2.cmake new file mode 100644 index 000000000..c1e512684 --- /dev/null +++ b/Tests/CMakeTests/String-TIMESTAMP-BadArg2.cmake @@ -0,0 +1 @@ +string(TIMESTAMP output_variable "%Y" UTF) diff --git a/Tests/CMakeTests/String-TIMESTAMP-BadArg3.cmake b/Tests/CMakeTests/String-TIMESTAMP-BadArg3.cmake new file mode 100644 index 000000000..3d577df3f --- /dev/null +++ b/Tests/CMakeTests/String-TIMESTAMP-BadArg3.cmake @@ -0,0 +1 @@ +string(TIMESTAMP output_variable "%Y" UTC UTC) diff --git a/Tests/CMakeTests/String-TIMESTAMP-CustomFormatLocal.cmake b/Tests/CMakeTests/String-TIMESTAMP-CustomFormatLocal.cmake new file mode 100644 index 000000000..eab2a45de --- /dev/null +++ b/Tests/CMakeTests/String-TIMESTAMP-CustomFormatLocal.cmake @@ -0,0 +1,2 @@ +string(TIMESTAMP output "%S") +message("~${output}~") diff --git a/Tests/CMakeTests/String-TIMESTAMP-CustomFormatUTC.cmake b/Tests/CMakeTests/String-TIMESTAMP-CustomFormatUTC.cmake new file mode 100644 index 000000000..eab2a45de --- /dev/null +++ b/Tests/CMakeTests/String-TIMESTAMP-CustomFormatUTC.cmake @@ -0,0 +1,2 @@ +string(TIMESTAMP output "%S") +message("~${output}~") diff --git a/Tests/CMakeTests/String-TIMESTAMP-DefaultFormatLocal.cmake b/Tests/CMakeTests/String-TIMESTAMP-DefaultFormatLocal.cmake new file mode 100644 index 000000000..d7c7dde1c --- /dev/null +++ b/Tests/CMakeTests/String-TIMESTAMP-DefaultFormatLocal.cmake @@ -0,0 +1,2 @@ +string(TIMESTAMP output) +message("~${output}~") diff --git a/Tests/CMakeTests/String-TIMESTAMP-DefaultFormatUTC.cmake b/Tests/CMakeTests/String-TIMESTAMP-DefaultFormatUTC.cmake new file mode 100644 index 000000000..dad6a8d97 --- /dev/null +++ b/Tests/CMakeTests/String-TIMESTAMP-DefaultFormatUTC.cmake @@ -0,0 +1,2 @@ +string(TIMESTAMP output UTC) +message("~${output}~") diff --git a/Tests/CMakeTests/String-TIMESTAMP-IncompleteSpecifier.cmake b/Tests/CMakeTests/String-TIMESTAMP-IncompleteSpecifier.cmake new file mode 100644 index 000000000..ffc5656fa --- /dev/null +++ b/Tests/CMakeTests/String-TIMESTAMP-IncompleteSpecifier.cmake @@ -0,0 +1,2 @@ +string(TIMESTAMP output "foobar%") +message("~${output}~") diff --git a/Tests/CMakeTests/String-TIMESTAMP-UnknownSpecifier.cmake b/Tests/CMakeTests/String-TIMESTAMP-UnknownSpecifier.cmake new file mode 100644 index 000000000..0e145e5ec --- /dev/null +++ b/Tests/CMakeTests/String-TIMESTAMP-UnknownSpecifier.cmake @@ -0,0 +1,2 @@ +string(TIMESTAMP output "%g") +message("~${output}~") diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in index 49e7dc90c..a9fe428e3 100644 --- a/Tests/CMakeTests/StringTest.cmake.in +++ b/Tests/CMakeTests/StringTest.cmake.in @@ -16,6 +16,26 @@ set(SHA384-Works-RESULT 0) set(SHA384-Works-STDERR "1de9560b4e030e02051ea408200ffc55d70c97ac64ebf822461a5c786f495c36df43259b14483bc8d364f0106f4971ee") set(SHA512-Works-RESULT 0) set(SHA512-Works-STDERR "3982a1b4e651768bec70ab1fb97045cb7a659f4ba7203d501c52ab2e803071f9d5fd272022df15f27727fc67f8cd022e710e29010b2a9c0b467c111e2f6abf51") +set(TIMESTAMP-BadArg1-RESULT 1) +set(TIMESTAMP-BadArg1-STDERR "string sub-command TIMESTAMP requires at least one argument") +set(TIMESTAMP-BadArg2-RESULT 1) +set(TIMESTAMP-BadArg2-STDERR "string TIMESTAMP sub-command does not recognize option UTF") +set(TIMESTAMP-BadArg3-RESULT 1) +set(TIMESTAMP-BadArg3-STDERR "string sub-command TIMESTAMP takes at most three arguments") +set(TIMESTAMP-DefaultFormatLocal-RESULT 0) +set(TIMESTAMP-DefaultFormatLocal-STDERR "~[0-9]*-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-6][0-9]~") +set(TIMESTAMP-DefaultFormatUTC-RESULT 0) +set(TIMESTAMP-DefaultFormatUTC-STDERR "~[0-9]*-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-6][0-9]Z~") +set(TIMESTAMP-CustomFormatLocal-RESULT 0) +set(TIMESTAMP-CustomFormatLocal-STDERR "~([0-5][0-9])|60~") +set(TIMESTAMP-CustomFormatUTC-RESULT 0) +set(TIMESTAMP-CustomFormatUTC-STDERR "~([0-5][0-9])|60~") +set(TIMESTAMP-UnknownSpecifier-RESULT 0) +set(TIMESTAMP-UnknownSpecifier-STDERR "~%g~") +set(TIMESTAMP-IncompleteSpecifier-RESULT 0) +set(TIMESTAMP-IncompleteSpecifier-STDERR "~foobar%~") +set(TIMESTAMP-AllSpecifiers-RESULT 0) +set(TIMESTAMP-AllSpecifiers-STDERR "~[0-9]+(;[0-9]+)*~") include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") check_cmake_test(String @@ -28,6 +48,16 @@ check_cmake_test(String SHA256-Works SHA384-Works SHA512-Works + TIMESTAMP-BadArg1 + TIMESTAMP-BadArg2 + TIMESTAMP-BadArg3 + TIMESTAMP-DefaultFormatLocal + TIMESTAMP-DefaultFormatUTC + TIMESTAMP-CustomFormatLocal + TIMESTAMP-CustomFormatUTC + TIMESTAMP-UnknownSpecifier + TIMESTAMP-IncompleteSpecifier + TIMESTAMP-AllSpecifiers ) # Execute each test listed in StringTestScript.cmake: diff --git a/Tests/CMakeTests/StringTestScript.cmake b/Tests/CMakeTests/StringTestScript.cmake index 7a264a0e2..a562e71d3 100644 --- a/Tests/CMakeTests/StringTestScript.cmake +++ b/Tests/CMakeTests/StringTestScript.cmake @@ -236,42 +236,42 @@ elseif(testname STREQUAL string_find_with_no_possible_result) # pass message(STATUS "v='${v}'") if(NOT(-1 EQUAL ${v})) message(SEND_ERROR "FIND sub-command should return -1 but returned ${v}.") - endif(NOT(-1 EQUAL ${v})) + endif() elseif(testname STREQUAL string_find_reverse_with_no_possible_result) # pass string(FIND "CMake is a great application." "z" v REVERSE) message(STATUS "v='${v}'") if(NOT(-1 EQUAL ${v})) message(SEND_ERROR "FIND REVERSE sub-command should return -1 but returned ${v}.") - endif(NOT(-1 EQUAL ${v})) + endif() elseif(testname STREQUAL string_find_with_required_result) # pass string(FIND "CMake is a great application." "g" v) message(STATUS "v='${v}'") if(NOT(11 EQUAL ${v})) message(SEND_ERROR "FIND sub-command should return 11 but returned ${v}.") - endif(NOT(11 EQUAL ${v})) + endif() elseif(testname STREQUAL string_find_reverse_with_required_result) # pass string(FIND "CMake is a great application." "e" v REVERSE) message(STATUS "v='${v}'") if(NOT(13 EQUAL ${v})) message(SEND_ERROR "FIND REVERSE sub-command should return 13 but returned ${v}.") - endif(NOT(13 EQUAL ${v})) + endif() elseif(testname STREQUAL string_find_word_reverse_with_required_result) # pass string(FIND "The command should find REVERSE in this string. Or maybe this REVERSE?!" "REVERSE" v) message(STATUS "v='${v}'") if(NOT(24 EQUAL ${v})) message(SEND_ERROR "FIND sub-command should return 24 but returned ${v}.") - endif(NOT(24 EQUAL ${v})) + endif() elseif(testname STREQUAL string_find_reverse_word_reverse_with_required_result) # pass string(FIND "The command should find REVERSE in this string. Or maybe this REVERSE?!" "REVERSE" v REVERSE) message(STATUS "v='${v}'") if(NOT(62 EQUAL ${v})) message(SEND_ERROR "FIND sub-command should return 62 but returned ${v}.") - endif(NOT(62 EQUAL ${v})) + endif() else() # fail message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'") diff --git a/Tests/CMakeTests/ToolchainTest.cmake.in b/Tests/CMakeTests/ToolchainTest.cmake.in index e4a2e4813..96e7196a5 100644 --- a/Tests/CMakeTests/ToolchainTest.cmake.in +++ b/Tests/CMakeTests/ToolchainTest.cmake.in @@ -1,12 +1,12 @@ ############################################################ # some preparations so that the CMakeDetermineXXX.cmake files will work in scripted mode -# overwrite MARK_AS_ADVANCED(), since this is used in CMakeDetermineCCompiler.cmake +# overwrite mark_as_advanced(), since this is used in CMakeDetermineCCompiler.cmake # which will complain that it can"t be used in script mode macro(MARK_AS_ADVANCED) -endmacro(MARK_AS_ADVANCED) +endmacro() # set this to a place where we are allowed to write -set(CMAKE_PLATFORM_ROOT_BIN "${CMAKE_CURRENT_BINARY_DIR}") +set(CMAKE_PLATFORM_INFO_DIR "${CMAKE_CURRENT_BINARY_DIR}") # don't run the compiler detection set(CMAKE_C_COMPILER_ID_RUN 1) @@ -21,19 +21,19 @@ include(CMakeDetermineSystem) # check that CMAKE_SYSTEM_XXX and CMAKE_HOST_SYSTEM_xxx are identical if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "${CMAKE_HOST_SYSTEM_NAME}") message(FATAL_ERROR "CMAKE_SYSTEM_NAME and CMAKE_HOST_SYSTEM_NAME not identical: \"${CMAKE_SYSTEM_NAME}\" vs. \"${CMAKE_HOST_SYSTEM_NAME}\"") -endif(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "${CMAKE_HOST_SYSTEM_NAME}") +endif() if(NOT "${CMAKE_SYSTEM}" STREQUAL "${CMAKE_HOST_SYSTEM}") message(FATAL_ERROR "CMAKE_SYSTEM and CMAKE_HOST_SYSTEM not identical: \"${CMAKE_SYSTEM}\" vs. \"${CMAKE_HOST_SYSTEM}\"") -endif(NOT "${CMAKE_SYSTEM}" STREQUAL "${CMAKE_HOST_SYSTEM}") +endif() if(NOT "${CMAKE_SYSTEM_VERSION}" STREQUAL "${CMAKE_HOST_SYSTEM_VERSION}") message(FATAL_ERROR "CMAKE_SYSTEM_VERSION and CMAKE_HOST_SYSTEM_VERSION not identical: \"${CMAKE_SYSTEM_VERSION}\" vs. \"${CMAKE_HOST_SYSTEM_VERSION}\"") -endif(NOT "${CMAKE_SYSTEM_VERSION}" STREQUAL "${CMAKE_HOST_SYSTEM_VERSION}") +endif() if(NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}") message(FATAL_ERROR "CMAKE_SYSTEM_PROCESSOR and CMAKE_HOST_SYSTEM_PROCESSOR not identical: \"${CMAKE_SYSTEM_PROCESSOR}\" vs. \"${CMAKE_HOST_SYSTEM_PROCESSOR}\"") -endif(NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}") +endif() # save the values so we can compare them to CMAKE_HOST_SYSTEM_XXX in the toolchain case @@ -55,7 +55,7 @@ set(CMAKE_HOST_SYSTEM_PROCESSOR) ############################################################ -# now define a toolchain file and check that everything is +# now define a toolchain file and check that everything is # detected correctly and nothing predefined is overwritten set(CMAKE_TOOLCHAIN_FILE "${MY_SOURCE_DIR}/DummyToolchain.cmake") @@ -73,35 +73,35 @@ include(CMakeDetermineCXXCompiler) if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Dumdidum") message(FATAL_ERROR "CMAKE_SYSTEM_NAME overwritten: \"${CMAKE_SYSTEM_NAME}\", was: \"Dumdidum\"") -endif(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Dumdidum") +endif() if(NOT "${CMAKE_SYSTEM}" STREQUAL "Dumdidum-1.0") message(FATAL_ERROR "CMAKE_SYSTEM wrong: \"${CMAKE_SYSTEM}\", expected: \"Dumdidum-1.0\"") -endif(NOT "${CMAKE_SYSTEM}" STREQUAL "Dumdidum-1.0") +endif() set(fileOne "${_INCLUDED_TOOLCHAIN_FILE}") set(fileTwo "${MY_SOURCE_DIR}/DummyToolchain.cmake") if(WIN32) string(TOLOWER "${fileOne}" fileOne) string(TOLOWER "${fileTwo}" fileTwo) -endif(WIN32) +endif() if(NOT "${fileOne}" STREQUAL "${fileTwo}") message(FATAL_ERROR "Wrong toolchain was loaded: \"${fileOne}\" expected \"${fileTwo}\"") -endif(NOT "${fileOne}" STREQUAL "${fileTwo}") +endif() # check that CMAKE_HOST_SYSTEM_XXX and _SYSTEM_xxx detected above are identical if(NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "${NATIVE_SYSTEM_NAME}") message(FATAL_ERROR "CMAKE_HOST_SYSTEM_NAME and NATIVE_SYSTEM_NAME not identical: \"${CMAKE_HOST_SYSTEM_NAME}\" vs. \"${NATIVE_SYSTEM_NAME}\"") -endif(NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "${NATIVE_SYSTEM_NAME}") +endif() if(NOT "${CMAKE_HOST_SYSTEM}" STREQUAL "${NATIVE_SYSTEM}") message(FATAL_ERROR "CMAKE_HOST_SYSTEM and NATIVE_SYSTEM not identical: \"${CMAKE_HOST_SYSTEM}\" vs. \"${NATIVE_SYSTEM}\"") -endif(NOT "${CMAKE_HOST_SYSTEM}" STREQUAL "${NATIVE_SYSTEM}") +endif() if(NOT "${CMAKE_HOST_SYSTEM_VERSION}" STREQUAL "${NATIVE_SYSTEM_VERSION}") message(FATAL_ERROR "CMAKE_HOST_SYSTEM_VERSION and NATIVE_SYSTEM_VERSION not identical: \"${CMAKE_HOST_SYSTEM_VERSION}\" vs. \"${NATIVE_SYSTEM_VERSION}\"") -endif(NOT "${CMAKE_HOST_SYSTEM_VERSION}" STREQUAL "${NATIVE_SYSTEM_VERSION}") +endif() if(NOT "${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "${NATIVE_SYSTEM_PROCESSOR}") message(FATAL_ERROR "CMAKE_HOST_SYSTEM_PROCESSOR and NATIVE_SYSTEM_PROCESSOR not identical: \"${CMAKE_HOST_SYSTEM_PROCESSOR}\" vs. \"${NATIVE_SYSTEM_PROCESSOR}\"") -endif(NOT "${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "${NATIVE_SYSTEM_PROCESSOR}") +endif() ############################################################# @@ -109,15 +109,15 @@ endif(NOT "${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "${NATIVE_SYSTEM_PROCESSOR}" if(NOT "${_CMAKE_TOOLCHAIN_PREFIX}" STREQUAL "arm-elf-") message(FATAL_ERROR "wrong toolchain prefix detected: \"${_CMAKE_TOOLCHAIN_PREFIX}\", expected: \"arm-elf-\"") -endif(NOT "${_CMAKE_TOOLCHAIN_PREFIX}" STREQUAL "arm-elf-") +endif() if(NOT "${_CMAKE_USER_C_COMPILER_PATH}" STREQUAL "/opt/foo/bin") message(FATAL_ERROR "wrong C compiler location detected: \"${_CMAKE_USER_C_COMPILER_PATH}\", expected: \"/opt/foo/bin\"") -endif(NOT "${_CMAKE_USER_C_COMPILER_PATH}" STREQUAL "/opt/foo/bin") +endif() if(NOT "${CMAKE_C_OUTPUT_EXTENSION}" STREQUAL ".foo") message(FATAL_ERROR "C output extension overwritten: \"${CMAKE_C_OUTPUT_EXTENSION}\", was: \".foo\"") -endif(NOT "${CMAKE_C_OUTPUT_EXTENSION}" STREQUAL ".foo") +endif() ############################################################# @@ -125,11 +125,11 @@ endif(NOT "${CMAKE_C_OUTPUT_EXTENSION}" STREQUAL ".foo") if(NOT "${_CMAKE_USER_CXX_COMPILER_PATH}" STREQUAL "/opt/bar/bin") message(FATAL_ERROR "wrong CXX compiler location detected: \"${_CMAKE_USER_CXX_COMPILER_PATH}\", expected: \"/opt/bar/bin\"") -endif(NOT "${_CMAKE_USER_CXX_COMPILER_PATH}" STREQUAL "/opt/bar/bin") +endif() if(NOT "${CMAKE_CXX_OUTPUT_EXTENSION}" STREQUAL ".bar") message(FATAL_ERROR "C output extension overwritten: \"${CMAKE_CXX_OUTPUT_EXTENSION}\", was: \".bar\"") -endif(NOT "${CMAKE_CXX_OUTPUT_EXTENSION}" STREQUAL ".bar") +endif() message(STATUS "CMAKE_SYSTEM: \"${CMAKE_SYSTEM}\"") message(STATUS "_CMAKE_TOOLCHAIN_PREFIX: \"${_CMAKE_TOOLCHAIN_PREFIX}\"") diff --git a/Tests/CMakeTests/VariableWatchTest.cmake.in b/Tests/CMakeTests/VariableWatchTest.cmake.in index bdb4f7ec4..0c084fde8 100644 --- a/Tests/CMakeTests/VariableWatchTest.cmake.in +++ b/Tests/CMakeTests/VariableWatchTest.cmake.in @@ -1,15 +1,15 @@ -MESSAGE("Start") +message("Start") -VARIABLE_WATCH(TESTVAR MESSAGE) -VARIABLE_WATCH(TESTVAR1) +variable_watch(TESTVAR MESSAGE) +variable_watch(TESTVAR1) macro(testwatch var access file stack) - MESSAGE("There was a ${access} access done on the variable: ${var} in file ${file}") - MESSAGE("List file stack is: ${stack}") + message("There was a ${access} access done on the variable: ${var} in file ${file}") + message("List file stack is: ${stack}") set(${var}_watched 1) -endmacro(testwatch) +endmacro() -VARIABLE_WATCH(somevar testwatch) +variable_watch(somevar testwatch) set(TESTVAR1 "1") set(TESTVAR "1") diff --git a/Tests/CMakeTests/VersionTest.cmake.in b/Tests/CMakeTests/VersionTest.cmake.in index 215bb2b96..9e31cb431 100644 --- a/Tests/CMakeTests/VersionTest.cmake.in +++ b/Tests/CMakeTests/VersionTest.cmake.in @@ -7,3 +7,10 @@ if("${CMAKE_VERSION}" VERSION_LESS "${min_ver}") else() message("CMAKE_VERSION=[${CMAKE_VERSION}] is not less than [${min_ver}]") endif() + +set(v 1.2.3.4.5.6.7) +if("${v}.8" VERSION_LESS "${v}.9") + message(STATUS "${v}.8 is less than ${v}.9") +else() + message(FATAL_ERROR "${v}.8 is not less than ${v}.9?") +endif() diff --git a/Tests/CMakeTests/WhileTest.cmake.in b/Tests/CMakeTests/WhileTest.cmake.in index 4693f2d8f..4cec291a0 100644 --- a/Tests/CMakeTests/WhileTest.cmake.in +++ b/Tests/CMakeTests/WhileTest.cmake.in @@ -10,7 +10,7 @@ while(COUNT LESS 200) set(NUMBERS "${NUMBERS} ${NCOUNT}") set(NCOUNT "${NCOUNT}0") endwhile() -endwhile(COUNT LESS 200) +endwhile() if(NOT NUMBERS STREQUAL " 0 3 30 20 3 30") message(SEND_ERROR "while loop nesting error, result: '${NUMBERS}'") diff --git a/Tests/COnly/CMakeLists.txt b/Tests/COnly/CMakeLists.txt index 5ef0f1eea..b3cc43813 100644 --- a/Tests/COnly/CMakeLists.txt +++ b/Tests/COnly/CMakeLists.txt @@ -10,14 +10,14 @@ target_link_libraries(COnly testc1 testc2) if(MSVC_VERSION) set_target_properties(COnly PROPERTIES LINK_FLAGS " /NODEFAULTLIB:\"libcdg.lib\" /NODEFAULTLIB:\"libcmtg.lib\" /NODEFAULTLIB:\"foomsvcrt.lib\" /NODEFAULTLIB:\"libbar.lib\" /NODEFAULTLIB:\"libfooba.lib\"") -endif(MSVC_VERSION) +endif() string(ASCII 35 32 67 77 97 107 101 ASCII_STRING) message(STATUS "String: ${ASCII_STRING}") get_source_file_property(LANG conly.c LANGUAGE) if("${LANG}" STREQUAL "C") message("Language is C") -else("${LANG}" STREQUAL "C") +else() message(FATAL_ERROR "Bad language for file conly.c") -endif("${LANG}" STREQUAL "C") +endif() add_library(testCModule MODULE testCModule.c) diff --git a/Tests/COnly/libc2.h b/Tests/COnly/libc2.h index a99d8984e..2713d71ae 100644 --- a/Tests/COnly/libc2.h +++ b/Tests/COnly/libc2.h @@ -5,7 +5,7 @@ # define CM_TEST_LIB_EXPORT __declspec( dllimport ) # endif #else -# define CM_TEST_LIB_EXPORT +# define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float LibC2Func(); diff --git a/Tests/CPackComponents/CMakeLists.txt b/Tests/CPackComponents/CMakeLists.txt index 58f5bdffe..1cb86696a 100644 --- a/Tests/CPackComponents/CMakeLists.txt +++ b/Tests/CPackComponents/CMakeLists.txt @@ -36,7 +36,7 @@ endif() # Create installation targets. Note that we put each kind of file # into a different component via COMPONENT. These components will # be used to create the installation components. -install(TARGETS mylib +install(TARGETS mylib ARCHIVE DESTINATION lib COMPONENT libraries) diff --git a/Tests/CPackComponents/VerifyResult.cmake b/Tests/CPackComponents/VerifyResult.cmake index 850ec0022..c7c24fde1 100644 --- a/Tests/CPackComponents/VerifyResult.cmake +++ b/Tests/CPackComponents/VerifyResult.cmake @@ -4,7 +4,7 @@ message(STATUS "") if(NOT CPackComponents_BINARY_DIR) message(FATAL_ERROR "CPackComponents_BINARY_DIR not set") -endif(NOT CPackComponents_BINARY_DIR) +endif() set(expected_file_mask "") @@ -18,15 +18,15 @@ if(WIN32) ) if(NSIS_MAKENSIS_EXECUTABLE) set(expected_file_mask "${CPackComponents_BINARY_DIR}/MyLib-*.exe") - endif(NSIS_MAKENSIS_EXECUTABLE) -endif(WIN32) + endif() +endif() if(APPLE) # Always expect the *.dmg installer - PackageMaker should always # be installed on a development Mac: # set(expected_file_mask "${CPackComponents_BINARY_DIR}/MyLib-*.dmg") -endif(APPLE) +endif() if(expected_file_mask) set(expected_count 1) @@ -38,11 +38,11 @@ if(expected_file_mask) if(NOT expected_file) message(FATAL_ERROR "error: expected_file does not exist: CPackComponents test fails.") - endif(NOT expected_file) + endif() list(LENGTH expected_file actual_count) message(STATUS "actual_count='${actual_count}'") if(NOT actual_count EQUAL expected_count) message(FATAL_ERROR "error: expected_count does not match actual_count: CPackComponents test fails.") - endif(NOT actual_count EQUAL expected_count) -endif(expected_file_mask) + endif() +endif() diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index 5449d09dc..8162f0c2a 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -118,6 +118,6 @@ if (NOT ("${CPackComponentWay}" STREQUAL "default")) ${CPackComponentsForAll_BINARY_DIR}/MyLibCPackConfig-${CPackComponentWay}.cmake @ONLY) set(CPACK_PROJECT_CONFIG_FILE ${CPackComponentsForAll_BINARY_DIR}/MyLibCPackConfig-${CPackComponentWay}.cmake) -endif (NOT ("${CPackComponentWay}" STREQUAL "default")) +endif () # Include CPack to introduce the appropriate targets include(CPack) \ No newline at end of file diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-AllInOne.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-AllInOne.cmake.in index 1d203c8d8..0bfbf1467 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-AllInOne.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-AllInOne.cmake.in @@ -3,15 +3,15 @@ # if(CPACK_GENERATOR MATCHES "ZIP") set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON") -endif(CPACK_GENERATOR MATCHES "ZIP") +endif() if(CPACK_GENERATOR MATCHES "RPM") set(CPACK_RPM_COMPONENT_INSTALL "ON") -endif(CPACK_GENERATOR MATCHES "RPM") +endif() if(CPACK_GENERATOR MATCHES "DEB") set(CPACK_DEB_COMPONENT_INSTALL "ON") -endif(CPACK_GENERATOR MATCHES "DEB") +endif() # # Choose grouping way diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index 9444a1473..450c2047e 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -3,16 +3,16 @@ # if(CPACK_GENERATOR MATCHES "ZIP") set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON") -endif(CPACK_GENERATOR MATCHES "ZIP") +endif() if(CPACK_GENERATOR MATCHES "RPM") set(CPACK_RPM_COMPONENT_INSTALL "ON") set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries") -endif(CPACK_GENERATOR MATCHES "RPM") +endif() if(CPACK_GENERATOR MATCHES "DEB") set(CPACK_DEB_COMPONENT_INSTALL "ON") -endif(CPACK_GENERATOR MATCHES "DEB") +endif() # # Choose grouping way diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in index 2d251b363..60bdd06be 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in @@ -3,20 +3,20 @@ # if(CPACK_GENERATOR MATCHES "ZIP") set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON") -endif(CPACK_GENERATOR MATCHES "ZIP") +endif() if(CPACK_GENERATOR MATCHES "RPM") set(CPACK_RPM_COMPONENT_INSTALL "ON") set(CPACK_RPM_Development_PACKAGE_REQUIRES "mylib-Runtime") -endif(CPACK_GENERATOR MATCHES "RPM") +endif() if(CPACK_GENERATOR MATCHES "DEB") set(CPACK_DEB_COMPONENT_INSTALL "ON") -endif(CPACK_GENERATOR MATCHES "DEB") +endif() if(CPACK_GENERATOR MATCHES "DragNDrop") set(CPACK_COMPONENTS_GROUPING "ONE_PER_GROUP") -endif(CPACK_GENERATOR MATCHES "DragNDrop") +endif() # # Choose grouping way diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index e2d343d9f..0b6d07d97 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -4,21 +4,20 @@ message(STATUS "") if(NOT CPackComponentsForAll_BINARY_DIR) message(FATAL_ERROR "CPackComponentsForAll_BINARY_DIR not set") -endif(NOT CPackComponentsForAll_BINARY_DIR) +endif() if(NOT CPackGen) message(FATAL_ERROR "CPackGen not set") -endif(NOT CPackGen) -get_filename_component(CPACK_LOCATION ${CMAKE_COMMAND} PATH) -set(CPackCommand "${CPACK_LOCATION}/cpack") -message("cpack = ${CPackCommand}") -if(NOT CPackCommand) - message(FATAL_ERROR "CPackCommand not set") -endif(NOT CPackCommand) +endif() + +message("CMAKE_CPACK_COMMAND = ${CMAKE_CPACK_COMMAND}") +if(NOT CMAKE_CPACK_COMMAND) + message(FATAL_ERROR "CMAKE_CPACK_COMMAND not set") +endif() if(NOT CPackComponentWay) message(FATAL_ERROR "CPackComponentWay not set") -endif(NOT CPackComponentWay) +endif() set(expected_file_mask "") # The usual default behavior is to expect a single file @@ -30,7 +29,7 @@ set(config_type $ENV{CMAKE_CONFIG_TYPE}) set(config_args ) if(config_type) set(config_args -C ${config_type}) -endif(config_type) +endif() set(config_verbose ) if(CPackGen MATCHES "ZIP") @@ -80,19 +79,19 @@ if(CPackGen MATCHES "DragNDrop") elseif (${CPackComponentWay} STREQUAL "AllInOne") set(expected_count 1) endif () -endif(CPackGen MATCHES "DragNDrop") +endif() # clean-up previously CPack generated files if(expected_file_mask) file(GLOB expected_file "${expected_file_mask}") if (expected_file) file(REMOVE ${expected_file}) - endif(expected_file) -endif(expected_file_mask) + endif() +endif() message("config_args = ${config_args}") message("config_verbose = ${config_verbose}") -execute_process(COMMAND ${CPackCommand} ${config_verbose} -G ${CPackGen} ${config_args} +execute_process(COMMAND ${CMAKE_CPACK_COMMAND} ${config_verbose} -G ${CPackGen} ${config_args} RESULT_VARIABLE CPack_result OUTPUT_VARIABLE CPack_output ERROR_VARIABLE CPack_error @@ -100,9 +99,9 @@ execute_process(COMMAND ${CPackCommand} ${config_verbose} -G ${CPackGen} ${confi if (CPack_result) message(FATAL_ERROR "error: CPack execution went wrong!, CPack_output=${CPack_output}, CPack_error=${CPack_error}") -else (CPack_result) +else () message(STATUS "CPack_output=${CPack_output}") -endif(CPack_result) +endif() # Now verify if the number of expected file is OK # - using expected_file_mask and @@ -116,11 +115,11 @@ if(expected_file_mask) if(NOT expected_file) message(FATAL_ERROR "error: expected_file=${expected_file} does not exist: CPackComponentsForAll test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error}") - endif(NOT expected_file) + endif() list(LENGTH expected_file actual_count) message(STATUS "actual_count='${actual_count}'") if(NOT actual_count EQUAL expected_count) message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error})") - endif(NOT actual_count EQUAL expected_count) -endif(expected_file_mask) + endif() +endif() diff --git a/Tests/CPackTestAllGenerators/RunCPack.cmake b/Tests/CPackTestAllGenerators/RunCPack.cmake index e0c241ec4..952d5f4ae 100644 --- a/Tests/CPackTestAllGenerators/RunCPack.cmake +++ b/Tests/CPackTestAllGenerators/RunCPack.cmake @@ -1,14 +1,10 @@ -if(NOT DEFINED cpack) - message(FATAL_ERROR "cpack not defined") -endif() - if(NOT DEFINED dir) message(FATAL_ERROR "dir not defined") endif() # Analyze 'cpack --help' output for list of available generators: # -execute_process(COMMAND ${cpack} --help +execute_process(COMMAND ${CMAKE_CPACK_COMMAND} --help RESULT_VARIABLE result OUTPUT_VARIABLE stdout ERROR_VARIABLE stderr @@ -43,7 +39,7 @@ message(STATUS "CPack generators='${generators}'") foreach(g ${generators}) message(STATUS "Calling cpack -G ${g}...") - execute_process(COMMAND ${cpack} -G ${g} + execute_process(COMMAND ${CMAKE_CPACK_COMMAND} -G ${g} RESULT_VARIABLE result OUTPUT_VARIABLE stdout ERROR_VARIABLE stderr diff --git a/Tests/CPackWiXGenerator/CMakeLists.txt b/Tests/CPackWiXGenerator/CMakeLists.txt new file mode 100644 index 000000000..ce02f110d --- /dev/null +++ b/Tests/CPackWiXGenerator/CMakeLists.txt @@ -0,0 +1,73 @@ +cmake_minimum_required(VERSION 2.8) + +project(CPackWiXGenerator) + +add_library(mylib mylib.cpp) + +add_executable(mylibapp mylibapp.cpp) +target_link_libraries(mylibapp mylib) + +install(TARGETS mylib + ARCHIVE + DESTINATION lib + COMPONENT libraries) + +install(TARGETS mylibapp + RUNTIME + DESTINATION bin + COMPONENT applications) + +install(FILES mylib.h "file with spaces.h" + DESTINATION include + COMPONENT headers) + +set(CPACK_GENERATOR "WIX") + +set(CPACK_PACKAGE_NAME "MyLib") +set(CPACK_PACKAGE_VENDOR "CMake.org") +set(CPACK_PACKAGE_CONTACT "somebody@cmake.org") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY + "MyLib - CPack Component Installation Example") + +set(CPACK_PACKAGE_VERSION_MAJOR "1") +set(CPACK_PACKAGE_VERSION_MINOR "0") +set(CPACK_PACKAGE_VERSION_PATCH "0") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example") + +set(CPACK_WIX_UPGRADE_GUID "BF20CE5E-7F7C-401D-8F7C-AB45E8D170E6") + +include(CPack) + +cpack_add_install_type(Full DISPLAY_NAME "Everything") +cpack_add_install_type(Developer) + +cpack_add_component_group(Runtime) + +cpack_add_component_group(Development + EXPANDED + DESCRIPTION "All of the tools you'll ever need to develop software") + +cpack_add_component(applications + DISPLAY_NAME "MyLib Application" + DESCRIPTION "An extremely useful application that makes use of MyLib" + GROUP Runtime + INSTALL_TYPES Full) + +cpack_add_component(documentation + DISPLAY_NAME "MyLib Documentation" + DESCRIPTION "The extensive suite of MyLib Application documentation files" + GROUP Runtime + INSTALL_TYPES Full) + +cpack_add_component(libraries + DISPLAY_NAME "Libraries" + DESCRIPTION "Static libraries used to build programs with MyLib" + GROUP Development + INSTALL_TYPES Developer Full) + +cpack_add_component(headers + DISPLAY_NAME "C++ Headers" + DESCRIPTION "C/C++ header files for use with MyLib" + GROUP Development + DEPENDS libraries + INSTALL_TYPES Developer Full) diff --git a/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake b/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake new file mode 100644 index 000000000..30e33cf22 --- /dev/null +++ b/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake @@ -0,0 +1,72 @@ +message(STATUS "=============================================================") +message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") +message(STATUS "") + +if(NOT CPackWiXGenerator_BINARY_DIR) + message(FATAL_ERROR "CPackWiXGenerator_BINARY_DIR not set") +endif() + +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") +message(STATUS "CMAKE_CPACK_COMMAND: ${CMAKE_CPACK_COMMAND}") +message(STATUS "CPackWiXGenerator_BINARY_DIR: ${CPackWiXGenerator_BINARY_DIR}") + +execute_process(COMMAND "${CMAKE_CPACK_COMMAND}" + RESULT_VARIABLE CPack_result + OUTPUT_VARIABLE CPack_output + ERROR_VARIABLE CPack_error + WORKING_DIRECTORY "${CPackWiXGenerator_BINARY_DIR}") + +if(CPack_result) + message(FATAL_ERROR "CPack execution went wrong!, CPack_output=${CPack_output}, CPack_error=${CPack_error}") +else () + message(STATUS "CPack_output=${CPack_output}") +endif() + +set(expected_file_mask "*.msi") +file(GLOB installer_file "${expected_file_mask}") + +message(STATUS "installer_file='${installer_file}'") +message(STATUS "expected_file_mask='${expected_file_mask}'") + +if(NOT installer_file) + message(FATAL_ERROR "installer_file does not exist.") +endif() + +function(run_wix_command command) + file(TO_CMAKE_PATH "$ENV{WIX}" WIX_ROOT) + set(WIX_PROGRAM "${WIX_ROOT}/bin/${command}.exe") + + if(NOT EXISTS "${WIX_PROGRAM}") + message(FATAL_ERROR "Failed to find WiX Tool: ${WIX_PROGRAM}") + endif() + + message(STATUS "Running WiX Tool: ${command} ${ARGN}") + + execute_process(COMMAND "${WIX_PROGRAM}" ${ARGN} + RESULT_VARIABLE WIX_result + OUTPUT_VARIABLE WIX_output + ERROR_VARIABLE WIX_output + WORKING_DIRECTORY "${CPackWiXGenerator_BINARY_DIR}") + + message(STATUS "${command} Output: \n${WIX_output}") + + if(WIX_result) + message(FATAL_ERROR "WiX ${command} failed: ${WIX_result}") + endif() +endfunction() + +file(GLOB WXS_SOURCE_FILES + "${CPackWiXGenerator_BINARY_DIR}/_CPack_Packages/*/WIX/*.wxs") + +if(NOT WXS_SOURCE_FILES) + message(FATAL_ERROR "Failed finding WiX source files to validate.") +endif() + +foreach(WXS_SOURCE_FILE IN LISTS WXS_SOURCE_FILES) + run_wix_command(wixcop "${WXS_SOURCE_FILE}") +endforeach() + +# error SMOK1076 : ICE61: This product should remove only older +# versions of itself. The Maximum version is not less +# than the current product. (1.0.0 1.0.0) +run_wix_command(smoke -nologo -wx -sw1076 "${installer_file}") diff --git a/Tests/CPackWiXGenerator/file with spaces.h b/Tests/CPackWiXGenerator/file with spaces.h new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/CPackWiXGenerator/mylib.cpp b/Tests/CPackWiXGenerator/mylib.cpp new file mode 100644 index 000000000..8ddac198c --- /dev/null +++ b/Tests/CPackWiXGenerator/mylib.cpp @@ -0,0 +1,7 @@ +#include "mylib.h" +#include "stdio.h" + +void mylib_function() +{ + printf("This is mylib"); +} diff --git a/Tests/CPackWiXGenerator/mylib.h b/Tests/CPackWiXGenerator/mylib.h new file mode 100644 index 000000000..5d0a822db --- /dev/null +++ b/Tests/CPackWiXGenerator/mylib.h @@ -0,0 +1 @@ +void mylib_function(); diff --git a/Tests/CPackWiXGenerator/mylibapp.cpp b/Tests/CPackWiXGenerator/mylibapp.cpp new file mode 100644 index 000000000..a438ac77f --- /dev/null +++ b/Tests/CPackWiXGenerator/mylibapp.cpp @@ -0,0 +1,6 @@ +#include "mylib.h" + +int main() +{ + mylib_function(); +} diff --git a/Tests/CTestConfig/dashboard.cmake.in b/Tests/CTestConfig/dashboard.cmake.in index c7ac21023..0bba6d62d 100644 --- a/Tests/CTestConfig/dashboard.cmake.in +++ b/Tests/CTestConfig/dashboard.cmake.in @@ -17,7 +17,10 @@ endif() message("cmake initial configure") execute_process(COMMAND ${CMAKE_COMMAND} - ${arg} -G "@CMAKE_TEST_GENERATOR@" ${CTEST_SOURCE_DIRECTORY} + ${arg} + -G "@CMAKE_TEST_GENERATOR@" + -T "@CMAKE_TEST_GENERATOR_TOOLSET@" + ${CTEST_SOURCE_DIRECTORY} WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} RESULT_VARIABLE rv) if(NOT rv STREQUAL 0) diff --git a/Tests/CTestConfig/script.cmake.in b/Tests/CTestConfig/script.cmake.in index 5ceb7c325..83267a4d1 100644 --- a/Tests/CTestConfig/script.cmake.in +++ b/Tests/CTestConfig/script.cmake.in @@ -1,4 +1,5 @@ set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") set(CTEST_PROJECT_NAME "CTestConfig") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestConfig") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestConfig/@cfg@-script") diff --git a/Tests/CTestLimitDashJ/CMakeLists.txt b/Tests/CTestLimitDashJ/CMakeLists.txt new file mode 100644 index 000000000..0c5950c9d --- /dev/null +++ b/Tests/CTestLimitDashJ/CMakeLists.txt @@ -0,0 +1,50 @@ +cmake_minimum_required(VERSION 2.8) +project(CTestLimitDashJ NONE) + +# This file demonstrates http://public.kitware.com/Bug/view.php?id=12904 +# when configured with CMake 2.8.10.2 and earlier, and when running +# "ctest -j 4" in the resulting build tree. This example is hard-coded +# to assume -j 4 just to reproduce the issue easily. Adjust the +# FAIL_REGULAR_EXPRESSION and PROCESSORS values to reproduce this problem +# with a different ctest -j value... + +if(EXISTS "${CMAKE_BINARY_DIR}/Testing/Temporary/CTestCostData.txt") + message(STATUS "Removing CTestCostData.txt to force ordering by COST PROPERTY value rather than prior run data") + file(REMOVE "${CMAKE_BINARY_DIR}/Testing/Temporary/CTestCostData.txt") +endif() + +include(CTest) + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/CreateSleepDelete.cmake + ${CMAKE_CURRENT_BINARY_DIR}/CreateSleepDelete.cmake + @ONLY + ) + +foreach(n RANGE 1 100) + add_test(NAME t${n} + COMMAND ${CMAKE_CTEST_COMMAND} + -D basefilename=f${n} + -S ${CMAKE_CURRENT_BINARY_DIR}/CreateSleepDelete.cmake + ) + set_property(TEST t${n} PROPERTY FAIL_REGULAR_EXPRESSION "(c='[5-9]'|c='[1-9][0-9]+')") +endforeach() + +set_property(TEST t1 PROPERTY RUN_SERIAL 1) +set_property(TEST t1 PROPERTY PROCESSORS 4) + +set_property(TEST t51 PROPERTY RUN_SERIAL 1) +set_property(TEST t51 PROPERTY PROCESSORS 4) + +foreach(n RANGE 2 50) + set_property(TEST t${n} PROPERTY DEPENDS t1) +endforeach() +set_property(TEST t1 PROPERTY DEPENDS t51) +set_property(TEST t51 PROPERTY DEPENDS t100) + +foreach(n 50) + set_property(TEST t${n} PROPERTY COST 6) +endforeach() +foreach(n RANGE 52 99) + set_property(TEST t${n} PROPERTY COST 3) +endforeach() diff --git a/Tests/CTestLimitDashJ/CreateSleepDelete.cmake b/Tests/CTestLimitDashJ/CreateSleepDelete.cmake new file mode 100644 index 000000000..b09307feb --- /dev/null +++ b/Tests/CTestLimitDashJ/CreateSleepDelete.cmake @@ -0,0 +1,48 @@ +set(CTEST_RUN_CURRENT_SCRIPT 0) + +if(NOT DEFINED basefilename) + message(FATAL_ERROR "pass -Dbasefilename=f1") +endif() + +if(NOT DEFINED ext) + set(ext "jkqvxz") +endif() + +if(NOT DEFINED sleep_interval) + set(sleep_interval 1) +endif() + +get_filename_component(self_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) +set(filename "${self_dir}/${basefilename}.${ext}") + +# count files +file(GLOB f1 *.${ext}) +list(LENGTH f1 c1) +message("c='${c1}'") + +# write a new file +message("Writing file: filename='${filename}'") +file(WRITE "${filename}" "${filename}") + +# count files again +file(GLOB f2 *.${ext}) +list(LENGTH f2 c2) +message("c='${c2}'") + +# snooze +message("Sleeping: sleep_interval='${sleep_interval}'") +ctest_sleep(${sleep_interval}) + +# count files again +file(GLOB f3 *.${ext}) +list(LENGTH f3 c3) +message("c='${c3}'") + +# delete the file we wrote earlier +message("Removing file: filename='${filename}'") +file(REMOVE "${filename}") + +# count files again +file(GLOB f4 *.${ext}) +list(LENGTH f4 c4) +message("c='${c4}'") diff --git a/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in b/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in index 0c4394faa..45f0e3710 100644 --- a/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in +++ b/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in @@ -5,9 +5,9 @@ set(CMAKE_CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@") if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "${CMAKE_CMAKE_SYSTEM_NAME}") message(FATAL_ERROR "Error: CMAKE_SYSTEM_NAME is \"${CMAKE_SYSTEM_NAME}\", but should be \"@CMAKE_SYSTEM_NAME@\"") -endif(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "${CMAKE_CMAKE_SYSTEM_NAME}") +endif() -# this seems to be necessary, otherwise ctest complains that these +# this seems to be necessary, otherwise ctest complains that these # variables are not set: set(CTEST_COMMAND "\"@CMAKE_CTEST_COMMAND@\"") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestScriptMode/") diff --git a/Tests/CTestTest/test.cmake.in b/Tests/CTestTest/test.cmake.in index eac5eab20..214bff8d7 100644 --- a/Tests/CTestTest/test.cmake.in +++ b/Tests/CTestTest/test.cmake.in @@ -4,25 +4,25 @@ ################################################################### # this is the cvs module name that should be checked out -SET (CTEST_MODULE_NAME SmallAndFast) +set (CTEST_MODULE_NAME SmallAndFast) -# these are the the name of the source and binary directory on disk. +# these are the the name of the source and binary directory on disk. # They will be appended to DASHBOARD_ROOT -SET (CTEST_SOURCE_NAME SmallAndFast) -SET (CTEST_BINARY_NAME SmallAndFastBuild) +set (CTEST_SOURCE_NAME SmallAndFast) +set (CTEST_BINARY_NAME SmallAndFastBuild) # which ctest command to use for running the dashboard -SET (CTEST_COMMAND +set (CTEST_COMMAND "\"${CTEST_EXECUTABLE_NAME}\" --version" "\"${CTEST_EXECUTABLE_NAME}\" -D Experimental -A \"${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}\"" ) # what cmake command to use for configuring this dashboard -GET_FILENAME_COMPONENT(CTEST_EXECUTABLE_PATH "${CTEST_EXECUTABLE_NAME}" PATH) -SET(CTEST_CMAKE_COMMAND "\"${CTEST_EXECUTABLE_PATH}/cmake\"") +get_filename_component(CTEST_EXECUTABLE_PATH "${CTEST_EXECUTABLE_NAME}" PATH) +set(CTEST_CMAKE_COMMAND "\"${CTEST_EXECUTABLE_PATH}/cmake\"") -MESSAGE("CTest executable: ${CTEST_EXECUTABLE_NAME}") -MESSAGE("CMake executable: ${CTEST_CMAKE_COMMAND}") +message("CTest executable: ${CTEST_EXECUTABLE_NAME}") +message("CMake executable: ${CTEST_CMAKE_COMMAND}") CTEST_SLEEP(1) CTEST_SLEEP(1 1 1) @@ -33,14 +33,15 @@ CTEST_SLEEP(1 1 1) #################################################################### # should ctest wipe the binary tree before running -SET (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) +set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) # this is the initial cache to use for the binary tree, be careful to escape # any quotes inside of this string if you use it -SET (CTEST_INITIAL_CACHE " +set (CTEST_INITIAL_CACHE " SITE:STRING=@SITE@ BUILDNAME:STRING=SmallAndFast-@BUILDNAME@ CMAKE_GENERATOR:INTERNAL=@CMAKE_GENERATOR@ +CMAKE_GENERATOR_TOOLSET:INTERNAL=@CMAKE_GENERATOR_TOOLSET@ CMAKE_CXX_FLAGS:STRING=@CMAKE_CXX_FLAGS@ CMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@ CMAKE_C_COMPILER:STRING=@CMAKE_C_COMPILER@ @@ -54,15 +55,15 @@ MEMORYCHECK_COMMAND_OPTIONS:STRING=@MEMORYCHECK_COMMAND_OPTIONS@ COVERAGE_COMMAND:FILEPATH=@COVERAGE_COMMAND@ ") -# if you do not want to use the default location for a +# if you do not want to use the default location for a # dashboard then set this variable to the directory # the dashboard should be in -SET (CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@/Tests/CTestTest") +set (CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@/Tests/CTestTest") # set any extra envionment varibles here -SET (CTEST_ENVIRONMENT +set (CTEST_ENVIRONMENT ) -SET (CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTest/SmallAndFast") -SET (CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTest/${CTEST_BINARY_NAME}") +set (CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTest/SmallAndFast") +set (CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTest/${CTEST_BINARY_NAME}") diff --git a/Tests/CTestTest2/test.cmake.in b/Tests/CTestTest2/test.cmake.in index b58b6397e..26a77a7e6 100644 --- a/Tests/CTestTest2/test.cmake.in +++ b/Tests/CTestTest2/test.cmake.in @@ -1,31 +1,32 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "KWSys-@BUILDNAME@-CTest2") - -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Source/kwsys") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTest2/kwsysBin") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@") -SET(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@") -SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "KWSys-@BUILDNAME@-CTest2") + +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Source/kwsys") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTest2/kwsysBin") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@") +set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@") +set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") # By default, CTESTTEST2_USE_PURIFY is not defined. If you want to run purify # on CTestTest2, set CTESTTEST2_USE_PURIFY to ON in CMake's cache. -SET(CTESTTEST2_USE_PURIFY @CTESTTEST2_USE_PURIFY@) -IF("${CTEST_MEMORYCHECK_COMMAND}" MATCHES purify AND NOT CTESTTEST2_USE_PURIFY) - SET(CTEST_MEMORYCHECK_COMMAND) -ENDIF() +set(CTESTTEST2_USE_PURIFY @CTESTTEST2_USE_PURIFY@) +if("${CTEST_MEMORYCHECK_COMMAND}" MATCHES purify AND NOT CTESTTEST2_USE_PURIFY) + set(CTEST_MEMORYCHECK_COMMAND) +endif() #CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) -FILE(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" " +file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" " CMAKE_CXX_FLAGS:STRING=@CMAKE_CXX_FLAGS@ CMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@ CMAKE_C_COMPILER:STRING=@CMAKE_C_COMPILER@ @@ -55,6 +56,6 @@ set(CTEST_DROP_LOCATION "@path@/submit.php?project=PublicDashboard") CTEST_SUBMIT(RETURN_VALUE res) # Test submission of a subset of parts. -SET(CTEST_EXTRA_SUBMIT_FILES ${CTEST_NOTES_FILES}) +set(CTEST_EXTRA_SUBMIT_FILES ${CTEST_NOTES_FILES}) CTEST_SUBMIT(RETURN_VALUE res PARTS ExtraFiles) -SET(CTEST_EXTRA_SUBMIT_FILES) +set(CTEST_EXTRA_SUBMIT_FILES) diff --git a/Tests/CTestTestBadExe/CMakeLists.txt b/Tests/CTestTestBadExe/CMakeLists.txt index 8a925b62f..c71c21516 100644 --- a/Tests/CTestTestBadExe/CMakeLists.txt +++ b/Tests/CTestTestBadExe/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(CTestTestBadExe) -INCLUDE(CTest) +project(CTestTestBadExe) +include(CTest) -CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/notAnExe.txt" "${CMAKE_CURRENT_BINARY_DIR}/notAnExe.txt" COPYONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/notAnExe.txt" "${CMAKE_CURRENT_BINARY_DIR}/notAnExe.txt" COPYONLY) -ADD_TEST (TestBadExe "${CMAKE_CURRENT_BINARY_DIR}/notAnExe.txt") +add_test (TestBadExe "${CMAKE_CURRENT_BINARY_DIR}/notAnExe.txt") diff --git a/Tests/CTestTestBadExe/test.cmake.in b/Tests/CTestTestBadExe/test.cmake.in index 5d22d3587..03ebd0416 100644 --- a/Tests/CTestTestBadExe/test.cmake.in +++ b/Tests/CTestTestBadExe/test.cmake.in @@ -1,17 +1,18 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-BadExe") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-BadExe") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestBadExe") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestBadExe") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestBadExe") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestBadExe") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") #CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) diff --git a/Tests/CTestTestChecksum/test.cmake.in b/Tests/CTestTestChecksum/test.cmake.in index 84135446f..efc53fbed 100644 --- a/Tests/CTestTestChecksum/test.cmake.in +++ b/Tests/CTestTestChecksum/test.cmake.in @@ -1,25 +1,26 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Checksum") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Checksum") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestParallel") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestParallel") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestParallel") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestParallel") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res PARALLEL_LEVEL 4) -SET(CTEST_DROP_METHOD "@protocol@") -SET(CTEST_DROP_SITE "@server@") -SET(CTEST_DROP_LOCATION "@path@/submit.php?project=PublicDashboard") +set(CTEST_DROP_METHOD "@protocol@") +set(CTEST_DROP_SITE "@server@") +set(CTEST_DROP_LOCATION "@path@/submit.php?project=PublicDashboard") CTEST_SUBMIT(RETRY_DELAY 3 RETRY_COUNT 2 INTERNAL_TEST_CHECKSUM RETURN_VALUE res) diff --git a/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in b/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in index 498cab280..42225d305 100644 --- a/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in +++ b/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in @@ -1,17 +1,18 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +cmake_minimum_required(VERSION 2.8) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ConfigFileInBuildDir1") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ConfigFileInBuildDir1") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestConfigFileInBuildDir") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestConfigFileInBuildDir1") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestConfigFileInBuildDir") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestConfigFileInBuildDir1") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in b/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in index d359f2d36..010fe1caa 100644 --- a/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in +++ b/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in @@ -1,17 +1,18 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +cmake_minimum_required(VERSION 2.8) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ConfigFileInBuildDir2") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ConfigFileInBuildDir2") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestConfigFileInBuildDir") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestConfigFileInBuildDir2") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestConfigFileInBuildDir") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestConfigFileInBuildDir2") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestCostSerial/CMakeLists.txt b/Tests/CTestTestCostSerial/CMakeLists.txt index a9a5c2594..d3344cfab 100644 --- a/Tests/CTestTestCostSerial/CMakeLists.txt +++ b/Tests/CTestTestCostSerial/CMakeLists.txt @@ -1,13 +1,13 @@ -CMAKE_MINIMUM_REQUIRED (VERSION 2.6) -PROJECT (CTestTestCostSerial) -INCLUDE (CTest) +cmake_minimum_required (VERSION 2.6) +project (CTestTestCostSerial) +include (CTest) -ADD_EXECUTABLE (Sleep sleep.c) +add_executable (Sleep sleep.c) -FOREACH (index RANGE 1 3) - ADD_TEST (TestSleep${index} Sleep) -ENDFOREACH (index RANGE 1 3) +foreach (index RANGE 1 3) + add_test (TestSleep${index} Sleep) +endforeach () -SET_TESTS_PROPERTIES(TestSleep1 PROPERTIES COST -500) -SET_TESTS_PROPERTIES(TestSleep2 PROPERTIES COST 12) -SET_TESTS_PROPERTIES(TestSleep3 PROPERTIES COST 0) +set_tests_properties(TestSleep1 PROPERTIES COST -500) +set_tests_properties(TestSleep2 PROPERTIES COST 12) +set_tests_properties(TestSleep3 PROPERTIES COST 0) diff --git a/Tests/CTestTestCostSerial/test.cmake.in b/Tests/CTestTestCostSerial/test.cmake.in index ca216e3fc..bfb3d9a03 100644 --- a/Tests/CTestTestCostSerial/test.cmake.in +++ b/Tests/CTestTestCostSerial/test.cmake.in @@ -1,24 +1,25 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-CostSerial") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-CostSerial") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestCostSerial") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestCostSerial") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestCostSerial") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestCostSerial") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") #CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) # Remove old cost data file if it exists -IF(EXISTS "${CTEST_BINARY_DIRECTORY}/Testing/Temporary/CTestCostData.txt") - FILE(REMOVE "${CTEST_BINARY_DIRECTORY}/Testing/Temporary/CTestCostData.txt") -ENDIF(EXISTS "${CTEST_BINARY_DIRECTORY}/Testing/Temporary/CTestCostData.txt") +if(EXISTS "${CTEST_BINARY_DIRECTORY}/Testing/Temporary/CTestCostData.txt") + file(REMOVE "${CTEST_BINARY_DIRECTORY}/Testing/Temporary/CTestCostData.txt") +endif() CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestCrash/CMakeLists.txt b/Tests/CTestTestCrash/CMakeLists.txt index 0ac6ba03c..77986df34 100644 --- a/Tests/CTestTestCrash/CMakeLists.txt +++ b/Tests/CTestTestCrash/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(CTestTestCrash) -INCLUDE(CTest) +project(CTestTestCrash) +include(CTest) -ADD_EXECUTABLE (Crash crash.cxx) +add_executable (Crash crash.cxx) -ADD_TEST (TestCrash Crash) +add_test (TestCrash Crash) diff --git a/Tests/CTestTestCrash/test.cmake.in b/Tests/CTestTestCrash/test.cmake.in index 5cec594cd..492966c4a 100644 --- a/Tests/CTestTestCrash/test.cmake.in +++ b/Tests/CTestTestCrash/test.cmake.in @@ -1,17 +1,18 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Crash") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Crash") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestCrash") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestCrash") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestCrash") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestCrash") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") #CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) diff --git a/Tests/CTestTestCycle/test.cmake.in b/Tests/CTestTestCycle/test.cmake.in index 201f6044e..e9c9a4ee8 100644 --- a/Tests/CTestTestCycle/test.cmake.in +++ b/Tests/CTestTestCycle/test.cmake.in @@ -1,17 +1,18 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Cycle") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Cycle") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestCycle") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestCycle") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestCycle") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestCycle") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestDepends/test.cmake.in b/Tests/CTestTestDepends/test.cmake.in index 36a1ebf87..002958b41 100644 --- a/Tests/CTestTestDepends/test.cmake.in +++ b/Tests/CTestTestDepends/test.cmake.in @@ -1,17 +1,18 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Depends") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Depends") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestDepends") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestDepends") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestDepends") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestDepends") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestFailedSubmits/test.cmake.in b/Tests/CTestTestFailedSubmits/test.cmake.in index b0e16322d..36a09cf61 100644 --- a/Tests/CTestTestFailedSubmits/test.cmake.in +++ b/Tests/CTestTestFailedSubmits/test.cmake.in @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +cmake_minimum_required(VERSION 2.8) # CTestConfig.cmake settings: set(CTEST_PROJECT_NAME "SmallAndFast") @@ -9,21 +9,22 @@ set(CTEST_PROJECT_NAME "SmallAndFast") set(CTEST_DROP_METHOD "@drop_method@") # Settings: -SET(CTEST_USE_LAUNCHERS 1) +set(CTEST_USE_LAUNCHERS 1) # Emit these compiler warnings: set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Wall") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTestLaunchers-@drop_method@") - -SET(CTEST_SOURCE_DIRECTORY "@source@") -SET(CTEST_BINARY_DIRECTORY "@build@") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTestLaunchers-@drop_method@") + +set(CTEST_SOURCE_DIRECTORY "@source@") +set(CTEST_BINARY_DIRECTORY "@build@") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) diff --git a/Tests/CTestTestFailure/CMakeLists.txt b/Tests/CTestTestFailure/CMakeLists.txt index 690fbfc5c..01fbb2c4f 100644 --- a/Tests/CTestTestFailure/CMakeLists.txt +++ b/Tests/CTestTestFailure/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(CTestTestFailure) -INCLUDE(CTest) +project(CTestTestFailure) +include(CTest) -ADD_EXECUTABLE (NoBuild badCode.cxx) -TARGET_LINK_LIBRARIES (NoBuild ${EXTRA_LIBS}) +add_executable (NoBuild badCode.cxx) +target_link_libraries (NoBuild ${EXTRA_LIBS}) -ADD_TEST (TestNoExe NoBuild) +add_test (TestNoExe NoBuild) diff --git a/Tests/CTestTestFailure/testNoBuild.cmake.in b/Tests/CTestTestFailure/testNoBuild.cmake.in index 7bc921a31..3c4d219f5 100644 --- a/Tests/CTestTestFailure/testNoBuild.cmake.in +++ b/Tests/CTestTestFailure/testNoBuild.cmake.in @@ -1,17 +1,18 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-NoBuild") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-NoBuild") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestFailure") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestFailure") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestFailure") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestFailure") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") #CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) diff --git a/Tests/CTestTestFailure/testNoExe.cmake.in b/Tests/CTestTestFailure/testNoExe.cmake.in index 59c18d752..a133e2a13 100644 --- a/Tests/CTestTestFailure/testNoExe.cmake.in +++ b/Tests/CTestTestFailure/testNoExe.cmake.in @@ -1,17 +1,18 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-NoExe") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-NoExe") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestFailure") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestFailure") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestFailure") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestFailure") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") #CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt new file mode 100644 index 000000000..2730a6140 --- /dev/null +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -0,0 +1,81 @@ +foreach (_retval 0 1) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.c" "int main(){return ${_retval};}\n") +endforeach () + +# create binaries that we will use as a pseudo memory checker +add_executable(pseudo_valgrind "${CMAKE_CURRENT_BINARY_DIR}/ret0.c") +set_target_properties(pseudo_valgrind PROPERTIES OUTPUT_NAME valgrind) + +# Xcode 2.x forgets to create the output directory before linking +# the individual architectures. +if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") + add_custom_command(TARGET pseudo_valgrind + PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" + ) +endif() + +add_executable(pseudo_purify "${CMAKE_CURRENT_BINARY_DIR}/ret0.c") +set_target_properties(pseudo_purify PROPERTIES OUTPUT_NAME purify) +add_executable(pseudo_BC "${CMAKE_CURRENT_BINARY_DIR}/ret0.c") +set_target_properties(pseudo_BC PROPERTIES OUTPUT_NAME BC) + +# binary to be used as pre- and post-memcheck command that fails +add_executable(memcheck_fail "${CMAKE_CURRENT_BINARY_DIR}/ret1.c") + +foreach (_test IN ITEMS Unknown UnknownQuoted NotExist + DummyValgrind DummyValgrindPrePost + DummyValgrindFailPre DummyValgrindFailPost + DummyPurify DummyBC + DummyValgrindIgnoreMemcheck) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/${_test}/test.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/${_test}/test.cmake" + @ONLY ESCAPE_QUOTES) + add_test(NAME CTestTestMemcheck${_test} + COMMAND ${CMAKE_CTEST_COMMAND} + -S "${CMAKE_CURRENT_BINARY_DIR}/${_test}/test.cmake" -V + --output-log "${CMAKE_CURRENT_BINARY_DIR}/${_test}/testOutput.log" + -D PSEUDO_BC=$ + -D PSEUDO_PURIFY=$ + -D PSEUDO_VALGRIND=$ + -D ERROR_COMMAND=$ + ) +endforeach () + +string(REPLACE "\\" "\\\\" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND}") +string(REPLACE "(" "\\(" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND_ESCAPED}") +string(REPLACE ")" "\\)" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND_ESCAPED}") +string(REPLACE "+" "\\+" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND_ESCAPED}") + +foreach (_unkn Unknown UnknownQuoted) + set_tests_properties(CTestTestMemcheck${_unkn} PROPERTIES + PASS_REGULAR_EXPRESSION "Do not understand memory checker: ${CMAKE_COMMAND_ESCAPED}\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/${_unkn}/test.cmake\n") +endforeach () + +set_tests_properties(CTestTestMemcheckNotExist PROPERTIES + PASS_REGULAR_EXPRESSION "Memory checker \\(MemoryCheckCommand\\) not set, or cannot find the specified program.") + +set(NORMAL_CTEST_OUTPUT "\n-- Processing memory checking output: \nMemory checking results:\n(BullseyeCoverage[^\n]*\n)?") + +# It is a valid result if valgrind does not output any files (can e.g. happen +# if you have not compiled in debug mode), so these tests will not fail. +set_tests_properties(CTestTestMemcheckDummyValgrind CTestTestMemcheckDummyValgrindPrePost + PROPERTIES + PASS_REGULAR_EXPRESSION "${NORMAL_CTEST_OUTPUT}") + +foreach (_pp Pre Post) + string(TOLOWER ${_pp} _pp_lower) + set_tests_properties(CTestTestMemcheckDummyValgrindFail${_pp} + PROPERTIES + PASS_REGULAR_EXPRESSION "\nProblem running command: ${CMAKE_CURRENT_BINARY_DIR}[^\n]*fail[^\n]*\n(.*\n)?Problem executing ${_pp_lower}-memcheck command\\(s\\\).\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyValgrindFail${_pp}/test.cmake\n") +endforeach () + +set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck + PROPERTIES + PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*\n1/1 MemCheck #1: RunCMake .*${NORMAL_CTEST_OUTPUT}") + +set_tests_properties(CTestTestMemcheckDummyPurify PROPERTIES + PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CMAKE_CURRENT_BINARY_DIR}/DummyPurify/Testing/Temporary/MemoryChecker.log\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyPurify/test.cmake\n") + +set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES + PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CMAKE_CURRENT_BINARY_DIR}/DummyBC/Testing/Temporary/MemoryChecker.log\n(.*\n)?Error parsing XML in stream at line 1: no element found\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyBC/test.cmake\n") diff --git a/Tests/CTestTestMemcheck/DummyBC/CMakeLists.txt b/Tests/CTestTestMemcheck/DummyBC/CMakeLists.txt new file mode 100644 index 000000000..aa0e495da --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyBC/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CTestTestMemcheckDummyBC) +include(CTest) + +add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/DummyBC/CTestConfig.cmake b/Tests/CTestTestMemcheck/DummyBC/CTestConfig.cmake new file mode 100644 index 000000000..39cdd88cc --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyBC/CTestConfig.cmake @@ -0,0 +1,7 @@ +set (CTEST_PROJECT_NAME "CTestTestMemcheckDummyBC") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/DummyBC/test.cmake.in b/Tests/CTestTestMemcheck/DummyBC/test.cmake.in new file mode 100644 index 000000000..1b16433fb --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyBC/test.cmake.in @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 2.8.9) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckDummyBC") + +set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/DummyBC") +set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/DummyBC") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +set(CTEST_MEMORYCHECK_COMMAND "${PSEUDO_BC}") + +#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +#CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/DummyPurify/CMakeLists.txt b/Tests/CTestTestMemcheck/DummyPurify/CMakeLists.txt new file mode 100644 index 000000000..dfd93fde4 --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyPurify/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CTestTestMemcheckDummyPurify) +include(CTest) + +add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/DummyPurify/CTestConfig.cmake b/Tests/CTestTestMemcheck/DummyPurify/CTestConfig.cmake new file mode 100644 index 000000000..40b960867 --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyPurify/CTestConfig.cmake @@ -0,0 +1,7 @@ +set (CTEST_PROJECT_NAME "CTestTestMemcheckDummyPurify") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/DummyPurify/test.cmake.in b/Tests/CTestTestMemcheck/DummyPurify/test.cmake.in new file mode 100644 index 000000000..0c8795cf5 --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyPurify/test.cmake.in @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 2.8.9) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckDummyPurify") + +set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/DummyPurify") +set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/DummyPurify") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +set(CTEST_MEMORYCHECK_COMMAND "${PSEUDO_PURIFY}") + +#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +#CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/DummyValgrind/CMakeLists.txt b/Tests/CTestTestMemcheck/DummyValgrind/CMakeLists.txt new file mode 100644 index 000000000..822966ade --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrind/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CTestTestMemcheckDummyValgrind) +include(CTest) + +add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/DummyValgrind/CTestConfig.cmake b/Tests/CTestTestMemcheck/DummyValgrind/CTestConfig.cmake new file mode 100644 index 000000000..4ca59a42e --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrind/CTestConfig.cmake @@ -0,0 +1,7 @@ +set (CTEST_PROJECT_NAME "CTestTestMemcheckDummyValgrind") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/DummyValgrind/test.cmake.in b/Tests/CTestTestMemcheck/DummyValgrind/test.cmake.in new file mode 100644 index 000000000..c3941c1f9 --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrind/test.cmake.in @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 2.8.9) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckDummyValgrind") + +set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/DummyValgrind") +set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/DummyValgrind") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +set(CTEST_MEMORYCHECK_COMMAND "${PSEUDO_VALGRIND}") + +#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +#CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/DummyValgrindFailPost/CMakeLists.txt b/Tests/CTestTestMemcheck/DummyValgrindFailPost/CMakeLists.txt new file mode 100644 index 000000000..8185071af --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrindFailPost/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CTestTestMemcheckDummyValgrindFailPost) +include(CTest) + +add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/DummyValgrindFailPost/CTestConfig.cmake b/Tests/CTestTestMemcheck/DummyValgrindFailPost/CTestConfig.cmake new file mode 100644 index 000000000..4ca59a42e --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrindFailPost/CTestConfig.cmake @@ -0,0 +1,7 @@ +set (CTEST_PROJECT_NAME "CTestTestMemcheckDummyValgrind") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/DummyValgrindFailPost/test.cmake.in b/Tests/CTestTestMemcheck/DummyValgrindFailPost/test.cmake.in new file mode 100644 index 000000000..90e2ac528 --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrindFailPost/test.cmake.in @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 2.8.9) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckDummyValgrindFailPost") + +set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/DummyValgrindFailPost") +set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/DummyValgrindFailPost") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +set(CTEST_MEMORYCHECK_COMMAND "${PSEUDO_VALGRIND}") + +set(CTEST_CUSTOM_POST_MEMCHECK "${ERROR_COMMAND}") + +#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +#CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/DummyValgrindFailPre/CMakeLists.txt b/Tests/CTestTestMemcheck/DummyValgrindFailPre/CMakeLists.txt new file mode 100644 index 000000000..3714cd6a3 --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrindFailPre/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CTestTestMemcheckDummyValgrindFailPre) +include(CTest) + +add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/DummyValgrindFailPre/CTestConfig.cmake b/Tests/CTestTestMemcheck/DummyValgrindFailPre/CTestConfig.cmake new file mode 100644 index 000000000..4ca59a42e --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrindFailPre/CTestConfig.cmake @@ -0,0 +1,7 @@ +set (CTEST_PROJECT_NAME "CTestTestMemcheckDummyValgrind") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/DummyValgrindFailPre/test.cmake.in b/Tests/CTestTestMemcheck/DummyValgrindFailPre/test.cmake.in new file mode 100644 index 000000000..fd17f638b --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrindFailPre/test.cmake.in @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 2.8.9) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckDummyValgrindFailPre") + +set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/DummyValgrindFailPre") +set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/DummyValgrindFailPre") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +set(CTEST_MEMORYCHECK_COMMAND "${PSEUDO_VALGRIND}") + +set(CTEST_CUSTOM_PRE_MEMCHECK "${ERROR_COMMAND}") + +#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +#CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/CMakeLists.txt new file mode 100644 index 000000000..5d437d1b7 --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CTestTestMemcheckDummyValgrindIgnoreMemcheck) +include(CTest) + +add_test (RunCMake "${CMAKE_COMMAND}") +add_test (RunCMakeAgain "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/CTestConfig.cmake b/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/CTestConfig.cmake new file mode 100644 index 000000000..6eee3e602 --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/CTestConfig.cmake @@ -0,0 +1,9 @@ +set (CTEST_PROJECT_NAME "CTestTestMemcheckDummyValgrindIgnoreMemcheck") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) + +set(CTEST_CUSTOM_MEMCHECK_IGNORE RunCMakeAgain) diff --git a/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/test.cmake.in b/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/test.cmake.in new file mode 100644 index 000000000..37aaaeb26 --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrindIgnoreMemcheck/test.cmake.in @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 2.8.9) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckDummyValgrindIgnoreMemcheck") + +set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/DummyValgrindIgnoreMemcheck") +set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/DummyValgrindIgnoreMemcheck") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +set(CTEST_MEMORYCHECK_COMMAND "${PSEUDO_VALGRIND}") + +#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +#CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/DummyValgrindPrePost/CMakeLists.txt b/Tests/CTestTestMemcheck/DummyValgrindPrePost/CMakeLists.txt new file mode 100644 index 000000000..bc1563212 --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrindPrePost/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CTestTestMemcheckDummyValgrindPrePost) +include(CTest) + +add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/DummyValgrindPrePost/CTestConfig.cmake b/Tests/CTestTestMemcheck/DummyValgrindPrePost/CTestConfig.cmake new file mode 100644 index 000000000..6e4c2e86c --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrindPrePost/CTestConfig.cmake @@ -0,0 +1,7 @@ +set (CTEST_PROJECT_NAME "CTestTestMemcheckDummyValgrindPrePost") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/DummyValgrindPrePost/test.cmake.in b/Tests/CTestTestMemcheck/DummyValgrindPrePost/test.cmake.in new file mode 100644 index 000000000..11f14a950 --- /dev/null +++ b/Tests/CTestTestMemcheck/DummyValgrindPrePost/test.cmake.in @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 2.8.9) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckDummyValgrindPrePost") + +set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/DummyValgrindPrePost") +set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/DummyValgrindPrePost") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +set(CTEST_MEMORYCHECK_COMMAND "${PSEUDO_VALGRIND}") + +set(CTEST_CUSTOM_PRE_MEMCHECK "${CTEST_MEMORYCHECK_COMMAND}") +set(CTEST_CUSTOM_POST_MEMCHECK "${CTEST_MEMORYCHECK_COMMAND}") + +#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +#CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/NotExist/CMakeLists.txt b/Tests/CTestTestMemcheck/NotExist/CMakeLists.txt new file mode 100644 index 000000000..4d905de9e --- /dev/null +++ b/Tests/CTestTestMemcheck/NotExist/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CTestTestMemcheckNotExist) +include(CTest) + +add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/NotExist/CTestConfig.cmake b/Tests/CTestTestMemcheck/NotExist/CTestConfig.cmake new file mode 100644 index 000000000..3ed84aab9 --- /dev/null +++ b/Tests/CTestTestMemcheck/NotExist/CTestConfig.cmake @@ -0,0 +1,7 @@ +set (CTEST_PROJECT_NAME "CTestTestMemcheckUnknown") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/NotExist/test.cmake.in b/Tests/CTestTestMemcheck/NotExist/test.cmake.in new file mode 100644 index 000000000..43f754272 --- /dev/null +++ b/Tests/CTestTestMemcheck/NotExist/test.cmake.in @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.9) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckNotExist") + +set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/NotExist") +set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/NotExist") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_MEMORYCHECK_COMMAND "${CTEST_BINARY_DIRECTORY}/no-memcheck-exe") + +CTEST_START(Experimental) +CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/Unknown/CMakeLists.txt b/Tests/CTestTestMemcheck/Unknown/CMakeLists.txt new file mode 100644 index 000000000..3fd3103ba --- /dev/null +++ b/Tests/CTestTestMemcheck/Unknown/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CTestTestMemcheckUnknown) +include(CTest) + +add_test (RunCMake "${CMAKE_COMMAND}") diff --git a/Tests/CTestTestMemcheck/Unknown/CTestConfig.cmake b/Tests/CTestTestMemcheck/Unknown/CTestConfig.cmake new file mode 100644 index 000000000..3ed84aab9 --- /dev/null +++ b/Tests/CTestTestMemcheck/Unknown/CTestConfig.cmake @@ -0,0 +1,7 @@ +set (CTEST_PROJECT_NAME "CTestTestMemcheckUnknown") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/Unknown/test.cmake.in b/Tests/CTestTestMemcheck/Unknown/test.cmake.in new file mode 100644 index 000000000..0830bf056 --- /dev/null +++ b/Tests/CTestTestMemcheck/Unknown/test.cmake.in @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.9) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckUnknown") + +set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/Unknown") +set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/Unknown") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_MEMORYCHECK_COMMAND "@CMAKE_COMMAND@") + +CTEST_START(Experimental) +CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/UnknownQuoted/CMakeLists.txt b/Tests/CTestTestMemcheck/UnknownQuoted/CMakeLists.txt new file mode 100644 index 000000000..6f49c6144 --- /dev/null +++ b/Tests/CTestTestMemcheck/UnknownQuoted/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CTestTestMemcheckUnknownQuoted) +include(CTest) + +add_test (RunCMake "\"${CMAKE_COMMAND}\"") diff --git a/Tests/CTestTestMemcheck/UnknownQuoted/CTestConfig.cmake b/Tests/CTestTestMemcheck/UnknownQuoted/CTestConfig.cmake new file mode 100644 index 000000000..f0233a7a4 --- /dev/null +++ b/Tests/CTestTestMemcheck/UnknownQuoted/CTestConfig.cmake @@ -0,0 +1,7 @@ +set (CTEST_PROJECT_NAME "CTestTestMemcheckUnknownQuoted") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestMemcheck/UnknownQuoted/test.cmake.in b/Tests/CTestTestMemcheck/UnknownQuoted/test.cmake.in new file mode 100644 index 000000000..1b1f7023a --- /dev/null +++ b/Tests/CTestTestMemcheck/UnknownQuoted/test.cmake.in @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.9) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-MemcheckUnknownQuoted") + +set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/UnknownQuoted") +set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/UnknownQuoted") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_MEMORYCHECK_COMMAND "@CMAKE_COMMAND@") + +CTEST_START(Experimental) +CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestParallel/CMakeLists.txt b/Tests/CTestTestParallel/CMakeLists.txt index fc53f6874..e47085a09 100644 --- a/Tests/CTestTestParallel/CMakeLists.txt +++ b/Tests/CTestTestParallel/CMakeLists.txt @@ -1,15 +1,15 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(CTestTestParallel) -INCLUDE(CTest) +project(CTestTestParallel) +include(CTest) -ADD_EXECUTABLE (LockFile lockFile.c) +add_executable (LockFile lockFile.c) -ADD_TEST (TestRunSerial1 LockFile) -ADD_TEST (TestRunSerial2 LockFile) -SET_TESTS_PROPERTIES(TestRunSerial1 TestRunSerial2 PROPERTIES RUN_SERIAL true) +add_test (TestRunSerial1 LockFile) +add_test (TestRunSerial2 LockFile) +set_tests_properties(TestRunSerial1 TestRunSerial2 PROPERTIES RUN_SERIAL true) -ADD_TEST (TestProcessorsGreaterThanMPL1 LockFile) -ADD_TEST (TestProcessorsGreaterThanMPL2 LockFile) -SET_TESTS_PROPERTIES(TestProcessorsGreaterThanMPL1 PROPERTIES PROCESSORS 10) -SET_TESTS_PROPERTIES(TestProcessorsGreaterThanMPL1 PROPERTIES DEPENDS +add_test (TestProcessorsGreaterThanMPL1 LockFile) +add_test (TestProcessorsGreaterThanMPL2 LockFile) +set_tests_properties(TestProcessorsGreaterThanMPL1 PROPERTIES PROCESSORS 10) +set_tests_properties(TestProcessorsGreaterThanMPL1 PROPERTIES DEPENDS TestProcessorsGreaterThanMPL2) diff --git a/Tests/CTestTestParallel/test.cmake.in b/Tests/CTestTestParallel/test.cmake.in index 83845dee4..a0d9fb3a1 100644 --- a/Tests/CTestTestParallel/test.cmake.in +++ b/Tests/CTestTestParallel/test.cmake.in @@ -1,17 +1,18 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Parallel") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Parallel") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestParallel") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestParallel") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestParallel") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestParallel") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") #CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) diff --git a/Tests/CTestTestResourceLock/CMakeLists.txt b/Tests/CTestTestResourceLock/CMakeLists.txt index 1041ef149..4001643fd 100644 --- a/Tests/CTestTestResourceLock/CMakeLists.txt +++ b/Tests/CTestTestResourceLock/CMakeLists.txt @@ -1,13 +1,13 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(CTestTestResourceLock) -INCLUDE(CTest) +project(CTestTestResourceLock) +include(CTest) -ADD_EXECUTABLE (LockFile lockFile.c) +add_executable (LockFile lockFile.c) -ADD_TEST (TestLockedFile1.1 LockFile locked1.txt) -ADD_TEST (TestLockedFile1.2 LockFile locked1.txt) -SET_TESTS_PROPERTIES(TestLockedFile1.1 TestLockedFile1.2 PROPERTIES RESOURCE_LOCK "locked1.txt") +add_test (TestLockedFile1.1 LockFile locked1.txt) +add_test (TestLockedFile1.2 LockFile locked1.txt) +set_tests_properties(TestLockedFile1.1 TestLockedFile1.2 PROPERTIES RESOURCE_LOCK "locked1.txt") -ADD_TEST (TestLockedFile2.1 LockFile locked2.txt) -ADD_TEST (TestLockedFile2.2 LockFile locked2.txt) -SET_TESTS_PROPERTIES(TestLockedFile2.1 TestLockedFile2.2 PROPERTIES RESOURCE_LOCK "locked2.txt") +add_test (TestLockedFile2.1 LockFile locked2.txt) +add_test (TestLockedFile2.2 LockFile locked2.txt) +set_tests_properties(TestLockedFile2.1 TestLockedFile2.2 PROPERTIES RESOURCE_LOCK "locked2.txt") diff --git a/Tests/CTestTestResourceLock/test.cmake.in b/Tests/CTestTestResourceLock/test.cmake.in index 98c5901c4..1e7e34480 100644 --- a/Tests/CTestTestResourceLock/test.cmake.in +++ b/Tests/CTestTestResourceLock/test.cmake.in @@ -1,17 +1,18 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ResourceLock") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ResourceLock") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestResourceLock") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestResourceLock") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestResourceLock") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestResourceLock") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestRunScript/hello.cmake.in b/Tests/CTestTestRunScript/hello.cmake.in index 140df1e02..37905e3c4 100644 --- a/Tests/CTestTestRunScript/hello.cmake.in +++ b/Tests/CTestTestRunScript/hello.cmake.in @@ -1,2 +1,2 @@ -SET(CTEST_RUN_CURRENT_SCRIPT 0) -MESSAGE("hello world") +set(CTEST_RUN_CURRENT_SCRIPT 0) +message("hello world") diff --git a/Tests/CTestTestRunScript/test.cmake.in b/Tests/CTestTestRunScript/test.cmake.in index 8301a56d3..3074a5156 100644 --- a/Tests/CTestTestRunScript/test.cmake.in +++ b/Tests/CTestTestRunScript/test.cmake.in @@ -1,2 +1,2 @@ -SET(CTEST_RUN_CURRENT_SCRIPT 0) +set(CTEST_RUN_CURRENT_SCRIPT 0) CTEST_RUN_SCRIPT("CTestTestRunScript/hello.cmake" RETURN_VALUE res RETURN_VALUE) diff --git a/Tests/CTestTestScheduler/CMakeLists.txt b/Tests/CTestTestScheduler/CMakeLists.txt index 882988fd4..ccd7b2cbb 100644 --- a/Tests/CTestTestScheduler/CMakeLists.txt +++ b/Tests/CTestTestScheduler/CMakeLists.txt @@ -1,9 +1,9 @@ -CMAKE_MINIMUM_REQUIRED (VERSION 2.6) -PROJECT (CTestTestScheduler) -INCLUDE (CTest) +cmake_minimum_required (VERSION 2.6) +project (CTestTestScheduler) +include (CTest) -ADD_EXECUTABLE (Sleep sleep.c) +add_executable (Sleep sleep.c) -FOREACH (time RANGE 1 4) - ADD_TEST (TestSleep${time} Sleep ${time}) -ENDFOREACH (time RANGE 1 4) +foreach (time RANGE 1 4) + add_test (TestSleep${time} Sleep ${time}) +endforeach () diff --git a/Tests/CTestTestScheduler/test.cmake.in b/Tests/CTestTestScheduler/test.cmake.in index 505bd7c5b..8ad6137eb 100644 --- a/Tests/CTestTestScheduler/test.cmake.in +++ b/Tests/CTestTestScheduler/test.cmake.in @@ -1,24 +1,25 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Scheduler") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Scheduler") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestScheduler") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestScheduler") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestScheduler") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestScheduler") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") #CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) # Remove old cost data file if it exists -IF(EXISTS "${CTEST_BINARY_DIRECTORY}/Testing/Temporary/CTestCostData.txt") - FILE(REMOVE "${CTEST_BINARY_DIRECTORY}/Testing/Temporary/CTestCostData.txt") -ENDIF(EXISTS "${CTEST_BINARY_DIRECTORY}/Testing/Temporary/CTestCostData.txt") +if(EXISTS "${CTEST_BINARY_DIRECTORY}/Testing/Temporary/CTestCostData.txt") + file(REMOVE "${CTEST_BINARY_DIRECTORY}/Testing/Temporary/CTestCostData.txt") +endif() CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestStopTime/CMakeLists.txt b/Tests/CTestTestStopTime/CMakeLists.txt index 5fe30d352..bd8bebdda 100644 --- a/Tests/CTestTestStopTime/CMakeLists.txt +++ b/Tests/CTestTestStopTime/CMakeLists.txt @@ -1,11 +1,11 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(CTestTestStopTime) -INCLUDE(CTest) +project(CTestTestStopTime) +include(CTest) -ADD_EXECUTABLE (Sleep sleep.c) +add_executable (Sleep sleep.c) -ADD_TEST (TestSleep Sleep 30) -ADD_TEST (ShouldNotRun Sleep 30) +add_test (TestSleep Sleep 30) +add_test (ShouldNotRun Sleep 30) -SET_TESTS_PROPERTIES(ShouldNotRun PROPERTIES DEPENDS TestSleep) -SET_TESTS_PROPERTIES(ShouldNotRun PROPERTIES WILL_FAIL ON) +set_tests_properties(ShouldNotRun PROPERTIES DEPENDS TestSleep) +set_tests_properties(ShouldNotRun PROPERTIES WILL_FAIL ON) diff --git a/Tests/CTestTestStopTime/GetDate.cmake b/Tests/CTestTestStopTime/GetDate.cmake index b79330691..60f1e0c74 100644 --- a/Tests/CTestTestStopTime/GetDate.cmake +++ b/Tests/CTestTestStopTime/GetDate.cmake @@ -1,6 +1,6 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.2) +cmake_minimum_required(VERSION 2.2) -MACRO(GET_DATE) +macro(GET_DATE) # # All macro arguments are optional. # If there's an ARGV0, use it as GD_PREFIX. Default = 'GD_' @@ -34,20 +34,20 @@ MACRO(GET_DATE) # If there's an ARGV0, use it as GD_PREFIX: # - SET(GD_PREFIX "GD_") - IF(NOT "${ARGV0}" STREQUAL "") - SET(GD_PREFIX "${ARGV0}") - ENDIF(NOT "${ARGV0}" STREQUAL "") - IF(NOT "${GD_PREFIX}" STREQUAL "GD_") - SET(${GD_PREFIX}PREFIX "${GD_PREFIX}") - ENDIF(NOT "${GD_PREFIX}" STREQUAL "GD_") + set(GD_PREFIX "GD_") + if(NOT "${ARGV0}" STREQUAL "") + set(GD_PREFIX "${ARGV0}") + endif() + if(NOT "${GD_PREFIX}" STREQUAL "GD_") + set(${GD_PREFIX}PREFIX "${GD_PREFIX}") + endif() # If there's an ARGV1, use it as ${GD_PREFIX}VERBOSE: # - SET(${GD_PREFIX}VERBOSE "0") - IF(NOT "${ARGV1}" STREQUAL "") - SET(${GD_PREFIX}VERBOSE "${ARGV1}") - ENDIF(NOT "${ARGV1}" STREQUAL "") + set(${GD_PREFIX}VERBOSE "0") + if(NOT "${ARGV1}" STREQUAL "") + set(${GD_PREFIX}VERBOSE "${ARGV1}") + endif() # Retrieve the current date and time in the format: # @@ -57,58 +57,58 @@ MACRO(GET_DATE) # Use "echo %DATE% %TIME%" on Windows. # Otherwise, try "date" as implemented on most Unix flavors. # - IF(WIN32) + if(WIN32) # # Use "cmd" shell with %DATE% and %TIME% support... # May need adjustment in different locales or for custom date/time formats # set in the Windows Control Panel. # - SET(${GD_PREFIX}CMD "cmd") - SET(${GD_PREFIX}ARGS "/c echo %DATE% %TIME%") - ELSE(WIN32) + set(${GD_PREFIX}CMD "cmd") + set(${GD_PREFIX}ARGS "/c echo %DATE% %TIME%") + else() # # Match the format returned by default in US English Windows: # - SET(${GD_PREFIX}CMD "date") - SET(${GD_PREFIX}ARGS "\"+%a %m/%d/%Y %H:%M:%S.00\"") - ENDIF(WIN32) + set(${GD_PREFIX}CMD "date") + set(${GD_PREFIX}ARGS "\"+%a %m/%d/%Y %H:%M:%S.00\"") + endif() - EXEC_PROGRAM("${${GD_PREFIX}CMD}" "." ARGS "${${GD_PREFIX}ARGS}" + exec_program("${${GD_PREFIX}CMD}" "." ARGS "${${GD_PREFIX}ARGS}" OUTPUT_VARIABLE ${GD_PREFIX}OV RETURN_VALUE ${GD_PREFIX}RV ) - IF(${GD_PREFIX}VERBOSE) - MESSAGE(STATUS "") - MESSAGE(STATUS "") - MESSAGE(STATUS "") - MESSAGE(STATUS "GD_PREFIX='${GD_PREFIX}'") - IF(NOT "${GD_PREFIX}" STREQUAL "GD_") - MESSAGE(STATUS "${GD_PREFIX}PREFIX='${${GD_PREFIX}PREFIX}'") - ENDIF(NOT "${GD_PREFIX}" STREQUAL "GD_") - MESSAGE(STATUS "${GD_PREFIX}VERBOSE='${${GD_PREFIX}VERBOSE}'") - MESSAGE(STATUS "") - MESSAGE(STATUS "${GD_PREFIX}CMD='${${GD_PREFIX}CMD}'") - MESSAGE(STATUS "${GD_PREFIX}ARGS='${${GD_PREFIX}ARGS}'") - MESSAGE(STATUS "${GD_PREFIX}OV='${${GD_PREFIX}OV}'") - MESSAGE(STATUS "${GD_PREFIX}RV='${${GD_PREFIX}RV}'") - MESSAGE(STATUS "") - ENDIF(${GD_PREFIX}VERBOSE) - - IF("${${GD_PREFIX}RV}" STREQUAL "0") + if(${GD_PREFIX}VERBOSE) + message(STATUS "") + message(STATUS "") + message(STATUS "") + message(STATUS "GD_PREFIX='${GD_PREFIX}'") + if(NOT "${GD_PREFIX}" STREQUAL "GD_") + message(STATUS "${GD_PREFIX}PREFIX='${${GD_PREFIX}PREFIX}'") + endif() + message(STATUS "${GD_PREFIX}VERBOSE='${${GD_PREFIX}VERBOSE}'") + message(STATUS "") + message(STATUS "${GD_PREFIX}CMD='${${GD_PREFIX}CMD}'") + message(STATUS "${GD_PREFIX}ARGS='${${GD_PREFIX}ARGS}'") + message(STATUS "${GD_PREFIX}OV='${${GD_PREFIX}OV}'") + message(STATUS "${GD_PREFIX}RV='${${GD_PREFIX}RV}'") + message(STATUS "") + endif() + + if("${${GD_PREFIX}RV}" STREQUAL "0") # # Extract eight individual components by matching a regex with paren groupings. # Use the replace functionality and \\1 thru \\8 to extract components. # - SET(${GD_PREFIX}REGEX "([^ ]+) +([^/]+)/([^/]+)/([^ ]+) +([^:]+):([^:]+):([^\\.]+)\\.(.*)") + set(${GD_PREFIX}REGEX "([^ ]+) +([^/]+)/([^/]+)/([^ ]+) +([^:]+):([^:]+):([^\\.]+)\\.(.*)") - STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\1" ${GD_PREFIX}DAY_OF_WEEK "${${GD_PREFIX}OV}") - STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\2" ${GD_PREFIX}MONTH "${${GD_PREFIX}OV}") - STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\3" ${GD_PREFIX}DAY "${${GD_PREFIX}OV}") - STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\4" ${GD_PREFIX}YEAR "${${GD_PREFIX}OV}") - STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\5" ${GD_PREFIX}HOUR "${${GD_PREFIX}OV}") - STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\6" ${GD_PREFIX}MINUTE "${${GD_PREFIX}OV}") - STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\7" ${GD_PREFIX}SECOND "${${GD_PREFIX}OV}") - STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\8" ${GD_PREFIX}FRACTIONAL_SECOND "${${GD_PREFIX}OV}") + string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\1" ${GD_PREFIX}DAY_OF_WEEK "${${GD_PREFIX}OV}") + string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\2" ${GD_PREFIX}MONTH "${${GD_PREFIX}OV}") + string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\3" ${GD_PREFIX}DAY "${${GD_PREFIX}OV}") + string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\4" ${GD_PREFIX}YEAR "${${GD_PREFIX}OV}") + string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\5" ${GD_PREFIX}HOUR "${${GD_PREFIX}OV}") + string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\6" ${GD_PREFIX}MINUTE "${${GD_PREFIX}OV}") + string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\7" ${GD_PREFIX}SECOND "${${GD_PREFIX}OV}") + string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\8" ${GD_PREFIX}FRACTIONAL_SECOND "${${GD_PREFIX}OV}") # # Verify that extracted components don't have anything obviously @@ -117,93 +117,93 @@ MACRO(GET_DATE) # Expecting a four digit year: # - IF(NOT "${${GD_PREFIX}YEAR}" MATCHES "^[0-9][0-9][0-9][0-9]$") - MESSAGE(STATUS "WARNING: Extracted ${GD_PREFIX}YEAR='${${GD_PREFIX}YEAR}' is not a four digit number...") - ENDIF(NOT "${${GD_PREFIX}YEAR}" MATCHES "^[0-9][0-9][0-9][0-9]$") + if(NOT "${${GD_PREFIX}YEAR}" MATCHES "^[0-9][0-9][0-9][0-9]$") + message(STATUS "WARNING: Extracted ${GD_PREFIX}YEAR='${${GD_PREFIX}YEAR}' is not a four digit number...") + endif() # Expecting month to be <= 12: # - IF(${${GD_PREFIX}MONTH} GREATER 12) - MESSAGE(STATUS "WARNING: Extracted ${GD_PREFIX}MONTH='${${GD_PREFIX}MONTH}' is greater than 12!") - ENDIF(${${GD_PREFIX}MONTH} GREATER 12) + if(${${GD_PREFIX}MONTH} GREATER 12) + message(STATUS "WARNING: Extracted ${GD_PREFIX}MONTH='${${GD_PREFIX}MONTH}' is greater than 12!") + endif() # Expecting day to be <= 31: # - IF(${${GD_PREFIX}DAY} GREATER 31) - MESSAGE(STATUS "WARNING: Extracted ${GD_PREFIX}DAY='${${GD_PREFIX}DAY}' is greater than 31!") - ENDIF(${${GD_PREFIX}DAY} GREATER 31) + if(${${GD_PREFIX}DAY} GREATER 31) + message(STATUS "WARNING: Extracted ${GD_PREFIX}DAY='${${GD_PREFIX}DAY}' is greater than 31!") + endif() # Expecting hour to be <= 23: # - IF(${${GD_PREFIX}HOUR} GREATER 23) - MESSAGE(STATUS "WARNING: Extracted ${GD_PREFIX}HOUR='${${GD_PREFIX}HOUR}' is greater than 23!") - ENDIF(${${GD_PREFIX}HOUR} GREATER 23) + if(${${GD_PREFIX}HOUR} GREATER 23) + message(STATUS "WARNING: Extracted ${GD_PREFIX}HOUR='${${GD_PREFIX}HOUR}' is greater than 23!") + endif() # Expecting minute to be <= 59: # - IF(${${GD_PREFIX}MINUTE} GREATER 59) - MESSAGE(STATUS "WARNING: Extracted ${GD_PREFIX}MINUTE='${${GD_PREFIX}MINUTE}' is greater than 59!") - ENDIF(${${GD_PREFIX}MINUTE} GREATER 59) + if(${${GD_PREFIX}MINUTE} GREATER 59) + message(STATUS "WARNING: Extracted ${GD_PREFIX}MINUTE='${${GD_PREFIX}MINUTE}' is greater than 59!") + endif() # Expecting second to be <= 59: # - IF(${${GD_PREFIX}SECOND} GREATER 59) - MESSAGE(STATUS "WARNING: Extracted ${GD_PREFIX}SECOND='${${GD_PREFIX}SECOND}' is greater than 59!") - ENDIF(${${GD_PREFIX}SECOND} GREATER 59) + if(${${GD_PREFIX}SECOND} GREATER 59) + message(STATUS "WARNING: Extracted ${GD_PREFIX}SECOND='${${GD_PREFIX}SECOND}' is greater than 59!") + endif() # If individual components are single digit, # prepend a leading zero: # - IF("${${GD_PREFIX}YEAR}" MATCHES "^[0-9]$") - SET(${GD_PREFIX}YEAR "0${${GD_PREFIX}YEAR}") - ENDIF("${${GD_PREFIX}YEAR}" MATCHES "^[0-9]$") - IF("${${GD_PREFIX}MONTH}" MATCHES "^[0-9]$") - SET(${GD_PREFIX}MONTH "0${${GD_PREFIX}MONTH}") - ENDIF("${${GD_PREFIX}MONTH}" MATCHES "^[0-9]$") - IF("${${GD_PREFIX}DAY}" MATCHES "^[0-9]$") - SET(${GD_PREFIX}DAY "0${${GD_PREFIX}DAY}") - ENDIF("${${GD_PREFIX}DAY}" MATCHES "^[0-9]$") - IF("${${GD_PREFIX}HOUR}" MATCHES "^[0-9]$") - SET(${GD_PREFIX}HOUR "0${${GD_PREFIX}HOUR}") - ENDIF("${${GD_PREFIX}HOUR}" MATCHES "^[0-9]$") - IF("${${GD_PREFIX}MINUTE}" MATCHES "^[0-9]$") - SET(${GD_PREFIX}MINUTE "0${${GD_PREFIX}MINUTE}") - ENDIF("${${GD_PREFIX}MINUTE}" MATCHES "^[0-9]$") - IF("${${GD_PREFIX}SECOND}" MATCHES "^[0-9]$") - SET(${GD_PREFIX}SECOND "0${${GD_PREFIX}SECOND}") - ENDIF("${${GD_PREFIX}SECOND}" MATCHES "^[0-9]$") - - IF(${GD_PREFIX}VERBOSE) - MESSAGE(STATUS "${GD_PREFIX}REGEX='${${GD_PREFIX}REGEX}'") - MESSAGE(STATUS "${GD_PREFIX}YEAR='${${GD_PREFIX}YEAR}'") - MESSAGE(STATUS "${GD_PREFIX}MONTH='${${GD_PREFIX}MONTH}'") - MESSAGE(STATUS "${GD_PREFIX}DAY='${${GD_PREFIX}DAY}'") - MESSAGE(STATUS "${GD_PREFIX}HOUR='${${GD_PREFIX}HOUR}'") - MESSAGE(STATUS "${GD_PREFIX}MINUTE='${${GD_PREFIX}MINUTE}'") - MESSAGE(STATUS "${GD_PREFIX}SECOND='${${GD_PREFIX}SECOND}'") - MESSAGE(STATUS "${GD_PREFIX}FRACTIONAL_SECOND='${${GD_PREFIX}FRACTIONAL_SECOND}'") - MESSAGE(STATUS "${GD_PREFIX}DAY_OF_WEEK='${${GD_PREFIX}DAY_OF_WEEK}'") - MESSAGE(STATUS "") - MESSAGE(STATUS "Counters that change...") - MESSAGE(STATUS "") - MESSAGE(STATUS "...very very quickly : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}${${GD_PREFIX}HOUR}${${GD_PREFIX}MINUTE}${${GD_PREFIX}SECOND}${${GD_PREFIX}FRACTIONAL_SECOND}") - MESSAGE(STATUS " every second : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}${${GD_PREFIX}HOUR}${${GD_PREFIX}MINUTE}${${GD_PREFIX}SECOND}") - MESSAGE(STATUS " daily : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}") - MESSAGE(STATUS " monthly : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}") - MESSAGE(STATUS " annually : ${${GD_PREFIX}YEAR}") - MESSAGE(STATUS "") - ENDIF(${GD_PREFIX}VERBOSE) - ELSE("${${GD_PREFIX}RV}" STREQUAL "0") - MESSAGE(SEND_ERROR "ERROR: MACRO(GET_DATE) failed. ${GD_PREFIX}CMD='${${GD_PREFIX}CMD}' ${GD_PREFIX}ARGS='${${GD_PREFIX}ARGS}' ${GD_PREFIX}OV='${${GD_PREFIX}OV}' ${GD_PREFIX}RV='${${GD_PREFIX}RV}'") - ENDIF("${${GD_PREFIX}RV}" STREQUAL "0") - - IF(${GD_PREFIX}VERBOSE) - MESSAGE(STATUS "") - MESSAGE(STATUS "") - ENDIF(${GD_PREFIX}VERBOSE) -ENDMACRO(GET_DATE) - -MACRO(ADD_SECONDS sec) + if("${${GD_PREFIX}YEAR}" MATCHES "^[0-9]$") + set(${GD_PREFIX}YEAR "0${${GD_PREFIX}YEAR}") + endif() + if("${${GD_PREFIX}MONTH}" MATCHES "^[0-9]$") + set(${GD_PREFIX}MONTH "0${${GD_PREFIX}MONTH}") + endif() + if("${${GD_PREFIX}DAY}" MATCHES "^[0-9]$") + set(${GD_PREFIX}DAY "0${${GD_PREFIX}DAY}") + endif() + if("${${GD_PREFIX}HOUR}" MATCHES "^[0-9]$") + set(${GD_PREFIX}HOUR "0${${GD_PREFIX}HOUR}") + endif() + if("${${GD_PREFIX}MINUTE}" MATCHES "^[0-9]$") + set(${GD_PREFIX}MINUTE "0${${GD_PREFIX}MINUTE}") + endif() + if("${${GD_PREFIX}SECOND}" MATCHES "^[0-9]$") + set(${GD_PREFIX}SECOND "0${${GD_PREFIX}SECOND}") + endif() + + if(${GD_PREFIX}VERBOSE) + message(STATUS "${GD_PREFIX}REGEX='${${GD_PREFIX}REGEX}'") + message(STATUS "${GD_PREFIX}YEAR='${${GD_PREFIX}YEAR}'") + message(STATUS "${GD_PREFIX}MONTH='${${GD_PREFIX}MONTH}'") + message(STATUS "${GD_PREFIX}DAY='${${GD_PREFIX}DAY}'") + message(STATUS "${GD_PREFIX}HOUR='${${GD_PREFIX}HOUR}'") + message(STATUS "${GD_PREFIX}MINUTE='${${GD_PREFIX}MINUTE}'") + message(STATUS "${GD_PREFIX}SECOND='${${GD_PREFIX}SECOND}'") + message(STATUS "${GD_PREFIX}FRACTIONAL_SECOND='${${GD_PREFIX}FRACTIONAL_SECOND}'") + message(STATUS "${GD_PREFIX}DAY_OF_WEEK='${${GD_PREFIX}DAY_OF_WEEK}'") + message(STATUS "") + message(STATUS "Counters that change...") + message(STATUS "") + message(STATUS "...very very quickly : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}${${GD_PREFIX}HOUR}${${GD_PREFIX}MINUTE}${${GD_PREFIX}SECOND}${${GD_PREFIX}FRACTIONAL_SECOND}") + message(STATUS " every second : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}${${GD_PREFIX}HOUR}${${GD_PREFIX}MINUTE}${${GD_PREFIX}SECOND}") + message(STATUS " daily : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}") + message(STATUS " monthly : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}") + message(STATUS " annually : ${${GD_PREFIX}YEAR}") + message(STATUS "") + endif() + else() + message(SEND_ERROR "ERROR: macro(GET_DATE) failed. ${GD_PREFIX}CMD='${${GD_PREFIX}CMD}' ${GD_PREFIX}ARGS='${${GD_PREFIX}ARGS}' ${GD_PREFIX}OV='${${GD_PREFIX}OV}' ${GD_PREFIX}RV='${${GD_PREFIX}RV}'") + endif() + + if(${GD_PREFIX}VERBOSE) + message(STATUS "") + message(STATUS "") + endif() +endmacro() + +macro(ADD_SECONDS sec) set(new_min ${${GD_PREFIX}MINUTE}) set(new_hr ${${GD_PREFIX}HOUR}) math(EXPR new_sec "${sec} + ${${GD_PREFIX}SECOND}") @@ -230,4 +230,4 @@ MACRO(ADD_SECONDS sec) if(${hr_len} EQUAL 1) set(new_hr "0${new_hr}") endif() -ENDMACRO(ADD_SECONDS) +endmacro() diff --git a/Tests/CTestTestStopTime/test.cmake.in b/Tests/CTestTestStopTime/test.cmake.in index 2d03686e6..6804789cc 100644 --- a/Tests/CTestTestStopTime/test.cmake.in +++ b/Tests/CTestTestStopTime/test.cmake.in @@ -1,21 +1,22 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-StopTime") - -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestStopTime") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestStopTime") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-StopTime") + +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestStopTime") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestStopTime") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") #CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) -INCLUDE("${CTEST_BINARY_DIRECTORY}/GetDate.cmake") +include("${CTEST_BINARY_DIRECTORY}/GetDate.cmake") CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestSubdir/CMakeLists.txt b/Tests/CTestTestSubdir/CMakeLists.txt index 5400ee8c5..b7cc7e2f1 100644 --- a/Tests/CTestTestSubdir/CMakeLists.txt +++ b/Tests/CTestTestSubdir/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(CTestTestSubdir) -INCLUDE(CTest) +project(CTestTestSubdir) +include(CTest) -ADD_SUBDIRECTORY(subdir) -SUBDIRS(subdir2) -SUBDIRS("${CTestTestSubdir_SOURCE_DIR}/subdir3") +add_subdirectory(subdir) +subdirs(subdir2) +subdirs("${CTestTestSubdir_SOURCE_DIR}/subdir3") diff --git a/Tests/CTestTestSubdir/subdir/CMakeLists.txt b/Tests/CTestTestSubdir/subdir/CMakeLists.txt index b40d316d6..ee555354e 100644 --- a/Tests/CTestTestSubdir/subdir/CMakeLists.txt +++ b/Tests/CTestTestSubdir/subdir/CMakeLists.txt @@ -1,2 +1,2 @@ -ADD_EXECUTABLE (main main.c) -ADD_TEST (TestMain1 main) +add_executable (main main.c) +add_test (TestMain1 main) diff --git a/Tests/CTestTestSubdir/subdir2/CMakeLists.txt b/Tests/CTestTestSubdir/subdir2/CMakeLists.txt index 23f8e07c2..a8d0a779b 100644 --- a/Tests/CTestTestSubdir/subdir2/CMakeLists.txt +++ b/Tests/CTestTestSubdir/subdir2/CMakeLists.txt @@ -1,2 +1,2 @@ -ADD_EXECUTABLE (main2 main.c) -ADD_TEST (TestMain2 main2) +add_executable (main2 main.c) +add_test (TestMain2 main2) diff --git a/Tests/CTestTestSubdir/subdir3/CMakeLists.txt b/Tests/CTestTestSubdir/subdir3/CMakeLists.txt index 9a44b12b8..fbc41d5e6 100644 --- a/Tests/CTestTestSubdir/subdir3/CMakeLists.txt +++ b/Tests/CTestTestSubdir/subdir3/CMakeLists.txt @@ -1,2 +1,2 @@ -ADD_EXECUTABLE (main3 main.c) -ADD_TEST (TestMain3 main3) +add_executable (main3 main.c) +add_test (TestMain3 main3) diff --git a/Tests/CTestTestSubdir/test.cmake.in b/Tests/CTestTestSubdir/test.cmake.in index f240473ee..526d453dd 100644 --- a/Tests/CTestTestSubdir/test.cmake.in +++ b/Tests/CTestTestSubdir/test.cmake.in @@ -1,17 +1,18 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Subdir") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Subdir") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestSubdir") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestSubdir") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestSubdir") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestSubdir") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") #CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) diff --git a/Tests/CTestTestTimeout/CMakeLists.txt b/Tests/CTestTestTimeout/CMakeLists.txt index 0fd1cebb3..476d0a5e0 100644 --- a/Tests/CTestTestTimeout/CMakeLists.txt +++ b/Tests/CTestTestTimeout/CMakeLists.txt @@ -1,28 +1,28 @@ cmake_minimum_required (VERSION 2.8) -PROJECT(CTestTestTimeout) -INCLUDE(CTest) +project(CTestTestTimeout) +include(CTest) -IF(NOT TIMEOUT) - IF(CYGWIN) - SET(TIMEOUT 4) # Cygwin CMake sometimes takes > 1 second to load! - ELSE() - SET(TIMEOUT 1) - ENDIF() -ENDIF() +if(NOT TIMEOUT) + if(CYGWIN) + set(TIMEOUT 4) # Cygwin CMake sometimes takes > 1 second to load! + else() + set(TIMEOUT 1) + endif() +endif() -ADD_DEFINITIONS(-DTIMEOUT=${TIMEOUT}) -ADD_EXECUTABLE (Timeout timeout.c) +add_definitions(-DTIMEOUT=${TIMEOUT}) +add_executable (Timeout timeout.c) -ADD_TEST(NAME TestTimeout +add_test(NAME TestTimeout COMMAND ${CMAKE_COMMAND} -D Timeout=$ -D Log=${CMAKE_CURRENT_BINARY_DIR}/timeout.log -P ${CMAKE_CURRENT_SOURCE_DIR}/timeout.cmake ) -SET_TESTS_PROPERTIES(TestTimeout PROPERTIES TIMEOUT ${TIMEOUT}) +set_tests_properties(TestTimeout PROPERTIES TIMEOUT ${TIMEOUT}) -ADD_TEST(NAME CheckChild +add_test(NAME CheckChild COMMAND ${CMAKE_COMMAND} -D Timeout=$ -D Log=${CMAKE_CURRENT_BINARY_DIR}/timeout.log -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake ) -SET_TESTS_PROPERTIES(CheckChild PROPERTIES DEPENDS TestTimeout) +set_tests_properties(CheckChild PROPERTIES DEPENDS TestTimeout) diff --git a/Tests/CTestTestTimeout/test.cmake.in b/Tests/CTestTestTimeout/test.cmake.in index 8a8dc24e5..40241ffd6 100644 --- a/Tests/CTestTestTimeout/test.cmake.in +++ b/Tests/CTestTestTimeout/test.cmake.in @@ -1,21 +1,22 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Timeout") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Timeout") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestTimeout") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestTimeout") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestTimeout") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestTimeout") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") #CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) -FILE(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" " +file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" " TIMEOUT:STRING=@CTestTestTimeout_TIME@ ") diff --git a/Tests/CTestTestUpload/CMakeLists.txt b/Tests/CTestTestUpload/CMakeLists.txt index bc164b10c..90d811cd9 100644 --- a/Tests/CTestTestUpload/CMakeLists.txt +++ b/Tests/CTestTestUpload/CMakeLists.txt @@ -1,4 +1,4 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(CTestTestUpload) +project(CTestTestUpload) add_executable (Sleep sleep.c) diff --git a/Tests/CTestTestUpload/test.cmake.in b/Tests/CTestTestUpload/test.cmake.in index acfa233bc..19abc89f1 100644 --- a/Tests/CTestTestUpload/test.cmake.in +++ b/Tests/CTestTestUpload/test.cmake.in @@ -1,14 +1,15 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Upload") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Upload") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestUpload") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestUpload") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestUpload") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestUpload") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestZeroTimeout/CMakeLists.txt b/Tests/CTestTestZeroTimeout/CMakeLists.txt index 8a5246db1..4d2b79dc2 100644 --- a/Tests/CTestTestZeroTimeout/CMakeLists.txt +++ b/Tests/CTestTestZeroTimeout/CMakeLists.txt @@ -1,8 +1,8 @@ -CMAKE_MINIMUM_REQUIRED (VERSION 2.6) -PROJECT (CTestTestZeroTimeout) -INCLUDE (CTest) +cmake_minimum_required (VERSION 2.6) +project (CTestTestZeroTimeout) +include (CTest) -ADD_EXECUTABLE (Sleep sleep.c) +add_executable (Sleep sleep.c) -ADD_TEST (TestExplicitZeroTimeout Sleep) -SET_TESTS_PROPERTIES(TestExplicitZeroTimeout PROPERTIES TIMEOUT 0) +add_test (TestExplicitZeroTimeout Sleep) +set_tests_properties(TestExplicitZeroTimeout PROPERTIES TIMEOUT 0) diff --git a/Tests/CTestTestZeroTimeout/test.cmake.in b/Tests/CTestTestZeroTimeout/test.cmake.in index 56bae9d17..745e5bc34 100644 --- a/Tests/CTestTestZeroTimeout/test.cmake.in +++ b/Tests/CTestTestZeroTimeout/test.cmake.in @@ -1,18 +1,19 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.1) +cmake_minimum_required(VERSION 2.1) # Settings: -SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -SET(CTEST_SITE "@SITE@") -SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ZeroTimeout") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ZeroTimeout") -SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestZeroTimeout") -SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestZeroTimeout") -SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") -SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") -SET(CTEST_TEST_TIMEOUT 2) +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestZeroTimeout") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestZeroTimeout") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +set(CTEST_TEST_TIMEOUT 2) CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestUpdateBZR.cmake.in b/Tests/CTestUpdateBZR.cmake.in index c654f477a..8fb1d3483 100644 --- a/Tests/CTestUpdateBZR.cmake.in +++ b/Tests/CTestUpdateBZR.cmake.in @@ -74,7 +74,7 @@ if(dirs_added) WORKING_DIRECTORY ${TOP}/user-source COMMAND ${BZR} add ${dirs_added} ) -endif(dirs_added) +endif() run_child( WORKING_DIRECTORY ${TOP}/user-source COMMAND ${BZR} add ${files_added} diff --git a/Tests/CTestUpdateCVS.cmake.in b/Tests/CTestUpdateCVS.cmake.in index f7f5db65d..1699c3f1f 100644 --- a/Tests/CTestUpdateCVS.cmake.in +++ b/Tests/CTestUpdateCVS.cmake.in @@ -91,7 +91,7 @@ if(dirs_added) WORKING_DIRECTORY ${TOP}/user-source COMMAND ${CVSCMD} add ${dirs_added} ) -endif(dirs_added) +endif() run_child( WORKING_DIRECTORY ${TOP}/user-source COMMAND ${CVSCMD} add ${files_added} diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 335d09e7e..aaf88a8d1 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -12,8 +12,8 @@ function(run_child) string(REGEX REPLACE "\n" "\n " OUTPUT "${OUTPUT}") message(FATAL_ERROR "Child failed (${FAILED}), output is\n ${OUTPUT}\n" "Command = [${ARGN}]\n") - endif(FAILED) -endfunction(run_child) + endif() +endfunction() #----------------------------------------------------------------------------- # Function to find the Update.xml file and check for expected entries. @@ -26,7 +26,7 @@ function(check_updates build) ) if(NOT UPDATE_XML_FILE) message(FATAL_ERROR "Cannot find Update.xml with pattern\n ${PATTERN}") - endif(NOT UPDATE_XML_FILE) + endif() message(" found ${UPDATE_XML_FILE}") set(max_update_xml_size 16384) @@ -73,11 +73,11 @@ function(check_updates build) set(MSG "${MSG}Update.xml is missing expected entries:\n") foreach(f ${MISSING}) set(MSG "${MSG} ${f}\n") - endforeach(f) - else(MISSING) + endforeach() + else() # Success message(" no entries missing from Update.xml") - endif(MISSING) + endif() # Report the result if(EXTRA) @@ -85,11 +85,11 @@ function(check_updates build) set(MSG "${MSG}Update.xml has extra unexpected entries:\n") foreach(f ${EXTRA}) set(MSG "${MSG} ${f}\n") - endforeach(f) - else(EXTRA) + endforeach() + else() # Success message(" no extra entries in Update.xml") - endif(EXTRA) + endif() if(MSG) # Provide the log file @@ -99,14 +99,14 @@ function(check_updates build) file(READ ${UPDATE_LOG_FILE} UPDATE_LOG LIMIT ${max_update_xml_size}) string(REGEX REPLACE "\n" "\n " UPDATE_LOG "${UPDATE_LOG}") set(MSG "${MSG}Update log:\n ${UPDATE_LOG}") - else(UPDATE_LOG_FILE) + else() set(MSG "${MSG}No update log found!") - endif(UPDATE_LOG_FILE) + endif() # Display the error message message(FATAL_ERROR "${MSG}") - endif(MSG) -endfunction(check_updates) + endif() +endfunction() #----------------------------------------------------------------------------- # Function to create initial content. @@ -123,7 +123,7 @@ set(CTEST_NIGHTLY_START_TIME \"21:00:00 EDT\") # Some other files. file(WRITE ${TOP}/${dir}/foo.txt "foo\n") file(WRITE ${TOP}/${dir}/bar.txt "bar\n") -endfunction(create_content) +endfunction() #----------------------------------------------------------------------------- # Function to update content. @@ -137,20 +137,20 @@ function(update_content dir added_var removed_var dirs_var) set(${dirs_var} subdir PARENT_SCOPE) set(${added_var} zot.txt subdir/foo.txt subdir/bar.txt PARENT_SCOPE) set(${removed_var} bar.txt PARENT_SCOPE) -endfunction(update_content) +endfunction() #----------------------------------------------------------------------------- # Function to change existing files function(change_content dir) file(APPEND ${TOP}/${dir}/foo.txt "foo line 3\n") file(APPEND ${TOP}/${dir}/subdir/foo.txt "foo line 2\n") -endfunction(change_content) +endfunction() #----------------------------------------------------------------------------- # Function to create local modifications before update function(modify_content dir) file(APPEND ${TOP}/${dir}/CTestConfig.cmake "# local modification\n") -endfunction(modify_content) +endfunction() #----------------------------------------------------------------------------- # Function to write CTestConfiguration.ini content. @@ -163,7 +163,7 @@ BuildDirectory: ${TOP}/${bin_dir} Site: test.site BuildName: user-test ") -endfunction(create_build_tree) +endfunction() #----------------------------------------------------------------------------- # Function to write the dashboard test script. @@ -181,7 +181,7 @@ ${custom_text} ctest_start(Experimental) ctest_update(SOURCE \${CTEST_SOURCE_DIRECTORY}) ") -endfunction(create_dashboard_script) +endfunction() #----------------------------------------------------------------------------- # Function to run the dashboard through the command line @@ -205,7 +205,7 @@ function(run_dashboard_command_line bin_dir) Updated{subdir/bar.txt} ${_modified} ) -endfunction(run_dashboard_command_line) +endfunction() #----------------------------------------------------------------------------- # Function to run the dashboard through a script @@ -224,11 +224,11 @@ function(run_dashboard_script bin_dir) Updated{subdir/foo.txt} Updated{subdir/bar.txt} ) -endfunction(run_dashboard_script) +endfunction() #----------------------------------------------------------------------------- # Function to initialize the testing directory. function(init_testing) file(REMOVE_RECURSE ${TOP}) file(MAKE_DIRECTORY ${TOP}) -endfunction(init_testing) +endfunction() diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index eb9f987c6..f6939de9a 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -76,6 +76,8 @@ run_child(WORKING_DIRECTORY ${TOP}/module # Import initial content into the repository. message("Importing content...") create_content(import) +file(WRITE ${TOP}/import/HEAD "HEAD\n") +file(WRITE ${TOP}/import/master "master\n") # Import the content into the repository. run_child(WORKING_DIRECTORY ${TOP}/import @@ -157,19 +159,19 @@ update_content(user-source files_added files_removed dirs_added) if(dirs_added) run_child( WORKING_DIRECTORY ${TOP}/user-source - COMMAND ${GIT} add ${dirs_added} + COMMAND ${GIT} add -- ${dirs_added} ) -endif(dirs_added) +endif() run_child( WORKING_DIRECTORY ${TOP}/user-source - COMMAND ${GIT} add ${files_added} + COMMAND ${GIT} add -- ${files_added} ) run_child( WORKING_DIRECTORY ${TOP}/user-source - COMMAND ${GIT} rm ${files_removed} + COMMAND ${GIT} rm -- ${files_removed} ) run_child(WORKING_DIRECTORY ${TOP}/user-source/module - COMMAND ${GIT} checkout master + COMMAND ${GIT} checkout master -- ) run_child( WORKING_DIRECTORY ${TOP}/user-source @@ -221,7 +223,7 @@ macro(rewind_source src_dir) WORKING_DIRECTORY ${TOP}/${src_dir} COMMAND ${GIT} submodule update ) -endmacro(rewind_source) +endmacro() rewind_source(user-source) # Make sure pull does not try to rebase (which does not work with diff --git a/Tests/CTestUpdateHG.cmake.in b/Tests/CTestUpdateHG.cmake.in index 640d2c6f3..c5440f954 100644 --- a/Tests/CTestUpdateHG.cmake.in +++ b/Tests/CTestUpdateHG.cmake.in @@ -70,7 +70,7 @@ if(dirs_added) WORKING_DIRECTORY ${TOP}/user-source COMMAND ${HG} add ${dirs_added} ) -endif(dirs_added) +endif() run_child( WORKING_DIRECTORY ${TOP}/user-source COMMAND ${HG} add ${files_added} diff --git a/Tests/CTestUpdateSVN.cmake.in b/Tests/CTestUpdateSVN.cmake.in index 15b833b10..b5728fd67 100644 --- a/Tests/CTestUpdateSVN.cmake.in +++ b/Tests/CTestUpdateSVN.cmake.in @@ -74,7 +74,7 @@ if(dirs_added) WORKING_DIRECTORY ${TOP}/user-source COMMAND ${SVNCMD} add ${depth_empty} ${dirs_added} ) -endif(dirs_added) +endif() run_child( WORKING_DIRECTORY ${TOP}/user-source COMMAND ${SVNCMD} add ${files_added} diff --git a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt index 8b279a5c4..20001e6ed 100644 --- a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt +++ b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt @@ -46,6 +46,7 @@ echo_var(MSVC80) echo_var(MSVC90) echo_var(MSVC10) echo_var(MSVC11) +echo_var(MSVC_IDE) if(MSVC) # @@ -60,6 +61,13 @@ if(MSVC) else() message(FATAL_ERROR "error: ${msvc_total} MSVC** variables are defined -- exactly 1 expected") endif() + if(NOT DEFINED MSVC_IDE) + message(FATAL_ERROR "MSVC_IDE not defined but should be!") + elseif("${CMAKE_GENERATOR}" MATCHES "Visual Studio" AND NOT MSVC_IDE) + message(FATAL_ERROR "MSVC_IDE is not true but should be (${CMAKE_GENERATOR})!") + elseif(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio" AND MSVC_IDE) + message(FATAL_ERROR "MSVC_IDE is true but should not be (${CMAKE_GENERATOR})!") + endif() else() # # The compiler is something other than cl... None of the MSVC** variables @@ -70,6 +78,9 @@ else() else() message(FATAL_ERROR "error: ${msvc_total} MSVC** variables are defined -- exactly 0 expected") endif() + if(DEFINED MSVC_IDE) + message(FATAL_ERROR "MSVC_IDE is defined but should not be!") + endif() endif() diff --git a/Tests/CommandLineTest/CMakeLists.txt b/Tests/CommandLineTest/CMakeLists.txt index 0493a0c4b..96aac104c 100644 --- a/Tests/CommandLineTest/CMakeLists.txt +++ b/Tests/CommandLineTest/CMakeLists.txt @@ -1,13 +1,13 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(CommandLineTest) +project(CommandLineTest) -GET_FILENAME_COMPONENT(CMAKE_BIN_DIR ${CMAKE_COMMAND} PATH) -MACRO(EXEC_CMAKE_COMMAND CMAKE_ARGS) - EXEC_PROGRAM("${CMAKE_COMMAND}" ARGS "${CMAKE_ARGS}" RETURN_VALUE RET) - IF(${RET}) - MESSAGE(SEND_ERROR "CMake command failed with arguments \"${CMAKE_ARGS}\"") - ENDIF(${RET}) -ENDMACRO(EXEC_CMAKE_COMMAND) +get_filename_component(CMAKE_BIN_DIR ${CMAKE_COMMAND} PATH) +macro(EXEC_CMAKE_COMMAND CMAKE_ARGS) + exec_program("${CMAKE_COMMAND}" ARGS "${CMAKE_ARGS}" RETURN_VALUE RET) + if(${RET}) + message(SEND_ERROR "CMake command failed with arguments \"${CMAKE_ARGS}\"") + endif() +endmacro() EXEC_CMAKE_COMMAND("-E chdir \"${CMAKE_CURRENT_SOURCE_DIR}\" \"${CMAKE_COMMAND}\" -E echo \"Hello World\"") EXEC_CMAKE_COMMAND("-E time \"${CMAKE_COMMAND} -N -L ${CommandLineTest_SOURCE_DIR}\"") @@ -24,22 +24,22 @@ EXEC_CMAKE_COMMAND("--help-html \"${CMAKE_CURRENT_BINARY_DIR}/cmake.html\"") EXEC_CMAKE_COMMAND("--copyright \"${CMAKE_CURRENT_BINARY_DIR}/Copyright.txt\"") EXEC_CMAKE_COMMAND("--version \"${CMAKE_CURRENT_BINARY_DIR}/version.txt\"") -ADD_EXECUTABLE(CommandLineTest CommandLineTest.cxx) +add_executable(CommandLineTest CommandLineTest.cxx) -GET_FILENAME_COMPONENT(CMAKE_COMMAND_PATH "${CMAKE_COMMAND}" PATH) -SET(CTEST_COMMAND "${CMAKE_COMMAND_PATH}/ctest") -MACRO(EXEC_CTEST_COMMAND CMAKE_ARGS) - EXEC_PROGRAM("${CTEST_COMMAND}" ARGS "${CMAKE_ARGS}" RETURN_VALUE RET) - IF(${RET}) - MESSAGE(SEND_ERROR "CTest command failed with arguments \"${CMAKE_ARGS}\"") - ENDIF(${RET}) -ENDMACRO(EXEC_CTEST_COMMAND) -MACRO(EXEC_CTEST_COMMAND_WITH_DIR DIR CMAKE_ARGS) - EXEC_PROGRAM("${CTEST_COMMAND}" "${DIR}" ARGS "${CMAKE_ARGS}" RETURN_VALUE RET) - IF(${RET}) - MESSAGE(SEND_ERROR "CTest command failed with arguments \"${CMAKE_ARGS}\"") - ENDIF(${RET}) -ENDMACRO(EXEC_CTEST_COMMAND_WITH_DIR) +get_filename_component(CMAKE_COMMAND_PATH "${CMAKE_COMMAND}" PATH) +set(CTEST_COMMAND "${CMAKE_COMMAND_PATH}/ctest") +macro(EXEC_CTEST_COMMAND CMAKE_ARGS) + exec_program("${CTEST_COMMAND}" ARGS "${CMAKE_ARGS}" RETURN_VALUE RET) + if(${RET}) + message(SEND_ERROR "CTest command failed with arguments \"${CMAKE_ARGS}\"") + endif() +endmacro() +macro(EXEC_CTEST_COMMAND_WITH_DIR DIR CMAKE_ARGS) + exec_program("${CTEST_COMMAND}" "${DIR}" ARGS "${CMAKE_ARGS}" RETURN_VALUE RET) + if(${RET}) + message(SEND_ERROR "CTest command failed with arguments \"${CMAKE_ARGS}\"") + endif() +endmacro() EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-N") EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-R complex -N") @@ -55,25 +55,25 @@ EXEC_CTEST_COMMAND("--help-man \"${CMAKE_CURRENT_BINARY_DIR}/ctest.man\"") EXEC_CTEST_COMMAND("--help-html \"${CMAKE_CURRENT_BINARY_DIR}/ctest.html\"") EXEC_CTEST_COMMAND("--version") -IF(THIS_SHOULD_BE_SET) - MESSAGE(STATUS "***************************") - MESSAGE(STATUS "PreLoad.cmake works fine.") - MESSAGE(STATUS "***************************") -ELSE(THIS_SHOULD_BE_SET) - MESSAGE("***************************") - MESSAGE(FATAL_ERROR "PreLoad.cmake does not work.") -ENDIF(THIS_SHOULD_BE_SET) +if(THIS_SHOULD_BE_SET) + message(STATUS "***************************") + message(STATUS "PreLoad.cmake works fine.") + message(STATUS "***************************") +else() + message("***************************") + message(FATAL_ERROR "PreLoad.cmake does not work.") +endif() -IF(DEFINED ENV{TEST_ENVIRONMENT_VARIABLE_NOTSET}) - MESSAGE(SEND_ERROR "Environment variable definition test broken!") -ENDIF(DEFINED ENV{TEST_ENVIRONMENT_VARIABLE_NOTSET}) +if(DEFINED ENV{TEST_ENVIRONMENT_VARIABLE_NOTSET}) + message(SEND_ERROR "Environment variable definition test broken!") +endif() -SET(ENV{TEST_ENVIRONMENT_VARIABLE} "Environment variable set") -IF("$ENV{TEST_ENVIRONMENT_VARIABLE}" STREQUAL "Environment variable set") - MESSAGE(STATUS "Environment variable set to: $ENV{TEST_ENVIRONMENT_VARIABLE}") - IF(NOT DEFINED ENV{TEST_ENVIRONMENT_VARIABLE}) - MESSAGE(SEND_ERROR "Environment variable definition test failed!") - ENDIF(NOT DEFINED ENV{TEST_ENVIRONMENT_VARIABLE}) -ELSE("$ENV{TEST_ENVIRONMENT_VARIABLE}" STREQUAL "Environment variable set") - MESSAGE(SEND_ERROR "Environment variable setting is broken") -ENDIF("$ENV{TEST_ENVIRONMENT_VARIABLE}" STREQUAL "Environment variable set") +set(ENV{TEST_ENVIRONMENT_VARIABLE} "Environment variable set") +if("$ENV{TEST_ENVIRONMENT_VARIABLE}" STREQUAL "Environment variable set") + message(STATUS "Environment variable set to: $ENV{TEST_ENVIRONMENT_VARIABLE}") + if(NOT DEFINED ENV{TEST_ENVIRONMENT_VARIABLE}) + message(SEND_ERROR "Environment variable definition test failed!") + endif() +else() + message(SEND_ERROR "Environment variable setting is broken") +endif() diff --git a/Tests/CommandLineTest/PreLoad.cmake b/Tests/CommandLineTest/PreLoad.cmake index 87284aff0..f059bcea6 100644 --- a/Tests/CommandLineTest/PreLoad.cmake +++ b/Tests/CommandLineTest/PreLoad.cmake @@ -1 +1 @@ -SET(THIS_SHOULD_BE_SET ON CACHE BOOL "Some variable") +set(THIS_SHOULD_BE_SET ON CACHE BOOL "Some variable") diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt new file mode 100644 index 000000000..cd0a37d20 --- /dev/null +++ b/Tests/CompatibleInterface/CMakeLists.txt @@ -0,0 +1,84 @@ + +cmake_minimum_required(VERSION 2.8) + +project(CompatibleInterface) + +include(GenerateExportHeader) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_library(iface1 empty.cpp) +set_property(TARGET iface1 APPEND PROPERTY + COMPATIBLE_INTERFACE_BOOL + BOOL_PROP1 + BOOL_PROP2 + BOOL_PROP3 + BOOL_PROP4 +) +set_property(TARGET iface1 APPEND PROPERTY + COMPATIBLE_INTERFACE_STRING + STRING_PROP1 + STRING_PROP2 + STRING_PROP3 +) + +set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP1 ON) +set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP2 ON) +set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP1 prop1) +set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP2 prop2) + +add_executable(CompatibleInterface main.cpp) +target_link_libraries(CompatibleInterface iface1) + +set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP2 ON) +set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP3 ON) +set_property(TARGET CompatibleInterface PROPERTY STRING_PROP2 prop2) +set_property(TARGET CompatibleInterface PROPERTY STRING_PROP3 prop3) + +target_compile_definitions(CompatibleInterface + PRIVATE + $<$>:BOOL_PROP1> + $<$>:BOOL_PROP2> + $<$>:BOOL_PROP3> + $<$,prop1>:STRING_PROP1> + $<$,prop2>:STRING_PROP2> + $<$,prop3>:STRING_PROP3> +) + + +add_library(iface2 SHARED iface2.cpp) +generate_export_header(iface2) + +set_property(TARGET iface2 APPEND PROPERTY + COMPATIBLE_INTERFACE_STRING + Iface2_PROP +) + +# For the LINK_LIBRARIES and related properties, we should not evaluate +# properties defined only in the interface - they should be implicitly zero +set_property(TARGET iface2 + APPEND PROPERTY + LINK_INTERFACE_LIBRARIES $<$>:nonexistant> +) +target_link_libraries(CompatibleInterface iface2 + $<$>:nonexistant> +) +# Test that this does not segfault: +target_compile_definitions(CompatibleInterface + PRIVATE + $<$>:SOME_DEFINE> +) + +# The COMPATIBLE_INTERFACE_* properties are only read from dependencies +# in the interface. Populating it on the CompatibleInterface target does +# not have any affect on the interpretation of the INTERFACE variants +# in dependencies. +set_property(TARGET iface1 PROPERTY + INTERFACE_NON_RELEVANT_PROP ON +) +set_property(TARGET iface2 PROPERTY + INTERFACE_NON_RELEVANT_PROP ON +) +set_property(TARGET CompatibleInterface APPEND PROPERTY + COMPATIBLE_INTERFACE_BOOL + NON_RELEVANT_PROP +) diff --git a/Tests/CompatibleInterface/empty.cpp b/Tests/CompatibleInterface/empty.cpp new file mode 100644 index 000000000..00323299c --- /dev/null +++ b/Tests/CompatibleInterface/empty.cpp @@ -0,0 +1 @@ +// no content diff --git a/Tests/CompatibleInterface/iface2.cpp b/Tests/CompatibleInterface/iface2.cpp new file mode 100644 index 000000000..a9b501508 --- /dev/null +++ b/Tests/CompatibleInterface/iface2.cpp @@ -0,0 +1,7 @@ + +#include "iface2.h" + +int Iface2::foo() +{ + return 0; +} diff --git a/Tests/CompatibleInterface/iface2.h b/Tests/CompatibleInterface/iface2.h new file mode 100644 index 000000000..ef4ebeec2 --- /dev/null +++ b/Tests/CompatibleInterface/iface2.h @@ -0,0 +1,13 @@ + +#ifndef IFACE2_H +#define IFACE2_H + +#include "iface2_export.h" + +class IFACE2_EXPORT Iface2 +{ +public: + int foo(); +}; + +#endif diff --git a/Tests/CompatibleInterface/main.cpp b/Tests/CompatibleInterface/main.cpp new file mode 100644 index 000000000..f5e6e3891 --- /dev/null +++ b/Tests/CompatibleInterface/main.cpp @@ -0,0 +1,32 @@ + +#ifndef BOOL_PROP1 +#error Expected BOOL_PROP1 +#endif + +#ifndef BOOL_PROP2 +#error Expected BOOL_PROP2 +#endif + +#ifndef BOOL_PROP3 +#error Expected BOOL_PROP3 +#endif + +#ifndef STRING_PROP1 +#error Expected STRING_PROP1 +#endif + +#ifndef STRING_PROP2 +#error Expected STRING_PROP2 +#endif + +#ifndef STRING_PROP3 +#error Expected STRING_PROP3 +#endif + +#include "iface2.h" + +int main(int argc, char **argv) +{ + Iface2 if2; + return if2.foo(); +} diff --git a/Tests/CompileCommandOutput/CMakeLists.txt b/Tests/CompileCommandOutput/CMakeLists.txt index bd8e305c2..6f9468dca 100644 --- a/Tests/CompileCommandOutput/CMakeLists.txt +++ b/Tests/CompileCommandOutput/CMakeLists.txt @@ -2,15 +2,15 @@ cmake_minimum_required (VERSION 2.6) project (CompileCommandOutput CXX) -SET(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix") -IF(MAKE_SUPPORTS_SPACES) - SET(test1_srcs "file with spaces.cxx") -ELSE() - SET(test1_srcs "file_with_underscores.cxx") -ENDIF() -ADD_LIBRARY(test1 STATIC ${test1_srcs}) -ADD_LIBRARY(test2 SHARED "../CompileCommandOutput/relative.cxx") -INCLUDE_DIRECTORIES(${CompileCommandOutput_SOURCE_DIR}/../../Source) -ADD_EXECUTABLE(CompileCommandOutput compile_command_output.cxx) -TARGET_LINK_LIBRARIES(CompileCommandOutput test1 test2) +if(MAKE_SUPPORTS_SPACES) + set(test1_srcs "file with spaces.cxx") +else() + set(test1_srcs "file_with_underscores.cxx") +endif() +add_library(test1 STATIC ${test1_srcs}) +add_library(test2 SHARED "../CompileCommandOutput/relative.cxx") +include_directories(${CompileCommandOutput_SOURCE_DIR}/../../Source) +add_executable(CompileCommandOutput compile_command_output.cxx) +target_link_libraries(CompileCommandOutput test1 test2) diff --git a/Tests/CompileDefinitions/CMakeLists.txt b/Tests/CompileDefinitions/CMakeLists.txt new file mode 100644 index 000000000..e7d91bf94 --- /dev/null +++ b/Tests/CompileDefinitions/CMakeLists.txt @@ -0,0 +1,16 @@ + +cmake_minimum_required(VERSION 2.8) + +project(CompileDefinitions) + +if ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 6") + add_definitions(-DNO_SPACES_IN_DEFINE_VALUES) +endif() + +add_subdirectory(add_definitions_command) +add_subdirectory(target_prop) +add_subdirectory(add_definitions_command_with_target_prop) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummyexecutable.cpp" "int main(int, char **) { return 0; }\n") + +add_executable(CompileDefinitions "${CMAKE_CURRENT_BINARY_DIR}/dummyexecutable.cpp") diff --git a/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt b/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt new file mode 100644 index 000000000..a6372af74 --- /dev/null +++ b/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt @@ -0,0 +1,7 @@ + +project(add_definitions_command) + +add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun -DCMAKE_IS_="Fun" -DCMAKE_IS_REALLY="Very Fun") +add_definitions(-DCMAKE_IS_="Fun" -DCMAKE_IS_REALLY="Very Fun" -DCMAKE_IS_FUN -DCMAKE_IS=Fun) + +add_executable(add_definitions_command_executable ../compiletest.cpp) diff --git a/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt b/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt new file mode 100644 index 000000000..e415390c0 --- /dev/null +++ b/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt @@ -0,0 +1,14 @@ + +project(add_definitions_command_with_target_prop) + +add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun) + +add_executable(add_definitions_command_with_target_prop_executable ../compiletest.cpp) + +set_target_properties(add_definitions_command_with_target_prop_executable PROPERTIES COMPILE_DEFINITIONS CMAKE_IS_="Fun") + +set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_REALLY="Very Fun") + +add_definitions(-DCMAKE_IS_FUN) + +set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS=Fun CMAKE_IS_="Fun") diff --git a/Tests/CompileDefinitions/compiletest.cpp b/Tests/CompileDefinitions/compiletest.cpp new file mode 100644 index 000000000..f18e59e67 --- /dev/null +++ b/Tests/CompileDefinitions/compiletest.cpp @@ -0,0 +1,51 @@ + +#ifndef CMAKE_IS_FUN +#error Expect CMAKE_IS_FUN definition +#endif + +#if CMAKE_IS != Fun +#error Expect CMAKE_IS=Fun definition +#endif + + +template +struct CMakeStaticAssert; + +template<> +struct CMakeStaticAssert {}; + +static const char fun_string[] = CMAKE_IS_; +#ifndef NO_SPACES_IN_DEFINE_VALUES +static const char very_fun_string[] = CMAKE_IS_REALLY; +#endif + +enum { + StringLiteralTest1 = sizeof(CMakeStaticAssert) +#ifndef NO_SPACES_IN_DEFINE_VALUES + , + StringLiteralTest2 = sizeof(CMakeStaticAssert) +#endif +}; + +#ifdef TEST_GENERATOR_EXPRESSIONS +#ifndef CMAKE_IS_DECLARATIVE +#error Expect declarative definition +#endif +#ifdef GE_NOT_DEFINED +#error Expect not defined generator expression +#endif + +#ifndef ARGUMENT +#error Expected define expanded from list +#endif +#ifndef LIST +#error Expected define expanded from list +#endif + +// TEST_GENERATOR_EXPRESSIONS +#endif + +int main(int argc, char **argv) +{ + return 0; +} diff --git a/Tests/CompileDefinitions/target_prop/CMakeLists.txt b/Tests/CompileDefinitions/target_prop/CMakeLists.txt new file mode 100644 index 000000000..abdf257ec --- /dev/null +++ b/Tests/CompileDefinitions/target_prop/CMakeLists.txt @@ -0,0 +1,16 @@ + +project(target_prop) + +add_executable(target_prop_executable ../compiletest.cpp) + +set_target_properties(target_prop_executable PROPERTIES COMPILE_DEFINITIONS CMAKE_IS_FUN) + +set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_REALLY="Very Fun" CMAKE_IS=Fun) +set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_FUN CMAKE_IS_="Fun") + +set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS + TEST_GENERATOR_EXPRESSIONS + "$<1:CMAKE_IS_DECLARATIVE>" + "$<0:GE_NOT_DEFINED>" + "$<1:ARGUMENT;LIST>" +) diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index ec3ad3985..048f966f6 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -1,219 +1,219 @@ # # A more complex test case # -SET(CMAKE_BACKWARDS_COMPATIBILITY 1.4) -PROJECT (Complex) +set(CMAKE_BACKWARDS_COMPATIBILITY 1.4) +project (Complex) # Try setting a new policy. The IF test is for coverage. -IF(POLICY CMP0003) - CMAKE_POLICY(SET CMP0003 NEW) +if(POLICY CMP0003) + cmake_policy(SET CMP0003 NEW) - CMAKE_POLICY(GET CMP0003 P3) - IF(NOT "${P3}" STREQUAL "NEW") - MESSAGE(FATAL_ERROR "CMAKE_POLICY(GET) did not report NEW!") - ENDIF(NOT "${P3}" STREQUAL "NEW") -ENDIF(POLICY CMP0003) + cmake_policy(GET CMP0003 P3) + if(NOT "${P3}" STREQUAL "NEW") + message(FATAL_ERROR "cmake_policy(GET) did not report NEW!") + endif() +endif() # Test building without per-rule echo lines in Makefiles. -SET_PROPERTY(GLOBAL PROPERTY RULE_MESSAGES OFF) +set_property(GLOBAL PROPERTY RULE_MESSAGES OFF) -SET(CPACK_SOURCE_IGNORE_FILES "~$;\\.cvsignore$;^C:/hoffman/My Builds/testcase.*/CVS/;^C:/hoffman/My Builds/testcase.*/\\.svn/;^C:/hoffman/My Builds/testcase.*/sweigart/;^C:/hoffman/My Builds/testcase/www/eospaper/solution/eos2001/;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_tables_new/;^C:/hoffman/My Builds/testcase/COPYING$;^C:/hoffman/My Builds/testcase/INSTALL$;^C:/hoffman/My Builds/testcase/Makefile$;^C:/hoffman/My Builds/testcase/Makefile\\.in$;^C:/hoffman/My Builds/testcase/.*\\.lo$;^C:/hoffman/My Builds/testcase/.*\\.la$;^C:/hoffman/My Builds/testcase/mkinstalldirs$;^C:/hoffman/My Builds/testcase/missing$;^C:/hoffman/My Builds/testcase/ltmain\\.sh$;^C:/hoffman/My Builds/testcase/libtool$;^C:/hoffman/My Builds/testcase/install-sh$;^C:/hoffman/My Builds/testcase/configure$;^C:/hoffman/My Builds/testcase/config\\.sub$;^C:/hoffman/My Builds/testcase/config\\.status$;^C:/hoffman/My Builds/testcase/config\\.log$;^C:/hoffman/My Builds/testcase/config\\.guess$;^C:/hoffman/My Builds/testcase/autom4te\\.cache$;^C:/hoffman/My Builds/testcase/aclocal\\.m4$;^C:/hoffman/My Builds/testcase/depcomp$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.075\\.model_cassisi_eos1_10$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.075\\.model_cassisi_eos1_10_corr$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model_cassisi_eos1$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model_cassisi_scvh$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.3\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.rgbtip\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.zahb\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.3\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.085\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/.*\\.ps$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.mem$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.tex\\.bak$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j10\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j12\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j16\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j20\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j22\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j26\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j30\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j32\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j36\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k10\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k12\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k20\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k22\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k30\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k32\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/1_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/1_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/2_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/2_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/linear_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/linear_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/noexchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/noexchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/nr_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/nr_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/series_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/series_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_JNR_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_Jseries_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_KNR_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_Kseries_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check34_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check35_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check36_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check43_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check44_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check45_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check46_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check47_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check48_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/tc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/make\\.out.*$;^C:/hoffman/My Builds/testcase/www/Makefile$;^C:/hoffman/My Builds/testcase/www/Makefile\\.in$;^C:/hoffman/My Builds/testcase/src/.*\\.flc$;^C:/hoffman/My Builds/testcase/src/Makefile$;^C:/hoffman/My Builds/testcase/src/Makefile\\.in$;^C:/hoffman/My Builds/testcase/src/\\.deps$;^C:/hoffman/My Builds/testcase/src/\\.libs$;^C:/hoffman/My Builds/testcase/src/.*\\.la$;^C:/hoffman/My Builds/testcase/src/.*\\.lo$;^C:/hoffman/My Builds/testcase/src/make\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/statef.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.1\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.1\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.1\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.3\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.3\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.3\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_15$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_rel$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/hot_post_agb\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgb_tip\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgbtip\\.1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgbtip\\.1\\.0\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgbtip\\.1\\.0\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/start_shellflash\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/white_dwarf\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.1\\.0\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.1\\.0\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/15gamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/15lnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/23gamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/23lnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/thermodynamic_consistency/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/thermodynamic_consistency/.*\\.results$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/newversion_grid/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/newversion_grid/.*\\.err$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/.*\\.ps$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_fit\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_fit\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_fit\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/3order_data\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/5order_data\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/8order_data\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check8_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check3_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check5_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/effo_check3_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/effoo_check3_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda15gamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda15lnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda23gamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda23lnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/tc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/make\\.out.*$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/thermodynamic_consistency/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/thermodynamic_consistency/tc\\.results$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_compare_model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_compare_solar\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_solar\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_solar_1995\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/statef_opal_model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/statef_opal_model_1995\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/purehe_newversion_grid/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/purehe_newversion_grid/.*\\.err$;^C:/hoffman/My Builds/testcase/include/Makefile\\.in$;^C:/hoffman/My Builds/testcase/include/Makefile$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/0\\.1\\.model_pteh$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/1\\.0\\.model_eos1a-eos1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/1\\.0\\.model_pteh$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/statef_model_0\\.1\\.model_pteh\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/statef_model_1\\.0\\.model_eos1a-eos1\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/statef_model_1\\.0\\.model_pteh\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context/contour\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context/eos_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context/statef_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/thermodynamic_consistency/fort\\.91$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/thermodynamic_consistency/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/context$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/oldversion_grid$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/2005Ap&SS\\.298\\.\\.135S\\.pdf$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/2007Ap&SS\\.307\\.\\.263C\\.pdf$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/astro-ph\\.9909168_eprint_submitted_to_High_Press\\.Res\\.16,331\\.pdf$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/.*ps.*$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/convergence\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/convergence\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/convergence\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/statef_grid-newversion$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/pureh_context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/purehe_context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/old$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/make\\.out.*$;^C:/hoffman/My Builds/testcase/utils/.*\\.flc$;^C:/hoffman/My Builds/testcase/utils/Makefile$;^C:/hoffman/My Builds/testcase/utils/Makefile\\.in$;^C:/hoffman/My Builds/testcase/utils/\\.deps$;^C:/hoffman/My Builds/testcase/utils/\\.libs$;^C:/hoffman/My Builds/testcase/utils/.*\\.la$;^C:/hoffman/My Builds/testcase/utils/.*\\.lo$;^C:/hoffman/My Builds/testcase/utils/free_eos_test$;^C:/hoffman/My Builds/testcase/utils/test_rosenbrock$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check1\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check3\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check5\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check8\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_checknr\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/effo_check3\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/effoo_check3\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence_20070613$;^C:/hoffman/My Builds/testcase/www/eospaper/text$;^C:/hoffman/My Builds/testcase/www/eospaper/cassisi_book_fig$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.1\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/2\\.0\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.2\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.3\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.4\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.5\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.6\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/figures$;^C:/hoffman/My Builds/testcase/www/eospaper/old$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/.*\\.ps.*$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/make\\.out.*$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_JNR\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_Jseries\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_KNR\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_Kseries\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check34\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check35\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check36\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check44\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check45\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check46\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_1_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_2_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_linear_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_noexchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_nr_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_series_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/1_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/noexchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/nr_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/series_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/series_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/linear_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/2_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/nr_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/linear_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/noexchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/1_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/2_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/pureh_newversion_grid/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/pureh_newversion_grid/.*\\.err$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_0\\.1\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_0\\.3\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model_linear\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model_noexchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model_nr\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.rgbtip\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.zahb\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.zahb\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.rgbtip\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model_linear$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model_noexchange$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model_nr$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/0\\.1\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/0\\.3\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context/contour\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context/eos_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context/statef_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/gong/delta\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/gong/m0085eos1gong\\.ascii$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/gong/m0085eos2gong\\.ascii$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb_adjust/coulomb_adjust\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/.*\\.ps$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/solution\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/solution\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/solution\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/rtc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/tc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/make\\.out.*$") +set(CPACK_SOURCE_IGNORE_FILES "~$;\\.cvsignore$;^C:/hoffman/My Builds/testcase.*/CVS/;^C:/hoffman/My Builds/testcase.*/\\.svn/;^C:/hoffman/My Builds/testcase.*/sweigart/;^C:/hoffman/My Builds/testcase/www/eospaper/solution/eos2001/;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_tables_new/;^C:/hoffman/My Builds/testcase/COPYING$;^C:/hoffman/My Builds/testcase/INSTALL$;^C:/hoffman/My Builds/testcase/Makefile$;^C:/hoffman/My Builds/testcase/Makefile\\.in$;^C:/hoffman/My Builds/testcase/.*\\.lo$;^C:/hoffman/My Builds/testcase/.*\\.la$;^C:/hoffman/My Builds/testcase/mkinstalldirs$;^C:/hoffman/My Builds/testcase/missing$;^C:/hoffman/My Builds/testcase/ltmain\\.sh$;^C:/hoffman/My Builds/testcase/libtool$;^C:/hoffman/My Builds/testcase/install-sh$;^C:/hoffman/My Builds/testcase/configure$;^C:/hoffman/My Builds/testcase/config\\.sub$;^C:/hoffman/My Builds/testcase/config\\.status$;^C:/hoffman/My Builds/testcase/config\\.log$;^C:/hoffman/My Builds/testcase/config\\.guess$;^C:/hoffman/My Builds/testcase/autom4te\\.cache$;^C:/hoffman/My Builds/testcase/aclocal\\.m4$;^C:/hoffman/My Builds/testcase/depcomp$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.075\\.model_cassisi_eos1_10$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.075\\.model_cassisi_eos1_10_corr$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model_cassisi_eos1$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model_cassisi_scvh$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.3\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.rgbtip\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.zahb\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.3\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.085\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/.*\\.ps$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.mem$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.tex\\.bak$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j10\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j12\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j16\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j20\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j22\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j26\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j30\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j32\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j36\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k10\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k12\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k20\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k22\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k30\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k32\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/1_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/1_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/2_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/2_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/linear_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/linear_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/noexchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/noexchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/nr_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/nr_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/series_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/series_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_JNR_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_Jseries_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_KNR_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_Kseries_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check34_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check35_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check36_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check43_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check44_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check45_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check46_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check47_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check48_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/tc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/make\\.out.*$;^C:/hoffman/My Builds/testcase/www/Makefile$;^C:/hoffman/My Builds/testcase/www/Makefile\\.in$;^C:/hoffman/My Builds/testcase/src/.*\\.flc$;^C:/hoffman/My Builds/testcase/src/Makefile$;^C:/hoffman/My Builds/testcase/src/Makefile\\.in$;^C:/hoffman/My Builds/testcase/src/\\.deps$;^C:/hoffman/My Builds/testcase/src/\\.libs$;^C:/hoffman/My Builds/testcase/src/.*\\.la$;^C:/hoffman/My Builds/testcase/src/.*\\.lo$;^C:/hoffman/My Builds/testcase/src/make\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/statef.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.1\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.1\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.1\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.3\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.3\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.3\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_15$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_rel$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/hot_post_agb\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgb_tip\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgbtip\\.1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgbtip\\.1\\.0\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgbtip\\.1\\.0\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/start_shellflash\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/white_dwarf\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.1\\.0\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.1\\.0\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/15gamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/15lnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/23gamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/23lnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/thermodynamic_consistency/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/thermodynamic_consistency/.*\\.results$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/newversion_grid/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/newversion_grid/.*\\.err$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/.*\\.ps$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_fit\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_fit\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_fit\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/3order_data\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/5order_data\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/8order_data\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check8_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check3_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check5_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/effo_check3_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/effoo_check3_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda15gamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda15lnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda23gamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda23lnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/tc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/make\\.out.*$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/thermodynamic_consistency/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/thermodynamic_consistency/tc\\.results$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_compare_model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_compare_solar\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_solar\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_solar_1995\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/statef_opal_model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/statef_opal_model_1995\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/purehe_newversion_grid/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/purehe_newversion_grid/.*\\.err$;^C:/hoffman/My Builds/testcase/include/Makefile\\.in$;^C:/hoffman/My Builds/testcase/include/Makefile$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/0\\.1\\.model_pteh$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/1\\.0\\.model_eos1a-eos1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/1\\.0\\.model_pteh$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/statef_model_0\\.1\\.model_pteh\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/statef_model_1\\.0\\.model_eos1a-eos1\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/statef_model_1\\.0\\.model_pteh\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context/contour\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context/eos_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context/statef_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/thermodynamic_consistency/fort\\.91$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/thermodynamic_consistency/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/context$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/oldversion_grid$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/2005Ap&SS\\.298\\.\\.135S\\.pdf$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/2007Ap&SS\\.307\\.\\.263C\\.pdf$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/astro-ph\\.9909168_eprint_submitted_to_High_Press\\.Res\\.16,331\\.pdf$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/.*ps.*$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/convergence\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/convergence\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/convergence\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/statef_grid-newversion$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/pureh_context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/purehe_context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/old$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/make\\.out.*$;^C:/hoffman/My Builds/testcase/utils/.*\\.flc$;^C:/hoffman/My Builds/testcase/utils/Makefile$;^C:/hoffman/My Builds/testcase/utils/Makefile\\.in$;^C:/hoffman/My Builds/testcase/utils/\\.deps$;^C:/hoffman/My Builds/testcase/utils/\\.libs$;^C:/hoffman/My Builds/testcase/utils/.*\\.la$;^C:/hoffman/My Builds/testcase/utils/.*\\.lo$;^C:/hoffman/My Builds/testcase/utils/free_eos_test$;^C:/hoffman/My Builds/testcase/utils/test_rosenbrock$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check1\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check3\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check5\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check8\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_checknr\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/effo_check3\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/effoo_check3\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence_20070613$;^C:/hoffman/My Builds/testcase/www/eospaper/text$;^C:/hoffman/My Builds/testcase/www/eospaper/cassisi_book_fig$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.1\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/2\\.0\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.2\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.3\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.4\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.5\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.6\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/figures$;^C:/hoffman/My Builds/testcase/www/eospaper/old$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/.*\\.ps.*$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/make\\.out.*$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_JNR\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_Jseries\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_KNR\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_Kseries\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check34\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check35\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check36\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check44\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check45\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check46\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_1_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_2_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_linear_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_noexchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_nr_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_series_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/1_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/noexchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/nr_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/series_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/series_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/linear_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/2_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/nr_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/linear_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/noexchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/1_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/2_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/pureh_newversion_grid/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/pureh_newversion_grid/.*\\.err$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_0\\.1\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_0\\.3\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model_linear\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model_noexchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model_nr\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.rgbtip\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.zahb\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.zahb\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.rgbtip\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model_linear$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model_noexchange$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model_nr$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/0\\.1\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/0\\.3\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context/contour\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context/eos_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context/statef_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/gong/delta\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/gong/m0085eos1gong\\.ascii$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/gong/m0085eos2gong\\.ascii$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb_adjust/coulomb_adjust\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/.*\\.ps$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/solution\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/solution\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/solution\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/rtc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/tc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/make\\.out.*$") # # Define a macro # -MACRO(ASSERT value msg) - IF (NOT ${value}) - MESSAGE ("Assertion failure:" ${msg} ) - ENDIF (NOT ${value}) -ENDMACRO(ASSERT) - +macro(ASSERT value msg) + if (NOT ${value}) + message ("Assertion failure:" ${msg} ) + endif () +endmacro() + # invoke the macro ASSERT(Complex_BINARY_DIR "The PROJECT command is broken") # # Define a var args macro, it must take two or four args # -MACRO(TEST_ARGC value1 value2) - ADD_DEFINITIONS(${value1} ${value2}) - IF (${ARGC} MATCHES 4) - ADD_DEFINITIONS(${ARGV2} ${ARGV3}) - ENDIF (${ARGC} MATCHES 4) -ENDMACRO(TEST_ARGC) - +macro(TEST_ARGC value1 value2) + add_definitions(${value1} ${value2}) + if (${ARGC} MATCHES 4) + add_definitions(${ARGV2} ${ARGV3}) + endif () +endmacro() + # invoke the macro TEST_ARGC(-DCMAKE_ARGV1 -DCMAKE_ARGV2 -DCMAKE_ARGV3 -DCMAKE_ARGV4) -MACRO(TEST_VAR_ARG fa) - IF("${ARGV}" MATCHES "^1;2;3$") - MESSAGE(STATUS "ARGV works") - ELSE("${ARGV}" MATCHES "^1;2;3$") - MESSAGE(FATAL_ERROR "ARGV does not work; got \"${ARGV}\" instead of \"1;2;3\"") - ENDIF("${ARGV}" MATCHES "^1;2;3$") - IF("${ARGN}" MATCHES "^2;3$") - MESSAGE(STATUS "ARGN works") - ELSE("${ARGN}" MATCHES "^2;3$") - MESSAGE(FATAL_ERROR "ARGV does not work; got \"${ARGN}\" instead of \"2;3\"") - ENDIF("${ARGN}" MATCHES "^2;3$") -ENDMACRO(TEST_VAR_ARG) +macro(TEST_VAR_ARG fa) + if("${ARGV}" MATCHES "^1;2;3$") + message(STATUS "ARGV works") + else() + message(FATAL_ERROR "ARGV does not work; got \"${ARGV}\" instead of \"1;2;3\"") + endif() + if("${ARGN}" MATCHES "^2;3$") + message(STATUS "ARGN works") + else() + message(FATAL_ERROR "ARGV does not work; got \"${ARGN}\" instead of \"2;3\"") + endif() +endmacro() TEST_VAR_ARG(1 2 3) # Floating-point comparison test. -IF(2.4 LESS 2.4) - MESSAGE(FATAL_ERROR "Failed: 2.4 LESS 2.4") -ENDIF(2.4 LESS 2.4) -IF(2.4 GREATER 2.4) - MESSAGE(FATAL_ERROR "Failed: 2.4 GREATER 2.4") -ENDIF(2.4 GREATER 2.4) -IF(NOT 2.4 EQUAL 2.4) - MESSAGE(FATAL_ERROR "Failed: NOT 2.4 EQUAL 2.4") -ENDIF(NOT 2.4 EQUAL 2.4) - -IF(CMAKE_SYSTEM MATCHES "OSF1-V.*") - IF(NOT CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ") - ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) -ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*") - - -ADD_DEFINITIONS(-DCMAKE_IS_FUN) -ADD_DEFINITIONS(-DCMAKE_IS_REALLY_FUN) -SET_PROPERTY(DIRECTORY +if(2.4 LESS 2.4) + message(FATAL_ERROR "Failed: 2.4 LESS 2.4") +endif() +if(2.4 GREATER 2.4) + message(FATAL_ERROR "Failed: 2.4 GREATER 2.4") +endif() +if(NOT 2.4 EQUAL 2.4) + message(FATAL_ERROR "Failed: NOT 2.4 EQUAL 2.4") +endif() + +if(CMAKE_SYSTEM MATCHES "OSF1-V.*") + if(NOT CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ") + endif() +endif() + + +add_definitions(-DCMAKE_IS_FUN) +add_definitions(-DCMAKE_IS_REALLY_FUN) +set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_RELEASE CMAKE_IS_FUN_IN_RELEASE_MODE ) -SET(TEST_SEP "a b c") -SEPARATE_ARGUMENTS(TEST_SEP) +set(TEST_SEP "a b c") +separate_arguments(TEST_SEP) # # Include vars from a file and from a cache # -IF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) - INCLUDE(${Complex_SOURCE_DIR}/VarTests.cmake) -ENDIF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) -INCLUDE(fileshouldnotbehere OPTIONAL) -LOAD_CACHE(${Complex_SOURCE_DIR}/Cache +if (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) + include(${Complex_SOURCE_DIR}/VarTests.cmake) +endif () +include(fileshouldnotbehere OPTIONAL) +load_cache(${Complex_SOURCE_DIR}/Cache EXCLUDE CACHE_TEST_VAR_EXCLUDED INCLUDE_INTERNALS CACHE_TEST_VAR_INTERNAL) -LOAD_CACHE(${Complex_SOURCE_DIR}/Cache READ_WITH_PREFIX foo CACHE_TEST_VAR2) -IF(${fooCACHE_TEST_VAR2} MATCHES bar) - MESSAGE("Load cache worked: ${fooCACHE_TEST_VAR2}") -ELSE(${fooCACHE_TEST_VAR2} MATCHES bar) - MESSAGE(FATAL_ERROR "Load cache with prefix failed: ${fooCACHE_TEST_VAR2}") -ENDIF(${fooCACHE_TEST_VAR2} MATCHES bar) +load_cache(${Complex_SOURCE_DIR}/Cache READ_WITH_PREFIX foo CACHE_TEST_VAR2) +if(${fooCACHE_TEST_VAR2} MATCHES bar) + message("Load cache worked: ${fooCACHE_TEST_VAR2}") +else() + message(FATAL_ERROR "Load cache with prefix failed: ${fooCACHE_TEST_VAR2}") +endif() # -# Specify include and lib dirs +# Specify include and lib dirs # (BEFORE is for coverage) # -INCLUDE_DIRECTORIES( +include_directories( Library ) -INCLUDE_DIRECTORIES(BEFORE +include_directories(BEFORE ${Complex_BINARY_DIR} ) -INCLUDE_DIRECTORIES(SYSTEM Library/SystemDir) +include_directories(SYSTEM Library/SystemDir) -INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile|test).*$" "^cmMissing") +include_regular_expression("^(cmTest|file|sharedFile|test).*$" "^cmMissing") -LINK_DIRECTORIES( +link_directories( ${Complex_BINARY_DIR}/Library ) # # check for SET CACHE FORCE # -SET(FORCE_TEST 1 CACHE STRING "a test") -SET(FORCE_TEST 0 CACHE STRING "a test" FORCE) +set(FORCE_TEST 1 CACHE STRING "a test") +set(FORCE_TEST 0 CACHE STRING "a test" FORCE) # # Lib and exe path # -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/lib/static") -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/lib") -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/bin") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/lib/static") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/lib") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/bin") -MESSAGE (Test " " escape " " semi-colon " " \; \;) +message (Test " " escape " " semi-colon " " \; \;) # # Exec program (TODO: test a result) # Increase coverage. # -MESSAGE("\nIgnore this message") -OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0) -IF (NOT NO_EXEC_PROGRAM) - EXEC_PROGRAM(${CMAKE_COMMAND} ARGS -E echo NO_EXEC_PROGRAM "${Complex_BINARY_DIR}") -ELSE (NOT NO_EXEC_PROGRAM) - MESSAGE("Set this option ON") -ENDIF (NOT NO_EXEC_PROGRAM) +message("\nIgnore this message") +option(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0) +if (NOT NO_EXEC_PROGRAM) + exec_program(${CMAKE_COMMAND} ARGS -E echo NO_EXEC_PROGRAM "${Complex_BINARY_DIR}") +else () + message("Set this option ON") +endif () -MARK_AS_ADVANCED(NO_EXEC_PROGRAM) -MARK_AS_ADVANCED(CLEAR NO_EXEC_PROGRAM) +mark_as_advanced(NO_EXEC_PROGRAM) +mark_as_advanced(CLEAR NO_EXEC_PROGRAM) # Execute a process. Add coverage for this command. -EXECUTE_PROCESS( +execute_process( COMMAND ${CMAKE_COMMAND} -E echo "ABCDEFG" OUTPUT_VARIABLE TEST_OUT ) -IF("${TEST_OUT}" MATCHES "^ABCDEFG\n$") -ELSE("${TEST_OUT}" MATCHES "^ABCDEFG\n$") - MESSAGE(SEND_ERROR "EXECUTE_PROCESS output test failed: [${TEST_OUT}]") -ENDIF("${TEST_OUT}" MATCHES "^ABCDEFG\n$") +if("${TEST_OUT}" MATCHES "^ABCDEFG\n$") +else() + message(SEND_ERROR "EXECUTE_PROCESS output test failed: [${TEST_OUT}]") +endif() # This test has some problems on UNIX systems. Disabling for now. # -# EXECUTE_PROCESS( +# execute_process( # COMMAND ${CMAKE_COMMAND} -E echo "ABCDEFG" # COMMAND /process/does/not/exist # OUTPUT_QUIET # ERROR_QUIET # RESULT_VARIABLE RESULT # ) -# IF("${RESULT}" MATCHES "^0$") -# MESSAGE(SEND_ERROR +# if("${RESULT}" MATCHES "^0$") +# message(SEND_ERROR # "EXECUTE_PROCESS result test failed with RESULT=[${RESULT}]") -# ELSE("${RESULT}" MATCHES "^0$") -# MESSAGE(STATUS "EXECUTE_PROCESS result test passed with RESULT=[${RESULT}]") -# ENDIF("${RESULT}" MATCHES "^0$") +# else() +# message(STATUS "EXECUTE_PROCESS result test passed with RESULT=[${RESULT}]") +# endif() # # Create directory. # The 'complex' executable will then test if this dir exists, # sadly it won't be able to remove it. # -MAKE_DIRECTORY("${Complex_BINARY_DIR}/make_dir") +make_directory("${Complex_BINARY_DIR}/make_dir") # # Test FIND_LIBARY # Create a dummy empty lib # -CONFIGURE_FILE( +configure_file( ${Complex_SOURCE_DIR}/Library/dummy ${Complex_BINARY_DIR}/Library/dummylib.lib COPYONLY IMMEDIATE) -FOREACH (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl +foreach (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl ${CMAKE_SHARED_LIBRARY_SUFFIX}.2 ${CMAKE_STATIC_LIBRARY_SUFFIX}.2) - CONFIGURE_FILE( + configure_file( ${Complex_SOURCE_DIR}/Library/dummy ${Complex_BINARY_DIR}/Library/libdummylib${ext} COPYONLY IMMEDIATE) -ENDFOREACH (ext) +endforeach () -FIND_LIBRARY(FIND_DUMMY_LIB +find_library(FIND_DUMMY_LIB dummylib PATHS ${Complex_BINARY_DIR}/Library DOC "find dummy lib") -FIND_LIBRARY(FIND_DUMMY_LIB +find_library(FIND_DUMMY_LIB NAMES dummylib dummylib2 PATHS ${Complex_BINARY_DIR}/Library DOC "find dummy lib") @@ -221,106 +221,106 @@ FIND_LIBRARY(FIND_DUMMY_LIB # This doesn't work for platforms that have a shared library and an import # library, like Windows with .dll and .lib. Limit is to ".so" now because it's # known to work there. -IF(CMAKE_SHARED_LIBRARY_SUFFIX STREQUAL ".so") - FIND_LIBRARY(FIND_DUMMY_SHLIB_VERSIONED +if(CMAKE_SHARED_LIBRARY_SUFFIX STREQUAL ".so") + find_library(FIND_DUMMY_SHLIB_VERSIONED NAMES libdummylib${CMAKE_SHARED_LIBRARY_SUFFIX}.2 PATHS ${Complex_BINARY_DIR}/Library DOC "find versioned dummy shared lib" NO_DEFAULT_PATH) - IF(NOT FIND_DUMMY_SHLIB_VERSIONED MATCHES "/libdummylib${CMAKE_SHARED_LIBRARY_SUFFIX}.2") - MESSAGE(SEND_ERROR "FIND_DUMMY_SHLIB_VERSIONED is not set correctly: " + if(NOT FIND_DUMMY_SHLIB_VERSIONED MATCHES "/libdummylib${CMAKE_SHARED_LIBRARY_SUFFIX}.2") + message(SEND_ERROR "FIND_DUMMY_SHLIB_VERSIONED is not set correctly: " "${FIND_DUMMY_SHLIB_VERSIONED}") - ENDIF() -ENDIF() + endif() +endif() # Static library, should work everywhere -FIND_LIBRARY(FIND_DUMMY_STLIB_VERSIONED +find_library(FIND_DUMMY_STLIB_VERSIONED NAMES libdummylib${CMAKE_STATIC_LIBRARY_SUFFIX}.2 PATHS ${Complex_BINARY_DIR}/Library DOC "find versioned dummy static lib" NO_DEFAULT_PATH) -IF(NOT FIND_DUMMY_STLIB_VERSIONED MATCHES "/libdummylib${CMAKE_STATIC_LIBRARY_SUFFIX}.2") - MESSAGE(SEND_ERROR "FIND_DUMMY_STLIB_VERSIONED is not set correctly: " +if(NOT FIND_DUMMY_STLIB_VERSIONED MATCHES "/libdummylib${CMAKE_STATIC_LIBRARY_SUFFIX}.2") + message(SEND_ERROR "FIND_DUMMY_STLIB_VERSIONED is not set correctly: " "${FIND_DUMMY_STLIB_VERSIONED}") -ENDIF() +endif() # -# Test SET_SOURCE_FILES_PROPERTIES +# Test SET_SOURCE_FILES_PROPERTIES # -SET_SOURCE_FILES_PROPERTIES(nonexisting_file2 - GENERATED - ABSTRACT - WRAP_EXCLUDE +set_source_files_properties(nonexisting_file2 + GENERATED + ABSTRACT + WRAP_EXCLUDE COMPILE_FLAGS "-foo -bar") -GET_SOURCE_FILE_PROPERTY(FILE_HAS_ABSTRACT nonexisting_file2 ABSTRACT) -GET_SOURCE_FILE_PROPERTY(FILE_HAS_WRAP_EXCLUDE nonexisting_file2 WRAP_EXCLUDE) -GET_SOURCE_FILE_PROPERTY(FILE_COMPILE_FLAGS nonexisting_file2 COMPILE_FLAGS) +get_source_file_property(FILE_HAS_ABSTRACT nonexisting_file2 ABSTRACT) +get_source_file_property(FILE_HAS_WRAP_EXCLUDE nonexisting_file2 WRAP_EXCLUDE) +get_source_file_property(FILE_COMPILE_FLAGS nonexisting_file2 COMPILE_FLAGS) -SET_SOURCE_FILES_PROPERTIES(nonexisting_file3 PROPERTIES +set_source_files_properties(nonexisting_file3 PROPERTIES GENERATED 1 ABSTRACT 1 WRAP_EXCLUDE 1 COMPILE_FLAGS "-foo -bar") -GET_SOURCE_FILE_PROPERTY(FILE_HAS_ABSTRACT nonexisting_file3 ABSTRACT) -GET_SOURCE_FILE_PROPERTY(FILE_HAS_WRAP_EXCLUDE nonexisting_file3 WRAP_EXCLUDE) -GET_SOURCE_FILE_PROPERTY(FILE_COMPILE_FLAGS nonexisting_file3 COMPILE_FLAGS) +get_source_file_property(FILE_HAS_ABSTRACT nonexisting_file3 ABSTRACT) +get_source_file_property(FILE_HAS_WRAP_EXCLUDE nonexisting_file3 WRAP_EXCLUDE) +get_source_file_property(FILE_COMPILE_FLAGS nonexisting_file3 COMPILE_FLAGS) # # Test registry (win32) # Create a file, put its path in a registry key, try to find the file in that # path using that registry key, then remove the file and the key # -IF (WIN32) - IF (NOT UNIX) - SET(dir "${Complex_BINARY_DIR}/registry_dir") - SET(file "registry_test_dummy") - SET(hkey "HKEY_CURRENT_USER\\Software\\Kitware\\CMake\\Tests\\Complex;registry_test") - CONFIGURE_FILE( +if (WIN32) + if (NOT UNIX) + set(dir "${Complex_BINARY_DIR}/registry_dir") + set(file "registry_test_dummy") + set(hkey "HKEY_CURRENT_USER\\Software\\Kitware\\CMake\\Tests\\Complex;registry_test") + configure_file( ${Complex_SOURCE_DIR}/Library/dummy "${dir}/${file}" COPYONLY IMMEDIATE) - EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "-E write_regv \"${hkey}\" \"${dir}\"") - FIND_PATH(REGISTRY_TEST_PATH + exec_program(${CMAKE_COMMAND} ARGS "-E write_regv \"${hkey}\" \"${dir}\"") + find_path(REGISTRY_TEST_PATH ${file} "[${hkey}]" DOC "Registry_Test_Path") - EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "-E delete_regv \"${hkey}\"") - EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "-E remove \"${dir}/${file}\"") - ENDIF (NOT UNIX) -ENDIF (WIN32) + exec_program(${CMAKE_COMMAND} ARGS "-E delete_regv \"${hkey}\"") + exec_program(${CMAKE_COMMAND} ARGS "-E remove \"${dir}/${file}\"") + endif () +endif () # # Test a set and a remove # -SET(REMOVE_STRING a b c d e f) -SET(removeVar1 c e) -REMOVE(REMOVE_STRING ${removeVar1} f) +set(REMOVE_STRING a b c d e f) +set(removeVar1 c e) +remove(REMOVE_STRING ${removeVar1} f) # # Test an IF inside a FOREACH. # -FOREACH(x "a") - IF(${x} MATCHES "a") +foreach(x "a") + if(${x} MATCHES "a") # Should always execute. - SET(IF_INSIDE_FOREACH_THEN_EXECUTED 1) - ELSE(${x} MATCHES "a") + set(IF_INSIDE_FOREACH_THEN_EXECUTED 1) + else() # Should never execute. - SET(IF_INSIDE_FOREACH_ELSE_EXECUTED 1) - ENDIF(${x} MATCHES "a") -ENDFOREACH(x) + set(IF_INSIDE_FOREACH_ELSE_EXECUTED 1) + endif() +endforeach() # test WHILE command -SET (while_var 1) -WHILE (while_var LESS 1000) - SET(while_var ${while_var}0) -ENDWHILE(while_var LESS 1000) +set (while_var 1) +while (while_var LESS 1000) + set(while_var ${while_var}0) +endwhile() -SET(SHOULD_BE_ZERO ) -SET(SHOULD_BE_ONE 1) +set(SHOULD_BE_ZERO ) +set(SHOULD_BE_ONE 1) -# test elseif functionality, the mess below tries to catch problem +# test elseif functionality, the mess below tries to catch problem # of clauses being executed early or late etc set (RESULT 3) if (RESULT EQUAL 1) @@ -328,7 +328,7 @@ if (RESULT EQUAL 1) set (ELSEIF_RESULT 1) elseif (RESULT EQUAL 3) set (ELSEIF_RESULT 1) - endif (RESULT EQUAL 2) + endif () elseif (RESULT EQUAL 2) set (ELSEIF_RESULT 1) elseif (RESULT EQUAL 3) @@ -337,25 +337,25 @@ elseif (RESULT EQUAL 3) elseif (RESULT EQUAL 3) if (NOT ELSEIF_RESULT EQUAL 1) set (ELSEIF_RESULT 2) - endif (NOT ELSEIF_RESULT EQUAL 1) - endif (RESULT EQUAL 2) + endif () + endif () elseif (RESULT EQUAL 4) if (RESULT EQUAL 2) set (ELSEIF_RESULT 1) elseif (RESULT EQUAL 3) set (ELSEIF_RESULT 1) - endif (RESULT EQUAL 2) -else (RESULT EQUAL 1) + endif () +else () if (RESULT EQUAL 2) set (ELSEIF_RESULT 1) elseif (RESULT EQUAL 3) set (ELSEIF_RESULT 1) - endif (RESULT EQUAL 2) -endif (RESULT EQUAL 1) + endif () +endif () if (NOT ELSEIF_RESULT EQUAL 2) set (ELSEIF_RESULT 0) -endif (NOT ELSEIF_RESULT EQUAL 2) +endif () # test handling of parenthetical groups in conditionals if (2 GREATER 1 AND (4 LESS 3 OR 5 LESS 6) AND NOT (7 GREATER 8)) @@ -364,43 +364,43 @@ endif() # -# Configure file +# Configure file # (plug vars to #define so that they can be tested) # -CONFIGURE_FILE( +configure_file( ${Complex_SOURCE_DIR}/cmTestConfigure.h.in ${Complex_BINARY_DIR}/cmTestConfigure.h) -SET(STRING_WITH_QUOTES "\"hello world\"") +set(STRING_WITH_QUOTES "\"hello world\"") # test CONFIGURE_FILE with ESCAPE_QUOTES on -CONFIGURE_FILE( +configure_file( ${Complex_SOURCE_DIR}/cmTestConfigureEscape.h.in ${Complex_BINARY_DIR}/cmTestConfigureEscape.h ESCAPE_QUOTES) # Test regular expression commands. -STRING(REGEX MATCH "b" RESULT "abc") -IF(NOT RESULT) - MESSAGE(SEND_ERROR "STRING(REGEX MATCH ... ) test failed.") -ENDIF(NOT RESULT) -STRING(REGEX MATCHALL "b" RESULT "abcb") -IF(NOT RESULT) - MESSAGE(SEND_ERROR "STRING(REGEX MATCHALL ... ) test failed.") -ENDIF(NOT RESULT) -STRING(REGEX REPLACE ".([bd])." "[\\1]" RESULT "a(b)c(d)e") -IF("x${RESULT}" MATCHES "^xa\\[b\\]c\\[d\\]e$") - SET(STRING_REGEX_PASSED 1) -ENDIF("x${RESULT}" MATCHES "^xa\\[b\\]c\\[d\\]e$") -IF(NOT STRING_REGEX_PASSED) - MESSAGE(SEND_ERROR - "STRING(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")") -ENDIF(NOT STRING_REGEX_PASSED) +string(REGEX MATCH "b" RESULT "abc") +if(NOT RESULT) + message(SEND_ERROR "string(REGEX MATCH ... ) test failed.") +endif() +string(REGEX MATCHALL "b" RESULT "abcb") +if(NOT RESULT) + message(SEND_ERROR "string(REGEX MATCHALL ... ) test failed.") +endif() +string(REGEX REPLACE ".([bd])." "[\\1]" RESULT "a(b)c(d)e") +if("x${RESULT}" MATCHES "^xa\\[b\\]c\\[d\\]e$") + set(STRING_REGEX_PASSED 1) +endif() +if(NOT STRING_REGEX_PASSED) + message(SEND_ERROR + "string(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")") +endif() # # Create the libs and the main exe # -ADD_SUBDIRECTORY(Library) -ADD_SUBDIRECTORY(Executable) -SUBDIR_DEPENDS(Executable Library) -EXPORT_LIBRARY_DEPENDENCIES(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake) -INCLUDE(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake OPTIONAL) +add_subdirectory(Library) +add_subdirectory(Executable) +subdir_depends(Executable Library) +export_library_dependencies(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake) +include(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake OPTIONAL) diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index 345836257..2613f2762 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -1,116 +1,116 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 1.3) +cmake_minimum_required(VERSION 1.3) # -# Create exe. +# Create exe. # -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") # Create an imported target for if(TARGET) test below. -ADD_LIBRARY(ExeImportedTarget UNKNOWN IMPORTED) +add_library(ExeImportedTarget UNKNOWN IMPORTED) # Test if(TARGET) command. -IF(NOT TARGET CMakeTestLibrary) - MESSAGE(FATAL_ERROR "IF(NOT TARGET CMakeTestLibrary) returned true!") -ENDIF(NOT TARGET CMakeTestLibrary) -IF(NOT TARGET ExeImportedTarget) - MESSAGE(FATAL_ERROR "IF(NOT TARGET ExeImportedTarget) returned true!") -ENDIF(NOT TARGET ExeImportedTarget) -IF(TARGET LibImportedTarget) - MESSAGE(FATAL_ERROR "IF(TARGET LibImportedTarget) returned true!") -ENDIF(TARGET LibImportedTarget) -IF(TARGET NotATarget) - MESSAGE(FATAL_ERROR "IF(TARGET NotATarget) returned true!") -ENDIF(TARGET NotATarget) - - # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to -SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared) -LINK_LIBRARIES(${COMPLEX_LIBS}) +if(NOT TARGET CMakeTestLibrary) + message(FATAL_ERROR "if(NOT TARGET CMakeTestLibrary) returned true!") +endif() +if(NOT TARGET ExeImportedTarget) + message(FATAL_ERROR "if(NOT TARGET ExeImportedTarget) returned true!") +endif() +if(TARGET LibImportedTarget) + message(FATAL_ERROR "if(TARGET LibImportedTarget) returned true!") +endif() +if(TARGET NotATarget) + message(FATAL_ERROR "if(TARGET NotATarget) returned true!") +endif() + + # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to +set(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared) +link_libraries(${COMPLEX_LIBS}) # Test forcing a .cxx file to not build. -SET_SOURCE_FILES_PROPERTIES(complex_nobuild.cxx PROPERTIES +set_source_files_properties(complex_nobuild.cxx PROPERTIES HEADER_FILE_ONLY 1) # Test forcing a .c file to not build. # This makes sure a mixed language library is created # with header file only sources -SET_SOURCE_FILES_PROPERTIES(complex_nobuild.c PROPERTIES +set_source_files_properties(complex_nobuild.c PROPERTIES HEADER_FILE_ONLY 1) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) -ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt) -ADD_CUSTOM_COMMAND(OUTPUT Aout.h COMMAND A > Aout.h VERBATIM) -ADD_EXECUTABLE(complex complex testcflags.c Aout.h) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +add_executable(A A.cxx A.hh A.h A.txt) +add_custom_command(OUTPUT Aout.h COMMAND A > Aout.h VERBATIM) +add_executable(complex complex testcflags.c Aout.h) # Sub1/NameConflictTest.c Sub2/NameConflictTest.c) -ADD_EXECUTABLE(complex.file complex.file.cxx complex_nobuild.cxx +add_executable(complex.file complex.file.cxx complex_nobuild.cxx complex_nobuild.c) -IF (UNIX) - TARGET_LINK_LIBRARIES(complex ${CMAKE_DL_LIBS}) -ELSE(UNIX) - IF (NOT BORLAND) - IF(NOT MINGW) - TARGET_LINK_LIBRARIES(complex rpcrt4.lib) - ENDIF(NOT MINGW) - ENDIF(NOT BORLAND) -ENDIF (UNIX) +if (UNIX) + target_link_libraries(complex ${CMAKE_DL_LIBS}) +else() + if (NOT BORLAND) + if(NOT MINGW) + target_link_libraries(complex rpcrt4.lib) + endif() + endif() +endif () # Test linking to static lib when a shared lib has the same name. -IF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) - ADD_DEFINITIONS(-DCOMPLEX_TEST_LINK_STATIC) - TARGET_LINK_LIBRARIES(complex CMakeTestLinkStatic) -ENDIF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) +if(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) + add_definitions(-DCOMPLEX_TEST_LINK_STATIC) + target_link_libraries(complex CMakeTestLinkStatic) +endif() # can we get the path to a source file -GET_SOURCE_FILE_PROPERTY(A_LOCATION A.cxx LOCATION) -IF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx") - ADD_DEFINITIONS(-DCMAKE_FOUND_ACXX) -ENDIF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx") +get_source_file_property(A_LOCATION A.cxx LOCATION) +if ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx") + add_definitions(-DCMAKE_FOUND_ACXX) +endif () # get the directory parent -GET_DIRECTORY_PROPERTY(P_VALUE PARENT_DIRECTORY) -IF ("${P_VALUE}" STREQUAL "${CMAKE_SOURCE_DIR}") - ADD_DEFINITIONS(-DCMAKE_FOUND_PARENT) -ENDIF ("${P_VALUE}" STREQUAL "${CMAKE_SOURCE_DIR}") +get_directory_property(P_VALUE PARENT_DIRECTORY) +if ("${P_VALUE}" STREQUAL "${CMAKE_SOURCE_DIR}") + add_definitions(-DCMAKE_FOUND_PARENT) +endif () # get the stack of listfiles -INCLUDE(Included.cmake) -IF ("${LF_VALUE}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt;${CMAKE_CURRENT_SOURCE_DIR}/Included.cmake") - ADD_DEFINITIONS(-DCMAKE_FOUND_LISTFILE_STACK) -ENDIF ("${LF_VALUE}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt;${CMAKE_CURRENT_SOURCE_DIR}/Included.cmake") +include(Included.cmake) +if ("${LF_VALUE}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt;${CMAKE_CURRENT_SOURCE_DIR}/Included.cmake") + add_definitions(-DCMAKE_FOUND_LISTFILE_STACK) +endif () # Test add/remove definitions. -ADD_DEFINITIONS( +add_definitions( -DCOMPLEX_DEFINED_PRE -DCOMPLEX_DEFINED -DCOMPLEX_DEFINED_POST -DCOMPLEX_DEFINED ) -REMOVE_DEFINITIONS(-DCOMPLEX_DEFINED) +remove_definitions(-DCOMPLEX_DEFINED) # Test pre-build/pre-link/post-build rules for an executable. -ADD_CUSTOM_COMMAND(TARGET complex PRE_BUILD +add_custom_command(TARGET complex PRE_BUILD COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Executable/prebuild.txt") -ADD_CUSTOM_COMMAND(TARGET complex PRE_BUILD +add_custom_command(TARGET complex PRE_LINK COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Executable/prelink.txt") -ADD_CUSTOM_COMMAND(TARGET complex POST_BUILD +add_custom_command(TARGET complex POST_BUILD COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Executable/postbuild.txt") -ADD_CUSTOM_COMMAND(TARGET complex POST_BUILD +add_custom_command(TARGET complex POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy "${Complex_BINARY_DIR}/Executable/postbuild.txt" "${Complex_BINARY_DIR}/Executable/postbuild2.txt") -SET_SOURCE_FILES_PROPERTIES(complex +set_source_files_properties(complex COMPILE_FLAGS "-DFILE_HAS_EXTRA_COMPILE_FLAGS" #" -DFILE_DEFINE_STRING=\\\"hello\\\"" OBJECT_DEPENDS ${Complex_BINARY_DIR}/cmTestGeneratedHeader.h ) -SET_TARGET_PROPERTIES(complex PROPERTIES COMPILE_FLAGS "-DCOMPLEX_TARGET_FLAG") -ADD_CUSTOM_COMMAND( +set_target_properties(complex PROPERTIES COMPILE_FLAGS "-DCOMPLEX_TARGET_FLAG") +add_custom_command( TARGET complex SOURCE ${Complex_SOURCE_DIR}/cmTestGeneratedHeader.h.in COMMAND ${CMAKE_COMMAND} @@ -121,18 +121,18 @@ ADD_CUSTOM_COMMAND( ) # Test creating an executable that is not built by default. -ADD_EXECUTABLE(notInAllExe EXCLUDE_FROM_ALL notInAllExe.cxx) -TARGET_LINK_LIBRARIES(notInAllExe notInAllLib) +add_executable(notInAllExe EXCLUDE_FROM_ALL notInAllExe.cxx) +target_link_libraries(notInAllExe notInAllLib) # Test user-value flag mapping for the VS IDE. -IF(MSVC) - SET_TARGET_PROPERTIES(notInAllExe PROPERTIES +if(MSVC) + set_target_properties(notInAllExe PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBC;LIBCMT;MSVCRT") -ENDIF(MSVC) +endif() # Test creating a custom target that builds not-in-all targets. -ADD_CUSTOM_TARGET(notInAllCustom) -ADD_DEPENDENCIES(notInAllCustom notInAllExe) +add_custom_target(notInAllCustom) +add_dependencies(notInAllCustom notInAllExe) # # Output the files required by 'complex' to a file. @@ -141,30 +141,30 @@ ADD_DEPENDENCIES(notInAllCustom notInAllExe) # has no side-effects on the current Makefile (duplicated source file # due to source list expansion done twice). # -ADD_SUBDIRECTORY(Temp) +add_subdirectory(Temp) -IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX) - ADD_EXECUTABLE(testSystemDir testSystemDir.cxx) - SET_TARGET_PROPERTIES(testSystemDir PROPERTIES COMPILE_FLAGS "-Werror") -ENDIF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX) +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX) + add_executable(testSystemDir testSystemDir.cxx) + set_target_properties(testSystemDir PROPERTIES COMPILE_FLAGS "-Werror") +endif() # # Extra coverage.Not used. # -INSTALL_TARGETS(/tmp complex) -INSTALL_PROGRAMS(/tmp complex) +install_targets(/tmp complex) +install_programs(/tmp complex) -CONFIGURE_FILE( +configure_file( ${Complex_SOURCE_DIR}/Executable/cmVersion.h.in ${Complex_BINARY_DIR}/cmVersion.h) -SOURCE_GROUP(A_GROUP ".cxx") -SOURCE_GROUP(B_GROUP REGULAR_EXPRESSION "cxx") -SOURCE_GROUP(C_GROUP FILES complex.cxx) +source_group(A_GROUP ".cxx") +source_group(B_GROUP REGULAR_EXPRESSION "cxx") +source_group(C_GROUP FILES complex.cxx) -FILE(WRITE ${Complex_BINARY_DIR}/A/libA.a "test") -FILE(WRITE ${Complex_BINARY_DIR}/A/libC.a "test") -FILE(WRITE ${Complex_BINARY_DIR}/B/libB.a "test") -FILE(WRITE ${Complex_BINARY_DIR}/B/libA.a "test") -FILE(WRITE ${Complex_BINARY_DIR}/C/libC.a "test") -FILE(WRITE ${Complex_BINARY_DIR}/C/libB.a "test") +file(WRITE ${Complex_BINARY_DIR}/A/libA.a "test") +file(WRITE ${Complex_BINARY_DIR}/A/libC.a "test") +file(WRITE ${Complex_BINARY_DIR}/B/libB.a "test") +file(WRITE ${Complex_BINARY_DIR}/B/libA.a "test") +file(WRITE ${Complex_BINARY_DIR}/C/libC.a "test") +file(WRITE ${Complex_BINARY_DIR}/C/libB.a "test") diff --git a/Tests/Complex/Executable/Included.cmake b/Tests/Complex/Executable/Included.cmake index 2d1ea3e8c..520a68be1 100644 --- a/Tests/Complex/Executable/Included.cmake +++ b/Tests/Complex/Executable/Included.cmake @@ -1,2 +1,2 @@ -GET_DIRECTORY_PROPERTY(LF_VALUE LISTFILE_STACK) +get_directory_property(LF_VALUE LISTFILE_STACK) diff --git a/Tests/Complex/Executable/Temp/CMakeLists.txt b/Tests/Complex/Executable/Temp/CMakeLists.txt index f00955029..041fcff20 100644 --- a/Tests/Complex/Executable/Temp/CMakeLists.txt +++ b/Tests/Complex/Executable/Temp/CMakeLists.txt @@ -3,6 +3,6 @@ # The 'complex' executable will then test if this file exists and remove it. # The contents of this file is not tested (absolute paths). # -OUTPUT_REQUIRED_FILES( - ${Complex_SOURCE_DIR}/Executable/complex.cxx - ${Complex_BINARY_DIR}/Executable/Temp/complex-required.txt) +output_required_files( + ${Complex_SOURCE_DIR}/Executable/complex.cxx + ${Complex_BINARY_DIR}/Executable/Temp/complex-required.txt) diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index 1901d9914..27d70adc8 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -33,7 +33,7 @@ int cm_failed = 0; void cmFailed(const char* Message, const char* m2= "", const char* m3 = "") { - std::cout << "FAILED: " << Message << m2 << m3 << "\n"; + std::cout << "FAILED: " << Message << m2 << m3 << "\n"; cm_failed++; } @@ -41,7 +41,7 @@ void cmFailed(const char* Message, const char* m2= "", const char* m3 = "") void cmPassed(const char* Message, const char* m2="") { - std::cout << "Passed: " << Message << m2 << "\n"; + std::cout << "Passed: " << Message << m2 << "\n"; cm_passed++; } @@ -67,7 +67,7 @@ void cmPassed(const char* Message, const char* m2="") // ====================================================================== -void TestAndRemoveFile(const char* filename) +void TestAndRemoveFile(const char* filename) { struct stat st; if(stat(filename, &st) < 0) @@ -89,7 +89,7 @@ void TestAndRemoveFile(const char* filename) // ====================================================================== -void TestDir(const char* filename) +void TestDir(const char* filename) { struct stat st; if(stat(filename, &st) < 0 || !S_ISDIR(st.st_mode)) @@ -113,7 +113,7 @@ void ForceStringUse() std::string cachetest = CACHE_TEST_VAR_INTERNAL; v.push_back(cachetest); v2 = v; - std::string x(5,'x'); + std::string x(5,'x'); char buff[5]; x.copy(buff, 1, 0); x[0] = 'a'; @@ -165,7 +165,7 @@ int main() #else cmPassed("COMPILE_FLAGS did work with SET_TARGET_PROPERTIES"); #endif - + #ifdef ELSEIF_RESULT cmPassed("ELSEIF did work"); #else @@ -228,8 +228,8 @@ int main() #else cmPassed("CMAKE_IS_FUN is defined."); #endif - -#if defined(CMAKE_ARGV1) && defined(CMAKE_ARGV2) && defined(CMAKE_ARGV3) && defined(CMAKE_ARGV4) + +#if defined(CMAKE_ARGV1) && defined(CMAKE_ARGV2) && defined(CMAKE_ARGV3) && defined(CMAKE_ARGV4) cmPassed("Variable args for MACROs are working."); #else cmFailed("Variable args for MACROs are failing."); @@ -250,7 +250,7 @@ int main() #else cmPassed("CMake found the parent directory properly"); #endif - + // ---------------------------------------------------------------------- // Test GET_DIRECTORY_PROPERTY for listfiles #ifndef CMAKE_FOUND_LISTFILE_STACK @@ -258,7 +258,7 @@ int main() #else cmPassed("CMake found the listfile stack properly"); #endif - + // ---------------------------------------------------------------------- // Test SET, VARIABLE_REQUIRES @@ -267,38 +267,38 @@ int main() #else cmPassed("SHOULD_NOT_BE_DEFINED is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED cmFailed("IF or SET is broken, SHOULD_BE_DEFINED is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED is defined."); #endif - + #ifndef ONE_VAR cmFailed("cmakedefine is broken, ONE_VAR is not defined."); #else cmPassed("ONE_VAR is defined."); #endif - + #ifndef ONE_VAR_IS_DEFINED cmFailed("cmakedefine, SET or VARIABLE_REQUIRES is broken, " "ONE_VAR_IS_DEFINED is not defined."); #else cmPassed("ONE_VAR_IS_DEFINED is defined."); #endif - + #ifdef ZERO_VAR cmFailed("cmakedefine is broken, ZERO_VAR is defined."); #else cmPassed("ZERO_VAR is not defined."); #endif - + #ifndef STRING_VAR cmFailed("the CONFIGURE_FILE command is broken, STRING_VAR is not defined."); #else if(strcmp(STRING_VAR, "CMake is great") != 0) { - cmFailed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ", + cmFailed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ", STRING_VAR); } else @@ -315,145 +315,145 @@ int main() #else cmPassed("SHOULD_NOT_BE_DEFINED_NOT is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_NOT cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_NOT is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_NOT2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_NOT2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_NOT2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_NOT2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_AND cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_AND is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_AND cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_AND is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_AND2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_AND2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_AND2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_AND2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_OR cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_OR is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_OR cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_OR is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_OR2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_OR2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_OR2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_OR2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_MATCHES cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_MATCHES is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_MATCHES cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_MATCHES is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_MATCHES2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_MATCHES2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_MATCHES2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_MATCHES2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_COMMAND cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_COMMAND cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_COMMAND is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_COMMAND2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_COMMAND2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_COMMAND2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_EXISTS cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EXISTS is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_EXISTS is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_EXISTS cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_EXISTS is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_EXISTS is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_EXISTS2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EXISTS2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_EXISTS2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_EXISTS2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_EXISTS2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_EXISTS2 is defined."); #endif - + #ifndef SHOULD_BE_DEFINED_IS_DIRECTORY cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY is not defined.\n"); #else @@ -471,31 +471,31 @@ int main() #else cmPassed("SHOULD_NOT_BE_DEFINED_LESS is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_LESS cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_LESS is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_LESS2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_LESS2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_LESS2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_LESS2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_GREATER cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_GREATER is not defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_EQUAL cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EQUAL is defined."); #else @@ -513,67 +513,67 @@ int main() #else cmPassed("SHOULD_BE_DEFINED_GREATER is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_GREATER2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_GREATER2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_GREATER2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_GREATER2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_STRLESS cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_STRLESS cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_STRLESS is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_STRLESS2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_STRLESS2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_STRLESS2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_STRGREATER cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_STRGREATER is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_STRGREATER2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_STRGREATER2 is defined."); #endif - + // ---------------------------------------------------------------------- // Test FOREACH @@ -624,7 +624,7 @@ int main() // ---------------------------------------------------------------------- // Test WHILE - + if(WHILE_VALUE != 1000) { cmFailed("WHILE command is not working"); @@ -814,7 +814,7 @@ int main() // only created during a build. TestAndRemoveFile(BINARY_DIR "/Library/custom_target1.txt"); - + // ---------------------------------------------------------------------- // A directory has been created. @@ -890,7 +890,7 @@ int main() #else if(strcmp(FILE_COMPILE_FLAGS, "-foo -bar") != 0) { - cmFailed("the SET_SOURCE_FILES_PROPERTIES or CONFIGURE_FILE command is broken. FILE_COMPILE_FLAGS == ", + cmFailed("the SET_SOURCE_FILES_PROPERTIES or CONFIGURE_FILE command is broken. FILE_COMPILE_FLAGS == ", FILE_COMPILE_FLAGS); } else @@ -908,7 +908,7 @@ int main() std::cout << "REGISTRY_TEST_PATH == " << REGISTRY_TEST_PATH << "\n"; if(stricmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0) { - cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ", + cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ", REGISTRY_TEST_PATH, " is not " BINARY_DIR "/registry_dir"); } else @@ -937,7 +937,7 @@ int main() { cmFailed("REMOVE is not working"); } - + // ---------------------------------------------------------------------- // Test SEPARATE_ARGUMENTS if(strcmp("a;b;c", TEST_SEP) == 0) @@ -948,7 +948,7 @@ int main() { cmFailed("SEPARATE_ARGUMENTS is not working"); } - + // ---------------------------------------------------------------------- // Test Escape Quotes if(strcmp("\"hello world\"", STRING_WITH_QUOTES) == 0) @@ -959,8 +959,8 @@ int main() { cmFailed("ESCAPE_QUOTES is not working"); } - - + + // ---------------------------------------------------------------------- // Test if IF command inside a FOREACH works. #if defined(IF_INSIDE_FOREACH_THEN_EXECUTED) && !defined(IF_INSIDE_FOREACH_ELSE_EXECUTED) @@ -981,7 +981,7 @@ int main() else { cmFailed("cmakedefine01 is not working for 0"); - } + } if(SHOULD_BE_ONE == 1) { cmPassed("cmakedefine01 is working for 1"); @@ -989,7 +989,7 @@ int main() else { cmFailed("cmakedefine01 is not working for 1"); - } + } #ifdef FORCE_TEST cmFailed("CMake SET CACHE FORCE"); #else diff --git a/Tests/Complex/Executable/testcflags.c b/Tests/Complex/Executable/testcflags.c index f4d584844..6c2dd5db3 100644 --- a/Tests/Complex/Executable/testcflags.c +++ b/Tests/Complex/Executable/testcflags.c @@ -18,7 +18,7 @@ int TestCFlags(char* m) return 0; #endif /* TEST_C_FLAGS should be defined in a c file */ -#ifndef TEST_C_FLAGS +#ifndef TEST_C_FLAGS strcpy(m, "CMake CMAKE_C_FLAGS (TEST_C_FLAGS) not found in c file."); return 0; #endif diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt index c8efc3022..5c430523e 100644 --- a/Tests/Complex/Library/CMakeLists.txt +++ b/Tests/Complex/Library/CMakeLists.txt @@ -1,90 +1,90 @@ -REMOVE_DEFINITIONS(-DCMAKE_IS_REALLY_FUN) +remove_definitions(-DCMAKE_IS_REALLY_FUN) # # Small utility used to create file # UTILITY_SOURCE is used for coverage and for getting the exact name # of the executable. # -UTILITY_SOURCE(CREATE_FILE_EXE create_file "." create_file.cxx) -ADD_EXECUTABLE(create_file create_file.cxx) -SET_TARGET_PROPERTIES(create_file PROPERTIES RUNTIME_OUTPUT_DIRECTORY ".") +utility_source(CREATE_FILE_EXE create_file "." create_file.cxx) +add_executable(create_file create_file.cxx) +set_target_properties(create_file PROPERTIES RUNTIME_OUTPUT_DIRECTORY ".") # # Create static library # SOURCE_FILES_REMOVE is used for Coverage. empty.h is included for coverage # -AUX_SOURCE_DIRECTORY(ExtraSources LibrarySources) -SET(LibrarySources ${LibrarySources} - file2 - empty - create_file.cxx - GENERATED +aux_source_directory(ExtraSources LibrarySources) +set(LibrarySources ${LibrarySources} + file2 + empty + create_file.cxx + GENERATED nonexisting_file) -REMOVE(LibrarySources create_file.cxx GENERATED nonexisting_file) -ADD_LIBRARY(CMakeTestLibrary ${LibrarySources}) +remove(LibrarySources create_file.cxx GENERATED nonexisting_file) +add_library(CMakeTestLibrary ${LibrarySources}) -IF(WIN32) - IF(NOT CYGWIN) - IF(NOT BORLAND) - IF(NOT MINGW) - TARGET_LINK_LIBRARIES(CMakeTestLibrary - debug +if(WIN32) + if(NOT CYGWIN) + if(NOT BORLAND) + if(NOT MINGW) + target_link_libraries(CMakeTestLibrary + debug user32.lib) - TARGET_LINK_LIBRARIES(CMakeTestLibrary - optimized + target_link_libraries(CMakeTestLibrary + optimized kernel32.lib) - ENDIF(NOT MINGW) - ENDIF(NOT BORLAND) - ENDIF(NOT CYGWIN) -ENDIF(WIN32) + endif() + endif() + endif() +endif() # # Create shared library # -SET(SharedLibrarySources sharedFile) -ADD_LIBRARY(CMakeTestLibraryShared SHARED ${SharedLibrarySources}) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") -ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c) -DEFINE_PROPERTY( +set(SharedLibrarySources sharedFile) +add_library(CMakeTestLibraryShared SHARED ${SharedLibrarySources}) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") +add_library(CMakeTestCLibraryShared SHARED testConly.c) +define_property( TARGET PROPERTY FOO BRIEF_DOCS "a test property" FULL_DOCS "A simple etst proerty that means nothign and is used for nothing" ) -SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES FOO BAR) -IF(NOT BEOS AND NOT WIN32) # No libm on BeOS. - SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm") -ENDIF(NOT BEOS AND NOT WIN32) -GET_TARGET_PROPERTY(FOO_BAR_VAR CMakeTestCLibraryShared FOO) -IF(${FOO_BAR_VAR} MATCHES "BAR") -ELSE(${FOO_BAR_VAR} MATCHES "BAR") - MESSAGE(SEND_ERROR "SET_TARGET_PROPERTIES or GET_TARGET_PROPERTY failed, FOO_BAR_VAR should be BAR, but is ${FOO_BAR_VAR}") -ENDIF(${FOO_BAR_VAR} MATCHES "BAR") +set_target_properties(CMakeTestCLibraryShared PROPERTIES FOO BAR) +if(NOT BEOS AND NOT WIN32) # No libm on BeOS. + set_target_properties(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm") +endif() +get_target_property(FOO_BAR_VAR CMakeTestCLibraryShared FOO) +if(${FOO_BAR_VAR} MATCHES "BAR") +else() + message(SEND_ERROR "SET_TARGET_PROPERTIES or GET_TARGET_PROPERTY failed, FOO_BAR_VAR should be BAR, but is ${FOO_BAR_VAR}") +endif() # Create static and shared lib of same name. -IF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) - ADD_LIBRARY(CMakeTestLinkStatic STATIC TestLink.c) - ADD_LIBRARY(CMakeTestLinkShared SHARED TestLink.c) - SET_TARGET_PROPERTIES(CMakeTestLinkStatic CMakeTestLinkShared +if(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) + add_library(CMakeTestLinkStatic STATIC TestLink.c) + add_library(CMakeTestLinkShared SHARED TestLink.c) + set_target_properties(CMakeTestLinkStatic CMakeTestLinkShared PROPERTIES OUTPUT_NAME CMakeTestLink) -ENDIF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) +endif() # # Attach pre-build/pre-link/post-build custom-commands to the lib. # Each runs ${CREATE_FILE_EXE} which will create a file. # The 'complex' executable will then test if this file exists and remove it. # -ADD_DEPENDENCIES(CMakeTestLibraryShared create_file) -MESSAGE("complex bin dir is ${Complex_BINARY_DIR}") -ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared PRE_BUILD +add_dependencies(CMakeTestLibraryShared create_file) +message("complex bin dir is ${Complex_BINARY_DIR}") +add_custom_command(TARGET CMakeTestLibraryShared PRE_BUILD COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Library/prebuild.txt") -ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared PRE_BUILD +add_custom_command(TARGET CMakeTestLibraryShared PRE_BUILD COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Library/prelink.txt") -ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared POST_BUILD +add_custom_command(TARGET CMakeTestLibraryShared POST_BUILD COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Library/postbuild.txt") -ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared POST_BUILD +add_custom_command(TARGET CMakeTestLibraryShared POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy "${Complex_BINARY_DIR}/Library/postbuild.txt" @@ -95,46 +95,46 @@ ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared POST_BUILD # It runs ${CREATE_FILE_EXE} which will create a file. # The 'complex' executable will then test if this file exists and remove it. # -ADD_CUSTOM_TARGET(custom_target1 +add_custom_target(custom_target1 ALL - ${CREATE_FILE_EXE} + ${CREATE_FILE_EXE} "${Complex_BINARY_DIR}/Library/custom_target1.txt") -ADD_DEPENDENCIES(custom_target1 create_file) +add_dependencies(custom_target1 create_file) # # Extra coverage # -SET_SOURCE_FILES_PROPERTIES(file2 PROPERTIES ABSTRACT 1) +set_source_files_properties(file2 PROPERTIES ABSTRACT 1) -INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h) -INSTALL_FILES(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h) +install_files(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h) +install_files(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h) # Test creating a library that is not built by default. -ADD_LIBRARY(notInAllLib EXCLUDE_FROM_ALL notInAllLib.cxx) +add_library(notInAllLib EXCLUDE_FROM_ALL notInAllLib.cxx) # Create an imported target for if(TARGET) test in Executable dir. # That test should not see this target. -ADD_LIBRARY(LibImportedTarget UNKNOWN IMPORTED) +add_library(LibImportedTarget UNKNOWN IMPORTED) # Test generation of preprocessed sources. -IF("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM) - IF(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE) +if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM) + if(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE) # Skip running this part of the test on certain platforms # until they are fixed. - SET(MAYBE_ALL ALL) - LIST(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_COUNT) - IF(ARCH_COUNT GREATER 1) + set(MAYBE_ALL ALL) + list(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_COUNT) + if(ARCH_COUNT GREATER 1) # OSX does not support preprocessing more than one architecture. - SET(MAYBE_ALL) - ENDIF(ARCH_COUNT GREATER 1) + set(MAYBE_ALL) + endif() # Custom target to try preprocessing invocation. - ADD_CUSTOM_TARGET(test_preprocess ${MAYBE_ALL} + add_custom_target(test_preprocess ${MAYBE_ALL} COMMAND ${CMAKE_COMMAND} -E remove CMakeFiles/create_file.dir/create_file.i COMMAND ${CMAKE_MAKE_PROGRAM} create_file.i COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_preprocess.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) - ENDIF(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE) -ENDIF("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM) + endif() +endif() diff --git a/Tests/Complex/Library/create_file.cxx b/Tests/Complex/Library/create_file.cxx index d41551980..050ed0bac 100644 --- a/Tests/Complex/Library/create_file.cxx +++ b/Tests/Complex/Library/create_file.cxx @@ -8,7 +8,7 @@ int main (int argc, char *argv[]) fprintf(stderr, "Missing name of file to create.\n"); return EXIT_FAILURE; } - + FILE *stream = fopen(argv[1], "w"); if(stream == NULL) { @@ -23,6 +23,6 @@ int main (int argc, char *argv[]) } fprintf(stdout, ">> Creating %s!\n", argv[1]); - + return EXIT_SUCCESS; } diff --git a/Tests/Complex/Library/testConly.c b/Tests/Complex/Library/testConly.c index 2d83f778e..a7d20b0b5 100644 --- a/Tests/Complex/Library/testConly.c +++ b/Tests/Complex/Library/testConly.c @@ -7,7 +7,7 @@ int CsharedFunction() printf("TEST_C_FLAGS failed\n"); return 0; #else - printf("Passed: TEST_C_FLAGS passed\n"); -#endif + printf("Passed: TEST_C_FLAGS passed\n"); +#endif return 1; } diff --git a/Tests/Complex/Library/testConly.h b/Tests/Complex/Library/testConly.h index f1470a8d7..ba8458923 100644 --- a/Tests/Complex/Library/testConly.h +++ b/Tests/Complex/Library/testConly.h @@ -10,4 +10,4 @@ #endif CMakeTest_EXPORT int CsharedFunction(); - + diff --git a/Tests/Complex/Library/test_preprocess.cmake b/Tests/Complex/Library/test_preprocess.cmake index d2d9fc652..4c8ec2174 100644 --- a/Tests/Complex/Library/test_preprocess.cmake +++ b/Tests/Complex/Library/test_preprocess.cmake @@ -1,7 +1,7 @@ -SET(TEST_FILE CMakeFiles/create_file.dir/create_file.i) -FILE(READ ${TEST_FILE} CONTENTS) -IF("${CONTENTS}" MATCHES "Unable to close") - MESSAGE(STATUS "${TEST_FILE} created successfully!") -ELSE("${CONTENTS}" MATCHES "Unable to close") - MESSAGE(FATAL_ERROR "${TEST_FILE} creation failed!") -ENDIF("${CONTENTS}" MATCHES "Unable to close") +set(TEST_FILE CMakeFiles/create_file.dir/create_file.i) +file(READ ${TEST_FILE} CONTENTS) +if("${CONTENTS}" MATCHES "Unable to close") + message(STATUS "${TEST_FILE} created successfully!") +else() + message(FATAL_ERROR "${TEST_FILE} creation failed!") +endif() diff --git a/Tests/Complex/VarTests.cmake b/Tests/Complex/VarTests.cmake index c146d1be0..52ec1fc8e 100644 --- a/Tests/Complex/VarTests.cmake +++ b/Tests/Complex/VarTests.cmake @@ -1,198 +1,198 @@ # # Test SET # -SET (ZERO_VAR 0) -SET (ZERO_VAR2 0) +set (ZERO_VAR 0) +set (ZERO_VAR2 0) -IF(ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED) -ELSE(ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED) -ENDIF(ZERO_VAR) +if(ZERO_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED) +else() + add_definitions(-DSHOULD_BE_DEFINED) +endif() -SET(ONE_VAR 1) -SET(ONE_VAR2 1) -SET(STRING_VAR "CMake is great" CACHE STRING "test a cache variable") +set(ONE_VAR 1) +set(ONE_VAR2 1) +set(STRING_VAR "CMake is great" CACHE STRING "test a cache variable") # # Test VARIABLE_REQUIRES # -VARIABLE_REQUIRES(ONE_VAR +variable_requires(ONE_VAR ONE_VAR_IS_DEFINED ONE_VAR) # # Test various IF/ELSE combinations # -IF(NOT ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT) -ELSE(NOT ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT) -ENDIF(NOT ZERO_VAR) - -IF(NOT ONE_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT2) -ELSE(NOT ONE_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT2) -ENDIF(NOT ONE_VAR) - -IF(ONE_VAR AND ONE_VAR2) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND) -ELSE(ONE_VAR AND ONE_VAR2) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND) -ENDIF(ONE_VAR AND ONE_VAR2) - -IF(ONE_VAR AND ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND2) -ELSE(ONE_VAR AND ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND2) -ENDIF(ONE_VAR AND ZERO_VAR) - -IF(ZERO_VAR OR ONE_VAR2) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR) -ELSE(ZERO_VAR OR ONE_VAR2) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR) -ENDIF(ZERO_VAR OR ONE_VAR2) - -IF(ZERO_VAR OR ZERO_VAR2) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR2) -ELSE(ZERO_VAR OR ZERO_VAR2) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR2) -ENDIF(ZERO_VAR OR ZERO_VAR2) - -IF(STRING_VAR MATCHES "^CMake") - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES) -ELSE(STRING_VAR MATCHES "^CMake") - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES) -ENDIF(STRING_VAR MATCHES "^CMake") - -IF(STRING_VAR MATCHES "^foo") - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES2) -ELSE(STRING_VAR MATCHES "^foo") - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES2) -ENDIF(STRING_VAR MATCHES "^foo") - -IF(COMMAND "IF") - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND) -ELSE(COMMAND "IF") - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND) -ENDIF(COMMAND "IF") - -IF(COMMAND "ROQUEFORT") - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND2) -ELSE(COMMAND "ROQUEFORT") - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND2) -ENDIF(COMMAND "ROQUEFORT") - -IF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EXISTS) -ELSE(EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_EXISTS) -ENDIF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) - -IF (EXISTS ${Complex_SOURCE_DIR}/roquefort.txt) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_EXISTS2) -ELSE(EXISTS ${Complex_SOURCE_DIR}/roquefort.txt) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EXISTS2) -ENDIF (EXISTS ${Complex_SOURCE_DIR}/roquefort.txt) - -IF (IS_DIRECTORY ${Complex_SOURCE_DIR}) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_IS_DIRECTORY) -ENDIF (IS_DIRECTORY ${Complex_SOURCE_DIR}) - -IF (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_IS_DIRECTORY2) -ENDIF (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake) - -SET (SNUM1_VAR "1") -SET (SNUM2_VAR "2") -SET (SNUM3_VAR "1") - - -IF (SNUM1_VAR LESS SNUM2_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_LESS) -ELSE (SNUM1_VAR LESS SNUM2_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_LESS) -ENDIF (SNUM1_VAR LESS SNUM2_VAR) - -IF (SNUM2_VAR LESS SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_LESS2) -ELSE (SNUM2_VAR LESS SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_LESS2) -ENDIF (SNUM2_VAR LESS SNUM1_VAR) - -IF (SNUM2_VAR GREATER SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_GREATER) -ELSE (SNUM2_VAR GREATER SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_GREATER) -ENDIF (SNUM2_VAR GREATER SNUM1_VAR) - -IF (SNUM2_VAR EQUAL SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_EQUAL) -ELSE (SNUM2_VAR EQUAL SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EQUAL) -ENDIF (SNUM2_VAR EQUAL SNUM1_VAR) - -IF (SNUM3_VAR EQUAL SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EQUAL) -ELSE (SNUM3_VAR EQUAL SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_EQUAL) -ENDIF (SNUM3_VAR EQUAL SNUM1_VAR) - -IF (SNUM1_VAR GREATER SNUM2_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_GREATER2) -ELSE (SNUM1_VAR GREATER SNUM2_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_GREATER2) -ENDIF (SNUM1_VAR GREATER SNUM2_VAR) - -SET (SSTR1_VAR "abc") -SET (SSTR2_VAR "bcd") - -IF (SSTR1_VAR STRLESS SSTR2_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_STRLESS) -ELSE (SSTR1_VAR STRLESS SSTR2_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_STRLESS) -ENDIF (SSTR1_VAR STRLESS SSTR2_VAR) - -IF (SSTR2_VAR STRLESS SSTR1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_STRLESS2) -ELSE (SSTR2_VAR STRLESS SSTR1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_STRLESS2) -ENDIF (SSTR2_VAR STRLESS SSTR1_VAR) - -IF (SSTR2_VAR STRGREATER SSTR1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_STRGREATER) -ELSE (SSTR2_VAR STRGREATER SSTR1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_STRGREATER) -ENDIF (SSTR2_VAR STRGREATER SSTR1_VAR) - -IF (SSTR1_VAR STRGREATER SSTR2_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_STRGREATER2) -ELSE (SSTR1_VAR STRGREATER SSTR2_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_STRGREATER2) -ENDIF (SSTR1_VAR STRGREATER SSTR2_VAR) +if(NOT ZERO_VAR) + add_definitions(-DSHOULD_BE_DEFINED_NOT) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_NOT) +endif() + +if(NOT ONE_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_NOT2) +else() + add_definitions(-DSHOULD_BE_DEFINED_NOT2) +endif() + +if(ONE_VAR AND ONE_VAR2) + add_definitions(-DSHOULD_BE_DEFINED_AND) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_AND) +endif() + +if(ONE_VAR AND ZERO_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_AND2) +else() + add_definitions(-DSHOULD_BE_DEFINED_AND2) +endif() + +if(ZERO_VAR OR ONE_VAR2) + add_definitions(-DSHOULD_BE_DEFINED_OR) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_OR) +endif() + +if(ZERO_VAR OR ZERO_VAR2) + add_definitions(-DSHOULD_NOT_BE_DEFINED_OR2) +else() + add_definitions(-DSHOULD_BE_DEFINED_OR2) +endif() + +if(STRING_VAR MATCHES "^CMake") + add_definitions(-DSHOULD_BE_DEFINED_MATCHES) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_MATCHES) +endif() + +if(STRING_VAR MATCHES "^foo") + add_definitions(-DSHOULD_NOT_BE_DEFINED_MATCHES2) +else() + add_definitions(-DSHOULD_BE_DEFINED_MATCHES2) +endif() + +if(COMMAND "IF") + add_definitions(-DSHOULD_BE_DEFINED_COMMAND) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_COMMAND) +endif() + +if(COMMAND "ROQUEFORT") + add_definitions(-DSHOULD_NOT_BE_DEFINED_COMMAND2) +else() + add_definitions(-DSHOULD_BE_DEFINED_COMMAND2) +endif() + +if (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) + add_definitions(-DSHOULD_BE_DEFINED_EXISTS) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_EXISTS) +endif () + +if (EXISTS ${Complex_SOURCE_DIR}/roquefort.txt) + add_definitions(-DSHOULD_NOT_BE_DEFINED_EXISTS2) +else() + add_definitions(-DSHOULD_BE_DEFINED_EXISTS2) +endif () + +if (IS_DIRECTORY ${Complex_SOURCE_DIR}) + add_definitions(-DSHOULD_BE_DEFINED_IS_DIRECTORY) +endif () + +if (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake) + add_definitions(-DSHOULD_BE_DEFINED_IS_DIRECTORY2) +endif () + +set (SNUM1_VAR "1") +set (SNUM2_VAR "2") +set (SNUM3_VAR "1") + + +if (SNUM1_VAR LESS SNUM2_VAR) + add_definitions(-DSHOULD_BE_DEFINED_LESS) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_LESS) +endif () + +if (SNUM2_VAR LESS SNUM1_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_LESS2) +else () + add_definitions(-DSHOULD_BE_DEFINED_LESS2) +endif () + +if (SNUM2_VAR GREATER SNUM1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_GREATER) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER) +endif () + +if (SNUM2_VAR EQUAL SNUM1_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_EQUAL) +else () + add_definitions(-DSHOULD_BE_DEFINED_EQUAL) +endif () + +if (SNUM3_VAR EQUAL SNUM1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_EQUAL) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_EQUAL) +endif () + +if (SNUM1_VAR GREATER SNUM2_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER2) +else () + add_definitions(-DSHOULD_BE_DEFINED_GREATER2) +endif () + +set (SSTR1_VAR "abc") +set (SSTR2_VAR "bcd") + +if (SSTR1_VAR STRLESS SSTR2_VAR) + add_definitions(-DSHOULD_BE_DEFINED_STRLESS) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS) +endif () + +if (SSTR2_VAR STRLESS SSTR1_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS2) +else () + add_definitions(-DSHOULD_BE_DEFINED_STRLESS2) +endif () + +if (SSTR2_VAR STRGREATER SSTR1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_STRGREATER) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER) +endif () + +if (SSTR1_VAR STRGREATER SSTR2_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER2) +else () + add_definitions(-DSHOULD_BE_DEFINED_STRGREATER2) +endif () # # Test FOREACH # -FOREACH (INDEX 1 2) - SET(FOREACH_VAR${INDEX} "VALUE${INDEX}") -ENDFOREACH(INDEX) +foreach (INDEX 1 2) + set(FOREACH_VAR${INDEX} "VALUE${INDEX}") +endforeach() -SET(FOREACH_CONCAT "") -FOREACH (INDEX a;b;c;d;e;f;g) - SET(FOREACH_CONCAT "${FOREACH_CONCAT}${INDEX}") -ENDFOREACH(INDEX) +set(FOREACH_CONCAT "") +foreach (INDEX a;b;c;d;e;f;g) + set(FOREACH_CONCAT "${FOREACH_CONCAT}${INDEX}") +endforeach() # # Test FIND_FILE, FIND_PATH and various GET_FILENAME_COMPONENT combinations # -FIND_FILE(FILENAME_VAR "VarTests.cmake" ${Complex_SOURCE_DIR}) +find_file(FILENAME_VAR "VarTests.cmake" ${Complex_SOURCE_DIR}) -GET_FILENAME_COMPONENT(FILENAME_VAR_PATH ${FILENAME_VAR} PATH) -GET_FILENAME_COMPONENT(FILENAME_VAR_PATH_NAME ${FILENAME_VAR_PATH} NAME) -GET_FILENAME_COMPONENT(FILENAME_VAR_NAME ${FILENAME_VAR} NAME) -GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT) -GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE CACHE) +get_filename_component(FILENAME_VAR_PATH ${FILENAME_VAR} PATH) +get_filename_component(FILENAME_VAR_PATH_NAME ${FILENAME_VAR_PATH} NAME) +get_filename_component(FILENAME_VAR_NAME ${FILENAME_VAR} NAME) +get_filename_component(FILENAME_VAR_EXT ${FILENAME_VAR} EXT) +get_filename_component(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE CACHE) -FIND_PATH(PATH_VAR "cmTestConfigure.h.in" ${Complex_SOURCE_DIR}) -GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME) +find_path(PATH_VAR "cmTestConfigure.h.in" ${Complex_SOURCE_DIR}) +get_filename_component(PATH_VAR_NAME ${PATH_VAR} NAME) diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index b50501905..b0748fe3d 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -1,296 +1,296 @@ # # A more complex test case # -SET(CMAKE_BACKWARDS_COMPATIBILITY 1.4) -PROJECT (Complex) +set(CMAKE_BACKWARDS_COMPATIBILITY 1.4) +project (Complex) # Try setting a new policy. The IF test is for coverage. -IF(POLICY CMP0003) - CMAKE_POLICY(SET CMP0003 NEW) +if(POLICY CMP0003) + cmake_policy(SET CMP0003 NEW) - CMAKE_POLICY(GET CMP0003 P3) - IF(NOT "${P3}" STREQUAL "NEW") - MESSAGE(FATAL_ERROR "CMAKE_POLICY(GET) did not report NEW!") - ENDIF(NOT "${P3}" STREQUAL "NEW") -ENDIF(POLICY CMP0003) + cmake_policy(GET CMP0003 P3) + if(NOT "${P3}" STREQUAL "NEW") + message(FATAL_ERROR "cmake_policy(GET) did not report NEW!") + endif() +endif() # Test building without per-rule echo lines in Makefiles. -SET_PROPERTY(GLOBAL PROPERTY RULE_MESSAGES OFF) +set_property(GLOBAL PROPERTY RULE_MESSAGES OFF) -SET(CPACK_SOURCE_IGNORE_FILES "~$;\\.cvsignore$;^C:/hoffman/My Builds/testcase.*/CVS/;^C:/hoffman/My Builds/testcase.*/\\.svn/;^C:/hoffman/My Builds/testcase.*/sweigart/;^C:/hoffman/My Builds/testcase/www/eospaper/solution/eos2001/;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_tables_new/;^C:/hoffman/My Builds/testcase/COPYING$;^C:/hoffman/My Builds/testcase/INSTALL$;^C:/hoffman/My Builds/testcase/Makefile$;^C:/hoffman/My Builds/testcase/Makefile\\.in$;^C:/hoffman/My Builds/testcase/.*\\.lo$;^C:/hoffman/My Builds/testcase/.*\\.la$;^C:/hoffman/My Builds/testcase/mkinstalldirs$;^C:/hoffman/My Builds/testcase/missing$;^C:/hoffman/My Builds/testcase/ltmain\\.sh$;^C:/hoffman/My Builds/testcase/libtool$;^C:/hoffman/My Builds/testcase/install-sh$;^C:/hoffman/My Builds/testcase/configure$;^C:/hoffman/My Builds/testcase/config\\.sub$;^C:/hoffman/My Builds/testcase/config\\.status$;^C:/hoffman/My Builds/testcase/config\\.log$;^C:/hoffman/My Builds/testcase/config\\.guess$;^C:/hoffman/My Builds/testcase/autom4te\\.cache$;^C:/hoffman/My Builds/testcase/aclocal\\.m4$;^C:/hoffman/My Builds/testcase/depcomp$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.075\\.model_cassisi_eos1_10$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.075\\.model_cassisi_eos1_10_corr$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model_cassisi_eos1$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model_cassisi_scvh$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.3\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.rgbtip\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.zahb\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.3\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.085\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/.*\\.ps$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.mem$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.tex\\.bak$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j10\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j12\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j16\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j20\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j22\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j26\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j30\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j32\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j36\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k10\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k12\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k20\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k22\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k30\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k32\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/1_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/1_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/2_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/2_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/linear_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/linear_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/noexchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/noexchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/nr_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/nr_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/series_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/series_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_JNR_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_Jseries_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_KNR_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_Kseries_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check34_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check35_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check36_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check43_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check44_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check45_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check46_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check47_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check48_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/tc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/make\\.out.*$;^C:/hoffman/My Builds/testcase/www/Makefile$;^C:/hoffman/My Builds/testcase/www/Makefile\\.in$;^C:/hoffman/My Builds/testcase/src/.*\\.flc$;^C:/hoffman/My Builds/testcase/src/Makefile$;^C:/hoffman/My Builds/testcase/src/Makefile\\.in$;^C:/hoffman/My Builds/testcase/src/\\.deps$;^C:/hoffman/My Builds/testcase/src/\\.libs$;^C:/hoffman/My Builds/testcase/src/.*\\.la$;^C:/hoffman/My Builds/testcase/src/.*\\.lo$;^C:/hoffman/My Builds/testcase/src/make\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/statef.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.1\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.1\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.1\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.3\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.3\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.3\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_15$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_rel$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/hot_post_agb\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgb_tip\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgbtip\\.1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgbtip\\.1\\.0\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgbtip\\.1\\.0\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/start_shellflash\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/white_dwarf\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.1\\.0\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.1\\.0\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/15gamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/15lnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/23gamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/23lnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/thermodynamic_consistency/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/thermodynamic_consistency/.*\\.results$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/newversion_grid/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/newversion_grid/.*\\.err$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/.*\\.ps$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_fit\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_fit\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_fit\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/3order_data\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/5order_data\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/8order_data\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check8_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check3_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check5_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/effo_check3_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/effoo_check3_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda15gamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda15lnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda23gamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda23lnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/tc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/make\\.out.*$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/thermodynamic_consistency/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/thermodynamic_consistency/tc\\.results$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_compare_model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_compare_solar\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_solar\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_solar_1995\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/statef_opal_model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/statef_opal_model_1995\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/purehe_newversion_grid/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/purehe_newversion_grid/.*\\.err$;^C:/hoffman/My Builds/testcase/include/Makefile\\.in$;^C:/hoffman/My Builds/testcase/include/Makefile$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/0\\.1\\.model_pteh$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/1\\.0\\.model_eos1a-eos1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/1\\.0\\.model_pteh$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/statef_model_0\\.1\\.model_pteh\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/statef_model_1\\.0\\.model_eos1a-eos1\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/statef_model_1\\.0\\.model_pteh\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context/contour\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context/eos_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context/statef_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/thermodynamic_consistency/fort\\.91$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/thermodynamic_consistency/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/context$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/oldversion_grid$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/2005Ap&SS\\.298\\.\\.135S\\.pdf$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/2007Ap&SS\\.307\\.\\.263C\\.pdf$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/astro-ph\\.9909168_eprint_submitted_to_High_Press\\.Res\\.16,331\\.pdf$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/.*ps.*$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/convergence\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/convergence\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/convergence\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/statef_grid-newversion$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/pureh_context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/purehe_context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/old$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/make\\.out.*$;^C:/hoffman/My Builds/testcase/utils/.*\\.flc$;^C:/hoffman/My Builds/testcase/utils/Makefile$;^C:/hoffman/My Builds/testcase/utils/Makefile\\.in$;^C:/hoffman/My Builds/testcase/utils/\\.deps$;^C:/hoffman/My Builds/testcase/utils/\\.libs$;^C:/hoffman/My Builds/testcase/utils/.*\\.la$;^C:/hoffman/My Builds/testcase/utils/.*\\.lo$;^C:/hoffman/My Builds/testcase/utils/free_eos_test$;^C:/hoffman/My Builds/testcase/utils/test_rosenbrock$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check1\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check3\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check5\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check8\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_checknr\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/effo_check3\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/effoo_check3\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence_20070613$;^C:/hoffman/My Builds/testcase/www/eospaper/text$;^C:/hoffman/My Builds/testcase/www/eospaper/cassisi_book_fig$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.1\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/2\\.0\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.2\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.3\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.4\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.5\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.6\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/figures$;^C:/hoffman/My Builds/testcase/www/eospaper/old$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/.*\\.ps.*$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/make\\.out.*$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_JNR\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_Jseries\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_KNR\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_Kseries\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check34\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check35\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check36\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check44\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check45\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check46\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_1_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_2_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_linear_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_noexchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_nr_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_series_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/1_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/noexchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/nr_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/series_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/series_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/linear_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/2_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/nr_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/linear_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/noexchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/1_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/2_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/pureh_newversion_grid/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/pureh_newversion_grid/.*\\.err$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_0\\.1\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_0\\.3\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model_linear\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model_noexchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model_nr\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.rgbtip\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.zahb\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.zahb\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.rgbtip\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model_linear$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model_noexchange$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model_nr$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/0\\.1\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/0\\.3\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context/contour\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context/eos_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context/statef_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/gong/delta\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/gong/m0085eos1gong\\.ascii$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/gong/m0085eos2gong\\.ascii$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb_adjust/coulomb_adjust\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/.*\\.ps$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/solution\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/solution\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/solution\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/rtc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/tc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/make\\.out.*$") +set(CPACK_SOURCE_IGNORE_FILES "~$;\\.cvsignore$;^C:/hoffman/My Builds/testcase.*/CVS/;^C:/hoffman/My Builds/testcase.*/\\.svn/;^C:/hoffman/My Builds/testcase.*/sweigart/;^C:/hoffman/My Builds/testcase/www/eospaper/solution/eos2001/;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_tables_new/;^C:/hoffman/My Builds/testcase/COPYING$;^C:/hoffman/My Builds/testcase/INSTALL$;^C:/hoffman/My Builds/testcase/Makefile$;^C:/hoffman/My Builds/testcase/Makefile\\.in$;^C:/hoffman/My Builds/testcase/.*\\.lo$;^C:/hoffman/My Builds/testcase/.*\\.la$;^C:/hoffman/My Builds/testcase/mkinstalldirs$;^C:/hoffman/My Builds/testcase/missing$;^C:/hoffman/My Builds/testcase/ltmain\\.sh$;^C:/hoffman/My Builds/testcase/libtool$;^C:/hoffman/My Builds/testcase/install-sh$;^C:/hoffman/My Builds/testcase/configure$;^C:/hoffman/My Builds/testcase/config\\.sub$;^C:/hoffman/My Builds/testcase/config\\.status$;^C:/hoffman/My Builds/testcase/config\\.log$;^C:/hoffman/My Builds/testcase/config\\.guess$;^C:/hoffman/My Builds/testcase/autom4te\\.cache$;^C:/hoffman/My Builds/testcase/aclocal\\.m4$;^C:/hoffman/My Builds/testcase/depcomp$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.075\\.model_cassisi_eos1_10$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.075\\.model_cassisi_eos1_10_corr$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model_cassisi_eos1$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model_cassisi_scvh$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.3\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.rgbtip\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.zahb\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.3\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.085\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/.*\\.ps$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.mem$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.tex\\.bak$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j10\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j12\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j16\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j20\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j22\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j26\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j30\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j32\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j36\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k10\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k12\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k20\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k22\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k30\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k32\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/1_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/1_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/2_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/2_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/linear_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/linear_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/noexchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/noexchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/nr_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/nr_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/series_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/series_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_JNR_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_Jseries_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_KNR_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_Kseries_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check34_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check35_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check36_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check43_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check44_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check45_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check46_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check47_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check48_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/tc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/make\\.out.*$;^C:/hoffman/My Builds/testcase/www/Makefile$;^C:/hoffman/My Builds/testcase/www/Makefile\\.in$;^C:/hoffman/My Builds/testcase/src/.*\\.flc$;^C:/hoffman/My Builds/testcase/src/Makefile$;^C:/hoffman/My Builds/testcase/src/Makefile\\.in$;^C:/hoffman/My Builds/testcase/src/\\.deps$;^C:/hoffman/My Builds/testcase/src/\\.libs$;^C:/hoffman/My Builds/testcase/src/.*\\.la$;^C:/hoffman/My Builds/testcase/src/.*\\.lo$;^C:/hoffman/My Builds/testcase/src/make\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/statef.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.1\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.1\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.1\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.3\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.3\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/0\\.3\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_15$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/1\\.0\\.model_rel$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/hot_post_agb\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgb_tip\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgbtip\\.1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgbtip\\.1\\.0\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/rgbtip\\.1\\.0\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/start_shellflash\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/white_dwarf\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.1\\.0\\.model_13$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.1\\.0\\.model_23$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/model-loci/zahb\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/15gamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/15lnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/23gamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fermi_dirac_approx/23lnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/thermodynamic_consistency/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/thermodynamic_consistency/.*\\.results$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/newversion_grid/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/newversion_grid/.*\\.err$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/.*\\.ps$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_fit\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_fit\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_fit\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/3order_data\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/5order_data\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/8order_data\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check8_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check3_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check5_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/effo_check3_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/effoo_check3_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda15gamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda15lnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda23gamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/fda23lnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/tc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/make\\.out.*$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/thermodynamic_consistency/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/thermodynamic_consistency/tc\\.results$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_compare_model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_compare_solar\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_solar\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/opal_solar_1995\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/statef_opal_model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_solar/statef_opal_model_1995\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/purehe_newversion_grid/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/purehe_newversion_grid/.*\\.err$;^C:/hoffman/My Builds/testcase/include/Makefile\\.in$;^C:/hoffman/My Builds/testcase/include/Makefile$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/0\\.1\\.model_pteh$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/1\\.0\\.model_eos1a-eos1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/1\\.0\\.model_pteh$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/statef_model_0\\.1\\.model_pteh\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/statef_model_1\\.0\\.model_eos1a-eos1\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/model-loci/statef_model_1\\.0\\.model_pteh\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context/contour\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context/eos_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context/statef_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/thermodynamic_consistency/fort\\.91$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/thermodynamic_consistency/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/context$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/oldversion_grid$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/2005Ap&SS\\.298\\.\\.135S\\.pdf$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/2007Ap&SS\\.307\\.\\.263C\\.pdf$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/astro-ph\\.9909168_eprint_submitted_to_High_Press\\.Res\\.16,331\\.pdf$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/.*ps.*$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/convergence\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/convergence\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/convergence\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/statef_grid-newversion$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/pureh_context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/purehe_context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/old$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/make\\.out.*$;^C:/hoffman/My Builds/testcase/utils/.*\\.flc$;^C:/hoffman/My Builds/testcase/utils/Makefile$;^C:/hoffman/My Builds/testcase/utils/Makefile\\.in$;^C:/hoffman/My Builds/testcase/utils/\\.deps$;^C:/hoffman/My Builds/testcase/utils/\\.libs$;^C:/hoffman/My Builds/testcase/utils/.*\\.la$;^C:/hoffman/My Builds/testcase/utils/.*\\.lo$;^C:/hoffman/My Builds/testcase/utils/free_eos_test$;^C:/hoffman/My Builds/testcase/utils/test_rosenbrock$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check1\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check3\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check5\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_check8\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/eff_checknr\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/effo_check3\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/eff_check/effoo_check3\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence_20070613$;^C:/hoffman/My Builds/testcase/www/eospaper/text$;^C:/hoffman/My Builds/testcase/www/eospaper/cassisi_book_fig$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.1\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/2\\.0\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.2\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.3\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.4\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.5\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/1\\.6\\.0$;^C:/hoffman/My Builds/testcase/www/eospaper/figures$;^C:/hoffman/My Builds/testcase/www/eospaper/old$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/.*\\.ps.*$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/context\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dh_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/nocoulomb_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh_dgamma1_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/pteh_dlnp_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/make\\.out.*$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_JNR\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_Jseries\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_KNR\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_Kseries\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check34\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check35\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check36\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check44\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check45\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/exchange_check46\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_1_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_2_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_linear_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_noexchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_nr_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/statef_compare_series_exchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/1_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/noexchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/nr_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/series_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/series_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/linear_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/2_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/nr_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/linear_exchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/noexchange_dgamma1\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/1_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange_check/2_exchange_dlnp\\.gnuplot$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/pureh_newversion_grid/.*\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/convergence/pureh_newversion_grid/.*\\.err$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau/dgamma1$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau/dlnp$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/dhtau/statef_compare\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_0\\.1\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_0\\.3\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model_linear\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model_noexchange\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.model_nr\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.rgbtip\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/statef_model_1\\.0\\.zahb\\.model\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.zahb\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.rgbtip\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model_linear$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model_noexchange$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model_nr$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/0\\.1\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/model-loci/0\\.3\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context/contour\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context/eos_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/context/statef_grid\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/gong/delta\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/gong/m0085eos1gong\\.ascii$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/gong/m0085eos2gong\\.ascii$;^C:/hoffman/My Builds/testcase/www/eospaper/coulomb/coulomb_adjust/coulomb_adjust\\.out$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/.*\\.ps$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/.*\\.pyc$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/solution\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/solution\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/solution\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/rtc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/tc_yplot\\.in$;^C:/hoffman/My Builds/testcase/www/eospaper/solution/make\\.out.*$") # # Define a macro # -MACRO(ASSERT value msg) - IF (NOT ${value}) - MESSAGE ("Assertion failure:" ${msg} ) - ENDIF (NOT ${value}) -ENDMACRO(ASSERT) - +macro(ASSERT value msg) + if (NOT ${value}) + message ("Assertion failure:" ${msg} ) + endif () +endmacro() + # invoke the macro ASSERT(Complex_BINARY_DIR "The PROJECT command is broken") # # Define a var args macro, it must take two or four args # -MACRO(TEST_ARGC value1 value2) - ADD_DEFINITIONS(${value1} ${value2}) - IF (${ARGC} MATCHES 4) - ADD_DEFINITIONS(${ARGV2} ${ARGV3}) - ENDIF (${ARGC} MATCHES 4) -ENDMACRO(TEST_ARGC) - +macro(TEST_ARGC value1 value2) + add_definitions(${value1} ${value2}) + if (${ARGC} MATCHES 4) + add_definitions(${ARGV2} ${ARGV3}) + endif () +endmacro() + # invoke the macro TEST_ARGC(-DCMAKE_ARGV1 -DCMAKE_ARGV2 -DCMAKE_ARGV3 -DCMAKE_ARGV4) -MACRO(TEST_VAR_ARG fa) - IF("${ARGV}" MATCHES "^1;2;3$") - MESSAGE(STATUS "ARGV works") - ELSE("${ARGV}" MATCHES "^1;2;3$") - MESSAGE(FATAL_ERROR "ARGV does not work; got \"${ARGV}\" instead of \"1;2;3\"") - ENDIF("${ARGV}" MATCHES "^1;2;3$") - IF("${ARGN}" MATCHES "^2;3$") - MESSAGE(STATUS "ARGN works") - ELSE("${ARGN}" MATCHES "^2;3$") - MESSAGE(FATAL_ERROR "ARGV does not work; got \"${ARGN}\" instead of \"2;3\"") - ENDIF("${ARGN}" MATCHES "^2;3$") -ENDMACRO(TEST_VAR_ARG) +macro(TEST_VAR_ARG fa) + if("${ARGV}" MATCHES "^1;2;3$") + message(STATUS "ARGV works") + else() + message(FATAL_ERROR "ARGV does not work; got \"${ARGV}\" instead of \"1;2;3\"") + endif() + if("${ARGN}" MATCHES "^2;3$") + message(STATUS "ARGN works") + else() + message(FATAL_ERROR "ARGV does not work; got \"${ARGN}\" instead of \"2;3\"") + endif() +endmacro() TEST_VAR_ARG(1 2 3) # Floating-point comparison test. -IF(2.4 LESS 2.4) - MESSAGE(FATAL_ERROR "Failed: 2.4 LESS 2.4") -ENDIF(2.4 LESS 2.4) -IF(2.4 GREATER 2.4) - MESSAGE(FATAL_ERROR "Failed: 2.4 GREATER 2.4") -ENDIF(2.4 GREATER 2.4) -IF(NOT 2.4 EQUAL 2.4) - MESSAGE(FATAL_ERROR "Failed: NOT 2.4 EQUAL 2.4") -ENDIF(NOT 2.4 EQUAL 2.4) - -IF(CMAKE_SYSTEM MATCHES "OSF1-V.*") - IF(NOT CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ") - ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) -ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*") - - -ADD_DEFINITIONS(-DCMAKE_IS_FUN) -ADD_DEFINITIONS(-DCMAKE_IS_REALLY_FUN) -SET_PROPERTY(DIRECTORY +if(2.4 LESS 2.4) + message(FATAL_ERROR "Failed: 2.4 LESS 2.4") +endif() +if(2.4 GREATER 2.4) + message(FATAL_ERROR "Failed: 2.4 GREATER 2.4") +endif() +if(NOT 2.4 EQUAL 2.4) + message(FATAL_ERROR "Failed: NOT 2.4 EQUAL 2.4") +endif() + +if(CMAKE_SYSTEM MATCHES "OSF1-V.*") + if(NOT CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ") + endif() +endif() + + +add_definitions(-DCMAKE_IS_FUN) +add_definitions(-DCMAKE_IS_REALLY_FUN) +set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_RELEASE CMAKE_IS_FUN_IN_RELEASE_MODE ) -SET(TEST_SEP "a b c") -SEPARATE_ARGUMENTS(TEST_SEP) +set(TEST_SEP "a b c") +separate_arguments(TEST_SEP) # # Include vars from a file and from a cache # -IF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) - INCLUDE(${Complex_SOURCE_DIR}/VarTests.cmake) -ENDIF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) -INCLUDE(fileshouldnotbehere OPTIONAL) -LOAD_CACHE(${Complex_SOURCE_DIR}/Cache +if (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) + include(${Complex_SOURCE_DIR}/VarTests.cmake) +endif () +include(fileshouldnotbehere OPTIONAL) +load_cache(${Complex_SOURCE_DIR}/Cache EXCLUDE CACHE_TEST_VAR_EXCLUDED INCLUDE_INTERNALS CACHE_TEST_VAR_INTERNAL) -LOAD_CACHE(${Complex_SOURCE_DIR}/Cache READ_WITH_PREFIX foo CACHE_TEST_VAR2) -IF(${fooCACHE_TEST_VAR2} MATCHES bar) - MESSAGE("Load cache worked: ${fooCACHE_TEST_VAR2}") -ELSE(${fooCACHE_TEST_VAR2} MATCHES bar) - MESSAGE(FATAL_ERROR "Load cache with prefix failed: ${fooCACHE_TEST_VAR2}") -ENDIF(${fooCACHE_TEST_VAR2} MATCHES bar) +load_cache(${Complex_SOURCE_DIR}/Cache READ_WITH_PREFIX foo CACHE_TEST_VAR2) +if(${fooCACHE_TEST_VAR2} MATCHES bar) + message("Load cache worked: ${fooCACHE_TEST_VAR2}") +else() + message(FATAL_ERROR "Load cache with prefix failed: ${fooCACHE_TEST_VAR2}") +endif() # -# Specify include and lib dirs +# Specify include and lib dirs # (BEFORE is for coverage) # -INCLUDE_DIRECTORIES( +include_directories( Library ) -INCLUDE_DIRECTORIES(BEFORE +include_directories(BEFORE ${Complex_BINARY_DIR} ) -INCLUDE_DIRECTORIES(SYSTEM Library/SystemDir) +include_directories(SYSTEM Library/SystemDir) -INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile|test).*$" "^cmMissing") +include_regular_expression("^(cmTest|file|sharedFile|test).*$" "^cmMissing") -LINK_DIRECTORIES( +link_directories( ${Complex_BINARY_DIR}/Library ) # # check for SET CACHE FORCE # -SET(FORCE_TEST 1 CACHE STRING "a test") -SET(FORCE_TEST 0 CACHE STRING "a test" FORCE) +set(FORCE_TEST 1 CACHE STRING "a test") +set(FORCE_TEST 0 CACHE STRING "a test" FORCE) # # Lib and exe path # -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/lib/static") -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/lib") -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/bin") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/lib/static") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/lib") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/bin") -MESSAGE (Test " " escape " " semi-colon " " \; \;) +message (Test " " escape " " semi-colon " " \; \;) # # Exec program (TODO: test a result) # Increase coverage. # -MESSAGE("\nIgnore this message") -OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0) -IF (NOT NO_EXEC_PROGRAM) - EXEC_PROGRAM(${CMAKE_COMMAND} ARGS -E echo NO_EXEC_PROGRAM "${Complex_BINARY_DIR}") -ELSE (NOT NO_EXEC_PROGRAM) - MESSAGE("Set this option ON") -ENDIF (NOT NO_EXEC_PROGRAM) +message("\nIgnore this message") +option(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0) +if (NOT NO_EXEC_PROGRAM) + exec_program(${CMAKE_COMMAND} ARGS -E echo NO_EXEC_PROGRAM "${Complex_BINARY_DIR}") +else () + message("Set this option ON") +endif () -MARK_AS_ADVANCED(NO_EXEC_PROGRAM) -MARK_AS_ADVANCED(CLEAR NO_EXEC_PROGRAM) +mark_as_advanced(NO_EXEC_PROGRAM) +mark_as_advanced(CLEAR NO_EXEC_PROGRAM) # Execute a process. Add coverage for this command. -EXECUTE_PROCESS( +execute_process( COMMAND ${CMAKE_COMMAND} -E echo "ABCDEFG" OUTPUT_VARIABLE TEST_OUT ) -IF("${TEST_OUT}" MATCHES "^ABCDEFG\n$") -ELSE("${TEST_OUT}" MATCHES "^ABCDEFG\n$") - MESSAGE(SEND_ERROR "EXECUTE_PROCESS output test failed: [${TEST_OUT}]") -ENDIF("${TEST_OUT}" MATCHES "^ABCDEFG\n$") +if("${TEST_OUT}" MATCHES "^ABCDEFG\n$") +else() + message(SEND_ERROR "EXECUTE_PROCESS output test failed: [${TEST_OUT}]") +endif() # This test has some problems on UNIX systems. Disabling for now. # -# EXECUTE_PROCESS( +# execute_process( # COMMAND ${CMAKE_COMMAND} -E echo "ABCDEFG" # COMMAND /process/does/not/exist # OUTPUT_QUIET # ERROR_QUIET # RESULT_VARIABLE RESULT # ) -# IF("${RESULT}" MATCHES "^0$") -# MESSAGE(SEND_ERROR +# if("${RESULT}" MATCHES "^0$") +# message(SEND_ERROR # "EXECUTE_PROCESS result test failed with RESULT=[${RESULT}]") -# ELSE("${RESULT}" MATCHES "^0$") -# MESSAGE(STATUS "EXECUTE_PROCESS result test passed with RESULT=[${RESULT}]") -# ENDIF("${RESULT}" MATCHES "^0$") +# else() +# message(STATUS "EXECUTE_PROCESS result test passed with RESULT=[${RESULT}]") +# endif() # # Create directory. # The 'complex' executable will then test if this dir exists, # sadly it won't be able to remove it. # -MAKE_DIRECTORY("${Complex_BINARY_DIR}/make_dir") +make_directory("${Complex_BINARY_DIR}/make_dir") # # Test FIND_LIBARY # Create a dummy empty lib # -CONFIGURE_FILE( +configure_file( ${Complex_SOURCE_DIR}/Library/dummy ${Complex_BINARY_DIR}/Library/dummylib.lib COPYONLY IMMEDIATE) -FOREACH (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl) - CONFIGURE_FILE( +foreach (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl) + configure_file( ${Complex_SOURCE_DIR}/Library/dummy ${Complex_BINARY_DIR}/Library/libdummylib${ext} COPYONLY IMMEDIATE) -ENDFOREACH (ext) +endforeach () -FIND_LIBRARY(FIND_DUMMY_LIB +find_library(FIND_DUMMY_LIB dummylib PATHS ${Complex_BINARY_DIR}/Library DOC "find dummy lib") -FIND_LIBRARY(FIND_DUMMY_LIB +find_library(FIND_DUMMY_LIB NAMES dummylib dummylib2 PATHS ${Complex_BINARY_DIR}/Library DOC "find dummy lib") # -# Test SET_SOURCE_FILES_PROPERTIES +# Test SET_SOURCE_FILES_PROPERTIES # -SET_SOURCE_FILES_PROPERTIES(nonexisting_file2 - GENERATED - ABSTRACT - WRAP_EXCLUDE +set_source_files_properties(nonexisting_file2 + GENERATED + ABSTRACT + WRAP_EXCLUDE COMPILE_FLAGS "-foo -bar") -GET_SOURCE_FILE_PROPERTY(FILE_HAS_ABSTRACT nonexisting_file2 ABSTRACT) -GET_SOURCE_FILE_PROPERTY(FILE_HAS_WRAP_EXCLUDE nonexisting_file2 WRAP_EXCLUDE) -GET_SOURCE_FILE_PROPERTY(FILE_COMPILE_FLAGS nonexisting_file2 COMPILE_FLAGS) +get_source_file_property(FILE_HAS_ABSTRACT nonexisting_file2 ABSTRACT) +get_source_file_property(FILE_HAS_WRAP_EXCLUDE nonexisting_file2 WRAP_EXCLUDE) +get_source_file_property(FILE_COMPILE_FLAGS nonexisting_file2 COMPILE_FLAGS) -SET_SOURCE_FILES_PROPERTIES(nonexisting_file3 PROPERTIES +set_source_files_properties(nonexisting_file3 PROPERTIES GENERATED 1 ABSTRACT 1 WRAP_EXCLUDE 1 COMPILE_FLAGS "-foo -bar") -GET_SOURCE_FILE_PROPERTY(FILE_HAS_ABSTRACT nonexisting_file3 ABSTRACT) -GET_SOURCE_FILE_PROPERTY(FILE_HAS_WRAP_EXCLUDE nonexisting_file3 WRAP_EXCLUDE) -GET_SOURCE_FILE_PROPERTY(FILE_COMPILE_FLAGS nonexisting_file3 COMPILE_FLAGS) +get_source_file_property(FILE_HAS_ABSTRACT nonexisting_file3 ABSTRACT) +get_source_file_property(FILE_HAS_WRAP_EXCLUDE nonexisting_file3 WRAP_EXCLUDE) +get_source_file_property(FILE_COMPILE_FLAGS nonexisting_file3 COMPILE_FLAGS) # # Test registry (win32) # Create a file, put its path in a registry key, try to find the file in that # path using that registry key, then remove the file and the key # -IF (WIN32) - IF (NOT UNIX) - SET(dir "${Complex_BINARY_DIR}/registry_dir") - SET(file "registry_test_dummy") - SET(hkey "HKEY_CURRENT_USER\\Software\\Kitware\\CMake\\Tests\\Complex;registry_test") - CONFIGURE_FILE( +if (WIN32) + if (NOT UNIX) + set(dir "${Complex_BINARY_DIR}/registry_dir") + set(file "registry_test_dummy") + set(hkey "HKEY_CURRENT_USER\\Software\\Kitware\\CMake\\Tests\\Complex;registry_test") + configure_file( ${Complex_SOURCE_DIR}/Library/dummy "${dir}/${file}" COPYONLY IMMEDIATE) - EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "-E write_regv \"${hkey}\" \"${dir}\"") - FIND_PATH(REGISTRY_TEST_PATH + exec_program(${CMAKE_COMMAND} ARGS "-E write_regv \"${hkey}\" \"${dir}\"") + find_path(REGISTRY_TEST_PATH ${file} "[${hkey}]" DOC "Registry_Test_Path") - EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "-E delete_regv \"${hkey}\"") - EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "-E remove \"${dir}/${file}\"") - ENDIF (NOT UNIX) -ENDIF (WIN32) + exec_program(${CMAKE_COMMAND} ARGS "-E delete_regv \"${hkey}\"") + exec_program(${CMAKE_COMMAND} ARGS "-E remove \"${dir}/${file}\"") + endif () +endif () # # Test a set and a remove # -SET(REMOVE_STRING a b c d e f) -SET(removeVar1 c e) -REMOVE(REMOVE_STRING ${removeVar1} f) +set(REMOVE_STRING a b c d e f) +set(removeVar1 c e) +remove(REMOVE_STRING ${removeVar1} f) # # Test an IF inside a FOREACH. # -FOREACH(x "a") - IF(${x} MATCHES "a") +foreach(x "a") + if(${x} MATCHES "a") # Should always execute. - SET(IF_INSIDE_FOREACH_THEN_EXECUTED 1) - ELSE(${x} MATCHES "a") + set(IF_INSIDE_FOREACH_THEN_EXECUTED 1) + else() # Should never execute. - SET(IF_INSIDE_FOREACH_ELSE_EXECUTED 1) - ENDIF(${x} MATCHES "a") -ENDFOREACH(x) + set(IF_INSIDE_FOREACH_ELSE_EXECUTED 1) + endif() +endforeach() # test WHILE command -SET (while_var 1) -WHILE (while_var LESS 1000) - SET(while_var ${while_var}0) -ENDWHILE(while_var LESS 1000) +set (while_var 1) +while (while_var LESS 1000) + set(while_var ${while_var}0) +endwhile() -SET(SHOULD_BE_ZERO ) -SET(SHOULD_BE_ONE 1) +set(SHOULD_BE_ZERO ) +set(SHOULD_BE_ONE 1) -# test elseif functionality, the mess below tries to catch problem +# test elseif functionality, the mess below tries to catch problem # of clauses being executed early or late etc set (RESULT 3) if (RESULT EQUAL 1) @@ -298,7 +298,7 @@ if (RESULT EQUAL 1) set (ELSEIF_RESULT 1) elseif (RESULT EQUAL 3) set (ELSEIF_RESULT 1) - endif (RESULT EQUAL 2) + endif () elseif (RESULT EQUAL 2) set (ELSEIF_RESULT 1) elseif (RESULT EQUAL 3) @@ -307,25 +307,25 @@ elseif (RESULT EQUAL 3) elseif (RESULT EQUAL 3) if (NOT ELSEIF_RESULT EQUAL 1) set (ELSEIF_RESULT 2) - endif (NOT ELSEIF_RESULT EQUAL 1) - endif (RESULT EQUAL 2) + endif () + endif () elseif (RESULT EQUAL 4) if (RESULT EQUAL 2) set (ELSEIF_RESULT 1) elseif (RESULT EQUAL 3) set (ELSEIF_RESULT 1) - endif (RESULT EQUAL 2) -else (RESULT EQUAL 1) + endif () +else () if (RESULT EQUAL 2) set (ELSEIF_RESULT 1) elseif (RESULT EQUAL 3) set (ELSEIF_RESULT 1) - endif (RESULT EQUAL 2) -endif (RESULT EQUAL 1) + endif () +endif () if (NOT ELSEIF_RESULT EQUAL 2) set (ELSEIF_RESULT 0) -endif (NOT ELSEIF_RESULT EQUAL 2) +endif () # test handling of parenthetical groups in conditionals if (2 GREATER 1 AND (4 LESS 3 OR 5 LESS 6) AND NOT (7 GREATER 8)) @@ -334,43 +334,43 @@ endif() # -# Configure file +# Configure file # (plug vars to #define so that they can be tested) # -CONFIGURE_FILE( +configure_file( ${Complex_SOURCE_DIR}/cmTestConfigure.h.in ${Complex_BINARY_DIR}/cmTestConfigure.h) -SET(STRING_WITH_QUOTES "\"hello world\"") +set(STRING_WITH_QUOTES "\"hello world\"") # test CONFIGURE_FILE with ESCAPE_QUOTES on -CONFIGURE_FILE( +configure_file( ${Complex_SOURCE_DIR}/cmTestConfigureEscape.h.in ${Complex_BINARY_DIR}/cmTestConfigureEscape.h ESCAPE_QUOTES) # Test regular expression commands. -STRING(REGEX MATCH "b" RESULT "abc") -IF(NOT RESULT) - MESSAGE(SEND_ERROR "STRING(REGEX MATCH ... ) test failed.") -ENDIF(NOT RESULT) -STRING(REGEX MATCHALL "b" RESULT "abcb") -IF(NOT RESULT) - MESSAGE(SEND_ERROR "STRING(REGEX MATCHALL ... ) test failed.") -ENDIF(NOT RESULT) -STRING(REGEX REPLACE ".([bd])." "[\\1]" RESULT "a(b)c(d)e") -IF("x${RESULT}" MATCHES "^xa\\[b\\]c\\[d\\]e$") - SET(STRING_REGEX_PASSED 1) -ENDIF("x${RESULT}" MATCHES "^xa\\[b\\]c\\[d\\]e$") -IF(NOT STRING_REGEX_PASSED) - MESSAGE(SEND_ERROR - "STRING(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")") -ENDIF(NOT STRING_REGEX_PASSED) +string(REGEX MATCH "b" RESULT "abc") +if(NOT RESULT) + message(SEND_ERROR "string(REGEX MATCH ... ) test failed.") +endif() +string(REGEX MATCHALL "b" RESULT "abcb") +if(NOT RESULT) + message(SEND_ERROR "string(REGEX MATCHALL ... ) test failed.") +endif() +string(REGEX REPLACE ".([bd])." "[\\1]" RESULT "a(b)c(d)e") +if("x${RESULT}" MATCHES "^xa\\[b\\]c\\[d\\]e$") + set(STRING_REGEX_PASSED 1) +endif() +if(NOT STRING_REGEX_PASSED) + message(SEND_ERROR + "string(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")") +endif() # # Create the libs and the main exe # -ADD_SUBDIRECTORY(Library) -ADD_SUBDIRECTORY(Executable) -SUBDIR_DEPENDS(Executable Library) -EXPORT_LIBRARY_DEPENDENCIES(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake) -INCLUDE(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake OPTIONAL) +add_subdirectory(Library) +add_subdirectory(Executable) +subdir_depends(Executable Library) +export_library_dependencies(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake) +include(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake OPTIONAL) diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt index 345836257..432dbf890 100644 --- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt @@ -1,116 +1,116 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 1.3) +cmake_minimum_required(VERSION 1.3) # -# Create exe. +# Create exe. # -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") # Create an imported target for if(TARGET) test below. -ADD_LIBRARY(ExeImportedTarget UNKNOWN IMPORTED) +add_library(ExeImportedTarget UNKNOWN IMPORTED) # Test if(TARGET) command. -IF(NOT TARGET CMakeTestLibrary) - MESSAGE(FATAL_ERROR "IF(NOT TARGET CMakeTestLibrary) returned true!") -ENDIF(NOT TARGET CMakeTestLibrary) -IF(NOT TARGET ExeImportedTarget) - MESSAGE(FATAL_ERROR "IF(NOT TARGET ExeImportedTarget) returned true!") -ENDIF(NOT TARGET ExeImportedTarget) -IF(TARGET LibImportedTarget) - MESSAGE(FATAL_ERROR "IF(TARGET LibImportedTarget) returned true!") -ENDIF(TARGET LibImportedTarget) -IF(TARGET NotATarget) - MESSAGE(FATAL_ERROR "IF(TARGET NotATarget) returned true!") -ENDIF(TARGET NotATarget) - - # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to -SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared) -LINK_LIBRARIES(${COMPLEX_LIBS}) +if(NOT TARGET CMakeTestLibrary) + message(FATAL_ERROR "if(NOT TARGET CMakeTestLibrary) returned true!") +endif() +if(NOT TARGET ExeImportedTarget) + message(FATAL_ERROR "if(NOT TARGET ExeImportedTarget) returned true!") +endif() +if(TARGET LibImportedTarget) + message(FATAL_ERROR "if(TARGET LibImportedTarget) returned true!") +endif() +if(TARGET NotATarget) + message(FATAL_ERROR "if(TARGET NotATarget) returned true!") +endif() + + # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to +set(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared) +link_libraries(${COMPLEX_LIBS}) # Test forcing a .cxx file to not build. -SET_SOURCE_FILES_PROPERTIES(complex_nobuild.cxx PROPERTIES +set_source_files_properties(complex_nobuild.cxx PROPERTIES HEADER_FILE_ONLY 1) # Test forcing a .c file to not build. # This makes sure a mixed language library is created # with header file only sources -SET_SOURCE_FILES_PROPERTIES(complex_nobuild.c PROPERTIES +set_source_files_properties(complex_nobuild.c PROPERTIES HEADER_FILE_ONLY 1) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) -ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt) -ADD_CUSTOM_COMMAND(OUTPUT Aout.h COMMAND A > Aout.h VERBATIM) -ADD_EXECUTABLE(complex complex testcflags.c Aout.h) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +add_executable(A A.cxx A.hh A.h A.txt) +add_custom_command(OUTPUT Aout.h COMMAND A > Aout.h VERBATIM) +add_executable(complex complex testcflags.c Aout.h) # Sub1/NameConflictTest.c Sub2/NameConflictTest.c) -ADD_EXECUTABLE(complex.file complex.file.cxx complex_nobuild.cxx +add_executable(complex.file complex.file.cxx complex_nobuild.cxx complex_nobuild.c) -IF (UNIX) - TARGET_LINK_LIBRARIES(complex ${CMAKE_DL_LIBS}) -ELSE(UNIX) - IF (NOT BORLAND) - IF(NOT MINGW) - TARGET_LINK_LIBRARIES(complex rpcrt4.lib) - ENDIF(NOT MINGW) - ENDIF(NOT BORLAND) -ENDIF (UNIX) +if (UNIX) + target_link_libraries(complex ${CMAKE_DL_LIBS}) +else() + if (NOT BORLAND) + if(NOT MINGW) + target_link_libraries(complex rpcrt4.lib) + endif() + endif() +endif () # Test linking to static lib when a shared lib has the same name. -IF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) - ADD_DEFINITIONS(-DCOMPLEX_TEST_LINK_STATIC) - TARGET_LINK_LIBRARIES(complex CMakeTestLinkStatic) -ENDIF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) +if(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) + add_definitions(-DCOMPLEX_TEST_LINK_STATIC) + target_link_libraries(complex CMakeTestLinkStatic) +endif() # can we get the path to a source file -GET_SOURCE_FILE_PROPERTY(A_LOCATION A.cxx LOCATION) -IF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx") - ADD_DEFINITIONS(-DCMAKE_FOUND_ACXX) -ENDIF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx") +get_source_file_property(A_LOCATION A.cxx LOCATION) +if ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx") + add_definitions(-DCMAKE_FOUND_ACXX) +endif () # get the directory parent -GET_DIRECTORY_PROPERTY(P_VALUE PARENT_DIRECTORY) -IF ("${P_VALUE}" STREQUAL "${CMAKE_SOURCE_DIR}") - ADD_DEFINITIONS(-DCMAKE_FOUND_PARENT) -ENDIF ("${P_VALUE}" STREQUAL "${CMAKE_SOURCE_DIR}") +get_directory_property(P_VALUE PARENT_DIRECTORY) +if ("${P_VALUE}" STREQUAL "${CMAKE_SOURCE_DIR}") + add_definitions(-DCMAKE_FOUND_PARENT) +endif () # get the stack of listfiles -INCLUDE(Included.cmake) -IF ("${LF_VALUE}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt;${CMAKE_CURRENT_SOURCE_DIR}/Included.cmake") - ADD_DEFINITIONS(-DCMAKE_FOUND_LISTFILE_STACK) -ENDIF ("${LF_VALUE}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt;${CMAKE_CURRENT_SOURCE_DIR}/Included.cmake") +include(Included.cmake) +if ("${LF_VALUE}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt;${CMAKE_CURRENT_SOURCE_DIR}/Included.cmake") + add_definitions(-DCMAKE_FOUND_LISTFILE_STACK) +endif () # Test add/remove definitions. -ADD_DEFINITIONS( +add_definitions( -DCOMPLEX_DEFINED_PRE -DCOMPLEX_DEFINED -DCOMPLEX_DEFINED_POST -DCOMPLEX_DEFINED ) -REMOVE_DEFINITIONS(-DCOMPLEX_DEFINED) +remove_definitions(-DCOMPLEX_DEFINED) # Test pre-build/pre-link/post-build rules for an executable. -ADD_CUSTOM_COMMAND(TARGET complex PRE_BUILD +add_custom_command(TARGET complex PRE_BUILD COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Executable/prebuild.txt") -ADD_CUSTOM_COMMAND(TARGET complex PRE_BUILD +add_custom_command(TARGET complex PRE_BUILD COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Executable/prelink.txt") -ADD_CUSTOM_COMMAND(TARGET complex POST_BUILD +add_custom_command(TARGET complex POST_BUILD COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Executable/postbuild.txt") -ADD_CUSTOM_COMMAND(TARGET complex POST_BUILD +add_custom_command(TARGET complex POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy "${Complex_BINARY_DIR}/Executable/postbuild.txt" "${Complex_BINARY_DIR}/Executable/postbuild2.txt") -SET_SOURCE_FILES_PROPERTIES(complex +set_source_files_properties(complex COMPILE_FLAGS "-DFILE_HAS_EXTRA_COMPILE_FLAGS" #" -DFILE_DEFINE_STRING=\\\"hello\\\"" OBJECT_DEPENDS ${Complex_BINARY_DIR}/cmTestGeneratedHeader.h ) -SET_TARGET_PROPERTIES(complex PROPERTIES COMPILE_FLAGS "-DCOMPLEX_TARGET_FLAG") -ADD_CUSTOM_COMMAND( +set_target_properties(complex PROPERTIES COMPILE_FLAGS "-DCOMPLEX_TARGET_FLAG") +add_custom_command( TARGET complex SOURCE ${Complex_SOURCE_DIR}/cmTestGeneratedHeader.h.in COMMAND ${CMAKE_COMMAND} @@ -121,18 +121,18 @@ ADD_CUSTOM_COMMAND( ) # Test creating an executable that is not built by default. -ADD_EXECUTABLE(notInAllExe EXCLUDE_FROM_ALL notInAllExe.cxx) -TARGET_LINK_LIBRARIES(notInAllExe notInAllLib) +add_executable(notInAllExe EXCLUDE_FROM_ALL notInAllExe.cxx) +target_link_libraries(notInAllExe notInAllLib) # Test user-value flag mapping for the VS IDE. -IF(MSVC) - SET_TARGET_PROPERTIES(notInAllExe PROPERTIES +if(MSVC) + set_target_properties(notInAllExe PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBC;LIBCMT;MSVCRT") -ENDIF(MSVC) +endif() # Test creating a custom target that builds not-in-all targets. -ADD_CUSTOM_TARGET(notInAllCustom) -ADD_DEPENDENCIES(notInAllCustom notInAllExe) +add_custom_target(notInAllCustom) +add_dependencies(notInAllCustom notInAllExe) # # Output the files required by 'complex' to a file. @@ -141,30 +141,30 @@ ADD_DEPENDENCIES(notInAllCustom notInAllExe) # has no side-effects on the current Makefile (duplicated source file # due to source list expansion done twice). # -ADD_SUBDIRECTORY(Temp) +add_subdirectory(Temp) -IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX) - ADD_EXECUTABLE(testSystemDir testSystemDir.cxx) - SET_TARGET_PROPERTIES(testSystemDir PROPERTIES COMPILE_FLAGS "-Werror") -ENDIF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX) +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX) + add_executable(testSystemDir testSystemDir.cxx) + set_target_properties(testSystemDir PROPERTIES COMPILE_FLAGS "-Werror") +endif() # # Extra coverage.Not used. # -INSTALL_TARGETS(/tmp complex) -INSTALL_PROGRAMS(/tmp complex) +install_targets(/tmp complex) +install_programs(/tmp complex) -CONFIGURE_FILE( +configure_file( ${Complex_SOURCE_DIR}/Executable/cmVersion.h.in ${Complex_BINARY_DIR}/cmVersion.h) -SOURCE_GROUP(A_GROUP ".cxx") -SOURCE_GROUP(B_GROUP REGULAR_EXPRESSION "cxx") -SOURCE_GROUP(C_GROUP FILES complex.cxx) +source_group(A_GROUP ".cxx") +source_group(B_GROUP REGULAR_EXPRESSION "cxx") +source_group(C_GROUP FILES complex.cxx) -FILE(WRITE ${Complex_BINARY_DIR}/A/libA.a "test") -FILE(WRITE ${Complex_BINARY_DIR}/A/libC.a "test") -FILE(WRITE ${Complex_BINARY_DIR}/B/libB.a "test") -FILE(WRITE ${Complex_BINARY_DIR}/B/libA.a "test") -FILE(WRITE ${Complex_BINARY_DIR}/C/libC.a "test") -FILE(WRITE ${Complex_BINARY_DIR}/C/libB.a "test") +file(WRITE ${Complex_BINARY_DIR}/A/libA.a "test") +file(WRITE ${Complex_BINARY_DIR}/A/libC.a "test") +file(WRITE ${Complex_BINARY_DIR}/B/libB.a "test") +file(WRITE ${Complex_BINARY_DIR}/B/libA.a "test") +file(WRITE ${Complex_BINARY_DIR}/C/libC.a "test") +file(WRITE ${Complex_BINARY_DIR}/C/libB.a "test") diff --git a/Tests/ComplexOneConfig/Executable/Included.cmake b/Tests/ComplexOneConfig/Executable/Included.cmake index 2d1ea3e8c..520a68be1 100644 --- a/Tests/ComplexOneConfig/Executable/Included.cmake +++ b/Tests/ComplexOneConfig/Executable/Included.cmake @@ -1,2 +1,2 @@ -GET_DIRECTORY_PROPERTY(LF_VALUE LISTFILE_STACK) +get_directory_property(LF_VALUE LISTFILE_STACK) diff --git a/Tests/ComplexOneConfig/Executable/Temp/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/Temp/CMakeLists.txt index f00955029..041fcff20 100644 --- a/Tests/ComplexOneConfig/Executable/Temp/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/Temp/CMakeLists.txt @@ -3,6 +3,6 @@ # The 'complex' executable will then test if this file exists and remove it. # The contents of this file is not tested (absolute paths). # -OUTPUT_REQUIRED_FILES( - ${Complex_SOURCE_DIR}/Executable/complex.cxx - ${Complex_BINARY_DIR}/Executable/Temp/complex-required.txt) +output_required_files( + ${Complex_SOURCE_DIR}/Executable/complex.cxx + ${Complex_BINARY_DIR}/Executable/Temp/complex-required.txt) diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index 1901d9914..27d70adc8 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -33,7 +33,7 @@ int cm_failed = 0; void cmFailed(const char* Message, const char* m2= "", const char* m3 = "") { - std::cout << "FAILED: " << Message << m2 << m3 << "\n"; + std::cout << "FAILED: " << Message << m2 << m3 << "\n"; cm_failed++; } @@ -41,7 +41,7 @@ void cmFailed(const char* Message, const char* m2= "", const char* m3 = "") void cmPassed(const char* Message, const char* m2="") { - std::cout << "Passed: " << Message << m2 << "\n"; + std::cout << "Passed: " << Message << m2 << "\n"; cm_passed++; } @@ -67,7 +67,7 @@ void cmPassed(const char* Message, const char* m2="") // ====================================================================== -void TestAndRemoveFile(const char* filename) +void TestAndRemoveFile(const char* filename) { struct stat st; if(stat(filename, &st) < 0) @@ -89,7 +89,7 @@ void TestAndRemoveFile(const char* filename) // ====================================================================== -void TestDir(const char* filename) +void TestDir(const char* filename) { struct stat st; if(stat(filename, &st) < 0 || !S_ISDIR(st.st_mode)) @@ -113,7 +113,7 @@ void ForceStringUse() std::string cachetest = CACHE_TEST_VAR_INTERNAL; v.push_back(cachetest); v2 = v; - std::string x(5,'x'); + std::string x(5,'x'); char buff[5]; x.copy(buff, 1, 0); x[0] = 'a'; @@ -165,7 +165,7 @@ int main() #else cmPassed("COMPILE_FLAGS did work with SET_TARGET_PROPERTIES"); #endif - + #ifdef ELSEIF_RESULT cmPassed("ELSEIF did work"); #else @@ -228,8 +228,8 @@ int main() #else cmPassed("CMAKE_IS_FUN is defined."); #endif - -#if defined(CMAKE_ARGV1) && defined(CMAKE_ARGV2) && defined(CMAKE_ARGV3) && defined(CMAKE_ARGV4) + +#if defined(CMAKE_ARGV1) && defined(CMAKE_ARGV2) && defined(CMAKE_ARGV3) && defined(CMAKE_ARGV4) cmPassed("Variable args for MACROs are working."); #else cmFailed("Variable args for MACROs are failing."); @@ -250,7 +250,7 @@ int main() #else cmPassed("CMake found the parent directory properly"); #endif - + // ---------------------------------------------------------------------- // Test GET_DIRECTORY_PROPERTY for listfiles #ifndef CMAKE_FOUND_LISTFILE_STACK @@ -258,7 +258,7 @@ int main() #else cmPassed("CMake found the listfile stack properly"); #endif - + // ---------------------------------------------------------------------- // Test SET, VARIABLE_REQUIRES @@ -267,38 +267,38 @@ int main() #else cmPassed("SHOULD_NOT_BE_DEFINED is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED cmFailed("IF or SET is broken, SHOULD_BE_DEFINED is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED is defined."); #endif - + #ifndef ONE_VAR cmFailed("cmakedefine is broken, ONE_VAR is not defined."); #else cmPassed("ONE_VAR is defined."); #endif - + #ifndef ONE_VAR_IS_DEFINED cmFailed("cmakedefine, SET or VARIABLE_REQUIRES is broken, " "ONE_VAR_IS_DEFINED is not defined."); #else cmPassed("ONE_VAR_IS_DEFINED is defined."); #endif - + #ifdef ZERO_VAR cmFailed("cmakedefine is broken, ZERO_VAR is defined."); #else cmPassed("ZERO_VAR is not defined."); #endif - + #ifndef STRING_VAR cmFailed("the CONFIGURE_FILE command is broken, STRING_VAR is not defined."); #else if(strcmp(STRING_VAR, "CMake is great") != 0) { - cmFailed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ", + cmFailed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ", STRING_VAR); } else @@ -315,145 +315,145 @@ int main() #else cmPassed("SHOULD_NOT_BE_DEFINED_NOT is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_NOT cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_NOT is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_NOT2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_NOT2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_NOT2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_NOT2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_AND cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_AND is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_AND cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_AND is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_AND2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_AND2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_AND2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_AND2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_OR cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_OR is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_OR cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_OR is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_OR2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_OR2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_OR2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_OR2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_MATCHES cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_MATCHES is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_MATCHES cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_MATCHES is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_MATCHES2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_MATCHES2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_MATCHES2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_MATCHES2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_COMMAND cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_COMMAND cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_COMMAND is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_COMMAND2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_COMMAND2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_COMMAND2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_EXISTS cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EXISTS is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_EXISTS is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_EXISTS cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_EXISTS is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_EXISTS is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_EXISTS2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EXISTS2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_EXISTS2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_EXISTS2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_EXISTS2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_EXISTS2 is defined."); #endif - + #ifndef SHOULD_BE_DEFINED_IS_DIRECTORY cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_IS_DIRECTORY is not defined.\n"); #else @@ -471,31 +471,31 @@ int main() #else cmPassed("SHOULD_NOT_BE_DEFINED_LESS is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_LESS cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_LESS is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_LESS2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_LESS2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_LESS2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_LESS2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_GREATER cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_GREATER is not defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_EQUAL cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EQUAL is defined."); #else @@ -513,67 +513,67 @@ int main() #else cmPassed("SHOULD_BE_DEFINED_GREATER is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_GREATER2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_GREATER2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_GREATER2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_GREATER2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_STRLESS cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_STRLESS cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_STRLESS is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_STRLESS2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_STRLESS2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_STRLESS2 is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_STRGREATER cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_STRGREATER is defined."); #endif - + #ifdef SHOULD_NOT_BE_DEFINED_STRGREATER2 cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER2 is defined."); #else cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER2 is not defined."); #endif - + #ifndef SHOULD_BE_DEFINED_STRGREATER2 cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER2 is not defined.\n"); #else cmPassed("SHOULD_BE_DEFINED_STRGREATER2 is defined."); #endif - + // ---------------------------------------------------------------------- // Test FOREACH @@ -624,7 +624,7 @@ int main() // ---------------------------------------------------------------------- // Test WHILE - + if(WHILE_VALUE != 1000) { cmFailed("WHILE command is not working"); @@ -814,7 +814,7 @@ int main() // only created during a build. TestAndRemoveFile(BINARY_DIR "/Library/custom_target1.txt"); - + // ---------------------------------------------------------------------- // A directory has been created. @@ -890,7 +890,7 @@ int main() #else if(strcmp(FILE_COMPILE_FLAGS, "-foo -bar") != 0) { - cmFailed("the SET_SOURCE_FILES_PROPERTIES or CONFIGURE_FILE command is broken. FILE_COMPILE_FLAGS == ", + cmFailed("the SET_SOURCE_FILES_PROPERTIES or CONFIGURE_FILE command is broken. FILE_COMPILE_FLAGS == ", FILE_COMPILE_FLAGS); } else @@ -908,7 +908,7 @@ int main() std::cout << "REGISTRY_TEST_PATH == " << REGISTRY_TEST_PATH << "\n"; if(stricmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0) { - cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ", + cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ", REGISTRY_TEST_PATH, " is not " BINARY_DIR "/registry_dir"); } else @@ -937,7 +937,7 @@ int main() { cmFailed("REMOVE is not working"); } - + // ---------------------------------------------------------------------- // Test SEPARATE_ARGUMENTS if(strcmp("a;b;c", TEST_SEP) == 0) @@ -948,7 +948,7 @@ int main() { cmFailed("SEPARATE_ARGUMENTS is not working"); } - + // ---------------------------------------------------------------------- // Test Escape Quotes if(strcmp("\"hello world\"", STRING_WITH_QUOTES) == 0) @@ -959,8 +959,8 @@ int main() { cmFailed("ESCAPE_QUOTES is not working"); } - - + + // ---------------------------------------------------------------------- // Test if IF command inside a FOREACH works. #if defined(IF_INSIDE_FOREACH_THEN_EXECUTED) && !defined(IF_INSIDE_FOREACH_ELSE_EXECUTED) @@ -981,7 +981,7 @@ int main() else { cmFailed("cmakedefine01 is not working for 0"); - } + } if(SHOULD_BE_ONE == 1) { cmPassed("cmakedefine01 is working for 1"); @@ -989,7 +989,7 @@ int main() else { cmFailed("cmakedefine01 is not working for 1"); - } + } #ifdef FORCE_TEST cmFailed("CMake SET CACHE FORCE"); #else diff --git a/Tests/ComplexOneConfig/Executable/testcflags.c b/Tests/ComplexOneConfig/Executable/testcflags.c index f4d584844..6c2dd5db3 100644 --- a/Tests/ComplexOneConfig/Executable/testcflags.c +++ b/Tests/ComplexOneConfig/Executable/testcflags.c @@ -18,7 +18,7 @@ int TestCFlags(char* m) return 0; #endif /* TEST_C_FLAGS should be defined in a c file */ -#ifndef TEST_C_FLAGS +#ifndef TEST_C_FLAGS strcpy(m, "CMake CMAKE_C_FLAGS (TEST_C_FLAGS) not found in c file."); return 0; #endif diff --git a/Tests/ComplexOneConfig/Library/CMakeLists.txt b/Tests/ComplexOneConfig/Library/CMakeLists.txt index c8efc3022..5c430523e 100644 --- a/Tests/ComplexOneConfig/Library/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Library/CMakeLists.txt @@ -1,90 +1,90 @@ -REMOVE_DEFINITIONS(-DCMAKE_IS_REALLY_FUN) +remove_definitions(-DCMAKE_IS_REALLY_FUN) # # Small utility used to create file # UTILITY_SOURCE is used for coverage and for getting the exact name # of the executable. # -UTILITY_SOURCE(CREATE_FILE_EXE create_file "." create_file.cxx) -ADD_EXECUTABLE(create_file create_file.cxx) -SET_TARGET_PROPERTIES(create_file PROPERTIES RUNTIME_OUTPUT_DIRECTORY ".") +utility_source(CREATE_FILE_EXE create_file "." create_file.cxx) +add_executable(create_file create_file.cxx) +set_target_properties(create_file PROPERTIES RUNTIME_OUTPUT_DIRECTORY ".") # # Create static library # SOURCE_FILES_REMOVE is used for Coverage. empty.h is included for coverage # -AUX_SOURCE_DIRECTORY(ExtraSources LibrarySources) -SET(LibrarySources ${LibrarySources} - file2 - empty - create_file.cxx - GENERATED +aux_source_directory(ExtraSources LibrarySources) +set(LibrarySources ${LibrarySources} + file2 + empty + create_file.cxx + GENERATED nonexisting_file) -REMOVE(LibrarySources create_file.cxx GENERATED nonexisting_file) -ADD_LIBRARY(CMakeTestLibrary ${LibrarySources}) +remove(LibrarySources create_file.cxx GENERATED nonexisting_file) +add_library(CMakeTestLibrary ${LibrarySources}) -IF(WIN32) - IF(NOT CYGWIN) - IF(NOT BORLAND) - IF(NOT MINGW) - TARGET_LINK_LIBRARIES(CMakeTestLibrary - debug +if(WIN32) + if(NOT CYGWIN) + if(NOT BORLAND) + if(NOT MINGW) + target_link_libraries(CMakeTestLibrary + debug user32.lib) - TARGET_LINK_LIBRARIES(CMakeTestLibrary - optimized + target_link_libraries(CMakeTestLibrary + optimized kernel32.lib) - ENDIF(NOT MINGW) - ENDIF(NOT BORLAND) - ENDIF(NOT CYGWIN) -ENDIF(WIN32) + endif() + endif() + endif() +endif() # # Create shared library # -SET(SharedLibrarySources sharedFile) -ADD_LIBRARY(CMakeTestLibraryShared SHARED ${SharedLibrarySources}) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") -ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c) -DEFINE_PROPERTY( +set(SharedLibrarySources sharedFile) +add_library(CMakeTestLibraryShared SHARED ${SharedLibrarySources}) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") +add_library(CMakeTestCLibraryShared SHARED testConly.c) +define_property( TARGET PROPERTY FOO BRIEF_DOCS "a test property" FULL_DOCS "A simple etst proerty that means nothign and is used for nothing" ) -SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES FOO BAR) -IF(NOT BEOS AND NOT WIN32) # No libm on BeOS. - SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm") -ENDIF(NOT BEOS AND NOT WIN32) -GET_TARGET_PROPERTY(FOO_BAR_VAR CMakeTestCLibraryShared FOO) -IF(${FOO_BAR_VAR} MATCHES "BAR") -ELSE(${FOO_BAR_VAR} MATCHES "BAR") - MESSAGE(SEND_ERROR "SET_TARGET_PROPERTIES or GET_TARGET_PROPERTY failed, FOO_BAR_VAR should be BAR, but is ${FOO_BAR_VAR}") -ENDIF(${FOO_BAR_VAR} MATCHES "BAR") +set_target_properties(CMakeTestCLibraryShared PROPERTIES FOO BAR) +if(NOT BEOS AND NOT WIN32) # No libm on BeOS. + set_target_properties(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm") +endif() +get_target_property(FOO_BAR_VAR CMakeTestCLibraryShared FOO) +if(${FOO_BAR_VAR} MATCHES "BAR") +else() + message(SEND_ERROR "SET_TARGET_PROPERTIES or GET_TARGET_PROPERTY failed, FOO_BAR_VAR should be BAR, but is ${FOO_BAR_VAR}") +endif() # Create static and shared lib of same name. -IF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) - ADD_LIBRARY(CMakeTestLinkStatic STATIC TestLink.c) - ADD_LIBRARY(CMakeTestLinkShared SHARED TestLink.c) - SET_TARGET_PROPERTIES(CMakeTestLinkStatic CMakeTestLinkShared +if(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) + add_library(CMakeTestLinkStatic STATIC TestLink.c) + add_library(CMakeTestLinkShared SHARED TestLink.c) + set_target_properties(CMakeTestLinkStatic CMakeTestLinkShared PROPERTIES OUTPUT_NAME CMakeTestLink) -ENDIF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) +endif() # # Attach pre-build/pre-link/post-build custom-commands to the lib. # Each runs ${CREATE_FILE_EXE} which will create a file. # The 'complex' executable will then test if this file exists and remove it. # -ADD_DEPENDENCIES(CMakeTestLibraryShared create_file) -MESSAGE("complex bin dir is ${Complex_BINARY_DIR}") -ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared PRE_BUILD +add_dependencies(CMakeTestLibraryShared create_file) +message("complex bin dir is ${Complex_BINARY_DIR}") +add_custom_command(TARGET CMakeTestLibraryShared PRE_BUILD COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Library/prebuild.txt") -ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared PRE_BUILD +add_custom_command(TARGET CMakeTestLibraryShared PRE_BUILD COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Library/prelink.txt") -ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared POST_BUILD +add_custom_command(TARGET CMakeTestLibraryShared POST_BUILD COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Library/postbuild.txt") -ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared POST_BUILD +add_custom_command(TARGET CMakeTestLibraryShared POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy "${Complex_BINARY_DIR}/Library/postbuild.txt" @@ -95,46 +95,46 @@ ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared POST_BUILD # It runs ${CREATE_FILE_EXE} which will create a file. # The 'complex' executable will then test if this file exists and remove it. # -ADD_CUSTOM_TARGET(custom_target1 +add_custom_target(custom_target1 ALL - ${CREATE_FILE_EXE} + ${CREATE_FILE_EXE} "${Complex_BINARY_DIR}/Library/custom_target1.txt") -ADD_DEPENDENCIES(custom_target1 create_file) +add_dependencies(custom_target1 create_file) # # Extra coverage # -SET_SOURCE_FILES_PROPERTIES(file2 PROPERTIES ABSTRACT 1) +set_source_files_properties(file2 PROPERTIES ABSTRACT 1) -INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h) -INSTALL_FILES(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h) +install_files(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h) +install_files(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h) # Test creating a library that is not built by default. -ADD_LIBRARY(notInAllLib EXCLUDE_FROM_ALL notInAllLib.cxx) +add_library(notInAllLib EXCLUDE_FROM_ALL notInAllLib.cxx) # Create an imported target for if(TARGET) test in Executable dir. # That test should not see this target. -ADD_LIBRARY(LibImportedTarget UNKNOWN IMPORTED) +add_library(LibImportedTarget UNKNOWN IMPORTED) # Test generation of preprocessed sources. -IF("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM) - IF(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE) +if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM) + if(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE) # Skip running this part of the test on certain platforms # until they are fixed. - SET(MAYBE_ALL ALL) - LIST(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_COUNT) - IF(ARCH_COUNT GREATER 1) + set(MAYBE_ALL ALL) + list(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_COUNT) + if(ARCH_COUNT GREATER 1) # OSX does not support preprocessing more than one architecture. - SET(MAYBE_ALL) - ENDIF(ARCH_COUNT GREATER 1) + set(MAYBE_ALL) + endif() # Custom target to try preprocessing invocation. - ADD_CUSTOM_TARGET(test_preprocess ${MAYBE_ALL} + add_custom_target(test_preprocess ${MAYBE_ALL} COMMAND ${CMAKE_COMMAND} -E remove CMakeFiles/create_file.dir/create_file.i COMMAND ${CMAKE_MAKE_PROGRAM} create_file.i COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_preprocess.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) - ENDIF(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE) -ENDIF("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM) + endif() +endif() diff --git a/Tests/ComplexOneConfig/Library/create_file.cxx b/Tests/ComplexOneConfig/Library/create_file.cxx index d41551980..050ed0bac 100644 --- a/Tests/ComplexOneConfig/Library/create_file.cxx +++ b/Tests/ComplexOneConfig/Library/create_file.cxx @@ -8,7 +8,7 @@ int main (int argc, char *argv[]) fprintf(stderr, "Missing name of file to create.\n"); return EXIT_FAILURE; } - + FILE *stream = fopen(argv[1], "w"); if(stream == NULL) { @@ -23,6 +23,6 @@ int main (int argc, char *argv[]) } fprintf(stdout, ">> Creating %s!\n", argv[1]); - + return EXIT_SUCCESS; } diff --git a/Tests/ComplexOneConfig/Library/testConly.c b/Tests/ComplexOneConfig/Library/testConly.c index 2d83f778e..a7d20b0b5 100644 --- a/Tests/ComplexOneConfig/Library/testConly.c +++ b/Tests/ComplexOneConfig/Library/testConly.c @@ -7,7 +7,7 @@ int CsharedFunction() printf("TEST_C_FLAGS failed\n"); return 0; #else - printf("Passed: TEST_C_FLAGS passed\n"); -#endif + printf("Passed: TEST_C_FLAGS passed\n"); +#endif return 1; } diff --git a/Tests/ComplexOneConfig/Library/testConly.h b/Tests/ComplexOneConfig/Library/testConly.h index f1470a8d7..ba8458923 100644 --- a/Tests/ComplexOneConfig/Library/testConly.h +++ b/Tests/ComplexOneConfig/Library/testConly.h @@ -10,4 +10,4 @@ #endif CMakeTest_EXPORT int CsharedFunction(); - + diff --git a/Tests/ComplexOneConfig/Library/test_preprocess.cmake b/Tests/ComplexOneConfig/Library/test_preprocess.cmake index d2d9fc652..4c8ec2174 100644 --- a/Tests/ComplexOneConfig/Library/test_preprocess.cmake +++ b/Tests/ComplexOneConfig/Library/test_preprocess.cmake @@ -1,7 +1,7 @@ -SET(TEST_FILE CMakeFiles/create_file.dir/create_file.i) -FILE(READ ${TEST_FILE} CONTENTS) -IF("${CONTENTS}" MATCHES "Unable to close") - MESSAGE(STATUS "${TEST_FILE} created successfully!") -ELSE("${CONTENTS}" MATCHES "Unable to close") - MESSAGE(FATAL_ERROR "${TEST_FILE} creation failed!") -ENDIF("${CONTENTS}" MATCHES "Unable to close") +set(TEST_FILE CMakeFiles/create_file.dir/create_file.i) +file(READ ${TEST_FILE} CONTENTS) +if("${CONTENTS}" MATCHES "Unable to close") + message(STATUS "${TEST_FILE} created successfully!") +else() + message(FATAL_ERROR "${TEST_FILE} creation failed!") +endif() diff --git a/Tests/ComplexOneConfig/VarTests.cmake b/Tests/ComplexOneConfig/VarTests.cmake index c146d1be0..52ec1fc8e 100644 --- a/Tests/ComplexOneConfig/VarTests.cmake +++ b/Tests/ComplexOneConfig/VarTests.cmake @@ -1,198 +1,198 @@ # # Test SET # -SET (ZERO_VAR 0) -SET (ZERO_VAR2 0) +set (ZERO_VAR 0) +set (ZERO_VAR2 0) -IF(ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED) -ELSE(ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED) -ENDIF(ZERO_VAR) +if(ZERO_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED) +else() + add_definitions(-DSHOULD_BE_DEFINED) +endif() -SET(ONE_VAR 1) -SET(ONE_VAR2 1) -SET(STRING_VAR "CMake is great" CACHE STRING "test a cache variable") +set(ONE_VAR 1) +set(ONE_VAR2 1) +set(STRING_VAR "CMake is great" CACHE STRING "test a cache variable") # # Test VARIABLE_REQUIRES # -VARIABLE_REQUIRES(ONE_VAR +variable_requires(ONE_VAR ONE_VAR_IS_DEFINED ONE_VAR) # # Test various IF/ELSE combinations # -IF(NOT ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT) -ELSE(NOT ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT) -ENDIF(NOT ZERO_VAR) - -IF(NOT ONE_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT2) -ELSE(NOT ONE_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT2) -ENDIF(NOT ONE_VAR) - -IF(ONE_VAR AND ONE_VAR2) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND) -ELSE(ONE_VAR AND ONE_VAR2) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND) -ENDIF(ONE_VAR AND ONE_VAR2) - -IF(ONE_VAR AND ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND2) -ELSE(ONE_VAR AND ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND2) -ENDIF(ONE_VAR AND ZERO_VAR) - -IF(ZERO_VAR OR ONE_VAR2) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR) -ELSE(ZERO_VAR OR ONE_VAR2) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR) -ENDIF(ZERO_VAR OR ONE_VAR2) - -IF(ZERO_VAR OR ZERO_VAR2) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR2) -ELSE(ZERO_VAR OR ZERO_VAR2) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR2) -ENDIF(ZERO_VAR OR ZERO_VAR2) - -IF(STRING_VAR MATCHES "^CMake") - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES) -ELSE(STRING_VAR MATCHES "^CMake") - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES) -ENDIF(STRING_VAR MATCHES "^CMake") - -IF(STRING_VAR MATCHES "^foo") - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES2) -ELSE(STRING_VAR MATCHES "^foo") - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES2) -ENDIF(STRING_VAR MATCHES "^foo") - -IF(COMMAND "IF") - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND) -ELSE(COMMAND "IF") - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND) -ENDIF(COMMAND "IF") - -IF(COMMAND "ROQUEFORT") - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND2) -ELSE(COMMAND "ROQUEFORT") - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND2) -ENDIF(COMMAND "ROQUEFORT") - -IF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EXISTS) -ELSE(EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_EXISTS) -ENDIF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) - -IF (EXISTS ${Complex_SOURCE_DIR}/roquefort.txt) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_EXISTS2) -ELSE(EXISTS ${Complex_SOURCE_DIR}/roquefort.txt) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EXISTS2) -ENDIF (EXISTS ${Complex_SOURCE_DIR}/roquefort.txt) - -IF (IS_DIRECTORY ${Complex_SOURCE_DIR}) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_IS_DIRECTORY) -ENDIF (IS_DIRECTORY ${Complex_SOURCE_DIR}) - -IF (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_IS_DIRECTORY2) -ENDIF (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake) - -SET (SNUM1_VAR "1") -SET (SNUM2_VAR "2") -SET (SNUM3_VAR "1") - - -IF (SNUM1_VAR LESS SNUM2_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_LESS) -ELSE (SNUM1_VAR LESS SNUM2_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_LESS) -ENDIF (SNUM1_VAR LESS SNUM2_VAR) - -IF (SNUM2_VAR LESS SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_LESS2) -ELSE (SNUM2_VAR LESS SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_LESS2) -ENDIF (SNUM2_VAR LESS SNUM1_VAR) - -IF (SNUM2_VAR GREATER SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_GREATER) -ELSE (SNUM2_VAR GREATER SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_GREATER) -ENDIF (SNUM2_VAR GREATER SNUM1_VAR) - -IF (SNUM2_VAR EQUAL SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_EQUAL) -ELSE (SNUM2_VAR EQUAL SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EQUAL) -ENDIF (SNUM2_VAR EQUAL SNUM1_VAR) - -IF (SNUM3_VAR EQUAL SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EQUAL) -ELSE (SNUM3_VAR EQUAL SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_EQUAL) -ENDIF (SNUM3_VAR EQUAL SNUM1_VAR) - -IF (SNUM1_VAR GREATER SNUM2_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_GREATER2) -ELSE (SNUM1_VAR GREATER SNUM2_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_GREATER2) -ENDIF (SNUM1_VAR GREATER SNUM2_VAR) - -SET (SSTR1_VAR "abc") -SET (SSTR2_VAR "bcd") - -IF (SSTR1_VAR STRLESS SSTR2_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_STRLESS) -ELSE (SSTR1_VAR STRLESS SSTR2_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_STRLESS) -ENDIF (SSTR1_VAR STRLESS SSTR2_VAR) - -IF (SSTR2_VAR STRLESS SSTR1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_STRLESS2) -ELSE (SSTR2_VAR STRLESS SSTR1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_STRLESS2) -ENDIF (SSTR2_VAR STRLESS SSTR1_VAR) - -IF (SSTR2_VAR STRGREATER SSTR1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_STRGREATER) -ELSE (SSTR2_VAR STRGREATER SSTR1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_STRGREATER) -ENDIF (SSTR2_VAR STRGREATER SSTR1_VAR) - -IF (SSTR1_VAR STRGREATER SSTR2_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_STRGREATER2) -ELSE (SSTR1_VAR STRGREATER SSTR2_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_STRGREATER2) -ENDIF (SSTR1_VAR STRGREATER SSTR2_VAR) +if(NOT ZERO_VAR) + add_definitions(-DSHOULD_BE_DEFINED_NOT) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_NOT) +endif() + +if(NOT ONE_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_NOT2) +else() + add_definitions(-DSHOULD_BE_DEFINED_NOT2) +endif() + +if(ONE_VAR AND ONE_VAR2) + add_definitions(-DSHOULD_BE_DEFINED_AND) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_AND) +endif() + +if(ONE_VAR AND ZERO_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_AND2) +else() + add_definitions(-DSHOULD_BE_DEFINED_AND2) +endif() + +if(ZERO_VAR OR ONE_VAR2) + add_definitions(-DSHOULD_BE_DEFINED_OR) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_OR) +endif() + +if(ZERO_VAR OR ZERO_VAR2) + add_definitions(-DSHOULD_NOT_BE_DEFINED_OR2) +else() + add_definitions(-DSHOULD_BE_DEFINED_OR2) +endif() + +if(STRING_VAR MATCHES "^CMake") + add_definitions(-DSHOULD_BE_DEFINED_MATCHES) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_MATCHES) +endif() + +if(STRING_VAR MATCHES "^foo") + add_definitions(-DSHOULD_NOT_BE_DEFINED_MATCHES2) +else() + add_definitions(-DSHOULD_BE_DEFINED_MATCHES2) +endif() + +if(COMMAND "IF") + add_definitions(-DSHOULD_BE_DEFINED_COMMAND) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_COMMAND) +endif() + +if(COMMAND "ROQUEFORT") + add_definitions(-DSHOULD_NOT_BE_DEFINED_COMMAND2) +else() + add_definitions(-DSHOULD_BE_DEFINED_COMMAND2) +endif() + +if (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) + add_definitions(-DSHOULD_BE_DEFINED_EXISTS) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_EXISTS) +endif () + +if (EXISTS ${Complex_SOURCE_DIR}/roquefort.txt) + add_definitions(-DSHOULD_NOT_BE_DEFINED_EXISTS2) +else() + add_definitions(-DSHOULD_BE_DEFINED_EXISTS2) +endif () + +if (IS_DIRECTORY ${Complex_SOURCE_DIR}) + add_definitions(-DSHOULD_BE_DEFINED_IS_DIRECTORY) +endif () + +if (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake) + add_definitions(-DSHOULD_BE_DEFINED_IS_DIRECTORY2) +endif () + +set (SNUM1_VAR "1") +set (SNUM2_VAR "2") +set (SNUM3_VAR "1") + + +if (SNUM1_VAR LESS SNUM2_VAR) + add_definitions(-DSHOULD_BE_DEFINED_LESS) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_LESS) +endif () + +if (SNUM2_VAR LESS SNUM1_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_LESS2) +else () + add_definitions(-DSHOULD_BE_DEFINED_LESS2) +endif () + +if (SNUM2_VAR GREATER SNUM1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_GREATER) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER) +endif () + +if (SNUM2_VAR EQUAL SNUM1_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_EQUAL) +else () + add_definitions(-DSHOULD_BE_DEFINED_EQUAL) +endif () + +if (SNUM3_VAR EQUAL SNUM1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_EQUAL) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_EQUAL) +endif () + +if (SNUM1_VAR GREATER SNUM2_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER2) +else () + add_definitions(-DSHOULD_BE_DEFINED_GREATER2) +endif () + +set (SSTR1_VAR "abc") +set (SSTR2_VAR "bcd") + +if (SSTR1_VAR STRLESS SSTR2_VAR) + add_definitions(-DSHOULD_BE_DEFINED_STRLESS) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS) +endif () + +if (SSTR2_VAR STRLESS SSTR1_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS2) +else () + add_definitions(-DSHOULD_BE_DEFINED_STRLESS2) +endif () + +if (SSTR2_VAR STRGREATER SSTR1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_STRGREATER) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER) +endif () + +if (SSTR1_VAR STRGREATER SSTR2_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER2) +else () + add_definitions(-DSHOULD_BE_DEFINED_STRGREATER2) +endif () # # Test FOREACH # -FOREACH (INDEX 1 2) - SET(FOREACH_VAR${INDEX} "VALUE${INDEX}") -ENDFOREACH(INDEX) +foreach (INDEX 1 2) + set(FOREACH_VAR${INDEX} "VALUE${INDEX}") +endforeach() -SET(FOREACH_CONCAT "") -FOREACH (INDEX a;b;c;d;e;f;g) - SET(FOREACH_CONCAT "${FOREACH_CONCAT}${INDEX}") -ENDFOREACH(INDEX) +set(FOREACH_CONCAT "") +foreach (INDEX a;b;c;d;e;f;g) + set(FOREACH_CONCAT "${FOREACH_CONCAT}${INDEX}") +endforeach() # # Test FIND_FILE, FIND_PATH and various GET_FILENAME_COMPONENT combinations # -FIND_FILE(FILENAME_VAR "VarTests.cmake" ${Complex_SOURCE_DIR}) +find_file(FILENAME_VAR "VarTests.cmake" ${Complex_SOURCE_DIR}) -GET_FILENAME_COMPONENT(FILENAME_VAR_PATH ${FILENAME_VAR} PATH) -GET_FILENAME_COMPONENT(FILENAME_VAR_PATH_NAME ${FILENAME_VAR_PATH} NAME) -GET_FILENAME_COMPONENT(FILENAME_VAR_NAME ${FILENAME_VAR} NAME) -GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT) -GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE CACHE) +get_filename_component(FILENAME_VAR_PATH ${FILENAME_VAR} PATH) +get_filename_component(FILENAME_VAR_PATH_NAME ${FILENAME_VAR_PATH} NAME) +get_filename_component(FILENAME_VAR_NAME ${FILENAME_VAR} NAME) +get_filename_component(FILENAME_VAR_EXT ${FILENAME_VAR} EXT) +get_filename_component(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE CACHE) -FIND_PATH(PATH_VAR "cmTestConfigure.h.in" ${Complex_SOURCE_DIR}) -GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME) +find_path(PATH_VAR "cmTestConfigure.h.in" ${Complex_SOURCE_DIR}) +get_filename_component(PATH_VAR_NAME ${PATH_VAR} NAME) diff --git a/Tests/Contracts/Trilinos-10-6/Patch.cmake b/Tests/Contracts/Trilinos-10-6/Patch.cmake index 76051eb98..6c619ac4f 100644 --- a/Tests/Contracts/Trilinos-10-6/Patch.cmake +++ b/Tests/Contracts/Trilinos-10-6/Patch.cmake @@ -14,8 +14,8 @@ set(text " # options to avoid CMake warnings about unused variables # -MESSAGE(\"Trilinos_ALLOW_NO_PACKAGES='\${Trilinos_ALLOW_NO_PACKAGES}'\") -MESSAGE(\"Trilinos_WARNINGS_AS_ERRORS_FLAGS='\${Trilinos_WARNINGS_AS_ERRORS_FLAGS}'\") +message(\"Trilinos_ALLOW_NO_PACKAGES='\${Trilinos_ALLOW_NO_PACKAGES}'\") +message(\"Trilinos_WARNINGS_AS_ERRORS_FLAGS='\${Trilinos_WARNINGS_AS_ERRORS_FLAGS}'\") ") file(APPEND "${source_dir}/CMakeLists.txt" "${text}") @@ -31,8 +31,8 @@ set(text " # Use newer than 10.6.1 CTestConfig settings from the Trilinos project. # Send the Trilinos dashboards to the new Trilinos CDash server instance. # -SET(CTEST_NIGHTLY_START_TIME \"04:00:00 UTC\") # 10 PM MDT or 9 PM MST -SET(CTEST_DROP_SITE \"testing.sandia.gov\") +set(CTEST_NIGHTLY_START_TIME \"04:00:00 UTC\") # 10 PM MDT or 9 PM MST +set(CTEST_DROP_SITE \"testing.sandia.gov\") ") file(APPEND "${source_dir}/CTestConfig.cmake" "${text}") diff --git a/Tests/Contracts/vtk542/RunTest.cmake b/Tests/Contracts/vtk542/RunTest.cmake index 4f48e5cd2..b4bd5b087 100644 --- a/Tests/Contracts/vtk542/RunTest.cmake +++ b/Tests/Contracts/vtk542/RunTest.cmake @@ -1 +1 @@ -SET(vtk542_RUN_TEST VTK-build/bin/CommonCxxTests otherArrays) +set(vtk542_RUN_TEST VTK-build/bin/CommonCxxTests otherArrays) diff --git a/Tests/CrossCompile/CMakeLists.txt b/Tests/CrossCompile/CMakeLists.txt index 96a57a051..121cb815e 100644 --- a/Tests/CrossCompile/CMakeLists.txt +++ b/Tests/CrossCompile/CMakeLists.txt @@ -1,13 +1,13 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(CrossCompile) +project(CrossCompile) -UNSET(run_result CACHE) +unset(run_result CACHE) #Simulate the cross compile condition -SET(CMAKE_CROSSCOMPILING ON) +set(CMAKE_CROSSCOMPILING ON) -ADD_EXECUTABLE(CrossCompile main.c) +add_executable(CrossCompile main.c) -TRY_RUN(run_result compile_result - ${CrossCompile_BINARY_DIR} +try_run(run_result compile_result + ${CrossCompile_BINARY_DIR} ${CrossCompile_SOURCE_DIR}/main.c) diff --git a/Tests/CustComDepend/CMakeLists.txt b/Tests/CustComDepend/CMakeLists.txt index d5266842d..46276b2ef 100644 --- a/Tests/CustComDepend/CMakeLists.txt +++ b/Tests/CustComDepend/CMakeLists.txt @@ -10,5 +10,5 @@ add_custom_command( ${CustComDepend_BINARY_DIR}/bar.c DEPENDS ${CustComDepend_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/foo ) - + add_library(bar SHARED ${CustComDepend_BINARY_DIR}/bar.c) diff --git a/Tests/CustComDepend/bar.h b/Tests/CustComDepend/bar.h index d462c9b5b..d17946428 100644 --- a/Tests/CustComDepend/bar.h +++ b/Tests/CustComDepend/bar.h @@ -5,5 +5,5 @@ # define BAR_EXPORT __declspec( dllimport ) # endif #else -# define BAR_EXPORT +# define BAR_EXPORT #endif diff --git a/Tests/CustComDepend/foo.cxx b/Tests/CustComDepend/foo.cxx index 3c204f8a2..19dfcb143 100644 --- a/Tests/CustComDepend/foo.cxx +++ b/Tests/CustComDepend/foo.cxx @@ -12,4 +12,4 @@ int main(int ac, char** av) fclose(fout); return 0; } - + diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index b7c9ea268..d3ced3ff9 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -2,22 +2,22 @@ # Wrapping # cmake_minimum_required (VERSION 2.6) -PROJECT (CustomCommand) +project (CustomCommand) -ADD_SUBDIRECTORY(GeneratedHeader) +add_subdirectory(GeneratedHeader) # # Lib and exe path # -IF(NOT DEFINED bin_dir) - SET(bin_dir "bin") -ENDIF() +if(NOT DEFINED bin_dir) + set(bin_dir "bin") +endif() -SET (LIBRARY_OUTPUT_PATH +set (LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${bin_dir} CACHE INTERNAL "Single output directory for building all libraries.") -SET (EXECUTABLE_OUTPUT_PATH +set (EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${bin_dir} CACHE INTERNAL "Single output directory for building all executables.") @@ -27,10 +27,10 @@ SET (EXECUTABLE_OUTPUT_PATH # ################################################################ # add the executable that will generate the file -ADD_EXECUTABLE(generator generator.cxx) +add_executable(generator generator.cxx) -GET_TARGET_PROPERTY(generator_PATH generator LOCATION) -MESSAGE("Location ${generator_PATH}") +get_target_property(generator_PATH generator LOCATION) +message("Location ${generator_PATH}") ################################################################ # @@ -38,9 +38,9 @@ MESSAGE("Location ${generator_PATH}") # ################################################################ # add the executable that will generate the file -ADD_EXECUTABLE(wrapper wrapper.cxx) +add_executable(wrapper wrapper.cxx) -ADD_CUSTOM_COMMAND( +add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/wrapped.c ${PROJECT_BINARY_DIR}/wrapped_help.c DEPENDS wrapper MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/wrapped.h @@ -55,19 +55,19 @@ ADD_CUSTOM_COMMAND( # Test creating files from a custom target # ################################################################ -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}//doc1.dvi # test 2 slashes - DEPENDS ${PROJECT_SOURCE_DIR}/doc1.tex - COMMAND ${CMAKE_COMMAND} - ARGS -E copy ${PROJECT_SOURCE_DIR}/doc1.tex +add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}//doc1.dvi # test 2 slashes + DEPENDS ${PROJECT_SOURCE_DIR}/doc1.tex + COMMAND ${CMAKE_COMMAND} + ARGS -E copy ${PROJECT_SOURCE_DIR}/doc1.tex ${PROJECT_BINARY_DIR}/doc1.dvi ) -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h +add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1.dvi to doc1temp.h." COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1.dvi ${PROJECT_BINARY_DIR}/doc1temp.h ) -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h APPEND +add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h APPEND DEPENDS ${PROJECT_BINARY_DIR}/doc1.dvi COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1temp.h to doc1.h." COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1temp.h @@ -77,7 +77,7 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h APPEND ) # Add custom command to generate foo.h. -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.h +add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/foo.h DEPENDS ${PROJECT_SOURCE_DIR}/foo.h.in COMMAND ${CMAKE_COMMAND} -E echo " Copying foo.h.in to foo.h." COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/foo.h.in @@ -85,12 +85,12 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.h ) # Add the location of foo.h to the include path. -INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) +include_directories(${PROJECT_BINARY_DIR}) # Test generation of a file to the build tree without full path. As # of CMake 2.6 custom command outputs specified by relative path go in # the build tree. -ADD_CUSTOM_COMMAND( +add_custom_command( OUTPUT doc1.txt COMMAND ${CMAKE_COMMAND} -E echo "Example Document Target" > doc1.txt DEPENDS doc1.tex @@ -98,7 +98,7 @@ ADD_CUSTOM_COMMAND( ) # Add a custom target to drive generation of doc1.h. -ADD_CUSTOM_TARGET(TDocument ALL +add_custom_target(TDocument ALL COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1.h to doc2.h." COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1.h ${PROJECT_BINARY_DIR}/doc2.h @@ -109,13 +109,13 @@ ADD_CUSTOM_TARGET(TDocument ALL # Setup a pre- and post-build pair that will fail if not run in the # proper order. -ADD_CUSTOM_COMMAND( +add_custom_command( TARGET TDocument PRE_BUILD COMMAND ${CMAKE_COMMAND} -E echo " Writing doc1pre.txt." COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/doc1.tex ${PROJECT_BINARY_DIR}/doc1pre.txt COMMENT "Running TDocument pre-build commands" ) -ADD_CUSTOM_COMMAND( +add_custom_command( TARGET TDocument POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1pre.txt to doc2post.txt." COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1pre.txt @@ -128,16 +128,16 @@ ADD_CUSTOM_COMMAND( # Test using a multistep generated file # ################################################################ -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.pre +add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/foo.pre DEPENDS ${PROJECT_SOURCE_DIR}/foo.in TDocument # Ensure doc1.h generates before this target - COMMAND ${CMAKE_COMMAND} - ARGS -E copy ${PROJECT_SOURCE_DIR}/foo.in + COMMAND ${CMAKE_COMMAND} + ARGS -E copy ${PROJECT_SOURCE_DIR}/foo.in ${PROJECT_BINARY_DIR}/foo.pre ) -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.c - DEPENDS ${PROJECT_BINARY_DIR}/foo.pre +add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/foo.c + DEPENDS ${PROJECT_BINARY_DIR}/foo.pre COMMAND ${CMAKE_COMMAND} ARGS -E copy ${PROJECT_BINARY_DIR}/foo.pre ${PROJECT_BINARY_DIR}/foo.c @@ -147,21 +147,21 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.c # file that is not included by any source in this project. This will # test whether all custom command outputs explicitly listed as sources # get generated even if they are not needed by an object file. -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/not_included.h +add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/not_included.h DEPENDS ${PROJECT_SOURCE_DIR}/foo.h.in COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/foo.h.in ${PROJECT_BINARY_DIR}/not_included.h ) # Tell the executable where to find not_included.h. -CONFIGURE_FILE( +configure_file( ${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h @ONLY IMMEDIATE ) # add the executable -ADD_EXECUTABLE(CustomCommand +add_executable(CustomCommand ${PROJECT_BINARY_DIR}/foo.h ${PROJECT_BINARY_DIR}/foo.c ${PROJECT_BINARY_DIR}/wrapped.c @@ -174,44 +174,44 @@ ADD_EXECUTABLE(CustomCommand # Add the rule to create generated.c at build time. This is placed # here to test adding the generation rule after referencing the # generated source in a target. -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/generated.c +add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/generated.c DEPENDS generator COMMAND ${generator_PATH} ARGS ${PROJECT_BINARY_DIR}/generated.c ) -TARGET_LINK_LIBRARIES(CustomCommand GeneratedHeader) +target_link_libraries(CustomCommand GeneratedHeader) ############################################################################## # Test for using just the target name as executable in the COMMAND # section. Has to be recognized and replaced by CMake with the output # actual location of the executable. -# Additionally the generator is created in an extra subdir after the -# ADD_CUSTOM_COMMAND() is used. +# Additionally the generator is created in an extra subdir after the +# add_custom_command() is used. # -# Test the same for ADD_CUSTOM_TARGET() +# Test the same for add_custom_target() -ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx COMMAND generator_extern ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx ) -ADD_EXECUTABLE(CustomCommandUsingTargetTest main.cxx ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx ) +add_executable(CustomCommandUsingTargetTest main.cxx ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx ) -ADD_CUSTOM_TARGET(RunTarget +add_custom_target(RunTarget COMMAND generator_extern ${CMAKE_CURRENT_BINARY_DIR}/run_target.cxx ) -ADD_CUSTOM_COMMAND(TARGET CustomCommandUsingTargetTest POST_BUILD +add_custom_command(TARGET CustomCommandUsingTargetTest POST_BUILD COMMAND dummy_generator ${CMAKE_CURRENT_BINARY_DIR}/generated_dummy.cxx) -ADD_SUBDIRECTORY(GeneratorInExtraDir) +add_subdirectory(GeneratorInExtraDir) ############################################################################## # Test shell operators in custom commands. -ADD_EXECUTABLE(tcat tcat.cxx) +add_executable(tcat tcat.cxx) -ADD_CUSTOM_COMMAND(OUTPUT gen_redirect.c +add_custom_command(OUTPUT gen_redirect.c DEPENDS tcat gen_redirect_in.c COMMAND tcat < ${CMAKE_CURRENT_SOURCE_DIR}/gen_redirect_in.c > gen_redirect.c COMMAND ${CMAKE_COMMAND} -E echo "#endif" >> gen_redirect.c @@ -220,12 +220,12 @@ ADD_CUSTOM_COMMAND(OUTPUT gen_redirect.c ############################################################################## # Test non-trivial command line arguments in custom commands. -SET(EXPECTED_ARGUMENTS) -SET(CHECK_ARGS) -IF(NOT MSVC71) - SET(CHECK_ARGS -DPATH=c:/posix/path) -ENDIF() -SET(CHECK_ARGS +set(EXPECTED_ARGUMENTS) +set(CHECK_ARGS) +if(NOT MSVC71) + set(CHECK_ARGS -DPATH=c:/posix/path) +endif() +set(CHECK_ARGS ${CHECK_ARGS} c:/posix/path c:\\windows\\path @@ -333,11 +333,11 @@ SET(CHECK_ARGS "one#pound w s" ~ ` ! @ \# $ % ^ & _ - + = : "\;" \" ' , . ? "(" ")" { } [] ) -IF(NOT MINGW) +if(NOT MINGW) # * # MinGW programs on windows always expands the wildcard! # / # MSys make converts a leading slash to the mingw home directory - LIST(APPEND CHECK_ARGS * /) -ENDIF(NOT MINGW) + list(APPEND CHECK_ARGS * /) +endif() # The windows command shell does not support a double quote by itself: # double\"quote @@ -352,25 +352,25 @@ ENDIF(NOT MINGW) # | < > << >> &> 2>&1 1>&2 # to allow custom commands to perform redirection. -FOREACH(arg ${CHECK_ARGS} "") - SET(ARG "${arg}") - STRING(REGEX REPLACE "\\\\" "\\\\\\\\" ARG "${ARG}") - STRING(REGEX REPLACE "\"" "\\\\\"" ARG "${ARG}") - SET(EXPECTED_ARGUMENTS +foreach(arg ${CHECK_ARGS} "") + set(ARG "${arg}") + string(REGEX REPLACE "\\\\" "\\\\\\\\" ARG "${ARG}") + string(REGEX REPLACE "\"" "\\\\\"" ARG "${ARG}") + set(EXPECTED_ARGUMENTS "${EXPECTED_ARGUMENTS} \"${ARG}\", ") -ENDFOREACH(arg) -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/check_command_line.c.in +endforeach() +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/check_command_line.c.in ${CMAKE_CURRENT_BINARY_DIR}/check_command_line.c @ONLY IMMEDIATE) -ADD_EXECUTABLE(check_command_line +add_executable(check_command_line ${CMAKE_CURRENT_BINARY_DIR}/check_command_line.c) -SET(output_name "check_command_line") -SET_PROPERTY(TARGET check_command_line +set(output_name "check_command_line") +set_property(TARGET check_command_line PROPERTY OUTPUT_NAME ${output_name}) -# SET_TARGET_PROPERTIES(check_command_line PROPERTIES +# set_target_properties(check_command_line PROPERTIES # COMPILE_FLAGS -DCHECK_COMMAND_LINE_VERBOSE) -ADD_CUSTOM_COMMAND( +add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/command_line_check COMMAND ${CMAKE_COMMAND} -DMARK_FILE=${CMAKE_CURRENT_BINARY_DIR}/check_mark.txt -P ${CMAKE_CURRENT_SOURCE_DIR}/check_mark.cmake @@ -379,9 +379,9 @@ ADD_CUSTOM_COMMAND( VERBATIM COMMENT "Checking custom command line escapes (single'quote)" ) -SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/command_line_check +set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/command_line_check PROPERTIES SYMBOLIC 1) -ADD_CUSTOM_TARGET(do_check_command_line ALL +add_custom_target(do_check_command_line ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/command_line_check COMMAND ${CMAKE_COMMAND} -E echo "Checking custom target command escapes" COMMAND ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/${output_name} @@ -389,12 +389,12 @@ ADD_CUSTOM_TARGET(do_check_command_line ALL VERBATIM COMMENT "Checking custom target command line escapes ($dollar-signs$)" ) -ADD_DEPENDENCIES(do_check_command_line check_command_line) +add_dependencies(do_check_command_line check_command_line) -ADD_CUSTOM_TARGET(pre_check_command_line +add_custom_target(pre_check_command_line COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/check_mark.txt ) -ADD_DEPENDENCIES(do_check_command_line pre_check_command_line) +add_dependencies(do_check_command_line pre_check_command_line) # # @@ -405,34 +405,34 @@ ADD_DEPENDENCIES(do_check_command_line pre_check_command_line) # At first, this reproduces a bug reported by a customer. After fixing it, # having this test here makes sure it stays fixed moving forward. # -ADD_CUSTOM_COMMAND( +add_custom_command( OUTPUT SameName1.txt COMMAND ${CMAKE_COMMAND} -E touch SameName1.txt ) -ADD_CUSTOM_TARGET(SameName ALL +add_custom_target(SameName ALL DEPENDS SameName1.txt ) -ADD_CUSTOM_COMMAND( +add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/subdir/SameName COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/subdir COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/subdir/SameName ) -ADD_CUSTOM_TARGET(DifferentName ALL +add_custom_target(DifferentName ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/subdir/SameName ) # # # Per-config target name and generator expressions. -ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../PerConfig PerConfig) -ADD_CUSTOM_COMMAND( +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../PerConfig PerConfig) +add_custom_command( OUTPUT perconfig.out COMMAND ${PerConfig_COMMAND} DEPENDS ${PerConfig_DEPENDS} VERBATIM ) -SET_PROPERTY(SOURCE perconfig.out PROPERTY SYMBOLIC 1) -ADD_CUSTOM_TARGET(perconfig_target ALL +set_property(SOURCE perconfig.out PROPERTY SYMBOLIC 1) +add_custom_target(perconfig_target ALL COMMAND ${CMAKE_COMMAND} -E echo "perconfig=$" "config=$" DEPENDS perconfig.out) diff --git a/Tests/CustomCommand/GeneratedHeader/CMakeLists.txt b/Tests/CustomCommand/GeneratedHeader/CMakeLists.txt index 2d47d8749..f7308e890 100644 --- a/Tests/CustomCommand/GeneratedHeader/CMakeLists.txt +++ b/Tests/CustomCommand/GeneratedHeader/CMakeLists.txt @@ -1,13 +1,13 @@ # Simulate in-source build include-file behavior for out-of-source # builds. -SET(CMAKE_INCLUDE_CURRENT_DIR 1) +set(CMAKE_INCLUDE_CURRENT_DIR 1) -ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated.h - COMMAND +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated.h + COMMAND ${CMAKE_COMMAND} ARGS -E - copy ${CMAKE_CURRENT_SOURCE_DIR}/generated.h.in - ${CMAKE_CURRENT_BINARY_DIR}/generated.h + copy ${CMAKE_CURRENT_SOURCE_DIR}/generated.h.in + ${CMAKE_CURRENT_BINARY_DIR}/generated.h ) -ADD_LIBRARY(GeneratedHeader main.cpp ${CMAKE_CURRENT_BINARY_DIR}/generated.h) - +add_library(GeneratedHeader main.cpp ${CMAKE_CURRENT_BINARY_DIR}/generated.h) + diff --git a/Tests/CustomCommand/GeneratorInExtraDir/CMakeLists.txt b/Tests/CustomCommand/GeneratorInExtraDir/CMakeLists.txt index 195a47792..04506db3b 100644 --- a/Tests/CustomCommand/GeneratorInExtraDir/CMakeLists.txt +++ b/Tests/CustomCommand/GeneratorInExtraDir/CMakeLists.txt @@ -1,8 +1,8 @@ -ADD_DEFINITIONS(-DGENERATOR_EXTERN) +add_definitions(-DGENERATOR_EXTERN) # add the executable which will be used for generating files -ADD_EXECUTABLE(generator_extern ../generator.cxx) -SET_TARGET_PROPERTIES(generator_extern PROPERTIES OUTPUT_NAME the_external_generator) +add_executable(generator_extern ../generator.cxx) +set_target_properties(generator_extern PROPERTIES OUTPUT_NAME the_external_generator) -# add an executable which will be called from ADD_CUSTOM_COMMAND( ... POST_BUILD) -ADD_EXECUTABLE(dummy_generator ../generator.cxx) +# add an executable which will be called from add_custom_command( ... POST_BUILD) +add_executable(dummy_generator ../generator.cxx) diff --git a/Tests/CustomCommand/check_mark.cmake b/Tests/CustomCommand/check_mark.cmake index 8b0551f83..1f47fd0bd 100644 --- a/Tests/CustomCommand/check_mark.cmake +++ b/Tests/CustomCommand/check_mark.cmake @@ -1,5 +1,5 @@ -IF(EXISTS "${MARK_FILE}") - MESSAGE(FATAL_ERROR "Custom command run more than once!") -ELSE(EXISTS "${MARK_FILE}") - FILE(WRITE "${MARK_FILE}" "check for running custom command twice\n") -ENDIF(EXISTS "${MARK_FILE}") +if(EXISTS "${MARK_FILE}") + message(FATAL_ERROR "Custom command run more than once!") +else() + file(WRITE "${MARK_FILE}" "check for running custom command twice\n") +endif() diff --git a/Tests/CustomCommand/foo.in b/Tests/CustomCommand/foo.in index 08c559df4..0c5021caa 100644 --- a/Tests/CustomCommand/foo.in +++ b/Tests/CustomCommand/foo.in @@ -22,7 +22,7 @@ int main () return -2; } } - + return -1; } diff --git a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt index 36d32e4a0..f917cd7f3 100644 --- a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt +++ b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt @@ -1,28 +1,28 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(TestWorkingDir) +project(TestWorkingDir) -ADD_CUSTOM_COMMAND( +add_custom_command( OUTPUT "${TestWorkingDir_BINARY_DIR}/working.c" COMMAND "${CMAKE_COMMAND}" -E copy ./working.c.in "${TestWorkingDir_BINARY_DIR}/working.c" WORKING_DIRECTORY "${TestWorkingDir_SOURCE_DIR}" COMMENT "custom command" ) -SET_SOURCE_FILES_PROPERTIES( +set_source_files_properties( "${TestWorkingDir_BINARY_DIR}/customTarget.c" "${TestWorkingDir_BINARY_DIR}/customTarget2.c" PROPERTIES GENERATED 1) -ADD_EXECUTABLE(working "${TestWorkingDir_BINARY_DIR}/working.c" +add_executable(working "${TestWorkingDir_BINARY_DIR}/working.c" "${TestWorkingDir_BINARY_DIR}/customTarget.c") -ADD_CUSTOM_TARGET( +add_custom_target( Custom ALL COMMAND "${CMAKE_COMMAND}" -E copy_if_different ./customTarget.c "${TestWorkingDir_BINARY_DIR}/customTarget.c" WORKING_DIRECTORY "${TestWorkingDir_SOURCE_DIR}" ) -ADD_DEPENDENCIES(working Custom) +add_dependencies(working Custom) file(MAKE_DIRECTORY ${TestWorkingDir_BINARY_DIR}/work) add_custom_command( diff --git a/Tests/Dependency/1/CMakeLists.txt b/Tests/Dependency/1/CMakeLists.txt index b50b2e9c5..a8e74e40b 100644 --- a/Tests/Dependency/1/CMakeLists.txt +++ b/Tests/Dependency/1/CMakeLists.txt @@ -1,3 +1,3 @@ -ADD_LIBRARY( One OneSrc.c ) +add_library( One OneSrc.c ) # This library has no dependencies -TARGET_LINK_LIBRARIES( One "" ) +target_link_libraries( One "" ) diff --git a/Tests/Dependency/CMakeLists.txt b/Tests/Dependency/CMakeLists.txt index 86e128f58..ef4204803 100644 --- a/Tests/Dependency/CMakeLists.txt +++ b/Tests/Dependency/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 2.6) -PROJECT( Dependency ) +project( Dependency ) # to test directories with only one character One was changed to 1 # There is one executable that depends on eight libraries. The @@ -29,25 +29,25 @@ PROJECT( Dependency ) # Although SixB does not depend on Two, there is a dependency listed # in the corresponding CMakeLists.txt just because of commands used. -ADD_SUBDIRECTORY(NoDepA) -ADD_SUBDIRECTORY(NoDepB) -ADD_SUBDIRECTORY(NoDepC) -ADD_SUBDIRECTORY(1) -ADD_SUBDIRECTORY(Two) -ADD_SUBDIRECTORY(Three) -ADD_SUBDIRECTORY(Four) -ADD_SUBDIRECTORY(Five) -ADD_SUBDIRECTORY(Six) -ADD_SUBDIRECTORY(Seven) -ADD_SUBDIRECTORY(Eight) -ADD_SUBDIRECTORY(Exec) -ADD_SUBDIRECTORY(Exec2) -ADD_SUBDIRECTORY(Exec3) -ADD_SUBDIRECTORY(Exec4) +add_subdirectory(NoDepA) +add_subdirectory(NoDepB) +add_subdirectory(NoDepC) +add_subdirectory(1) +add_subdirectory(Two) +add_subdirectory(Three) +add_subdirectory(Four) +add_subdirectory(Five) +add_subdirectory(Six) +add_subdirectory(Seven) +add_subdirectory(Eight) +add_subdirectory(Exec) +add_subdirectory(Exec2) +add_subdirectory(Exec3) +add_subdirectory(Exec4) # Specific cases added to test fixes to problems found in real # projects. -ADD_SUBDIRECTORY(Case1) -ADD_SUBDIRECTORY(Case2) -ADD_SUBDIRECTORY(Case3) -ADD_SUBDIRECTORY(Case4) +add_subdirectory(Case1) +add_subdirectory(Case2) +add_subdirectory(Case3) +add_subdirectory(Case4) diff --git a/Tests/Dependency/Eight/CMakeLists.txt b/Tests/Dependency/Eight/CMakeLists.txt index 5d8e7564e..db5e2dfb5 100644 --- a/Tests/Dependency/Eight/CMakeLists.txt +++ b/Tests/Dependency/Eight/CMakeLists.txt @@ -1,3 +1,3 @@ -ADD_LIBRARY( Eight EightSrc.c ) -TARGET_LINK_LIBRARIES( Eight Seven ) +add_library( Eight EightSrc.c ) +target_link_libraries( Eight Seven ) diff --git a/Tests/Dependency/Exec/CMakeLists.txt b/Tests/Dependency/Exec/CMakeLists.txt index 97fffe706..a9206857f 100644 --- a/Tests/Dependency/Exec/CMakeLists.txt +++ b/Tests/Dependency/Exec/CMakeLists.txt @@ -1,7 +1,7 @@ # This executable directly depends on NoDepB, NoDepC, SixA and SixB. However, # since NoDepB and NoDepC do not have explicit dependency information, # and they depend on NoDepA, we have to manually specify that dependency. -LINK_LIBRARIES( NoDepB NoDepC NoDepA SixB SixA ) +link_libraries( NoDepB NoDepC NoDepA SixB SixA ) -ADD_EXECUTABLE( exec ExecMain.c ) +add_executable( exec ExecMain.c ) diff --git a/Tests/Dependency/Exec2/CMakeLists.txt b/Tests/Dependency/Exec2/CMakeLists.txt index ee0c74d13..04d6fe810 100644 --- a/Tests/Dependency/Exec2/CMakeLists.txt +++ b/Tests/Dependency/Exec2/CMakeLists.txt @@ -2,11 +2,11 @@ # If the dependencies of Five are emitted, and then we attempt to emit the # dependencies of Seven, then we find that they have already been done. So: # Original line: Eight Five -# Add deps of Five: Eight Five Two ... NoDepA +# Add deps of Five: Eight Five Two ... NoDepA # Now, we must make sure that Seven gets inserted between Five and Two, and # not at the end. Unfortunately, if we get it wrong, the test will only # fail on a platform where the link order makes a difference. -LINK_LIBRARIES( Eight Five ) +link_libraries( Eight Five ) -ADD_EXECUTABLE( exec2 ExecMain.c ) +add_executable( exec2 ExecMain.c ) diff --git a/Tests/Dependency/Exec3/CMakeLists.txt b/Tests/Dependency/Exec3/CMakeLists.txt index b33e732a2..605fbc9f1 100644 --- a/Tests/Dependency/Exec3/CMakeLists.txt +++ b/Tests/Dependency/Exec3/CMakeLists.txt @@ -1,6 +1,6 @@ # Here, Five already has it's immediate dependency, Two satisfied. We must # make sure Two gets output anyway, because Eight indirectly depends on it. -LINK_LIBRARIES( Five Two Eight Five ) +link_libraries( Five Two Eight Five ) -ADD_EXECUTABLE( exec3 ExecMain.c ) +add_executable( exec3 ExecMain.c ) diff --git a/Tests/Dependency/Exec4/CMakeLists.txt b/Tests/Dependency/Exec4/CMakeLists.txt index 6fcb15383..94c6bf588 100644 --- a/Tests/Dependency/Exec4/CMakeLists.txt +++ b/Tests/Dependency/Exec4/CMakeLists.txt @@ -1,6 +1,6 @@ # Even though Five's dependency on Two is explicitly satisfied, Two # must be emitted again in order to satisfy a cyclic dependency on Three. -LINK_LIBRARIES( Five Two Five ) +link_libraries( Five Two Five ) -ADD_EXECUTABLE( exec4 ExecMain.c ) +add_executable( exec4 ExecMain.c ) diff --git a/Tests/Dependency/Five/CMakeLists.txt b/Tests/Dependency/Five/CMakeLists.txt index 27f6a1f5b..19c1c77d3 100644 --- a/Tests/Dependency/Five/CMakeLists.txt +++ b/Tests/Dependency/Five/CMakeLists.txt @@ -1,3 +1,3 @@ -ADD_LIBRARY( Five FiveSrc.c ) -TARGET_LINK_LIBRARIES( Five Two ) +add_library( Five FiveSrc.c ) +target_link_libraries( Five Two ) diff --git a/Tests/Dependency/Four/CMakeLists.txt b/Tests/Dependency/Four/CMakeLists.txt index df0f1624e..71c531fe9 100644 --- a/Tests/Dependency/Four/CMakeLists.txt +++ b/Tests/Dependency/Four/CMakeLists.txt @@ -1,6 +1,6 @@ -INCLUDE_DIRECTORIES(${Dependency_BINARY_DIR}/Two) -ADD_LIBRARY( Four FourSrc.c ) -TARGET_LINK_LIBRARIES( Four One Two NoDepA ) +include_directories(${Dependency_BINARY_DIR}/Two) +add_library( Four FourSrc.c ) +target_link_libraries( Four One Two NoDepA ) # TwoCustom must build before Four. -ADD_DEPENDENCIES(Four TwoCustom) +add_dependencies(Four TwoCustom) diff --git a/Tests/Dependency/NoDepA/CMakeLists.txt b/Tests/Dependency/NoDepA/CMakeLists.txt index cedf185fa..543402d9d 100644 --- a/Tests/Dependency/NoDepA/CMakeLists.txt +++ b/Tests/Dependency/NoDepA/CMakeLists.txt @@ -1 +1 @@ -ADD_LIBRARY( NoDepA NoDepASrc.c ) +add_library( NoDepA NoDepASrc.c ) diff --git a/Tests/Dependency/NoDepB/CMakeLists.txt b/Tests/Dependency/NoDepB/CMakeLists.txt index 0d69f6841..1c70f375c 100644 --- a/Tests/Dependency/NoDepB/CMakeLists.txt +++ b/Tests/Dependency/NoDepB/CMakeLists.txt @@ -1,3 +1,3 @@ -ADD_LIBRARY( NoDepB NoDepBSrc.c ) +add_library( NoDepB NoDepBSrc.c ) # This library depends on NoDepA, but the # dependency is not explicitly specified. diff --git a/Tests/Dependency/NoDepC/CMakeLists.txt b/Tests/Dependency/NoDepC/CMakeLists.txt index 88b29ba6f..dd41cebb6 100644 --- a/Tests/Dependency/NoDepC/CMakeLists.txt +++ b/Tests/Dependency/NoDepC/CMakeLists.txt @@ -1,3 +1,3 @@ -ADD_LIBRARY( NoDepC NoDepCSrc.c ) +add_library( NoDepC NoDepCSrc.c ) # This library depends on NoDepA, but the # dependency is not explicitly specified. diff --git a/Tests/Dependency/Seven/CMakeLists.txt b/Tests/Dependency/Seven/CMakeLists.txt index 51a38d8ed..7fba55cb9 100644 --- a/Tests/Dependency/Seven/CMakeLists.txt +++ b/Tests/Dependency/Seven/CMakeLists.txt @@ -1,3 +1,3 @@ -ADD_LIBRARY( Seven SevenSrc.c ) -TARGET_LINK_LIBRARIES( Seven Two ) +add_library( Seven SevenSrc.c ) +target_link_libraries( Seven Two ) diff --git a/Tests/Dependency/Six/CMakeLists.txt b/Tests/Dependency/Six/CMakeLists.txt index d0abdd695..db12051e2 100644 --- a/Tests/Dependency/Six/CMakeLists.txt +++ b/Tests/Dependency/Six/CMakeLists.txt @@ -2,11 +2,11 @@ # use an all-encompassing LINK_LIBRARIES. And sometimes they don't # specify them in the correct order. -LINK_LIBRARIES( Two ) -LINK_LIBRARIES( Five ) +link_libraries( Two ) +link_libraries( Five ) -ADD_LIBRARY( SixA SixASrc.c ) +add_library( SixA SixASrc.c ) -ADD_LIBRARY( SixB SixBSrc.c ) -TARGET_LINK_LIBRARIES( SixB Four ) +add_library( SixB SixBSrc.c ) +target_link_libraries( SixB Four ) diff --git a/Tests/Dependency/Three/CMakeLists.txt b/Tests/Dependency/Three/CMakeLists.txt index 6b20dcb81..3897f0cdd 100644 --- a/Tests/Dependency/Three/CMakeLists.txt +++ b/Tests/Dependency/Three/CMakeLists.txt @@ -1,3 +1,3 @@ -ADD_LIBRARY( Three ThreeSrc.c ) -TARGET_LINK_LIBRARIES( Three One Four ) +add_library( Three ThreeSrc.c ) +target_link_libraries( Three One Four ) diff --git a/Tests/Dependency/Two/CMakeLists.txt b/Tests/Dependency/Two/CMakeLists.txt index 587c848f7..19a070328 100644 --- a/Tests/Dependency/Two/CMakeLists.txt +++ b/Tests/Dependency/Two/CMakeLists.txt @@ -1,20 +1,20 @@ -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) -ADD_LIBRARY( Two TwoSrc.c ) -TARGET_LINK_LIBRARIES( Two Three ) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +add_library( Two TwoSrc.c ) +target_link_libraries( Two Three ) # Setup a target to cause failure if Two does not depend on it or if # Two actually links to it. This will test that a utility dependency # on a library target works properly. -ADD_CUSTOM_COMMAND( +add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/two-test.h COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/two-test.h.in ${CMAKE_CURRENT_BINARY_DIR}/two-test.h DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/two-test.h.in ) -ADD_LIBRARY( TwoCustom TwoCustomSrc.c ${CMAKE_CURRENT_BINARY_DIR}/two-test.h) -SET_TARGET_PROPERTIES(TwoCustom PROPERTIES EXCLUDE_FROM_ALL 1) -TARGET_LINK_LIBRARIES(TwoCustom Three) +add_library( TwoCustom TwoCustomSrc.c ${CMAKE_CURRENT_BINARY_DIR}/two-test.h) +set_target_properties(TwoCustom PROPERTIES EXCLUDE_FROM_ALL 1) +target_link_libraries(TwoCustom Three) # Add a utility dependency to make sure it works without linking. -ADD_DEPENDENCIES(Two TwoCustom) +add_dependencies(Two TwoCustom) diff --git a/Tests/DocTest/DocTest.cxx b/Tests/DocTest/DocTest.cxx index 2263cbd73..a8a62ab6c 100644 --- a/Tests/DocTest/DocTest.cxx +++ b/Tests/DocTest/DocTest.cxx @@ -13,7 +13,7 @@ int main () fprintf(stderr,"failed to find undefined properties file"); return 1; } - + char buffer[1024]; while ( fin ) { @@ -28,6 +28,6 @@ int main () } } fin.close(); - + return result; } diff --git a/Tests/EmptyDepends/CMakeLists.txt b/Tests/EmptyDepends/CMakeLists.txt new file mode 100644 index 000000000..832d9dce6 --- /dev/null +++ b/Tests/EmptyDepends/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) +project(EmptyDepends) + +include(CTest) + +set(extra_dep) + +add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/qrc_my.cxx + COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_BINARY_DIR}/qrc_my.cxx" + DEPENDS "${extra_dep}" "${CMAKE_BINARY_DIR}/my.qrc") + +add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/my.qrc + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/my.qrc) + +add_library(qrc STATIC ${CMAKE_BINARY_DIR}/qrc_my.cxx) diff --git a/Tests/EnforceConfig.cmake.in b/Tests/EnforceConfig.cmake.in index c9028a391..8c0817cd6 100644 --- a/Tests/EnforceConfig.cmake.in +++ b/Tests/EnforceConfig.cmake.in @@ -1,26 +1,26 @@ # Choose a configuration with which to drive CTest tests. -IF(CTEST_CONFIGURATION_TYPE) - SET(CTestTest_CONFIG "${CTEST_CONFIGURATION_TYPE}") -ELSE(CTEST_CONFIGURATION_TYPE) - SET(CTestTest_CONFIG "@CTestTest_CONFIG@") -ENDIF(CTEST_CONFIGURATION_TYPE) +if(CTEST_CONFIGURATION_TYPE) + set(CTestTest_CONFIG "${CTEST_CONFIGURATION_TYPE}") +else() + set(CTestTest_CONFIG "@CTestTest_CONFIG@") +endif() # Choose a configuration that was built if none is given. -IF(NOT CTEST_CONFIGURATION_TYPE) - SET(CTEST_CMD "@CMAKE_CTEST_COMMAND@@CMAKE_EXECUTABLE_SUFFIX@") - GET_FILENAME_COMPONENT(CTEST_DIR "${CTEST_CMD}" PATH) - GET_FILENAME_COMPONENT(CTEST_EXE "${CTEST_CMD}" NAME) - FOREACH(cfg Release Debug MinSizeRel RelWithDebInfo) - IF(NOT CTEST_CONFIGURATION_TYPE) - IF(EXISTS "${CTEST_DIR}/${cfg}/${CTEST_EXE}") - SET(CTEST_CONFIGURATION_TYPE ${cfg}) - ENDIF(EXISTS "${CTEST_DIR}/${cfg}/${CTEST_EXE}") - ENDIF(NOT CTEST_CONFIGURATION_TYPE) - ENDFOREACH(cfg) - IF(NOT CTEST_CONFIGURATION_TYPE) - SET(CTEST_CONFIGURATION_TYPE NoConfig) - ENDIF(NOT CTEST_CONFIGURATION_TYPE) - MESSAGE("Guessing configuration ${CTEST_CONFIGURATION_TYPE}") -ENDIF(NOT CTEST_CONFIGURATION_TYPE) +if(NOT CTEST_CONFIGURATION_TYPE) + set(CTEST_CMD "@CMAKE_CTEST_COMMAND@@CMAKE_EXECUTABLE_SUFFIX@") + get_filename_component(CTEST_DIR "${CTEST_CMD}" PATH) + get_filename_component(CTEST_EXE "${CTEST_CMD}" NAME) + foreach(cfg Release Debug MinSizeRel RelWithDebInfo) + if(NOT CTEST_CONFIGURATION_TYPE) + if(EXISTS "${CTEST_DIR}/${cfg}/${CTEST_EXE}") + set(CTEST_CONFIGURATION_TYPE ${cfg}) + endif() + endif() + endforeach() + if(NOT CTEST_CONFIGURATION_TYPE) + set(CTEST_CONFIGURATION_TYPE NoConfig) + endif() + message("Guessing configuration ${CTEST_CONFIGURATION_TYPE}") +endif() @TEST_HOME_ENV_CODE@ diff --git a/Tests/ExportImport/CMakeLists.txt b/Tests/ExportImport/CMakeLists.txt index ccfb8940c..b8368fc98 100644 --- a/Tests/ExportImport/CMakeLists.txt +++ b/Tests/ExportImport/CMakeLists.txt @@ -14,13 +14,13 @@ set_property( if(CMAKE_CONFIGURATION_TYPES) set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") -else(CMAKE_CONFIGURATION_TYPES) +else() if(CMAKE_BUILD_TYPE) set(NESTED_CONFIG_TYPE -C "${CMAKE_BUILD_TYPE}") - else(CMAKE_BUILD_TYPE) + else() set(NESTED_CONFIG_TYPE) - endif(CMAKE_BUILD_TYPE) -endif(CMAKE_CONFIGURATION_TYPES) + endif() +endif() if(MINGW OR MSYS) # Test CMAKE_GNUtoMS whether we have VS or not. @@ -41,9 +41,11 @@ add_custom_command( --build-project Export --build-target install --build-generator ${CMAKE_GENERATOR} + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-makeprogram ${CMAKE_MAKE_PROGRAM} --build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake - ) + VERBATIM + ) add_custom_target(ExportTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/ExportProject) add_dependencies(ExportTarget CleanupTarget) set_property( @@ -61,9 +63,11 @@ add_custom_command( --build-noclean --build-project Import --build-generator ${CMAKE_GENERATOR} + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-makeprogram ${CMAKE_MAKE_PROGRAM} --build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake - ) + VERBATIM + ) add_custom_target(ImportTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/ImportProject) add_dependencies(ImportTarget ExportTarget) set_property( diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index f06a4659f..c00ef82bb 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -56,7 +56,7 @@ add_library(testLib6 STATIC testLib6.cxx testLib6c.c) set(VS6) if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") set(VS6 1) -endif("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") +endif() # Test using the target_link_libraries command to set the # LINK_INTERFACE_LIBRARIES* properties. We construct two libraries @@ -87,6 +87,162 @@ target_link_libraries(testLibCycleA testLibCycleB) target_link_libraries(testLibCycleB testLibCycleA) set_property(TARGET testLibCycleA PROPERTY LINK_INTERFACE_MULTIPLICITY 3) +# Test exporting dependent libraries into different exports +add_library(testLibRequired testLibRequired.c) +add_library(testLibDepends testLibDepends.c) +target_link_libraries(testLibDepends LINK_PUBLIC testLibRequired) + +macro(add_include_lib _libName) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_libName}.c" "// no content\n") + add_library(${_libName} "${CMAKE_CURRENT_BINARY_DIR}/${_libName}.c") + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_libName}") + set_property(TARGET ${_libName} APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES + "$" + "$/include/${_libName}>" + ) + if (NOT "${ARGV1}" STREQUAL "NO_HEADER") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_libName}/${_libName}.h" "// no content\n") + install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/${_libName}/${_libName}.h" + DESTINATION include/${_libName} + ) + endif() +endmacro() + +add_include_lib(testLibIncludeRequired1) +add_include_lib(testLibIncludeRequired2) +add_include_lib(testLibIncludeRequired3 NO_HEADER) +# Generate testLibIncludeRequired4 in the testLibIncludeRequired3 directory +# with an error. If the includes from testLibIncludeRequired3 appear first, +# the error will be hit. +# Below, the '3' library appears before the '4' library +# but we are testing that the INSTALL_INTERFACE causes it not to be used +# at build time. +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testLibIncludeRequired3/testLibIncludeRequired4.h" "#error Should not be included\n") +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/testLibIncludeRequired3/testLibIncludeRequired4.h" + DESTINATION include/testLibIncludeRequired3 +) +add_include_lib(testLibIncludeRequired4) +add_include_lib(testLibIncludeRequired5 NO_HEADER) +# Generate testLibIncludeRequired6 in the testLibIncludeRequired5 directory +# with an error. If the includes from testLibIncludeRequired5 appear first, +# the error will be hit. +# Below, the '5' library appears before the '6' library +# but we are testing that when the installed IMPORTED target is used, from +# the Import side of this unit test, the '6' include from the '5' directory +# will not be used because it is in the BUILD_INTERFACE only. +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testLibIncludeRequired5/testLibIncludeRequired6.h" "#error Should not be included\n") +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/testLibIncludeRequired5/testLibIncludeRequired6.h" + DESTINATION include/testLibIncludeRequired5 +) +add_include_lib(testLibIncludeRequired6) + +set_property(TARGET testLibRequired APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES + $ + $>,INTERFACE_INCLUDE_DIRECTORIES> + $> + $> + $> + $> + # Test that the below is non-fatal + $<$:$> +) + +set_property(TARGET testLibRequired APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS + testLibRequired_IFACE_DEFINE + $ + $ +) + +include(GenerateExportHeader) + +add_library(testSharedLibRequired SHARED testSharedLibRequired.cpp) +generate_export_header(testSharedLibRequired) +set_property(TARGET testSharedLibRequired + PROPERTY + INTERFACE_POSITION_INDEPENDENT_CODE ON +) +set_property(TARGET testSharedLibRequired APPEND PROPERTY + INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" +) +set_property(TARGET testSharedLibRequired APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}" +) +set_property(TARGET testSharedLibRequired + APPEND PROPERTY + COMPATIBLE_INTERFACE_BOOL CUSTOM_PROP +) +set_property(TARGET testSharedLibRequired + PROPERTY + INTERFACE_CUSTOM_PROP ON +) +set_property(TARGET testSharedLibRequired + APPEND PROPERTY + COMPATIBLE_INTERFACE_STRING CUSTOM_STRING +) +set_property(TARGET testSharedLibRequired + PROPERTY + INTERFACE_CUSTOM_STRING testcontent +) + +add_library(testSharedLibDepends SHARED testSharedLibDepends.cpp) +set_property(TARGET testSharedLibDepends APPEND PROPERTY + INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" +) +generate_export_header(testSharedLibDepends) + +set_property(TARGET testSharedLibDepends APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES + $ +) +set_property(TARGET testSharedLibDepends APPEND PROPERTY + LINK_INTERFACE_LIBRARIES + $<$,EXECUTABLE>:$> +) + +# LINK_PRIVATE because the LINK_INTERFACE_LIBRARIES is specified above. +target_link_libraries(testSharedLibDepends LINK_PRIVATE testSharedLibRequired) + +install(TARGETS testLibRequired + testLibIncludeRequired1 + testLibIncludeRequired2 + testLibIncludeRequired3 + testLibIncludeRequired4 + testLibIncludeRequired5 + testLibIncludeRequired6 + testSharedLibRequired + EXPORT RequiredExp DESTINATION lib ) +install(EXPORT RequiredExp NAMESPACE Req:: FILE testLibRequiredTargets.cmake DESTINATION lib/cmake/testLibRequired) + +install(TARGETS testLibDepends testSharedLibDepends EXPORT DependsExp DESTINATION lib ) +install(EXPORT DependsExp FILE testLibDependsTargets.cmake DESTINATION lib/cmake/testLibDepends) + +file(WRITE + "${CMAKE_CURRENT_BINARY_DIR}/testLibRequiredConfig.cmake" + " +if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION VERSION_LESS 2.3 AND NOT \${CMAKE_FIND_PACKAGE_NAME}_INTERFACES) + set(\${CMAKE_FIND_PACKAGE_NAME}_NO_INTERFACES 1) +endif() +include(\"\${CMAKE_CURRENT_LIST_DIR}/testLibRequiredTargets.cmake\") +set(\${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS \"${CMAKE_CURRENT_BINARY_DIR}\" \"${CMAKE_CURRENT_SOURCE_DIR}\" ) +" +) + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( testLibRequiredConfigVersion.cmake VERSION 2.5 COMPATIBILITY AnyNewerVersion) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/testLibRequiredConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/testLibRequiredConfigVersion.cmake" + DESTINATION lib/cmake/testLibRequired +) + # Install and export from install tree. install( TARGETS @@ -129,11 +285,14 @@ install(EXPORT exp NAMESPACE exp_ DESTINATION lib/exp) # Install testLib5.dll outside the export. if(WIN32) install(TARGETS testLib5 RUNTIME DESTINATION bin) -endif(WIN32) +endif() + +add_subdirectory(sublib) # For CMAKE_BUILD_INTERFACE_INCLUDES test. # Export from build tree. export(TARGETS testExe1 testLib1 testLib2 testLib3 - testExe2libImp testLib3Imp testLib3ImpDep + testExe2libImp testLib3Imp testLib3ImpDep subdirlib + testSharedLibRequired testSharedLibDepends NAMESPACE bld_ FILE ExportBuildTree.cmake ) diff --git a/Tests/ExportImport/Export/sublib/CMakeLists.txt b/Tests/ExportImport/Export/sublib/CMakeLists.txt new file mode 100644 index 000000000..2d11040a9 --- /dev/null +++ b/Tests/ExportImport/Export/sublib/CMakeLists.txt @@ -0,0 +1,6 @@ + +set(CMAKE_BUILD_INTERFACE_INCLUDES ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_library(subdirlib SHARED subdir.cpp) +generate_export_header(subdirlib) diff --git a/Tests/ExportImport/Export/sublib/subdir.cpp b/Tests/ExportImport/Export/sublib/subdir.cpp new file mode 100644 index 000000000..35b074368 --- /dev/null +++ b/Tests/ExportImport/Export/sublib/subdir.cpp @@ -0,0 +1,7 @@ + +#include "subdir.h" + +int SubDirObject::foo() +{ + return 0; +} diff --git a/Tests/ExportImport/Export/sublib/subdir.h b/Tests/ExportImport/Export/sublib/subdir.h new file mode 100644 index 000000000..3a4b73d73 --- /dev/null +++ b/Tests/ExportImport/Export/sublib/subdir.h @@ -0,0 +1,12 @@ + +#ifndef SUBDIR_H +#define SUBDIR_H + +#include "subdirlib_export.h" + +struct SUBDIRLIB_EXPORT SubDirObject +{ + int foo(); +}; + +#endif diff --git a/Tests/ExportImport/Export/testLibDepends.c b/Tests/ExportImport/Export/testLibDepends.c new file mode 100644 index 000000000..fb5a002e0 --- /dev/null +++ b/Tests/ExportImport/Export/testLibDepends.c @@ -0,0 +1,20 @@ + +#include "testLibIncludeRequired1.h" +#include "testLibIncludeRequired2.h" +#include "testLibIncludeRequired4.h" + +#ifndef testLibRequired_IFACE_DEFINE +#error Expected testLibRequired_IFACE_DEFINE +#endif + +#ifndef BuildOnly_DEFINE +#error Expected BuildOnly_DEFINE +#endif + +#ifdef InstallOnly_DEFINE +#error Unexpected InstallOnly_DEFINE +#endif + +extern int testLibRequired(void); + +int testLibDepends(void) { return testLibRequired(); } diff --git a/Tests/ExportImport/Export/testLibRequired.c b/Tests/ExportImport/Export/testLibRequired.c new file mode 100644 index 000000000..e126d44e7 --- /dev/null +++ b/Tests/ExportImport/Export/testLibRequired.c @@ -0,0 +1 @@ +int testLibRequired(void) { return 0; } diff --git a/Tests/ExportImport/Export/testSharedLibDepends.cpp b/Tests/ExportImport/Export/testSharedLibDepends.cpp new file mode 100644 index 000000000..e27920725 --- /dev/null +++ b/Tests/ExportImport/Export/testSharedLibDepends.cpp @@ -0,0 +1,8 @@ + +#include "testSharedLibDepends.h" + +int TestSharedLibDepends::foo() +{ + TestSharedLibRequired req; + return req.foo(); +} diff --git a/Tests/ExportImport/Export/testSharedLibDepends.h b/Tests/ExportImport/Export/testSharedLibDepends.h new file mode 100644 index 000000000..b93143a5c --- /dev/null +++ b/Tests/ExportImport/Export/testSharedLibDepends.h @@ -0,0 +1,14 @@ + +#ifndef TESTSHAREDLIBDEPENDS_H +#define TESTSHAREDLIBDEPENDS_H + +#include "testsharedlibdepends_export.h" + +#include "testSharedLibRequired.h" + +struct TESTSHAREDLIBDEPENDS_EXPORT TestSharedLibDepends +{ + int foo(); +}; + +#endif diff --git a/Tests/ExportImport/Export/testSharedLibRequired.cpp b/Tests/ExportImport/Export/testSharedLibRequired.cpp new file mode 100644 index 000000000..1ac34aaef --- /dev/null +++ b/Tests/ExportImport/Export/testSharedLibRequired.cpp @@ -0,0 +1,7 @@ + +#include "testSharedLibRequired.h" + +int TestSharedLibRequired::foo() +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testSharedLibRequired.h b/Tests/ExportImport/Export/testSharedLibRequired.h new file mode 100644 index 000000000..edaddd485 --- /dev/null +++ b/Tests/ExportImport/Export/testSharedLibRequired.h @@ -0,0 +1,12 @@ + +#ifndef TESTSHAREDLIBREQUIRED_H +#define TESTSHAREDLIBREQUIRED_H + +#include "testsharedlibrequired_export.h" + +struct TESTSHAREDLIBREQUIRED_EXPORT TestSharedLibRequired +{ + int foo(); +}; + +#endif diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index a21e1b0f8..0337130f4 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -4,6 +4,10 @@ include(${Import_BINARY_DIR}/../Export/ExportBuildTree.cmake) # Import targets from the exported install tree. include(${CMAKE_INSTALL_PREFIX}/lib/exp/exp.cmake) +# Import two exports, where the Depends one depends on an exported target from the Required one: +include(${CMAKE_INSTALL_PREFIX}/lib/cmake/testLibRequired/testLibRequiredTargets.cmake) +include(${CMAKE_INSTALL_PREFIX}/lib/cmake/testLibDepends/testLibDependsTargets.cmake) + # Try referencing an executable imported from the install tree. add_custom_command( OUTPUT ${Import_BINARY_DIR}/exp_generated.c @@ -73,7 +77,7 @@ target_link_libraries(imp_mod1b bld_testExe2) foreach(c DEBUG RELWITHDEBINFO) set_property(TARGET imp_testExe1 PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG) set_property(TARGET imp_testExe1b PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG) -endforeach(c) +endforeach() #----------------------------------------------------------------------------- # Create a custom target to generate a header for the libraries below. @@ -148,3 +152,50 @@ check_function_exists(testLib1 HAVE_TESTLIB1_FUNCTION) if (NOT HAVE_TESTLIB1_FUNCTION) message(SEND_ERROR "Using imported target testLib2 in check_function_exists() failed !") endif() + +#----------------------------------------------------------------------------- +# Test that dependent imported targets have usable +# INTERFACE_COMPILE_DEFINITIONS and INTERFACE_INCLUDE_DIRECTORIES + +add_executable(deps_iface deps_iface.c) +target_link_libraries(deps_iface testLibDepends) + +add_executable(deps_shared_iface deps_shared_iface.cpp) +target_link_libraries(deps_shared_iface testSharedLibDepends) +target_compile_definitions(deps_shared_iface + PRIVATE + $<$>:PIC_PROPERTY_IS_ON> + $<$>:CUSTOM_PROPERTY_IS_ON> + $<$,testcontent>:CUSTOM_STRING_IS_MATCH> +) + +if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag(-fPIE run_pic_test) +else() + if (CMAKE_CXX_COMPILER_ID MATCHES "PGI" + OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale" + OR CMAKE_SYSTEM_NAME MATCHES "IRIX64" + OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") + set(run_pic_test 0) + else() + set(run_pic_test 1) + endif() +endif() + +if (run_pic_test) + target_compile_definitions(deps_shared_iface PRIVATE CHECK_PIC_WORKS) +endif() + +#----------------------------------------------------------------------------- +# Test that targets imported from the build tree have their dependencies +# evaluated correctly. The above already tests the same for the install tree. + +add_executable(deps_shared_iface2 deps_shared_iface.cpp) +target_link_libraries(deps_shared_iface2 bld_testSharedLibDepends bld_subdirlib) +target_compile_definitions(deps_shared_iface2 + PRIVATE TEST_SUBDIR_LIB + $<$>:PIC_PROPERTY_IS_ON> + $<$>:CUSTOM_PROPERTY_IS_ON> + $<$,testcontent>:CUSTOM_STRING_IS_MATCH> +) diff --git a/Tests/ExportImport/Import/A/deps_iface.c b/Tests/ExportImport/Import/A/deps_iface.c new file mode 100644 index 000000000..e73ca26bf --- /dev/null +++ b/Tests/ExportImport/Import/A/deps_iface.c @@ -0,0 +1,24 @@ + +#include "testLibIncludeRequired1.h" +#include "testLibIncludeRequired2.h" +#include "testLibIncludeRequired6.h" + +#ifndef testLibRequired_IFACE_DEFINE +#error Expected testLibRequired_IFACE_DEFINE +#endif + +#ifdef BuildOnly_DEFINE +#error Unexpected BuildOnly_DEFINE +#endif + +#ifndef InstallOnly_DEFINE +#error Expected InstallOnly_DEFINE +#endif + +extern int testLibDepends(void); + + +int main() +{ + return testLibDepends(); +} diff --git a/Tests/ExportImport/Import/A/deps_shared_iface.cpp b/Tests/ExportImport/Import/A/deps_shared_iface.cpp new file mode 100644 index 000000000..2f0e74a07 --- /dev/null +++ b/Tests/ExportImport/Import/A/deps_shared_iface.cpp @@ -0,0 +1,41 @@ + + +#include "testSharedLibDepends.h" + +#ifdef CHECK_PIC_WORKS +#if defined(__ELF__) && !defined(__PIC__) && !defined(__PIE__) +#error Expected by INTERFACE_POSITION_INDEPENDENT_CODE property of dependency +#endif +#endif + +#ifndef PIC_PROPERTY_IS_ON +#error Expected PIC_PROPERTY_IS_ON +#endif + +#ifndef CUSTOM_PROPERTY_IS_ON +#error Expected CUSTOM_PROPERTY_IS_ON +#endif + +#ifndef CUSTOM_STRING_IS_MATCH +#error Expected CUSTOM_STRING_IS_MATCH +#endif + +#ifdef TEST_SUBDIR_LIB +#include "subdir.h" +#endif + +int main(int,char **) +{ + TestSharedLibDepends dep; + TestSharedLibRequired req; + +#ifdef TEST_SUBDIR_LIB + SubDirObject sdo; +#endif + + return dep.foo() + req.foo() +#ifdef TEST_SUBDIR_LIB + + sdo.foo() +#endif + ; +} diff --git a/Tests/ExportImport/Import/CMakeLists.txt b/Tests/ExportImport/Import/CMakeLists.txt index 3fc78a280..9c2d5977c 100644 --- a/Tests/ExportImport/Import/CMakeLists.txt +++ b/Tests/ExportImport/Import/CMakeLists.txt @@ -17,3 +17,5 @@ add_executable(imp_testTransExe1 imp_testTransExe1.c) target_link_libraries(imp_testTransExe1 imp_lib1) add_executable(imp_testTransExe1b imp_testTransExe1.c) target_link_libraries(imp_testTransExe1b imp_lib1b) + +add_subdirectory(try_compile) diff --git a/Tests/ExportImport/Import/try_compile/CMakeLists.txt b/Tests/ExportImport/Import/try_compile/CMakeLists.txt new file mode 100644 index 000000000..5600dffdf --- /dev/null +++ b/Tests/ExportImport/Import/try_compile/CMakeLists.txt @@ -0,0 +1,21 @@ + +cmake_minimum_required(VERSION 2.8) + +find_package(testLibRequired 2.5 REQUIRED) + +include(CheckCXXSourceCompiles) + +set(CMAKE_REQUIRED_LIBRARIES Req::testSharedLibRequired) +check_cxx_source_compiles( + " +#include \"testSharedLibRequired.h\" +int main(int argc, char **argv) +{ + TestSharedLibRequired req; + return req.foo(); +} +" SHARED_LIB_REQUIRED) + +if(NOT SHARED_LIB_REQUIRED) + message(SEND_ERROR "try_compile with IMPORTED targets failed!\n\n${OUTPUT}") +endif() diff --git a/Tests/ExportImport/InitialCache.cmake.in b/Tests/ExportImport/InitialCache.cmake.in index 4893f7020..98d355f8f 100644 --- a/Tests/ExportImport/InitialCache.cmake.in +++ b/Tests/ExportImport/InitialCache.cmake.in @@ -1,15 +1,15 @@ -SET(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE STRING "C Compiler") -SET(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "C Flags") -SET(CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" CACHE STRING "C Flags") -SET(CMAKE_C_FLAGS_RELEASE "@CMAKE_C_FLAGS_RELEASE@" CACHE STRING "C Flags") -SET(CMAKE_C_FLAGS_MINSIZEREL "@CMAKE_C_FLAGS_MINSIZEREL@" CACHE STRING "C Flags") -SET(CMAKE_C_FLAGS_RELWITHDEBINFO "@CMAKE_C_FLAGS_RELWITHDEBINFO@" CACHE STRING "C Flags") -SET(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@" CACHE STRING "C++ Compiler") -SET(CMAKE_CXX_FLAGS "@CMAKE_CXX_FLAGS@" CACHE STRING "C++ Flags") -SET(CMAKE_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@" CACHE STRING "C++ Flags") -SET(CMAKE_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@" CACHE STRING "C++ Flags") -SET(CMAKE_CXX_FLAGS_MINSIZEREL "@CMAKE_CXX_FLAGS_MINSIZEREL@" CACHE STRING "C++ Flags") -SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@" CACHE STRING "C++ Flags") -SET(CMAKE_INSTALL_PREFIX "@ExportImport_BINARY_DIR@/Root" CACHE STRING "Installation Prefix") -SET(CMAKE_SKIP_RPATH ON CACHE BOOL "No RPATH") -SET(CMAKE_GNUtoMS "@ExportImport_GNUtoMS@" CACHE BOOL "CMAKE_GNUtoMS") +set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE STRING "C Compiler") +set(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "C Flags") +set(CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" CACHE STRING "C Flags") +set(CMAKE_C_FLAGS_RELEASE "@CMAKE_C_FLAGS_RELEASE@" CACHE STRING "C Flags") +set(CMAKE_C_FLAGS_MINSIZEREL "@CMAKE_C_FLAGS_MINSIZEREL@" CACHE STRING "C Flags") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "@CMAKE_C_FLAGS_RELWITHDEBINFO@" CACHE STRING "C Flags") +set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@" CACHE STRING "C++ Compiler") +set(CMAKE_CXX_FLAGS "@CMAKE_CXX_FLAGS@" CACHE STRING "C++ Flags") +set(CMAKE_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@" CACHE STRING "C++ Flags") +set(CMAKE_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@" CACHE STRING "C++ Flags") +set(CMAKE_CXX_FLAGS_MINSIZEREL "@CMAKE_CXX_FLAGS_MINSIZEREL@" CACHE STRING "C++ Flags") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@" CACHE STRING "C++ Flags") +set(CMAKE_INSTALL_PREFIX "@ExportImport_BINARY_DIR@/Root" CACHE STRING "Installation Prefix") +set(CMAKE_SKIP_RPATH ON CACHE BOOL "No RPATH") +set(CMAKE_GNUtoMS "@ExportImport_GNUtoMS@" CACHE BOOL "CMAKE_GNUtoMS") diff --git a/Tests/ExternalOBJ/CMakeLists.txt b/Tests/ExternalOBJ/CMakeLists.txt index 683e7997c..458c88bfd 100644 --- a/Tests/ExternalOBJ/CMakeLists.txt +++ b/Tests/ExternalOBJ/CMakeLists.txt @@ -1,51 +1,51 @@ cmake_minimum_required (VERSION 2.6) -PROJECT (ExternalOBJ) +project (ExternalOBJ) -IF(APPLE) +if(APPLE) # set _CMAKE_OSX_MACHINE to umame -m - EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE) + exec_program(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE) # check for Power PC and change to ppc - IF("${_CMAKE_OSX_MACHINE}" MATCHES "Power") - SET(_CMAKE_OSX_MACHINE ppc) - ENDIF("${_CMAKE_OSX_MACHINE}" MATCHES "Power") - SET(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE}) -ENDIF(APPLE) + if("${_CMAKE_OSX_MACHINE}" MATCHES "Power") + set(_CMAKE_OSX_MACHINE ppc) + endif() + set(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE}) +endif() # Build the external object file. -TRY_COMPILE(EXTERNAL_OBJECT_BUILT +try_compile(EXTERNAL_OBJECT_BUILT ${ExternalOBJ_BINARY_DIR}/Object ${ExternalOBJ_SOURCE_DIR}/Object Object external OUTPUT_VARIABLE OUTPUT ) -IF(EXTERNAL_OBJECT_BUILT) - MESSAGE( +if(EXTERNAL_OBJECT_BUILT) + message( "Building external_object.cxx succeeded with the following output:\n" "[${OUTPUT}]" ) -ELSE(EXTERNAL_OBJECT_BUILT) - MESSAGE(FATAL_ERROR +else() + message(FATAL_ERROR "Building external_object.cxx failed with the following output:\n" "[${OUTPUT}]" ) -ENDIF(EXTERNAL_OBJECT_BUILT) +endif() # Find the external object file. -SET(DIR ${ExternalOBJ_BINARY_DIR}/Object) -FILE(GLOB_RECURSE EXTERNAL_OBJECT +set(DIR ${ExternalOBJ_BINARY_DIR}/Object) +file(GLOB_RECURSE EXTERNAL_OBJECT "${DIR}/external_object*${CMAKE_CXX_OUTPUT_EXTENSION}") -IF(EXTERNAL_OBJECT) - LIST (GET EXTERNAL_OBJECT 0 EXTERNAL_OBJECT) - MESSAGE("Found \"${EXTERNAL_OBJECT}\".") -ELSE(EXTERNAL_OBJECT) - MESSAGE(FATAL_ERROR "Could not find external object.") -ENDIF(EXTERNAL_OBJECT) +if(EXTERNAL_OBJECT) + list (GET EXTERNAL_OBJECT 0 EXTERNAL_OBJECT) + message("Found \"${EXTERNAL_OBJECT}\".") +else() + message(FATAL_ERROR "Could not find external object.") +endif() # Test creation of external objects by custom commands. -SET(CUSTOM_OBJECT +set(CUSTOM_OBJECT ${CMAKE_CURRENT_BINARY_DIR}/custom_object${CMAKE_C_OUTPUT_EXTENSION}) -ADD_CUSTOM_COMMAND( +add_custom_command( OUTPUT ${CUSTOM_OBJECT} COMMAND ${CMAKE_COMMAND} -E copy ${EXTERNAL_OBJECT} ${CUSTOM_OBJECT} DEPENDS ${EXTERNAL_OBJECT} @@ -53,11 +53,11 @@ ADD_CUSTOM_COMMAND( message("${EXTERNAL_OBJECT}") # Build an executable using the external object file. -ADD_EXECUTABLE(ExternalOBJ executable.cxx ${CUSTOM_OBJECT}) +add_executable(ExternalOBJ executable.cxx ${CUSTOM_OBJECT}) # A bug showed up in VS2010 where an object file that was # part of a custom commad output worked, but ones that were # not didn't work. So, repeat the executable using the object # directly and not from the output of the copy. -ADD_EXECUTABLE(ExternalOBJ2 executable.cxx ${EXTERNAL_OBJECT}) +add_executable(ExternalOBJ2 executable.cxx ${EXTERNAL_OBJECT}) -ADD_SUBDIRECTORY(Sub) +add_subdirectory(Sub) diff --git a/Tests/ExternalOBJ/Object/CMakeLists.txt b/Tests/ExternalOBJ/Object/CMakeLists.txt index 6f1d7e3fb..dbfe09ee6 100644 --- a/Tests/ExternalOBJ/Object/CMakeLists.txt +++ b/Tests/ExternalOBJ/Object/CMakeLists.txt @@ -1,13 +1,13 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(Object) -IF(APPLE) +project(Object) +if(APPLE) # set _CMAKE_OSX_MACHINE to umame -m - EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE) + exec_program(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE) # check for Power PC and change to ppc - IF("${_CMAKE_OSX_MACHINE}" MATCHES "Power") - SET(_CMAKE_OSX_MACHINE ppc) - ENDIF("${_CMAKE_OSX_MACHINE}" MATCHES "Power") - SET(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE}) -ENDIF(APPLE) + if("${_CMAKE_OSX_MACHINE}" MATCHES "Power") + set(_CMAKE_OSX_MACHINE ppc) + endif() + set(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE}) +endif() -ADD_EXECUTABLE(external external_object.cxx external_main.cxx) +add_executable(external external_object.cxx external_main.cxx) diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index 7a7626199..602ff0f65 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -6,6 +6,7 @@ include(ExternalProject) find_package(CVS) find_package(Subversion) find_package(Git) +find_package(Hg) option(ExternalProjectTest_USE_FOLDERS "Enable folder grouping in IDEs." ON) if(ExternalProjectTest_USE_FOLDERS) @@ -49,6 +50,8 @@ if(NOT DEFINED can_build_tutorial_step5) endif() endif() +add_custom_target(NonExternalProjectTarget + COMMAND ${CMAKE_COMMAND} -E echo NonExternalProjectTarget) # Empty projects that test all the known ExternalProject_Add argument key words: # @@ -93,7 +96,7 @@ ExternalProject_Add(${proj} CVS_REPOSITORY "" CVS_MODULE "" CVS_TAG "" - DEPENDS "MinimalNoOpProject" + DEPENDS "MinimalNoOpProject" NonExternalProjectTarget DOWNLOAD_COMMAND "" INSTALL_COMMAND "" PATCH_COMMAND "" @@ -188,7 +191,7 @@ set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") set(proj TutorialStep1-LocalNoDirTGZ) ExternalProject_Add(${proj} URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tgz" - URL_MD5 0b8182edcecdf40bf1c9d71d7d259f78 + URL_HASH SHA256=496229e2a5ed620a37c385ad9406004a18026beab8b55dd2c4565d4b7f1d5383 CMAKE_GENERATOR "${CMAKE_GENERATOR}" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= INSTALL_COMMAND "" @@ -511,6 +514,76 @@ if(do_git_tests) set_property(TARGET ${proj} PROPERTY FOLDER "GIT") endif() +set(do_hg_tests 0) + +if(HG_EXECUTABLE) + set(do_hg_tests 1) +endif() + +if(do_hg_tests) + set(local_hg_repo "../../LocalRepositories/HG") + + # Unzip/untar the hg repository in our source folder so that other + # projects below may use it to test hg args of ExternalProject_Add + # + set(proj SetupLocalHGRepository) + ExternalProject_Add(${proj} + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/HG + URL ${CMAKE_CURRENT_SOURCE_DIR}/hgrepo.tgz + BUILD_COMMAND "" + CONFIGURE_COMMAND "${HG_EXECUTABLE}" --version + INSTALL_COMMAND "" + ) + set_property(TARGET ${proj} + PROPERTY FOLDER "SetupRepos/Local/Deeply/Nested/For/Testing") + + + # hg by commit id: + # + set(proj TutorialStep1-HG-byhash) + ExternalProject_Add(${proj} + HG_REPOSITORY "${local_hg_repo}" + HG_TAG dd2ce38a6b8a + UPDATE_COMMAND "" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= + INSTALL_COMMAND "" + DEPENDS "SetupLocalHGRepository" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "HG") + + # hg by explicit branch/tag name: + # + set(proj TutorialStep1-HG-bytag) + ExternalProject_Add(${proj} + HG_REPOSITORY "${local_hg_repo}" + HG_TAG "default" + UPDATE_COMMAND "" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= + INSTALL_COMMAND "" + DEPENDS "SetupLocalHGRepository" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "HG") + + # Live hg / tip (no HG_TAG): + # + # Mercurial 2.1 does not distinguish an empty pull from a failed pull, + # so do not run the test with that version. + if(NOT "${HG_VERSION_STRING}" STREQUAL "2.1") + set(proj TutorialStep1-HG-tip) + ExternalProject_Add(${proj} + HG_REPOSITORY "${local_hg_repo}" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= + INSTALL_COMMAND "" + DEPENDS "SetupLocalHGRepository" + LOG_UPDATE 1 + ) + set_property(TARGET ${proj} PROPERTY FOLDER "HG") + endif() +endif() + # Test the testable built/installed products: # @@ -567,6 +640,17 @@ if(do_svn_tests) "${binary_base}/TutorialStep1-SVN-trunk/Tutorial" 98) endif() +if(do_git_tests) + add_test(TutorialStep1-GIT-byhash + "${binary_base}/TutorialStep1-GIT-byhash/Tutorial" 100) + + add_test(TutorialStep1-GIT-bytag + "${binary_base}/TutorialStep1-GIT-bytag/Tutorial" 99) + + add_test(TutorialStep1-GIT-master + "${binary_base}/TutorialStep1-GIT-master/Tutorial" 98) +endif() + # InstallTree tests: # @@ -581,5 +665,5 @@ endif() message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'") message(STATUS "do_cvs_tests='${do_cvs_tests}'") message(STATUS "do_svn_tests='${do_svn_tests}'") -message(STATUS "do_git_tests='${do_git_tests}'") -message(STATUS "GIT_EXECUTABLE='${GIT_EXECUTABLE}'") +message(STATUS "do_git_tests='${do_git_tests}' GIT_EXECUTABLE='${GIT_EXECUTABLE}'") +message(STATUS "do_hg_tests='${do_hg_tests}' HG_EXECUTABLE='${HG_EXECUTABLE}'") diff --git a/Tests/ExternalProject/TryCheckout.cmake b/Tests/ExternalProject/TryCheckout.cmake index de069ebe4..6a396c339 100644 --- a/Tests/ExternalProject/TryCheckout.cmake +++ b/Tests/ExternalProject/TryCheckout.cmake @@ -25,7 +25,7 @@ function(try_cvs_checkout repository module dir result_var) message(STATUS "try_cvs_checkout -- done") endif() -endfunction(try_cvs_checkout) +endfunction() function(try_svn_checkout repository dir result_var) @@ -51,4 +51,4 @@ function(try_svn_checkout repository dir result_var) message(STATUS "try_svn_checkout -- done") endif() -endfunction(try_svn_checkout) +endfunction() diff --git a/Tests/ExternalProject/hgrepo.tgz b/Tests/ExternalProject/hgrepo.tgz new file mode 100644 index 000000000..0d75ce22f Binary files /dev/null and b/Tests/ExternalProject/hgrepo.tgz differ diff --git a/Tests/ExternalProjectUpdate/CMakeLists.txt b/Tests/ExternalProjectUpdate/CMakeLists.txt new file mode 100644 index 000000000..c33e90b51 --- /dev/null +++ b/Tests/ExternalProjectUpdate/CMakeLists.txt @@ -0,0 +1,94 @@ +cmake_minimum_required(VERSION 2.8) +project(ExternalProjectUpdateTest NONE) + +include(ExternalProject) + +find_package(Git) + +option(ExternalProjectUpdateTest_USE_FOLDERS "Enable folder grouping in IDEs." ON) +if(ExternalProjectUpdateTest_USE_FOLDERS) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +else() + set_property(GLOBAL PROPERTY USE_FOLDERS OFF) +endif() + +set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER + "CMakePredefinedTargets-in-ExternalProjectUpdateTest") + +set(base "${CMAKE_BINARY_DIR}/CMakeExternals") +set(binary_base "${base}/Build") +set_property(DIRECTORY PROPERTY EP_BASE ${base}) +set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) + +set(do_git_tests 0) + +if(GIT_EXECUTABLE) + set(do_git_tests 1) + + execute_process( + COMMAND "${GIT_EXECUTABLE}" --version + OUTPUT_VARIABLE ov + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(REGEX REPLACE "^git version (.+)$" "\\1" git_version "${ov}") + message(STATUS "git_version='${git_version}'") + + if(git_version VERSION_LESS 1.6.5) + message(STATUS "No ExternalProject git tests with git client less than version 1.6.5") + set(do_git_tests 0) + endif() +endif() + +# This should be specified from the command line. +if(NOT TEST_GIT_TAG) + set(TEST_GIT_TAG origin/master) +endif() + +if(do_git_tests) + set(local_git_repo "../../LocalRepositories/GIT") + + # Unzip/untar the git repository in our source folder so that other + # projects below may use it to test git args of ExternalProject_Add + # + set(proj SetupLocalGITRepository) + ExternalProject_Add(${proj} + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/GIT + URL ${CMAKE_CURRENT_SOURCE_DIR}/gitrepo.tgz + BUILD_COMMAND "" + CONFIGURE_COMMAND "${GIT_EXECUTABLE}" --version + INSTALL_COMMAND "" + ) + set_property(TARGET ${proj} + PROPERTY FOLDER "SetupRepos/Local/Deeply/Nested/For/Testing") + + set(proj TutorialStep1-GIT) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + GIT_TAG ${TEST_GIT_TAG} + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + ) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") +endif() + + +# Test the testable built/installed products: +# +enable_testing() + + +# Do at least a smoke test of a built executable from each +# project's build directory... +# +# BuildTree tests: +# + +if(do_git_tests) + add_test(TutorialStep1-GIT + "${binary_base}/TutorialStep1-GIT/Tutorial" 81) +endif() + +message(STATUS "do_git_tests='${do_git_tests}'") +message(STATUS "GIT_EXECUTABLE='${GIT_EXECUTABLE}'") diff --git a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake new file mode 100644 index 000000000..b6f848aa8 --- /dev/null +++ b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake @@ -0,0 +1,94 @@ +# Set the ExternalProject GIT_TAG to desired_tag, and make sure the +# resulting checked out version is resulting_sha and rebuild. +# This check's the correct behavior of the ExternalProject UPDATE_COMMAND. +# Also verify that a fetch only occurs when fetch_expected is 1. +macro(check_a_tag desired_tag resulting_sha fetch_expected) + message( STATUS "Checking ExternalProjectUpdate to tag: ${desired_tag}" ) + + # Remove the FETCH_HEAD file, so we can check if it gets replaced with a 'git + # fetch'. + set( FETCH_HEAD_file ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals/Source/TutorialStep1-GIT/.git/FETCH_HEAD ) + file( REMOVE ${FETCH_HEAD_file} ) + + # Configure + execute_process(COMMAND ${CMAKE_COMMAND} + -G ${CMAKE_TEST_GENERATOR} -T "${CMAKE_TEST_GENERATOR_TOOLSET}" + -DTEST_GIT_TAG:STRING=${desired_tag} + ${ExternalProjectUpdate_SOURCE_DIR} + WORKING_DIRECTORY ${ExternalProjectUpdate_BINARY_DIR} + RESULT_VARIABLE error_code + ) + if(error_code) + message(FATAL_ERROR "Could not configure the project.") + endif() + + # Build + execute_process(COMMAND ${CMAKE_COMMAND} + --build ${ExternalProjectUpdate_BINARY_DIR} + RESULT_VARIABLE error_code + ) + if(error_code) + message(FATAL_ERROR "Could not build the project.") + endif() + + # Check the resulting SHA + execute_process(COMMAND ${GIT_EXECUTABLE} + rev-list --max-count=1 HEAD + WORKING_DIRECTORY ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals/Source/TutorialStep1-GIT + RESULT_VARIABLE error_code + OUTPUT_VARIABLE tag_sha + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(error_code) + message(FATAL_ERROR "Could not check the sha.") + endif() + + if(NOT (${tag_sha} STREQUAL ${resulting_sha})) + message(FATAL_ERROR "UPDATE_COMMAND produced + ${tag_sha} +when + ${resulting_sha} +was expected." + ) + endif() + + if( NOT EXISTS ${FETCH_HEAD_file} AND ${fetch_expected}) + message( FATAL_ERROR "Fetch did NOT occur when it was expected.") + endif() + if( EXISTS ${FETCH_HEAD_file} AND NOT ${fetch_expected}) + message( FATAL_ERROR "Fetch DID occur when it was not expected.") + endif() +endmacro() + +find_package(Git) +set(do_git_tests 0) +if(GIT_EXECUTABLE) + set(do_git_tests 1) + + execute_process( + COMMAND "${GIT_EXECUTABLE}" --version + OUTPUT_VARIABLE ov + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(REGEX REPLACE "^git version (.+)$" "\\1" git_version "${ov}") + message(STATUS "git_version='${git_version}'") + + if(git_version VERSION_LESS 1.6.5) + message(STATUS "No ExternalProject git tests with git client less than version 1.6.5") + set(do_git_tests 0) + endif() +endif() + +if(do_git_tests) + check_a_tag(origin/master 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1) + check_a_tag(tag1 d1970730310fe8bc07e73f15dc570071f9f9654a 1) + # With the Git UPDATE_COMMAND performance patch, this will not required a + # 'git fetch' + check_a_tag(tag1 d1970730310fe8bc07e73f15dc570071f9f9654a 0) + check_a_tag(tag2 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1) + check_a_tag(d19707303 d1970730310fe8bc07e73f15dc570071f9f9654a 1) + check_a_tag(d19707303 d1970730310fe8bc07e73f15dc570071f9f9654a 0) + check_a_tag(origin/master 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1) + # This is a remote symbolic ref, so it will always trigger a 'git fetch' + check_a_tag(origin/master 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1) +endif() diff --git a/Tests/ExternalProjectUpdate/gitrepo.tgz b/Tests/ExternalProjectUpdate/gitrepo.tgz new file mode 100644 index 000000000..87090ab0b Binary files /dev/null and b/Tests/ExternalProjectUpdate/gitrepo.tgz differ diff --git a/Tests/FindModulesExecuteAll/CMakeLists.txt b/Tests/FindModulesExecuteAll/CMakeLists.txt index df5162652..21b9d3897 100644 --- a/Tests/FindModulesExecuteAll/CMakeLists.txt +++ b/Tests/FindModulesExecuteAll/CMakeLists.txt @@ -23,8 +23,8 @@ foreach(module ${all_modules}) # disabled for now, since too many modules break: # if(NOT DEFINED ${packageNameUpper}_FOUND) # message(SEND_ERROR "${packageNameUpper}_FOUND not defined !") -# endif(NOT DEFINED ${packageNameUpper}_FOUND) +# endif() -endforeach(module ${all_modules}) +endforeach() add_executable(FindModulesExecuteAll main.c) diff --git a/Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake b/Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake index 321fa118e..979bbdf18 100644 --- a/Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake +++ b/Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake @@ -1,8 +1,8 @@ -SET(PACKAGE_VERSION 1.1) -IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1) - SET(PACKAGE_VERSION_COMPATIBLE 1) - IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) - SET(PACKAGE_VERSION_EXACT 1) - ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) -ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1) +set(PACKAGE_VERSION 1.1) +if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1) + set(PACKAGE_VERSION_COMPATIBLE 1) + if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) + set(PACKAGE_VERSION_EXACT 1) + endif() +endif() diff --git a/Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake b/Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake index 4576809f5..17caaa728 100644 --- a/Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake +++ b/Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake @@ -1,8 +1,8 @@ -SET(PACKAGE_VERSION 1.2) -IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1) - SET(PACKAGE_VERSION_COMPATIBLE 1) - IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 2) - SET(PACKAGE_VERSION_EXACT 1) - ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 2) -ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1) +set(PACKAGE_VERSION 1.2) +if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1) + set(PACKAGE_VERSION_COMPATIBLE 1) + if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 2) + set(PACKAGE_VERSION_EXACT 1) + endif() +endif() diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index e85fb4dd2..a77713f27 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -1,86 +1,96 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(FindPackageTest) +project(FindPackageTest) -LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) # Look for a package which uses FindPackageHandleStandardArgs.cmake with the # new (as of cmake 2.8.3) syntax. This works only if CMP0017 is set to NEW, # because otherwise FindPackageHandleStandardArgs.cmake from the current # directory is included (via CMAKE_MODULE_PATH). -CMAKE_POLICY(SET CMP0017 NEW) -FIND_PACKAGE(ZLIB QUIET) +cmake_policy(SET CMP0017 NEW) +find_package(ZLIB QUIET) # Look for a package that has a find module and may be found. -FIND_PACKAGE(OpenGL QUIET) +find_package(OpenGL QUIET) # Look for a package that has no find module and will not be found. -FIND_PACKAGE(NotAPackage QUIET) +find_package(NotAPackage QUIET) # Look for a package that has an advanced find module. -FIND_PACKAGE(VTK QUIET) +find_package(VTK QUIET) -ADD_EXECUTABLE(FindPackageTest FindPackageTest.cxx) +add_executable(FindPackageTest FindPackageTest.cxx) # test behaviour of cmFindBase wrt. the CMAKE_PREFIX_PATH variable # foo.h should be found in ${CMAKE_CURRENT_SOURCE_DIR}/include: -SET(CMAKE_PREFIX_PATH /blub /blah "${CMAKE_CURRENT_SOURCE_DIR}") -FIND_PATH(FOO_DIR foo.h) +set(CMAKE_PREFIX_PATH /blub /blah "${CMAKE_CURRENT_SOURCE_DIR}") +find_path(FOO_DIR foo.h) -IF(NOT FOO_DIR) - MESSAGE(FATAL_ERROR "Did not find foo.h which is in ${CMAKE_CURRENT_SOURCE_DIR}/include +if(NOT FOO_DIR) + message(FATAL_ERROR "Did not find foo.h which is in ${CMAKE_CURRENT_SOURCE_DIR}/include CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}") -ENDIF(NOT FOO_DIR) +endif() + +find_package(VersionTestA 1) +find_package(VersionTestB 1.2) +find_package(VersionTestC 1.2.3) +find_package(VersionTestD 1.2.3.4) + -FIND_PACKAGE(VersionTestA 1) -FIND_PACKAGE(VersionTestB 1.2) -FIND_PACKAGE(VersionTestC 1.2.3) -FIND_PACKAGE(VersionTestD 1.2.3.4) +find_package(LotsOfComponents COMPONENTS AComp OPTIONAL_COMPONENTS BComp CComp) +if(NOT LOTSOFCOMPONENTS_FOUND) + message(SEND_ERROR "LotsOfComponents not found !") +endif() +find_package(SomePackage) +if(NOT SomePackage_FOUND) + message(SEND_ERROR "SomePackage with FOUND_VAR SomePackage_FOUND not found !") +endif() -FIND_PACKAGE(LotsOfComponents COMPONENTS AComp OPTIONAL_COMPONENTS BComp CComp) -IF(NOT LOTSOFCOMPONENTS_FOUND) - MESSAGE(SEND_ERROR "LotsOfComponents not found !") -ENDIF() +find_package(UpperCasePackage) +if(NOT UPPERCASEPACKAGE_FOUND) + message(SEND_ERROR "UpperCasePackage with FOUND_VAR UPPERCASEPACKAGE_FOUND not found !") +endif() #----------------------------------------------------------------------------- # Test system package registry if possible. -SET(CMakeTestSystemPackage "") -IF(WIN32 AND NOT CYGWIN) +set(CMakeTestSystemPackage "") +if(WIN32 AND NOT CYGWIN) # Try writing a value to the system package registry. - SET(_data "${FindPackageTest_SOURCE_DIR}/SystemPackage") - SET(_key "HKLM\\Software\\Kitware\\CMake\\Packages\\CMakeTestSystemPackage") - SET(_file "${FindPackageTest_BINARY_DIR}/CMakeTestSystemPackage.data") - FILE(WRITE ${_file} "${_data}\n") - EXECUTE_PROCESS( + set(_data "${FindPackageTest_SOURCE_DIR}/SystemPackage") + set(_key "HKLM\\Software\\Kitware\\CMake\\Packages\\CMakeTestSystemPackage") + set(_file "${FindPackageTest_BINARY_DIR}/CMakeTestSystemPackage.data") + file(WRITE ${_file} "${_data}\n") + execute_process( COMMAND ${CMAKE_COMMAND} -E md5sum ${_file} OUTPUT_VARIABLE _output ERROR_VARIABLE _error RESULT_VARIABLE _failed OUTPUT_STRIP_TRAILING_WHITESPACE ) - STRING(REGEX REPLACE " .*" "" _value "${_output}") - IF(NOT _failed AND _value) - EXECUTE_PROCESS( + string(REGEX REPLACE " .*" "" _value "${_output}") + if(NOT _failed AND _value) + execute_process( COMMAND reg add "${_key}" /v "${_value}" /t REG_SZ /d "${_data}" /f OUTPUT_VARIABLE _output ERROR_VARIABLE _output RESULT_VARIABLE _failed ) - ENDIF() + endif() # If the above worked, add the rest of the test and a rule to # cleanup the value. - IF(NOT _failed) - MESSAGE(STATUS "HKLM is writable: enabling CMakeTestSystemPackage") - SET(CMakeTestSystemPackage_CLEANUP reg delete "${_key}" /v "${_value}" /f) - SET(CMakeTestSystemPackage CMakeTestSystemPackage) - ELSE() - MESSAGE(STATUS "HKLM is readonly: disabling CMakeTestSystemPackage") - ENDIF() -ENDIF() + if(NOT _failed) + message(STATUS "HKLM is writable: enabling CMakeTestSystemPackage") + set(CMakeTestSystemPackage_CLEANUP reg delete "${_key}" /v "${_value}" /f) + set(CMakeTestSystemPackage CMakeTestSystemPackage) + else() + message(STATUS "HKLM is readonly: disabling CMakeTestSystemPackage") + endif() +endif() #----------------------------------------------------------------------------- -#SET(CMAKE_FIND_DEBUG_MODE 1) +#set(CMAKE_FIND_DEBUG_MODE 1) # For purposes of the test wipe out previous find results. -SET(PACKAGES +set(PACKAGES foo Foo Bar Blub TFramework Tframework TApp Tapp Special VersionedA VersionedB VersionedC VersionedD VersionedE WrongA WrongB WrongC WrongD @@ -91,14 +101,14 @@ SET(PACKAGES SetFoundTRUE SetFoundFALSE ${CMakeTestSystemPackage} ) -FOREACH(p ${PACKAGES}) - SET(${p}_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE) -ENDFOREACH(p) +foreach(p ${PACKAGES}) + set(${p}_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE) +endforeach() # Enable framework and bundle searching. Make sure bundles are found # before unix-syle packages. -SET(CMAKE_FIND_FRAMEWORK LAST) -SET(CMAKE_FIND_APPBUNDLE FIRST) +set(CMAKE_FIND_FRAMEWORK LAST) +set(CMAKE_FIND_APPBUNDLE FIRST) # Set the wrong answer for a find to make sure it re-finds. set(VersionedA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/cmake/zot-4.0) @@ -108,219 +118,219 @@ set(VersionedA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/cmake/zot-4.0) set(CMAKE_IGNORE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/cmake/zot-3.1) # Look for packages with new-style signatures. -FIND_PACKAGE(foo NO_MODULE) -FIND_PACKAGE(Foo CONFIGS FooConfig.cmake) -FIND_PACKAGE(Bar) -SET(CMAKE_DISABLE_FIND_PACKAGE_Blub TRUE) -FIND_PACKAGE(Blub NO_MODULE) -FIND_PACKAGE(TFramework CONFIGS TFrameworkConfig.cmake) -FIND_PACKAGE(Tframework) -FIND_PACKAGE(TApp) -FIND_PACKAGE(Tapp CONFIGS tapp-config.cmake) -FIND_PACKAGE(Special NAMES Suffix SuffixTest PATH_SUFFIXES test) -FIND_PACKAGE(VersionedA 2 NAMES zot) -FIND_PACKAGE(VersionedB 3.1 EXACT NAMES zot) -FIND_PACKAGE(VersionedC 4.0 EXACT NAMES zot) -FIND_PACKAGE(VersionedD 1.1 EXACT NAMES Baz) -FIND_PACKAGE(VersionedE 1.2 EXACT NAMES Baz) +find_package(foo NO_MODULE) +find_package(Foo CONFIGS FooConfig.cmake) +find_package(Bar) +set(CMAKE_DISABLE_FIND_PACKAGE_Blub TRUE) +find_package(Blub NO_MODULE) +find_package(TFramework CONFIGS TFrameworkConfig.cmake) +find_package(Tframework) +find_package(TApp) +find_package(Tapp CONFIGS tapp-config.cmake) +find_package(Special NAMES Suffix SuffixTest PATH_SUFFIXES test) +find_package(VersionedA 2 NAMES zot) +find_package(VersionedB 3.1 EXACT NAMES zot) +find_package(VersionedC 4.0 EXACT NAMES zot) +find_package(VersionedD 1.1 EXACT NAMES Baz) +find_package(VersionedE 1.2 EXACT NAMES Baz) # Test Config files which set Xyz_FOUND themselves: -FIND_PACKAGE(SetFoundTRUE NO_MODULE) -FIND_PACKAGE(SetFoundFALSE NO_MODULE) +find_package(SetFoundTRUE NO_MODULE) +find_package(SetFoundFALSE NO_MODULE) # Test wrong initial path when result is present. -SET(WrongA_DIR "${VersionedD_DIR}") -FIND_PACKAGE(WrongA 1.2 EXACT NAMES Baz) +set(WrongA_DIR "${VersionedD_DIR}") +find_package(WrongA 1.2 EXACT NAMES Baz) # Test wrong initial cache entry of UNINITIALIZED type when result is present. -SET(WrongB_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE) -GET_PROPERTY(type CACHE WrongB_DIR PROPERTY TYPE) -FIND_PACKAGE(WrongB 1.2 EXACT NAMES Baz) +set(WrongB_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE) +get_property(type CACHE WrongB_DIR PROPERTY TYPE) +find_package(WrongB 1.2 EXACT NAMES Baz) # Test wrong initial path when result is missing. -SET(WrongC_DIR "${VersionedD_DIR}") -FIND_PACKAGE(WrongC 1.3 EXACT QUIET NAMES Baz) +set(WrongC_DIR "${VersionedD_DIR}") +find_package(WrongC 1.3 EXACT QUIET NAMES Baz) # Test wrong initial cache entry of UNINITIALIZED type when result is missing. -SET(WrongD_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE) -GET_PROPERTY(type CACHE WrongD_DIR PROPERTY TYPE) -FIND_PACKAGE(WrongD 1.3 EXACT QUIET NAMES Baz) +set(WrongD_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE) +get_property(type CACHE WrongD_DIR PROPERTY TYPE) +find_package(WrongD 1.3 EXACT QUIET NAMES Baz) # HINTS should override the system but PATHS should not -LIST(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/A") -FIND_PACKAGE(wibbleA NAMES wibble PATHS B) -FIND_PACKAGE(wibbleB NAMES wibble HINTS B) +list(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/A") +find_package(wibbleA NAMES wibble PATHS B) +find_package(wibbleB NAMES wibble HINTS B) # Look for package with recursive find-modules. -FIND_PACKAGE(RecursiveA COMPONENTS A) -FIND_PACKAGE(RecursiveB 2) -FIND_PACKAGE(RecursiveC 3.1 EXACT) +find_package(RecursiveA COMPONENTS A) +find_package(RecursiveB 2) +find_package(RecursiveC 3.1 EXACT) # Test architecture-specific search directories. -SET(CMAKE_LIBRARY_ARCHITECTURE arch) -FIND_PACKAGE(ArchA NAMES Bar) -FIND_PACKAGE(ArchB NAMES Foo CONFIGS FooConfig.cmake) -FIND_PACKAGE(ArchC 3.1 EXACT NAMES zot) -FIND_PACKAGE(ArchD 4.0 EXACT NAMES zot) -UNSET(CMAKE_LIBRARY_ARCHITECTURE) +set(CMAKE_LIBRARY_ARCHITECTURE arch) +find_package(ArchA NAMES Bar) +find_package(ArchB NAMES Foo CONFIGS FooConfig.cmake) +find_package(ArchC 3.1 EXACT NAMES zot) +find_package(ArchD 4.0 EXACT NAMES zot) +unset(CMAKE_LIBRARY_ARCHITECTURE) # Test _DIR environment variable. # We erase the main prefix path to ensure the env var is used. -SET(CMAKE_PREFIX_PATH) -SET(ENV{EnvA_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/lib/zot-3.1") -FIND_PACKAGE(EnvA 3.1 EXACT QUIET NAMES zot) # Should Work -FIND_PACKAGE(EnvB 3.1 EXACT QUIET NAMES zot) # Should Fail +set(CMAKE_PREFIX_PATH) +set(ENV{EnvA_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/lib/zot-3.1") +find_package(EnvA 3.1 EXACT QUIET NAMES zot) # Should Work +find_package(EnvB 3.1 EXACT QUIET NAMES zot) # Should Fail # Test system package registry if available. -IF(CMakeTestSystemPackage) - FIND_PACKAGE(CMakeTestSystemPackage) - EXECUTE_PROCESS(COMMAND ${CMakeTestSystemPackage_CLEANUP} +if(CMakeTestSystemPackage) + find_package(CMakeTestSystemPackage) + execute_process(COMMAND ${CMakeTestSystemPackage_CLEANUP} OUTPUT_VARIABLE _output ERROR_VARIABLE _error) -ENDIF() +endif() # Expected locations at which packages should be found. -SET(foo_EXPECTED "lib/foo-1.2/foo-config.cmake") -SET(Foo_EXPECTED "lib/foo-1.2/CMake/FooConfig.cmake") -SET(Bar_EXPECTED "lib/Bar/BarConfig.cmake") -SET(Blub_MISSING "") -SET(Special_EXPECTED "lib/suffix/test/SuffixTestConfig.cmake") -SET(TFramework_EXPECTED +set(foo_EXPECTED "lib/foo-1.2/foo-config.cmake") +set(Foo_EXPECTED "lib/foo-1.2/CMake/FooConfig.cmake") +set(Bar_EXPECTED "lib/Bar/BarConfig.cmake") +set(Blub_MISSING "") +set(Special_EXPECTED "lib/suffix/test/SuffixTestConfig.cmake") +set(TFramework_EXPECTED "TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake") -SET(Tframework_EXPECTED +set(Tframework_EXPECTED "TFramework.framework/Versions/A/Resources/tframework-config.cmake") -SET(TApp_EXPECTED +set(TApp_EXPECTED "TApp.app/Contents/Resources/TAppConfig.cmake") -SET(Tapp_EXPECTED +set(Tapp_EXPECTED "TApp.app/Contents/Resources/cmake/tapp-config.cmake") -SET(VersionedA_EXPECTED "lib/zot-2.0/zot-config.cmake") -SET(VersionedB_EXPECTED "lib/zot-3.1/zot-config.cmake") -SET(VersionedC_EXPECTED "lib/cmake/zot-4.0/zot-config.cmake") -SET(VersionedD_EXPECTED "Baz 1.1/BazConfig.cmake") -SET(VersionedE_EXPECTED "Baz 1.2/CMake/BazConfig.cmake") -SET(WrongA_EXPECTED "${VersionedE_EXPECTED}") -SET(WrongB_EXPECTED "${VersionedE_EXPECTED}") -SET(WrongC_MISSING "WrongC_DIR-NOTFOUND") -SET(WrongD_MISSING "WrongD_DIR-NOTFOUND") -SET(wibbleA_EXPECTED "A/wibble-config.cmake") -SET(wibbleB_EXPECTED "B/wibble-config.cmake") -SET(RecursiveA_EXPECTED "lib/RecursiveA/recursivea-config.cmake") -SET(RecursiveB_EXPECTED "lib/zot-2.0/zot-config.cmake") -SET(RecursiveC_EXPECTED "lib/zot-3.1/zot-config.cmake") -SET(ArchA_EXPECTED "lib/arch/Bar/BarConfig.cmake") -SET(ArchB_EXPECTED "lib/arch/foo-1.2/CMake/FooConfig.cmake") -SET(ArchC_EXPECTED "lib/arch/zot-3.1/zot-config.cmake") -SET(ArchD_EXPECTED "lib/arch/cmake/zot-4.0/zot-config.cmake") -SET(EnvA_EXPECTED "lib/zot-3.1/zot-config.cmake") -SET(EnvB_MISSING "EnvB_DIR-NOTFOUND") -SET(SetFoundTRUE_EXPECTED "cmake/SetFoundTRUEConfig.cmake") -SET(SetFoundFALSE_MISSING "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -SET(CMakeTestSystemPackage_EXPECTED "SystemPackage/CMakeTestSystemPackageConfig.cmake") +set(VersionedA_EXPECTED "lib/zot-2.0/zot-config.cmake") +set(VersionedB_EXPECTED "lib/zot-3.1/zot-config.cmake") +set(VersionedC_EXPECTED "lib/cmake/zot-4.0/zot-config.cmake") +set(VersionedD_EXPECTED "Baz 1.1/BazConfig.cmake") +set(VersionedE_EXPECTED "Baz 1.2/CMake/BazConfig.cmake") +set(WrongA_EXPECTED "${VersionedE_EXPECTED}") +set(WrongB_EXPECTED "${VersionedE_EXPECTED}") +set(WrongC_MISSING "WrongC_DIR-NOTFOUND") +set(WrongD_MISSING "WrongD_DIR-NOTFOUND") +set(wibbleA_EXPECTED "A/wibble-config.cmake") +set(wibbleB_EXPECTED "B/wibble-config.cmake") +set(RecursiveA_EXPECTED "lib/RecursiveA/recursivea-config.cmake") +set(RecursiveB_EXPECTED "lib/zot-2.0/zot-config.cmake") +set(RecursiveC_EXPECTED "lib/zot-3.1/zot-config.cmake") +set(ArchA_EXPECTED "lib/arch/Bar/BarConfig.cmake") +set(ArchB_EXPECTED "lib/arch/foo-1.2/CMake/FooConfig.cmake") +set(ArchC_EXPECTED "lib/arch/zot-3.1/zot-config.cmake") +set(ArchD_EXPECTED "lib/arch/cmake/zot-4.0/zot-config.cmake") +set(EnvA_EXPECTED "lib/zot-3.1/zot-config.cmake") +set(EnvB_MISSING "EnvB_DIR-NOTFOUND") +set(SetFoundTRUE_EXPECTED "cmake/SetFoundTRUEConfig.cmake") +set(SetFoundFALSE_MISSING "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +set(CMakeTestSystemPackage_EXPECTED "SystemPackage/CMakeTestSystemPackageConfig.cmake") # Check the results. -FOREACH(p ${PACKAGES}) - IF(DEFINED ${p}_MISSING) +foreach(p ${PACKAGES}) + if(DEFINED ${p}_MISSING) # Check and report failure. - IF(NOT "${${p}_DIR}" STREQUAL "${${p}_MISSING}") - MESSAGE(SEND_ERROR + if(NOT "${${p}_DIR}" STREQUAL "${${p}_MISSING}") + message(SEND_ERROR "Package ${p} should have been [${${p}_MISSING}] but " "was [${${p}_DIR}]") - ENDIF() - IF(${p}_FOUND) - MESSAGE(SEND_ERROR + endif() + if(${p}_FOUND) + message(SEND_ERROR "Package ${p} should not have been found, but ${p}_FOUND is set to " "\"${${p}_FOUND}\"") - ENDIF() - ELSEIF(${p}_FOUND) + endif() + elseif(${p}_FOUND) # Convert to relative path for comparison to expected location. - FILE(RELATIVE_PATH REL_${p}_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}" + file(RELATIVE_PATH REL_${p}_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}" "${${p}_CONFIG}") # Debugging output. - IF(CMAKE_FIND_DEBUG_MODE) - MESSAGE("Package ${p} found [${REL_${p}_CONFIG}]") - ENDIF(CMAKE_FIND_DEBUG_MODE) + if(CMAKE_FIND_DEBUG_MODE) + message("Package ${p} found [${REL_${p}_CONFIG}]") + endif() # Check and report failure. - IF(NOT "${REL_${p}_CONFIG}" STREQUAL "${${p}_EXPECTED}") - MESSAGE(SEND_ERROR + if(NOT "${REL_${p}_CONFIG}" STREQUAL "${${p}_EXPECTED}") + message(SEND_ERROR "Package ${p} should have been [${${p}_EXPECTED}] but " "was [${REL_${p}_CONFIG}]") - ENDIF(NOT "${REL_${p}_CONFIG}" STREQUAL "${${p}_EXPECTED}") - ELSE() - MESSAGE(SEND_ERROR "Package ${p} not found!") - ENDIF() -ENDFOREACH(p) + endif() + else() + message(SEND_ERROR "Package ${p} not found!") + endif() +endforeach() # Check that version information was extracted. -IF(NOT "${VersionedA_VERSION}" STREQUAL "2.0") - MESSAGE(SEND_ERROR +if(NOT "${VersionedA_VERSION}" STREQUAL "2.0") + message(SEND_ERROR "Package VersionedA is version [${VersionedA_VERSION}], not [2.0]") -ENDIF(NOT "${VersionedA_VERSION}" STREQUAL "2.0") -IF(NOT "${VersionedA_VERSION_MAJOR}" STREQUAL "2") - MESSAGE(SEND_ERROR +endif() +if(NOT "${VersionedA_VERSION_MAJOR}" STREQUAL "2") + message(SEND_ERROR "Package VersionedA is major version [${VersionedA_VERSION_MAJOR}], not [2]") -ENDIF(NOT "${VersionedA_VERSION_MAJOR}" STREQUAL "2") -IF(NOT "${VersionedA_VERSION_MINOR}" STREQUAL "0") - MESSAGE(SEND_ERROR +endif() +if(NOT "${VersionedA_VERSION_MINOR}" STREQUAL "0") + message(SEND_ERROR "Package VersionedA is minor version [${VersionedA_VERSION_MINOR}], not [0]") -ENDIF(NOT "${VersionedA_VERSION_MINOR}" STREQUAL "0") +endif() -IF(NOT "${VersionedB_VERSION}" STREQUAL "3.1") - MESSAGE(SEND_ERROR +if(NOT "${VersionedB_VERSION}" STREQUAL "3.1") + message(SEND_ERROR "Package VersionedB is version [${VersionedB_VERSION}], not [3.1]") -ENDIF(NOT "${VersionedB_VERSION}" STREQUAL "3.1") -IF(NOT "${VersionedB_VERSION_MAJOR}" STREQUAL "3") - MESSAGE(SEND_ERROR +endif() +if(NOT "${VersionedB_VERSION_MAJOR}" STREQUAL "3") + message(SEND_ERROR "Package VersionedB is major version [${VersionedB_VERSION_MAJOR}], not [3]") -ENDIF(NOT "${VersionedB_VERSION_MAJOR}" STREQUAL "3") -IF(NOT "${VersionedB_VERSION_MINOR}" STREQUAL "1") - MESSAGE(SEND_ERROR +endif() +if(NOT "${VersionedB_VERSION_MINOR}" STREQUAL "1") + message(SEND_ERROR "Package VersionedB is minor version [${VersionedB_VERSION_MINOR}], not [1]") -ENDIF(NOT "${VersionedB_VERSION_MINOR}" STREQUAL "1") +endif() -IF(NOT "${Special_VERSION}" STREQUAL "1.2") - MESSAGE(SEND_ERROR +if(NOT "${Special_VERSION}" STREQUAL "1.2") + message(SEND_ERROR "Package Special is version [${Special_VERSION}], not [1.2]") -ENDIF(NOT "${Special_VERSION}" STREQUAL "1.2") -IF(NOT "${Special_VERSION_MAJOR}" STREQUAL "1") - MESSAGE(SEND_ERROR +endif() +if(NOT "${Special_VERSION_MAJOR}" STREQUAL "1") + message(SEND_ERROR "Package Special is major version [${Special_VERSION_MAJOR}], not [1]") -ENDIF(NOT "${Special_VERSION_MAJOR}" STREQUAL "1") -IF(NOT "${Special_VERSION_MINOR}" STREQUAL "2") - MESSAGE(SEND_ERROR +endif() +if(NOT "${Special_VERSION_MINOR}" STREQUAL "2") + message(SEND_ERROR "Package Special is minor version [${Special_VERSION_MINOR}], not [2]") -ENDIF(NOT "${Special_VERSION_MINOR}" STREQUAL "2") +endif() # Test version number comparison. -IF(NOT "1.2.3.4" VERSION_LESS "1.2.3.5") - MESSAGE(SEND_ERROR "1.2.3.4 VERSION_LESS 1.2.3.5 is not true!") -ENDIF() -IF(NOT "1.2" VERSION_LESS "1.10") - MESSAGE(SEND_ERROR "1.2 VERSION_LESS 1.10 is not true!") -ENDIF() -IF(NOT "1.02" VERSION_GREATER "1.1") - MESSAGE(SEND_ERROR "1.02 VERSION_GREATER 1.1 is not true!") -ENDIF() -IF("1.2.3" VERSION_GREATER "1.2.3.4") - MESSAGE(SEND_ERROR "1.2.3 VERSION_GREATER 1.2.3.4 is not false!") -ENDIF() -IF(NOT "1.2" VERSION_EQUAL "1.2.0.0") - MESSAGE(SEND_ERROR "1.2 VERSION_EQUAL 1.2.0.0 is not true!") -ENDIF() +if(NOT "1.2.3.4" VERSION_LESS "1.2.3.5") + message(SEND_ERROR "1.2.3.4 VERSION_LESS 1.2.3.5 is not true!") +endif() +if(NOT "1.2" VERSION_LESS "1.10") + message(SEND_ERROR "1.2 VERSION_LESS 1.10 is not true!") +endif() +if(NOT "1.02" VERSION_GREATER "1.1") + message(SEND_ERROR "1.02 VERSION_GREATER 1.1 is not true!") +endif() +if("1.2.3" VERSION_GREATER "1.2.3.4") + message(SEND_ERROR "1.2.3 VERSION_GREATER 1.2.3.4 is not false!") +endif() +if(NOT "1.2" VERSION_EQUAL "1.2.0.0") + message(SEND_ERROR "1.2 VERSION_EQUAL 1.2.0.0 is not true!") +endif() #----------------------------------------------------------------------------- # Test export(PACKAGE) with find_package. -MESSAGE(STATUS "Preparing export(PACKAGE) test project") -TRY_COMPILE(EXPORTER_COMPILED +message(STATUS "Preparing export(PACKAGE) test project") +try_compile(EXPORTER_COMPILED ${FindPackageTest_BINARY_DIR}/Exporter ${FindPackageTest_SOURCE_DIR}/Exporter CMakeTestExportPackage dummy OUTPUT_VARIABLE output) -MESSAGE(STATUS "Searching for export(PACKAGE) test project") -SET(CMakeTestExportPackage_DIR "" CACHE FILEPATH +message(STATUS "Searching for export(PACKAGE) test project") +set(CMakeTestExportPackage_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE) -STRING(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION}) -FIND_PACKAGE(CMakeTestExportPackage 1.${version} EXACT REQUIRED) +string(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION}) +find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED) #----------------------------------------------------------------------------- # Test configure_package_config_file(). diff --git a/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in b/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in index ff450a145..42bd84ea8 100644 --- a/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in +++ b/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in @@ -1,6 +1,6 @@ # Test config file. -SET(PACKAGE_VERSION "1.@CMAKE_VERSION@") -IF("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "${PACKAGE_VERSION}") - SET(PACKAGE_VERSION_COMPATIBLE 1) - SET(PACKAGE_VERSION_EXACT 1) -ENDIF() +set(PACKAGE_VERSION "1.@CMAKE_VERSION@") +if("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_COMPATIBLE 1) + set(PACKAGE_VERSION_EXACT 1) +endif() diff --git a/Tests/FindPackageTest/FindRecursiveA.cmake b/Tests/FindPackageTest/FindRecursiveA.cmake index 3af7e99a3..a6d25dc4b 100644 --- a/Tests/FindPackageTest/FindRecursiveA.cmake +++ b/Tests/FindPackageTest/FindRecursiveA.cmake @@ -1 +1 @@ -FIND_PACKAGE(RecursiveA NO_MODULE) +find_package(RecursiveA NO_MODULE) diff --git a/Tests/FindPackageTest/FindRecursiveB.cmake b/Tests/FindPackageTest/FindRecursiveB.cmake index c609ab127..9e28f2ce9 100644 --- a/Tests/FindPackageTest/FindRecursiveB.cmake +++ b/Tests/FindPackageTest/FindRecursiveB.cmake @@ -1 +1 @@ -FIND_PACKAGE(RecursiveB NAMES zot) +find_package(RecursiveB NAMES zot) diff --git a/Tests/FindPackageTest/FindRecursiveC.cmake b/Tests/FindPackageTest/FindRecursiveC.cmake index 018cc7302..cd4400ca0 100644 --- a/Tests/FindPackageTest/FindRecursiveC.cmake +++ b/Tests/FindPackageTest/FindRecursiveC.cmake @@ -1 +1 @@ -FIND_PACKAGE(RecursiveC NAMES zot) +find_package(RecursiveC NAMES zot) diff --git a/Tests/FindPackageTest/FindSomePackage.cmake b/Tests/FindPackageTest/FindSomePackage.cmake new file mode 100644 index 000000000..83d1d0e4d --- /dev/null +++ b/Tests/FindPackageTest/FindSomePackage.cmake @@ -0,0 +1,6 @@ +set(SOP_FOO TRUE) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(SomePackage REQUIRED_VARS SOP_FOO + FOUND_VAR SomePackage_FOUND ) diff --git a/Tests/FindPackageTest/FindUpperCasePackage.cmake b/Tests/FindPackageTest/FindUpperCasePackage.cmake new file mode 100644 index 000000000..66c2fea5b --- /dev/null +++ b/Tests/FindPackageTest/FindUpperCasePackage.cmake @@ -0,0 +1,6 @@ +set(UCP_FOO TRUE) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(UpperCasePackage REQUIRED_VARS UCP_FOO + FOUND_VAR UPPERCASEPACKAGE_FOUND ) diff --git a/Tests/FindPackageTest/FindVersionTestA.cmake b/Tests/FindPackageTest/FindVersionTestA.cmake index 55c67e257..982859382 100644 --- a/Tests/FindPackageTest/FindVersionTestA.cmake +++ b/Tests/FindPackageTest/FindVersionTestA.cmake @@ -1,18 +1,18 @@ -IF(NOT "${VersionTestA_FIND_VERSION}" STREQUAL "1") - MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION=${VersionTestA_FIND_VERSION} is not 1") -ENDIF(NOT "${VersionTestA_FIND_VERSION}" STREQUAL "1") -IF(NOT "${VersionTestA_FIND_VERSION_MAJOR}" STREQUAL "1") - MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_MAJOR=${VersionTestA_FIND_VERSION_MAJOR} is not 1") -ENDIF(NOT "${VersionTestA_FIND_VERSION_MAJOR}" STREQUAL "1") -IF(NOT "${VersionTestA_FIND_VERSION_MINOR}" STREQUAL "0") - MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_MINOR=${VersionTestA_FIND_VERSION_MINOR} is not 0") -ENDIF(NOT "${VersionTestA_FIND_VERSION_MINOR}" STREQUAL "0") -IF(NOT "${VersionTestA_FIND_VERSION_PATCH}" STREQUAL "0") - MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_PATCH=${VersionTestA_FIND_VERSION_PATCH} is not 0") -ENDIF(NOT "${VersionTestA_FIND_VERSION_PATCH}" STREQUAL "0") -IF(NOT "${VersionTestA_FIND_VERSION_TWEAK}" STREQUAL "0") - MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_TWEAK=${VersionTestA_FIND_VERSION_TWEAK} is not 0") -ENDIF(NOT "${VersionTestA_FIND_VERSION_TWEAK}" STREQUAL "0") -IF(NOT "${VersionTestA_FIND_VERSION_COUNT}" STREQUAL "1") - MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_COUNT=${VersionTestA_FIND_VERSION_COUNT} is not 1") -ENDIF(NOT "${VersionTestA_FIND_VERSION_COUNT}" STREQUAL "1") +if(NOT "${VersionTestA_FIND_VERSION}" STREQUAL "1") + message(SEND_ERROR "VersionTestA_FIND_VERSION=${VersionTestA_FIND_VERSION} is not 1") +endif() +if(NOT "${VersionTestA_FIND_VERSION_MAJOR}" STREQUAL "1") + message(SEND_ERROR "VersionTestA_FIND_VERSION_MAJOR=${VersionTestA_FIND_VERSION_MAJOR} is not 1") +endif() +if(NOT "${VersionTestA_FIND_VERSION_MINOR}" STREQUAL "0") + message(SEND_ERROR "VersionTestA_FIND_VERSION_MINOR=${VersionTestA_FIND_VERSION_MINOR} is not 0") +endif() +if(NOT "${VersionTestA_FIND_VERSION_PATCH}" STREQUAL "0") + message(SEND_ERROR "VersionTestA_FIND_VERSION_PATCH=${VersionTestA_FIND_VERSION_PATCH} is not 0") +endif() +if(NOT "${VersionTestA_FIND_VERSION_TWEAK}" STREQUAL "0") + message(SEND_ERROR "VersionTestA_FIND_VERSION_TWEAK=${VersionTestA_FIND_VERSION_TWEAK} is not 0") +endif() +if(NOT "${VersionTestA_FIND_VERSION_COUNT}" STREQUAL "1") + message(SEND_ERROR "VersionTestA_FIND_VERSION_COUNT=${VersionTestA_FIND_VERSION_COUNT} is not 1") +endif() diff --git a/Tests/FindPackageTest/FindVersionTestB.cmake b/Tests/FindPackageTest/FindVersionTestB.cmake index 03173c65a..1ebb82302 100644 --- a/Tests/FindPackageTest/FindVersionTestB.cmake +++ b/Tests/FindPackageTest/FindVersionTestB.cmake @@ -1,18 +1,18 @@ -IF(NOT "${VersionTestB_FIND_VERSION}" STREQUAL "1.2") - MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION=${VersionTestB_FIND_VERSION} is not 1.2") -ENDIF(NOT "${VersionTestB_FIND_VERSION}" STREQUAL "1.2") -IF(NOT "${VersionTestB_FIND_VERSION_MAJOR}" STREQUAL "1") - MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_MAJOR=${VersionTestB_FIND_VERSION_MAJOR} is not 1") -ENDIF(NOT "${VersionTestB_FIND_VERSION_MAJOR}" STREQUAL "1") -IF(NOT "${VersionTestB_FIND_VERSION_MINOR}" STREQUAL "2") - MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_MINOR=${VersionTestB_FIND_VERSION_MINOR} is not 2") -ENDIF(NOT "${VersionTestB_FIND_VERSION_MINOR}" STREQUAL "2") -IF(NOT "${VersionTestB_FIND_VERSION_PATCH}" STREQUAL "0") - MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_PATCH=${VersionTestB_FIND_VERSION_PATCH} is not 0") -ENDIF(NOT "${VersionTestB_FIND_VERSION_PATCH}" STREQUAL "0") -IF(NOT "${VersionTestB_FIND_VERSION_TWEAK}" STREQUAL "0") - MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_TWEAK=${VersionTestB_FIND_VERSION_TWEAK} is not 0") -ENDIF(NOT "${VersionTestB_FIND_VERSION_TWEAK}" STREQUAL "0") -IF(NOT "${VersionTestB_FIND_VERSION_COUNT}" STREQUAL "2") - MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_COUNT=${VersionTestB_FIND_VERSION_COUNT} is not 2") -ENDIF(NOT "${VersionTestB_FIND_VERSION_COUNT}" STREQUAL "2") +if(NOT "${VersionTestB_FIND_VERSION}" STREQUAL "1.2") + message(SEND_ERROR "VersionTestB_FIND_VERSION=${VersionTestB_FIND_VERSION} is not 1.2") +endif() +if(NOT "${VersionTestB_FIND_VERSION_MAJOR}" STREQUAL "1") + message(SEND_ERROR "VersionTestB_FIND_VERSION_MAJOR=${VersionTestB_FIND_VERSION_MAJOR} is not 1") +endif() +if(NOT "${VersionTestB_FIND_VERSION_MINOR}" STREQUAL "2") + message(SEND_ERROR "VersionTestB_FIND_VERSION_MINOR=${VersionTestB_FIND_VERSION_MINOR} is not 2") +endif() +if(NOT "${VersionTestB_FIND_VERSION_PATCH}" STREQUAL "0") + message(SEND_ERROR "VersionTestB_FIND_VERSION_PATCH=${VersionTestB_FIND_VERSION_PATCH} is not 0") +endif() +if(NOT "${VersionTestB_FIND_VERSION_TWEAK}" STREQUAL "0") + message(SEND_ERROR "VersionTestB_FIND_VERSION_TWEAK=${VersionTestB_FIND_VERSION_TWEAK} is not 0") +endif() +if(NOT "${VersionTestB_FIND_VERSION_COUNT}" STREQUAL "2") + message(SEND_ERROR "VersionTestB_FIND_VERSION_COUNT=${VersionTestB_FIND_VERSION_COUNT} is not 2") +endif() diff --git a/Tests/FindPackageTest/FindVersionTestC.cmake b/Tests/FindPackageTest/FindVersionTestC.cmake index 1344cbc22..450c2e914 100644 --- a/Tests/FindPackageTest/FindVersionTestC.cmake +++ b/Tests/FindPackageTest/FindVersionTestC.cmake @@ -1,18 +1,18 @@ -IF(NOT "${VersionTestC_FIND_VERSION}" STREQUAL "1.2.3") - MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION=${VersionTestC_FIND_VERSION} is not 1.2.3") -ENDIF(NOT "${VersionTestC_FIND_VERSION}" STREQUAL "1.2.3") -IF(NOT "${VersionTestC_FIND_VERSION_MAJOR}" STREQUAL "1") - MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION_MAJOR=${VersionTestC_FIND_VERSION_MAJOR} is not 1") -ENDIF(NOT "${VersionTestC_FIND_VERSION_MAJOR}" STREQUAL "1") -IF(NOT "${VersionTestC_FIND_VERSION_MINOR}" STREQUAL "2") - MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION_MINOR=${VersionTestC_FIND_VERSION_MINOR} is not 2") -ENDIF(NOT "${VersionTestC_FIND_VERSION_MINOR}" STREQUAL "2") -IF(NOT "${VersionTestC_FIND_VERSION_PATCH}" STREQUAL "3") - MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION_PATCH=${VersionTestC_FIND_VERSION_PATCH} is not 3") -ENDIF(NOT "${VersionTestC_FIND_VERSION_PATCH}" STREQUAL "3") -IF(NOT "${VersionTestC_FIND_VERSION_TWEAK}" STREQUAL "0") - MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION_TWEAK=${VersionTestC_FIND_VERSION_TWEAK} is not 0") -ENDIF(NOT "${VersionTestC_FIND_VERSION_TWEAK}" STREQUAL "0") -IF(NOT "${VersionTestC_FIND_VERSION_COUNT}" STREQUAL "3") - MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION_COUNT=${VersionTestC_FIND_VERSION_COUNT} is not 3") -ENDIF(NOT "${VersionTestC_FIND_VERSION_COUNT}" STREQUAL "3") +if(NOT "${VersionTestC_FIND_VERSION}" STREQUAL "1.2.3") + message(SEND_ERROR "VersionTestC_FIND_VERSION=${VersionTestC_FIND_VERSION} is not 1.2.3") +endif() +if(NOT "${VersionTestC_FIND_VERSION_MAJOR}" STREQUAL "1") + message(SEND_ERROR "VersionTestC_FIND_VERSION_MAJOR=${VersionTestC_FIND_VERSION_MAJOR} is not 1") +endif() +if(NOT "${VersionTestC_FIND_VERSION_MINOR}" STREQUAL "2") + message(SEND_ERROR "VersionTestC_FIND_VERSION_MINOR=${VersionTestC_FIND_VERSION_MINOR} is not 2") +endif() +if(NOT "${VersionTestC_FIND_VERSION_PATCH}" STREQUAL "3") + message(SEND_ERROR "VersionTestC_FIND_VERSION_PATCH=${VersionTestC_FIND_VERSION_PATCH} is not 3") +endif() +if(NOT "${VersionTestC_FIND_VERSION_TWEAK}" STREQUAL "0") + message(SEND_ERROR "VersionTestC_FIND_VERSION_TWEAK=${VersionTestC_FIND_VERSION_TWEAK} is not 0") +endif() +if(NOT "${VersionTestC_FIND_VERSION_COUNT}" STREQUAL "3") + message(SEND_ERROR "VersionTestC_FIND_VERSION_COUNT=${VersionTestC_FIND_VERSION_COUNT} is not 3") +endif() diff --git a/Tests/FindPackageTest/FindVersionTestD.cmake b/Tests/FindPackageTest/FindVersionTestD.cmake index d3e3f509e..9f2db72e4 100644 --- a/Tests/FindPackageTest/FindVersionTestD.cmake +++ b/Tests/FindPackageTest/FindVersionTestD.cmake @@ -1,18 +1,18 @@ -IF(NOT "${VersionTestD_FIND_VERSION}" STREQUAL "1.2.3.4") - MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION=${VersionTestD_FIND_VERSION} is not 1.2.3.4") -ENDIF(NOT "${VersionTestD_FIND_VERSION}" STREQUAL "1.2.3.4") -IF(NOT "${VersionTestD_FIND_VERSION_MAJOR}" STREQUAL "1") - MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_MAJOR=${VersionTestD_FIND_VERSION_MAJOR} is not 1") -ENDIF(NOT "${VersionTestD_FIND_VERSION_MAJOR}" STREQUAL "1") -IF(NOT "${VersionTestD_FIND_VERSION_MINOR}" STREQUAL "2") - MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_MINOR=${VersionTestD_FIND_VERSION_MINOR} is not 2") -ENDIF(NOT "${VersionTestD_FIND_VERSION_MINOR}" STREQUAL "2") -IF(NOT "${VersionTestD_FIND_VERSION_PATCH}" STREQUAL "3") - MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_PATCH=${VersionTestD_FIND_VERSION_PATCH} is not 3") -ENDIF(NOT "${VersionTestD_FIND_VERSION_PATCH}" STREQUAL "3") -IF(NOT "${VersionTestD_FIND_VERSION_TWEAK}" STREQUAL "4") - MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_TWEAK=${VersionTestD_FIND_VERSION_TWEAK} is not 4") -ENDIF(NOT "${VersionTestD_FIND_VERSION_TWEAK}" STREQUAL "4") -IF(NOT "${VersionTestD_FIND_VERSION_COUNT}" STREQUAL "4") - MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_COUNT=${VersionTestD_FIND_VERSION_COUNT} is not 4") -ENDIF(NOT "${VersionTestD_FIND_VERSION_COUNT}" STREQUAL "4") +if(NOT "${VersionTestD_FIND_VERSION}" STREQUAL "1.2.3.4") + message(SEND_ERROR "VersionTestD_FIND_VERSION=${VersionTestD_FIND_VERSION} is not 1.2.3.4") +endif() +if(NOT "${VersionTestD_FIND_VERSION_MAJOR}" STREQUAL "1") + message(SEND_ERROR "VersionTestD_FIND_VERSION_MAJOR=${VersionTestD_FIND_VERSION_MAJOR} is not 1") +endif() +if(NOT "${VersionTestD_FIND_VERSION_MINOR}" STREQUAL "2") + message(SEND_ERROR "VersionTestD_FIND_VERSION_MINOR=${VersionTestD_FIND_VERSION_MINOR} is not 2") +endif() +if(NOT "${VersionTestD_FIND_VERSION_PATCH}" STREQUAL "3") + message(SEND_ERROR "VersionTestD_FIND_VERSION_PATCH=${VersionTestD_FIND_VERSION_PATCH} is not 3") +endif() +if(NOT "${VersionTestD_FIND_VERSION_TWEAK}" STREQUAL "4") + message(SEND_ERROR "VersionTestD_FIND_VERSION_TWEAK=${VersionTestD_FIND_VERSION_TWEAK} is not 4") +endif() +if(NOT "${VersionTestD_FIND_VERSION_COUNT}" STREQUAL "4") + message(SEND_ERROR "VersionTestD_FIND_VERSION_COUNT=${VersionTestD_FIND_VERSION_COUNT} is not 4") +endif() diff --git a/Tests/FindPackageTest/lib/TApp/TAppConfig.cmake b/Tests/FindPackageTest/lib/TApp/TAppConfig.cmake index cbf06036e..5ba8d5585 100644 --- a/Tests/FindPackageTest/lib/TApp/TAppConfig.cmake +++ b/Tests/FindPackageTest/lib/TApp/TAppConfig.cmake @@ -1,2 +1,2 @@ # Test config file that should not be found. -MESSAGE("Package TApp found non-bundle first!") +message("Package TApp found non-bundle first!") diff --git a/Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config-version.cmake b/Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config-version.cmake index 2f768e8f5..822b44966 100644 --- a/Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config-version.cmake +++ b/Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config-version.cmake @@ -1,7 +1,7 @@ -SET(PACKAGE_VERSION 4.0) -IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4) - SET(PACKAGE_VERSION_COMPATIBLE 1) - IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0) - SET(PACKAGE_VERSION_EXACT 1) - ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0) -ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4) +set(PACKAGE_VERSION 4.0) +if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4) + set(PACKAGE_VERSION_COMPATIBLE 1) + if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0) + set(PACKAGE_VERSION_EXACT 1) + endif() +endif() diff --git a/Tests/FindPackageTest/lib/arch/zot-3.1/zot-config-version.cmake b/Tests/FindPackageTest/lib/arch/zot-3.1/zot-config-version.cmake index 13763adf1..31573b90a 100644 --- a/Tests/FindPackageTest/lib/arch/zot-3.1/zot-config-version.cmake +++ b/Tests/FindPackageTest/lib/arch/zot-3.1/zot-config-version.cmake @@ -1,7 +1,7 @@ -SET(PACKAGE_VERSION 3.1) -IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) - SET(PACKAGE_VERSION_COMPATIBLE 1) - IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) - SET(PACKAGE_VERSION_EXACT 1) - ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) -ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) +set(PACKAGE_VERSION 3.1) +if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) + set(PACKAGE_VERSION_COMPATIBLE 1) + if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) + set(PACKAGE_VERSION_EXACT 1) + endif() +endif() diff --git a/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake b/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake index bee2f0eea..e3e17de7c 100644 --- a/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake +++ b/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake @@ -1,4 +1,4 @@ # Claim to be any version to test that CMAKE_IGNORE_PATH hides us. -SET(PACKAGE_VERSION 3.1) -SET(PACKAGE_VERSION_COMPATIBLE 1) -SET(PACKAGE_VERSION_EXACT 1) +set(PACKAGE_VERSION 3.1) +set(PACKAGE_VERSION_COMPATIBLE 1) +set(PACKAGE_VERSION_EXACT 1) diff --git a/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake index 606945f2d..bcefcd746 100644 --- a/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake +++ b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake @@ -1,8 +1,8 @@ -SET(PACKAGE_VERSION 4.0) -IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4) - SET(PACKAGE_VERSION_COMPATIBLE 1) - IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0) - SET(PACKAGE_VERSION_EXACT 1) - ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0) -ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4) +set(PACKAGE_VERSION 4.0) +if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4) + set(PACKAGE_VERSION_COMPATIBLE 1) + if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0) + set(PACKAGE_VERSION_EXACT 1) + endif() +endif() diff --git a/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfigVersion.cmake b/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfigVersion.cmake index 5c3bddece..b37bc8e22 100644 --- a/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfigVersion.cmake +++ b/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfigVersion.cmake @@ -1,7 +1,7 @@ -SET(PACKAGE_VERSION 1.2) -IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1) - SET(PACKAGE_VERSION_COMPATIBLE 1) - IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 2) - SET(PACKAGE_VERSION_EXACT 1) - ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 2) -ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1) +set(PACKAGE_VERSION 1.2) +if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1) + set(PACKAGE_VERSION_COMPATIBLE 1) + if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 2) + set(PACKAGE_VERSION_EXACT 1) + endif() +endif() diff --git a/Tests/FindPackageTest/lib/zot-2.0/zot-config-version.cmake b/Tests/FindPackageTest/lib/zot-2.0/zot-config-version.cmake index 10ac53d19..db3a8a40c 100644 --- a/Tests/FindPackageTest/lib/zot-2.0/zot-config-version.cmake +++ b/Tests/FindPackageTest/lib/zot-2.0/zot-config-version.cmake @@ -1,5 +1,5 @@ -SET(PACKAGE_VERSION 2.0) -IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 2) - SET(PACKAGE_VERSION_COMPATIBLE 1) -ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 2) +set(PACKAGE_VERSION 2.0) +if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 2) + set(PACKAGE_VERSION_COMPATIBLE 1) +endif() diff --git a/Tests/FindPackageTest/lib/zot-3.0/zot-config-version.cmake b/Tests/FindPackageTest/lib/zot-3.0/zot-config-version.cmake index af57cfa5c..dd9c939c5 100644 --- a/Tests/FindPackageTest/lib/zot-3.0/zot-config-version.cmake +++ b/Tests/FindPackageTest/lib/zot-3.0/zot-config-version.cmake @@ -1,5 +1,5 @@ -SET(PACKAGE_VERSION 3.0) -IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) - SET(PACKAGE_VERSION_COMPATIBLE 1) -ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) +set(PACKAGE_VERSION 3.0) +if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) + set(PACKAGE_VERSION_COMPATIBLE 1) +endif() diff --git a/Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake b/Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake index b54d94ce6..8fa767ea1 100644 --- a/Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake +++ b/Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake @@ -1,8 +1,8 @@ -SET(PACKAGE_VERSION 3.1) -IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) - SET(PACKAGE_VERSION_COMPATIBLE 1) - IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) - SET(PACKAGE_VERSION_EXACT 1) - ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) -ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) +set(PACKAGE_VERSION 3.1) +if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) + set(PACKAGE_VERSION_COMPATIBLE 1) + if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) + set(PACKAGE_VERSION_EXACT 1) + endif() +endif() diff --git a/Tests/FindPackageTest/lib/zot/zot-config-version.cmake b/Tests/FindPackageTest/lib/zot/zot-config-version.cmake index 2a6be8640..430f009e1 100644 --- a/Tests/FindPackageTest/lib/zot/zot-config-version.cmake +++ b/Tests/FindPackageTest/lib/zot/zot-config-version.cmake @@ -1,10 +1,10 @@ # This version should never, ever be used. -SET(PACKAGE_VERSION_UNSUITABLE 1) -SET(PACKAGE_VERSION 3.1) -IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) - SET(PACKAGE_VERSION_COMPATIBLE 1) - IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) - SET(PACKAGE_VERSION_EXACT 1) - ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) -ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) +set(PACKAGE_VERSION_UNSUITABLE 1) +set(PACKAGE_VERSION 3.1) +if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) + set(PACKAGE_VERSION_COMPATIBLE 1) + if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) + set(PACKAGE_VERSION_EXACT 1) + endif() +endif() diff --git a/Tests/FindPackageTest/lib/zot/zot-config.cmake b/Tests/FindPackageTest/lib/zot/zot-config.cmake index 442b8a4ec..916818360 100644 --- a/Tests/FindPackageTest/lib/zot/zot-config.cmake +++ b/Tests/FindPackageTest/lib/zot/zot-config.cmake @@ -1,2 +1,2 @@ # Test config file that is unsuitable. -MESSAGE(FATAL_ERROR "Unsuitable version of zot was found") +message(FATAL_ERROR "Unsuitable version of zot was found") diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index a995f68dd..cda5fed3f 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -121,7 +121,7 @@ else() message("Fortran does not match c compiler") message("Fortran = ${CMAKE_Fortran_COMPILER_ID}") message("C = ${CMAKE_C_COMPILER_ID}") - # hack to make g77 work after CL has been enabled + # hack to make g77 work after CL has been enabled # as a languge, cmake needs language specific versions # of these variables.... if(WIN32 AND "${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") @@ -154,11 +154,11 @@ if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) add_executable(test_use_in_comment_fixedform test_use_in_comment_fixedform.f) set_property(SOURCE test_use_in_comment_fixedform.f PROPERTY Fortran_FORMAT FIXED) - add_executable(test_use_in_comment_freeform + add_executable(test_use_in_comment_freeform test_use_in_comment_freeform.f90) set_property(SOURCE test_use_in_comment_freeform.f90 PROPERTY Fortran_FORMAT FREE) - add_executable(test_in_interface + add_executable(test_in_interface in_interface/main.f90 in_interface/module.f90) @@ -167,7 +167,7 @@ if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) add_executable(test_preprocess test_preprocess.F90) set(TEST_MODULE_DEPENDS 1) -endif(CMAKE_Fortran_COMPILER_SUPPORTS_F90) +endif() if(TEST_MODULE_DEPENDS) # Build the external project separately using a custom target. @@ -175,10 +175,10 @@ if(TEST_MODULE_DEPENDS) if(CMAKE_CONFIGURATION_TYPES) set(External_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") set(External_BUILD_TYPE) - else(CMAKE_CONFIGURATION_TYPES) + else() set(External_CONFIG_TYPE) set(External_BUILD_TYPE -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}) - endif(CMAKE_CONFIGURATION_TYPES) + endif() set(External_SOURCE_DIR "${testf_SOURCE_DIR}/External") set(External_BINARY_DIR "${testf_BINARY_DIR}/External") if("${testf_BINARY_DIR}" MATCHES " ") @@ -197,6 +197,7 @@ if(TEST_MODULE_DEPENDS) --build-two-config --build-project ExtFort --build-generator ${CMAKE_GENERATOR} + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-makeprogram ${CMAKE_MAKE_PROGRAM} --build-options -DCMAKE_Fortran_COMPILER:STRING=${CMAKE_Fortran_COMPILER} -DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS} @@ -205,16 +206,17 @@ if(TEST_MODULE_DEPENDS) -DCMAKE_Fortran_FLAGS_MINSIZEREL:STRING=${CMAKE_Fortran_FLAGS_MINSIZEREL} -DCMAKE_Fortran_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_Fortran_FLAGS_RELWITHDEBINFO} ${External_BUILD_TYPE} - ) + VERBATIM + ) add_custom_target(ExternalTarget ALL DEPENDS ${testf_BINARY_DIR}/ExternalProject) # Test module output directory if available. if(CMAKE_Fortran_MODDIR_FLAG) set(Library_MODDIR "${testf_BINARY_DIR}/Library/modules") - else(CMAKE_Fortran_MODDIR_FLAG) + else() set(Library_MODDIR "${testf_BINARY_DIR}/Library") - endif(CMAKE_Fortran_MODDIR_FLAG) + endif() add_subdirectory(Library) add_subdirectory(Executable) -endif(TEST_MODULE_DEPENDS) +endif() diff --git a/Tests/Fortran/Library/CMakeLists.txt b/Tests/Fortran/Library/CMakeLists.txt index fe1368a07..17438cafb 100644 --- a/Tests/Fortran/Library/CMakeLists.txt +++ b/Tests/Fortran/Library/CMakeLists.txt @@ -1,11 +1,11 @@ -INCLUDE_DIRECTORIES(${Library_MODDIR}) -ADD_LIBRARY(subdir_mods a.f90 b.f90) -ADD_EXECUTABLE(subdir_exe main.f90) -TARGET_LINK_LIBRARIES(subdir_exe subdir_mods) +include_directories(${Library_MODDIR}) +add_library(subdir_mods a.f90 b.f90) +add_executable(subdir_exe main.f90) +target_link_libraries(subdir_exe subdir_mods) # Test module output directory if available. -IF(CMAKE_Fortran_MODDIR_FLAG) - SET_TARGET_PROPERTIES(subdir_mods PROPERTIES +if(CMAKE_Fortran_MODDIR_FLAG) + set_target_properties(subdir_mods PROPERTIES Fortran_MODULE_DIRECTORY modules ) -ENDIF(CMAKE_Fortran_MODDIR_FLAG) +endif() diff --git a/Tests/Fortran/foo.f b/Tests/Fortran/foo.f index dbbb3a4e9..ece0df44c 100644 --- a/Tests/Fortran/foo.f +++ b/Tests/Fortran/foo.f @@ -5,5 +5,5 @@ contains subroutine sub end subroutine - + end module test_mod diff --git a/Tests/Fortran/test_use_in_comment_freeform.f90 b/Tests/Fortran/test_use_in_comment_freeform.f90 index c992a041b..48bcd5a21 100644 --- a/Tests/Fortran/test_use_in_comment_freeform.f90 +++ b/Tests/Fortran/test_use_in_comment_freeform.f90 @@ -1,7 +1,7 @@ PROGRAM foo -! USE bar -! use bar -! Use bar +! USE bar +! use bar +! Use bar WRITE(*,*) 'Hello, Fortran world.' END PROGRAM diff --git a/Tests/FortranC/Flags.cmake.in b/Tests/FortranC/Flags.cmake.in index 0b82f0ead..34363093b 100644 --- a/Tests/FortranC/Flags.cmake.in +++ b/Tests/FortranC/Flags.cmake.in @@ -15,6 +15,7 @@ set(COMMAND) execute_process( WORKING_DIRECTORY "${bld}" COMMAND ${CMAKE_COMMAND} "${src}" -G "@CMAKE_TEST_GENERATOR@" + -T "@CMAKE_TEST_GENERATOR_TOOLSET@" "-DFortranC_TEST_FLAGS=1" "-DCMAKE_C_COMPILER=${bld}/cc.sh" "-DCMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@" diff --git a/Tests/Framework/foo.cxx b/Tests/Framework/foo.cxx index b249ce348..e5c19738c 100644 --- a/Tests/Framework/foo.cxx +++ b/Tests/Framework/foo.cxx @@ -1,7 +1,7 @@ #include #if defined(_WIN32) && defined(foo_EXPORTS) # define CM_TEST_LIB_EXPORT __declspec( dllexport ) -#else +#else # define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT void foo() diff --git a/Tests/FunctionTest/CMakeLists.txt b/Tests/FunctionTest/CMakeLists.txt index 5d4f42d4a..d1fada495 100644 --- a/Tests/FunctionTest/CMakeLists.txt +++ b/Tests/FunctionTest/CMakeLists.txt @@ -1,66 +1,66 @@ # a simple C only test case cmake_minimum_required (VERSION 2.6) -PROJECT (FunctionTest) +project (FunctionTest) -FUNCTION(FAILED testname) - MESSAGE(SEND_ERROR "${testname} failed ${ARGN}") -ENDFUNCTION(FAILED) +function(FAILED testname) + message(SEND_ERROR "${testname} failed ${ARGN}") +endfunction() -FUNCTION(PASS testname) - MESSAGE("${testname} passed ${ARGN}") -ENDFUNCTION(PASS) +function(PASS testname) + message("${testname} passed ${ARGN}") +endfunction() # test scope -SET(COUNT 3) -FUNCTION(scope_test) - SET(COUNT 4) -ENDFUNCTION(scope_test) +set(COUNT 3) +function(scope_test) + set(COUNT 4) +endfunction() scope_test() -IF(COUNT EQUAL "3") +if(COUNT EQUAL "3") PASS("scope") -ELSE(COUNT EQUAL "3") +else() FAILED("COUNT Got: ${COUNT}") -ENDIF(COUNT EQUAL "3") +endif() # test ARGC -FUNCTION(weird_name) - IF("${ARGC}" EQUAL "3") +function(weird_name) + if("${ARGC}" EQUAL "3") PASS("ARGC") - ELSE("${ARGC}" EQUAL "3") + else() FAILED("ARGC" "Got: ${ARGC}") - ENDIF("${ARGC}" EQUAL "3") -ENDFUNCTION(weird_name) + endif() +endfunction() WeIrD_nAmE(a1 a2 a3) # test ARGN -FUNCTION(test_argn_function argument) - IF("${ARGN}" EQUAL "3") +function(test_argn_function argument) + if("${ARGN}" EQUAL "3") PASS("ARGN") - ELSE("${ARGN}" EQUAL "3") + else() FAILED("ARGN" "Got: ${ARGN}") - ENDIF("${ARGN}" EQUAL "3") -ENDFUNCTION(test_argn_function) + endif() +endfunction() Test_Argn_Function(ignored 3) # test argument naming and raise scope function(track_find_variable cache_variable is_changed) set("${is_changed}" changed PARENT_SCOPE) -endfunction(track_find_variable) +endfunction() track_find_variable(testvar is_changed) if ("${is_changed}" STREQUAL changed) pass("same argument name test") -else ("${is_changed}" STREQUAL changed) +else () pass("same argument name test") -endif ("${is_changed}" STREQUAL changed) +endif () include("Util.cmake") tester() if (tester_res STREQUAL "${CMAKE_CURRENT_LIST_FILE}") pass("CMAKE_CURRENT_LIST_FILE test") -else (tester_res STREQUAL "${CMAKE_CURRENT_LIST_FILE}") +else () pass("CMAKE_CURRENT_LIST_FILE test") -endif (tester_res STREQUAL "${CMAKE_CURRENT_LIST_FILE}") +endif () @@ -68,109 +68,109 @@ endif (tester_res STREQUAL "${CMAKE_CURRENT_LIST_FILE}") function (factorial argument result) if (argument LESS 2) set (lresult 1) - else (argument LESS 2) + else () math (EXPR temp "${argument} - 1") factorial (${temp} tresult) math (EXPR lresult "${argument}*${tresult}") - endif (argument LESS 2) + endif () set ("${result}" "${lresult}" PARENT_SCOPE) -endfunction (factorial) +endfunction () factorial (5 fresult) if (fresult EQUAL 120) pass("factorial") -else (fresult EQUAL 120) +else () failed ("factorial, computed ${fresult} instead of 120") -endif (fresult EQUAL 120) +endif () # case test -FUNCTION(strange_function m) - SET("${m}" strange_function PARENT_SCOPE) -ENDFUNCTION(strange_function m) +function(strange_function m) + set("${m}" strange_function PARENT_SCOPE) +endfunction() STRANGE_FUNCTION(var) set(second_var "second_var") -IF("${var}" STREQUAL "strange_function" AND "${second_var}" STREQUAL "second_var") +if("${var}" STREQUAL "strange_function" AND "${second_var}" STREQUAL "second_var") PASS("Case Test" "(${var} ${second_var})") -ELSE("${var}" STREQUAL "strange_function" AND "${second_var}" STREQUAL "second_var") +else() FAILED("Case test" "(${var} ${second_var})") -ENDIF("${var}" STREQUAL "strange_function" AND "${second_var}" STREQUAL "second_var") +endif() # test backing up command -FUNCTION(ADD_EXECUTABLE exec) +function(ADD_EXECUTABLE exec) _ADD_EXECUTABLE(mini${exec} ${ARGN}) -ENDFUNCTION(ADD_EXECUTABLE) +endfunction() # var undef case -FUNCTION(undef_var m) - SET("${m}" PARENT_SCOPE) -ENDFUNCTION(undef_var) +function(undef_var m) + set("${m}" PARENT_SCOPE) +endfunction() -SET(FUNCTION_UNDEFINED 1) +set(FUNCTION_UNDEFINED 1) undef_var(FUNCTION_UNDEFINED) -IF(DEFINED FUNCTION_UNDEFINED) +if(DEFINED FUNCTION_UNDEFINED) FAILED("Function Undefine Test" "(${FUNCTION_UNDEFINED})") -ELSE(DEFINED FUNCTION_UNDEFINED) +else() PASS("Function Undefine Test" "(${FUNCTION_UNDEFINED})") -ENDIF(DEFINED FUNCTION_UNDEFINED) +endif() # Subdirectory scope raise. -SET(SUBDIR_UNDEFINED 1) -ADD_SUBDIRECTORY(SubDirScope) -IF(DEFINED SUBDIR_UNDEFINED) +set(SUBDIR_UNDEFINED 1) +add_subdirectory(SubDirScope) +if(DEFINED SUBDIR_UNDEFINED) FAILED("Subdir Undefine Test" "(${SUBDIR_UNDEFINED})") -ELSE(DEFINED SUBDIR_UNDEFINED) +else() PASS("Subdir Undefine Test" "(${SUBDIR_UNDEFINED})") -ENDIF(DEFINED SUBDIR_UNDEFINED) -IF(DEFINED SUBDIR_DEFINED) +endif() +if(DEFINED SUBDIR_DEFINED) PASS("Subdir Define Test" "(${SUBDIR_DEFINED})") -ELSE(DEFINED SUBDIR_DEFINED) +else() FAILED("Subdir Define Test" "(${SUBDIR_DEFINED})") -ENDIF(DEFINED SUBDIR_DEFINED) +endif() # Test function-scoped directory. -FUNCTION(ADD_SUBDIR2 dir) - ADD_SUBDIRECTORY("${dir}" "${dir}2") +function(ADD_SUBDIR2 dir) + add_subdirectory("${dir}" "${dir}2") # The parent scope sets in the subdir should be visible here. - IF(DEFINED SUBDIR_UNDEFINED) + if(DEFINED SUBDIR_UNDEFINED) FAILED("Subdir Function Undefine Test 1" "(${SUBDIR_UNDEFINED})") - ELSE(DEFINED SUBDIR_UNDEFINED) + else() PASS("Subdir Function Undefine Test 1" "(${SUBDIR_UNDEFINED})") - ENDIF(DEFINED SUBDIR_UNDEFINED) - IF(DEFINED SUBDIR_DEFINED) + endif() + if(DEFINED SUBDIR_DEFINED) PASS("Subdir Function Define Test 1" "(${SUBDIR_DEFINED})") - ELSE(DEFINED SUBDIR_DEFINED) + else() FAILED("Subdir Function Define Test 1" "(${SUBDIR_DEFINED})") - ENDIF(DEFINED SUBDIR_DEFINED) -ENDFUNCTION(ADD_SUBDIR2) + endif() +endfunction() # Reset test variables. -SET(SUBDIR_UNDEFINED 1) -SET(SUBDIR_DEFINED) +set(SUBDIR_UNDEFINED 1) +set(SUBDIR_DEFINED) # Run test function. ADD_SUBDIR2(SubDirScope) # The parent scope sets in the subdir should not be visible here. -IF(DEFINED SUBDIR_UNDEFINED) +if(DEFINED SUBDIR_UNDEFINED) PASS("Subdir Function Undefine Test 2" "(${SUBDIR_UNDEFINED})") -ELSE(DEFINED SUBDIR_UNDEFINED) +else() FAILED("Subdir Function Undefine Test 2" "(${SUBDIR_UNDEFINED})") -ENDIF(DEFINED SUBDIR_UNDEFINED) -IF(DEFINED SUBDIR_DEFINED) +endif() +if(DEFINED SUBDIR_DEFINED) FAILED("Subdir Function Define Test 2" "(${SUBDIR_DEFINED})") -ELSE(DEFINED SUBDIR_DEFINED) +else() PASS("Subdir Function Define Test 2" "(${SUBDIR_DEFINED})") -ENDIF(DEFINED SUBDIR_DEFINED) +endif() -ADD_EXECUTABLE(FunctionTest functionTest.c) +add_executable(FunctionTest functionTest.c) # Use the PROJECT_LABEL property: in IDEs, the project label should appear # in the UI rather than the target name. If this were a good test of the # property rather than just a smoke test, it would verify that the label # actually appears in the UI of the IDE... Or at least that the text appears # somewhere in the generated project files. -SET_PROPERTY(TARGET miniFunctionTest +set_property(TARGET miniFunctionTest PROPERTY PROJECT_LABEL "Test de Fonctionnement") diff --git a/Tests/FunctionTest/SubDirScope/CMakeLists.txt b/Tests/FunctionTest/SubDirScope/CMakeLists.txt index 4a53d2c0a..c1a3cfb37 100644 --- a/Tests/FunctionTest/SubDirScope/CMakeLists.txt +++ b/Tests/FunctionTest/SubDirScope/CMakeLists.txt @@ -1,14 +1,14 @@ -SET(SUBDIR_DEFINED 1 PARENT_SCOPE) -SET(SUBDIR_UNDEFINED PARENT_SCOPE) +set(SUBDIR_DEFINED 1 PARENT_SCOPE) +set(SUBDIR_UNDEFINED PARENT_SCOPE) # The above sets should not affect the current scope. -IF(DEFINED SUBDIR_UNDEFINED) +if(DEFINED SUBDIR_UNDEFINED) PASS("SubdirScope Undefine Test" "(${SUBDIR_UNDEFINED})") -ELSE(DEFINED SUBDIR_UNDEFINED) +else() FAILED("SubdirScope Undefine Test" "(${SUBDIR_UNDEFINED})") -ENDIF(DEFINED SUBDIR_UNDEFINED) -IF(DEFINED SUBDIR_DEFINED) +endif() +if(DEFINED SUBDIR_DEFINED) FAILED("SubdirScope Define Test" "(${SUBDIR_DEFINED})") -ELSE(DEFINED SUBDIR_DEFINED) +else() PASS("SubdirScope Define Test" "(${SUBDIR_DEFINED})") -ENDIF(DEFINED SUBDIR_DEFINED) +endif() diff --git a/Tests/FunctionTest/Util.cmake b/Tests/FunctionTest/Util.cmake index f0c73b5da..846abd78a 100644 --- a/Tests/FunctionTest/Util.cmake +++ b/Tests/FunctionTest/Util.cmake @@ -1,3 +1,3 @@ function(tester) set (tester_res "${CMAKE_CURRENT_LIST_FILE}" PARENT_SCOPE) -endfunction(tester) +endfunction() diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt new file mode 100644 index 000000000..0008c1656 --- /dev/null +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -0,0 +1,126 @@ +cmake_minimum_required (VERSION 2.8.8) +project(GeneratorExpression CXX) + +add_custom_target(check-part1 ALL + COMMAND ${CMAKE_COMMAND} + -Dtest_0=$<0:nothing> + -Dtest_0_with_comma=$<0:-Wl,--no-undefined> + -Dtest_1=$<1:content> + -Dtest_1_with_comma=$<1:-Wl,--no-undefined> + -Dconfig=$ + -Dtest_and_0=$ + -Dtest_and_0_0=$ + -Dtest_and_0_1=$ + -Dtest_and_1=$ + -Dtest_and_1_0=$ + -Dtest_and_1_1=$ + # Ordinarily, the 'invalidcontent' would cause an error, but + # the '0' makes the AND abort early. + -Dtest_and_0_invalidcontent=$ + -Dtest_config_0=$x> + -Dtest_config_1=$> + -Dtest_config_debug=$$$ + -Dtest_config_release=$$$ + -Dtest_config_relwithdebinfo=$$$ + -Dtest_config_minsizerel=$$$ + -Dtest_not_0=$ + -Dtest_not_1=$ + -Dtest_or_0=$ + -Dtest_or_0_0=$ + -Dtest_or_0_1=$ + -Dtest_or_1=$ + -Dtest_or_1_0=$ + -Dtest_or_1_1=$ + -Dtest_or_1_invalidcontent=$ + -Dtest_bool_notfound=$ + -Dtest_bool_foo_notfound=$ + -Dtest_bool_true=$ + -Dtest_bool_false=$ + -Dtest_bool_on=$ + -Dtest_bool_off=$ + -Dtest_bool_no=$ + -Dtest_bool_n=$ + -Dtest_bool_empty=$ + -Dtest_strequal_yes_yes=$ + -Dtest_strequal_yes_yes_cs=$ + -Dtest_strequal_yes_no=$ + -Dtest_strequal_no_yes=$ + -Dtest_strequal_angle_r=$,$> + -Dtest_strequal_comma=$,$> + -Dtest_strequal_semicolon=$,$> + -Dtest_strequal_angle_r_comma=$,$> + -Dtest_strequal_both_empty=$ + -Dtest_strequal_one_empty=$ + -Dtest_angle_r=$ + -Dtest_comma=$ + -Dtest_semicolon=$ + -Dtest_colons_1=$<1::> + -Dtest_colons_2=$<1:::> + -Dtest_colons_3=$<1:Qt5::Core> + -Dtest_colons_4=$<1:C:\\CMake> + -Dtest_colons_5=$<1:C:/CMake> + -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part1.cmake + COMMAND ${CMAKE_COMMAND} -E echo "check done (part 1 of 2)" + VERBATIM + ) + +add_library(empty1 empty.cpp) +target_include_directories(empty1 PUBLIC /empty1/public) +target_include_directories(empty1 PRIVATE /empty1/private) + +add_library(empty2 empty.cpp) +target_include_directories(empty2 PUBLIC /empty2/public) + +add_library(empty3 empty.cpp) +target_include_directories(empty3 PUBLIC /empty3/public) +target_include_directories(empty3 PRIVATE /empty3/private) + +add_library(empty4 empty.cpp) +target_include_directories(empty4 PUBLIC /empty4/public) + +target_link_libraries(empty1 LINK_PUBLIC empty2) +target_link_libraries(empty2 LINK_PUBLIC empty3 empty4) +target_link_libraries(empty3 LINK_PUBLIC empty2 empty4) + +add_library(empty5 empty.cpp) +target_include_directories(empty5 PRIVATE /empty5/private1 /empty5/private2) + +add_custom_target(check-part2 ALL + COMMAND ${CMAKE_COMMAND} + -Dtest_incomplete_1=$< + -Dtest_incomplete_2=$ + -Dtest_incomplete_6= + -Dtest_incomplete_7=$thing + -Dtest_incomplete_14=$<$ + -Dtest_incomplete_15=$ + -Dtest_incomplete_18=$<1:some,thing + -Dtest_incomplete_19=$<1:some,thing$ + -Dtest_incomplete_20=$ + -Dtest_incomplete_21=$ + -Dtest_build_interface=$ + -Dtest_install_interface=$ + -Dtest_target_name_1=$ + -Dtest_target_name_2=$ + -Dtest_target_includes1=$ + -Dtest_target_includes2=$ + -Dtest_target_includes3=$ + -Dtest_target_includes4=$ + -Dtest_target_includes5=$ + -Dtest_target_includes6=$ + -Dtest_target_includes7=$ + -Dtest_target_includes8=$ + -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part2.cmake + COMMAND ${CMAKE_COMMAND} -E echo "check done (part 2 of 2)" + VERBATIM + ) diff --git a/Tests/GeneratorExpression/check-common.cmake b/Tests/GeneratorExpression/check-common.cmake new file mode 100644 index 000000000..8ffebd740 --- /dev/null +++ b/Tests/GeneratorExpression/check-common.cmake @@ -0,0 +1,5 @@ +macro(check var val) + if(NOT "${${var}}" STREQUAL "${val}") + message(SEND_ERROR "${var} is \"${${var}}\", not \"${val}\"") + endif() +endmacro() diff --git a/Tests/GeneratorExpression/check-part1.cmake b/Tests/GeneratorExpression/check-part1.cmake new file mode 100644 index 000000000..9bef15904 --- /dev/null +++ b/Tests/GeneratorExpression/check-part1.cmake @@ -0,0 +1,58 @@ + +include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake) + +message(STATUS "config=[${config}]") +check(test_0 "") +check(test_0_with_comma "") +check(test_1 "content") +check(test_1_with_comma "-Wl,--no-undefined") +check(test_and_0 "0") +check(test_and_0_0 "0") +check(test_and_0_1 "0") +check(test_and_1 "1") +check(test_and_1_0 "0") +check(test_and_1_1 "1") +check(test_and_0_invalidcontent "0") +check(test_config_0 "0") +check(test_config_1 "1") +foreach(c debug release relwithdebinfo minsizerel) + if(NOT "${test_config_${c}}" MATCHES "^(0+|1+)$") + message(SEND_ERROR "test_config_${c} is \"${test_config_${c}}\", not all 0 or all 1") + endif() +endforeach() +check(test_not_0 "1") +check(test_not_1 "0") +check(test_or_0 "0") +check(test_or_0_0 "0") +check(test_or_0_1 "1") +check(test_or_1 "1") +check(test_or_1_0 "1") +check(test_or_1_1 "1") +check(test_or_1_invalidcontent "1") +check(test_bool_notfound "0") +check(test_bool_foo_notfound "0") +check(test_bool_true "1") +check(test_bool_false "0") +check(test_bool_on "1") +check(test_bool_off "0") +check(test_bool_no "0") +check(test_bool_n "0") +check(test_bool_empty "0") +check(test_strequal_yes_yes "1") +check(test_strequal_yes_yes_cs "0") +check(test_strequal_yes_no "0") +check(test_strequal_no_yes "0") +check(test_strequal_angle_r "1") +check(test_strequal_comma "1") +check(test_strequal_semicolon "1") +check(test_strequal_angle_r_comma "0") +check(test_strequal_both_empty "1") +check(test_strequal_one_empty "0") +check(test_angle_r ">") +check(test_comma ",") +check(test_semicolon ";") +check(test_colons_1 ":") +check(test_colons_2 "::") +check(test_colons_3 "Qt5::Core") +check(test_colons_4 "C:\\\\CMake") +check(test_colons_5 "C:/CMake") diff --git a/Tests/GeneratorExpression/check-part2.cmake b/Tests/GeneratorExpression/check-part2.cmake new file mode 100644 index 000000000..3f7187ca2 --- /dev/null +++ b/Tests/GeneratorExpression/check-part2.cmake @@ -0,0 +1,36 @@ + +include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake) + +check(test_incomplete_1 "$<") +check(test_incomplete_2 "$") +check(test_incomplete_6 "") +check(test_incomplete_7 "$") +check(test_incomplete_15 "$") +check(test_incomplete_20 "$") +check(test_incomplete_21 "$") +check(test_build_interface "build") +check(test_install_interface "") +check(test_target_name_1 "tgt,ok") +check(test_target_name_2 "tgt:ok") +check(test_target_includes1 "/empty1/public;/empty2/public;/empty3/public;/empty4/public") +check(test_target_includes2 "/empty2/public;/empty3/public;/empty4/public") +check(test_target_includes3 "/empty3/public;/empty2/public;/empty4/public") +check(test_target_includes4 "/empty1/public;/empty1/private;/empty2/public;/empty3/public;/empty4/public") +check(test_target_includes5 "/empty2/public;/empty3/public;/empty2/public;/empty4/public") +check(test_target_includes6 "/empty3/public;/empty3/private;/empty2/public;/empty3/public;/empty4/public") +check(test_target_includes7 "/empty1/public;/empty2/public;/empty3/public;/empty4/public") +check(test_target_includes8 "/empty5/private1;/empty5/private2") diff --git a/Tests/GeneratorExpression/empty.cpp b/Tests/GeneratorExpression/empty.cpp new file mode 100644 index 000000000..c5399014f --- /dev/null +++ b/Tests/GeneratorExpression/empty.cpp @@ -0,0 +1,2 @@ + +// empty diff --git a/Tests/IPO/CMakeLists.txt b/Tests/IPO/CMakeLists.txt index 595e4f50d..6dabf86bb 100644 --- a/Tests/IPO/CMakeLists.txt +++ b/Tests/IPO/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.8) project(IPO NONE) -SET_PROPERTY(DIRECTORY PROPERTY INTERPROCEDURAL_OPTIMIZATION 1) +set_property(DIRECTORY PROPERTY INTERPROCEDURAL_OPTIMIZATION 1) add_subdirectory(../COnly COnly) add_subdirectory(../CxxOnly CxxOnly) diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt index 334b8be62..ad6671feb 100644 --- a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt @@ -12,13 +12,114 @@ create_header(bar) create_header(bat) create_header(foo) create_header(baz) +create_header(bang) +create_header(bing) +create_header(bung) +create_header(arguments) +create_header(list) +create_header(target) set(CMAKE_INCLUDE_CURRENT_DIR ON) include_directories("${CMAKE_CURRENT_BINARY_DIR}/bar") +include_directories("$<1:${CMAKE_CURRENT_BINARY_DIR}/bang>") add_executable(TargetIncludeDirectories main.cpp) + set_property(TARGET TargetIncludeDirectories APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/bat") set_property(TARGET TargetIncludeDirectories APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/foo") +set_property(TARGET TargetIncludeDirectories APPEND PROPERTY + INCLUDE_DIRECTORIES "$<1:${CMAKE_CURRENT_BINARY_DIR}/bing>") include_directories("${CMAKE_CURRENT_BINARY_DIR}/baz") +include_directories("$<1:${CMAKE_CURRENT_BINARY_DIR}/bung>") +include_directories("sing$<1:/ting>") + +include_directories("$<1:${CMAKE_CURRENT_BINARY_DIR}/arguments;${CMAKE_CURRENT_BINARY_DIR}/list>") + +create_header(fee) +create_header(fiy) +create_header(foh) +create_header(fum) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib1.cpp" "#include \"fee.h\"\n") +add_library(lib1 "${CMAKE_CURRENT_BINARY_DIR}/lib1.cpp") +set_property(TARGET lib1 APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/fee") +set_property(TARGET lib1 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/fiy") +set_property(TARGET lib1 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<$,EXECUTABLE>:${CMAKE_CURRENT_BINARY_DIR}/foh>") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib2.cpp" "#include \"fiy.h\"\n") +add_library(lib2 "${CMAKE_CURRENT_BINARY_DIR}/lib2.cpp") +set_property(TARGET lib2 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/fum;$") +set_property(TARGET lib2 APPEND PROPERTY INCLUDE_DIRECTORIES "$") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main3.cpp" "#include \"fiy.h\"\n#include \"foh.h\"\n#include \"fum.h\"\nint main(int,char**) { return 0; }\n") +add_executable(exe3 "${CMAKE_CURRENT_BINARY_DIR}/main3.cpp") +set_property(TARGET exe3 APPEND PROPERTY INCLUDE_DIRECTORIES "$") + +# Test cycles +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib3.cpp" "#include \"fiy.h\"\n#include \"foh.h\"\n") +add_library(lib3 "${CMAKE_CURRENT_BINARY_DIR}/lib3.cpp") +set_property(TARGET lib3 APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/fiy;$") +set_property(TARGET lib3 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/fiy;$") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib4.cpp" "#include \"fiy.h\"\n#include \"foh.h\"\n") +add_library(lib4 "${CMAKE_CURRENT_BINARY_DIR}/lib4.cpp") +set_property(TARGET lib4 APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/foh;$") +set_property(TARGET lib4 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/foh;$") + +add_library(somelib::withcolons UNKNOWN IMPORTED) +set_property(TARGET somelib::withcolons PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/target") +set_property(TARGET somelib::withcolons PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/target") + +set_property(TARGET TargetIncludeDirectories + APPEND PROPERTY INCLUDE_DIRECTORIES + "$" +) + +add_custom_target(test_custom_target + "some_bogus_custom_tool" + $ + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}") + +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bad") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/bad/common.h" "#error Should not be included\n") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/good") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/good/common.h" "#include \"othergood.h\"\n") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/othergood") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/othergood/othergood.h" "// No error\n") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/libothergood.cpp" "// No content \n") +add_library(libothergood "${CMAKE_CURRENT_BINARY_DIR}/libothergood.cpp") +set_property(TARGET libothergood APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/othergood" +) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/libgood.cpp" "// No content \n") +add_library(libgood "${CMAKE_CURRENT_BINARY_DIR}/libgood.cpp") +set_property(TARGET libgood APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES + "${CMAKE_CURRENT_BINARY_DIR}/good;$" +) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/libbad.cpp" "// No content \n") +add_library(libbad "${CMAKE_CURRENT_BINARY_DIR}/libbad.cpp") +set_property(TARGET libbad APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/bad" +) + + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib5.cpp" "#include \"common.h\"\n") +add_library(lib5 "${CMAKE_CURRENT_BINARY_DIR}/lib5.cpp") + +# Assuming the link order must be: +target_link_libraries(lib5 libbad libgood) + +# Oops!. +# As include directory order and link order are the same when using target_link_libraries, we have to +# get the libgood includes in before the libbad includes. +# We do that with this command: +target_include_directories(lib5 + BEFORE PRIVATE $ +) diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp b/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp index 8aa35320f..90909d334 100644 --- a/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp @@ -3,6 +3,13 @@ #include "bat.h" #include "foo.h" #include "baz.h" +#include "bang.h" +#include "bing.h" +#include "bung.h" +#include "ting.h" +#include "arguments.h" +#include "list.h" +#include "target.h" int main(int, char**) { diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/sing/ting/ting.h b/Tests/IncludeDirectories/TargetIncludeDirectories/sing/ting/ting.h new file mode 100644 index 000000000..4fe01dd3e --- /dev/null +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/sing/ting/ting.h @@ -0,0 +1 @@ +//ting.h diff --git a/Tests/JCTest/CMakeLists.txt b/Tests/JCTest/CMakeLists.txt index a0f590e57..31dcc3abf 100644 --- a/Tests/JCTest/CMakeLists.txt +++ b/Tests/JCTest/CMakeLists.txt @@ -3,7 +3,7 @@ project(TestTime) enable_testing() add_executable(TestTime TestTime.cxx) -foreach(f 1 2 3 4 5 6 7 8 9 10 11 12 12 14 15 16 17 18 19 +foreach(f 1 2 3 4 5 6 7 8 9 10 11 12 12 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30) add_test(TestTime${f} TestTime 50000000) -endforeach(f) +endforeach() diff --git a/Tests/Java/A.java b/Tests/Java/A.java index e34b7046a..403a7f889 100644 --- a/Tests/Java/A.java +++ b/Tests/Java/A.java @@ -1,11 +1,11 @@ class A { - public A() + public A() { } - + public void printName() - { + { System.out.println("A"); } } diff --git a/Tests/Java/HelloWorld.java b/Tests/Java/HelloWorld.java index 54246ec26..378e37193 100644 --- a/Tests/Java/HelloWorld.java +++ b/Tests/Java/HelloWorld.java @@ -1,5 +1,5 @@ class HelloWorld -{ +{ public static void main(String args[]) { A a; diff --git a/Tests/Jump/CMakeLists.txt b/Tests/Jump/CMakeLists.txt index 4bdafd09b..4c5ad303f 100644 --- a/Tests/Jump/CMakeLists.txt +++ b/Tests/Jump/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(Jump) +project(Jump) -SET(CMAKE_IGNORE_DEPENDENCIES_ORDERING 1) -ADD_SUBDIRECTORY(Executable) -ADD_SUBDIRECTORY(Library) +set(CMAKE_IGNORE_DEPENDENCIES_ORDERING 1) +add_subdirectory(Executable) +add_subdirectory(Library) diff --git a/Tests/Jump/Executable/CMakeLists.txt b/Tests/Jump/Executable/CMakeLists.txt index 7658b7e31..bc6731ff1 100644 --- a/Tests/Jump/Executable/CMakeLists.txt +++ b/Tests/Jump/Executable/CMakeLists.txt @@ -1,6 +1,6 @@ -IF(NOT LIBRARY_OUTPUT_PATH) - LINK_DIRECTORIES(${Jump_BINARY_DIR}/Library/Static +if(NOT LIBRARY_OUTPUT_PATH) + link_directories(${Jump_BINARY_DIR}/Library/Static ${Jump_BINARY_DIR}/Library/Shared) -ENDIF(NOT LIBRARY_OUTPUT_PATH) -ADD_EXECUTABLE(jumpExecutable jumpExecutable.cxx) -TARGET_LINK_LIBRARIES(jumpExecutable jumpStatic jumpShared) +endif() +add_executable(jumpExecutable jumpExecutable.cxx) +target_link_libraries(jumpExecutable jumpStatic jumpShared) diff --git a/Tests/Jump/Library/CMakeLists.txt b/Tests/Jump/Library/CMakeLists.txt index 2f78c501c..1d9fed934 100644 --- a/Tests/Jump/Library/CMakeLists.txt +++ b/Tests/Jump/Library/CMakeLists.txt @@ -1,2 +1,2 @@ -ADD_SUBDIRECTORY(Static) -ADD_SUBDIRECTORY(Shared) +add_subdirectory(Static) +add_subdirectory(Shared) diff --git a/Tests/Jump/Library/Shared/CMakeLists.txt b/Tests/Jump/Library/Shared/CMakeLists.txt index 44405770f..a37299a79 100644 --- a/Tests/Jump/Library/Shared/CMakeLists.txt +++ b/Tests/Jump/Library/Shared/CMakeLists.txt @@ -1,26 +1,26 @@ -ADD_LIBRARY(jumpShared SHARED jumpShared.cxx) +add_library(jumpShared SHARED jumpShared.cxx) -IF(WIN32 OR CYGWIN) - SET(SHARED_MUST_BE_IN_EXE_DIR 1) -ENDIF() +if(WIN32 OR CYGWIN) + set(SHARED_MUST_BE_IN_EXE_DIR 1) +endif() -IF(APPLE) - SET(SHARED_MUST_BE_IN_EXE_DIR 1) -ENDIF(APPLE) +if(APPLE) + set(SHARED_MUST_BE_IN_EXE_DIR 1) +endif() -IF(SHARED_MUST_BE_IN_EXE_DIR) - SET(LIB_NAME +if(SHARED_MUST_BE_IN_EXE_DIR) + set(LIB_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}jumpShared${CMAKE_SHARED_LIBRARY_SUFFIX}) - SET(EXE_DIR ${Jump_BINARY_DIR}/Executable) - IF(EXECUTABLE_OUTPUT_PATH) - SET(EXE_DIR ${EXECUTABLE_OUTPUT_PATH}) - ENDIF(EXECUTABLE_OUTPUT_PATH) - SET(LIB_DIR ${Jump_BINARY_DIR}/Library/Shared) - IF(LIBRARY_OUTPUT_PATH) - SET(LIB_DIR ${LIBRARY_OUTPUT_PATH}) - ENDIF(LIBRARY_OUTPUT_PATH) - ADD_CUSTOM_COMMAND(TARGET jumpShared + set(EXE_DIR ${Jump_BINARY_DIR}/Executable) + if(EXECUTABLE_OUTPUT_PATH) + set(EXE_DIR ${EXECUTABLE_OUTPUT_PATH}) + endif() + set(LIB_DIR ${Jump_BINARY_DIR}/Library/Shared) + if(LIBRARY_OUTPUT_PATH) + set(LIB_DIR ${LIBRARY_OUTPUT_PATH}) + endif() + add_custom_command(TARGET jumpShared POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${LIB_DIR}/${CMAKE_CFG_INTDIR}/${LIB_NAME} ${EXE_DIR}/${CMAKE_CFG_INTDIR}/${LIB_NAME}) -ENDIF(SHARED_MUST_BE_IN_EXE_DIR) +endif() diff --git a/Tests/Jump/Library/Static/CMakeLists.txt b/Tests/Jump/Library/Static/CMakeLists.txt index 23e70c0b1..4ee39545a 100644 --- a/Tests/Jump/Library/Static/CMakeLists.txt +++ b/Tests/Jump/Library/Static/CMakeLists.txt @@ -1 +1 @@ -ADD_LIBRARY(jumpStatic STATIC jumpStatic.cxx) +add_library(jumpStatic STATIC jumpStatic.cxx) diff --git a/Tests/KDE4StableBranchTest/test_kde4.sh.in b/Tests/KDE4StableBranchTest/test_kde4.sh.in deleted file mode 100755 index 81badcd79..000000000 --- a/Tests/KDE4StableBranchTest/test_kde4.sh.in +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh - -# This shell script tests whether cmake is able to build the latest -# stable KDE4 release, or at least some part of it. -# It downloads automoc from KDE svn, builds and installs it, then it -# downloads phonon from KDE svn, builds and installs it, and finally -# it downloads kdelibs (currently from the 4.3 branch), and builds -# a (small) part of it, i.e. libkdecore and one unit test depending on it. -# -# - -CMAKE="@CMAKE_CMAKE_COMMAND@" -BASEDIR="@TEST_KDE4_BASE_DIR@" -INSTALLDIR="$BASEDIR/install" -QMAKE="@QT_QMAKE_EXECUTABLE@" - -cd "$BASEDIR" || exit -1 -echo "Removing old install dir " $INSTALLDIR - -rm -rf install || exit -1 -rm -rf build-automoc || exit -1 -rm -rf build-phonon || exit -1 -rm -rf build-kdelibs || exit -1 - - - -# build and install automoc -cd "$BASEDIR" || exit -1 -svn co svn://anonsvn.kde.org/home/kde/tags/kdesupport-for-4.3/kdesupport/automoc || exit -1 - -mkdir -p build-automoc || exit -1 - -cd build-automoc || exit -1 -"$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DQT_QMAKE_EXECUTABLE:STRING="$QMAKE" ../automoc || exit -1 -"$CMAKE" --build . || exit -1 -"$CMAKE" -P cmake_install.cmake || exit -1 - -export CMAKE_PREFIX_PATH="$INSTALLDIR:$CMAKE_PREFIX_PATH" - - -# build and install phonon -cd "$BASEDIR" || exit -1 -svn co svn://anonsvn.kde.org/home/kde/tags/kdesupport-for-4.3/kdesupport/phonon || exit -1 - -mkdir -p build-phonon || exit -1 - -cd build-phonon || exit -1 -"$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DQT_QMAKE_EXECUTABLE:STRING="$QMAKE" -DWITH_GLIB2=FALSE -DWITH_GObject=FALSE -DWITH_GStreamer=FALSE -DWITH_GStreamerPlugins=FALSE -DWITH_OpenGL=FALSE -DWITH_XCB=FALSE -DWITH_Xine=FALSE ../phonon || exit -1 -"$CMAKE" --build . || exit -1 -"$CMAKE" -P cmake_install.cmake || exit -1 - - -# finally build kdelibs/kdecore -cd "$BASEDIR" || exit -1 - -svn co svn://anonsvn.kde.org/home/kde/branches/KDE/4.3/kdelibs/ || exit -1 -mkdir -p build-kdelibs || exit -1 -cd build-kdelibs || exit -1 -# trick cmake into not searching strigi and not searching sharedmimeinfo -"$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DQT_QMAKE_EXECUTABLE:STRING="$QMAKE" -DSTRIGI_FOUND=TRUE -DSTRIGI_INCLUDE_DIR=/usr/include -DSTRIGI_STREAMANALYZER_LIBRARY=-lc -DSTRIGI_STREAMS_LIBRARY=-lc -DSTRIGI_STRIGIQTDBUSCLIENT_LIBRARY=-lc -DSTRIGI_NEEDS_SIGNED_CHAR=TRUE -DSTRIGI_NEEDS_CHAR=FALSE -DUPDATE_MIME_DATABASE_EXECUTABLE=/bin/sh ../kdelibs || exit -1 -make -C kdecore/tests kurltest || exit -1 - diff --git a/Tests/LibName/CMakeLists.txt b/Tests/LibName/CMakeLists.txt index 07499a14d..3ac125fb9 100644 --- a/Tests/LibName/CMakeLists.txt +++ b/Tests/LibName/CMakeLists.txt @@ -1,5 +1,5 @@ project(LibName) -# this is a test to make sure that relative path +# this is a test to make sure that relative path # LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH work set(LIBRARY_OUTPUT_PATH lib) set(EXECUTABLE_OUTPUT_PATH lib) @@ -11,9 +11,9 @@ target_link_libraries(foo bar) add_executable(foobar foobar.c) target_link_libraries(foobar foo) -IF(UNIX) +if(UNIX) target_link_libraries(foobar -L/usr/local/lib) -ENDIF(UNIX) +endif() # check with lib version diff --git a/Tests/LibName/bar.c b/Tests/LibName/bar.c index 960718038..f82aa28e8 100644 --- a/Tests/LibName/bar.c +++ b/Tests/LibName/bar.c @@ -1,7 +1,7 @@ #ifdef _WIN32 -__declspec(dllexport) +__declspec(dllexport) #endif - + extern void foo() { } diff --git a/Tests/LibName/foo.c b/Tests/LibName/foo.c index a68970405..6d258e0e9 100644 --- a/Tests/LibName/foo.c +++ b/Tests/LibName/foo.c @@ -1,9 +1,9 @@ #ifdef _WIN32 -__declspec(dllimport) +__declspec(dllimport) #endif extern void foo(); #ifdef _WIN32 -__declspec(dllexport) +__declspec(dllexport) #endif void bar() { diff --git a/Tests/LibName/foobar.c b/Tests/LibName/foobar.c index 73b4b4156..2f8a3ff08 100644 --- a/Tests/LibName/foobar.c +++ b/Tests/LibName/foobar.c @@ -1,5 +1,5 @@ #ifdef _WIN32 -__declspec(dllimport) +__declspec(dllimport) #endif extern void bar(); diff --git a/Tests/LinkLine/CMakeLists.txt b/Tests/LinkLine/CMakeLists.txt index c8f0ecf63..6154dd469 100644 --- a/Tests/LinkLine/CMakeLists.txt +++ b/Tests/LinkLine/CMakeLists.txt @@ -1,12 +1,12 @@ -PROJECT( LinkLine ) +project( LinkLine ) # Makes sure that the library order as specified by the user are # unchanged by dependency analysis, etc. libOne and libTwo are # dependent on each other. The link line should be -lOne -lTwo -lOne. -ADD_LIBRARY( One One.c ) -ADD_LIBRARY( Two Two.c ) +add_library( One One.c ) +add_library( Two Two.c ) -LINK_LIBRARIES( One Two ) -ADD_EXECUTABLE( LinkLine Exec.c ) -LINK_LIBRARIES( One ) +link_libraries( One Two ) +add_executable( LinkLine Exec.c ) +link_libraries( One ) diff --git a/Tests/LinkLineOrder/CMakeLists.txt b/Tests/LinkLineOrder/CMakeLists.txt index 21a502217..78455e971 100644 --- a/Tests/LinkLineOrder/CMakeLists.txt +++ b/Tests/LinkLineOrder/CMakeLists.txt @@ -1,4 +1,4 @@ -PROJECT( LinkLineOrder ) +project( LinkLineOrder ) # This tests ensures that the order of libraries are preserved when # they don't have dependency information, even if they are deep in the @@ -9,28 +9,28 @@ PROJECT( LinkLineOrder ) # has no information about these libraries except for the order they # are specified in One. We must make sure we don't lose that. -ADD_LIBRARY( NoDepA NoDepA.c ) -ADD_LIBRARY( NoDepB NoDepB.c ) -ADD_LIBRARY( NoDepC NoDepC.c ) -ADD_LIBRARY( NoDepE NoDepE.c ) -ADD_LIBRARY( NoDepF NoDepF.c ) +add_library( NoDepA NoDepA.c ) +add_library( NoDepB NoDepB.c ) +add_library( NoDepC NoDepC.c ) +add_library( NoDepE NoDepE.c ) +add_library( NoDepF NoDepF.c ) -ADD_LIBRARY( One One.c ) -TARGET_LINK_LIBRARIES( One NoDepC NoDepA NoDepB NoDepE NoDepF NoDepE ) +add_library( One One.c ) +target_link_libraries( One NoDepC NoDepA NoDepB NoDepE NoDepF NoDepE ) -ADD_EXECUTABLE( Exec1 Exec1.c ) -TARGET_LINK_LIBRARIES( Exec1 One ) +add_executable( Exec1 Exec1.c ) +target_link_libraries( Exec1 One ) # Similar situation as One, except at a different level of the # dependency tree. This makes sure that the order is presevered # everywhere in the graph. -ADD_LIBRARY( NoDepX NoDepX.c ) -ADD_LIBRARY( NoDepY NoDepY.c ) -ADD_LIBRARY( NoDepZ NoDepZ.c ) +add_library( NoDepX NoDepX.c ) +add_library( NoDepY NoDepY.c ) +add_library( NoDepZ NoDepZ.c ) -ADD_LIBRARY( Two Two.c ) -TARGET_LINK_LIBRARIES( Two One NoDepZ NoDepX NoDepY ) +add_library( Two Two.c ) +target_link_libraries( Two One NoDepZ NoDepX NoDepY ) -ADD_EXECUTABLE( Exec2 Exec2.c ) -TARGET_LINK_LIBRARIES( Exec2 Two ) +add_executable( Exec2 Exec2.c ) +target_link_libraries( Exec2 Two ) diff --git a/Tests/LoadCommand/CMakeCommands/CMakeLists.txt b/Tests/LoadCommand/CMakeCommands/CMakeLists.txt index 5cdbc59bf..99b1aba82 100644 --- a/Tests/LoadCommand/CMakeCommands/CMakeLists.txt +++ b/Tests/LoadCommand/CMakeCommands/CMakeLists.txt @@ -1,14 +1,14 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(CMAKE_LOADED_COMMANDS) +project(CMAKE_LOADED_COMMANDS) -IF (MUDSLIDE_TYPE MATCHES MUCHO) - ADD_DEFINITIONS(-DMUCHO_MUDSLIDE) -ENDIF (MUDSLIDE_TYPE MATCHES MUCHO) +if (MUDSLIDE_TYPE MATCHES MUCHO) + add_definitions(-DMUCHO_MUDSLIDE) +endif () -INCLUDE_DIRECTORIES(${CMAKE_ROOT}/include ${CMAKE_ROOT}/Source) +include_directories(${CMAKE_ROOT}/include ${CMAKE_ROOT}/Source) -ADD_LIBRARY(cmCMAKE_TEST_COMMAND MODULE cmTestCommand.c) +add_library(cmCMAKE_TEST_COMMAND MODULE cmTestCommand.c) -IF(WATCOM) - TARGET_LINK_LIBRARIES(cmCMAKE_TEST_COMMAND clbsdll.lib) -ENDIF(WATCOM) +if(WATCOM) + target_link_libraries(cmCMAKE_TEST_COMMAND clbsdll.lib) +endif() diff --git a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c index 6b4f48f7b..fc04934dd 100644 --- a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c +++ b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c @@ -3,7 +3,7 @@ #include #include -typedef struct +typedef struct { char *LibraryName; int Argc; @@ -24,8 +24,8 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) char *ccDep[1]; char *ccOut[1]; cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; - - cmVTKWrapTclData *cdata = + + cmVTKWrapTclData *cdata = (cmVTKWrapTclData *)malloc(sizeof(cmVTKWrapTclData)); cdata->LibraryName = "BOO"; cdata->Argc = argc; @@ -36,33 +36,33 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) /* already, if so use that value and don't look for the program */ if(!info->CAPI->IsOn(mf,"TEST_COMMAND_TEST1")) { - info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO"); + info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO"); return 1; } - - info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO"); + + info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO"); cdata->LibraryName = "HOO"; - info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE", "ON", + info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE", "ON", "Test cache variable", CM_CACHE_BOOL); - info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE1", "", + info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE1", "", "Test cache variable 1", CM_CACHE_PATH); - info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE2", "", + info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE2", "", "Test cache variable 2", CM_CACHE_FILEPATH); - info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE3", "", + info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE3", "", "Test cache variable 3", CM_CACHE_STRING); - info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE4", "", + info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE4", "", "Test cache variable 4", CM_CACHE_INTERNAL); - info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE5", "", + info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE5", "", "Test cache variable 5", CM_CACHE_STATIC); - + file = info->CAPI->ExpandVariablesInString(mf, "${CMAKE_COMMAND}", 0, 0); str = info->CAPI->GetFilenameWithoutExtension(file); @@ -140,7 +140,7 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) 1, ccDep, 1, ccOut, "LoadedCommand"); - + ccArgs[2] = argv[1]; ccArgs[3] = argv[2]; @@ -171,22 +171,22 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) return 0; } info->CAPI->ExecuteCommand(mf,"SET",2,args); - + /* make sure we can find the source file */ if (!info->CAPI->GetSource(mf,argv[1])) { info->CAPI->SetError(mf, "Source file could not be found!"); - return 0; + return 0; } return 1; } -static void CCONV FinalPass(void *inf, void *mf) +static void CCONV FinalPass(void *inf, void *mf) { cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; /* get our client data from initial pass */ - cmVTKWrapTclData *cdata = + cmVTKWrapTclData *cdata = (cmVTKWrapTclData *)info->CAPI->GetClientData(info); if (strcmp(info->CAPI->GetDefinition(mf, "TEST_DEF"),"HOO") || strcmp(cdata->LibraryName,"HOO")) @@ -194,11 +194,11 @@ static void CCONV FinalPass(void *inf, void *mf) fprintf(stderr,"*** Failed LOADED COMMAND Final Pass\n"); } } -static void CCONV Destructor(void *inf) +static void CCONV Destructor(void *inf) { cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; /* get our client data from initial pass */ - cmVTKWrapTclData *cdata = + cmVTKWrapTclData *cdata = (cmVTKWrapTclData *)info->CAPI->GetClientData(info); free(cdata); } diff --git a/Tests/LoadCommand/CMakeLists.txt b/Tests/LoadCommand/CMakeLists.txt index 846cbb084..c9337987a 100644 --- a/Tests/LoadCommand/CMakeLists.txt +++ b/Tests/LoadCommand/CMakeLists.txt @@ -1,63 +1,63 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(LoadCommand) +project(LoadCommand) # set a definition -SET (TEST_COMMAND_TEST1 1) +set (TEST_COMMAND_TEST1 1) -INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) +include (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) CHECK_TYPE_SIZE(char SIZEOF_CHAR) CHECK_TYPE_SIZE(short SIZEOF_SHORT) -INCLUDE (CheckFunctionExists) +include (CheckFunctionExists) CHECK_FUNCTION_EXISTS(printf HAVE_PRINTF) CHECK_FUNCTION_EXISTS(vsblabla HAVE_VSBLABLA) -CONFIGURE_FILE(${LoadCommand_SOURCE_DIR}/LoadedCommand.h.in +configure_file(${LoadCommand_SOURCE_DIR}/LoadedCommand.h.in ${LoadCommand_BINARY_DIR}/LoadedCommand.h) -INCLUDE_DIRECTORIES(${LoadCommand_BINARY_DIR}) +include_directories(${LoadCommand_BINARY_DIR}) # try to compile the command # make sure it is not already loaded -IF(COMMAND CMAKE_TEST_COMMAND) -ELSE(COMMAND CMAKE_TEST_COMMAND) - TRY_COMPILE(COMPILE_OK - ${LoadCommand_BINARY_DIR}/CMakeCommands - ${LoadCommand_SOURCE_DIR}/CMakeCommands +if(COMMAND CMAKE_TEST_COMMAND) +else() + try_compile(COMPILE_OK + ${LoadCommand_BINARY_DIR}/CMakeCommands + ${LoadCommand_SOURCE_DIR}/CMakeCommands CMAKE_LOADED_COMMANDS CMAKE_FLAGS -DMUDSLIDE_TYPE:STRING=MUCHO OUTPUT_VARIABLE OUTPUT ) # do another TRY_COMPILE to get around make # problem on hp - TRY_COMPILE(COMPILE_OK - ${LoadCommand_BINARY_DIR}/CMakeCommands - ${LoadCommand_SOURCE_DIR}/CMakeCommands + try_compile(COMPILE_OK + ${LoadCommand_BINARY_DIR}/CMakeCommands + ${LoadCommand_SOURCE_DIR}/CMakeCommands CMAKE_LOADED_COMMANDS CMAKE_FLAGS -DMUDSLIDE_TYPE:STRING=MUCHO OUTPUT_VARIABLE OUTPUT ) -ENDIF(COMMAND CMAKE_TEST_COMMAND) +endif() -MESSAGE("Output from try compile: ${OUTPUT}") +message("Output from try compile: ${OUTPUT}") # if the compile was OK, try loading the command -IF (COMPILE_OK) - LOAD_COMMAND(CMAKE_TEST_COMMAND - ${LoadCommand_BINARY_DIR}/CMakeCommands +if (COMPILE_OK) + load_command(CMAKE_TEST_COMMAND + ${LoadCommand_BINARY_DIR}/CMakeCommands ${LoadCommand_BINARY_DIR}/CMakeCommands/Debug ${LoadCommand_BINARY_DIR}/CMakeCommands/Development ) # if the command loaded, execute the command - IF (COMMAND CMAKE_TEST_COMMAND) + if (COMMAND CMAKE_TEST_COMMAND) CMAKE_TEST_COMMAND( "${LoadCommand_SOURCE_DIR}/LoadedCommand.cxx.in" "${LoadCommand_BINARY_DIR}/LoadedCommand2.cxx.in" "${LoadCommand_BINARY_DIR}/LoadedCommand3.cxx" ) - ENDIF (COMMAND CMAKE_TEST_COMMAND) -ELSE (COMPILE_OK) - MESSAGE("failed to compile CMAKE_LOADED_COMMANDS") -ENDIF (COMPILE_OK) + endif () +else () + message("failed to compile CMAKE_LOADED_COMMANDS") +endif () # TEST_DEF is set by the loaded command cmTestCommand.c -IF (TEST_DEF AND SOME_CACHE_VARIABLE AND TEST_EXEC) - ADD_DEFINITIONS(-DCMAKE_IS_FUN) -ENDIF (TEST_DEF AND SOME_CACHE_VARIABLE AND TEST_EXEC) +if (TEST_DEF AND SOME_CACHE_VARIABLE AND TEST_EXEC) + add_definitions(-DCMAKE_IS_FUN) +endif () diff --git a/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt b/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt index 953d05c99..5ee2ed0f1 100644 --- a/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt +++ b/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt @@ -1,17 +1,17 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(CMAKE_LOADED_COMMANDS) +project(CMAKE_LOADED_COMMANDS) -IF (MUDSLIDE_TYPE MATCHES MUCHO) - ADD_DEFINITIONS(-DMUCHO_MUDSLIDE) -ENDIF (MUDSLIDE_TYPE MATCHES MUCHO) +if (MUDSLIDE_TYPE MATCHES MUCHO) + add_definitions(-DMUCHO_MUDSLIDE) +endif () -IF(WATCOM) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -ENDIF(WATCOM) -INCLUDE_DIRECTORIES(${CMAKE_ROOT}/include ${CMAKE_ROOT}/Source) +if(WATCOM) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") +endif() +include_directories(${CMAKE_ROOT}/include ${CMAKE_ROOT}/Source) -ADD_LIBRARY(cmCMAKE_TEST_COMMAND MODULE cmTestCommand.c) +add_library(cmCMAKE_TEST_COMMAND MODULE cmTestCommand.c) -IF(WATCOM) - TARGET_LINK_LIBRARIES(cmCMAKE_TEST_COMMAND clbsdll.lib) -ENDIF(WATCOM) +if(WATCOM) + target_link_libraries(cmCMAKE_TEST_COMMAND clbsdll.lib) +endif() diff --git a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c index 6b4f48f7b..fc04934dd 100644 --- a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c +++ b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c @@ -3,7 +3,7 @@ #include #include -typedef struct +typedef struct { char *LibraryName; int Argc; @@ -24,8 +24,8 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) char *ccDep[1]; char *ccOut[1]; cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; - - cmVTKWrapTclData *cdata = + + cmVTKWrapTclData *cdata = (cmVTKWrapTclData *)malloc(sizeof(cmVTKWrapTclData)); cdata->LibraryName = "BOO"; cdata->Argc = argc; @@ -36,33 +36,33 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) /* already, if so use that value and don't look for the program */ if(!info->CAPI->IsOn(mf,"TEST_COMMAND_TEST1")) { - info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO"); + info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO"); return 1; } - - info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO"); + + info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO"); cdata->LibraryName = "HOO"; - info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE", "ON", + info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE", "ON", "Test cache variable", CM_CACHE_BOOL); - info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE1", "", + info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE1", "", "Test cache variable 1", CM_CACHE_PATH); - info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE2", "", + info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE2", "", "Test cache variable 2", CM_CACHE_FILEPATH); - info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE3", "", + info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE3", "", "Test cache variable 3", CM_CACHE_STRING); - info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE4", "", + info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE4", "", "Test cache variable 4", CM_CACHE_INTERNAL); - info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE5", "", + info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE5", "", "Test cache variable 5", CM_CACHE_STATIC); - + file = info->CAPI->ExpandVariablesInString(mf, "${CMAKE_COMMAND}", 0, 0); str = info->CAPI->GetFilenameWithoutExtension(file); @@ -140,7 +140,7 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) 1, ccDep, 1, ccOut, "LoadedCommand"); - + ccArgs[2] = argv[1]; ccArgs[3] = argv[2]; @@ -171,22 +171,22 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) return 0; } info->CAPI->ExecuteCommand(mf,"SET",2,args); - + /* make sure we can find the source file */ if (!info->CAPI->GetSource(mf,argv[1])) { info->CAPI->SetError(mf, "Source file could not be found!"); - return 0; + return 0; } return 1; } -static void CCONV FinalPass(void *inf, void *mf) +static void CCONV FinalPass(void *inf, void *mf) { cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; /* get our client data from initial pass */ - cmVTKWrapTclData *cdata = + cmVTKWrapTclData *cdata = (cmVTKWrapTclData *)info->CAPI->GetClientData(info); if (strcmp(info->CAPI->GetDefinition(mf, "TEST_DEF"),"HOO") || strcmp(cdata->LibraryName,"HOO")) @@ -194,11 +194,11 @@ static void CCONV FinalPass(void *inf, void *mf) fprintf(stderr,"*** Failed LOADED COMMAND Final Pass\n"); } } -static void CCONV Destructor(void *inf) +static void CCONV Destructor(void *inf) { cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; /* get our client data from initial pass */ - cmVTKWrapTclData *cdata = + cmVTKWrapTclData *cdata = (cmVTKWrapTclData *)info->CAPI->GetClientData(info); free(cdata); } diff --git a/Tests/LoadCommandOneConfig/CMakeLists.txt b/Tests/LoadCommandOneConfig/CMakeLists.txt index e99105a74..a75ad5aa5 100644 --- a/Tests/LoadCommandOneConfig/CMakeLists.txt +++ b/Tests/LoadCommandOneConfig/CMakeLists.txt @@ -1,69 +1,69 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(LoadCommand) +project(LoadCommand) # set a definition -SET (TEST_COMMAND_TEST1 1) +set (TEST_COMMAND_TEST1 1) -INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) +include (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) CHECK_TYPE_SIZE(char SIZEOF_CHAR) CHECK_TYPE_SIZE(short SIZEOF_SHORT) -INCLUDE (CheckFunctionExists) +include (CheckFunctionExists) CHECK_FUNCTION_EXISTS(printf HAVE_PRINTF) CHECK_FUNCTION_EXISTS(vsblabla HAVE_VSBLABLA) -INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) +include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) CHECK_INCLUDE_FILE("sys/prctl.h" HAVE_SYS_PRCTL_H) -INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake) +include (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake) CHECK_LIBRARY_EXISTS(m ceil "" HAVE_LIBM) -CONFIGURE_FILE(${LoadCommand_SOURCE_DIR}/LoadedCommand.h.in +configure_file(${LoadCommand_SOURCE_DIR}/LoadedCommand.h.in ${LoadCommand_BINARY_DIR}/LoadedCommand.h) -INCLUDE_DIRECTORIES(${LoadCommand_BINARY_DIR}) +include_directories(${LoadCommand_BINARY_DIR}) # try to compile the command # make sure it is not already loaded -IF(COMMAND CMAKE_TEST_COMMAND) -ELSE(COMMAND CMAKE_TEST_COMMAND) - TRY_COMPILE(COMPILE_OK - ${LoadCommand_BINARY_DIR}/CMakeCommands - ${LoadCommand_SOURCE_DIR}/CMakeCommands +if(COMMAND CMAKE_TEST_COMMAND) +else() + try_compile(COMPILE_OK + ${LoadCommand_BINARY_DIR}/CMakeCommands + ${LoadCommand_SOURCE_DIR}/CMakeCommands CMAKE_LOADED_COMMANDS CMAKE_FLAGS -DMUDSLIDE_TYPE:STRING=MUCHO OUTPUT_VARIABLE OUTPUT ) # do another TRY_COMPILE to get around make # problem on hp - TRY_COMPILE(COMPILE_OK - ${LoadCommand_BINARY_DIR}/CMakeCommands - ${LoadCommand_SOURCE_DIR}/CMakeCommands + try_compile(COMPILE_OK + ${LoadCommand_BINARY_DIR}/CMakeCommands + ${LoadCommand_SOURCE_DIR}/CMakeCommands CMAKE_LOADED_COMMANDS CMAKE_FLAGS -DMUDSLIDE_TYPE:STRING=MUCHO OUTPUT_VARIABLE OUTPUT ) -ENDIF(COMMAND CMAKE_TEST_COMMAND) +endif() -MESSAGE("Output from try compile: ${OUTPUT}") +message("Output from try compile: ${OUTPUT}") # if the compile was OK, try loading the command -IF (COMPILE_OK) - LOAD_COMMAND(CMAKE_TEST_COMMAND - ${LoadCommand_BINARY_DIR}/CMakeCommands +if (COMPILE_OK) + load_command(CMAKE_TEST_COMMAND + ${LoadCommand_BINARY_DIR}/CMakeCommands ${LoadCommand_BINARY_DIR}/CMakeCommands/Debug ${LoadCommand_BINARY_DIR}/CMakeCommands/Development ) # if the command loaded, execute the command - IF (COMMAND CMAKE_TEST_COMMAND) + if (COMMAND CMAKE_TEST_COMMAND) CMAKE_TEST_COMMAND( "${LoadCommand_SOURCE_DIR}/LoadedCommand.cxx.in" "${LoadCommand_BINARY_DIR}/LoadedCommand2.cxx.in" "${LoadCommand_BINARY_DIR}/LoadedCommand3.cxx" ) - ENDIF (COMMAND CMAKE_TEST_COMMAND) -ELSE (COMPILE_OK) - MESSAGE("failed to compile CMAKE_LOADED_COMMANDS") -ENDIF (COMPILE_OK) + endif () +else () + message("failed to compile CMAKE_LOADED_COMMANDS") +endif () # TEST_DEF is set by the loaded command cmTestCommand.c -IF (TEST_DEF AND SOME_CACHE_VARIABLE AND TEST_EXEC) - ADD_DEFINITIONS(-DCMAKE_IS_FUN) -ENDIF (TEST_DEF AND SOME_CACHE_VARIABLE AND TEST_EXEC) +if (TEST_DEF AND SOME_CACHE_VARIABLE AND TEST_EXEC) + add_definitions(-DCMAKE_IS_FUN) +endif () diff --git a/Tests/MacroTest/CMakeLists.txt b/Tests/MacroTest/CMakeLists.txt index ef673fd85..02bb31f20 100644 --- a/Tests/MacroTest/CMakeLists.txt +++ b/Tests/MacroTest/CMakeLists.txt @@ -1,53 +1,53 @@ # a simple C only test case cmake_minimum_required (VERSION 2.6) -PROJECT (MacroTest) +project (MacroTest) -MACRO(FAILED testname) - MESSAGE(SEND_ERROR "${testname} failed ${ARGN}") -ENDMACRO(FAILED) +macro(FAILED testname) + message(SEND_ERROR "${testname} failed ${ARGN}") +endmacro() -MACRO(PASS testname) - MESSAGE("${testname} passed ${ARGN}") -ENDMACRO(PASS) +macro(PASS testname) + message("${testname} passed ${ARGN}") +endmacro() # test ARGC -MACRO(weird_name) - IF("${ARGC}" EQUAL "3") +macro(weird_name) + if("${ARGC}" EQUAL "3") PASS("ARGC") - ELSE("${ARGC}" EQUAL "3") + else() FAILED("ARGC" "Got: ${ARGC}") - ENDIF("${ARGC}" EQUAL "3") -ENDMACRO(weird_name) + endif() +endmacro() WeIrD_nAmE(a1 a2 a3) # test ARGN -MACRO(test_argn_macro argument) - IF("${ARGN}" EQUAL "3") +macro(test_argn_macro argument) + if("${ARGN}" EQUAL "3") PASS("ARGN") - ELSE("${ARGN}" EQUAL "3") + else() FAILED("ARGN" "Got: ${ARGN}") - ENDIF("${ARGN}" EQUAL "3") -ENDMACRO(test_argn_macro) + endif() +endmacro() Test_Argn_Macro(ignored 3) # case test -MACRO(strange_macro m) - SET("${m}" strange_macro) -ENDMACRO(strange_macro m) +macro(strange_macro m) + set("${m}" strange_macro) +endmacro() STRANGE_MACRO(var) set(second_var "second_var") -IF("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var") +if("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var") PASS("Case Test" "(${var} ${second_var})") -ELSE("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var") +else() FAILED("Case test" "(${var} ${second_var})") -ENDIF("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var") +endif() # test backing up command -MACRO(ADD_EXECUTABLE exec) +macro(ADD_EXECUTABLE exec) _ADD_EXECUTABLE("mini${exec}" ${ARGN}) -ENDMACRO(ADD_EXECUTABLE) +endmacro() -INCLUDE(CheckCSourceCompiles) +include(CheckCSourceCompiles) Check_C_Source_Compiles( " #include @@ -62,13 +62,13 @@ int main(int ac, char*av[]){ return 0; }" SOME_CHECK) -IF(SOME_CHECK) - MESSAGE("CheckCSourceCompiles works") -ELSE(SOME_CHECK) - MESSAGE(FATAL_ERROR "CheckCSourceCompiles does not work") -ENDIF(SOME_CHECK) +if(SOME_CHECK) + message("CheckCSourceCompiles works") +else() + message(FATAL_ERROR "CheckCSourceCompiles does not work") +endif() -INCLUDE(CheckCXXSourceCompiles) +include(CheckCXXSourceCompiles) Check_CXX_Source_Compiles( " #include @@ -77,15 +77,15 @@ int main(int ac, char*av[]){ return 0; }" SOME_CHECK) -IF(SOME_CHECK) - MESSAGE("CheckCXXSourceCompiles works") -ELSE(SOME_CHECK) - MESSAGE(FATAL_ERROR "CheckCXXSourceCompiles does not work") -ENDIF(SOME_CHECK) +if(SOME_CHECK) + message("CheckCXXSourceCompiles works") +else() + message(FATAL_ERROR "CheckCXXSourceCompiles does not work") +endif() -ADD_EXECUTABLE(MacroTest macroTest.c) +add_executable(MacroTest macroTest.c) -MACRO(GET_CURRENT_FILE var) - SET(${var} ${CMAKE_CURRENT_LIST_FILE}) -ENDMACRO(GET_CURRENT_FILE) -INCLUDE(context.cmake) +macro(GET_CURRENT_FILE var) + set(${var} ${CMAKE_CURRENT_LIST_FILE}) +endmacro() +include(context.cmake) diff --git a/Tests/MacroTest/context.cmake b/Tests/MacroTest/context.cmake index f4d7035fb..f7350d771 100644 --- a/Tests/MacroTest/context.cmake +++ b/Tests/MacroTest/context.cmake @@ -1,10 +1,10 @@ GET_CURRENT_FILE(current_file) -IF(NOT "${current_file}" STREQUAL "${CMAKE_CURRENT_LIST_FILE}") - MESSAGE(FATAL_ERROR +if(NOT "${current_file}" STREQUAL "${CMAKE_CURRENT_LIST_FILE}") + message(FATAL_ERROR "Macro file context is broken. Expected:\n" " ${CMAKE_CURRENT_LIST_FILE}\n" "but got:\n" " ${current_file}\n" "from the macro." ) -ENDIF(NOT "${current_file}" STREQUAL "${CMAKE_CURRENT_LIST_FILE}") +endif() diff --git a/Tests/MakeClean/CMakeLists.txt b/Tests/MakeClean/CMakeLists.txt index 97d3554bd..13348a28b 100644 --- a/Tests/MakeClean/CMakeLists.txt +++ b/Tests/MakeClean/CMakeLists.txt @@ -1,47 +1,47 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(MakeClean) +project(MakeClean) # Build the to-clean project. -TRY_COMPILE(TOCLEAN_BUILT +try_compile(TOCLEAN_BUILT ${MakeClean_BINARY_DIR}/ToClean ${MakeClean_SOURCE_DIR}/ToClean ToClean OUTPUT_VARIABLE OUTPUT ) -IF(TOCLEAN_BUILT) - MESSAGE( +if(TOCLEAN_BUILT) + message( "Building ToClean succeeded with the following output:\n" "[${OUTPUT}]" ) -ELSE(TOCLEAN_BUILT) - MESSAGE(FATAL_ERROR +else() + message(FATAL_ERROR "Building ToClean failed with the following output:\n" "[${OUTPUT}]" ) -ENDIF(TOCLEAN_BUILT) +endif() # Get the set of files to check from the ToClean project. -INCLUDE(${MakeClean_BINARY_DIR}/ToClean/ToCleanFiles.cmake) +include(${MakeClean_BINARY_DIR}/ToClean/ToCleanFiles.cmake) # Check for the existence of the files. -FOREACH(f ${TOCLEAN_FILES}) - IF(EXISTS "${f}") - ELSE(EXISTS "${f}") - MESSAGE(FATAL_ERROR "File \"${f}\" does not exist!") - ENDIF(EXISTS "${f}") -ENDFOREACH(f) +foreach(f ${TOCLEAN_FILES}) + if(EXISTS "${f}") + else() + message(FATAL_ERROR "File \"${f}\" does not exist!") + endif() +endforeach() # Configure an executable to check that all the files are missing. -SET(CHECK_FILES) -FOREACH(f ${TOCLEAN_FILES}) - SET(CHECK_FILES "${CHECK_FILES} \"${f}\",\n") -ENDFOREACH(f) -CONFIGURE_FILE(${MakeClean_SOURCE_DIR}/check_clean.c.in +set(CHECK_FILES) +foreach(f ${TOCLEAN_FILES}) + set(CHECK_FILES "${CHECK_FILES} \"${f}\",\n") +endforeach() +configure_file(${MakeClean_SOURCE_DIR}/check_clean.c.in ${MakeClean_BINARY_DIR}/check_clean.c @ONLY IMMEDIATE) -ADD_EXECUTABLE(check_clean ${MakeClean_BINARY_DIR}/check_clean.c) +add_executable(check_clean ${MakeClean_BINARY_DIR}/check_clean.c) # After the executable builds, clean the files. -ADD_CUSTOM_COMMAND( +add_custom_command( TARGET check_clean POST_BUILD COMMAND ${CMAKE_CTEST_COMMAND} diff --git a/Tests/MakeClean/ToClean/CMakeLists.txt b/Tests/MakeClean/ToClean/CMakeLists.txt index 50facadb7..28569dd1d 100644 --- a/Tests/MakeClean/ToClean/CMakeLists.txt +++ b/Tests/MakeClean/ToClean/CMakeLists.txt @@ -1,31 +1,31 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(ToClean) +cmake_minimum_required(VERSION 2.6) +project(ToClean) # Build a simple project. -ADD_EXECUTABLE(toclean toclean.cxx) +add_executable(toclean toclean.cxx) # List some build-time-generated files. -GET_TARGET_PROPERTY(TOCLEAN_FILES toclean LOCATION) -SET(TOCLEAN_FILES ${TOCLEAN_FILES} +get_target_property(TOCLEAN_FILES toclean LOCATION) +set(TOCLEAN_FILES ${TOCLEAN_FILES} "${ToClean_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/toclean.dir/toclean.cxx${CMAKE_CXX_OUTPUT_EXTENSION}") # Create a file that must be registered for cleaning. -FILE(WRITE "${ToClean_BINARY_DIR}/Registered.txt" +file(WRITE "${ToClean_BINARY_DIR}/Registered.txt" "File registered for cleaning.\n") -SET_DIRECTORY_PROPERTIES(PROPERTIES +set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ToClean_BINARY_DIR}/Registered.txt") -SET(TOCLEAN_FILES ${TOCLEAN_FILES} "${ToClean_BINARY_DIR}/Registered.txt") +set(TOCLEAN_FILES ${TOCLEAN_FILES} "${ToClean_BINARY_DIR}/Registered.txt") # Create a custom command whose output should be cleaned. -ADD_CUSTOM_COMMAND(OUTPUT ${ToClean_BINARY_DIR}/generated.txt +add_custom_command(OUTPUT ${ToClean_BINARY_DIR}/generated.txt DEPENDS ${ToClean_SOURCE_DIR}/toclean.cxx COMMAND ${CMAKE_COMMAND} ARGS -E copy ${ToClean_SOURCE_DIR}/toclean.cxx ${ToClean_BINARY_DIR}/generated.txt ) -ADD_CUSTOM_TARGET(generate ALL DEPENDS ${ToClean_BINARY_DIR}/generated.txt) -SET(TOCLEAN_FILES ${TOCLEAN_FILES} "${ToClean_BINARY_DIR}/generated.txt") +add_custom_target(generate ALL DEPENDS ${ToClean_BINARY_DIR}/generated.txt) +set(TOCLEAN_FILES ${TOCLEAN_FILES} "${ToClean_BINARY_DIR}/generated.txt") # Configure a file listing these build-time-generated files. -CONFIGURE_FILE(${ToClean_SOURCE_DIR}/ToCleanFiles.cmake.in +configure_file(${ToClean_SOURCE_DIR}/ToCleanFiles.cmake.in ${ToClean_BINARY_DIR}/ToCleanFiles.cmake @ONLY IMMEDIATE) diff --git a/Tests/MakeClean/ToClean/ToCleanFiles.cmake.in b/Tests/MakeClean/ToClean/ToCleanFiles.cmake.in index 10d11c37a..e7d99470c 100644 --- a/Tests/MakeClean/ToClean/ToCleanFiles.cmake.in +++ b/Tests/MakeClean/ToClean/ToCleanFiles.cmake.in @@ -1 +1 @@ -SET(TOCLEAN_FILES "@TOCLEAN_FILES@") +set(TOCLEAN_FILES "@TOCLEAN_FILES@") diff --git a/Tests/MathTest/CMakeLists.txt b/Tests/MathTest/CMakeLists.txt index d1e5b1acd..34beaa0aa 100644 --- a/Tests/MathTest/CMakeLists.txt +++ b/Tests/MathTest/CMakeLists.txt @@ -1,10 +1,10 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(MathTest) +project(MathTest) # Expression test -SET(expressions +set(expressions "5 * ( 3 + 4)" "(1 | 2 | 4 | 8) & 16" "1 +(3*4) + 10 >> 2" @@ -12,18 +12,18 @@ SET(expressions "10000 / (20 / 4)" ) -SET(FILE_EXPRESSIONS "") -FOREACH(expression +set(FILE_EXPRESSIONS "") +foreach(expression ${expressions}) - MATH(EXPR expr "${expression}") - SET(FILE_EXPRESSIONS "${FILE_EXPRESSIONS}TEST_EXPRESSION(${expression}, ${expr})\n") -ENDFOREACH(expression) + math(EXPR expr "${expression}") + set(FILE_EXPRESSIONS "${FILE_EXPRESSIONS}TEST_EXPRESSION(${expression}, ${expr})\n") +endforeach() -CONFIGURE_FILE( +configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/MathTestTests.h.in" "${CMAKE_CURRENT_BINARY_DIR}/MathTestTests.h" @ONLY) -INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}") -ADD_EXECUTABLE(MathTest MathTestExec.cxx) +include_directories("${CMAKE_CURRENT_BINARY_DIR}") +add_executable(MathTest MathTestExec.cxx) diff --git a/Tests/Module/CheckTypeSize/CMakeLists.txt b/Tests/Module/CheckTypeSize/CMakeLists.txt index 45e9f6757..abe617a16 100644 --- a/Tests/Module/CheckTypeSize/CMakeLists.txt +++ b/Tests/Module/CheckTypeSize/CMakeLists.txt @@ -12,7 +12,13 @@ check_type_size(__int64 SIZEOF___INT64) check_type_size(size_t SIZEOF_SIZE_T) check_type_size(ssize_t SIZEOF_SSIZE_T) +set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}") +set(CMAKE_EXTRA_INCLUDE_FILES somestruct.h) +check_type_size("((struct somestruct*)0)->someint" SIZEOF_STRUCTMEMBER_INT) +check_type_size("((struct somestruct*)0)->someptr" SIZEOF_STRUCTMEMBER_PTR) +check_type_size("((struct somestruct*)0)->somechar" SIZEOF_STRUCTMEMBER_CHAR) + configure_file(config.h.in config.h) -include_directories(${CheckTypeSize_BINARY_DIR}) +include_directories("${CheckTypeSize_BINARY_DIR}") add_executable(CheckTypeSize CheckTypeSize.c) diff --git a/Tests/Module/CheckTypeSize/CheckTypeSize.c b/Tests/Module/CheckTypeSize/CheckTypeSize.c index 602c83494..32e395cca 100644 --- a/Tests/Module/CheckTypeSize/CheckTypeSize.c +++ b/Tests/Module/CheckTypeSize/CheckTypeSize.c @@ -1,4 +1,5 @@ #include "config.h" +#include "somestruct.h" #ifdef HAVE_SYS_TYPES_H # include @@ -29,6 +30,7 @@ int main() { int result = 0; + struct somestruct x; /* void* */ #if !defined(HAVE_SIZEOF_DATA_PTR) @@ -118,5 +120,41 @@ int main() NODEF(SIZEOF_SSIZE_T); #endif - return result; + /* struct somestruct::someint */ +#if defined(SIZEOF_STRUCTMEMBER_INT) + CHECK(x.someint, SIZEOF_STRUCTMEMBER_INT); + CHECK(x.someint, SIZEOF_INT); +# if !defined(HAVE_SIZEOF_STRUCTMEMBER_INT) + NODEF(HAVE_SIZEOF_STRUCTMEMBER_INT); +# endif +#elif defined(HAVE_SIZEOF_STRUCTMEMBER_INT) + NODEF(SIZEOF_STRUCTMEMBER_INT); +#endif + + /* struct somestruct::someptr */ +#if defined(SIZEOF_STRUCTMEMBER_PTR) + CHECK(x.someptr, SIZEOF_STRUCTMEMBER_PTR); + CHECK(x.someptr, SIZEOF_DATA_PTR); +# if !defined(HAVE_SIZEOF_STRUCTMEMBER_PTR) + NODEF(HAVE_SIZEOF_STRUCTMEMBER_PTR); +# endif +#elif defined(HAVE_SIZEOF_STRUCTMEMBER_PTR) + NODEF(SIZEOF_STRUCTMEMBER_PTR); +#endif + + /* struct somestruct::someint */ +#if defined(SIZEOF_STRUCTMEMBER_CHAR) + CHECK(x.somechar, SIZEOF_STRUCTMEMBER_CHAR); + CHECK(x.somechar, SIZEOF_CHAR); +# if !defined(HAVE_SIZEOF_STRUCTMEMBER_CHAR) + NODEF(HAVE_SIZEOF_STRUCTMEMBER_CHAR); +# endif +#elif defined(HAVE_SIZEOF_STRUCTMEMBER_CHAR) + NODEF(SIZEOF_STRUCTMEMBER_CHAR); +#endif + + /* to avoid possible warnings about unused or write-only variable */ + x.someint = result; + + return x.someint; } diff --git a/Tests/Module/CheckTypeSize/config.h.in b/Tests/Module/CheckTypeSize/config.h.in index b5bfbf6e5..c60107588 100644 --- a/Tests/Module/CheckTypeSize/config.h.in +++ b/Tests/Module/CheckTypeSize/config.h.in @@ -37,3 +37,15 @@ /* ssize_t */ #cmakedefine HAVE_SIZEOF_SSIZE_T @SIZEOF_SSIZE_T_CODE@ + +/* struct somestruct::someint */ +#cmakedefine HAVE_SIZEOF_STRUCTMEMBER_INT +@SIZEOF_STRUCTMEMBER_INT_CODE@ + +/* struct somestruct::someptr */ +#cmakedefine HAVE_SIZEOF_STRUCTMEMBER_PTR +@SIZEOF_STRUCTMEMBER_PTR_CODE@ + +/* struct somestruct::somechar */ +#cmakedefine HAVE_SIZEOF_STRUCTMEMBER_CHAR +@SIZEOF_STRUCTMEMBER_CHAR_CODE@ diff --git a/Tests/Module/CheckTypeSize/somestruct.h b/Tests/Module/CheckTypeSize/somestruct.h new file mode 100644 index 000000000..e08efc4ca --- /dev/null +++ b/Tests/Module/CheckTypeSize/somestruct.h @@ -0,0 +1,10 @@ +#ifndef _CMAKE_SOMESTRUCT_H +#define _CMAKE_SOMESTRUCT_H + +struct somestruct { + int someint; + void *someptr; + char somechar; +}; + +#endif diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt new file mode 100644 index 000000000..8312dcacd --- /dev/null +++ b/Tests/Module/ExternalData/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 2.8.10.20130115) +project(ExternalDataTest NONE) + +include(CTest) + +include(ExternalData) + +if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/") + set(slash /) +endif() +set(ExternalData_URL_TEMPLATES + "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +set(ExternalData_BINARY_ROOT "${CMAKE_CURRENT_BINARY_DIR}/ExternalData") +file(REMOVE_RECURSE ${ExternalData_BINARY_ROOT}) # clean test + +if(MAKE_SUPPORTS_SPACES) + set(Data1CheckSpaces -D "DataSpace=DATA{Data Space.dat}") +endif() + +ExternalData_Add_Test(Data1 + NAME Data1Check + COMMAND ${CMAKE_COMMAND} + -D Data=DATA{Data.dat} + ${Data1CheckSpaces} + -D SeriesA=DATA{SeriesA.dat,:} + -D SeriesB=DATA{SeriesB.dat,:} + -D SeriesC=DATA{SeriesC.dat,:} + -D SeriesD=DATA{SeriesD.dat,:} + -D SeriesAn=DATA{SeriesAn1.dat,:} + -D SeriesBn=DATA{SeriesBn_1.dat,:} + -D SeriesCn=DATA{SeriesCn.1.dat,:} + -D SeriesDn=DATA{SeriesDn-1.dat,:} + -D SeriesMixed=DATA{SeriesMixed.1.dat,:} + -D Paired=DATA{PairedA.dat,PairedB.dat} + -D Meta=DATA{MetaTop.dat,REGEX:Meta[ABC].dat} + -D Directory=DATA{Directory/,A.dat,REGEX:[BC].dat} + -D "Semicolons=DATA{Data.dat}\\;DATA{Data.dat}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/Data1Check.cmake + ) +ExternalData_Add_Target(Data1) + +add_subdirectory(Data2) +add_subdirectory(Data3) diff --git a/Tests/Module/ExternalData/Data Space.dat.md5 b/Tests/Module/ExternalData/Data Space.dat.md5 new file mode 100644 index 000000000..70e39bd5d --- /dev/null +++ b/Tests/Module/ExternalData/Data Space.dat.md5 @@ -0,0 +1 @@ +8c018830e3efa5caf3c7415028335a57 diff --git a/Tests/Module/ExternalData/Data.dat.md5 b/Tests/Module/ExternalData/Data.dat.md5 new file mode 100644 index 000000000..70e39bd5d --- /dev/null +++ b/Tests/Module/ExternalData/Data.dat.md5 @@ -0,0 +1 @@ +8c018830e3efa5caf3c7415028335a57 diff --git a/Tests/Module/ExternalData/Data1Check.cmake b/Tests/Module/ExternalData/Data1Check.cmake new file mode 100644 index 000000000..57702453e --- /dev/null +++ b/Tests/Module/ExternalData/Data1Check.cmake @@ -0,0 +1,68 @@ +file(STRINGS "${Data}" lines LIMIT_INPUT 1024) +if(NOT "x${lines}" STREQUAL "xInput file already transformed.") + message(SEND_ERROR "Input file:\n ${Data}\ndoes not have expected content, but [[${lines}]]") +endif() +if(DEFINED DataSpace) + file(STRINGS "${DataSpace}" lines LIMIT_INPUT 1024) + if(NOT "x${lines}" STREQUAL "xInput file already transformed.") + message(SEND_ERROR "Input file:\n ${DataSpace}\ndoes not have expected content, but [[${lines}]]") + endif() +endif() +set(SeriesAn1 "1\\.dat") +set(SeriesBn1 "_1\\.dat") +set(SeriesCn1 "\\.1\\.dat") +set(SeriesDn1 "-1\\.dat") +set(SeriesAl 1 2 3) +set(SeriesBl _1 _2 _3) +set(SeriesCl .1 .2 .3) +set(SeriesDl -1 -2 -3) +foreach(s A B C D) + foreach(n "" ${Series${s}l}) + string(REGEX REPLACE "\\.dat$" "${n}.dat" file "${Series${s}}") + if(NOT EXISTS "${file}") + message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") + endif() + endforeach() +endforeach() +foreach(s A B C D) + foreach(n ${Series${s}l}) + string(REGEX REPLACE "${Series${s}n1}$" "${n}.dat" file "${Series${s}n}") + if(NOT EXISTS "${file}") + message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") + endif() + endforeach() +endforeach() +foreach(n .1 .2 .3 .4) + string(REGEX REPLACE "\\.1\\.dat$" "${n}.dat" file "${SeriesMixed}") + if(NOT EXISTS "${file}") + message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") + endif() +endforeach() +foreach(n A B) + string(REGEX REPLACE "A\\.dat$" "${n}.dat" file "${Paired}") + if(NOT EXISTS "${file}") + message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") + endif() +endforeach() +foreach(n Top A B C) + string(REGEX REPLACE "Top\\.dat$" "${n}.dat" file "${Meta}") + if(NOT EXISTS "${file}") + message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") + endif() +endforeach() +foreach(n A B C) + set(file "${Directory}/${n}.dat") + if(NOT EXISTS "${file}") + message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") + endif() +endforeach() +list(LENGTH Semicolons len) +if("${len}" EQUAL 2) + foreach(file ${Semicolons}) + if(NOT EXISTS "${file}") + message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") + endif() + endforeach() +else() + message(SEND_ERROR "Semicolons value:\n ${Semicolons}\nis not a list of length 2.") +endif() diff --git a/Tests/Module/ExternalData/Data2.dat.md5 b/Tests/Module/ExternalData/Data2.dat.md5 new file mode 100644 index 000000000..70e39bd5d --- /dev/null +++ b/Tests/Module/ExternalData/Data2.dat.md5 @@ -0,0 +1 @@ +8c018830e3efa5caf3c7415028335a57 diff --git a/Tests/Module/ExternalData/Data2/CMakeLists.txt b/Tests/Module/ExternalData/Data2/CMakeLists.txt new file mode 100644 index 000000000..c5b79ac05 --- /dev/null +++ b/Tests/Module/ExternalData/Data2/CMakeLists.txt @@ -0,0 +1,11 @@ +set(ExternalData_SERIES_PARSE "([0-9]+)(_\\.my\\.dat)$") +set(ExternalData_SERIES_MATCH "([0-9]+)") +ExternalData_Add_Test(Data2 + NAME Data2Check + COMMAND ${CMAKE_COMMAND} + -D Data2=DATA{../Data2.dat} + -D Data2b=DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data2b.dat} + -D SeriesC=DATA{SeriesC_1_.my.dat,:} + -P ${CMAKE_CURRENT_SOURCE_DIR}/Data2Check.cmake + ) +ExternalData_Add_Target(Data2) diff --git a/Tests/Module/ExternalData/Data2/Data2Check.cmake b/Tests/Module/ExternalData/Data2/Data2Check.cmake new file mode 100644 index 000000000..d5b0c7b68 --- /dev/null +++ b/Tests/Module/ExternalData/Data2/Data2Check.cmake @@ -0,0 +1,12 @@ +foreach(d "${Data2}" "${Data2b}") + file(STRINGS "${d}" lines LIMIT_INPUT 1024) + if(NOT "x${lines}" STREQUAL "xInput file already transformed.") + message(SEND_ERROR "Input file:\n ${d}\ndoes not have expected content, but [[${lines}]]") + endif() +endforeach() +foreach(n 1 2 3) + string(REGEX REPLACE "_1_\\.my\\.dat$" "_${n}_.my.dat" SeriesCFile "${SeriesC}") + if(NOT EXISTS "${SeriesCFile}") + message(SEND_ERROR "Input file:\n ${SeriesCFile}\ndoes not exist!") + endif() +endforeach() diff --git a/Tests/Module/ExternalData/Data2/SeriesC_1_.my.dat.md5 b/Tests/Module/ExternalData/Data2/SeriesC_1_.my.dat.md5 new file mode 100644 index 000000000..f22e266a6 --- /dev/null +++ b/Tests/Module/ExternalData/Data2/SeriesC_1_.my.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/Data2/SeriesC_2_.my.dat.md5 b/Tests/Module/ExternalData/Data2/SeriesC_2_.my.dat.md5 new file mode 100644 index 000000000..2b917e793 --- /dev/null +++ b/Tests/Module/ExternalData/Data2/SeriesC_2_.my.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/Data2/SeriesC_3_.my.dat.md5 b/Tests/Module/ExternalData/Data2/SeriesC_3_.my.dat.md5 new file mode 100644 index 000000000..b9c9760c4 --- /dev/null +++ b/Tests/Module/ExternalData/Data2/SeriesC_3_.my.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/Data2b.dat.md5 b/Tests/Module/ExternalData/Data2b.dat.md5 new file mode 100644 index 000000000..70e39bd5d --- /dev/null +++ b/Tests/Module/ExternalData/Data2b.dat.md5 @@ -0,0 +1 @@ +8c018830e3efa5caf3c7415028335a57 diff --git a/Tests/Module/ExternalData/Data3/CMakeLists.txt b/Tests/Module/ExternalData/Data3/CMakeLists.txt new file mode 100644 index 000000000..a7c2b6e06 --- /dev/null +++ b/Tests/Module/ExternalData/Data3/CMakeLists.txt @@ -0,0 +1,14 @@ +set(Store0 ${CMAKE_BINARY_DIR}/ExternalData/Other) +set(Store1 ${CMAKE_BINARY_DIR}/ExternalData/Objects) +set(ExternalData_OBJECT_STORES ${Store0} ${Store1}) +ExternalData_Add_Test(Data3 + NAME Data3Check + COMMAND ${CMAKE_COMMAND} + -D Data=DATA{Data.dat} + -D Other=DATA{Other.dat} + -D Store0=${Store0} + -D Store1=${Store1} + -P ${CMAKE_CURRENT_SOURCE_DIR}/Data3Check.cmake + ) +ExternalData_Add_Target(Data3) +add_dependencies(Data3 Data1 Data2) diff --git a/Tests/Module/ExternalData/Data3/Data.dat.md5 b/Tests/Module/ExternalData/Data3/Data.dat.md5 new file mode 100644 index 000000000..70e39bd5d --- /dev/null +++ b/Tests/Module/ExternalData/Data3/Data.dat.md5 @@ -0,0 +1 @@ +8c018830e3efa5caf3c7415028335a57 diff --git a/Tests/Module/ExternalData/Data3/Data3Check.cmake b/Tests/Module/ExternalData/Data3/Data3Check.cmake new file mode 100644 index 000000000..de9883948 --- /dev/null +++ b/Tests/Module/ExternalData/Data3/Data3Check.cmake @@ -0,0 +1,25 @@ +if(NOT EXISTS "${Data}") + message(SEND_ERROR "Input file:\n ${Data}\ndoes not exist!") +endif() +if(NOT EXISTS "${Other}") + message(SEND_ERROR "Input file:\n ${Other}\ndoes not exist!") +endif() +# Verify that the 'Data' object was found in the second store location left +# from Data1 target downloads and that the 'Other' object was downloaded to +# our first store location. Neither object should exist in the other store. +foreach(should_exist + "${Store0}/MD5/aaad162b85f60d1eb57ca71a23e8efd7" + "${Store1}/MD5/8c018830e3efa5caf3c7415028335a57" + ) + if(NOT EXISTS ${should_exist}) + message(SEND_ERROR "Store file:\n ${should_exist}\nshould exist!") + endif() +endforeach() +foreach(should_not_exist + "${Store0}/MD5/8c018830e3efa5caf3c7415028335a57" + "${Store1}/MD5/aaad162b85f60d1eb57ca71a23e8efd7" + ) + if(EXISTS ${should_not_exist}) + message(SEND_ERROR "Store file:\n ${should_not_exist}\nshould not exist!") + endif() +endforeach() diff --git a/Tests/Module/ExternalData/Data3/Other.dat.md5 b/Tests/Module/ExternalData/Data3/Other.dat.md5 new file mode 100644 index 000000000..5312faac0 --- /dev/null +++ b/Tests/Module/ExternalData/Data3/Other.dat.md5 @@ -0,0 +1 @@ +aaad162b85f60d1eb57ca71a23e8efd7 diff --git a/Tests/Module/ExternalData/Directory/A.dat.md5 b/Tests/Module/ExternalData/Directory/A.dat.md5 new file mode 100644 index 000000000..4a78fc783 --- /dev/null +++ b/Tests/Module/ExternalData/Directory/A.dat.md5 @@ -0,0 +1 @@ +9d980b06c2f0fec3d4872d68175b9822 diff --git a/Tests/Module/ExternalData/Directory/B.dat.md5 b/Tests/Module/ExternalData/Directory/B.dat.md5 new file mode 100644 index 000000000..4557a216a --- /dev/null +++ b/Tests/Module/ExternalData/Directory/B.dat.md5 @@ -0,0 +1 @@ +8f4add4581551facf27237e6577fd662 diff --git a/Tests/Module/ExternalData/Directory/C.dat.md5 b/Tests/Module/ExternalData/Directory/C.dat.md5 new file mode 100644 index 000000000..a7f23dd7f --- /dev/null +++ b/Tests/Module/ExternalData/Directory/C.dat.md5 @@ -0,0 +1 @@ +c1030719c95f3435d8abc39c0d442946 diff --git a/Tests/Module/ExternalData/MD5/.gitattributes b/Tests/Module/ExternalData/MD5/.gitattributes new file mode 100644 index 000000000..3e51d39db --- /dev/null +++ b/Tests/Module/ExternalData/MD5/.gitattributes @@ -0,0 +1 @@ +* -crlf diff --git a/Tests/Module/ExternalData/MD5/08cfcf221f76ace7b906b312284e73d7 b/Tests/Module/ExternalData/MD5/08cfcf221f76ace7b906b312284e73d7 new file mode 100644 index 000000000..a689e3cc4 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/08cfcf221f76ace7b906b312284e73d7 @@ -0,0 +1 @@ +MetaTop diff --git a/Tests/Module/ExternalData/MD5/30ba0acdee9096b3b9fc6c69362c6b42 b/Tests/Module/ExternalData/MD5/30ba0acdee9096b3b9fc6c69362c6b42 new file mode 100644 index 000000000..5491241b0 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/30ba0acdee9096b3b9fc6c69362c6b42 @@ -0,0 +1 @@ +Series.3 diff --git a/Tests/Module/ExternalData/MD5/31eff09e84fca01415f8cd9d82ec432b b/Tests/Module/ExternalData/MD5/31eff09e84fca01415f8cd9d82ec432b new file mode 100644 index 000000000..4d0475e22 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/31eff09e84fca01415f8cd9d82ec432b @@ -0,0 +1 @@ +Series.1 diff --git a/Tests/Module/ExternalData/MD5/401767f22a456b3522953722090a2c36 b/Tests/Module/ExternalData/MD5/401767f22a456b3522953722090a2c36 new file mode 100644 index 000000000..9dec11661 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/401767f22a456b3522953722090a2c36 @@ -0,0 +1 @@ +PairedA diff --git a/Tests/Module/ExternalData/MD5/8c018830e3efa5caf3c7415028335a57 b/Tests/Module/ExternalData/MD5/8c018830e3efa5caf3c7415028335a57 new file mode 100644 index 000000000..fa701e21b --- /dev/null +++ b/Tests/Module/ExternalData/MD5/8c018830e3efa5caf3c7415028335a57 @@ -0,0 +1 @@ +Input file already transformed. diff --git a/Tests/Module/ExternalData/MD5/8f4add4581551facf27237e6577fd662 b/Tests/Module/ExternalData/MD5/8f4add4581551facf27237e6577fd662 new file mode 100644 index 000000000..69ba09c86 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/8f4add4581551facf27237e6577fd662 @@ -0,0 +1 @@ +MetaB diff --git a/Tests/Module/ExternalData/MD5/9d980b06c2f0fec3d4872d68175b9822 b/Tests/Module/ExternalData/MD5/9d980b06c2f0fec3d4872d68175b9822 new file mode 100644 index 000000000..000e7b2bf --- /dev/null +++ b/Tests/Module/ExternalData/MD5/9d980b06c2f0fec3d4872d68175b9822 @@ -0,0 +1 @@ +MetaA diff --git a/Tests/Module/ExternalData/MD5/aaad162b85f60d1eb57ca71a23e8efd7 b/Tests/Module/ExternalData/MD5/aaad162b85f60d1eb57ca71a23e8efd7 new file mode 100644 index 000000000..df0510c3c --- /dev/null +++ b/Tests/Module/ExternalData/MD5/aaad162b85f60d1eb57ca71a23e8efd7 @@ -0,0 +1 @@ +Another input file already transformed. diff --git a/Tests/Module/ExternalData/MD5/c1030719c95f3435d8abc39c0d442946 b/Tests/Module/ExternalData/MD5/c1030719c95f3435d8abc39c0d442946 new file mode 100644 index 000000000..3fac5e63d --- /dev/null +++ b/Tests/Module/ExternalData/MD5/c1030719c95f3435d8abc39c0d442946 @@ -0,0 +1 @@ +MetaC diff --git a/Tests/Module/ExternalData/MD5/ce38ea6c3c1e00fa6405dd64b8bf6da0 b/Tests/Module/ExternalData/MD5/ce38ea6c3c1e00fa6405dd64b8bf6da0 new file mode 100644 index 000000000..362d4b4f2 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/ce38ea6c3c1e00fa6405dd64b8bf6da0 @@ -0,0 +1 @@ +SeriesMixed.1 diff --git a/Tests/Module/ExternalData/MD5/ecfa1ecd417d4253af81ae04d1bd6581 b/Tests/Module/ExternalData/MD5/ecfa1ecd417d4253af81ae04d1bd6581 new file mode 100644 index 000000000..8c414f53b --- /dev/null +++ b/Tests/Module/ExternalData/MD5/ecfa1ecd417d4253af81ae04d1bd6581 @@ -0,0 +1 @@ +PairedB diff --git a/Tests/Module/ExternalData/MD5/f41c94425d01ecbbee70440b951cb058 b/Tests/Module/ExternalData/MD5/f41c94425d01ecbbee70440b951cb058 new file mode 100644 index 000000000..3503da4f2 --- /dev/null +++ b/Tests/Module/ExternalData/MD5/f41c94425d01ecbbee70440b951cb058 @@ -0,0 +1 @@ +Series diff --git a/Tests/Module/ExternalData/MD5/f7ab5a04aae9cb9a520e70b20b9c8ed7 b/Tests/Module/ExternalData/MD5/f7ab5a04aae9cb9a520e70b20b9c8ed7 new file mode 100644 index 000000000..29d727b8f --- /dev/null +++ b/Tests/Module/ExternalData/MD5/f7ab5a04aae9cb9a520e70b20b9c8ed7 @@ -0,0 +1 @@ +Series.2 diff --git a/Tests/Module/ExternalData/MetaA.dat.md5 b/Tests/Module/ExternalData/MetaA.dat.md5 new file mode 100644 index 000000000..4a78fc783 --- /dev/null +++ b/Tests/Module/ExternalData/MetaA.dat.md5 @@ -0,0 +1 @@ +9d980b06c2f0fec3d4872d68175b9822 diff --git a/Tests/Module/ExternalData/MetaB.dat.md5 b/Tests/Module/ExternalData/MetaB.dat.md5 new file mode 100644 index 000000000..4557a216a --- /dev/null +++ b/Tests/Module/ExternalData/MetaB.dat.md5 @@ -0,0 +1 @@ +8f4add4581551facf27237e6577fd662 diff --git a/Tests/Module/ExternalData/MetaC.dat.md5 b/Tests/Module/ExternalData/MetaC.dat.md5 new file mode 100644 index 000000000..a7f23dd7f --- /dev/null +++ b/Tests/Module/ExternalData/MetaC.dat.md5 @@ -0,0 +1 @@ +c1030719c95f3435d8abc39c0d442946 diff --git a/Tests/Module/ExternalData/MetaTop.dat.md5 b/Tests/Module/ExternalData/MetaTop.dat.md5 new file mode 100644 index 000000000..1906cbf7f --- /dev/null +++ b/Tests/Module/ExternalData/MetaTop.dat.md5 @@ -0,0 +1 @@ +08cfcf221f76ace7b906b312284e73d7 diff --git a/Tests/Module/ExternalData/PairedA.dat.md5 b/Tests/Module/ExternalData/PairedA.dat.md5 new file mode 100644 index 000000000..1ffe035e0 --- /dev/null +++ b/Tests/Module/ExternalData/PairedA.dat.md5 @@ -0,0 +1 @@ +401767f22a456b3522953722090a2c36 diff --git a/Tests/Module/ExternalData/PairedB.dat.md5 b/Tests/Module/ExternalData/PairedB.dat.md5 new file mode 100644 index 000000000..89c942b63 --- /dev/null +++ b/Tests/Module/ExternalData/PairedB.dat.md5 @@ -0,0 +1 @@ +ecfa1ecd417d4253af81ae04d1bd6581 diff --git a/Tests/Module/ExternalData/SHA1/.gitattributes b/Tests/Module/ExternalData/SHA1/.gitattributes new file mode 100644 index 000000000..3e51d39db --- /dev/null +++ b/Tests/Module/ExternalData/SHA1/.gitattributes @@ -0,0 +1 @@ +* -crlf diff --git a/Tests/Module/ExternalData/SHA1/2af59a7022024974f3b8521b7ed8137c996a79f1 b/Tests/Module/ExternalData/SHA1/2af59a7022024974f3b8521b7ed8137c996a79f1 new file mode 100644 index 000000000..a38854060 --- /dev/null +++ b/Tests/Module/ExternalData/SHA1/2af59a7022024974f3b8521b7ed8137c996a79f1 @@ -0,0 +1 @@ +SeriesMixed.2 diff --git a/Tests/Module/ExternalData/SHA224/.gitattributes b/Tests/Module/ExternalData/SHA224/.gitattributes new file mode 100644 index 000000000..3e51d39db --- /dev/null +++ b/Tests/Module/ExternalData/SHA224/.gitattributes @@ -0,0 +1 @@ +* -crlf diff --git a/Tests/Module/ExternalData/SHA224/3b679da7908562fe1cc28db47ffb89bae025f4551dceb343a5869174 b/Tests/Module/ExternalData/SHA224/3b679da7908562fe1cc28db47ffb89bae025f4551dceb343a5869174 new file mode 100644 index 000000000..e806d9853 --- /dev/null +++ b/Tests/Module/ExternalData/SHA224/3b679da7908562fe1cc28db47ffb89bae025f4551dceb343a5869174 @@ -0,0 +1 @@ +SeriesMixed.3 diff --git a/Tests/Module/ExternalData/SHA256/.gitattributes b/Tests/Module/ExternalData/SHA256/.gitattributes new file mode 100644 index 000000000..3e51d39db --- /dev/null +++ b/Tests/Module/ExternalData/SHA256/.gitattributes @@ -0,0 +1 @@ +* -crlf diff --git a/Tests/Module/ExternalData/SHA256/969171a0dd70d49ce096bd3e8178c7e26c711c9b20dbcaa3853d869d3871f133 b/Tests/Module/ExternalData/SHA256/969171a0dd70d49ce096bd3e8178c7e26c711c9b20dbcaa3853d869d3871f133 new file mode 100644 index 000000000..e3d1e0cc7 --- /dev/null +++ b/Tests/Module/ExternalData/SHA256/969171a0dd70d49ce096bd3e8178c7e26c711c9b20dbcaa3853d869d3871f133 @@ -0,0 +1 @@ +SeriesMixed.4 diff --git a/Tests/Module/ExternalData/SeriesA.dat.md5 b/Tests/Module/ExternalData/SeriesA.dat.md5 new file mode 100644 index 000000000..be2d6878b --- /dev/null +++ b/Tests/Module/ExternalData/SeriesA.dat.md5 @@ -0,0 +1 @@ +f41c94425d01ecbbee70440b951cb058 diff --git a/Tests/Module/ExternalData/SeriesA1.dat.md5 b/Tests/Module/ExternalData/SeriesA1.dat.md5 new file mode 100644 index 000000000..f22e266a6 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesA1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesA2.dat.md5 b/Tests/Module/ExternalData/SeriesA2.dat.md5 new file mode 100644 index 000000000..2b917e793 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesA2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesA3.dat.md5 b/Tests/Module/ExternalData/SeriesA3.dat.md5 new file mode 100644 index 000000000..b9c9760c4 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesA3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesAn1.dat.md5 b/Tests/Module/ExternalData/SeriesAn1.dat.md5 new file mode 100644 index 000000000..f22e266a6 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesAn1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesAn2.dat.md5 b/Tests/Module/ExternalData/SeriesAn2.dat.md5 new file mode 100644 index 000000000..2b917e793 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesAn2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesAn3.dat.md5 b/Tests/Module/ExternalData/SeriesAn3.dat.md5 new file mode 100644 index 000000000..b9c9760c4 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesAn3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesB.dat.md5 b/Tests/Module/ExternalData/SeriesB.dat.md5 new file mode 100644 index 000000000..be2d6878b --- /dev/null +++ b/Tests/Module/ExternalData/SeriesB.dat.md5 @@ -0,0 +1 @@ +f41c94425d01ecbbee70440b951cb058 diff --git a/Tests/Module/ExternalData/SeriesB_1.dat.md5 b/Tests/Module/ExternalData/SeriesB_1.dat.md5 new file mode 100644 index 000000000..f22e266a6 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesB_1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesB_2.dat.md5 b/Tests/Module/ExternalData/SeriesB_2.dat.md5 new file mode 100644 index 000000000..2b917e793 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesB_2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesB_3.dat.md5 b/Tests/Module/ExternalData/SeriesB_3.dat.md5 new file mode 100644 index 000000000..b9c9760c4 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesB_3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesBn_1.dat.md5 b/Tests/Module/ExternalData/SeriesBn_1.dat.md5 new file mode 100644 index 000000000..f22e266a6 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesBn_1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesBn_2.dat.md5 b/Tests/Module/ExternalData/SeriesBn_2.dat.md5 new file mode 100644 index 000000000..2b917e793 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesBn_2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesBn_3.dat.md5 b/Tests/Module/ExternalData/SeriesBn_3.dat.md5 new file mode 100644 index 000000000..b9c9760c4 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesBn_3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesC.1.dat.md5 b/Tests/Module/ExternalData/SeriesC.1.dat.md5 new file mode 100644 index 000000000..f22e266a6 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesC.1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesC.2.dat.md5 b/Tests/Module/ExternalData/SeriesC.2.dat.md5 new file mode 100644 index 000000000..2b917e793 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesC.2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesC.3.dat.md5 b/Tests/Module/ExternalData/SeriesC.3.dat.md5 new file mode 100644 index 000000000..b9c9760c4 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesC.3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesC.dat.md5 b/Tests/Module/ExternalData/SeriesC.dat.md5 new file mode 100644 index 000000000..be2d6878b --- /dev/null +++ b/Tests/Module/ExternalData/SeriesC.dat.md5 @@ -0,0 +1 @@ +f41c94425d01ecbbee70440b951cb058 diff --git a/Tests/Module/ExternalData/SeriesCn.1.dat.md5 b/Tests/Module/ExternalData/SeriesCn.1.dat.md5 new file mode 100644 index 000000000..f22e266a6 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesCn.1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesCn.2.dat.md5 b/Tests/Module/ExternalData/SeriesCn.2.dat.md5 new file mode 100644 index 000000000..2b917e793 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesCn.2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesCn.3.dat.md5 b/Tests/Module/ExternalData/SeriesCn.3.dat.md5 new file mode 100644 index 000000000..b9c9760c4 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesCn.3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesD-1.dat.md5 b/Tests/Module/ExternalData/SeriesD-1.dat.md5 new file mode 100644 index 000000000..f22e266a6 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesD-1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesD-2.dat.md5 b/Tests/Module/ExternalData/SeriesD-2.dat.md5 new file mode 100644 index 000000000..2b917e793 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesD-2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesD-3.dat.md5 b/Tests/Module/ExternalData/SeriesD-3.dat.md5 new file mode 100644 index 000000000..b9c9760c4 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesD-3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesD.dat.md5 b/Tests/Module/ExternalData/SeriesD.dat.md5 new file mode 100644 index 000000000..be2d6878b --- /dev/null +++ b/Tests/Module/ExternalData/SeriesD.dat.md5 @@ -0,0 +1 @@ +f41c94425d01ecbbee70440b951cb058 diff --git a/Tests/Module/ExternalData/SeriesDn-1.dat.md5 b/Tests/Module/ExternalData/SeriesDn-1.dat.md5 new file mode 100644 index 000000000..f22e266a6 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesDn-1.dat.md5 @@ -0,0 +1 @@ +31eff09e84fca01415f8cd9d82ec432b diff --git a/Tests/Module/ExternalData/SeriesDn-2.dat.md5 b/Tests/Module/ExternalData/SeriesDn-2.dat.md5 new file mode 100644 index 000000000..2b917e793 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesDn-2.dat.md5 @@ -0,0 +1 @@ +f7ab5a04aae9cb9a520e70b20b9c8ed7 diff --git a/Tests/Module/ExternalData/SeriesDn-3.dat.md5 b/Tests/Module/ExternalData/SeriesDn-3.dat.md5 new file mode 100644 index 000000000..b9c9760c4 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesDn-3.dat.md5 @@ -0,0 +1 @@ +30ba0acdee9096b3b9fc6c69362c6b42 diff --git a/Tests/Module/ExternalData/SeriesMixed.1.dat.md5 b/Tests/Module/ExternalData/SeriesMixed.1.dat.md5 new file mode 100644 index 000000000..f962d8f79 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesMixed.1.dat.md5 @@ -0,0 +1 @@ +ce38ea6c3c1e00fa6405dd64b8bf6da0 diff --git a/Tests/Module/ExternalData/SeriesMixed.2.dat.sha1 b/Tests/Module/ExternalData/SeriesMixed.2.dat.sha1 new file mode 100644 index 000000000..43a354086 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesMixed.2.dat.sha1 @@ -0,0 +1 @@ +2af59a7022024974f3b8521b7ed8137c996a79f1 diff --git a/Tests/Module/ExternalData/SeriesMixed.3.dat.sha224 b/Tests/Module/ExternalData/SeriesMixed.3.dat.sha224 new file mode 100644 index 000000000..a18e40e4c --- /dev/null +++ b/Tests/Module/ExternalData/SeriesMixed.3.dat.sha224 @@ -0,0 +1 @@ +3b679da7908562fe1cc28db47ffb89bae025f4551dceb343a5869174 diff --git a/Tests/Module/ExternalData/SeriesMixed.4.dat.sha256 b/Tests/Module/ExternalData/SeriesMixed.4.dat.sha256 new file mode 100644 index 000000000..67fc3c2f1 --- /dev/null +++ b/Tests/Module/ExternalData/SeriesMixed.4.dat.sha256 @@ -0,0 +1 @@ +969171a0dd70d49ce096bd3e8178c7e26c711c9b20dbcaa3853d869d3871f133 diff --git a/Tests/NewlineArgs/CMakeLists.txt b/Tests/NewlineArgs/CMakeLists.txt index a18230488..755160102 100644 --- a/Tests/NewlineArgs/CMakeLists.txt +++ b/Tests/NewlineArgs/CMakeLists.txt @@ -5,10 +5,10 @@ project (NewlineArgs CXX) add_definitions("-DTEST_FLAG_1 -DTEST_FLAG_2") -include_directories(" ${NewlineArgs_BINARY_DIR} +include_directories(" ${NewlineArgs_BINARY_DIR} ${NewlineArgs_SOURCE_DIR} ") -configure_file("${NewlineArgs_SOURCE_DIR}/libcxx2.h.in" +configure_file("${NewlineArgs_SOURCE_DIR}/libcxx2.h.in" "${NewlineArgs_BINARY_DIR}/libcxx2.h") add_library(testcxx1 libcxx1.cxx) diff --git a/Tests/ObjC++/CMakeLists.txt b/Tests/ObjC++/CMakeLists.txt index c892bd0a1..8b1563ed8 100644 --- a/Tests/ObjC++/CMakeLists.txt +++ b/Tests/ObjC++/CMakeLists.txt @@ -1,6 +1,6 @@ # a simple objc++ test case that uses Cocoa framework -PROJECT (ObjC++) +project (ObjC++) -ADD_EXECUTABLE (ObjC++ objc++.mm) -TARGET_LINK_LIBRARIES(ObjC++ "-framework Cocoa") +add_executable (ObjC++ objc++.mm) +target_link_libraries(ObjC++ "-framework Cocoa") diff --git a/Tests/ObjC++/objc++.mm b/Tests/ObjC++/objc++.mm index f0be25682..258ebaa52 100644 --- a/Tests/ObjC++/objc++.mm +++ b/Tests/ObjC++/objc++.mm @@ -5,7 +5,7 @@ using namespace std; int main() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - + NSMutableSet *mySet = [NSMutableSet set]; cout<<"Adding values to the set."<) +target_compile_definitions(Bexport PRIVATE $) diff --git a/Tests/ObjectLibrary/B/b.h b/Tests/ObjectLibrary/B/b.h index 11b22f427..3489c7105 100644 --- a/Tests/ObjectLibrary/B/b.h +++ b/Tests/ObjectLibrary/B/b.h @@ -4,8 +4,15 @@ #ifndef B_DEF # error "B_DEF not defined" #endif + #if defined(_WIN32) && defined(Bexport) # define EXPORT_B __declspec(dllexport) #else # define EXPORT_B #endif + +#if defined(_WIN32) && defined(SHARED_B) +# define IMPORT_B __declspec(dllimport) +#else +# define IMPORT_B +#endif diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index 87234159f..13a07b44a 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -26,6 +26,9 @@ endif() # Test static library without its own sources. add_library(ABstatic STATIC ${dummy} $ $) +target_include_directories(ABstatic PUBLIC $) +target_compile_definitions(ABstatic PUBLIC $) + add_executable(UseABstatic mainAB.c) target_link_libraries(UseABstatic ABstatic) @@ -41,12 +44,17 @@ endif() # Test shared library without its own sources. add_library(ABshared SHARED ${dummy} ${ABshared_SRCS}) +target_include_directories(ABshared PUBLIC $) +target_compile_definitions(ABshared PUBLIC $) + add_executable(UseABshared mainAB.c) set_property(TARGET UseABshared PROPERTY COMPILE_DEFINITIONS SHARED_B ${NO_A}) target_link_libraries(UseABshared ABshared) # Test executable without its own sources. add_library(ABmain OBJECT mainAB.c) +target_include_directories(ABmain PUBLIC $) +target_compile_definitions(ABmain PUBLIC $) add_executable(UseABinternal ${dummy} $ $ $ ) diff --git a/Tests/ObjectLibrary/mainAB.c b/Tests/ObjectLibrary/mainAB.c index 556898b83..38db20520 100644 --- a/Tests/ObjectLibrary/mainAB.c +++ b/Tests/ObjectLibrary/mainAB.c @@ -1,8 +1,6 @@ -#if defined(_WIN32) && defined(SHARED_B) -# define IMPORT_B __declspec(dllimport) -#else -# define IMPORT_B -#endif + +#include "b.h" + extern IMPORT_B int b1(void); extern IMPORT_B int b2(void); #ifndef NO_A diff --git a/Tests/OutOfBinary/CMakeLists.txt b/Tests/OutOfBinary/CMakeLists.txt index fcf90bd0d..e32754143 100644 --- a/Tests/OutOfBinary/CMakeLists.txt +++ b/Tests/OutOfBinary/CMakeLists.txt @@ -1,2 +1,2 @@ -ADD_LIBRARY(outlib outlib.c) +add_library(outlib outlib.c) diff --git a/Tests/OutOfSource/CMakeLists.txt b/Tests/OutOfSource/CMakeLists.txt index e250f4177..de1603a55 100644 --- a/Tests/OutOfSource/CMakeLists.txt +++ b/Tests/OutOfSource/CMakeLists.txt @@ -6,9 +6,9 @@ add_subdirectory(SubDir) get_directory_property(ANIMAL DIRECTORY OutOfSourceSubdir DEFINITION WEASELS) get_directory_property(ANIMALREL DIRECTORY SubDir/../OutOfSourceSubdir DEFINITION WEASELS) -IF(NOT "${ANIMAL}" STREQUAL "${ANIMALREL}") - MESSAGE(FATAL_ERROR "GET_DIRECTORY_PROPERTY does not seem to collapse paths.") -ENDIF(NOT "${ANIMAL}" STREQUAL "${ANIMALREL}") +if(NOT "${ANIMAL}" STREQUAL "${ANIMALREL}") + message(FATAL_ERROR "GET_DIRECTORY_PROPERTY does not seem to collapse paths.") +endif() configure_file( ${OutOfSource_SOURCE_DIR}/testdp.h.in diff --git a/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt b/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt index c362e79ba..10a2f59d1 100644 --- a/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt +++ b/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt @@ -1,62 +1,62 @@ -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) -IF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}") - SET(BUILD_SHARED_LIBS 1) +if ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}") + set(BUILD_SHARED_LIBS 1) # Construct a source file outside the tree whose full path is close to # the path length limit. This will cause the full path to the object # file in the build tree to exceed the maximum path length which will # test cmLocalGenerator::CreateSafeUniqueObjectFileName. - GET_FILENAME_COMPONENT(DEEPDIR + get_filename_component(DEEPDIR ${OutOfSource_BINARY_DIR}/../OutOfSourceDeep/deeper ABSOLUTE) # Test giving the generator a custom limit. - SET(CMAKE_OBJECT_PATH_MAX 220) + set(CMAKE_OBJECT_PATH_MAX 220) # Use a separate variable for computation. - SET(MAXPATH "${CMAKE_OBJECT_PATH_MAX}") + set(MAXPATH "${CMAKE_OBJECT_PATH_MAX}") # VS8 adds "OutOfSource/SubDir/OutOfSourceSubdir/../../../" to the # path of the source file for no good reason. Reduce the length # limit by 46 characters to account for it. It should still be long # enough to require special object file name conversion. - IF(${CMAKE_GENERATOR} MATCHES "Visual Studio (8|10)") - MATH(EXPR MAXPATH "${MAXPATH} - 46") - ENDIF() + if(${CMAKE_GENERATOR} MATCHES "Visual Studio (8|10)") + math(EXPR MAXPATH "${MAXPATH} - 46") + endif() # Ninja imposes a maximum path component count of 30. Permit more # path components in the source path. - IF(${CMAKE_GENERATOR} MATCHES "Ninja") - MATH(EXPR MAXPATH "${MAXPATH} - 44") - ENDIF() + if(${CMAKE_GENERATOR} MATCHES "Ninja") + math(EXPR MAXPATH "${MAXPATH} - 44") + endif() # MAXPATH less 25 for last /and/deeper/simple.cxx part and small safety - MATH(EXPR MAXPATH "${MAXPATH} - 25") - STRING(LENGTH "${DEEPDIR}" DEEPDIR_LEN) - WHILE("${DEEPDIR_LEN}" LESS "${MAXPATH}") - SET(DEEPDIR ${DEEPDIR}/and/deeper) - STRING(LENGTH "${DEEPDIR}" DEEPDIR_LEN) - ENDWHILE("${DEEPDIR_LEN}" LESS "${MAXPATH}") - SET(DEEPSRC ${DEEPDIR}/simple.cxx) - STRING(LENGTH "${DEEPSRC}" DEEPSRC_LEN) - CONFIGURE_FILE(simple.cxx.in ${DEEPSRC} COPYONLY) + math(EXPR MAXPATH "${MAXPATH} - 25") + string(LENGTH "${DEEPDIR}" DEEPDIR_LEN) + while("${DEEPDIR_LEN}" LESS "${MAXPATH}") + set(DEEPDIR ${DEEPDIR}/and/deeper) + string(LENGTH "${DEEPDIR}" DEEPDIR_LEN) + endwhile() + set(DEEPSRC ${DEEPDIR}/simple.cxx) + string(LENGTH "${DEEPSRC}" DEEPSRC_LEN) + configure_file(simple.cxx.in ${DEEPSRC} COPYONLY) # Watcom WMake seems to have problems with long command lines. Just # disable this part of the test until it is resolved. - IF(${CMAKE_GENERATOR} MATCHES "Watcom WMake") - SET(DEEPSRC "") - ADD_DEFINITIONS(-DNO_DEEPSRC) - ENDIF(${CMAKE_GENERATOR} MATCHES "Watcom WMake") + if(${CMAKE_GENERATOR} MATCHES "Watcom WMake") + set(DEEPSRC "") + add_definitions(-DNO_DEEPSRC) + endif() - ADD_LIBRARY(testlib testlib.cxx) - ADD_EXECUTABLE (simple simple.cxx ../simple.cxx ${DEEPSRC}) - TARGET_LINK_LIBRARIES(simple testlib outlib) -ENDIF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}") + add_library(testlib testlib.cxx) + add_executable (simple simple.cxx ../simple.cxx ${DEEPSRC}) + target_link_libraries(simple testlib outlib) +endif () # test getting a definition from a subdir -SET (WEASELS SIZZLING) +set (WEASELS SIZZLING) -GET_DIRECTORY_PROPERTY(incDirs INCLUDE_DIRECTORIES) -IF(NOT incDirs) - MESSAGE(FATAL_ERROR "GET_DIRECTORY_PROPERTY(INCLUDE_DIRECTORIES) returned empty list") -ENDIF(NOT incDirs) +get_directory_property(incDirs INCLUDE_DIRECTORIES) +if(NOT incDirs) + message(FATAL_ERROR "get_directory_property(INCLUDE_DIRECTORIES) returned empty list") +endif() diff --git a/Tests/OutOfSource/OutOfSourceSubdir/testlib.h b/Tests/OutOfSource/OutOfSourceSubdir/testlib.h index 289b67361..75c2d84fd 100644 --- a/Tests/OutOfSource/OutOfSourceSubdir/testlib.h +++ b/Tests/OutOfSource/OutOfSourceSubdir/testlib.h @@ -5,7 +5,7 @@ # define CM_TEST_LIB_EXPORT __declspec( dllimport ) # endif #else -# define CM_TEST_LIB_EXPORT +# define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float TestLib(); diff --git a/Tests/OutOfSource/SubDir/CMakeLists.txt b/Tests/OutOfSource/SubDir/CMakeLists.txt index 4fc48e13d..c5df36e1b 100644 --- a/Tests/OutOfSource/SubDir/CMakeLists.txt +++ b/Tests/OutOfSource/SubDir/CMakeLists.txt @@ -1,8 +1,8 @@ -PROJECT(ANOTHER_PROJ) +project(ANOTHER_PROJ) # subdir to an out of source and out of binary directory -ADD_SUBDIRECTORY(${OutOfSource_SOURCE_DIR}/../OutOfBinary +add_subdirectory(${OutOfSource_SOURCE_DIR}/../OutOfBinary ${OutOfSource_BINARY_DIR}/../OutOfBinary) # subdir to a sibling dir -ADD_SUBDIRECTORY(${OutOfSource_SOURCE_DIR}/${KEN}OutOfSourceSubdir OutOfSourceSubdir ) +add_subdirectory(${OutOfSource_SOURCE_DIR}/${KEN}OutOfSourceSubdir OutOfSourceSubdir ) diff --git a/Tests/PDBDirectoryAndName/CMakeLists.txt b/Tests/PDBDirectoryAndName/CMakeLists.txt new file mode 100644 index 000000000..bc2f01317 --- /dev/null +++ b/Tests/PDBDirectoryAndName/CMakeLists.txt @@ -0,0 +1,79 @@ +cmake_minimum_required(VERSION 2.8) +project(PDBDirectoryAndName C) + +# Make sure the proper compiler is in use. +if(NOT MSVC AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") + message(FATAL_ERROR "The PDBDirectoryAndName test works only with MSVC or Intel") +endif() + +set(my_targets "") + +add_library(mylibA SHARED mylibA.c) +set_target_properties(mylibA PROPERTIES + PDB_NAME "mylibA_Special" + PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibA_PDB" +) +list(APPEND my_targets mylibA) + +add_library(mylibB STATIC mylibB.c) +set_target_properties(mylibB PROPERTIES + PDB_NAME "mylibB_Special" + PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibB_PDB" +) +list(APPEND my_targets mylibB) + +add_library(mylibC SHARED mylibC.c) +set_target_properties(mylibC PROPERTIES + PDB_NAME "mylibC_Special" +) +list(APPEND my_targets mylibC) + +add_library(mylibD STATIC mylibD.c) +set_target_properties(mylibD PROPERTIES + PDB_NAME "mylibD_Special" +) +list(APPEND my_targets mylibD) + +add_executable(myexe myexe.c) +set_target_properties(myexe PROPERTIES + PDB_NAME "myexe_Special" + PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/myexe_PDB" +) +list(APPEND my_targets myexe) + +target_link_libraries(myexe mylibA mylibB mylibC mylibD) + +add_executable(myexe2 myexe2.c) +set_target_properties(myexe2 PROPERTIES + PDB_NAME "myexe2_Special" +) +list(APPEND my_targets myexe2) + +target_link_libraries(myexe2 mylibA mylibD) + +#----------------------------------------------------------------------------- +# Check that PDB files actually appear where expected. + +# The PDB_NAME and PDB_OUTPUT_DIRECTORY options do not work in VS 6. +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") + return() +endif() +# PDB output not fully implemented for Intel +if("${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") + return() +endif() + +set(pdbs "") +foreach(t ${my_targets}) + get_property(pdb_name TARGET ${t} PROPERTY PDB_NAME) + get_property(pdb_dir TARGET ${t} PROPERTY PDB_OUTPUT_DIRECTORY) + if(NOT pdb_dir) + set(pdb_dir ${CMAKE_CURRENT_BINARY_DIR}) + endif() + list(APPEND pdbs ${pdb_dir}/${CMAKE_CFG_INTDIR}/${pdb_name}.pdb) +endforeach() +add_custom_target(check_pdbs ALL VERBATIM + COMMAND ${CMAKE_COMMAND} -Dconfig=$ "-Dpdbs=${pdbs}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/check_pdbs.cmake + ) +add_dependencies(check_pdbs ${my_targets}) diff --git a/Tests/PDBDirectoryAndName/check_pdbs.cmake b/Tests/PDBDirectoryAndName/check_pdbs.cmake new file mode 100644 index 000000000..89cdb3c72 --- /dev/null +++ b/Tests/PDBDirectoryAndName/check_pdbs.cmake @@ -0,0 +1,10 @@ +if(NOT "${config}" MATCHES "[Dd][Ee][Bb]") + return() +endif() +foreach(pdb ${pdbs}) + if(EXISTS "${pdb}") + message(STATUS "PDB Exists: ${pdb}") + else() + message(SEND_ERROR "PDB MISSING: ${pdb}") + endif() +endforeach() diff --git a/Tests/PDBDirectoryAndName/myexe.c b/Tests/PDBDirectoryAndName/myexe.c new file mode 100644 index 000000000..c6d9065fe --- /dev/null +++ b/Tests/PDBDirectoryAndName/myexe.c @@ -0,0 +1,5 @@ +extern int mylibA(); +extern int mylibB(); +extern int mylibC(); +extern int mylibD(); +int main() { return mylibA() + mylibB() + mylibC() + mylibD(); } diff --git a/Tests/PDBDirectoryAndName/myexe2.c b/Tests/PDBDirectoryAndName/myexe2.c new file mode 100644 index 000000000..75b39cd28 --- /dev/null +++ b/Tests/PDBDirectoryAndName/myexe2.c @@ -0,0 +1,3 @@ +extern int mylibA(); +extern int mylibD(); +int main() { return mylibA() + mylibD(); } diff --git a/Tests/PDBDirectoryAndName/mylibA.c b/Tests/PDBDirectoryAndName/mylibA.c new file mode 100644 index 000000000..f4c553f42 --- /dev/null +++ b/Tests/PDBDirectoryAndName/mylibA.c @@ -0,0 +1 @@ +__declspec(dllexport) int mylibA() { return 1; } diff --git a/Tests/PDBDirectoryAndName/mylibB.c b/Tests/PDBDirectoryAndName/mylibB.c new file mode 100644 index 000000000..2040c6795 --- /dev/null +++ b/Tests/PDBDirectoryAndName/mylibB.c @@ -0,0 +1 @@ +int mylibB() { return -1; } diff --git a/Tests/PDBDirectoryAndName/mylibC.c b/Tests/PDBDirectoryAndName/mylibC.c new file mode 100644 index 000000000..adf7c7098 --- /dev/null +++ b/Tests/PDBDirectoryAndName/mylibC.c @@ -0,0 +1 @@ +__declspec(dllexport) int mylibC() { return 1; } diff --git a/Tests/PDBDirectoryAndName/mylibD.c b/Tests/PDBDirectoryAndName/mylibD.c new file mode 100644 index 000000000..efa8a8234 --- /dev/null +++ b/Tests/PDBDirectoryAndName/mylibD.c @@ -0,0 +1 @@ +int mylibD() { return -1; } diff --git a/Tests/PerConfig/CMakeLists.txt b/Tests/PerConfig/CMakeLists.txt index 3a473b883..7f461b0ec 100644 --- a/Tests/PerConfig/CMakeLists.txt +++ b/Tests/PerConfig/CMakeLists.txt @@ -1,23 +1,23 @@ project(PerConfig C) # Targets with per-configuration names. -ADD_LIBRARY(pcStatic STATIC pcStatic.c) -SET_PROPERTY(TARGET pcStatic PROPERTY RELEASE_POSTFIX -opt) -SET_PROPERTY(TARGET pcStatic PROPERTY DEBUG_POSTFIX -dbg) -ADD_LIBRARY(pcShared SHARED pcShared.c) -SET_PROPERTY(TARGET pcShared PROPERTY RELEASE_POSTFIX -opt) -SET_PROPERTY(TARGET pcShared PROPERTY DEBUG_POSTFIX -dbg) -SET_PROPERTY(TARGET pcShared PROPERTY VERSION 1.2) -SET_PROPERTY(TARGET pcShared PROPERTY SOVERSION 3) -IF(UNIX AND NOT CYGWIN) - SET(soname_file -DpcShared_soname_file=$) -ENDIF() -ADD_EXECUTABLE(perconfig perconfig.c) -TARGET_LINK_LIBRARIES(perconfig pcStatic pcShared) -SET_PROPERTY(TARGET perconfig PROPERTY RELEASE_POSTFIX -opt) -SET_PROPERTY(TARGET perconfig PROPERTY DEBUG_POSTFIX -dbg) +add_library(pcStatic STATIC pcStatic.c) +set_property(TARGET pcStatic PROPERTY RELEASE_POSTFIX -opt) +set_property(TARGET pcStatic PROPERTY DEBUG_POSTFIX -dbg) +add_library(pcShared SHARED pcShared.c) +set_property(TARGET pcShared PROPERTY RELEASE_POSTFIX -opt) +set_property(TARGET pcShared PROPERTY DEBUG_POSTFIX -dbg) +set_property(TARGET pcShared PROPERTY VERSION 1.2) +set_property(TARGET pcShared PROPERTY SOVERSION 3) +if(UNIX AND NOT CYGWIN) + set(soname_file -DpcShared_soname_file=$) +endif() +add_executable(perconfig perconfig.c) +target_link_libraries(perconfig pcStatic pcShared) +set_property(TARGET perconfig PROPERTY RELEASE_POSTFIX -opt) +set_property(TARGET perconfig PROPERTY DEBUG_POSTFIX -dbg) -SET(PerConfig_COMMAND +set(PerConfig_COMMAND ${CMAKE_COMMAND} -Dconfiguration=$ -Dperconfig_file_dir=$ @@ -30,5 +30,5 @@ SET(PerConfig_COMMAND ${soname_file} -P ${PerConfig_SOURCE_DIR}/perconfig.cmake ) -SET(PerConfig_COMMAND "${PerConfig_COMMAND}" PARENT_SCOPE) -SET(PerConfig_DEPENDS ${PerConfig_SOURCE_DIR}/perconfig.cmake perconfig pcStatic pcShared) +set(PerConfig_COMMAND "${PerConfig_COMMAND}" PARENT_SCOPE) +set(PerConfig_DEPENDS ${PerConfig_SOURCE_DIR}/perconfig.cmake perconfig pcStatic pcShared) diff --git a/Tests/Plugin/CMakeLists.txt b/Tests/Plugin/CMakeLists.txt index 31ca59c13..d1b8334a9 100644 --- a/Tests/Plugin/CMakeLists.txt +++ b/Tests/Plugin/CMakeLists.txt @@ -1,87 +1,87 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(Plugin) +project(Plugin) # Test per-target output directory properties. -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/bin) -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/lib/plugin) -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/lib/static) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/bin) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/lib/plugin) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/lib/static) # We need the dynamic loader support from KWSys to load the plugin in # the executable. -SET(KWSYS_NAMESPACE kwsys) -SET(KWSYS_HEADER_ROOT ${Plugin_BINARY_DIR}/include) -SET(KWSYS_USE_DynamicLoader 1) -ADD_SUBDIRECTORY(${Plugin_SOURCE_DIR}/../../Source/kwsys src/kwsys) +set(KWSYS_NAMESPACE kwsys) +set(KWSYS_HEADER_ROOT ${Plugin_BINARY_DIR}/include) +set(KWSYS_USE_DynamicLoader 1) +add_subdirectory(${Plugin_SOURCE_DIR}/../../Source/kwsys src/kwsys) # Configure the location of plugins. -CONFIGURE_FILE(${Plugin_SOURCE_DIR}/src/example_exe.h.in +configure_file(${Plugin_SOURCE_DIR}/src/example_exe.h.in ${Plugin_BINARY_DIR}/include/example_exe.h @ONLY) # We need to include headers from the source tree and configured # headers in the build tree. -INCLUDE_DIRECTORIES( +include_directories( ${Plugin_BINARY_DIR}/include ${Plugin_SOURCE_DIR}/include ) # Create an executable that exports an API for use by plugins. -ADD_EXECUTABLE(example_exe src/example_exe.cxx) -SET_TARGET_PROPERTIES(example_exe PROPERTIES +add_executable(example_exe src/example_exe.cxx) +set_target_properties(example_exe PROPERTIES ENABLE_EXPORTS 1 OUTPUT_NAME example # Test placing exe import library in unique directory. ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/exe ) -TARGET_LINK_LIBRARIES(example_exe kwsys) +target_link_libraries(example_exe kwsys) # Create a plugin that uses the API provided by the executable. # This module "links" to the executable to use the symbols. -ADD_LIBRARY(example_mod_1 MODULE src/example_mod_1.c) -TARGET_LINK_LIBRARIES(example_mod_1 example_exe) +add_library(example_mod_1 MODULE src/example_mod_1.c) +target_link_libraries(example_mod_1 example_exe) -IF(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG AND +if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG AND "${CMAKE_C_CREATE_SHARED_MODULE}" MATCHES "SONAME_FLAG") # Add a second plugin that should not have any soname. - ADD_LIBRARY(example_mod_2 MODULE src/example_mod_1.c) - TARGET_LINK_LIBRARIES(example_mod_2 example_exe) - SET_PROPERTY(TARGET example_mod_2 PROPERTY NO_SONAME 1) + add_library(example_mod_2 MODULE src/example_mod_1.c) + target_link_libraries(example_mod_2 example_exe) + set_property(TARGET example_mod_2 PROPERTY NO_SONAME 1) # Verify that targets export with proper IMPORTED SONAME properties. - EXPORT(TARGETS example_mod_1 example_mod_2 NAMESPACE exp_ + export(TARGETS example_mod_1 example_mod_2 NAMESPACE exp_ FILE ${CMAKE_CURRENT_BINARY_DIR}/mods.cmake) - INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/mods.cmake) - GET_PROPERTY(configs TARGET exp_example_mod_1 PROPERTY IMPORTED_CONFIGURATIONS) - FOREACH(c ${configs}) - STRING(TOUPPER "${c}" CONFIG) - GET_PROPERTY(soname1 TARGET exp_example_mod_1 PROPERTY IMPORTED_SONAME_${CONFIG}) - GET_PROPERTY(soname2 TARGET exp_example_mod_2 PROPERTY IMPORTED_NO_SONAME_${CONFIG}) - IF(soname1) - MESSAGE(STATUS "exp_example_mod_1 has IMPORTED_SONAME_${CONFIG} as expected: ${soname1}") - ELSE() - MESSAGE(SEND_ERROR "exp_example_mod_1 does not have IMPORTED_SONAME_${CONFIG} but should") - ENDIF() - IF(soname2) - MESSAGE(STATUS "exp_example_mod_2 has IMPORTED_NO_SONAME_${CONFIG} as expected: ${soname2}") - ELSE() - MESSAGE(SEND_ERROR "exp_example_mod_2 does not have IMPORTED_NO_SONAME_${CONFIG} but should") - ENDIF() - ENDFOREACH() + include(${CMAKE_CURRENT_BINARY_DIR}/mods.cmake) + get_property(configs TARGET exp_example_mod_1 PROPERTY IMPORTED_CONFIGURATIONS) + foreach(c ${configs}) + string(TOUPPER "${c}" CONFIG) + get_property(soname1 TARGET exp_example_mod_1 PROPERTY IMPORTED_SONAME_${CONFIG}) + get_property(soname2 TARGET exp_example_mod_2 PROPERTY IMPORTED_NO_SONAME_${CONFIG}) + if(soname1) + message(STATUS "exp_example_mod_1 has IMPORTED_SONAME_${CONFIG} as expected: ${soname1}") + else() + message(SEND_ERROR "exp_example_mod_1 does not have IMPORTED_SONAME_${CONFIG} but should") + endif() + if(soname2) + message(STATUS "exp_example_mod_2 has IMPORTED_NO_SONAME_${CONFIG} as expected: ${soname2}") + else() + message(SEND_ERROR "exp_example_mod_2 does not have IMPORTED_NO_SONAME_${CONFIG} but should") + endif() + endforeach() # Parse the binary to check for SONAME if possible. - IF("${CMAKE_EXECUTABLE_FORMAT}" MATCHES "ELF") - FIND_PROGRAM(READELF_EXE readelf) - IF(READELF_EXE) - ADD_CUSTOM_TARGET(check_mod_soname ALL COMMAND + if("${CMAKE_EXECUTABLE_FORMAT}" MATCHES "ELF") + find_program(READELF_EXE readelf) + if(READELF_EXE) + add_custom_target(check_mod_soname ALL COMMAND ${CMAKE_COMMAND} -Dreadelf=${READELF_EXE} -Dmod1=$ -Dmod2=$ -P ${CMAKE_CURRENT_SOURCE_DIR}/check_mod_soname.cmake ) - ADD_DEPENDENCIES(check_mod_soname example_mod_1 example_mod_2) - ENDIF() - ENDIF() -ENDIF() + add_dependencies(check_mod_soname example_mod_1 example_mod_2) + endif() + endif() +endif() # TODO: # - create a plugin that links to a static lib diff --git a/Tests/Plugin/src/example_exe.cxx b/Tests/Plugin/src/example_exe.cxx index d2c52052c..309302e58 100644 --- a/Tests/Plugin/src/example_exe.cxx +++ b/Tests/Plugin/src/example_exe.cxx @@ -54,7 +54,7 @@ int main() kwsys_ios::cerr << "Incorrect return value from plugin!" << kwsys_ios::endl; return 1; - } + } kwsys::DynamicLoader::CloseLibrary(handle); return 0; } diff --git a/Tests/PolicyScope/CMakeLists.txt b/Tests/PolicyScope/CMakeLists.txt index e6f2edc07..413195a5c 100644 --- a/Tests/PolicyScope/CMakeLists.txt +++ b/Tests/PolicyScope/CMakeLists.txt @@ -7,7 +7,7 @@ function(check msg lhs rhs) if(NOT "${lhs}" STREQUAL "${rhs}") message(FATAL_ERROR "${msg}: expected [${lhs}], got [${rhs}]") endif() -endfunction(check) +endfunction() #----------------------------------------------------------------------------- # Test using a development framework that sets policies for us. @@ -52,7 +52,7 @@ if(1) # CMP0002 should be changed when this function is invoked cmake_policy(GET CMP0002 cmp) check(CMP0002 "OLD" "${cmp}") - endfunction(func1) + endfunction() # Unset CMP0002 cmake_policy(VERSION 2.4) @@ -65,8 +65,8 @@ if(1) cmake_policy(SET CMP0002 OLD) cmake_policy(GET CMP0002 cmp) check(CMP0002 "OLD" "${cmp}") - endmacro(macro1) -endif(1) + endmacro() +endif() cmake_policy(POP) # CMP0002 should still be NEW in this context. diff --git a/Tests/PreOrder/CMakeLists.txt b/Tests/PreOrder/CMakeLists.txt index 29720e4c1..8b4c43954 100644 --- a/Tests/PreOrder/CMakeLists.txt +++ b/Tests/PreOrder/CMakeLists.txt @@ -1,6 +1,6 @@ # a simple test case -PROJECT (PreOrder) -SET(CMAKE_IGNORE_DEPENDENCIES_ORDERING 1) -ADD_SUBDIRECTORY(Library) -ADD_EXECUTABLE (PreOrder simple.cxx) -TARGET_LINK_LIBRARIES(PreOrder simpleLib) +project (PreOrder) +set(CMAKE_IGNORE_DEPENDENCIES_ORDERING 1) +add_subdirectory(Library) +add_executable (PreOrder simple.cxx) +target_link_libraries(PreOrder simpleLib) diff --git a/Tests/PreOrder/Library/CMakeLists.txt b/Tests/PreOrder/Library/CMakeLists.txt index 6c011eca9..018ffa5e2 100644 --- a/Tests/PreOrder/Library/CMakeLists.txt +++ b/Tests/PreOrder/Library/CMakeLists.txt @@ -1,2 +1,2 @@ -ADD_LIBRARY(simpleLib simpleLib.cxx ) +add_library(simpleLib simpleLib.cxx ) diff --git a/Tests/PrecompiledHeader/CMakeLists.txt b/Tests/PrecompiledHeader/CMakeLists.txt index 3374e325f..6958131bf 100644 --- a/Tests/PrecompiledHeader/CMakeLists.txt +++ b/Tests/PrecompiledHeader/CMakeLists.txt @@ -1,59 +1,59 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(PrecompiledHeader C) +project(PrecompiledHeader C) # Make sure the proper compiler is in use. -IF(NOT MSVC AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") - MESSAGE(FATAL_ERROR "The PrecompiledHeader test works only with MSVC or Intel") -ENDIF() +if(NOT MSVC AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") + message(FATAL_ERROR "The PrecompiledHeader test works only with MSVC or Intel") +endif() # Compute a custom name for the precompiled header. -IF(CMAKE_CONFIGURATION_TYPES) - SET(PCH_DIR "${CMAKE_CURRENT_BINARY_DIR}/PCH/${CMAKE_CFG_INTDIR}") - FOREACH(cfg ${CMAKE_CONFIGURATION_TYPES}) - FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/PCH/${cfg}) - ENDFOREACH() -ELSE(CMAKE_CONFIGURATION_TYPES) - SET(PCH_DIR "${CMAKE_CURRENT_BINARY_DIR}/PCH") - FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/PCH) -ENDIF(CMAKE_CONFIGURATION_TYPES) +if(CMAKE_CONFIGURATION_TYPES) + set(PCH_DIR "${CMAKE_CURRENT_BINARY_DIR}/PCH/${CMAKE_CFG_INTDIR}") + foreach(cfg ${CMAKE_CONFIGURATION_TYPES}) + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/PCH/${cfg}) + endforeach() +else() + set(PCH_DIR "${CMAKE_CURRENT_BINARY_DIR}/PCH") + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/PCH) +endif() # The VS6 IDE does not support renaming .pch files with /Fp. -IF("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") - SET(PCH_USE_INCLUDE_DIR 1) - SET(PCH_FILE) -ELSE("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") - SET(PCH_USE_INCLUDE_DIR 0) - SET(PCH_FILE "\"/Fp${PCH_DIR}/foo_precompiled.pch\"") -ENDIF("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") + set(PCH_USE_INCLUDE_DIR 1) + set(PCH_FILE) +else() + set(PCH_USE_INCLUDE_DIR 0) + set(PCH_FILE "\"/Fp${PCH_DIR}/foo_precompiled.pch\"") +endif() # Choose between an explicit include path and using /I during # precompilation. The /I form is used to test that the PCH is # actually used. In practice the include path form would be used. -IF(PCH_USE_INCLUDE_DIR) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) -ELSE(PCH_USE_INCLUDE_DIR) - SET(PCH_INCLUDE_DIR "\"/I${CMAKE_CURRENT_SOURCE_DIR}/include\"") -ENDIF(PCH_USE_INCLUDE_DIR) +if(PCH_USE_INCLUDE_DIR) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) +else() + set(PCH_INCLUDE_DIR "\"/I${CMAKE_CURRENT_SOURCE_DIR}/include\"") +endif() # Create a target that will use a precompiled header. -SET(foo_SRCS foo1.c foo2.c) -ADD_EXECUTABLE(foo foo_precompile.c ${foo_SRCS}) +set(foo_SRCS foo1.c foo2.c) +add_executable(foo foo_precompile.c ${foo_SRCS}) # Setup flags on the target to create and use the precompiled header. -SET_TARGET_PROPERTIES(foo PROPERTIES +set_target_properties(foo PROPERTIES COMPILE_FLAGS "/Yufoo_precompiled.h /FIfoo_precompiled.h ${PCH_FILE}") -SET_SOURCE_FILES_PROPERTIES(foo_precompile.c PROPERTIES +set_source_files_properties(foo_precompile.c PROPERTIES COMPILE_FLAGS "/Ycfoo_precompiled.h ${PCH_INCLUDE_DIR}") # Setup dependencies for precompiled header creation and use. The VS # IDE takes care of this automatically. -IF("${CMAKE_GENERATOR}" MATCHES "Makefile" OR +if("${CMAKE_GENERATOR}" MATCHES "Makefile" OR "${CMAKE_GENERATOR}" MATCHES "Ninja") # This source file creates the precompiled header as a side-effect. - SET_SOURCE_FILES_PROPERTIES(foo_precompile.c PROPERTIES + set_source_files_properties(foo_precompile.c PROPERTIES OBJECT_OUTPUTS "${PCH_DIR}/foo_precompiled.pch") # These source files use the precompiled header. - SET_SOURCE_FILES_PROPERTIES(${foo_SRCS} PROPERTIES + set_source_files_properties(${foo_SRCS} PROPERTIES OBJECT_DEPENDS "${PCH_DIR}/foo_precompiled.pch") -ENDIF("${CMAKE_GENERATOR}" MATCHES "Makefile") +endif() diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt index 1ed7b83ac..78746e7b8 100644 --- a/Tests/Preprocess/CMakeLists.txt +++ b/Tests/Preprocess/CMakeLists.txt @@ -9,37 +9,37 @@ project(Preprocess) # to work with each tool and documents those known to not work. if("${CMAKE_GENERATOR}" MATCHES "Xcode") set(PP_XCODE 1) -endif("${CMAKE_GENERATOR}" MATCHES "Xcode") +endif() if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") set(PP_VS6 1) -endif("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") +endif() if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles") set(PP_UMAKE 1) -endif("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles") +endif() if("${CMAKE_GENERATOR}" MATCHES "NMake Makefiles") set(PP_NMAKE 1) -endif("${CMAKE_GENERATOR}" MATCHES "NMake Makefiles") +endif() if("${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles") set(PP_MINGW 1) -endif("${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles") +endif() if("${CMAKE_GENERATOR}" MATCHES "Borland Makefiles") set(PP_BORLAND 1) -endif("${CMAKE_GENERATOR}" MATCHES "Borland Makefiles") +endif() if("${CMAKE_GENERATOR}" MATCHES "Watcom WMake") set(PP_WATCOM 1) -endif("${CMAKE_GENERATOR}" MATCHES "Watcom WMake") +endif() if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 7$") set(PP_VS70 1) -endif("${CMAKE_GENERATOR}" MATCHES "Visual Studio 7$") +endif() if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") set(PP_VS 1) -endif("${CMAKE_GENERATOR}" MATCHES "Visual Studio") +endif() if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 10") set(PP_VS100 1) -endif("${CMAKE_GENERATOR}" MATCHES "Visual Studio 10") +endif() if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 11") set(PP_VS110 1) -endif("${CMAKE_GENERATOR}" MATCHES "Visual Studio 11") +endif() # Some tests below check the PP_* variables set above. They are meant # to test the case that the build tool is at fault. Other tests below @@ -80,8 +80,8 @@ if(NOT PP_VS6) # trouble passing to other tools, and the compiler may be directly # invoked from the command line. set(STRING_EXTRA "${STRING_EXTRA} ") - endif(NOT PP_BORLAND AND NOT PP_WATCOM) -endif(NOT PP_VS6) + endif() +endif() if(NOT PP_VS) # VS: , @@ -89,21 +89,21 @@ if(NOT PP_VS) # The comma-separated list of PreprocessorDefinitions in the project # file seems to be parsed before the content of entries is examined. set(STRING_EXTRA "${STRING_EXTRA},") -endif(NOT PP_VS) +endif() if(NOT PP_MINGW) # MinGW: & # When inside -D"FOO=\"a & b\"" MinGW make wants -D"FOO=\"a "&" b\"" # but it does not like quoted ampersand elsewhere. set(STRING_EXTRA "${STRING_EXTRA}&") -endif(NOT PP_MINGW) +endif() if(NOT PP_MINGW) # MinGW: | # When inside -D"FOO=\"a | b\"" MinGW make wants -D"FOO=\"a "|" b\"" # but it does not like quoted pipe elsewhere. set(STRING_EXTRA "${STRING_EXTRA}|") -endif(NOT PP_MINGW) +endif() if(NOT PP_BORLAND AND NOT PP_MINGW AND NOT PP_NMAKE) # Borland, NMake, MinGW: ^ @@ -111,13 +111,13 @@ if(NOT PP_BORLAND AND NOT PP_MINGW AND NOT PP_NMAKE) # but do not like quoted carrot elsewhere. In NMake the non-quoted # syntax works when the flags are not in a make variable. set(STRING_EXTRA "${STRING_EXTRA}^") -endif(NOT PP_BORLAND AND NOT PP_MINGW AND NOT PP_NMAKE) +endif() if(NOT PP_BORLAND AND NOT PP_MINGW AND NOT PP_NMAKE) # Borland, MinGW: < > # Angle-brackets have funny behavior that is hard to escape. set(STRING_EXTRA "${STRING_EXTRA}<>") -endif(NOT PP_BORLAND AND NOT PP_MINGW AND NOT PP_NMAKE) +endif() set(EXPR_OP1 "/") if((NOT MSVC OR PP_NMAKE) AND @@ -150,7 +150,7 @@ endif() # - NMake is okay with just \\\" if(PP_NMAKE OR PP_UMAKE) set(STRING_EXTRA "${STRING_EXTRA}\\\"") -endif(PP_NMAKE OR PP_UMAKE) +endif() # General: # # MSVC will not accept a # in the value of a string definition on the @@ -187,7 +187,7 @@ set(EXPR "x*y+!(x==(y+1*2))*f(x${EXPR_OP1}2)") if(NOT WATCOM) # Watcom does not support - or / because it parses them as options. set(EXPR "${EXPR} + y/x-x") -endif(NOT WATCOM) +endif() #----------------------------------------------------------------------------- @@ -199,11 +199,11 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DPREPROCESS_DEBUG") # Inform the test if it built from Xcode or VS6 IDE. if(PP_XCODE) set(PREPROCESS_XCODE 1) -endif(PP_XCODE) +endif() if(PP_VS6) set(PREPROCESS_VS6 1) set(VS6 _vs6) -endif(PP_VS6) +endif() # Test old-style definitions. add_definitions(-DOLD_DEF -DOLD_EXPR=2) @@ -213,7 +213,7 @@ set(OLD_DEFS_EXPECTED "OLD_DEF;OLD_EXPR=2") get_property(OLD_DEFS DIRECTORY PROPERTY COMPILE_DEFINITIONS) if(NOT "${OLD_DEFS}" STREQUAL "${OLD_DEFS_EXPECTED}") message(SEND_ERROR "add_definitions not converted to directory property!") -endif(NOT "${OLD_DEFS}" STREQUAL "${OLD_DEFS_EXPECTED}") +endif() add_executable(Preprocess preprocess.c preprocess${VS6}.cxx) @@ -234,14 +234,14 @@ foreach(c "" "_DEBUG" "_RELEASE") SOURCE preprocess.c preprocess${VS6}.cxx PROPERTY COMPILE_DEFINITIONS${c} "FILE_DEF${c}" ) -endforeach(c) +endforeach() # Add definitions with values. if(NOT PREPROCESS_VS6) # The path might have spaces, which VS6 does not support. set(DEF_TARGET_PATH "TARGET_PATH=\"${TARGET_PATH}\"") set(DEF_FILE_PATH "FILE_PATH=\"${FILE_PATH}\"") -endif(NOT PREPROCESS_VS6) +endif() set_property( TARGET Preprocess APPEND PROPERTY COMPILE_DEFINITIONS @@ -263,7 +263,7 @@ add_custom_target(drive COMMAND Preprocess) # Configure the header file with the desired string value. if(SEMICOLON) set(STRING_VALUE "${STRING_VALUE};") -endif(SEMICOLON) +endif() configure_file(${Preprocess_SOURCE_DIR}/preprocess.h.in ${Preprocess_BINARY_DIR}/preprocess.h) include_directories(${Preprocess_BINARY_DIR}) diff --git a/Tests/Properties/CMakeLists.txt b/Tests/Properties/CMakeLists.txt index c1bc3b9e3..285d5965e 100644 --- a/Tests/Properties/CMakeLists.txt +++ b/Tests/Properties/CMakeLists.txt @@ -2,15 +2,15 @@ cmake_minimum_required (VERSION 2.6) project (Properties) -# these first three tests really test both properties and the management of -# cmSourceFile objects by CMake. +# these first three tests really test both properties and the management of +# cmSourceFile objects by CMake. # test properties on a build tree file that is relative (yuck) configure_file(properties.h.in "${Properties_BINARY_DIR}/properties.h") set_source_files_properties(properties.h PROPERTIES TEST1 1) get_source_file_property(RESULT1 properties.h TEST1) -# test properties on a headerfile in the source tree +# test properties on a headerfile in the source tree # accessed without an extenion (also yuck) set_source_files_properties(properties2 PROPERTIES TEST2 1) get_source_file_property(RESULT2 properties2 TEST2) @@ -27,7 +27,7 @@ get_property(GLOBALRESULT GLOBAL PROPERTY GLOBALTEST DEFINED) if (GLOBALRESULT) message(SEND_ERROR "Error: global prop defined when it should not be, " "result is GLOBALRESULT=${GLOBALRESULT}") -endif (GLOBALRESULT) +endif () define_property(GLOBAL PROPERTY GLOBALTEST BRIEF_DOCS "A test property" @@ -38,8 +38,8 @@ get_property(GLOBALRESULT GLOBAL PROPERTY GLOBALTEST DEFINED) if (NOT GLOBALRESULT) message(SEND_ERROR "Error: global prop not defined " "result is GLOBALRESULT=${GLOBALRESULT}") -endif (NOT GLOBALRESULT) - +endif () + set_property(GLOBAL PROPERTY GLOBALTEST 1) set_property(DIRECTORY PROPERTY DIRECTORYTEST 1) set_property(SOURCE SubDir/properties3.cxx PROPERTY SOURCETEST 1) @@ -50,26 +50,24 @@ get_property(SOURCERESULT PROPERTY SOURCETEST ) -if (RESULT1 AND RESULT2 AND RESULT3 AND GLOBALRESULT AND +if (RESULT1 AND RESULT2 AND RESULT3 AND GLOBALRESULT AND DIRECTORYRESULT AND SOURCERESULT) add_executable (Properties SubDir/properties3.cxx properties) -else (RESULT1 AND RESULT2 AND RESULT3 AND GLOBALRESULT AND - DIRECTORYRESULT AND SOURCERESULT) - message(SEND_ERROR +else () + message(SEND_ERROR "Error: test results are RESULT1=${RESULT1} RESULT2=${RESULT2} " "RESULT3=${RESULT3} GLOBALRESULT=${GLOBALRESULT} " "DIRECTORYRESULT=${DIRECTORYRESULT} " "SOURCERESULT=${SOURCERESULT}") -endif (RESULT1 AND RESULT2 AND RESULT3 AND GLOBALRESULT AND - DIRECTORYRESULT AND SOURCERESULT) +endif () # test the target property set_property(TARGET Properties PROPERTY TARGETTEST 1) get_property(TARGETRESULT TARGET Properties PROPERTY TARGETTEST) if (NOT TARGETRESULT) - message(SEND_ERROR + message(SEND_ERROR "Error: target result is TARGETRESULT=${TARGETRESULT}") -endif (NOT TARGETRESULT) +endif () # test APPEND and APPEND_STRING set_property() set_property(TARGET Properties PROPERTY FOO foo) @@ -92,9 +90,9 @@ endif () # test get_property SET get_property(TARGETRESULT TARGET Properties PROPERTY TARGETTEST SET) if (NOT TARGETRESULT) - message(SEND_ERROR + message(SEND_ERROR "Error: target prop not set, result is TARGETRESULT=${TARGETRESULT}") -endif (NOT TARGETRESULT) +endif () # test unsetting a property set_property(TARGET Properties PROPERTY TARGETTEST) @@ -102,7 +100,7 @@ get_property(TARGETRESULT TARGET Properties PROPERTY TARGETTEST SET) if (TARGETRESULT) message(SEND_ERROR "Error: target prop not unset, " "result is TARGETRESULT=${TARGETRESULT}") -endif (TARGETRESULT) +endif () @@ -114,7 +112,7 @@ if(NOT RESULT4) message(SEND_ERROR "Error: target result is" " RESULT4=${RESULT4}" " Properties_SOURCES=[${Properties_SOURCES}]") -endif(NOT RESULT4) +endif() # test CACHE properties macro(check_cache_props) @@ -123,8 +121,8 @@ macro(check_cache_props) if(NOT "x${result}" STREQUAL "x${expect_${prop}}") message(SEND_ERROR "CACHE property ${prop} is [${result}], not [${expect_${prop}}]") endif() - endforeach(prop) -endmacro(check_cache_props) + endforeach() +endmacro() set(expect_VALUE "ON") set(expect_TYPE "BOOL") set(expect_HELPSTRING "sample cache entry") diff --git a/Tests/Qt4Targets/CMakeLists.txt b/Tests/Qt4Targets/CMakeLists.txt new file mode 100644 index 000000000..d0c9c667a --- /dev/null +++ b/Tests/Qt4Targets/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 2.8) + +project(Qt4Targets) + +cmake_policy(SET CMP0020 NEW) + +find_package(Qt4 REQUIRED) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(Qt4Targets WIN32 main.cpp) +target_link_libraries(Qt4Targets Qt4::QtGui) + +if (WIN32) + if (TARGET Qt4::QAxServer) + add_executable(activeqtexe WIN32 activeqtexe.cpp) + set_property(TARGET activeqtexe PROPERTY QT4_NO_LINK_QTMAIN ON) + target_link_libraries(activeqtexe Qt4::QAxServer Qt4::QtGui) + endif() +endif() diff --git a/Tests/Qt4Targets/activeqtexe.cpp b/Tests/Qt4Targets/activeqtexe.cpp new file mode 100644 index 000000000..d4a912173 --- /dev/null +++ b/Tests/Qt4Targets/activeqtexe.cpp @@ -0,0 +1,36 @@ + +#include + +#ifndef QT_QAXSERVER_LIB +#error Expected QT_QAXSERVER_LIB +#endif + +#include + +class MyObject : public QObject +{ + Q_OBJECT +public: + MyObject(QObject *parent = 0) + : QObject(parent) + { + } +}; + +QAXFACTORY_DEFAULT(MyObject, + "{4dc3f340-a6f7-44e4-a79b-3e9217685fbd}", + "{9ee49617-7d5c-441a-b833-4b068d41d751}", + "{13eca64b-ee2a-4f3c-aa04-5d9d975779a7}", + "{ce947ee3-0403-4fdc-895a-4fe779344b46}", + "{8de435ce-8d2a-46ac-b3b3-cb800d0547c7}"); + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + QAxFactory::isServer(); + + return app.exec(); +} + +#include "activeqtexe.moc" diff --git a/Tests/Qt4Targets/main.cpp b/Tests/Qt4Targets/main.cpp new file mode 100644 index 000000000..3c98c99f6 --- /dev/null +++ b/Tests/Qt4Targets/main.cpp @@ -0,0 +1,24 @@ + +#include +#include + +#include + +#ifndef QT_CORE_LIB +#error Expected QT_CORE_LIB +#endif + +#ifndef QT_GUI_LIB +#error Expected QT_GUI_LIB +#endif + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + QWidget w; + w.setWindowTitle(QString::fromLatin1("SomeTitle")); + w.show(); + + return 0; +} diff --git a/Tests/QtAutomoc/Adir/CMakeLists.txt b/Tests/QtAutomoc/Adir/CMakeLists.txt new file mode 100644 index 000000000..abd328e76 --- /dev/null +++ b/Tests/QtAutomoc/Adir/CMakeLists.txt @@ -0,0 +1,8 @@ + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_BUILD_INTERFACE_INCLUDES ON) + +add_library(libA SHARED libA.cpp) +target_link_libraries(libA LINK_PUBLIC Qt4::QtCore) +generate_export_header(libA) diff --git a/Tests/QtAutomoc/Adir/libA.cpp b/Tests/QtAutomoc/Adir/libA.cpp new file mode 100644 index 000000000..3968c4415 --- /dev/null +++ b/Tests/QtAutomoc/Adir/libA.cpp @@ -0,0 +1,13 @@ + +#include "libA.h" + +LibA::LibA(QObject *parent) + : QObject(parent) +{ + +} + +int LibA::foo() +{ + return 0; +} diff --git a/Tests/QtAutomoc/Adir/libA.h b/Tests/QtAutomoc/Adir/libA.h new file mode 100644 index 000000000..03ad1e006 --- /dev/null +++ b/Tests/QtAutomoc/Adir/libA.h @@ -0,0 +1,18 @@ + +#ifndef LIBA_H +#define LIBA_H + +#include "liba_export.h" + +#include + +class LIBA_EXPORT LibA : public QObject +{ + Q_OBJECT +public: + explicit LibA(QObject *parent = 0); + + int foo(); +}; + +#endif diff --git a/Tests/QtAutomoc/Bdir/CMakeLists.txt b/Tests/QtAutomoc/Bdir/CMakeLists.txt new file mode 100644 index 000000000..549710571 --- /dev/null +++ b/Tests/QtAutomoc/Bdir/CMakeLists.txt @@ -0,0 +1,10 @@ + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_BUILD_INTERFACE_INCLUDES ON) + +add_library(libB SHARED libB.cpp) +generate_export_header(libB) + +# set_property(TARGET libB APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) +target_link_libraries(libB LINK_PUBLIC libA) diff --git a/Tests/QtAutomoc/Bdir/libB.cpp b/Tests/QtAutomoc/Bdir/libB.cpp new file mode 100644 index 000000000..72f2cfae9 --- /dev/null +++ b/Tests/QtAutomoc/Bdir/libB.cpp @@ -0,0 +1,13 @@ + +#include "libB.h" + +LibB::LibB(QObject *parent) + : QObject(parent) +{ + +} + +int LibB::foo() +{ + return a.foo(); +} diff --git a/Tests/QtAutomoc/Bdir/libB.h b/Tests/QtAutomoc/Bdir/libB.h new file mode 100644 index 000000000..510c17f8f --- /dev/null +++ b/Tests/QtAutomoc/Bdir/libB.h @@ -0,0 +1,21 @@ + +#ifndef LIBB_H +#define LIBB_H + +#include "libb_export.h" + +#include +#include "libA.h" + +class LIBB_EXPORT LibB : public QObject +{ + Q_OBJECT +public: + explicit LibB(QObject *parent = 0); + + int foo(); +private: + LibA a; +}; + +#endif diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutomoc/CMakeLists.txt index 5e3686dbc..ebfbb0363 100644 --- a/Tests/QtAutomoc/CMakeLists.txt +++ b/Tests/QtAutomoc/CMakeLists.txt @@ -13,11 +13,34 @@ add_definitions(-DFOO -DSomeDefine="Barx") # enable relaxed mode so automoc can handle all the special cases: set(CMAKE_AUTOMOC_RELAXED_MODE TRUE) -# create an executable and a library target, both requiring automoc: +# create an executable and two library targets, each requiring automoc: add_library(codeeditorLib STATIC codeeditor.cpp) -add_executable(foo main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp xyz.cpp yaf.cpp private_slot.cpp) - -set_target_properties(foo codeeditorLib PROPERTIES AUTOMOC TRUE) - -target_link_libraries(foo codeeditorLib ${QT_LIBRARIES} ) +add_library(privateSlot OBJECT private_slot.cpp) + +add_executable(foo main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp + xyz.cpp yaf.cpp $) + +set_target_properties(foo codeeditorLib privateSlot PROPERTIES AUTOMOC TRUE) + +include(GenerateExportHeader) +# The order is relevant here. B depends on A, and B headers depend on A +# headers both subdirectories use CMAKE_BUILD_INTERFACE_INCLUDES and we +# test that CMAKE_AUTOMOC successfully reads the include directories +# for the build interface from those targets. There has previously been +# a bug where caching of the include directories happened before +# extracting the includes to pass to moc. +add_subdirectory(Bdir) +add_subdirectory(Adir) +add_library(libC SHARED libC.cpp) +set_target_properties(libC PROPERTIES AUTOMOC TRUE) +generate_export_header(libC) +target_link_libraries(libC LINK_PUBLIC libB) + +target_link_libraries(foo codeeditorLib ${QT_LIBRARIES} libC) + +add_library(empty STATIC empty.cpp) +set_target_properties(empty PROPERTIES AUTOMOC TRUE) +target_link_libraries(empty no_link_language) +add_library(no_link_language STATIC empty.h) +set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE) diff --git a/Tests/QtAutomoc/empty.cpp b/Tests/QtAutomoc/empty.cpp new file mode 100644 index 000000000..ab32cf6c8 --- /dev/null +++ b/Tests/QtAutomoc/empty.cpp @@ -0,0 +1 @@ +// No content diff --git a/Tests/QtAutomoc/empty.h b/Tests/QtAutomoc/empty.h new file mode 100644 index 000000000..4566142c1 --- /dev/null +++ b/Tests/QtAutomoc/empty.h @@ -0,0 +1,9 @@ + +#include + +class Empty : public QObject +{ + Q_OBJECT +public: + explicit Empty(QObject *parent = 0) {} +}; diff --git a/Tests/QtAutomoc/libC.cpp b/Tests/QtAutomoc/libC.cpp new file mode 100644 index 000000000..8d61cb1bf --- /dev/null +++ b/Tests/QtAutomoc/libC.cpp @@ -0,0 +1,13 @@ + +#include "libC.h" + +LibC::LibC(QObject *parent) + : QObject(parent) +{ + +} + +int LibC::foo() +{ + return b.foo(); +} diff --git a/Tests/QtAutomoc/libC.h b/Tests/QtAutomoc/libC.h new file mode 100644 index 000000000..4fb4a2cf4 --- /dev/null +++ b/Tests/QtAutomoc/libC.h @@ -0,0 +1,22 @@ + +#ifndef LIBC_H +#define LIBC_H + +#include "libc_export.h" + +#include +#include "libB.h" + +class LIBC_EXPORT LibC : public QObject +{ + Q_OBJECT +public: + explicit LibC(QObject *parent = 0); + + + int foo(); +private: + LibB b; +}; + +#endif diff --git a/Tests/QtAutomoc/main.cpp b/Tests/QtAutomoc/main.cpp index 738f67720..d952171b5 100644 --- a/Tests/QtAutomoc/main.cpp +++ b/Tests/QtAutomoc/main.cpp @@ -48,6 +48,7 @@ #include "abc.h" #include "xyz.h" #include "yaf.h" +#include "libC.h" int main(int argv, char **args) { @@ -78,5 +79,8 @@ int main(int argv, char **args) Yaf yaf; yaf.doYaf(); + LibC lc; + lc.foo(); + return app.exec(); } diff --git a/Tests/QtAutomocNoQt/CMakeLists.txt b/Tests/QtAutomocNoQt/CMakeLists.txt new file mode 100644 index 000000000..b26e47117 --- /dev/null +++ b/Tests/QtAutomocNoQt/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8) + +project(QtAutomocNoQt) + +set(CMAKE_AUTOMOC ON) + +add_executable(hello main.c) diff --git a/Tests/QtAutomocNoQt/main.c b/Tests/QtAutomocNoQt/main.c new file mode 100644 index 000000000..8488f4e58 --- /dev/null +++ b/Tests/QtAutomocNoQt/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/ReturnTest/CMakeLists.txt b/Tests/ReturnTest/CMakeLists.txt index a08855ec1..3bd7ce099 100644 --- a/Tests/ReturnTest/CMakeLists.txt +++ b/Tests/ReturnTest/CMakeLists.txt @@ -4,24 +4,24 @@ project (ReturnTest) function (FAILED testname) message (SEND_ERROR "${testname} failed ${ARGN}") -endfunction (FAILED) +endfunction () function (PASS testname) message ("${testname} passed ${ARGN}") -endfunction (PASS) +endfunction () # test simple return function (simple) set(simpleResult 1 PARENT_SCOPE) return() set(simpleResult 0 PARENT_SCOPE) -endfunction (simple) +endfunction () simple() if ("${simpleResult}") pass ("simple") -else ("${simpleResult}") +else () failed ("simple got: ${simpleResult}") -endif ("${simpleResult}") +endif () #test return in an if statement set (simple2IF 1) @@ -29,15 +29,15 @@ function (simple2) set(simple2Result 1 PARENT_SCOPE) if (simple2IF) return() - endif (simple2IF) + endif () set(simple2Result 0 PARENT_SCOPE) -endfunction (simple2) +endfunction () simple2() if ("${simple2Result}") pass ("simple2") -else ("${simple2Result}") +else () failed ("simple2 got: ${simple2Result}") -endif ("${simple2Result}") +endif () #test return in a foreach loop function (looptest) @@ -45,15 +45,15 @@ function (looptest) set (looptestResult "${iter}" PARENT_SCOPE) if ("${iter}" EQUAL 3) return () - endif ("${iter}" EQUAL 3) - endforeach (iter) -endfunction (looptest) + endif () + endforeach () +endfunction () looptest() if ("${looptestResult}" EQUAL 3) pass ("looptest") -else ("${looptestResult}" EQUAL 3) +else () failed ("looptest got: ${looptestResult}") -endif ("${looptestResult}" EQUAL 3) +endif () #test return in a while loop function (whiletest) @@ -62,58 +62,58 @@ function (whiletest) set (whiletestResult "${iter}" PARENT_SCOPE) if ("${iter}" STREQUAL "aaa") return () - endif ("${iter}" STREQUAL "aaa") + endif () set (iter "${iter}a") - endwhile(NOT "${iter}" STREQUAL "aaaaa") -endfunction (whiletest) + endwhile() +endfunction () whiletest() if ("${whiletestResult}" STREQUAL "aaa") pass ("whiletest") -else ("${whiletestResult}" STREQUAL "aaa") +else () failed ("whiletest got: ${whiletestResult}") -endif ("${whiletestResult}" STREQUAL "aaa") +endif () # check subdir return add_subdirectory(subdir) get_directory_property(subdirResult DIRECTORY subdir DEFINITION subdirreturn) if ("${subdirResult}" EQUAL 1) pass ("subdir") -else ("${subdirResult}" EQUAL 1) +else () failed ("subdir got: ${subdirResult}") -endif ("${subdirResult}" EQUAL 1) +endif () # check return from a file include(include_return.cmake) if ("${include_returnResult}" EQUAL 1) pass ("include_return") -else ("${include_returnResult}" EQUAL 1) +else () failed ("include_return got: ${include_returnResult}") -endif ("${include_returnResult}" EQUAL 1) +endif () # check return from within a macro macro (mymacro) set (foo 1) if (foo) return() - endif (foo) -endmacro(mymacro) + endif () +endmacro() # test simple return function (simple3) set (bar 0) set(simple3Result 1 PARENT_SCOPE) if (bar) - else (bar) + else () mymacro() - endif(bar) + endif() set(simple3Result 0 PARENT_SCOPE) -endfunction (simple3) +endfunction () simple3() if ("${simple3Result}") pass ("macrotest") -else ("${simple3Result}") +else () failed ("macrotest got: ${simple3Result}") -endif ("${simple3Result}") +endif () # test break command now in a foreach @@ -121,27 +121,27 @@ foreach (iter RANGE 1 5) set (break1 "${iter}") if ("${iter}" EQUAL 3) break () - endif ("${iter}" EQUAL 3) -endforeach (iter) + endif () +endforeach () if ("${break1}" EQUAL 3) pass ("break in foreach") -else ("${break1}" EQUAL 3) +else () failed ("break in foreach got: ${break1}") -endif ("${break1}" EQUAL 3) +endif () # test break in a while loop set (iter "a") while(NOT "${iter}" STREQUAL "aaaaa") if ("${iter}" STREQUAL "aaa") break () - endif ("${iter}" STREQUAL "aaa") + endif () set (iter "${iter}a") -endwhile(NOT "${iter}" STREQUAL "aaaaa") +endwhile() if ("${iter}" STREQUAL "aaa") pass ("break in a while") -else ("${iter}" STREQUAL "aaa") +else () failed ("break in a whi;e got: ${whiletestResult}") -endif ("${iter}" STREQUAL "aaa") +endif () add_executable (ReturnTest returnTest.c) diff --git a/Tests/RunCMake/CMP0004/CMP0004-NEW-result.txt b/Tests/RunCMake/CMP0004/CMP0004-NEW-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CMP0004/CMP0004-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0004/CMP0004-NEW-stderr.txt b/Tests/RunCMake/CMP0004/CMP0004-NEW-stderr.txt new file mode 100644 index 000000000..a21cb6ae3 --- /dev/null +++ b/Tests/RunCMake/CMP0004/CMP0004-NEW-stderr.txt @@ -0,0 +1,2 @@ + Target "foo" links to item " bar " which has leading or trailing + whitespace. This is now an error according to policy CMP0004. diff --git a/Tests/RunCMake/CMP0004/CMP0004-NEW.cmake b/Tests/RunCMake/CMP0004/CMP0004-NEW.cmake new file mode 100644 index 000000000..7c61961f5 --- /dev/null +++ b/Tests/RunCMake/CMP0004/CMP0004-NEW.cmake @@ -0,0 +1,9 @@ + +cmake_minimum_required(VERSION 2.8) + +cmake_policy(SET CMP0004 NEW) + +add_library(foo SHARED empty.cpp) +add_library(bar SHARED empty.cpp) + +target_link_libraries(foo "$<1: bar >") diff --git a/Tests/RunCMake/CMP0004/CMP0004-OLD-result.txt b/Tests/RunCMake/CMP0004/CMP0004-OLD-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CMP0004/CMP0004-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0004/CMP0004-OLD-stderr.txt b/Tests/RunCMake/CMP0004/CMP0004-OLD-stderr.txt new file mode 100644 index 000000000..782e45c57 --- /dev/null +++ b/Tests/RunCMake/CMP0004/CMP0004-OLD-stderr.txt @@ -0,0 +1,2 @@ + Target "bat" links to item " bar " which has leading or trailing + whitespace. This is now an error according to policy CMP0004. diff --git a/Tests/RunCMake/CMP0004/CMP0004-OLD.cmake b/Tests/RunCMake/CMP0004/CMP0004-OLD.cmake new file mode 100644 index 000000000..d6ed72c79 --- /dev/null +++ b/Tests/RunCMake/CMP0004/CMP0004-OLD.cmake @@ -0,0 +1,21 @@ + +cmake_minimum_required(VERSION 2.8) + +cmake_policy(SET CMP0004 OLD) + +add_library(foo SHARED empty.cpp) +add_library(bar SHARED empty.cpp) +add_library(bing SHARED empty.cpp) +add_library(bung SHARED empty.cpp) + +cmake_policy(SET CMP0004 NEW) + +add_library(bat SHARED empty.cpp) + +target_link_libraries(foo "$<1: bar >") +target_link_libraries(bing "$<$>: bar >") +target_link_libraries(bung "$<$: bar >") + +# The line below causes the error because the policy is NEW when bat +# is created. +target_link_libraries(bat "$<1: bar >") diff --git a/Tests/RunCMake/CMP0004/CMP0004-WARN-stderr.txt b/Tests/RunCMake/CMP0004/CMP0004-WARN-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CMP0004/CMP0004-policy-genex-result.txt b/Tests/RunCMake/CMP0004/CMP0004-policy-genex-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CMP0004/CMP0004-policy-genex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0004/CMP0004-policy-genex-stderr.txt b/Tests/RunCMake/CMP0004/CMP0004-policy-genex-stderr.txt new file mode 100644 index 000000000..eed53e7f4 --- /dev/null +++ b/Tests/RunCMake/CMP0004/CMP0004-policy-genex-stderr.txt @@ -0,0 +1,2 @@ + Target "foo" links to item " bat " which has leading or trailing + whitespace. This is now an error according to policy CMP0004. diff --git a/Tests/RunCMake/CMP0004/CMP0004-policy-genex.cmake b/Tests/RunCMake/CMP0004/CMP0004-policy-genex.cmake new file mode 100644 index 000000000..eab680a92 --- /dev/null +++ b/Tests/RunCMake/CMP0004/CMP0004-policy-genex.cmake @@ -0,0 +1,14 @@ + +cmake_minimum_required(VERSION 2.8) + +cmake_policy(SET CMP0004 NEW) + +add_library(foo SHARED empty.cpp) +add_library(bar SHARED empty.cpp) +add_library(bat SHARED empty.cpp) + +# The negation here avoids the error. +target_link_libraries(foo "$<$>: bar >") + +# The below line causes the error. +target_link_libraries(foo "$<$: bat >") diff --git a/Tests/RunCMake/CMP0004/CMakeLists.txt b/Tests/RunCMake/CMP0004/CMakeLists.txt new file mode 100644 index 000000000..e8db6b05b --- /dev/null +++ b/Tests/RunCMake/CMP0004/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0004/RunCMakeTest.cmake b/Tests/RunCMake/CMP0004/RunCMakeTest.cmake new file mode 100644 index 000000000..950d0edbd --- /dev/null +++ b/Tests/RunCMake/CMP0004/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0004-OLD) +run_cmake(CMP0004-NEW) +run_cmake(CMP0004-policy-genex) diff --git a/Tests/RunCMake/CMP0004/empty.cpp b/Tests/RunCMake/CMP0004/empty.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CMP0019/CMP0019-NEW.cmake b/Tests/RunCMake/CMP0019/CMP0019-NEW.cmake new file mode 100644 index 000000000..3091e66ac --- /dev/null +++ b/Tests/RunCMake/CMP0019/CMP0019-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0019 NEW) +include(CMP0019-code.cmake) diff --git a/Tests/RunCMake/CMP0019/CMP0019-OLD.cmake b/Tests/RunCMake/CMP0019/CMP0019-OLD.cmake new file mode 100644 index 000000000..0f02f9ce5 --- /dev/null +++ b/Tests/RunCMake/CMP0019/CMP0019-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0019 OLD) +include(CMP0019-code.cmake) diff --git a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt new file mode 100644 index 000000000..03faef90e --- /dev/null +++ b/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt @@ -0,0 +1,40 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0019 is not set: Do not re-expand variables in include and link + information. Run "cmake --help-policy CMP0019" for policy details. Use + the cmake_policy command to set the policy and suppress this warning. + + The following variable evaluations were encountered: + + Evaluated directory INCLUDE_DIRECTORIES + + /usr/include/\${VAR_INCLUDE};/usr/include/normal + + as + + /usr/include/VAL_INCLUDE;/usr/include/normal + + Evaluated target some_target INCLUDE_DIRECTORIES + + /usr/include/\${VAR_INCLUDE};/usr/include/normal + + as + + /usr/include/VAL_INCLUDE;/usr/include/normal + + Evaluated link directory + + /usr/lib/\${VAR_LINK_DIRS} + + as + + /usr/lib/VAL_LINK_DIRS + + Evaluated link library + + \${VAR_LINK_LIBS} + + as + + VAL_LINK_LIBS + +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CMP0019/CMP0019-WARN.cmake b/Tests/RunCMake/CMP0019/CMP0019-WARN.cmake new file mode 100644 index 000000000..a419f309e --- /dev/null +++ b/Tests/RunCMake/CMP0019/CMP0019-WARN.cmake @@ -0,0 +1 @@ +include(CMP0019-code.cmake) diff --git a/Tests/RunCMake/CMP0019/CMP0019-code.cmake b/Tests/RunCMake/CMP0019/CMP0019-code.cmake new file mode 100644 index 000000000..26c0e5b27 --- /dev/null +++ b/Tests/RunCMake/CMP0019/CMP0019-code.cmake @@ -0,0 +1,9 @@ +set(VAR_INCLUDE "VAL_INCLUDE") +set(VAR_LINK_DIRS "VAL_LINK_DIRS") +set(VAR_LINK_LIBS "VAL_LINK_LIBS") +add_custom_target(some_target) +include_directories("/usr/include/\${VAR_INCLUDE}" /usr/include/normal) +link_directories("/usr/lib/\${VAR_LINK_DIRS}" /usr/lib/normal) +link_libraries("\${VAR_LINK_LIBS}" normal) +add_custom_target(other_target) +set_property(TARGET other_target PROPERTY INCLUDE_DIRECTORIES "") diff --git a/Tests/RunCMake/CMP0019/CMakeLists.txt b/Tests/RunCMake/CMP0019/CMakeLists.txt new file mode 100644 index 000000000..e8db6b05b --- /dev/null +++ b/Tests/RunCMake/CMP0019/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0019/RunCMakeTest.cmake b/Tests/RunCMake/CMP0019/RunCMakeTest.cmake new file mode 100644 index 000000000..119fc2b30 --- /dev/null +++ b/Tests/RunCMake/CMP0019/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0019-WARN) +run_cmake(CMP0019-OLD) +run_cmake(CMP0019-NEW) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eca96f907..4b4bd31bc 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -39,20 +39,43 @@ macro(add_RunCMake_test test) add_test(RunCMake.${test} ${CMAKE_CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} -DRunCMake_GENERATOR=${CMAKE_TEST_GENERATOR} + -DRunCMake_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET} -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} + ${${test}_ARGS} -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" ) endmacro() +if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3) + set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1) +endif() + +add_RunCMake_test(CMP0019) +add_RunCMake_test(CTest) +if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles") + add_RunCMake_test(CompilerChange) +endif() +add_RunCMake_test(ExternalData) +add_RunCMake_test(FPHSA) +add_RunCMake_test(GeneratorExpression) +add_RunCMake_test(GeneratorToolset) +add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(ObjectLibrary) +if(NOT WIN32) + add_RunCMake_test(PositionIndependentCode) +endif() +add_RunCMake_test(CompatibleInterface) add_RunCMake_test(build_command) add_RunCMake_test(find_package) add_RunCMake_test(include) +add_RunCMake_test(include_directories) add_RunCMake_test(list) +add_RunCMake_test(CMP0004) if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]") add_RunCMake_test(include_external_msproject) + add_RunCMake_test(SolutionGlobalSections) endif() diff --git a/Tests/RunCMake/CTest/BeforeProject-result.txt b/Tests/RunCMake/CTest/BeforeProject-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CTest/BeforeProject-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTest/BeforeProject-stderr.txt b/Tests/RunCMake/CTest/BeforeProject-stderr.txt new file mode 100644 index 000000000..354896bc6 --- /dev/null +++ b/Tests/RunCMake/CTest/BeforeProject-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/CTest.cmake:[0-9]+ \(build_command\): + build_command\(\) requires CMAKE_MAKE_PROGRAM to be defined. Call project\(\) + or enable_language\(\) first. +Call Stack \(most recent call first\): + BeforeProject.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CTest/BeforeProject.cmake b/Tests/RunCMake/CTest/BeforeProject.cmake new file mode 100644 index 000000000..903ca6933 --- /dev/null +++ b/Tests/RunCMake/CTest/BeforeProject.cmake @@ -0,0 +1,2 @@ +include(CTest) +project(${RunCMake_TEST} NONE) diff --git a/Tests/RunCMake/CTest/CMakeLists.txt b/Tests/RunCMake/CTest/CMakeLists.txt new file mode 100644 index 000000000..f6e84c04d --- /dev/null +++ b/Tests/RunCMake/CTest/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 2.8) +if(NOT NoProject) + project(${RunCMake_TEST} NONE) +endif() +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CTest/RunCMakeTest.cmake b/Tests/RunCMake/CTest/RunCMakeTest.cmake new file mode 100644 index 000000000..a6f684224 --- /dev/null +++ b/Tests/RunCMake/CTest/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +set(RunCMake_TEST_OPTIONS -DNoProject=1) +run_cmake(BeforeProject) +unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/CompatibleInterface/CMakeLists.txt b/Tests/RunCMake/CompatibleInterface/CMakeLists.txt new file mode 100644 index 000000000..68dd8d6a1 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceBool-builtin-prop-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceBool-builtin-prop-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceBool-builtin-prop-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceBool-builtin-prop-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceBool-builtin-prop-stderr.txt new file mode 100644 index 000000000..1a925b602 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceBool-builtin-prop-stderr.txt @@ -0,0 +1,5 @@ +CMake Error in CMakeLists.txt: + Target "foo" has property "INCLUDE_DIRECTORIES" listed in its + COMPATIBLE_INTERFACE_BOOL property. This is not allowed. Only + user-defined properties may appear listed in the COMPATIBLE_INTERFACE_BOOL + property. diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceBool-builtin-prop.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceBool-builtin-prop.cmake new file mode 100644 index 000000000..5feb4d5cc --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceBool-builtin-prop.cmake @@ -0,0 +1,11 @@ + +add_library(foo UNKNOWN IMPORTED) +add_library(bar UNKNOWN IMPORTED) + +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL INCLUDE_DIRECTORIES) +set_property(TARGET foo PROPERTY INTERFACE_INCLUDE_DIRECTORIES ON) +set_property(TARGET bar PROPERTY INTERFACE_INCLUDE_DIRECTORIES ON) + +add_executable(user main.cpp) +set_property(TARGET user PROPERTY INCLUDE_DIRECTORIES OFF) +target_link_libraries(user foo bar) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depend-self-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depend-self-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depend-self-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depend-self-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depend-self-stderr.txt new file mode 100644 index 000000000..0476da97d --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depend-self-stderr.txt @@ -0,0 +1,3 @@ +CMake Error: Property SOMEPROP on target "user" does +not match the INTERFACE_SOMEPROP property requirement +of dependency "foo". diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depend-self.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depend-self.cmake new file mode 100644 index 000000000..90543e8d3 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depend-self.cmake @@ -0,0 +1,11 @@ + +add_library(foo UNKNOWN IMPORTED) +add_library(bar UNKNOWN IMPORTED) + +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPROP) +set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP ON) +set_property(TARGET bar PROPERTY INTERFACE_SOMEPROP ON) + +add_executable(user main.cpp) +set_property(TARGET user PROPERTY SOMEPROP OFF) +target_link_libraries(user foo bar) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depends-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depends-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depends-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depends-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depends-stderr.txt new file mode 100644 index 000000000..d885c09d9 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depends-stderr.txt @@ -0,0 +1,3 @@ +CMake Error: The INTERFACE_SOMEPROP property of "bar" does +not agree with the value of SOMEPROP already determined +for "user". diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depends.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depends.cmake new file mode 100644 index 000000000..69be79632 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatch-depends.cmake @@ -0,0 +1,10 @@ + +add_library(foo UNKNOWN IMPORTED) +add_library(bar UNKNOWN IMPORTED) + +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPROP) +set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP ON) +set_property(TARGET bar PROPERTY INTERFACE_SOMEPROP OFF) + +add_executable(user main.cpp) +target_link_libraries(user foo bar) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatched-use-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatched-use-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatched-use-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatched-use-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatched-use-stderr.txt new file mode 100644 index 000000000..8556ee0b6 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatched-use-stderr.txt @@ -0,0 +1,4 @@ +CMake Error: Property SOMEPROP on target "user" is +implied to be FALSE because it was used to determine the link libraries +already. The INTERFACE_SOMEPROP property on +dependency "foo" is in conflict. diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatched-use.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatched-use.cmake new file mode 100644 index 000000000..ccfad0ac7 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceBool-mismatched-use.cmake @@ -0,0 +1,9 @@ + +add_library(foo UNKNOWN IMPORTED) +add_library(bar UNKNOWN IMPORTED) + +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPROP) +set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP ON) + +add_executable(user main.cpp) +target_link_libraries(user foo $<$,prop>:bar>) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt new file mode 100644 index 000000000..5a8f99df2 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt @@ -0,0 +1,5 @@ +CMake Error in CMakeLists.txt: + Property "SOMETHING" appears in both the COMPATIBLE_INTERFACE_BOOL and the + COMPATIBLE_INTERFACE_STRING property in the dependencies of target "user". + This is not allowed. A property may only require compatibility in a + boolean interpretation or a string interpretation, but not both. diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake new file mode 100644 index 000000000..711368a80 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake @@ -0,0 +1,9 @@ + +add_library(foo UNKNOWN IMPORTED) +add_library(bar UNKNOWN IMPORTED) + +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMETHING) +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING SOMETHING) + +add_executable(user main.cpp) +target_link_libraries(user foo bar) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop-stderr.txt new file mode 100644 index 000000000..6a293b4f1 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop-stderr.txt @@ -0,0 +1,5 @@ +CMake Error in CMakeLists.txt: + Target "foo" has property "INCLUDE_DIRECTORIES" listed in its + COMPATIBLE_INTERFACE_STRING property. This is not allowed. Only + user-defined properties may appear listed in the + COMPATIBLE_INTERFACE_STRING property. diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake new file mode 100644 index 000000000..5221a129c --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake @@ -0,0 +1,11 @@ + +add_library(foo UNKNOWN IMPORTED) +add_library(bar UNKNOWN IMPORTED) + +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING INCLUDE_DIRECTORIES) +set_property(TARGET foo PROPERTY INTERFACE_INCLUDE_DIRECTORIES foo_inc) +set_property(TARGET bar PROPERTY INTERFACE_INCLUDE_DIRECTORIES bar_inc) + +add_executable(user main.cpp) +set_property(TARGET user PROPERTY INCLUDE_DIRECTORIES bar_inc) +target_link_libraries(user foo bar) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self-stderr.txt new file mode 100644 index 000000000..0476da97d --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self-stderr.txt @@ -0,0 +1,3 @@ +CMake Error: Property SOMEPROP on target "user" does +not match the INTERFACE_SOMEPROP property requirement +of dependency "foo". diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self.cmake new file mode 100644 index 000000000..187f29f79 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self.cmake @@ -0,0 +1,11 @@ + +add_library(foo UNKNOWN IMPORTED) +add_library(bar UNKNOWN IMPORTED) + +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING SOMEPROP) +set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP prop) +set_property(TARGET bar PROPERTY INTERFACE_SOMEPROP prop) + +add_executable(user main.cpp) +set_property(TARGET user PROPERTY SOMEPROP different) +target_link_libraries(user foo bar) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends-stderr.txt new file mode 100644 index 000000000..d885c09d9 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends-stderr.txt @@ -0,0 +1,3 @@ +CMake Error: The INTERFACE_SOMEPROP property of "bar" does +not agree with the value of SOMEPROP already determined +for "user". diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends.cmake new file mode 100644 index 000000000..73cc3fc55 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends.cmake @@ -0,0 +1,10 @@ + +add_library(foo UNKNOWN IMPORTED) +add_library(bar UNKNOWN IMPORTED) + +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING SOMEPROP) +set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP foo) +set_property(TARGET bar PROPERTY INTERFACE_SOMEPROP bar) + +add_executable(user main.cpp) +target_link_libraries(user foo bar) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use-stderr.txt new file mode 100644 index 000000000..723daec09 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use-stderr.txt @@ -0,0 +1,4 @@ +CMake Error: Property SOMEPROP on target "user" is +implied to be empty because it was used to determine the link libraries +already. The INTERFACE_SOMEPROP property on +dependency "foo" is in conflict. diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use.cmake new file mode 100644 index 000000000..af3ce8fbc --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use.cmake @@ -0,0 +1,9 @@ + +add_library(foo UNKNOWN IMPORTED) +add_library(bar UNKNOWN IMPORTED) + +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING SOMEPROP) +set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP prop) + +add_executable(user main.cpp) +target_link_libraries(user foo $<$,prop>:bar>) diff --git a/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake b/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake new file mode 100644 index 000000000..976815111 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake @@ -0,0 +1,11 @@ +include(RunCMake) + +run_cmake(InterfaceBool-mismatch-depends) +run_cmake(InterfaceBool-mismatch-depend-self) +run_cmake(InterfaceBool-mismatched-use) +run_cmake(InterfaceBool-builtin-prop) +run_cmake(InterfaceString-mismatch-depends) +run_cmake(InterfaceString-mismatch-depend-self) +run_cmake(InterfaceString-mismatched-use) +run_cmake(InterfaceString-builtin-prop) +run_cmake(InterfaceString-Bool-Conflict) diff --git a/Tests/RunCMake/CompatibleInterface/main.cpp b/Tests/RunCMake/CompatibleInterface/main.cpp new file mode 100644 index 000000000..65eddcf84 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/main.cpp @@ -0,0 +1,5 @@ + +int main(int argc, char **argv) +{ + return 0; +} diff --git a/Tests/RunCMake/CompilerChange/CMakeLists.txt b/Tests/RunCMake/CompilerChange/CMakeLists.txt new file mode 100644 index 000000000..3b925188d --- /dev/null +++ b/Tests/RunCMake/CompilerChange/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 2.8) +if(NOT RunCMake_TEST) + set(RunCMake_TEST "$ENV{RunCMake_TEST}") # needed when cache is deleted +endif() +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CompilerChange/EmptyCompiler-result.txt b/Tests/RunCMake/CompilerChange/EmptyCompiler-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/EmptyCompiler-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt b/Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt new file mode 100644 index 000000000..4745b254d --- /dev/null +++ b/Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt @@ -0,0 +1,5 @@ +You have changed variables that require your cache to be deleted. +Configure will be re-run and you may have to reset some variables. +The following variables have changed: +CMAKE_C_COMPILER= *( +|$) diff --git a/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake b/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake new file mode 100644 index 000000000..c87ec4952 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake @@ -0,0 +1,3 @@ +enable_language(C) +message(STATUS "CMAKE_C_COMPILER is \"${CMAKE_C_COMPILER}\"") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cc.cmake" "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n") diff --git a/Tests/RunCMake/CompilerChange/FindCompiler.cmake b/Tests/RunCMake/CompilerChange/FindCompiler.cmake new file mode 100644 index 000000000..297ab2fa5 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/FindCompiler.cmake @@ -0,0 +1,2 @@ +enable_language(C) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cc.cmake" "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n") diff --git a/Tests/RunCMake/CompilerChange/FirstCompiler-stdout.txt b/Tests/RunCMake/CompilerChange/FirstCompiler-stdout.txt new file mode 100644 index 000000000..17621b7e5 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/FirstCompiler-stdout.txt @@ -0,0 +1 @@ +-- CMAKE_C_COMPILER is ".*/Tests/RunCMake/CompilerChange/cc1.sh" diff --git a/Tests/RunCMake/CompilerChange/FirstCompiler.cmake b/Tests/RunCMake/CompilerChange/FirstCompiler.cmake new file mode 100644 index 000000000..c87ec4952 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/FirstCompiler.cmake @@ -0,0 +1,3 @@ +enable_language(C) +message(STATUS "CMAKE_C_COMPILER is \"${CMAKE_C_COMPILER}\"") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cc.cmake" "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n") diff --git a/Tests/RunCMake/CompilerChange/RunCMakeTest.cmake b/Tests/RunCMake/CompilerChange/RunCMakeTest.cmake new file mode 100644 index 000000000..d38371680 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/RunCMakeTest.cmake @@ -0,0 +1,58 @@ +include(RunCMake) + +# Detect the compiler in use in the current environment. +run_cmake(FindCompiler) +include(${RunCMake_BINARY_DIR}/FindCompiler-build/cc.cmake) +if(NOT CMAKE_C_COMPILER) + message(FATAL_ERROR "FindCompiler provided no compiler!") +endif() +if(NOT IS_ABSOLUTE "${CMAKE_C_COMPILER}") + message(FATAL_ERROR "FindCompiler provided non-absolute path \"${CMAKE_C_COMPILER}\"!") +endif() +if(NOT EXISTS "${CMAKE_C_COMPILER}") + message(FATAL_ERROR "FindCompiler provided non-existing path \"${CMAKE_C_COMPILER}\"!") +endif() + +# Now that we have the full compiler path, hide CC. +unset(ENV{CC}) + +# Wrap around the real compiler so we can change the compiler +# path without changing the underlying compiler. +set(ccIn ${RunCMake_SOURCE_DIR}/cc.sh.in) +set(cc1 ${RunCMake_BINARY_DIR}/cc1.sh) +set(cc2 ${RunCMake_BINARY_DIR}/cc2.sh) +set(cc3 CMAKE_C_COMPILER-NOTFOUND) +configure_file(${ccIn} ${cc1} @ONLY IMMEDIATE) +configure_file(${ccIn} ${cc2} @ONLY IMMEDIATE) + +# Use a single build tree for remaining tests without cleaning. +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ChangeCompiler-build) +set(RunCMake_TEST_NO_CLEAN 1) +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + +# Check build with compiler wrapper 1. +set(RunCMake_TEST_OPTIONS -DCMAKE_C_COMPILER=${cc1}) +set(ENV{RunCMake_TEST} "FirstCompiler") +run_cmake(FirstCompiler) +include(${RunCMake_TEST_BINARY_DIR}/cc.cmake) +if(NOT "${CMAKE_C_COMPILER}" STREQUAL "${cc1}") + message(FATAL_ERROR "FirstCompiler built with compiler:\n ${CMAKE_C_COMPILER}\nand not with:\n ${cc1}") +endif() + +# Check rebuild with compiler wrapper 2. +set(RunCMake_TEST_OPTIONS -DCMAKE_C_COMPILER=${cc2}) +set(ENV{RunCMake_TEST} "SecondCompiler") +run_cmake(SecondCompiler) +include(${RunCMake_TEST_BINARY_DIR}/cc.cmake) +if(NOT "${CMAKE_C_COMPILER}" STREQUAL "${cc2}") + message(FATAL_ERROR "SecondCompiler built with compiler:\n ${CMAKE_C_COMPILER}\nand not with:\n ${cc2}") +endif() + +# Check failure with an empty compiler string. +set(RunCMake_TEST_OPTIONS -DCMAKE_C_COMPILER=) +set(ENV{RunCMake_TEST} "EmptyCompiler") +run_cmake(EmptyCompiler) +include(${RunCMake_TEST_BINARY_DIR}/cc.cmake) +if(NOT "${CMAKE_C_COMPILER}" STREQUAL "${cc3}") + message(FATAL_ERROR "Empty built with compiler:\n ${CMAKE_C_COMPILER}\nand not with:\n ${cc3}") +endif() diff --git a/Tests/RunCMake/CompilerChange/SecondCompiler-stderr.txt b/Tests/RunCMake/CompilerChange/SecondCompiler-stderr.txt new file mode 100644 index 000000000..3a01c53f1 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/SecondCompiler-stderr.txt @@ -0,0 +1,4 @@ +You have changed variables that require your cache to be deleted. +Configure will be re-run and you may have to reset some variables. +The following variables have changed: +CMAKE_C_COMPILER=.*/Tests/RunCMake/CompilerChange/cc2.sh diff --git a/Tests/RunCMake/CompilerChange/SecondCompiler-stdout.txt b/Tests/RunCMake/CompilerChange/SecondCompiler-stdout.txt new file mode 100644 index 000000000..26ca96438 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/SecondCompiler-stdout.txt @@ -0,0 +1 @@ +-- CMAKE_C_COMPILER is ".*/Tests/RunCMake/CompilerChange/cc2.sh" diff --git a/Tests/RunCMake/CompilerChange/SecondCompiler.cmake b/Tests/RunCMake/CompilerChange/SecondCompiler.cmake new file mode 100644 index 000000000..c87ec4952 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/SecondCompiler.cmake @@ -0,0 +1,3 @@ +enable_language(C) +message(STATUS "CMAKE_C_COMPILER is \"${CMAKE_C_COMPILER}\"") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cc.cmake" "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n") diff --git a/Tests/RunCMake/CompilerChange/cc.sh.in b/Tests/RunCMake/CompilerChange/cc.sh.in new file mode 100755 index 000000000..1d400e6ba --- /dev/null +++ b/Tests/RunCMake/CompilerChange/cc.sh.in @@ -0,0 +1,2 @@ +#!/bin/sh +exec "@CMAKE_C_COMPILER@" "$@" diff --git a/Tests/RunCMake/ExternalData/BadHashAlgo1-result.txt b/Tests/RunCMake/ExternalData/BadHashAlgo1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadHashAlgo1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadHashAlgo1-stderr.txt b/Tests/RunCMake/ExternalData/BadHashAlgo1-stderr.txt new file mode 100644 index 000000000..f68f0be6b --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadHashAlgo1-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Unknown hash algorithm specified by ExternalData_LINK_CONTENT: + + BAD +Call Stack \(most recent call first\): + .* + BadHashAlgo1.cmake:3 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadHashAlgo1.cmake b/Tests/RunCMake/ExternalData/BadHashAlgo1.cmake new file mode 100644 index 000000000..19e2e412d --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadHashAlgo1.cmake @@ -0,0 +1,3 @@ +include(ExternalData) +set(ExternalData_LINK_CONTENT BAD) +ExternalData_Expand_Arguments(Data args DATA{BadHashAlgo1.txt}) diff --git a/Tests/RunCMake/ExternalData/BadHashAlgo1.txt b/Tests/RunCMake/ExternalData/BadHashAlgo1.txt new file mode 100644 index 000000000..bfa2818c2 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadHashAlgo1.txt @@ -0,0 +1 @@ +Sample input file that should not be transformed. diff --git a/Tests/RunCMake/ExternalData/BadOption1-result.txt b/Tests/RunCMake/ExternalData/BadOption1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadOption1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadOption1-stderr.txt b/Tests/RunCMake/ExternalData/BadOption1-stderr.txt new file mode 100644 index 000000000..b63d098c0 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadOption1-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Unknown option "Bad/Option" in argument + + DATA{Data.txt,Bad/Option} + +Call Stack \(most recent call first\): + .* + BadOption1.cmake:2 \(ExternalData_Add_Test\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadOption1.cmake b/Tests/RunCMake/ExternalData/BadOption1.cmake new file mode 100644 index 000000000..1303d7f1a --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadOption1.cmake @@ -0,0 +1,5 @@ +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{Data.txt,Bad/Option} + ) diff --git a/Tests/RunCMake/ExternalData/BadOption2-result.txt b/Tests/RunCMake/ExternalData/BadOption2-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadOption2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadOption2-stderr.txt b/Tests/RunCMake/ExternalData/BadOption2-stderr.txt new file mode 100644 index 000000000..d114c8aa9 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadOption2-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Unknown option "Bad:Option" in argument + + DATA{Data.txt,Bad:Option} + +Call Stack \(most recent call first\): + .* + BadOption2.cmake:2 \(ExternalData_Add_Test\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadOption2.cmake b/Tests/RunCMake/ExternalData/BadOption2.cmake new file mode 100644 index 000000000..6269b064c --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadOption2.cmake @@ -0,0 +1,5 @@ +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{Data.txt,Bad:Option} + ) diff --git a/Tests/RunCMake/ExternalData/BadSeries1-result.txt b/Tests/RunCMake/ExternalData/BadSeries1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadSeries1-stderr.txt b/Tests/RunCMake/ExternalData/BadSeries1-stderr.txt new file mode 100644 index 000000000..3099be579 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries1-stderr.txt @@ -0,0 +1,19 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + ExternalData_SERIES_PARSE is set to + + NotASeriesRegex + + which is not of the form + + \(\)\(\)\$ + + Fix the regular expression or set variables + + ExternalData_SERIES_PARSE_PREFIX = regex group number, if any + ExternalData_SERIES_PARSE_NUMBER = regex group number + ExternalData_SERIES_PARSE_SUFFIX = regex group number + +Call Stack \(most recent call first\): + .* + BadSeries1.cmake:3 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadSeries1.cmake b/Tests/RunCMake/ExternalData/BadSeries1.cmake new file mode 100644 index 000000000..7d712106f --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries1.cmake @@ -0,0 +1,3 @@ +include(ExternalData) +set(ExternalData_SERIES_PARSE NotASeriesRegex) +ExternalData_Expand_Arguments(Data args DATA{Data.txt,:}) diff --git a/Tests/RunCMake/ExternalData/BadSeries2-result.txt b/Tests/RunCMake/ExternalData/BadSeries2-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadSeries2-stderr.txt b/Tests/RunCMake/ExternalData/BadSeries2-stderr.txt new file mode 100644 index 000000000..3a02c25e9 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries2-stderr.txt @@ -0,0 +1,16 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Data file referenced by argument + + DATA{Data.txt,:} + + corresponds to path + + Data.txt + + that does not match regular expression + + \(x\)\(y\)\$ +Call Stack \(most recent call first\): + .* + BadSeries2.cmake:3 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadSeries2.cmake b/Tests/RunCMake/ExternalData/BadSeries2.cmake new file mode 100644 index 000000000..e81993b8f --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries2.cmake @@ -0,0 +1,3 @@ +include(ExternalData) +set(ExternalData_SERIES_PARSE "(x)(y)$") +ExternalData_Expand_Arguments(Data args DATA{Data.txt,:}) diff --git a/Tests/RunCMake/ExternalData/BadSeries3-result.txt b/Tests/RunCMake/ExternalData/BadSeries3-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadSeries3-stderr.txt b/Tests/RunCMake/ExternalData/BadSeries3-stderr.txt new file mode 100644 index 000000000..594cb6f6a --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries3-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Series option ":" not allowed with associated files. +Call Stack \(most recent call first\): + .* + BadSeries3.cmake:2 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadSeries3.cmake b/Tests/RunCMake/ExternalData/BadSeries3.cmake new file mode 100644 index 000000000..b640df878 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadSeries3.cmake @@ -0,0 +1,2 @@ +include(ExternalData) +ExternalData_Expand_Arguments(Data args DATA{PairA.txt,PairB.txt,:}) diff --git a/Tests/RunCMake/ExternalData/CMakeLists.txt b/Tests/RunCMake/ExternalData/CMakeLists.txt new file mode 100644 index 000000000..e8db6b05b --- /dev/null +++ b/Tests/RunCMake/ExternalData/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExternalData/Data.txt.md5 b/Tests/RunCMake/ExternalData/Data.txt.md5 new file mode 100644 index 000000000..93b3485e9 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Data.txt.md5 @@ -0,0 +1 @@ +e8bb14af900b998b5a3df7e21dd07d58 diff --git a/Tests/RunCMake/ExternalData/Directory1-result.txt b/Tests/RunCMake/ExternalData/Directory1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/Directory1-stderr.txt b/Tests/RunCMake/ExternalData/Directory1-stderr.txt new file mode 100644 index 000000000..85c250f02 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory1-stderr.txt @@ -0,0 +1,14 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Data file referenced by argument + + DATA{Directory1} + + corresponds to source tree path + + Directory1 + + that does not exist as a file \(with or without an extension\)! +Call Stack \(most recent call first\): + .* + Directory1.cmake:3 \(ExternalData_Add_Test\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/Directory1.cmake b/Tests/RunCMake/ExternalData/Directory1.cmake new file mode 100644 index 000000000..68f1b54be --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory1.cmake @@ -0,0 +1,6 @@ +include(CTest) +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{Directory1} + ) diff --git a/Tests/RunCMake/ExternalData/Directory1/DirData1.txt b/Tests/RunCMake/ExternalData/Directory1/DirData1.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/ExternalData/Directory2-result.txt b/Tests/RunCMake/ExternalData/Directory2-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/Directory2-stderr.txt b/Tests/RunCMake/ExternalData/Directory2-stderr.txt new file mode 100644 index 000000000..92c9a2ff5 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory2-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Data directory referenced by argument + + DATA{Directory2/} + + must list associated files. +Call Stack \(most recent call first\): + .* + Directory2.cmake:3 \(ExternalData_Add_Test\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/Directory2.cmake b/Tests/RunCMake/ExternalData/Directory2.cmake new file mode 100644 index 000000000..30b992e6e --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory2.cmake @@ -0,0 +1,6 @@ +include(CTest) +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{Directory2/} + ) diff --git a/Tests/RunCMake/ExternalData/Directory2.md5 b/Tests/RunCMake/ExternalData/Directory2.md5 new file mode 100644 index 000000000..93b3485e9 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory2.md5 @@ -0,0 +1 @@ +e8bb14af900b998b5a3df7e21dd07d58 diff --git a/Tests/RunCMake/ExternalData/Directory2/DirData2.txt b/Tests/RunCMake/ExternalData/Directory2/DirData2.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/ExternalData/Directory3-result.txt b/Tests/RunCMake/ExternalData/Directory3-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/Directory3-stderr.txt b/Tests/RunCMake/ExternalData/Directory3-stderr.txt new file mode 100644 index 000000000..56a341e03 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory3-stderr.txt @@ -0,0 +1,14 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Data file referenced by argument + + DATA{Directory3/\*} + + corresponds to source tree path + + Directory3/. + + that does not exist as a file \(with or without an extension\)! +Call Stack \(most recent call first\): + .* + Directory3.cmake:3 \(ExternalData_Add_Test\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/Directory3.cmake b/Tests/RunCMake/ExternalData/Directory3.cmake new file mode 100644 index 000000000..55d8be9dd --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory3.cmake @@ -0,0 +1,6 @@ +include(CTest) +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{Directory3/*} + ) diff --git a/Tests/RunCMake/ExternalData/Directory3/DirData3.txt b/Tests/RunCMake/ExternalData/Directory3/DirData3.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/ExternalData/Directory4-result.txt b/Tests/RunCMake/ExternalData/Directory4-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/Directory4-stderr.txt b/Tests/RunCMake/ExternalData/Directory4-stderr.txt new file mode 100644 index 000000000..dcb8522f8 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory4-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Series option ":" not allowed with directories. +Call Stack \(most recent call first\): + .* + Directory4.cmake:3 \(ExternalData_Add_Test\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/Directory4.cmake b/Tests/RunCMake/ExternalData/Directory4.cmake new file mode 100644 index 000000000..7d3d6384d --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory4.cmake @@ -0,0 +1,6 @@ +include(CTest) +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{Directory4/,:} + ) diff --git a/Tests/RunCMake/ExternalData/Directory4/DirData4.txt b/Tests/RunCMake/ExternalData/Directory4/DirData4.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/ExternalData/Directory5-result.txt b/Tests/RunCMake/ExternalData/Directory5-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/Directory5-stderr.txt b/Tests/RunCMake/ExternalData/Directory5-stderr.txt new file mode 100644 index 000000000..8e54aecd2 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory5-stderr.txt @@ -0,0 +1,14 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Data directory referenced by argument + + DATA{Directory5/} + + corresponds to source tree path + + Directory5 + + that does not exist as a directory! +Call Stack \(most recent call first\): + .* + Directory5.cmake:3 \(ExternalData_Add_Test\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/Directory5.cmake b/Tests/RunCMake/ExternalData/Directory5.cmake new file mode 100644 index 000000000..931589e4e --- /dev/null +++ b/Tests/RunCMake/ExternalData/Directory5.cmake @@ -0,0 +1,6 @@ +include(CTest) +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{Directory5/} + ) diff --git a/Tests/RunCMake/ExternalData/LinkContentMD5-stdout.txt b/Tests/RunCMake/ExternalData/LinkContentMD5-stdout.txt new file mode 100644 index 000000000..f77fca9b5 --- /dev/null +++ b/Tests/RunCMake/ExternalData/LinkContentMD5-stdout.txt @@ -0,0 +1,3 @@ +-- Linked ToLink.txt.md5 to ExternalData MD5/c18ff9804c8deec9eaeb17063cda8b7b +-- Raw data correctly transformed to content link! +-- Staged content exists! diff --git a/Tests/RunCMake/ExternalData/LinkContentMD5.cmake b/Tests/RunCMake/ExternalData/LinkContentMD5.cmake new file mode 100644 index 000000000..41b4deebf --- /dev/null +++ b/Tests/RunCMake/ExternalData/LinkContentMD5.cmake @@ -0,0 +1,22 @@ +include(ExternalData) +set(ExternalData_LINK_CONTENT MD5) +set(ExternalData_SOURCE_ROOT ${CMAKE_CURRENT_BINARY_DIR}) +set(ExternalData_BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/ExternalData) +set(input ${CMAKE_CURRENT_BINARY_DIR}/ToLink.txt) +set(output ${CMAKE_CURRENT_BINARY_DIR}/ExternalData/ToLink.txt) +set(staged "${CMAKE_CURRENT_BINARY_DIR}/.ExternalData_MD5_c18ff9804c8deec9eaeb17063cda8b7b") +file(REMOVE ${staged}) +file(REMOVE ${input}.md5) +file(WRITE ${input} "To be transformed into a content link.") +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Raw data correctly transformed to content link!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() +if(EXISTS "${staged}") + message(STATUS "Staged content exists!") +else() + message(FATAL_ERROR "Staged content missing!") +endif() diff --git a/Tests/RunCMake/ExternalData/LinkContentSHA1-stdout.txt b/Tests/RunCMake/ExternalData/LinkContentSHA1-stdout.txt new file mode 100644 index 000000000..9a8eb2e3d --- /dev/null +++ b/Tests/RunCMake/ExternalData/LinkContentSHA1-stdout.txt @@ -0,0 +1,3 @@ +-- Linked ToLink.txt.sha1 to ExternalData SHA1/114ee5dda251457fd2df63bec91d3b8db43aba58 +-- Raw data correctly transformed to content link! +-- Staged content exists! diff --git a/Tests/RunCMake/ExternalData/LinkContentSHA1.cmake b/Tests/RunCMake/ExternalData/LinkContentSHA1.cmake new file mode 100644 index 000000000..f78501cf5 --- /dev/null +++ b/Tests/RunCMake/ExternalData/LinkContentSHA1.cmake @@ -0,0 +1,22 @@ +include(ExternalData) +set(ExternalData_LINK_CONTENT SHA1) +set(ExternalData_SOURCE_ROOT ${CMAKE_CURRENT_BINARY_DIR}) +set(ExternalData_BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/ExternalData) +set(input ${CMAKE_CURRENT_BINARY_DIR}/ToLink.txt) +set(output ${CMAKE_CURRENT_BINARY_DIR}/ExternalData/ToLink.txt) +set(staged "${CMAKE_CURRENT_BINARY_DIR}/.ExternalData_SHA1_114ee5dda251457fd2df63bec91d3b8db43aba58") +file(REMOVE ${staged}) +file(REMOVE ${input}.sha1) +file(WRITE ${input} "To be transformed into a content link.") +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Raw data correctly transformed to content link!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() +if(EXISTS "${staged}") + message(STATUS "Staged content exists!") +else() + message(FATAL_ERROR "Staged content missing!") +endif() diff --git a/Tests/RunCMake/ExternalData/MissingData-result.txt b/Tests/RunCMake/ExternalData/MissingData-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/MissingData-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/MissingData-stderr.txt b/Tests/RunCMake/ExternalData/MissingData-stderr.txt new file mode 100644 index 000000000..e794f955d --- /dev/null +++ b/Tests/RunCMake/ExternalData/MissingData-stderr.txt @@ -0,0 +1,14 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Data file referenced by argument + + DATA{MissingData.txt} + + corresponds to source tree path + + MissingData.txt + + that does not exist as a file \(with or without an extension\)! +Call Stack \(most recent call first\): + .* + MissingData.cmake:2 \(ExternalData_Add_Test\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/MissingData.cmake b/Tests/RunCMake/ExternalData/MissingData.cmake new file mode 100644 index 000000000..b3c8a5cdc --- /dev/null +++ b/Tests/RunCMake/ExternalData/MissingData.cmake @@ -0,0 +1,5 @@ +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{MissingData.txt} + ) diff --git a/Tests/RunCMake/ExternalData/NoLinkInSource-stderr.txt b/Tests/RunCMake/ExternalData/NoLinkInSource-stderr.txt new file mode 100644 index 000000000..496ad8ae4 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NoLinkInSource-stderr.txt @@ -0,0 +1,6 @@ +CMake Warning at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + ExternalData_LINK_CONTENT cannot be used in-source +Call Stack \(most recent call first\): + .* + NoLinkInSource.cmake:8 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/NoLinkInSource-stdout.txt b/Tests/RunCMake/ExternalData/NoLinkInSource-stdout.txt new file mode 100644 index 000000000..18946f0ec --- /dev/null +++ b/Tests/RunCMake/ExternalData/NoLinkInSource-stdout.txt @@ -0,0 +1 @@ +-- Data reference correctly not transformed! diff --git a/Tests/RunCMake/ExternalData/NoLinkInSource.cmake b/Tests/RunCMake/ExternalData/NoLinkInSource.cmake new file mode 100644 index 000000000..cbf45ebbf --- /dev/null +++ b/Tests/RunCMake/ExternalData/NoLinkInSource.cmake @@ -0,0 +1,14 @@ +include(ExternalData) +set(ExternalData_LINK_CONTENT MD5) +set(ExternalData_SOURCE_ROOT ${CMAKE_CURRENT_BINARY_DIR}) +set(ExternalData_BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}) +set(input ${CMAKE_CURRENT_BINARY_DIR}/ToLink.txt) +file(REMOVE ${input}.md5) +file(WRITE ${input} "To be transformed into a content link.") +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${input}") + message(STATUS "Data reference correctly not transformed!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected no transformation.") +endif() diff --git a/Tests/RunCMake/ExternalData/NoURLTemplates-result.txt b/Tests/RunCMake/ExternalData/NoURLTemplates-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NoURLTemplates-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/NoURLTemplates-stderr.txt b/Tests/RunCMake/ExternalData/NoURLTemplates-stderr.txt new file mode 100644 index 000000000..ad059d434 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NoURLTemplates-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + ExternalData_URL_TEMPLATES is not set! +Call Stack \(most recent call first\): + NoURLTemplates.cmake:2 \(ExternalData_Add_Target\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/NoURLTemplates.cmake b/Tests/RunCMake/ExternalData/NoURLTemplates.cmake new file mode 100644 index 000000000..8f0e069c2 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NoURLTemplates.cmake @@ -0,0 +1,2 @@ +include(ExternalData) +ExternalData_Add_Target(Data) diff --git a/Tests/RunCMake/ExternalData/NormalData1-stdout.txt b/Tests/RunCMake/ExternalData/NormalData1-stdout.txt new file mode 100644 index 000000000..2f2c770cb --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalData1-stdout.txt @@ -0,0 +1 @@ +-- Data reference correctly transformed! diff --git a/Tests/RunCMake/ExternalData/NormalData1.cmake b/Tests/RunCMake/ExternalData/NormalData1.cmake new file mode 100644 index 000000000..d6cc384c8 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalData1.cmake @@ -0,0 +1,13 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +set(input Data.txt) +set(output ${CMAKE_CURRENT_BINARY_DIR}/Data.txt) +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Data reference correctly transformed!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() diff --git a/Tests/RunCMake/ExternalData/NormalData2-stdout.txt b/Tests/RunCMake/ExternalData/NormalData2-stdout.txt new file mode 100644 index 000000000..2f2c770cb --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalData2-stdout.txt @@ -0,0 +1 @@ +-- Data reference correctly transformed! diff --git a/Tests/RunCMake/ExternalData/NormalData2.cmake b/Tests/RunCMake/ExternalData/NormalData2.cmake new file mode 100644 index 000000000..c979b48ea --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalData2.cmake @@ -0,0 +1,14 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +set(ExternalData_BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/ExternalData) +set(input Data.txt) +set(output ${CMAKE_CURRENT_BINARY_DIR}/ExternalData/Data.txt) +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Data reference correctly transformed!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() diff --git a/Tests/RunCMake/ExternalData/NormalData3-stdout.txt b/Tests/RunCMake/ExternalData/NormalData3-stdout.txt new file mode 100644 index 000000000..2f2c770cb --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalData3-stdout.txt @@ -0,0 +1 @@ +-- Data reference correctly transformed! diff --git a/Tests/RunCMake/ExternalData/NormalData3.cmake b/Tests/RunCMake/ExternalData/NormalData3.cmake new file mode 100644 index 000000000..e99112267 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalData3.cmake @@ -0,0 +1,14 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +set(ExternalData_BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/ExternalData) +set(input ${CMAKE_CURRENT_SOURCE_DIR}/Data.txt) +set(output ${CMAKE_CURRENT_BINARY_DIR}/ExternalData/Data.txt) +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Data reference correctly transformed!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() diff --git a/Tests/RunCMake/ExternalData/NormalDataSub1-stdout.txt b/Tests/RunCMake/ExternalData/NormalDataSub1-stdout.txt new file mode 100644 index 000000000..2f2c770cb --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalDataSub1-stdout.txt @@ -0,0 +1 @@ +-- Data reference correctly transformed! diff --git a/Tests/RunCMake/ExternalData/NormalDataSub1.cmake b/Tests/RunCMake/ExternalData/NormalDataSub1.cmake new file mode 100644 index 000000000..015e94c0a --- /dev/null +++ b/Tests/RunCMake/ExternalData/NormalDataSub1.cmake @@ -0,0 +1,13 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +set(input SubDirectory1/Data.txt) +set(output ${CMAKE_CURRENT_BINARY_DIR}/SubDirectory1/Data.txt) +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Data reference correctly transformed!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() diff --git a/Tests/RunCMake/ExternalData/NotUnderRoot-result.txt b/Tests/RunCMake/ExternalData/NotUnderRoot-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NotUnderRoot-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/NotUnderRoot-stderr.txt b/Tests/RunCMake/ExternalData/NotUnderRoot-stderr.txt new file mode 100644 index 000000000..1f2eb1c7a --- /dev/null +++ b/Tests/RunCMake/ExternalData/NotUnderRoot-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Data file referenced by argument + + DATA{../NotUnderRoot.txt} + + does not lie under the top-level source directory + + .*/Tests/RunCMake/ExternalData + +Call Stack \(most recent call first\): + .* + NotUnderRoot.cmake:2 \(ExternalData_Add_Test\) diff --git a/Tests/RunCMake/ExternalData/NotUnderRoot.cmake b/Tests/RunCMake/ExternalData/NotUnderRoot.cmake new file mode 100644 index 000000000..c7942d678 --- /dev/null +++ b/Tests/RunCMake/ExternalData/NotUnderRoot.cmake @@ -0,0 +1,5 @@ +include(ExternalData) +ExternalData_Add_Test(Data + NAME Test + COMMAND ${CMAKE_COMMAND} -E echo DATA{../NotUnderRoot.txt} + ) diff --git a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake new file mode 100644 index 000000000..ceb2ecffb --- /dev/null +++ b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake @@ -0,0 +1,27 @@ +include(RunCMake) + +run_cmake(BadHashAlgo1) +run_cmake(BadOption1) +run_cmake(BadOption2) +run_cmake(BadSeries1) +run_cmake(BadSeries2) +run_cmake(BadSeries3) +run_cmake(Directory1) +run_cmake(Directory2) +run_cmake(Directory3) +run_cmake(Directory4) +run_cmake(Directory5) +run_cmake(LinkContentMD5) +run_cmake(LinkContentSHA1) +run_cmake(MissingData) +run_cmake(NoLinkInSource) +run_cmake(NoURLTemplates) +run_cmake(NormalData1) +run_cmake(NormalData2) +run_cmake(NormalData3) +run_cmake(NormalDataSub1) +run_cmake(NotUnderRoot) +run_cmake(Semicolon1) +run_cmake(Semicolon2) +run_cmake(Semicolon3) +run_cmake(SubDirectory1) diff --git a/Tests/RunCMake/ExternalData/Semicolon1-stdout.txt b/Tests/RunCMake/ExternalData/Semicolon1-stdout.txt new file mode 100644 index 000000000..361baebba --- /dev/null +++ b/Tests/RunCMake/ExternalData/Semicolon1-stdout.txt @@ -0,0 +1 @@ +-- Data arguments correctly transformed! diff --git a/Tests/RunCMake/ExternalData/Semicolon1.cmake b/Tests/RunCMake/ExternalData/Semicolon1.cmake new file mode 100644 index 000000000..c83286082 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Semicolon1.cmake @@ -0,0 +1,14 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +set(input Data.txt) +set(output ${CMAKE_CURRENT_BINARY_DIR}/Data.txt) +ExternalData_Expand_Arguments(Data args DATA{${input}} "a\\;b" "c;d" DATA{${input}}) +set(expect "${output};a\\;b;c;d;${output}") +if("x${args}" STREQUAL "x${expect}") + message(STATUS "Data arguments correctly transformed!") +else() + message(FATAL_ERROR "Data arguments transformed to:\n ${args}\n" + "but we expected:\n ${expect}") +endif() diff --git a/Tests/RunCMake/ExternalData/Semicolon2-stdout.txt b/Tests/RunCMake/ExternalData/Semicolon2-stdout.txt new file mode 100644 index 000000000..361baebba --- /dev/null +++ b/Tests/RunCMake/ExternalData/Semicolon2-stdout.txt @@ -0,0 +1 @@ +-- Data arguments correctly transformed! diff --git a/Tests/RunCMake/ExternalData/Semicolon2.cmake b/Tests/RunCMake/ExternalData/Semicolon2.cmake new file mode 100644 index 000000000..1a1ae5f3f --- /dev/null +++ b/Tests/RunCMake/ExternalData/Semicolon2.cmake @@ -0,0 +1,14 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +set(input Data.txt) +set(output ${CMAKE_CURRENT_BINARY_DIR}/Data.txt) +ExternalData_Expand_Arguments(Data args "DATA{${input}};a\\;b;c;d;DATA{${input}}") +set(expect "${output};a\\;b;c;d;${output}") +if("x${args}" STREQUAL "x${expect}") + message(STATUS "Data arguments correctly transformed!") +else() + message(FATAL_ERROR "Data arguments transformed to:\n ${args}\n" + "but we expected:\n ${expect}") +endif() diff --git a/Tests/RunCMake/ExternalData/Semicolon3-stdout.txt b/Tests/RunCMake/ExternalData/Semicolon3-stdout.txt new file mode 100644 index 000000000..ca4a36002 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Semicolon3-stdout.txt @@ -0,0 +1 @@ +-- Data arguments correctly not transformed! diff --git a/Tests/RunCMake/ExternalData/Semicolon3.cmake b/Tests/RunCMake/ExternalData/Semicolon3.cmake new file mode 100644 index 000000000..2ae99da98 --- /dev/null +++ b/Tests/RunCMake/ExternalData/Semicolon3.cmake @@ -0,0 +1,12 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +set(input "DATA{a;b}") +ExternalData_Expand_Arguments(Data args "${input}") +if("x${args}" STREQUAL "x${input}") + message(STATUS "Data arguments correctly not transformed!") +else() + message(FATAL_ERROR "Data arguments transformed to:\n ${args}\n" + "but we expected:\n ${input}") +endif() diff --git a/Tests/RunCMake/ExternalData/SubDirectory1-stdout.txt b/Tests/RunCMake/ExternalData/SubDirectory1-stdout.txt new file mode 100644 index 000000000..03924cb5b --- /dev/null +++ b/Tests/RunCMake/ExternalData/SubDirectory1-stdout.txt @@ -0,0 +1,3 @@ +-- Data reference correctly transformed in parent dir 1! +-- Data reference correctly transformed in parent dir 2! +-- Data reference correctly transformed in current dir! diff --git a/Tests/RunCMake/ExternalData/SubDirectory1.cmake b/Tests/RunCMake/ExternalData/SubDirectory1.cmake new file mode 100644 index 000000000..29894710a --- /dev/null +++ b/Tests/RunCMake/ExternalData/SubDirectory1.cmake @@ -0,0 +1,5 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + ) +add_subdirectory(SubDirectory1) diff --git a/Tests/RunCMake/ExternalData/SubDirectory1/CMakeLists.txt b/Tests/RunCMake/ExternalData/SubDirectory1/CMakeLists.txt new file mode 100644 index 000000000..881ff5c2c --- /dev/null +++ b/Tests/RunCMake/ExternalData/SubDirectory1/CMakeLists.txt @@ -0,0 +1,29 @@ +set(input ../Data.txt) +set(output ${CMAKE_BINARY_DIR}/Data.txt) +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Data reference correctly transformed in parent dir 1!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() + +set(input ${CMAKE_CURRENT_SOURCE_DIR}/../Data.txt) +set(output ${CMAKE_BINARY_DIR}/Data.txt) +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Data reference correctly transformed in parent dir 2!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() + +set(input Data.txt) +set(output ${CMAKE_CURRENT_BINARY_DIR}/Data.txt) +ExternalData_Expand_Arguments(Data args DATA{${input}}) +if("x${args}" STREQUAL "x${output}") + message(STATUS "Data reference correctly transformed in current dir!") +else() + message(FATAL_ERROR "Data reference transformed to:\n ${args}\n" + "but we expected:\n ${output}") +endif() diff --git a/Tests/RunCMake/ExternalData/SubDirectory1/Data.txt.md5 b/Tests/RunCMake/ExternalData/SubDirectory1/Data.txt.md5 new file mode 100644 index 000000000..93b3485e9 --- /dev/null +++ b/Tests/RunCMake/ExternalData/SubDirectory1/Data.txt.md5 @@ -0,0 +1 @@ +e8bb14af900b998b5a3df7e21dd07d58 diff --git a/Tests/RunCMake/FPHSA/BadFoundVar-result.txt b/Tests/RunCMake/FPHSA/BadFoundVar-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/FPHSA/BadFoundVar-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt b/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt new file mode 100644 index 000000000..4c739d89b --- /dev/null +++ b/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt @@ -0,0 +1,7 @@ +CMake Error at .*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(message\): + The argument for FOUND_VAR is "badfoundvar_FOUND", but only + "BadFoundVar_FOUND" and "BADFOUNDVAR_FOUND" are valid names. +Call Stack \(most recent call first\): + FindBadFoundVar.cmake:5 \(find_package_handle_standard_args\) + BadFoundVar.cmake:3 \(find_package\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/FPHSA/BadFoundVar.cmake b/Tests/RunCMake/FPHSA/BadFoundVar.cmake new file mode 100644 index 000000000..07d4322e4 --- /dev/null +++ b/Tests/RunCMake/FPHSA/BadFoundVar.cmake @@ -0,0 +1,3 @@ +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") + +find_package(BadFoundVar REQUIRED) diff --git a/Tests/RunCMake/FPHSA/CMakeLists.txt b/Tests/RunCMake/FPHSA/CMakeLists.txt new file mode 100644 index 000000000..e8db6b05b --- /dev/null +++ b/Tests/RunCMake/FPHSA/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FPHSA/FindBadFoundVar.cmake b/Tests/RunCMake/FPHSA/FindBadFoundVar.cmake new file mode 100644 index 000000000..152df5cd8 --- /dev/null +++ b/Tests/RunCMake/FPHSA/FindBadFoundVar.cmake @@ -0,0 +1,6 @@ +set(BFV_FOO TRUE) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(BadFoundVar REQUIRED_VARS BFV_FOO + FOUND_VAR badfoundvar_FOUND ) diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake new file mode 100644 index 000000000..0d48fa973 --- /dev/null +++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(BadFoundVar) diff --git a/Tests/RunCMake/GeneratorExpression/BadAND-result.txt b/Tests/RunCMake/GeneratorExpression/BadAND-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadAND-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt new file mode 100644 index 000000000..0e48ba423 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt @@ -0,0 +1,53 @@ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires at least one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadAND.cmake b/Tests/RunCMake/GeneratorExpression/BadAND.cmake new file mode 100644 index 000000000..8a7993f53 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadAND.cmake @@ -0,0 +1,8 @@ +add_custom_target(check ALL COMMAND check + $ + $ + $ + $ + $ + $ + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt new file mode 100644 index 000000000..1cfbf404e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt @@ -0,0 +1,44 @@ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Expression syntax not recognized. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Expression syntax not recognized. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Expression syntax not recognized. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake new file mode 100644 index 000000000..c27ea5f73 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake @@ -0,0 +1,7 @@ +add_custom_target(check ALL COMMAND check + $ + $ + $ + $ + $<$:foo> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadInstallPrefix-result.txt b/Tests/RunCMake/GeneratorExpression/BadInstallPrefix-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadInstallPrefix-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadInstallPrefix-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadInstallPrefix-stderr.txt new file mode 100644 index 000000000..271eb6e6f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadInstallPrefix-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at BadInstallPrefix.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + INSTALL_PREFIX is a marker for install\(EXPORT\) only. It should never be + evaluated. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/BadInstallPrefix.cmake b/Tests/RunCMake/GeneratorExpression/BadInstallPrefix.cmake new file mode 100644 index 000000000..fcfc3ebaa --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadInstallPrefix.cmake @@ -0,0 +1,3 @@ +add_custom_target(check ALL COMMAND check + $/include + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT-result.txt b/Tests/RunCMake/GeneratorExpression/BadNOT-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadNOT-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt new file mode 100644 index 000000000..e5e628c30 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt @@ -0,0 +1,52 @@ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ parameter must resolve to exactly one '0' or '1' value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ parameter must resolve to exactly one '0' or '1' value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ parameter must resolve to exactly one '0' or '1' value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT.cmake b/Tests/RunCMake/GeneratorExpression/BadNOT.cmake new file mode 100644 index 000000000..c2dada3c2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadNOT.cmake @@ -0,0 +1,8 @@ +add_custom_target(check ALL COMMAND check + $ + $ + $ + $ + $ + $ + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadOR-result.txt b/Tests/RunCMake/GeneratorExpression/BadOR-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadOR-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt new file mode 100644 index 000000000..eb263286e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt @@ -0,0 +1,53 @@ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires at least one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadOR.cmake b/Tests/RunCMake/GeneratorExpression/BadOR.cmake new file mode 100644 index 000000000..c0309da25 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadOR.cmake @@ -0,0 +1,8 @@ +add_custom_target(check ALL COMMAND check + $ + $ + $ + $ + $ + $ + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadStrEqual-result.txt b/Tests/RunCMake/GeneratorExpression/BadStrEqual-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadStrEqual-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadStrEqual-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadStrEqual-stderr.txt new file mode 100644 index 000000000..dd0d931be --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadStrEqual-stderr.txt @@ -0,0 +1,38 @@ +CMake Error at BadStrEqual.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires 2 comma separated parameters, but got 0 + instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++CMake Error at BadStrEqual.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires 2 comma separated parameters, but got 1 + instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadStrEqual.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires 2 comma separated parameters, but got 3 + instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadStrEqual.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires 2 comma separated parameters, but got 3 + instead. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadStrEqual.cmake b/Tests/RunCMake/GeneratorExpression/BadStrEqual.cmake new file mode 100644 index 000000000..56eb45853 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadStrEqual.cmake @@ -0,0 +1,6 @@ +add_custom_target(check ALL COMMAND check + $ + $ + $ + $ + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetName-result.txt b/Tests/RunCMake/GeneratorExpression/BadTargetName-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetName-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetName-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadTargetName-stderr.txt new file mode 100644 index 000000000..969393acc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetName-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at BadTargetName.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$> + + \$ expression requires literal input. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetName.cmake b/Tests/RunCMake/GeneratorExpression/BadTargetName.cmake new file mode 100644 index 000000000..e125cab42 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadTargetName.cmake @@ -0,0 +1,3 @@ +add_custom_target(check ALL COMMAND check + $> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadZero-result.txt b/Tests/RunCMake/GeneratorExpression/BadZero-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadZero-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadZero-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadZero-stderr.txt new file mode 100644 index 000000000..40db4ae88 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadZero-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at BadZero.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<0> + + \$<0> expression requires a parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadZero.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<0,> + + Expression did not evaluate to a known generator expression +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/BadZero.cmake b/Tests/RunCMake/GeneratorExpression/BadZero.cmake new file mode 100644 index 000000000..559a9fa3d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadZero.cmake @@ -0,0 +1,5 @@ + +add_custom_target(check ALL COMMAND check + $<0> + $<0,> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/CMakeLists.txt b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt new file mode 100644 index 000000000..e8db6b05b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake new file mode 100644 index 000000000..62bf29bc9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -0,0 +1,10 @@ +include(RunCMake) + +run_cmake(BadCONFIG) +run_cmake(BadOR) +run_cmake(BadAND) +run_cmake(BadNOT) +run_cmake(BadStrEqual) +run_cmake(BadZero) +run_cmake(BadTargetName) +run_cmake(BadInstallPrefix) diff --git a/Tests/RunCMake/GeneratorToolset/BadToolset-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolset-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolset-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolset-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolset-stderr.txt new file mode 100644 index 000000000..bf1f19018 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolset-stderr.txt @@ -0,0 +1,10 @@ +CMake Error: + Generator + + .* + + does not support toolset specification, but toolset + + Bad Toolset + + was specified.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolset.cmake b/Tests/RunCMake/GeneratorToolset/BadToolset.cmake new file mode 100644 index 000000000..2fc38e5c5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolset.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/CMakeLists.txt b/Tests/RunCMake/GeneratorToolset/CMakeLists.txt new file mode 100644 index 000000000..e8db6b05b --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorToolset/NoToolset-result.txt b/Tests/RunCMake/GeneratorToolset/NoToolset-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/NoToolset-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/NoToolset-stderr.txt b/Tests/RunCMake/GeneratorToolset/NoToolset-stderr.txt new file mode 100644 index 000000000..bc6f74193 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/NoToolset-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NoToolset.cmake:2 \(message\): + CMAKE_GENERATOR_TOOLSET is empty as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorToolset/NoToolset.cmake b/Tests/RunCMake/GeneratorToolset/NoToolset.cmake new file mode 100644 index 000000000..f1f1ecd26 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/NoToolset.cmake @@ -0,0 +1,7 @@ +if("x${CMAKE_GENERATOR_TOOLSET}" STREQUAL "x") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is empty as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be empty!") +endif() diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake new file mode 100644 index 000000000..09375d9a7 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -0,0 +1,17 @@ +include(RunCMake) + +set(RunCMake_GENERATOR_TOOLSET "") +run_cmake(NoToolset) + +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01]|Xcode" AND NOT XCODE_BELOW_3) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset") + run_cmake(TestToolset) +else() + set(RunCMake_GENERATOR_TOOLSET "Bad Toolset") + run_cmake(BadToolset) +endif() + +set(RunCMake_GENERATOR_TOOLSET "") +set(RunCMake_TEST_OPTIONS -T "Extra Toolset") +run_cmake(TwoToolsets) +unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolset-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolset-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolset-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolset-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolset-stderr.txt new file mode 100644 index 000000000..d5726af5f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolset-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at TestToolset.cmake:2 \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolset.cmake b/Tests/RunCMake/GeneratorToolset/TestToolset.cmake new file mode 100644 index 000000000..6f83bef28 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolset.cmake @@ -0,0 +1,7 @@ +if("x${CMAKE_GENERATOR_TOOLSET}" STREQUAL "xTest Toolset") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset\"!") +endif() diff --git a/Tests/RunCMake/GeneratorToolset/TwoToolsets-result.txt b/Tests/RunCMake/GeneratorToolset/TwoToolsets-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TwoToolsets-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TwoToolsets-stderr.txt b/Tests/RunCMake/GeneratorToolset/TwoToolsets-stderr.txt new file mode 100644 index 000000000..9fa817ff5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TwoToolsets-stderr.txt @@ -0,0 +1 @@ +CMake Error: Multiple -T options not allowed diff --git a/Tests/RunCMake/GeneratorToolset/TwoToolsets.cmake b/Tests/RunCMake/GeneratorToolset/TwoToolsets.cmake new file mode 100644 index 000000000..2fc38e5c5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TwoToolsets.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/PositionIndependentCode/CMakeLists.txt b/Tests/RunCMake/PositionIndependentCode/CMakeLists.txt new file mode 100644 index 000000000..22577da4a --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/CMakeLists.txt @@ -0,0 +1,8 @@ + +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} CXX) + +# MSVC creates extra targets which pollute the stderr unless we set this. +set(CMAKE_SUPPRESS_REGENERATION TRUE) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict1-result.txt b/Tests/RunCMake/PositionIndependentCode/Conflict1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict1-stderr.txt b/Tests/RunCMake/PositionIndependentCode/Conflict1-stderr.txt new file mode 100644 index 000000000..cb0710986 --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict1-stderr.txt @@ -0,0 +1,3 @@ +CMake Error: Property POSITION_INDEPENDENT_CODE on target "conflict" does +not match the INTERFACE_POSITION_INDEPENDENT_CODE property requirement +of dependency "piciface". diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict1.cmake b/Tests/RunCMake/PositionIndependentCode/Conflict1.cmake new file mode 100644 index 000000000..242bec37a --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict1.cmake @@ -0,0 +1,7 @@ + +add_library(piciface UNKNOWN IMPORTED) +set_property(TARGET piciface PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON) + +add_executable(conflict "main.cpp") +set_property(TARGET conflict PROPERTY POSITION_INDEPENDENT_CODE OFF) +target_link_libraries(conflict piciface) diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict2-result.txt b/Tests/RunCMake/PositionIndependentCode/Conflict2-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict2-stderr.txt b/Tests/RunCMake/PositionIndependentCode/Conflict2-stderr.txt new file mode 100644 index 000000000..ecd04928d --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict2-stderr.txt @@ -0,0 +1,3 @@ +CMake Error: The INTERFACE_POSITION_INDEPENDENT_CODE property of "picoff" does +not agree with the value of POSITION_INDEPENDENT_CODE already determined +for "conflict". diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict2.cmake b/Tests/RunCMake/PositionIndependentCode/Conflict2.cmake new file mode 100644 index 000000000..215d08dae --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict2.cmake @@ -0,0 +1,9 @@ + +add_library(picon UNKNOWN IMPORTED) +set_property(TARGET picon PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON) + +add_library(picoff UNKNOWN IMPORTED) +set_property(TARGET picoff PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE OFF) + +add_executable(conflict "main.cpp") +target_link_libraries(conflict picon picoff) diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict3-result.txt b/Tests/RunCMake/PositionIndependentCode/Conflict3-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict3-stderr.txt b/Tests/RunCMake/PositionIndependentCode/Conflict3-stderr.txt new file mode 100644 index 000000000..0254e5557 --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict3-stderr.txt @@ -0,0 +1,4 @@ +Property POSITION_INDEPENDENT_CODE on target "conflict" is +implied to be FALSE because it was used to determine the link libraries +already. The INTERFACE_POSITION_INDEPENDENT_CODE property on +dependency "picon" is in conflict. diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict3.cmake b/Tests/RunCMake/PositionIndependentCode/Conflict3.cmake new file mode 100644 index 000000000..bf669bf4f --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/Conflict3.cmake @@ -0,0 +1,12 @@ + +add_library(picoff UNKNOWN IMPORTED) + +add_library(picon UNKNOWN IMPORTED) +set_property(TARGET picon PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON) + +add_executable(conflict "main.cpp") +target_link_libraries(conflict picon) +set_property(TARGET conflict APPEND PROPERTY + LINK_LIBRARIES + $<$>>:picoff> +) diff --git a/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake new file mode 100644 index 000000000..64a340c9c --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(Conflict1) +run_cmake(Conflict2) +run_cmake(Conflict3) diff --git a/Tests/RunCMake/PositionIndependentCode/main.cpp b/Tests/RunCMake/PositionIndependentCode/main.cpp new file mode 100644 index 000000000..31ba48280 --- /dev/null +++ b/Tests/RunCMake/PositionIndependentCode/main.cpp @@ -0,0 +1,5 @@ + +int main(int,char**) +{ + return 0; +} diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index c3c161abe..00faa4ca7 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -26,12 +26,22 @@ function(run_cmake test) endif() endforeach() set(RunCMake_TEST_SOURCE_DIR "${top_src}") - set(RunCMake_TEST_BINARY_DIR "${top_bin}/${test}-build") - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + if(NOT RunCMake_TEST_BINARY_DIR) + set(RunCMake_TEST_BINARY_DIR "${top_bin}/${test}-build") + endif() + if(NOT RunCMake_TEST_NO_CLEAN) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + endif() file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + if(NOT DEFINED RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_OPTIONS "") + endif() execute_process( COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}" - -G "${RunCMake_GENERATOR}" -DRunCMake_TEST=${test} + -G "${RunCMake_GENERATOR}" + -T "${RunCMake_GENERATOR_TOOLSET}" + -DRunCMake_TEST=${test} + ${RunCMake_TEST_OPTIONS} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" OUTPUT_VARIABLE actual_stdout ERROR_VARIABLE actual_stderr diff --git a/Tests/RunCMake/SolutionGlobalSections/CMakeLists.txt b/Tests/RunCMake/SolutionGlobalSections/CMakeLists.txt new file mode 100644 index 000000000..e8db6b05b --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/SolutionGlobalSections/MorePost-check.cmake b/Tests/RunCMake/SolutionGlobalSections/MorePost-check.cmake new file mode 100644 index 000000000..0f7e37084 --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/MorePost-check.cmake @@ -0,0 +1,5 @@ +parseGlobalSections(pre post MorePost) +testGlobalSection(post TestSec2 Key1=Value1 "Key2=Value with spaces") +testGlobalSection(post TestSec4 Key6=Value1 "Key7=Value with spaces" Key8=ValueWithoutSpaces) +testGlobalSection(post ExtensibilityGlobals) +testGlobalSection(post ExtensibilityAddIns) diff --git a/Tests/RunCMake/SolutionGlobalSections/MorePost.cmake b/Tests/RunCMake/SolutionGlobalSections/MorePost.cmake new file mode 100644 index 000000000..2eb3f60af --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/MorePost.cmake @@ -0,0 +1,2 @@ +set_property(DIRECTORY PROPERTY VS_GLOBAL_SECTION_POST_TestSec2 Key1=Value1 "Key2=Value with spaces") +set_property(DIRECTORY PROPERTY VS_GLOBAL_SECTION_POST_TestSec4 Key6=Value1 "Key7=Value with spaces" "Key8 =ValueWithoutSpaces") diff --git a/Tests/RunCMake/SolutionGlobalSections/MorePre-check.cmake b/Tests/RunCMake/SolutionGlobalSections/MorePre-check.cmake new file mode 100644 index 000000000..45e7419f9 --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/MorePre-check.cmake @@ -0,0 +1,5 @@ +parseGlobalSections(pre post MorePre) +testGlobalSection(pre TestSec1 Key1=Value1 "Key2=Value with spaces") +testGlobalSection(pre TestSec3 Key3=Value1 "Key4=Value with spaces" Key5=ValueWithoutSpaces) +testGlobalSection(post ExtensibilityGlobals) +testGlobalSection(post ExtensibilityAddIns) diff --git a/Tests/RunCMake/SolutionGlobalSections/MorePre.cmake b/Tests/RunCMake/SolutionGlobalSections/MorePre.cmake new file mode 100644 index 000000000..07f4eb8fc --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/MorePre.cmake @@ -0,0 +1,2 @@ +set_property(DIRECTORY PROPERTY VS_GLOBAL_SECTION_PRE_TestSec1 Key1=Value1 "Key2=Value with spaces") +set_property(DIRECTORY PROPERTY VS_GLOBAL_SECTION_PRE_TestSec3 Key3=Value1 "Key4=Value with spaces" "Key5 = ValueWithoutSpaces") diff --git a/Tests/RunCMake/SolutionGlobalSections/OnePost-check.cmake b/Tests/RunCMake/SolutionGlobalSections/OnePost-check.cmake new file mode 100644 index 000000000..6af51561b --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/OnePost-check.cmake @@ -0,0 +1,4 @@ +parseGlobalSections(pre post OnePost) +testGlobalSection(post TestSec2 Key1=Value1 "Key2=Value with spaces") +testGlobalSection(post ExtensibilityGlobals) +testGlobalSection(post ExtensibilityAddIns) diff --git a/Tests/RunCMake/SolutionGlobalSections/OnePost.cmake b/Tests/RunCMake/SolutionGlobalSections/OnePost.cmake new file mode 100644 index 000000000..2295cfb01 --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/OnePost.cmake @@ -0,0 +1 @@ +set_property(DIRECTORY PROPERTY VS_GLOBAL_SECTION_POST_TestSec2 Key1=Value1 "Key2=Value with spaces") diff --git a/Tests/RunCMake/SolutionGlobalSections/OnePre-check.cmake b/Tests/RunCMake/SolutionGlobalSections/OnePre-check.cmake new file mode 100644 index 000000000..70b18b272 --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/OnePre-check.cmake @@ -0,0 +1,4 @@ +parseGlobalSections(pre post OnePre) +testGlobalSection(pre TestSec1 Key1=Value1 "Key2=Value with spaces") +testGlobalSection(post ExtensibilityGlobals) +testGlobalSection(post ExtensibilityAddIns) diff --git a/Tests/RunCMake/SolutionGlobalSections/OnePre.cmake b/Tests/RunCMake/SolutionGlobalSections/OnePre.cmake new file mode 100644 index 000000000..1499b4780 --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/OnePre.cmake @@ -0,0 +1 @@ +set_property(DIRECTORY PROPERTY VS_GLOBAL_SECTION_PRE_TestSec1 Key1=Value1 "Key2=Value with spaces") diff --git a/Tests/RunCMake/SolutionGlobalSections/Override1-check.cmake b/Tests/RunCMake/SolutionGlobalSections/Override1-check.cmake new file mode 100644 index 000000000..a19e2e1fe --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/Override1-check.cmake @@ -0,0 +1,4 @@ +parseGlobalSections(pre post Override1) +testGlobalSection(post TestSec Key2=Value2 Key3=Value3) +testGlobalSection(post ExtensibilityGlobals Key1=Value1) +testGlobalSection(post ExtensibilityAddIns) diff --git a/Tests/RunCMake/SolutionGlobalSections/Override1.cmake b/Tests/RunCMake/SolutionGlobalSections/Override1.cmake new file mode 100644 index 000000000..a726c9fd2 --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/Override1.cmake @@ -0,0 +1,2 @@ +set_property(DIRECTORY PROPERTY VS_GLOBAL_SECTION_POST_ExtensibilityGlobals Key1=Value1) +set_property(DIRECTORY PROPERTY VS_GLOBAL_SECTION_POST_TestSec Key2=Value2 Key3=Value3) diff --git a/Tests/RunCMake/SolutionGlobalSections/Override2-check.cmake b/Tests/RunCMake/SolutionGlobalSections/Override2-check.cmake new file mode 100644 index 000000000..d9656e15e --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/Override2-check.cmake @@ -0,0 +1,4 @@ +parseGlobalSections(pre post Override2) +testGlobalSection(pre TestSec Key2=Value2 Key3=Value3) +testGlobalSection(post ExtensibilityGlobals) +testGlobalSection(post ExtensibilityAddIns Key1=Value1) diff --git a/Tests/RunCMake/SolutionGlobalSections/Override2.cmake b/Tests/RunCMake/SolutionGlobalSections/Override2.cmake new file mode 100644 index 000000000..0ce43cc0e --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/Override2.cmake @@ -0,0 +1,2 @@ +set_property(DIRECTORY PROPERTY VS_GLOBAL_SECTION_POST_ExtensibilityAddIns Key1=Value1) +set_property(DIRECTORY PROPERTY VS_GLOBAL_SECTION_PRE_TestSec Key2=Value2 Key3=Value3) diff --git a/Tests/RunCMake/SolutionGlobalSections/PrePost-check.cmake b/Tests/RunCMake/SolutionGlobalSections/PrePost-check.cmake new file mode 100644 index 000000000..322a68931 --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/PrePost-check.cmake @@ -0,0 +1,6 @@ +parseGlobalSections(pre post PrePost) +testGlobalSection(post Postsec Key1=Value2) +testGlobalSection(pre Presec Key1=Value1 "Key2=Value with some spaces") +testGlobalSection(post Emptysec) +testGlobalSection(post ExtensibilityGlobals) +testGlobalSection(post ExtensibilityAddIns) diff --git a/Tests/RunCMake/SolutionGlobalSections/PrePost.cmake b/Tests/RunCMake/SolutionGlobalSections/PrePost.cmake new file mode 100644 index 000000000..976c341ed --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/PrePost.cmake @@ -0,0 +1,4 @@ +set_directory_properties(PROPERTIES + VS_GLOBAL_SECTION_POST_Postsec Key1=Value2 + VS_GLOBAL_SECTION_PRE_Presec "Key1=Value1;Key2= Value with some spaces" + VS_GLOBAL_SECTION_POST_Emptysec "") diff --git a/Tests/RunCMake/SolutionGlobalSections/RunCMakeTest.cmake b/Tests/RunCMake/SolutionGlobalSections/RunCMakeTest.cmake new file mode 100644 index 000000000..6ae158d29 --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/RunCMakeTest.cmake @@ -0,0 +1,10 @@ +include(RunCMake) +include(${CMAKE_CURRENT_LIST_DIR}/solution_parsing.cmake) + +run_cmake(OnePre) +run_cmake(OnePost) +run_cmake(MorePre) +run_cmake(MorePost) +run_cmake(PrePost) +run_cmake(Override1) +run_cmake(Override2) diff --git a/Tests/RunCMake/SolutionGlobalSections/solution_parsing.cmake b/Tests/RunCMake/SolutionGlobalSections/solution_parsing.cmake new file mode 100644 index 000000000..dd158efe9 --- /dev/null +++ b/Tests/RunCMake/SolutionGlobalSections/solution_parsing.cmake @@ -0,0 +1,60 @@ +macro(error text) + set(RunCMake_TEST_FAILED "${text}") + return() +endmacro() + + +macro(parseGlobalSections arg_out_pre arg_out_post testName) + set(out_pre ${arg_out_pre}) + set(out_post ${arg_out_post}) + set(sln "${RunCMake_TEST_BINARY_DIR}/${testName}.sln") + if(NOT EXISTS "${sln}") + error("Expected solution file ${sln} does not exist") + endif() + file(STRINGS "${sln}" lines) + set(sectionLines "") + set(store FALSE) + foreach(line IN LISTS lines) + if(line MATCHES "^\t*Global\n?$") + set(store TRUE) + elseif(line MATCHES "^\t*EndGlobal\n?$") + set(store FALSE) + elseif(store) + list(APPEND sectionLines "${line}") + endif() + endforeach() + set(sectionName "") + set(sectionType "") + foreach(line IN LISTS sectionLines) + if(line MATCHES "^\t*GlobalSection\\((.*)\\) *= *(pre|post)Solution\n?$") + set(sectionName "${CMAKE_MATCH_1}") + set(sectionType ${CMAKE_MATCH_2}) + list(APPEND ${out_${sectionType}} "${sectionName}") + if(DEFINED ${out_${sectionType}}_${sectionName}) + error("Section ${sectionName} defined twice") + endif() + set(${out_${sectionType}}_${sectionName} "") + elseif(line MATCHES "\t*EndGlobalSection\n?$") + set(sectionName "") + set(sectionType "") + elseif(sectionName) + string(REGEX MATCH "^\t*([^=]*)=([^\n]*)\n?$" matches "${line}") + if(NOT matches) + error("Bad syntax in solution file: '${line}'") + endif() + string(STRIP "${CMAKE_MATCH_1}" key) + string(STRIP "${CMAKE_MATCH_2}" value) + list(APPEND ${out_${sectionType}}_${sectionName} "${key}=${value}") + endif() + endforeach() +endmacro() + + +macro(testGlobalSection prefix sectionName) + if(NOT DEFINED ${prefix}_${sectionName}) + error("Section ${sectionName} does not exist") + endif() + if(NOT "${${prefix}_${sectionName}}" STREQUAL "${ARGN}") + error("Section ${sectionName} content mismatch\n expected: ${ARGN}\n actual: ${${prefix}_${sectionName}}") + endif() +endmacro() diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-stderr.txt new file mode 100644 index 000000000..9c146e057 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at BadInvalidName1.cmake:7 \(include_directories\): + Error evaluating generator expression: + + \$ + + Target name not supported. +Call Stack \(most recent call first\): + CMakeLists.txt:8 \(include\) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1.cmake new file mode 100644 index 000000000..d5f661d60 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1.cmake @@ -0,0 +1,7 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +include_directories("$") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-stderr.txt new file mode 100644 index 000000000..451888cc6 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at BadInvalidName2.cmake:7 \(include_directories\): + Error evaluating generator expression: + + \$ + + Target name and property name not supported. +Call Stack \(most recent call first\): + CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2.cmake new file mode 100644 index 000000000..6e4c1d0d3 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2.cmake @@ -0,0 +1,7 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +include_directories("$") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-stderr.txt new file mode 100644 index 000000000..39692c4ef --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at BadInvalidName3.cmake:7 \(include_directories\): + Error evaluating generator expression: + + \$ + + Property name not supported. +Call Stack \(most recent call first\): + CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3.cmake new file mode 100644 index 000000000..3f75aa382 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3.cmake @@ -0,0 +1,7 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +include_directories("$") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-stderr.txt new file mode 100644 index 000000000..c3aa1b1a9 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at BadInvalidName4.cmake:9 \(include_directories\): + Error evaluating generator expression: + + \$ + + Property name not supported. +Call Stack \(most recent call first\): + CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4.cmake new file mode 100644 index 000000000..b616c3106 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4.cmake @@ -0,0 +1,9 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(foo "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +include_directories("$") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-stderr.txt new file mode 100644 index 000000000..1c6fad4b0 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at BadInvalidName5.cmake:7 \(include_directories\): + Error evaluating generator expression: + + \$ + + \$ expression requires a non-empty target name and + property name. +Call Stack \(most recent call first\): + CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5.cmake new file mode 100644 index 000000000..11cb6fa52 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5.cmake @@ -0,0 +1,7 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +include_directories("$") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-stderr.txt new file mode 100644 index 000000000..8b147dca6 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at BadInvalidName6.cmake:7 \(include_directories\): + Error evaluating generator expression: + + \$ + + \$ expression requires a non-empty target name. +Call Stack \(most recent call first\): + CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6.cmake new file mode 100644 index 000000000..bf868a501 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6.cmake @@ -0,0 +1,7 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +include_directories("$") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-stderr.txt new file mode 100644 index 000000000..dad6bf86a --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at BadInvalidName7.cmake:9 \(include_directories\): + Error evaluating generator expression: + + \$ + + \$ expression requires a non-empty property name. +Call Stack \(most recent call first\): + CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7.cmake new file mode 100644 index 000000000..36d1a7903 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7.cmake @@ -0,0 +1,9 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(foo "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +include_directories("$") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-stderr.txt new file mode 100644 index 000000000..4e8c14c99 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at BadInvalidName8.cmake:7 \(include_directories\): + Error evaluating generator expression: + + \$ + + \$ expression requires a non-empty property name. +Call Stack \(most recent call first\): + CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8.cmake new file mode 100644 index 000000000..f059288c6 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8.cmake @@ -0,0 +1,7 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +include_directories("$") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt new file mode 100644 index 000000000..3b3bab07d --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at BadNonTarget.cmake:7 \(include_directories\): + Error evaluating generator expression: + + \$ + + Target "NonExistant" not found. +Call Stack \(most recent call first\): + CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget.cmake new file mode 100644 index 000000000..b020c0821 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget.cmake @@ -0,0 +1,7 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +include_directories("$") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1-stderr.txt new file mode 100644 index 000000000..791c4a9b3 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + Self reference on target "TargetPropertyGeneratorExpressions".$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1.cmake new file mode 100644 index 000000000..a85731ecf --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1.cmake @@ -0,0 +1,7 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +include_directories("$") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2-stderr.txt new file mode 100644 index 000000000..791c4a9b3 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + Self reference on target "TargetPropertyGeneratorExpressions".$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2.cmake new file mode 100644 index 000000000..f1459b8cb --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2.cmake @@ -0,0 +1,9 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +set_property(TARGET TargetPropertyGeneratorExpressions PROPERTY + INCLUDE_DIRECTORIES "$" +) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3-stderr.txt new file mode 100644 index 000000000..f60d72632 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + Self reference on target "TargetPropertyGeneratorExpressions".$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3.cmake new file mode 100644 index 000000000..433b73011 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3.cmake @@ -0,0 +1,8 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +include_directories( + "$") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4-stderr.txt new file mode 100644 index 000000000..f60d72632 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + Self reference on target "TargetPropertyGeneratorExpressions".$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4.cmake new file mode 100644 index 000000000..4b6445916 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4.cmake @@ -0,0 +1,10 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +set_property(TARGET TargetPropertyGeneratorExpressions PROPERTY +INCLUDE_DIRECTORIES + "$" +) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5-stderr.txt new file mode 100644 index 000000000..2b22d0fc3 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + Self reference on target "TargetPropertyGeneratorExpressions".$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5.cmake new file mode 100644 index 000000000..74fff674d --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5.cmake @@ -0,0 +1,10 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +set_property(TARGET TargetPropertyGeneratorExpressions +PROPERTY + COMPILE_DEFINITIONS "$" +) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6-stderr.txt new file mode 100644 index 000000000..fe7caa3c3 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + Self reference on target "TargetPropertyGeneratorExpressions".$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6.cmake new file mode 100644 index 000000000..d6650d3a5 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6.cmake @@ -0,0 +1,10 @@ + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main(int, char **) { return 0; }\n") + +add_executable(TargetPropertyGeneratorExpressions + "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +set_property(TARGET TargetPropertyGeneratorExpressions PROPERTY +COMPILE_DEFINITIONS + "$" +) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/CMakeLists.txt new file mode 100644 index 000000000..22577da4a --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/CMakeLists.txt @@ -0,0 +1,8 @@ + +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} CXX) + +# MSVC creates extra targets which pollute the stderr unless we set this. +set(CMAKE_SUPPRESS_REGENERATION TRUE) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake new file mode 100644 index 000000000..0ee32387d --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake @@ -0,0 +1,17 @@ +include(RunCMake) + +run_cmake(BadSelfReference1) +run_cmake(BadSelfReference2) +run_cmake(BadSelfReference3) +run_cmake(BadSelfReference4) +run_cmake(BadSelfReference5) +run_cmake(BadSelfReference6) +run_cmake(BadNonTarget) +run_cmake(BadInvalidName1) +run_cmake(BadInvalidName2) +run_cmake(BadInvalidName3) +run_cmake(BadInvalidName4) +run_cmake(BadInvalidName5) +run_cmake(BadInvalidName6) +run_cmake(BadInvalidName7) +run_cmake(BadInvalidName8) diff --git a/Tests/RunCMake/build_command/BeforeProject-result.txt b/Tests/RunCMake/build_command/BeforeProject-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/build_command/BeforeProject-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/build_command/BeforeProject-stderr.txt b/Tests/RunCMake/build_command/BeforeProject-stderr.txt new file mode 100644 index 000000000..d3d766163 --- /dev/null +++ b/Tests/RunCMake/build_command/BeforeProject-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at BeforeProject.cmake:[0-9]+ \(build_command\): + build_command\(\) requires CMAKE_MAKE_PROGRAM to be defined. Call project\(\) + or enable_language\(\) first. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/build_command/BeforeProject.cmake b/Tests/RunCMake/build_command/BeforeProject.cmake new file mode 100644 index 000000000..15788d15b --- /dev/null +++ b/Tests/RunCMake/build_command/BeforeProject.cmake @@ -0,0 +1,2 @@ +build_command(MAKECOMMAND_DEFAULT_VALUE) +project(${RunCMake_TEST} NONE) diff --git a/Tests/RunCMake/build_command/CMakeLists.txt b/Tests/RunCMake/build_command/CMakeLists.txt index 0fbb94803..f6e84c04d 100644 --- a/Tests/RunCMake/build_command/CMakeLists.txt +++ b/Tests/RunCMake/build_command/CMakeLists.txt @@ -1,59 +1,5 @@ cmake_minimum_required(VERSION 2.8) -project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake) - -# This CMakeLists file is *sometimes expected* to result in a configure error. -# -# expect this to succeed: -# ../bin/Release/cmake -G Xcode -# ../../CMake/Tests/CMakeCommands/build_command -# -# expect this to fail: -# ../bin/Release/cmake -DTEST_ERROR_CONDITIONS:BOOL=ON -G Xcode -# ../../CMake/Tests/CMakeCommands/build_command -# -# This project exists merely to test the CMake command 'build_command'... -# ...even purposefully calling it with known-bad argument lists to cover -# error handling code. -# - -set(cmd "initial") - -message("0. begin") - -if(TEST_ERROR_CONDITIONS) - # Test with no arguments (an error): - build_command() - message("1. cmd='${cmd}'") - - # Test with unknown arguments (also an error): - build_command(cmd BOGUS STUFF) - message("2. cmd='${cmd}'") - - build_command(cmd STUFF BOGUS) - message("3. cmd='${cmd}'") -else() - message("(skipping cases 1, 2 and 3 because TEST_ERROR_CONDITIONS is OFF)") +if(NOT NoProject) + project(${RunCMake_TEST} NONE) endif() - -# Test the one arg signature with none of the optional KEYWORD arguments: -build_command(cmd) -message("4. cmd='${cmd}'") - -# Test the two-arg legacy signature: -build_command(legacy_cmd ${CMAKE_BUILD_TOOL}) -message("5. legacy_cmd='${legacy_cmd}'") -message(" CMAKE_BUILD_TOOL='${CMAKE_BUILD_TOOL}'") - -# Test the optional KEYWORDs: -build_command(cmd CONFIGURATION hoohaaConfig) -message("6. cmd='${cmd}'") - -build_command(cmd PROJECT_NAME hoohaaProject) -message("7. cmd='${cmd}'") - -build_command(cmd TARGET hoohaaTarget) -message("8. cmd='${cmd}'") - -set(cmd "final") -message("9. cmd='${cmd}'") +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/build_command/ErrorsCommon.cmake b/Tests/RunCMake/build_command/ErrorsCommon.cmake new file mode 100644 index 000000000..d22453916 --- /dev/null +++ b/Tests/RunCMake/build_command/ErrorsCommon.cmake @@ -0,0 +1,55 @@ +# This CMakeLists file is *sometimes expected* to result in a configure error. +# +# expect this to succeed: +# ../bin/Release/cmake -G Xcode +# ../../CMake/Tests/CMakeCommands/build_command +# +# expect this to fail: +# ../bin/Release/cmake -DTEST_ERROR_CONDITIONS:BOOL=ON -G Xcode +# ../../CMake/Tests/CMakeCommands/build_command +# +# This project exists merely to test the CMake command 'build_command'... +# ...even purposefully calling it with known-bad argument lists to cover +# error handling code. +# + +set(cmd "initial") + +message("0. begin") + +if(TEST_ERROR_CONDITIONS) + # Test with no arguments (an error): + build_command() + message("1. cmd='${cmd}'") + + # Test with unknown arguments (also an error): + build_command(cmd BOGUS STUFF) + message("2. cmd='${cmd}'") + + build_command(cmd STUFF BOGUS) + message("3. cmd='${cmd}'") +else() + message("(skipping cases 1, 2 and 3 because TEST_ERROR_CONDITIONS is OFF)") +endif() + +# Test the one arg signature with none of the optional KEYWORD arguments: +build_command(cmd) +message("4. cmd='${cmd}'") + +# Test the two-arg legacy signature: +build_command(legacy_cmd ${CMAKE_BUILD_TOOL}) +message("5. legacy_cmd='${legacy_cmd}'") +message(" CMAKE_BUILD_TOOL='${CMAKE_BUILD_TOOL}'") + +# Test the optional KEYWORDs: +build_command(cmd CONFIGURATION hoohaaConfig) +message("6. cmd='${cmd}'") + +build_command(cmd PROJECT_NAME hoohaaProject) +message("7. cmd='${cmd}'") + +build_command(cmd TARGET hoohaaTarget) +message("8. cmd='${cmd}'") + +set(cmd "final") +message("9. cmd='${cmd}'") diff --git a/Tests/RunCMake/build_command/ErrorsOFF.cmake b/Tests/RunCMake/build_command/ErrorsOFF.cmake index a243fab01..7b9cac647 100644 --- a/Tests/RunCMake/build_command/ErrorsOFF.cmake +++ b/Tests/RunCMake/build_command/ErrorsOFF.cmake @@ -1 +1,2 @@ set(TEST_ERROR_CONDITIONS OFF) +include(ErrorsCommon.cmake) diff --git a/Tests/RunCMake/build_command/ErrorsON-stderr.txt b/Tests/RunCMake/build_command/ErrorsON-stderr.txt index 0be7475d7..47a84d674 100644 --- a/Tests/RunCMake/build_command/ErrorsON-stderr.txt +++ b/Tests/RunCMake/build_command/ErrorsON-stderr.txt @@ -1,12 +1,21 @@ -CMake Error at CMakeLists.txt:[0-9]+ \(build_command\): +CMake Error at ErrorsCommon.cmake:[0-9]+ \(build_command\): build_command requires at least one argument naming a CMake variable +Call Stack \(most recent call first\): + ErrorsON.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) + 1. cmd='initial' -CMake Error at CMakeLists.txt:[0-9]+ \(build_command\): +CMake Error at ErrorsCommon.cmake:[0-9]+ \(build_command\): build_command unknown argument "BOGUS" +Call Stack \(most recent call first\): + ErrorsON.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) + 2. cmd='initial' -CMake Error at CMakeLists.txt:[0-9]+ \(build_command\): +CMake Error at ErrorsCommon.cmake:[0-9]+ \(build_command\): build_command unknown argument "STUFF" +Call Stack \(most recent call first\): + ErrorsON.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/build_command/ErrorsON.cmake b/Tests/RunCMake/build_command/ErrorsON.cmake index 27814bf64..d7b709b87 100644 --- a/Tests/RunCMake/build_command/ErrorsON.cmake +++ b/Tests/RunCMake/build_command/ErrorsON.cmake @@ -1 +1,2 @@ set(TEST_ERROR_CONDITIONS ON) +include(ErrorsCommon.cmake) diff --git a/Tests/RunCMake/build_command/RunCMakeTest.cmake b/Tests/RunCMake/build_command/RunCMakeTest.cmake index 4525c5725..eaa1d77d8 100644 --- a/Tests/RunCMake/build_command/RunCMakeTest.cmake +++ b/Tests/RunCMake/build_command/RunCMakeTest.cmake @@ -2,3 +2,7 @@ include(RunCMake) run_cmake(ErrorsOFF) run_cmake(ErrorsON) + +set(RunCMake_TEST_OPTIONS -DNoProject=1) +run_cmake(BeforeProject) +unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/include_directories/CMakeLists.txt b/Tests/RunCMake/include_directories/CMakeLists.txt new file mode 100644 index 000000000..e8db6b05b --- /dev/null +++ b/Tests/RunCMake/include_directories/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/include_directories/DebugIncludes-result.txt b/Tests/RunCMake/include_directories/DebugIncludes-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/include_directories/DebugIncludes-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt b/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt new file mode 100644 index 000000000..63aec9052 --- /dev/null +++ b/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt @@ -0,0 +1,44 @@ +CMake Debug Log at DebugIncludes.cmake:8 \(include_directories\): + Used includes for target lll: + + \* .*/Tests/RunCMake/include_directories/one + \* .*/Tests/RunCMake/include_directories/two + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Debug Log at DebugIncludes.cmake:13 \(set_property\): + Used includes for target lll: + + \* .*/Tests/RunCMake/include_directories/three + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Debug Log at DebugIncludes.cmake:18 \(include_directories\): + Used includes for target lll: + + \* .*/Tests/RunCMake/include_directories/four + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Debug Log at DebugIncludes.cmake:33 \(set_property\): + Used includes for target lll: + + \* .*/Tests/RunCMake/include_directories/five + \* .*/Tests/RunCMake/include_directories/six + \* .*/Tests/RunCMake/include_directories/seven + +Call Stack \(most recent call first\): + DebugIncludes.cmake:44 \(some_macro\) + DebugIncludes.cmake:47 \(some_function\) + CMakeLists.txt:3 \(include\) ++ +CMake Debug Log at DebugIncludes.cmake:30 \(target_link_libraries\): + Used includes for target lll: + + \* .*/Tests/RunCMake/include_directories/eight + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/include_directories/DebugIncludes.cmake b/Tests/RunCMake/include_directories/DebugIncludes.cmake new file mode 100644 index 000000000..de3689956 --- /dev/null +++ b/Tests/RunCMake/include_directories/DebugIncludes.cmake @@ -0,0 +1,47 @@ + +project(DebugIncludes) + +set(CMAKE_DEBUG_TARGET_PROPERTIES INCLUDE_DIRECTORIES) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/DebugIncludes.cpp" "enum { dummy };\n") + +include_directories( + "${CMAKE_CURRENT_SOURCE_DIR}/one" + "${CMAKE_CURRENT_SOURCE_DIR}/two" +) + +set_property(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES + "${CMAKE_CURRENT_SOURCE_DIR}/three") + +add_library(lll "${CMAKE_CURRENT_BINARY_DIR}/DebugIncludes.cpp") + +include_directories( + "${CMAKE_CURRENT_SOURCE_DIR}/two" + "${CMAKE_CURRENT_SOURCE_DIR}/three" + "${CMAKE_CURRENT_SOURCE_DIR}/four" +) + +add_library(foo "${CMAKE_CURRENT_BINARY_DIR}/DebugIncludes.cpp") +target_include_directories(foo + INTERFACE + "${CMAKE_CURRENT_SOURCE_DIR}/seven" + "${CMAKE_CURRENT_SOURCE_DIR}/eight" +) +target_link_libraries(lll foo) + +macro(some_macro) + set_property(TARGET lll APPEND PROPERTY + INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/one" + "${CMAKE_CURRENT_SOURCE_DIR}/three" + "${CMAKE_CURRENT_SOURCE_DIR}/four" + "${CMAKE_CURRENT_SOURCE_DIR}/five" + "${CMAKE_CURRENT_SOURCE_DIR}/six" + "${CMAKE_CURRENT_SOURCE_DIR}/seven" + ) +endmacro() + +function(some_function) + some_macro() +endfunction() + +some_function() diff --git a/Tests/RunCMake/include_directories/NotFoundContent-result.txt b/Tests/RunCMake/include_directories/NotFoundContent-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/include_directories/NotFoundContent-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include_directories/NotFoundContent-stderr.txt b/Tests/RunCMake/include_directories/NotFoundContent-stderr.txt new file mode 100644 index 000000000..f608d633f --- /dev/null +++ b/Tests/RunCMake/include_directories/NotFoundContent-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: The following variables are used in this project, but they are set to NOTFOUND. +Please set them or make sure they are set and tested correctly in the CMake files: +NotThere1 + used as include directory in directory .* +NotThere2 + used as include directory in directory .* diff --git a/Tests/RunCMake/include_directories/NotFoundContent.cmake b/Tests/RunCMake/include_directories/NotFoundContent.cmake new file mode 100644 index 000000000..9677e0c43 --- /dev/null +++ b/Tests/RunCMake/include_directories/NotFoundContent.cmake @@ -0,0 +1,9 @@ + +include_directories(NotThere1-NOTFOUND) + +include_directories($<1:There1-NOTFOUND>) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp" "int main(int,char**) { return 0; }\n") +add_executable(dummy "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp") +set_property(TARGET dummy APPEND PROPERTY INCLUDE_DIRECTORIES "NotThere2-NOTFOUND") +set_property(TARGET dummy APPEND PROPERTY INCLUDE_DIRECTORIES "$<1:There2-NOTFOUND>") diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake new file mode 100644 index 000000000..ddf268c1e --- /dev/null +++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(NotFoundContent) +run_cmake(DebugIncludes) +run_cmake(TID-bad-target) diff --git a/Tests/RunCMake/include_directories/TID-bad-target-result.txt b/Tests/RunCMake/include_directories/TID-bad-target-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/include_directories/TID-bad-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include_directories/TID-bad-target-stderr.txt b/Tests/RunCMake/include_directories/TID-bad-target-stderr.txt new file mode 100644 index 000000000..481e358b2 --- /dev/null +++ b/Tests/RunCMake/include_directories/TID-bad-target-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at TID-bad-target.cmake:6 \(target_include_directories\): + target_include_directories called with non-compilable target type +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/include_directories/TID-bad-target.cmake b/Tests/RunCMake/include_directories/TID-bad-target.cmake new file mode 100644 index 000000000..32201c1fb --- /dev/null +++ b/Tests/RunCMake/include_directories/TID-bad-target.cmake @@ -0,0 +1,6 @@ + +add_custom_target(check ALL + COMMAND ${CMAKE_COMMAND} -E echo check +) + +target_include_directories(check PRIVATE somedir) diff --git a/Tests/RunCMake/include_external_msproject/check_utils.cmake b/Tests/RunCMake/include_external_msproject/check_utils.cmake index 7d6b8f8ea..7f5ef5394 100644 --- a/Tests/RunCMake/include_external_msproject/check_utils.cmake +++ b/Tests/RunCMake/include_external_msproject/check_utils.cmake @@ -8,8 +8,8 @@ macro(check_line_exists TARGET_FILE REG_EXP_REF) if(_VAR_LEN GREATER 0) set(IS_FOUND "TRUE") - endif(_VAR_LEN GREATER 0) -endmacro(check_line_exists TARGET_FILE REG_EXP_REF) + endif() +endmacro() # Search and parse project section line by project name. # If search was successful stores found type and guid into FOUND_TYPE and FOUND_GUID variables respectively. @@ -20,13 +20,13 @@ macro(parse_project_section TARGET_FILE PROJECT_NAME) check_line_exists(${TARGET_FILE} REG_EXP) if(NOT IS_FOUND) return() - endif(NOT IS_FOUND) + endif() string(REGEX REPLACE "${REG_EXP}" "\\1;\\2" _GUIDS "${FOUND_LINE}") list(GET _GUIDS 0 FOUND_TYPE) list(GET _GUIDS 1 FOUND_GUID) -endmacro(parse_project_section TARGET_FILE PROJECT_NAME) +endmacro() # Search project section line by project name and type. # Returns TRUE if found and FALSE otherwise @@ -36,8 +36,8 @@ function(check_project_type TARGET_FILE PROJECT_NAME PROJECT_TYPE RESULT) parse_project_section(${TARGET_FILE} ${PROJECT_NAME}) if(IS_FOUND AND FOUND_TYPE STREQUAL PROJECT_TYPE) set(${RESULT} "TRUE" PARENT_SCOPE) - endif(IS_FOUND AND FOUND_TYPE STREQUAL PROJECT_TYPE) -endfunction(check_project_type TARGET_FILE PROJECT_NAME PROJECT_TYPE RESULT) + endif() +endfunction() # Search project section line by project name and id. @@ -48,8 +48,8 @@ function(check_project_guid TARGET_FILE PROJECT_NAME PROJECT_GUID RESULT) parse_project_section(${TARGET_FILE} ${PROJECT_NAME}) if(IS_FOUND AND FOUND_GUID STREQUAL PROJECT_GUID) set(${RESULT} "TRUE" PARENT_SCOPE) - endif(IS_FOUND AND FOUND_GUID STREQUAL PROJECT_GUID) -endfunction(check_project_guid TARGET_FILE PROJECT_NAME PROJECT_GUID RESULT) + endif() +endfunction() # Search project's build configuration line by project name and target platform name. @@ -61,7 +61,7 @@ function(check_custom_platform TARGET_FILE PROJECT_NAME PLATFORM_NAME RESULT) parse_project_section(${TARGET_FILE} ${PROJECT_NAME}) if(NOT IS_FOUND) return() - endif(NOT IS_FOUND) + endif() # probably whould be better to use configuration name # extracted from CMAKE_CONFIGURATION_TYPES than just hardcoded "Debug" instead @@ -69,7 +69,7 @@ function(check_custom_platform TARGET_FILE PROJECT_NAME PLATFORM_NAME RESULT) check_line_exists(${TARGET_FILE} REG_EXP) set(${RESULT} ${IS_FOUND} PARENT_SCOPE) -endfunction(check_custom_platform TARGET_FILE PLATFORM_NAME RESULT) +endfunction() # RunCMake test check helper function(check_project test name guid type platform) diff --git a/Tests/RuntimePath/CMakeLists.txt b/Tests/RuntimePath/CMakeLists.txt index 2164cdb8d..6583a8712 100644 --- a/Tests/RuntimePath/CMakeLists.txt +++ b/Tests/RuntimePath/CMakeLists.txt @@ -30,4 +30,4 @@ if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG) set_property(TARGET bar2 PROPERTY OUTPUT_NAME bar) set_property(TARGET bar2 PROPERTY LIBRARY_OUTPUT_DIRECTORY A) target_link_libraries(bar2 foo2) -endif(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG) +endif() diff --git a/Tests/SameName/CMakeLists.txt b/Tests/SameName/CMakeLists.txt index a4b993cfd..d78879dd9 100644 --- a/Tests/SameName/CMakeLists.txt +++ b/Tests/SameName/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(SameName C) +project(SameName C) -ADD_SUBDIRECTORY(Lib1) +add_subdirectory(Lib1) -INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/Lib1) -ADD_SUBDIRECTORY(Exe1) +include_directories(${PROJECT_SOURCE_DIR}/Lib1) +add_subdirectory(Exe1) diff --git a/Tests/SameName/Exe1/CMakeLists.txt b/Tests/SameName/Exe1/CMakeLists.txt index 3917a2f6b..b9182f209 100644 --- a/Tests/SameName/Exe1/CMakeLists.txt +++ b/Tests/SameName/Exe1/CMakeLists.txt @@ -1,11 +1,11 @@ # a target with the same name as a target in a different dir -ADD_EXECUTABLE(mytest_exe conly.c) -SET_TARGET_PROPERTIES(mytest_exe PROPERTIES OUTPUT_NAME mytest) -TARGET_LINK_LIBRARIES(mytest_exe mytest) +add_executable(mytest_exe conly.c) +set_target_properties(mytest_exe PROPERTIES OUTPUT_NAME mytest) +target_link_libraries(mytest_exe mytest) # and two targets in the same dir with the same name -ADD_LIBRARY(mytest2 ../Lib1/libc1.c) +add_library(mytest2 ../Lib1/libc1.c) -ADD_EXECUTABLE(mytest2_exe conly.c) -SET_TARGET_PROPERTIES(mytest2_exe PROPERTIES OUTPUT_NAME mytest2) -TARGET_LINK_LIBRARIES(mytest2_exe mytest2) +add_executable(mytest2_exe conly.c) +set_target_properties(mytest2_exe PROPERTIES OUTPUT_NAME mytest2) +target_link_libraries(mytest2_exe mytest2) diff --git a/Tests/SameName/Lib1/CMakeLists.txt b/Tests/SameName/Lib1/CMakeLists.txt index 67e7f6843..40fa15422 100644 --- a/Tests/SameName/Lib1/CMakeLists.txt +++ b/Tests/SameName/Lib1/CMakeLists.txt @@ -1 +1 @@ -ADD_LIBRARY(mytest libc1.c) +add_library(mytest libc1.c) diff --git a/Tests/SetLang/CMakeLists.txt b/Tests/SetLang/CMakeLists.txt index ab6570c33..f24e5cb5d 100644 --- a/Tests/SetLang/CMakeLists.txt +++ b/Tests/SetLang/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.6) project(SetLang) # force this to be verbose so I can debug a dashboard entry -SET(CMAKE_VERBOSE_MAKEFILE 1) +set(CMAKE_VERBOSE_MAKEFILE 1) add_library(foo foo.c) add_executable(SetLang bar.c) set_source_files_properties(foo.c bar.c PROPERTIES LANGUAGE CXX) diff --git a/Tests/Simple/CMakeLists.txt b/Tests/Simple/CMakeLists.txt index dc965a733..a951c2da2 100644 --- a/Tests/Simple/CMakeLists.txt +++ b/Tests/Simple/CMakeLists.txt @@ -3,9 +3,9 @@ project (Simple) add_executable (Simple simple.cxx) -add_library (simpleLib STATIC - simpleLib.cxx - simpleCLib.c +add_library (simpleLib STATIC + simpleLib.cxx + simpleCLib.c simpleWe.cpp ) @@ -14,4 +14,4 @@ target_link_libraries (Simple simpleLib) # make sure optimized libs are not used by debug builds if(CMAKE_BUILD_TYPE MATCHES Debug) target_link_libraries(Simple optimized c:/not/here.lib ) -endif(CMAKE_BUILD_TYPE MATCHES Debug) +endif() diff --git a/Tests/Simple/simpleWe.cpp b/Tests/Simple/simpleWe.cpp index 859e07c06..e0f22ef8d 100644 --- a/Tests/Simple/simpleWe.cpp +++ b/Tests/Simple/simpleWe.cpp @@ -1,6 +1,6 @@ #include -class Foo +class Foo { public: Foo() diff --git a/Tests/SimpleCOnly/CMakeLists.txt b/Tests/SimpleCOnly/CMakeLists.txt index d0ed651b1..fb247790f 100644 --- a/Tests/SimpleCOnly/CMakeLists.txt +++ b/Tests/SimpleCOnly/CMakeLists.txt @@ -14,4 +14,4 @@ message(STATUS "sizeof(float): ${SIZE_FLOAT}") # make sure optimized libs are not used by debug builds if(CMAKE_BUILD_TYPE MATCHES Debug) target_link_libraries(Simple optimized c:/not/here.lib ) -endif(CMAKE_BUILD_TYPE MATCHES Debug) +endif() diff --git a/Tests/SimpleCOnly/main.c b/Tests/SimpleCOnly/main.c index e4df685cb..022a8e88d 100644 --- a/Tests/SimpleCOnly/main.c +++ b/Tests/SimpleCOnly/main.c @@ -3,7 +3,7 @@ extern int foo(); extern int bar(); -int main() +int main() { int i=foo(); int k=bar(); diff --git a/Tests/SimpleExclude/run.cmake.in b/Tests/SimpleExclude/run.cmake.in index 8f83380c8..d31d2e51b 100644 --- a/Tests/SimpleExclude/run.cmake.in +++ b/Tests/SimpleExclude/run.cmake.in @@ -8,6 +8,6 @@ message("T9 ${t9_name} resulted ${t9_var}") if ( "${t4_var}" EQUAL "0" AND "${t9_var}" EQUAL "0" ) message("Everything is good, Yoshimi won...") -else ( "${t4_var}" EQUAL "0" AND "${t9_var}" EQUAL "0" ) +else () message(FATAL_ERROR "Yoshimi lost... The evil pink robots will take over the world") -endif ( "${t4_var}" EQUAL "0" AND "${t9_var}" EQUAL "0" ) +endif () diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index 378b5292b..479d6ec36 100644 --- a/Tests/SimpleInstall/CMakeLists.txt +++ b/Tests/SimpleInstall/CMakeLists.txt @@ -1,216 +1,216 @@ cmake_minimum_required (VERSION 2.6) -PROJECT (TestSimpleInstall) -SET(CMAKE_VERBOSE_MAKEFILE 1) -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY +project (TestSimpleInstall) +set(CMAKE_VERBOSE_MAKEFILE 1) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${TestSimpleInstall_BINARY_DIR}/bin") -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${TestSimpleInstall_BINARY_DIR}/lib/static") -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${TestSimpleInstall_BINARY_DIR}/lib") # Skip generating the rpath pointing at the build tree to make sure # the executable is installed with the proper rpath in the install # tree. -SET(CMAKE_SKIP_BUILD_RPATH 1) +set(CMAKE_SKIP_BUILD_RPATH 1) # Make sure the executable can run from the install tree. -SET(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) +set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) # Skip the dependency that causes a build when installing. This # avoids infinite loops when the post-build rule below installs. -SET(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1) -SET(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1) +set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1) +set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1) -SET(CMAKE_DEBUG_POSTFIX "_test_debug_postfix") +set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix") -SET(EXTRA_INSTALL_FLAGS) -MESSAGE("Extra install: ${EXTRA_INSTALL_FLAGS}") +set(EXTRA_INSTALL_FLAGS) +message("Extra install: ${EXTRA_INSTALL_FLAGS}") -IF(STAGE2) - SET(LIBPATHS +if(STAGE2) + set(LIBPATHS ${CMAKE_INSTALL_PREFIX}/MyTest/lib/static ${CMAKE_INSTALL_PREFIX}/MyTest/lib ) - SET(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX} test1rel) - SET(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX}) - SET(t4NAMES test4out test4out${CMAKE_DEBUG_POSTFIX}) + set(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX} test1rel) + set(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX}) + set(t4NAMES test4out test4out${CMAKE_DEBUG_POSTFIX}) # Make sure the install script ran. - SET(CMAKE_INSTALL_SCRIPT_DID_RUN 0) - INCLUDE(${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake OPTIONAL) - IF(CMAKE_INSTALL_SCRIPT_DID_RUN) - MESSAGE(STATUS "Stage 1 did run install script 2.") - ELSE(CMAKE_INSTALL_SCRIPT_DID_RUN) - MESSAGE(SEND_ERROR "Stage 1 did not run install script 2.") - ENDIF(CMAKE_INSTALL_SCRIPT_DID_RUN) - - IF(CYGWIN OR MINGW) - SET(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/MyTest/bin") - ENDIF(CYGWIN OR MINGW) - MESSAGE("Search for library in: ${LIBPATHS}") - - SET(TEST1_LIBRARY "TEST1_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - SET(TEST2_LIBRARY "TEST2_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - SET(TEST4_LIBRARY "TEST4_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - - FIND_LIBRARY(TEST1_LIBRARY + set(CMAKE_INSTALL_SCRIPT_DID_RUN 0) + include(${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake OPTIONAL) + if(CMAKE_INSTALL_SCRIPT_DID_RUN) + message(STATUS "Stage 1 did run install script 2.") + else() + message(SEND_ERROR "Stage 1 did not run install script 2.") + endif() + + if(CYGWIN OR MINGW) + set(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/MyTest/bin") + endif() + message("Search for library in: ${LIBPATHS}") + + set(TEST1_LIBRARY "TEST1_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) + set(TEST2_LIBRARY "TEST2_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) + set(TEST4_LIBRARY "TEST4_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) + + find_library(TEST1_LIBRARY NAMES ${t1NAMES} PATHS ${LIBPATHS} DOC "First library") - FIND_LIBRARY(TEST2_LIBRARY + find_library(TEST2_LIBRARY NAMES ${t2NAMES} PATHS ${LIBPATHS} DOC "Second library") - FIND_LIBRARY(TEST4_LIBRARY + find_library(TEST4_LIBRARY NAMES ${t4NAMES} PATHS ${LIBPATHS} DOC "Fourth library") # Test importing a library found on disk. - ADD_LIBRARY(lib_test4 UNKNOWN IMPORTED) - SET_PROPERTY(TARGET lib_test4 PROPERTY IMPORTED_LOCATION ${TEST4_LIBRARY}) + add_library(lib_test4 UNKNOWN IMPORTED) + set_property(TARGET lib_test4 PROPERTY IMPORTED_LOCATION ${TEST4_LIBRARY}) - INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/MyTest/include) - ADD_EXECUTABLE (SimpleInstExeS2 inst2.cxx foo.c foo.h) - TARGET_LINK_LIBRARIES(SimpleInstExeS2 ${TEST1_LIBRARY} ${TEST2_LIBRARY} lib_test4) - SET(install_target SimpleInstExeS2) + include_directories(${CMAKE_INSTALL_PREFIX}/MyTest/include) + add_executable (SimpleInstExeS2 inst2.cxx foo.c foo.h) + target_link_libraries(SimpleInstExeS2 ${TEST1_LIBRARY} ${TEST2_LIBRARY} lib_test4) + set(install_target SimpleInstExeS2) - IF("${TEST1_LIBRARY}" MATCHES "static") - MESSAGE(STATUS "test1 correctly found in lib/static") - ELSE("${TEST1_LIBRARY}" MATCHES "static") - MESSAGE(SEND_ERROR "test1 not found in lib/static!") - ENDIF("${TEST1_LIBRARY}" MATCHES "static") + if("${TEST1_LIBRARY}" MATCHES "static") + message(STATUS "test1 correctly found in lib/static") + else() + message(SEND_ERROR "test1 not found in lib/static!") + endif() # Check for failure of configuration-specific installation. - IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h") - MESSAGE(FATAL_ERROR "Debug-configuration file installed for Release!") - ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h") - IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h") - MESSAGE(FATAL_ERROR "Release-configuration file installed for Debug!") - ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h") + if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h") + message(FATAL_ERROR "Debug-configuration file installed for Release!") + endif() + if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h") + message(FATAL_ERROR "Release-configuration file installed for Debug!") + endif() # Check for failure of directory installation. - IF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h") - MESSAGE(FATAL_ERROR "Directory installation did not install TSD.h") - ENDIF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h") - IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") - MESSAGE(FATAL_ERROR "Directory installation installed CVS directory.") - ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") - IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") - MESSAGE(FATAL_ERROR "Directory installation installed CVS directory.") - ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") - IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CMakeLists.txt") - MESSAGE(FATAL_ERROR "Directory installation installed CMakeLists.txt.") - ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CMakeLists.txt") - IF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.h") - MESSAGE(FATAL_ERROR "Directory installation did not install alternate TSD.h") - ENDIF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.h") - IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.cxx") - MESSAGE(FATAL_ERROR "Directory installation installed alternate TSD.cxx") - ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.cxx") + if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h") + message(FATAL_ERROR "Directory installation did not install TSD.h") + endif() + if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") + message(FATAL_ERROR "Directory installation installed CVS directory.") + endif() + if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") + message(FATAL_ERROR "Directory installation installed CVS directory.") + endif() + if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CMakeLists.txt") + message(FATAL_ERROR "Directory installation installed CMakeLists.txt.") + endif() + if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.h") + message(FATAL_ERROR "Directory installation did not install alternate TSD.h") + endif() + if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.cxx") + message(FATAL_ERROR "Directory installation installed alternate TSD.cxx") + endif() # Check that scripts properly installed. - IF(WIN32 AND NOT CYGWIN) - SET(BAT .bat) - ELSE(WIN32 AND NOT CYGWIN) - SET(BAT) - ENDIF(WIN32 AND NOT CYGWIN) - FOREACH(loc share share/old1 share/old2 share/old3 share/alt) - SET(CUR_SCRIPT "${CMAKE_INSTALL_PREFIX}/MyTest/${loc}/sample_script${BAT}") - EXECUTE_PROCESS( + if(WIN32 AND NOT CYGWIN) + set(BAT .bat) + else() + set(BAT) + endif() + foreach(loc share share/old1 share/old2 share/old3 share/alt) + set(CUR_SCRIPT "${CMAKE_INSTALL_PREFIX}/MyTest/${loc}/sample_script${BAT}") + execute_process( COMMAND ${CUR_SCRIPT} RESULT_VARIABLE SAMPLE_SCRIPT_RESULT OUTPUT_VARIABLE SAMPLE_SCRIPT_OUTPUT ) - IF(NOT "${SAMPLE_SCRIPT_RESULT}" MATCHES "^0$") - MESSAGE(FATAL_ERROR + if(NOT "${SAMPLE_SCRIPT_RESULT}" MATCHES "^0$") + message(FATAL_ERROR "Sample script [${CUR_SCRIPT}] failed: [${SAMPLE_SCRIPT_RESULT}]") - ENDIF(NOT "${SAMPLE_SCRIPT_RESULT}" MATCHES "^0$") - IF(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output") - MESSAGE(FATAL_ERROR + endif() + if(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output") + message(FATAL_ERROR "Bad sample script [${CUR_SCRIPT}] output: [${SAMPLE_SCRIPT_OUTPUT}]") - ENDIF(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output") - ENDFOREACH(loc) + endif() + endforeach() # Check for failure of empty directory installation. - IF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty") - MESSAGE(FATAL_ERROR "Empty directory installation did not install.") - ENDIF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty") - FILE(GLOB EMPTY_FILES "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty/*") - IF(EMPTY_FILES) - MESSAGE(FATAL_ERROR "Empty directory installed [${EMPTY_FILES}].") - ENDIF(EMPTY_FILES) + if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty") + message(FATAL_ERROR "Empty directory installation did not install.") + endif() + file(GLOB EMPTY_FILES "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty/*") + if(EMPTY_FILES) + message(FATAL_ERROR "Empty directory installed [${EMPTY_FILES}].") + endif() # Make sure the test executable can run from the install tree. - SET_TARGET_PROPERTIES(SimpleInstExeS2 PROPERTIES + set_target_properties(SimpleInstExeS2 PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - INSTALL_TARGETS(/MyTest/bin SimpleInstExeS2) + install_targets(/MyTest/bin SimpleInstExeS2) # try to import the exported targets again - SET(SimpleInstallS1_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - FIND_PACKAGE(SimpleInstallS1 REQUIRED) - GET_TARGET_PROPERTY(simpleInstallImported S1_SimpleInstall IMPORTED) - IF(NOT simpleInstallImported) - MESSAGE(FATAL_ERROR "Target S1_SimpleInstall could not be imported") - ENDIF(NOT simpleInstallImported) - -ELSE(STAGE2) + set(SimpleInstallS1_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) + find_package(SimpleInstallS1 REQUIRED) + get_target_property(simpleInstallImported S1_SimpleInstall IMPORTED) + if(NOT simpleInstallImported) + message(FATAL_ERROR "Target S1_SimpleInstall could not be imported") + endif() + +else() # Wipe out the install directory to do a fresh test. - FILE(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/MyTest) + file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/MyTest) # this is stage 1, so create libraries and modules and install everything - ADD_LIBRARY(test1 STATIC lib1.cxx) - ADD_LIBRARY(test2 SHARED lib2.cxx) - ADD_LIBRARY(test3 MODULE lib3.cxx) - ADD_LIBRARY(test4 SHARED lib4.cxx) + add_library(test1 STATIC lib1.cxx) + add_library(test2 SHARED lib2.cxx) + add_library(test3 MODULE lib3.cxx) + add_library(test4 SHARED lib4.cxx) # Test _OUTPUT_NAME properties. - SET_PROPERTY(TARGET test4 PROPERTY ARCHIVE_OUTPUT_NAME test4out) - SET_PROPERTY(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4out) + set_property(TARGET test4 PROPERTY ARCHIVE_OUTPUT_NAME test4out) + set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4out) - ADD_EXECUTABLE (SimpleInstall inst.cxx foo.c foo.h) - TARGET_LINK_LIBRARIES(SimpleInstall test1 test2 test4) - SET(install_target SimpleInstall) + add_executable (SimpleInstall inst.cxx foo.c foo.h) + target_link_libraries(SimpleInstall test1 test2 test4) + set(install_target SimpleInstall) - SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe) + set_target_properties(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe) # Disable VERSION test until it is implemented in the Xcode generator. - IF(NOT XCODE) - SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2) - ENDIF(NOT XCODE) + if(NOT XCODE) + set_target_properties(SimpleInstall PROPERTIES VERSION 1.2) + endif() # Make sure the test executable can run from the install tree. - SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES + set_target_properties(SimpleInstall PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib) # Test per-configuration output name. - SET_TARGET_PROPERTIES(test1 PROPERTIES RELEASE_OUTPUT_NAME test1rel) - SET_TARGET_PROPERTIES(test2 PROPERTIES PUBLIC_HEADER foo.h) + set_target_properties(test1 PROPERTIES RELEASE_OUTPUT_NAME test1rel) + set_target_properties(test2 PROPERTIES PUBLIC_HEADER foo.h) - IF(CMAKE_GENERATOR MATCHES "Makefiles") - ADD_SUBDIRECTORY(TestSubDir) - ADD_DEPENDENCIES(SimpleInstall TSD) - ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + if(CMAKE_GENERATOR MATCHES "Makefiles") + add_subdirectory(TestSubDir) + add_dependencies(SimpleInstall TSD) + endif() - ADD_DEPENDENCIES(SimpleInstall test3) - ADD_DEPENDENCIES(test2 test3) - ADD_DEPENDENCIES(test4 test2) + add_dependencies(SimpleInstall test3) + add_dependencies(test2 test3) + add_dependencies(test4 test2) - INSTALL(TARGETS SimpleInstall test1 test2 test3 EXPORT SimpleInstallS1 + install(TARGETS SimpleInstall test1 test2 test3 EXPORT SimpleInstallS1 RUNTIME DESTINATION MyTest/bin COMPONENT Runtime # .exe, .dll LIBRARY DESTINATION MyTest/lib COMPONENT Runtime # .so, mod.dll ARCHIVE DESTINATION MyTest/lib/static COMPONENT Development # .a, .lib - PUBLIC_HEADER DESTINATION MyTest/include COMPONENT Development + PUBLIC_HEADER DESTINATION MyTest/include COMPONENT Development ) - INSTALL(TARGETS test4 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE + install(TARGETS test4 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE RUNTIME DESTINATION MyTest/bin LIBRARY DESTINATION MyTest/lib ARCHIVE DESTINATION MyTest/lib/static OPTIONAL # for coverage...target should always exist ) - INSTALL(FILES lib1.h DESTINATION MyTest/include/foo) - INSTALL(FILES lib2.h + install(FILES lib1.h DESTINATION MyTest/include/foo) + install(FILES lib2.h DESTINATION MyTest/include/foo COMPONENT Development PERMISSIONS OWNER_READ OWNER_WRITE @@ -218,40 +218,40 @@ ELSE(STAGE2) ) # Test old-style install commands. - INSTALL_FILES(/MyTest/include FILES lib3.h) - INSTALL_FILES(/MyTest/include/old .h lib3) - INSTALL_FILES(/MyTest/include/old "^lib2.h$") - INSTALL_PROGRAMS(/MyTest/share/old1 FILES + install_files(/MyTest/include FILES lib3.h) + install_files(/MyTest/include/old .h lib3) + install_files(/MyTest/include/old "^lib2.h$") + install_programs(/MyTest/share/old1 FILES scripts/sample_script scripts/sample_script.bat) - INSTALL_PROGRAMS(/MyTest/share/old2 + install_programs(/MyTest/share/old2 scripts/sample_script scripts/sample_script.bat) # "export" the targets collected in "SimpleInstallS1" - INSTALL(EXPORT SimpleInstallS1 FILE SimpleInstallS1Config.cmake - DESTINATION MyTest/lib + install(EXPORT SimpleInstallS1 FILE SimpleInstallS1Config.cmake + DESTINATION MyTest/lib NAMESPACE S1_ ) - EXPORT(TARGETS SimpleInstall test1 test2 test3 + export(TARGETS SimpleInstall test1 test2 test3 FILE "${CMAKE_CURRENT_BINARY_DIR}/SimpleInstallS1Config.cmake" NAMESPACE S2_ ) - ADD_SUBDIRECTORY(scripts) + add_subdirectory(scripts) # Test optional installation. - INSTALL(FILES does_not_exist.h DESTINATION MyTest/include/foo OPTIONAL) + install(FILES does_not_exist.h DESTINATION MyTest/include/foo OPTIONAL) # Test configuration-specific installation. - INSTALL(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release + install(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release DESTINATION MyTest/include/Release ) - INSTALL(FILES lib1.h RENAME lib1debug.h CONFIGURATIONS Debug + install(FILES lib1.h RENAME lib1debug.h CONFIGURATIONS Debug DESTINATION MyTest/include/Debug ) # Test directory installation. - FILE(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") - FILE(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") - INSTALL( + file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") + file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") + install( DIRECTORY TestSubDir scripts/ DESTINATION MyTest/share FILE_PERMISSIONS OWNER_READ OWNER_WRITE DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE @@ -262,14 +262,14 @@ ELSE(STAGE2) ) # Alternate directory installation for coverage. - INSTALL( + install( DIRECTORY scripts/ DESTINATION MyTest/share/alt COMPONENT Development USE_SOURCE_PERMISSIONS PATTERN "CVS" EXCLUDE REGEX "\\.txt$" EXCLUDE ) - INSTALL( + install( DIRECTORY TestSubDir DESTINATION MyTest/share/alt FILE_PERMISSIONS OWNER_READ OWNER_WRITE DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE @@ -278,109 +278,109 @@ ELSE(STAGE2) ) # Test empty directory installation. - INSTALL(DIRECTORY DESTINATION MyTest/share/empty) + install(DIRECTORY DESTINATION MyTest/share/empty) # Test optional directory installation. - INSTALL(DIRECTORY does-not-exist DESTINATION MyTest/share OPTIONAL) + install(DIRECTORY does-not-exist DESTINATION MyTest/share OPTIONAL) # Test user-specified install scripts, with and without COMPONENT. - INSTALL( + install( SCRIPT InstallScript1.cmake - CODE "SET(INSTALL_CODE_DID_RUN 1)" + CODE "set(INSTALL_CODE_DID_RUN 1)" SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript2.cmake ) - INSTALL( + install( SCRIPT InstallScript3.cmake - CODE "SET(INSTALL_CODE_WITH_COMPONENT_DID_RUN 1)" + CODE "set(INSTALL_CODE_WITH_COMPONENT_DID_RUN 1)" SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript4.cmake COMPONENT Development ) - SET_DIRECTORY_PROPERTIES(PROPERTIES + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake") - SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT + set_target_properties(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake) - SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT + set_target_properties(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/PostInstall.cmake) - SET_TARGET_PROPERTIES(test4 PROPERTIES VERSION 1.2 SOVERSION 3 + set_target_properties(test4 PROPERTIES VERSION 1.2 SOVERSION 3 INSTALL_NAME_DIR @executable_path/../lib) -ENDIF(STAGE2) +endif() -IF(CMAKE_CONFIGURATION_TYPES) - SET(SI_CONFIG -C ${CMAKE_CFG_INTDIR}) -ELSE(CMAKE_CONFIGURATION_TYPES) - SET(SI_CONFIG) -ENDIF(CMAKE_CONFIGURATION_TYPES) +if(CMAKE_CONFIGURATION_TYPES) + set(SI_CONFIG -C ${CMAKE_CFG_INTDIR}) +else() + set(SI_CONFIG) +endif() # Dummy test of CPack -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack") -SET(CPACK_PACKAGE_VENDOR "Kitware") -SET(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/PackageScript.cmake") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack") +set(CPACK_PACKAGE_VENDOR "Kitware") +set(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/PackageScript.cmake") -IF(WIN32 AND NOT UNIX) - FIND_PROGRAM(NSIS_MAKENSIS NAMES makensis +if(WIN32 AND NOT UNIX) + find_program(NSIS_MAKENSIS NAMES makensis PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS] DOC "Where is makensis.exe located" ) - IF(NOT NSIS_MAKENSIS) - SET(CPACK_GENERATOR TGZ) - ENDIF(NOT NSIS_MAKENSIS) -ENDIF(WIN32 AND NOT UNIX) -IF(UNIX AND NOT APPLE) - SET(CPACK_GENERATOR "TGZ;STGZ;TZ") - # FIND_PROGRAM(found_compress + if(NOT NSIS_MAKENSIS) + set(CPACK_GENERATOR TGZ) + endif() +endif() +if(UNIX AND NOT APPLE) + set(CPACK_GENERATOR "TGZ;STGZ;TZ") + # find_program(found_compress # NAMES compress) - # IF(found_compress) - # FIND_PROGRAM(file_command NAMES file) - # IF(NOT file_command) + # if(found_compress) + # find_program(file_command NAMES file) + # if(NOT file_command) # set(file_command file) - # ENDIF(NOT file_command) - # EXECUTE_PROCESS(COMMAND ${file_command} ${found_compress} + # endif() + # execute_process(COMMAND ${file_command} ${found_compress} # OUTPUT_VARIABLE output) # set(SKIP_TZ FALSE) # if("${output}" MATCHES "script") # set(SKIP_TZ TRUE) - # endif("${output}" MATCHES "script") + # endif() # if("${output}" MATCHES "dummy.sh") # set(SKIP_TZ TRUE) - # endif("${output}" MATCHES "dummy.sh") + # endif() # if(NOT SKIP_TZ) # message("compress found and it was not a script") # message("output from file command: [${output}]") - # SET(CPACK_GENERATOR "${CPACK_GENERATOR};TZ") - # else(NOT SKIP_TZ) + # set(CPACK_GENERATOR "${CPACK_GENERATOR};TZ") + # else() # message("compress found, but it was a script so dont use it") # message("output from file command: [${output}]") - # endif(NOT SKIP_TZ) - # ENDIF(found_compress) - FIND_PROGRAM(found_bz2 + # endif() + # endif() + find_program(found_bz2 NAMES bzip2) - IF(found_bz2) - SET(CPACK_GENERATOR "${CPACK_GENERATOR};TBZ2") - ENDIF(found_bz2) -ENDIF(UNIX AND NOT APPLE) + if(found_bz2) + set(CPACK_GENERATOR "${CPACK_GENERATOR};TBZ2") + endif() +endif() -SET(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install") -SET(CMAKE_INSTALL_MFC_LIBRARIES 1) -SET(CMAKE_INSTALL_DEBUG_LIBRARIES 1) -INCLUDE(InstallRequiredSystemLibraries) +set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install") +set(CMAKE_INSTALL_MFC_LIBRARIES 1) +set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) +include(InstallRequiredSystemLibraries) -IF(CTEST_TEST_CPACK) - SET(PACKAGE_TARGET --build-target package) +if(CTEST_TEST_CPACK) + set(PACKAGE_TARGET --build-target package) # Avoid settings that require the .zip file command line tools... # (just build an NSIS installer without component support) # - SET(CPACK_BINARY_ZIP OFF) - SET(CPACK_MONOLITHIC_INSTALL ON) -ELSE(CTEST_TEST_CPACK) - SET(PACKAGE_TARGET) -ENDIF(CTEST_TEST_CPACK) + set(CPACK_BINARY_ZIP OFF) + set(CPACK_MONOLITHIC_INSTALL ON) +else() + set(PACKAGE_TARGET) +endif() -INCLUDE(CPack) +include(CPack) -ADD_CUSTOM_COMMAND( +add_custom_command( TARGET ${install_target} POST_BUILD COMMAND ${CMAKE_CTEST_COMMAND} diff --git a/Tests/SimpleInstall/InstallScript1.cmake b/Tests/SimpleInstall/InstallScript1.cmake index 27b7725f8..ef9da5761 100644 --- a/Tests/SimpleInstall/InstallScript1.cmake +++ b/Tests/SimpleInstall/InstallScript1.cmake @@ -1,5 +1,5 @@ -MESSAGE("This is install script 1.") -SET(INSTALL_SCRIPT_1_DID_RUN 1) -IF(INSTALL_CODE_DID_RUN) - MESSAGE(FATAL_ERROR "Install script 1 did not run before install code.") -ENDIF(INSTALL_CODE_DID_RUN) +message("This is install script 1.") +set(INSTALL_SCRIPT_1_DID_RUN 1) +if(INSTALL_CODE_DID_RUN) + message(FATAL_ERROR "Install script 1 did not run before install code.") +endif() diff --git a/Tests/SimpleInstall/InstallScript2.cmake b/Tests/SimpleInstall/InstallScript2.cmake index 927cae8b6..c1d20a3a6 100644 --- a/Tests/SimpleInstall/InstallScript2.cmake +++ b/Tests/SimpleInstall/InstallScript2.cmake @@ -1,14 +1,14 @@ -MESSAGE("This is install script 2.") -IF(INSTALL_SCRIPT_1_DID_RUN) - MESSAGE("Install script ordering works.") -ELSE(INSTALL_SCRIPT_1_DID_RUN) - MESSAGE(FATAL_ERROR "Install script 1 did not run before install script 2.") -ENDIF(INSTALL_SCRIPT_1_DID_RUN) -IF(INSTALL_CODE_DID_RUN) - MESSAGE("Install code ordering works.") -ELSE(INSTALL_CODE_DID_RUN) - MESSAGE(FATAL_ERROR "Install script 2 did not run after install code.") -ENDIF(INSTALL_CODE_DID_RUN) -FILE(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake" - "SET(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n" +message("This is install script 2.") +if(INSTALL_SCRIPT_1_DID_RUN) + message("Install script ordering works.") +else() + message(FATAL_ERROR "Install script 1 did not run before install script 2.") +endif() +if(INSTALL_CODE_DID_RUN) + message("Install code ordering works.") +else() + message(FATAL_ERROR "Install script 2 did not run after install code.") +endif() +file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake" + "set(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n" ) diff --git a/Tests/SimpleInstall/InstallScript3.cmake b/Tests/SimpleInstall/InstallScript3.cmake index b1aecd4c2..64851564d 100644 --- a/Tests/SimpleInstall/InstallScript3.cmake +++ b/Tests/SimpleInstall/InstallScript3.cmake @@ -1,12 +1,12 @@ -MESSAGE("This is install script 3.") -SET(INSTALL_SCRIPT_3_DID_RUN 1) -IF(INSTALL_CODE_WITH_COMPONENT_DID_RUN) - MESSAGE(FATAL_ERROR "Install script 3 did not run before install code with component.") -ENDIF(INSTALL_CODE_WITH_COMPONENT_DID_RUN) +message("This is install script 3.") +set(INSTALL_SCRIPT_3_DID_RUN 1) +if(INSTALL_CODE_WITH_COMPONENT_DID_RUN) + message(FATAL_ERROR "Install script 3 did not run before install code with component.") +endif() -IF(CMAKE_INSTALL_COMPONENT) -IF(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") - MESSAGE("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") - MESSAGE(FATAL_ERROR "Install script 3 should only run for \"Development\" INSTALL COMPONENT.") -ENDIF(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") -ENDIF(CMAKE_INSTALL_COMPONENT) +if(CMAKE_INSTALL_COMPONENT) +if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") + message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") + message(FATAL_ERROR "Install script 3 should only run for \"Development\" INSTALL COMPONENT.") +endif() +endif() diff --git a/Tests/SimpleInstall/InstallScript4.cmake b/Tests/SimpleInstall/InstallScript4.cmake index 0ffea4bc8..34d0a73bb 100644 --- a/Tests/SimpleInstall/InstallScript4.cmake +++ b/Tests/SimpleInstall/InstallScript4.cmake @@ -1,22 +1,22 @@ -MESSAGE("This is install script 4.") -IF(INSTALL_SCRIPT_3_DID_RUN) - MESSAGE("Install script ordering works.") -ELSE(INSTALL_SCRIPT_3_DID_RUN) - MESSAGE(FATAL_ERROR "Install script 3 did not run before install script 4.") -ENDIF(INSTALL_SCRIPT_3_DID_RUN) -IF(INSTALL_CODE_WITH_COMPONENT_DID_RUN) - MESSAGE("Install code ordering works.") -ELSE(INSTALL_CODE_WITH_COMPONENT_DID_RUN) - MESSAGE(FATAL_ERROR "Install script 4 did not run after install with component code.") -ENDIF(INSTALL_CODE_WITH_COMPONENT_DID_RUN) +message("This is install script 4.") +if(INSTALL_SCRIPT_3_DID_RUN) + message("Install script ordering works.") +else() + message(FATAL_ERROR "Install script 3 did not run before install script 4.") +endif() +if(INSTALL_CODE_WITH_COMPONENT_DID_RUN) + message("Install code ordering works.") +else() + message(FATAL_ERROR "Install script 4 did not run after install with component code.") +endif() -IF(CMAKE_INSTALL_COMPONENT) -IF(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") - MESSAGE("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") - MESSAGE(FATAL_ERROR "Install script 4 should only run for \"Development\" INSTALL COMPONENT.") -ENDIF(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") -ENDIF(CMAKE_INSTALL_COMPONENT) +if(CMAKE_INSTALL_COMPONENT) +if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") + message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") + message(FATAL_ERROR "Install script 4 should only run for \"Development\" INSTALL COMPONENT.") +endif() +endif() -FILE(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScript4Out.cmake" - "SET(CMAKE_INSTALL_SCRIPT_4_DID_RUN 1)\n" +file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScript4Out.cmake" + "set(CMAKE_INSTALL_SCRIPT_4_DID_RUN 1)\n" ) diff --git a/Tests/SimpleInstall/PackageScript.cmake b/Tests/SimpleInstall/PackageScript.cmake index 3567a2f43..53b790932 100644 --- a/Tests/SimpleInstall/PackageScript.cmake +++ b/Tests/SimpleInstall/PackageScript.cmake @@ -1,10 +1,10 @@ -MESSAGE("This is packaging script") -MESSAGE("It writes a file with all variables available in ${CMAKE_INSTALL_PREFIX}/AllVariables.txt") +message("This is packaging script") +message("It writes a file with all variables available in ${CMAKE_INSTALL_PREFIX}/AllVariables.txt") -FILE(WRITE ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "") -GET_CMAKE_PROPERTY(res VARIABLES) -FOREACH(var ${res}) - FILE(APPEND ${CMAKE_INSTALL_PREFIX}/AllVariables.txt +file(WRITE ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "") +get_cmake_property(res VARIABLES) +foreach(var ${res}) + file(APPEND ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "${var} \"${${var}}\"\n") -ENDFOREACH(var ${res}) +endforeach() diff --git a/Tests/SimpleInstall/PostInstall.cmake b/Tests/SimpleInstall/PostInstall.cmake index 52ea140a5..d616221ef 100644 --- a/Tests/SimpleInstall/PostInstall.cmake +++ b/Tests/SimpleInstall/PostInstall.cmake @@ -1,6 +1,6 @@ -MESSAGE("In post install") -IF(PRE_INSTALL_DID_RUN) - MESSAGE("Pre and post install work fine") -ELSE(PRE_INSTALL_DID_RUN) - MESSAGE(FATAL_ERROR "Pre install did not run before post install") -ENDIF(PRE_INSTALL_DID_RUN) +message("In post install") +if(PRE_INSTALL_DID_RUN) + message("Pre and post install work fine") +else() + message(FATAL_ERROR "Pre install did not run before post install") +endif() diff --git a/Tests/SimpleInstall/PreInstall.cmake b/Tests/SimpleInstall/PreInstall.cmake index 2ea2f7716..7a9851e1d 100644 --- a/Tests/SimpleInstall/PreInstall.cmake +++ b/Tests/SimpleInstall/PreInstall.cmake @@ -1,2 +1,2 @@ -MESSAGE("This is in pre install") -SET(PRE_INSTALL_DID_RUN 1) +message("This is in pre install") +set(PRE_INSTALL_DID_RUN 1) diff --git a/Tests/SimpleInstall/TestSubDir/CMakeLists.txt b/Tests/SimpleInstall/TestSubDir/CMakeLists.txt index 4f6295300..860e10425 100644 --- a/Tests/SimpleInstall/TestSubDir/CMakeLists.txt +++ b/Tests/SimpleInstall/TestSubDir/CMakeLists.txt @@ -1,3 +1,3 @@ -ADD_EXECUTABLE(TSD TSD.cxx TSD_utils.cxx) -INSTALL_FILES(/MyTest/include FILES TSD.h) -INSTALL_TARGETS(/MyTest/bin TSD) +add_executable(TSD TSD.cxx TSD_utils.cxx) +install_files(/MyTest/include FILES TSD.h) +install_targets(/MyTest/bin TSD) diff --git a/Tests/SimpleInstall/lib2.h b/Tests/SimpleInstall/lib2.h index ea5a6f7ea..d69b78613 100644 --- a/Tests/SimpleInstall/lib2.h +++ b/Tests/SimpleInstall/lib2.h @@ -5,7 +5,7 @@ # define CM_TEST_LIB_EXPORT __declspec( dllimport ) # endif #else -# define CM_TEST_LIB_EXPORT +# define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float Lib2Func(); diff --git a/Tests/SimpleInstall/lib3.h b/Tests/SimpleInstall/lib3.h index c250ed769..66bc52a7f 100644 --- a/Tests/SimpleInstall/lib3.h +++ b/Tests/SimpleInstall/lib3.h @@ -5,7 +5,7 @@ # define CM_TEST_LIB_EXPORT __declspec( dllimport ) # endif #else -# define CM_TEST_LIB_EXPORT +# define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float Lib3Func(); diff --git a/Tests/SimpleInstall/lib4.h b/Tests/SimpleInstall/lib4.h index 4b94ea207..11c127247 100644 --- a/Tests/SimpleInstall/lib4.h +++ b/Tests/SimpleInstall/lib4.h @@ -5,7 +5,7 @@ # define CM_TEST_LIB_EXPORT __declspec( dllimport ) # endif #else -# define CM_TEST_LIB_EXPORT +# define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float Lib4Func(); diff --git a/Tests/SimpleInstall/scripts/CMakeLists.txt b/Tests/SimpleInstall/scripts/CMakeLists.txt index d46c1652e..ec34e8c50 100644 --- a/Tests/SimpleInstall/scripts/CMakeLists.txt +++ b/Tests/SimpleInstall/scripts/CMakeLists.txt @@ -1 +1 @@ -INSTALL_PROGRAMS(/MyTest/share/old3 "^sample_script(\\.bat)?$") +install_programs(/MyTest/share/old3 "^sample_script(\\.bat)?$") diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index 378b5292b..479d6ec36 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/CMakeLists.txt @@ -1,216 +1,216 @@ cmake_minimum_required (VERSION 2.6) -PROJECT (TestSimpleInstall) -SET(CMAKE_VERBOSE_MAKEFILE 1) -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY +project (TestSimpleInstall) +set(CMAKE_VERBOSE_MAKEFILE 1) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${TestSimpleInstall_BINARY_DIR}/bin") -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${TestSimpleInstall_BINARY_DIR}/lib/static") -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${TestSimpleInstall_BINARY_DIR}/lib") # Skip generating the rpath pointing at the build tree to make sure # the executable is installed with the proper rpath in the install # tree. -SET(CMAKE_SKIP_BUILD_RPATH 1) +set(CMAKE_SKIP_BUILD_RPATH 1) # Make sure the executable can run from the install tree. -SET(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) +set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) # Skip the dependency that causes a build when installing. This # avoids infinite loops when the post-build rule below installs. -SET(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1) -SET(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1) +set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1) +set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1) -SET(CMAKE_DEBUG_POSTFIX "_test_debug_postfix") +set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix") -SET(EXTRA_INSTALL_FLAGS) -MESSAGE("Extra install: ${EXTRA_INSTALL_FLAGS}") +set(EXTRA_INSTALL_FLAGS) +message("Extra install: ${EXTRA_INSTALL_FLAGS}") -IF(STAGE2) - SET(LIBPATHS +if(STAGE2) + set(LIBPATHS ${CMAKE_INSTALL_PREFIX}/MyTest/lib/static ${CMAKE_INSTALL_PREFIX}/MyTest/lib ) - SET(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX} test1rel) - SET(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX}) - SET(t4NAMES test4out test4out${CMAKE_DEBUG_POSTFIX}) + set(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX} test1rel) + set(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX}) + set(t4NAMES test4out test4out${CMAKE_DEBUG_POSTFIX}) # Make sure the install script ran. - SET(CMAKE_INSTALL_SCRIPT_DID_RUN 0) - INCLUDE(${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake OPTIONAL) - IF(CMAKE_INSTALL_SCRIPT_DID_RUN) - MESSAGE(STATUS "Stage 1 did run install script 2.") - ELSE(CMAKE_INSTALL_SCRIPT_DID_RUN) - MESSAGE(SEND_ERROR "Stage 1 did not run install script 2.") - ENDIF(CMAKE_INSTALL_SCRIPT_DID_RUN) - - IF(CYGWIN OR MINGW) - SET(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/MyTest/bin") - ENDIF(CYGWIN OR MINGW) - MESSAGE("Search for library in: ${LIBPATHS}") - - SET(TEST1_LIBRARY "TEST1_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - SET(TEST2_LIBRARY "TEST2_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - SET(TEST4_LIBRARY "TEST4_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - - FIND_LIBRARY(TEST1_LIBRARY + set(CMAKE_INSTALL_SCRIPT_DID_RUN 0) + include(${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake OPTIONAL) + if(CMAKE_INSTALL_SCRIPT_DID_RUN) + message(STATUS "Stage 1 did run install script 2.") + else() + message(SEND_ERROR "Stage 1 did not run install script 2.") + endif() + + if(CYGWIN OR MINGW) + set(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/MyTest/bin") + endif() + message("Search for library in: ${LIBPATHS}") + + set(TEST1_LIBRARY "TEST1_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) + set(TEST2_LIBRARY "TEST2_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) + set(TEST4_LIBRARY "TEST4_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) + + find_library(TEST1_LIBRARY NAMES ${t1NAMES} PATHS ${LIBPATHS} DOC "First library") - FIND_LIBRARY(TEST2_LIBRARY + find_library(TEST2_LIBRARY NAMES ${t2NAMES} PATHS ${LIBPATHS} DOC "Second library") - FIND_LIBRARY(TEST4_LIBRARY + find_library(TEST4_LIBRARY NAMES ${t4NAMES} PATHS ${LIBPATHS} DOC "Fourth library") # Test importing a library found on disk. - ADD_LIBRARY(lib_test4 UNKNOWN IMPORTED) - SET_PROPERTY(TARGET lib_test4 PROPERTY IMPORTED_LOCATION ${TEST4_LIBRARY}) + add_library(lib_test4 UNKNOWN IMPORTED) + set_property(TARGET lib_test4 PROPERTY IMPORTED_LOCATION ${TEST4_LIBRARY}) - INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/MyTest/include) - ADD_EXECUTABLE (SimpleInstExeS2 inst2.cxx foo.c foo.h) - TARGET_LINK_LIBRARIES(SimpleInstExeS2 ${TEST1_LIBRARY} ${TEST2_LIBRARY} lib_test4) - SET(install_target SimpleInstExeS2) + include_directories(${CMAKE_INSTALL_PREFIX}/MyTest/include) + add_executable (SimpleInstExeS2 inst2.cxx foo.c foo.h) + target_link_libraries(SimpleInstExeS2 ${TEST1_LIBRARY} ${TEST2_LIBRARY} lib_test4) + set(install_target SimpleInstExeS2) - IF("${TEST1_LIBRARY}" MATCHES "static") - MESSAGE(STATUS "test1 correctly found in lib/static") - ELSE("${TEST1_LIBRARY}" MATCHES "static") - MESSAGE(SEND_ERROR "test1 not found in lib/static!") - ENDIF("${TEST1_LIBRARY}" MATCHES "static") + if("${TEST1_LIBRARY}" MATCHES "static") + message(STATUS "test1 correctly found in lib/static") + else() + message(SEND_ERROR "test1 not found in lib/static!") + endif() # Check for failure of configuration-specific installation. - IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h") - MESSAGE(FATAL_ERROR "Debug-configuration file installed for Release!") - ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h") - IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h") - MESSAGE(FATAL_ERROR "Release-configuration file installed for Debug!") - ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h") + if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h") + message(FATAL_ERROR "Debug-configuration file installed for Release!") + endif() + if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h") + message(FATAL_ERROR "Release-configuration file installed for Debug!") + endif() # Check for failure of directory installation. - IF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h") - MESSAGE(FATAL_ERROR "Directory installation did not install TSD.h") - ENDIF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h") - IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") - MESSAGE(FATAL_ERROR "Directory installation installed CVS directory.") - ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") - IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") - MESSAGE(FATAL_ERROR "Directory installation installed CVS directory.") - ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") - IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CMakeLists.txt") - MESSAGE(FATAL_ERROR "Directory installation installed CMakeLists.txt.") - ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CMakeLists.txt") - IF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.h") - MESSAGE(FATAL_ERROR "Directory installation did not install alternate TSD.h") - ENDIF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.h") - IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.cxx") - MESSAGE(FATAL_ERROR "Directory installation installed alternate TSD.cxx") - ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.cxx") + if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h") + message(FATAL_ERROR "Directory installation did not install TSD.h") + endif() + if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") + message(FATAL_ERROR "Directory installation installed CVS directory.") + endif() + if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") + message(FATAL_ERROR "Directory installation installed CVS directory.") + endif() + if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CMakeLists.txt") + message(FATAL_ERROR "Directory installation installed CMakeLists.txt.") + endif() + if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.h") + message(FATAL_ERROR "Directory installation did not install alternate TSD.h") + endif() + if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.cxx") + message(FATAL_ERROR "Directory installation installed alternate TSD.cxx") + endif() # Check that scripts properly installed. - IF(WIN32 AND NOT CYGWIN) - SET(BAT .bat) - ELSE(WIN32 AND NOT CYGWIN) - SET(BAT) - ENDIF(WIN32 AND NOT CYGWIN) - FOREACH(loc share share/old1 share/old2 share/old3 share/alt) - SET(CUR_SCRIPT "${CMAKE_INSTALL_PREFIX}/MyTest/${loc}/sample_script${BAT}") - EXECUTE_PROCESS( + if(WIN32 AND NOT CYGWIN) + set(BAT .bat) + else() + set(BAT) + endif() + foreach(loc share share/old1 share/old2 share/old3 share/alt) + set(CUR_SCRIPT "${CMAKE_INSTALL_PREFIX}/MyTest/${loc}/sample_script${BAT}") + execute_process( COMMAND ${CUR_SCRIPT} RESULT_VARIABLE SAMPLE_SCRIPT_RESULT OUTPUT_VARIABLE SAMPLE_SCRIPT_OUTPUT ) - IF(NOT "${SAMPLE_SCRIPT_RESULT}" MATCHES "^0$") - MESSAGE(FATAL_ERROR + if(NOT "${SAMPLE_SCRIPT_RESULT}" MATCHES "^0$") + message(FATAL_ERROR "Sample script [${CUR_SCRIPT}] failed: [${SAMPLE_SCRIPT_RESULT}]") - ENDIF(NOT "${SAMPLE_SCRIPT_RESULT}" MATCHES "^0$") - IF(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output") - MESSAGE(FATAL_ERROR + endif() + if(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output") + message(FATAL_ERROR "Bad sample script [${CUR_SCRIPT}] output: [${SAMPLE_SCRIPT_OUTPUT}]") - ENDIF(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output") - ENDFOREACH(loc) + endif() + endforeach() # Check for failure of empty directory installation. - IF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty") - MESSAGE(FATAL_ERROR "Empty directory installation did not install.") - ENDIF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty") - FILE(GLOB EMPTY_FILES "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty/*") - IF(EMPTY_FILES) - MESSAGE(FATAL_ERROR "Empty directory installed [${EMPTY_FILES}].") - ENDIF(EMPTY_FILES) + if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty") + message(FATAL_ERROR "Empty directory installation did not install.") + endif() + file(GLOB EMPTY_FILES "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty/*") + if(EMPTY_FILES) + message(FATAL_ERROR "Empty directory installed [${EMPTY_FILES}].") + endif() # Make sure the test executable can run from the install tree. - SET_TARGET_PROPERTIES(SimpleInstExeS2 PROPERTIES + set_target_properties(SimpleInstExeS2 PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - INSTALL_TARGETS(/MyTest/bin SimpleInstExeS2) + install_targets(/MyTest/bin SimpleInstExeS2) # try to import the exported targets again - SET(SimpleInstallS1_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - FIND_PACKAGE(SimpleInstallS1 REQUIRED) - GET_TARGET_PROPERTY(simpleInstallImported S1_SimpleInstall IMPORTED) - IF(NOT simpleInstallImported) - MESSAGE(FATAL_ERROR "Target S1_SimpleInstall could not be imported") - ENDIF(NOT simpleInstallImported) - -ELSE(STAGE2) + set(SimpleInstallS1_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) + find_package(SimpleInstallS1 REQUIRED) + get_target_property(simpleInstallImported S1_SimpleInstall IMPORTED) + if(NOT simpleInstallImported) + message(FATAL_ERROR "Target S1_SimpleInstall could not be imported") + endif() + +else() # Wipe out the install directory to do a fresh test. - FILE(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/MyTest) + file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/MyTest) # this is stage 1, so create libraries and modules and install everything - ADD_LIBRARY(test1 STATIC lib1.cxx) - ADD_LIBRARY(test2 SHARED lib2.cxx) - ADD_LIBRARY(test3 MODULE lib3.cxx) - ADD_LIBRARY(test4 SHARED lib4.cxx) + add_library(test1 STATIC lib1.cxx) + add_library(test2 SHARED lib2.cxx) + add_library(test3 MODULE lib3.cxx) + add_library(test4 SHARED lib4.cxx) # Test _OUTPUT_NAME properties. - SET_PROPERTY(TARGET test4 PROPERTY ARCHIVE_OUTPUT_NAME test4out) - SET_PROPERTY(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4out) + set_property(TARGET test4 PROPERTY ARCHIVE_OUTPUT_NAME test4out) + set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4out) - ADD_EXECUTABLE (SimpleInstall inst.cxx foo.c foo.h) - TARGET_LINK_LIBRARIES(SimpleInstall test1 test2 test4) - SET(install_target SimpleInstall) + add_executable (SimpleInstall inst.cxx foo.c foo.h) + target_link_libraries(SimpleInstall test1 test2 test4) + set(install_target SimpleInstall) - SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe) + set_target_properties(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe) # Disable VERSION test until it is implemented in the Xcode generator. - IF(NOT XCODE) - SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2) - ENDIF(NOT XCODE) + if(NOT XCODE) + set_target_properties(SimpleInstall PROPERTIES VERSION 1.2) + endif() # Make sure the test executable can run from the install tree. - SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES + set_target_properties(SimpleInstall PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib) # Test per-configuration output name. - SET_TARGET_PROPERTIES(test1 PROPERTIES RELEASE_OUTPUT_NAME test1rel) - SET_TARGET_PROPERTIES(test2 PROPERTIES PUBLIC_HEADER foo.h) + set_target_properties(test1 PROPERTIES RELEASE_OUTPUT_NAME test1rel) + set_target_properties(test2 PROPERTIES PUBLIC_HEADER foo.h) - IF(CMAKE_GENERATOR MATCHES "Makefiles") - ADD_SUBDIRECTORY(TestSubDir) - ADD_DEPENDENCIES(SimpleInstall TSD) - ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + if(CMAKE_GENERATOR MATCHES "Makefiles") + add_subdirectory(TestSubDir) + add_dependencies(SimpleInstall TSD) + endif() - ADD_DEPENDENCIES(SimpleInstall test3) - ADD_DEPENDENCIES(test2 test3) - ADD_DEPENDENCIES(test4 test2) + add_dependencies(SimpleInstall test3) + add_dependencies(test2 test3) + add_dependencies(test4 test2) - INSTALL(TARGETS SimpleInstall test1 test2 test3 EXPORT SimpleInstallS1 + install(TARGETS SimpleInstall test1 test2 test3 EXPORT SimpleInstallS1 RUNTIME DESTINATION MyTest/bin COMPONENT Runtime # .exe, .dll LIBRARY DESTINATION MyTest/lib COMPONENT Runtime # .so, mod.dll ARCHIVE DESTINATION MyTest/lib/static COMPONENT Development # .a, .lib - PUBLIC_HEADER DESTINATION MyTest/include COMPONENT Development + PUBLIC_HEADER DESTINATION MyTest/include COMPONENT Development ) - INSTALL(TARGETS test4 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE + install(TARGETS test4 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE RUNTIME DESTINATION MyTest/bin LIBRARY DESTINATION MyTest/lib ARCHIVE DESTINATION MyTest/lib/static OPTIONAL # for coverage...target should always exist ) - INSTALL(FILES lib1.h DESTINATION MyTest/include/foo) - INSTALL(FILES lib2.h + install(FILES lib1.h DESTINATION MyTest/include/foo) + install(FILES lib2.h DESTINATION MyTest/include/foo COMPONENT Development PERMISSIONS OWNER_READ OWNER_WRITE @@ -218,40 +218,40 @@ ELSE(STAGE2) ) # Test old-style install commands. - INSTALL_FILES(/MyTest/include FILES lib3.h) - INSTALL_FILES(/MyTest/include/old .h lib3) - INSTALL_FILES(/MyTest/include/old "^lib2.h$") - INSTALL_PROGRAMS(/MyTest/share/old1 FILES + install_files(/MyTest/include FILES lib3.h) + install_files(/MyTest/include/old .h lib3) + install_files(/MyTest/include/old "^lib2.h$") + install_programs(/MyTest/share/old1 FILES scripts/sample_script scripts/sample_script.bat) - INSTALL_PROGRAMS(/MyTest/share/old2 + install_programs(/MyTest/share/old2 scripts/sample_script scripts/sample_script.bat) # "export" the targets collected in "SimpleInstallS1" - INSTALL(EXPORT SimpleInstallS1 FILE SimpleInstallS1Config.cmake - DESTINATION MyTest/lib + install(EXPORT SimpleInstallS1 FILE SimpleInstallS1Config.cmake + DESTINATION MyTest/lib NAMESPACE S1_ ) - EXPORT(TARGETS SimpleInstall test1 test2 test3 + export(TARGETS SimpleInstall test1 test2 test3 FILE "${CMAKE_CURRENT_BINARY_DIR}/SimpleInstallS1Config.cmake" NAMESPACE S2_ ) - ADD_SUBDIRECTORY(scripts) + add_subdirectory(scripts) # Test optional installation. - INSTALL(FILES does_not_exist.h DESTINATION MyTest/include/foo OPTIONAL) + install(FILES does_not_exist.h DESTINATION MyTest/include/foo OPTIONAL) # Test configuration-specific installation. - INSTALL(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release + install(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release DESTINATION MyTest/include/Release ) - INSTALL(FILES lib1.h RENAME lib1debug.h CONFIGURATIONS Debug + install(FILES lib1.h RENAME lib1debug.h CONFIGURATIONS Debug DESTINATION MyTest/include/Debug ) # Test directory installation. - FILE(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") - FILE(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") - INSTALL( + file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") + file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") + install( DIRECTORY TestSubDir scripts/ DESTINATION MyTest/share FILE_PERMISSIONS OWNER_READ OWNER_WRITE DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE @@ -262,14 +262,14 @@ ELSE(STAGE2) ) # Alternate directory installation for coverage. - INSTALL( + install( DIRECTORY scripts/ DESTINATION MyTest/share/alt COMPONENT Development USE_SOURCE_PERMISSIONS PATTERN "CVS" EXCLUDE REGEX "\\.txt$" EXCLUDE ) - INSTALL( + install( DIRECTORY TestSubDir DESTINATION MyTest/share/alt FILE_PERMISSIONS OWNER_READ OWNER_WRITE DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE @@ -278,109 +278,109 @@ ELSE(STAGE2) ) # Test empty directory installation. - INSTALL(DIRECTORY DESTINATION MyTest/share/empty) + install(DIRECTORY DESTINATION MyTest/share/empty) # Test optional directory installation. - INSTALL(DIRECTORY does-not-exist DESTINATION MyTest/share OPTIONAL) + install(DIRECTORY does-not-exist DESTINATION MyTest/share OPTIONAL) # Test user-specified install scripts, with and without COMPONENT. - INSTALL( + install( SCRIPT InstallScript1.cmake - CODE "SET(INSTALL_CODE_DID_RUN 1)" + CODE "set(INSTALL_CODE_DID_RUN 1)" SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript2.cmake ) - INSTALL( + install( SCRIPT InstallScript3.cmake - CODE "SET(INSTALL_CODE_WITH_COMPONENT_DID_RUN 1)" + CODE "set(INSTALL_CODE_WITH_COMPONENT_DID_RUN 1)" SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript4.cmake COMPONENT Development ) - SET_DIRECTORY_PROPERTIES(PROPERTIES + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake") - SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT + set_target_properties(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake) - SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT + set_target_properties(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/PostInstall.cmake) - SET_TARGET_PROPERTIES(test4 PROPERTIES VERSION 1.2 SOVERSION 3 + set_target_properties(test4 PROPERTIES VERSION 1.2 SOVERSION 3 INSTALL_NAME_DIR @executable_path/../lib) -ENDIF(STAGE2) +endif() -IF(CMAKE_CONFIGURATION_TYPES) - SET(SI_CONFIG -C ${CMAKE_CFG_INTDIR}) -ELSE(CMAKE_CONFIGURATION_TYPES) - SET(SI_CONFIG) -ENDIF(CMAKE_CONFIGURATION_TYPES) +if(CMAKE_CONFIGURATION_TYPES) + set(SI_CONFIG -C ${CMAKE_CFG_INTDIR}) +else() + set(SI_CONFIG) +endif() # Dummy test of CPack -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack") -SET(CPACK_PACKAGE_VENDOR "Kitware") -SET(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/PackageScript.cmake") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack") +set(CPACK_PACKAGE_VENDOR "Kitware") +set(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/PackageScript.cmake") -IF(WIN32 AND NOT UNIX) - FIND_PROGRAM(NSIS_MAKENSIS NAMES makensis +if(WIN32 AND NOT UNIX) + find_program(NSIS_MAKENSIS NAMES makensis PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS] DOC "Where is makensis.exe located" ) - IF(NOT NSIS_MAKENSIS) - SET(CPACK_GENERATOR TGZ) - ENDIF(NOT NSIS_MAKENSIS) -ENDIF(WIN32 AND NOT UNIX) -IF(UNIX AND NOT APPLE) - SET(CPACK_GENERATOR "TGZ;STGZ;TZ") - # FIND_PROGRAM(found_compress + if(NOT NSIS_MAKENSIS) + set(CPACK_GENERATOR TGZ) + endif() +endif() +if(UNIX AND NOT APPLE) + set(CPACK_GENERATOR "TGZ;STGZ;TZ") + # find_program(found_compress # NAMES compress) - # IF(found_compress) - # FIND_PROGRAM(file_command NAMES file) - # IF(NOT file_command) + # if(found_compress) + # find_program(file_command NAMES file) + # if(NOT file_command) # set(file_command file) - # ENDIF(NOT file_command) - # EXECUTE_PROCESS(COMMAND ${file_command} ${found_compress} + # endif() + # execute_process(COMMAND ${file_command} ${found_compress} # OUTPUT_VARIABLE output) # set(SKIP_TZ FALSE) # if("${output}" MATCHES "script") # set(SKIP_TZ TRUE) - # endif("${output}" MATCHES "script") + # endif() # if("${output}" MATCHES "dummy.sh") # set(SKIP_TZ TRUE) - # endif("${output}" MATCHES "dummy.sh") + # endif() # if(NOT SKIP_TZ) # message("compress found and it was not a script") # message("output from file command: [${output}]") - # SET(CPACK_GENERATOR "${CPACK_GENERATOR};TZ") - # else(NOT SKIP_TZ) + # set(CPACK_GENERATOR "${CPACK_GENERATOR};TZ") + # else() # message("compress found, but it was a script so dont use it") # message("output from file command: [${output}]") - # endif(NOT SKIP_TZ) - # ENDIF(found_compress) - FIND_PROGRAM(found_bz2 + # endif() + # endif() + find_program(found_bz2 NAMES bzip2) - IF(found_bz2) - SET(CPACK_GENERATOR "${CPACK_GENERATOR};TBZ2") - ENDIF(found_bz2) -ENDIF(UNIX AND NOT APPLE) + if(found_bz2) + set(CPACK_GENERATOR "${CPACK_GENERATOR};TBZ2") + endif() +endif() -SET(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install") -SET(CMAKE_INSTALL_MFC_LIBRARIES 1) -SET(CMAKE_INSTALL_DEBUG_LIBRARIES 1) -INCLUDE(InstallRequiredSystemLibraries) +set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install") +set(CMAKE_INSTALL_MFC_LIBRARIES 1) +set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) +include(InstallRequiredSystemLibraries) -IF(CTEST_TEST_CPACK) - SET(PACKAGE_TARGET --build-target package) +if(CTEST_TEST_CPACK) + set(PACKAGE_TARGET --build-target package) # Avoid settings that require the .zip file command line tools... # (just build an NSIS installer without component support) # - SET(CPACK_BINARY_ZIP OFF) - SET(CPACK_MONOLITHIC_INSTALL ON) -ELSE(CTEST_TEST_CPACK) - SET(PACKAGE_TARGET) -ENDIF(CTEST_TEST_CPACK) + set(CPACK_BINARY_ZIP OFF) + set(CPACK_MONOLITHIC_INSTALL ON) +else() + set(PACKAGE_TARGET) +endif() -INCLUDE(CPack) +include(CPack) -ADD_CUSTOM_COMMAND( +add_custom_command( TARGET ${install_target} POST_BUILD COMMAND ${CMAKE_CTEST_COMMAND} diff --git a/Tests/SimpleInstallS2/InstallScript1.cmake b/Tests/SimpleInstallS2/InstallScript1.cmake index 27b7725f8..ef9da5761 100644 --- a/Tests/SimpleInstallS2/InstallScript1.cmake +++ b/Tests/SimpleInstallS2/InstallScript1.cmake @@ -1,5 +1,5 @@ -MESSAGE("This is install script 1.") -SET(INSTALL_SCRIPT_1_DID_RUN 1) -IF(INSTALL_CODE_DID_RUN) - MESSAGE(FATAL_ERROR "Install script 1 did not run before install code.") -ENDIF(INSTALL_CODE_DID_RUN) +message("This is install script 1.") +set(INSTALL_SCRIPT_1_DID_RUN 1) +if(INSTALL_CODE_DID_RUN) + message(FATAL_ERROR "Install script 1 did not run before install code.") +endif() diff --git a/Tests/SimpleInstallS2/InstallScript2.cmake b/Tests/SimpleInstallS2/InstallScript2.cmake index 927cae8b6..c1d20a3a6 100644 --- a/Tests/SimpleInstallS2/InstallScript2.cmake +++ b/Tests/SimpleInstallS2/InstallScript2.cmake @@ -1,14 +1,14 @@ -MESSAGE("This is install script 2.") -IF(INSTALL_SCRIPT_1_DID_RUN) - MESSAGE("Install script ordering works.") -ELSE(INSTALL_SCRIPT_1_DID_RUN) - MESSAGE(FATAL_ERROR "Install script 1 did not run before install script 2.") -ENDIF(INSTALL_SCRIPT_1_DID_RUN) -IF(INSTALL_CODE_DID_RUN) - MESSAGE("Install code ordering works.") -ELSE(INSTALL_CODE_DID_RUN) - MESSAGE(FATAL_ERROR "Install script 2 did not run after install code.") -ENDIF(INSTALL_CODE_DID_RUN) -FILE(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake" - "SET(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n" +message("This is install script 2.") +if(INSTALL_SCRIPT_1_DID_RUN) + message("Install script ordering works.") +else() + message(FATAL_ERROR "Install script 1 did not run before install script 2.") +endif() +if(INSTALL_CODE_DID_RUN) + message("Install code ordering works.") +else() + message(FATAL_ERROR "Install script 2 did not run after install code.") +endif() +file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake" + "set(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n" ) diff --git a/Tests/SimpleInstallS2/InstallScript3.cmake b/Tests/SimpleInstallS2/InstallScript3.cmake index b1aecd4c2..64851564d 100644 --- a/Tests/SimpleInstallS2/InstallScript3.cmake +++ b/Tests/SimpleInstallS2/InstallScript3.cmake @@ -1,12 +1,12 @@ -MESSAGE("This is install script 3.") -SET(INSTALL_SCRIPT_3_DID_RUN 1) -IF(INSTALL_CODE_WITH_COMPONENT_DID_RUN) - MESSAGE(FATAL_ERROR "Install script 3 did not run before install code with component.") -ENDIF(INSTALL_CODE_WITH_COMPONENT_DID_RUN) +message("This is install script 3.") +set(INSTALL_SCRIPT_3_DID_RUN 1) +if(INSTALL_CODE_WITH_COMPONENT_DID_RUN) + message(FATAL_ERROR "Install script 3 did not run before install code with component.") +endif() -IF(CMAKE_INSTALL_COMPONENT) -IF(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") - MESSAGE("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") - MESSAGE(FATAL_ERROR "Install script 3 should only run for \"Development\" INSTALL COMPONENT.") -ENDIF(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") -ENDIF(CMAKE_INSTALL_COMPONENT) +if(CMAKE_INSTALL_COMPONENT) +if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") + message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") + message(FATAL_ERROR "Install script 3 should only run for \"Development\" INSTALL COMPONENT.") +endif() +endif() diff --git a/Tests/SimpleInstallS2/InstallScript4.cmake b/Tests/SimpleInstallS2/InstallScript4.cmake index 0ffea4bc8..34d0a73bb 100644 --- a/Tests/SimpleInstallS2/InstallScript4.cmake +++ b/Tests/SimpleInstallS2/InstallScript4.cmake @@ -1,22 +1,22 @@ -MESSAGE("This is install script 4.") -IF(INSTALL_SCRIPT_3_DID_RUN) - MESSAGE("Install script ordering works.") -ELSE(INSTALL_SCRIPT_3_DID_RUN) - MESSAGE(FATAL_ERROR "Install script 3 did not run before install script 4.") -ENDIF(INSTALL_SCRIPT_3_DID_RUN) -IF(INSTALL_CODE_WITH_COMPONENT_DID_RUN) - MESSAGE("Install code ordering works.") -ELSE(INSTALL_CODE_WITH_COMPONENT_DID_RUN) - MESSAGE(FATAL_ERROR "Install script 4 did not run after install with component code.") -ENDIF(INSTALL_CODE_WITH_COMPONENT_DID_RUN) +message("This is install script 4.") +if(INSTALL_SCRIPT_3_DID_RUN) + message("Install script ordering works.") +else() + message(FATAL_ERROR "Install script 3 did not run before install script 4.") +endif() +if(INSTALL_CODE_WITH_COMPONENT_DID_RUN) + message("Install code ordering works.") +else() + message(FATAL_ERROR "Install script 4 did not run after install with component code.") +endif() -IF(CMAKE_INSTALL_COMPONENT) -IF(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") - MESSAGE("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") - MESSAGE(FATAL_ERROR "Install script 4 should only run for \"Development\" INSTALL COMPONENT.") -ENDIF(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") -ENDIF(CMAKE_INSTALL_COMPONENT) +if(CMAKE_INSTALL_COMPONENT) +if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") + message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") + message(FATAL_ERROR "Install script 4 should only run for \"Development\" INSTALL COMPONENT.") +endif() +endif() -FILE(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScript4Out.cmake" - "SET(CMAKE_INSTALL_SCRIPT_4_DID_RUN 1)\n" +file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScript4Out.cmake" + "set(CMAKE_INSTALL_SCRIPT_4_DID_RUN 1)\n" ) diff --git a/Tests/SimpleInstallS2/PackageScript.cmake b/Tests/SimpleInstallS2/PackageScript.cmake index 3567a2f43..53b790932 100644 --- a/Tests/SimpleInstallS2/PackageScript.cmake +++ b/Tests/SimpleInstallS2/PackageScript.cmake @@ -1,10 +1,10 @@ -MESSAGE("This is packaging script") -MESSAGE("It writes a file with all variables available in ${CMAKE_INSTALL_PREFIX}/AllVariables.txt") +message("This is packaging script") +message("It writes a file with all variables available in ${CMAKE_INSTALL_PREFIX}/AllVariables.txt") -FILE(WRITE ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "") -GET_CMAKE_PROPERTY(res VARIABLES) -FOREACH(var ${res}) - FILE(APPEND ${CMAKE_INSTALL_PREFIX}/AllVariables.txt +file(WRITE ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "") +get_cmake_property(res VARIABLES) +foreach(var ${res}) + file(APPEND ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "${var} \"${${var}}\"\n") -ENDFOREACH(var ${res}) +endforeach() diff --git a/Tests/SimpleInstallS2/PostInstall.cmake b/Tests/SimpleInstallS2/PostInstall.cmake index 52ea140a5..d616221ef 100644 --- a/Tests/SimpleInstallS2/PostInstall.cmake +++ b/Tests/SimpleInstallS2/PostInstall.cmake @@ -1,6 +1,6 @@ -MESSAGE("In post install") -IF(PRE_INSTALL_DID_RUN) - MESSAGE("Pre and post install work fine") -ELSE(PRE_INSTALL_DID_RUN) - MESSAGE(FATAL_ERROR "Pre install did not run before post install") -ENDIF(PRE_INSTALL_DID_RUN) +message("In post install") +if(PRE_INSTALL_DID_RUN) + message("Pre and post install work fine") +else() + message(FATAL_ERROR "Pre install did not run before post install") +endif() diff --git a/Tests/SimpleInstallS2/PreInstall.cmake b/Tests/SimpleInstallS2/PreInstall.cmake index 2ea2f7716..7a9851e1d 100644 --- a/Tests/SimpleInstallS2/PreInstall.cmake +++ b/Tests/SimpleInstallS2/PreInstall.cmake @@ -1,2 +1,2 @@ -MESSAGE("This is in pre install") -SET(PRE_INSTALL_DID_RUN 1) +message("This is in pre install") +set(PRE_INSTALL_DID_RUN 1) diff --git a/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt b/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt index 4f6295300..860e10425 100644 --- a/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt +++ b/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt @@ -1,3 +1,3 @@ -ADD_EXECUTABLE(TSD TSD.cxx TSD_utils.cxx) -INSTALL_FILES(/MyTest/include FILES TSD.h) -INSTALL_TARGETS(/MyTest/bin TSD) +add_executable(TSD TSD.cxx TSD_utils.cxx) +install_files(/MyTest/include FILES TSD.h) +install_targets(/MyTest/bin TSD) diff --git a/Tests/SimpleInstallS2/lib2.h b/Tests/SimpleInstallS2/lib2.h index ea5a6f7ea..d69b78613 100644 --- a/Tests/SimpleInstallS2/lib2.h +++ b/Tests/SimpleInstallS2/lib2.h @@ -5,7 +5,7 @@ # define CM_TEST_LIB_EXPORT __declspec( dllimport ) # endif #else -# define CM_TEST_LIB_EXPORT +# define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float Lib2Func(); diff --git a/Tests/SimpleInstallS2/lib3.h b/Tests/SimpleInstallS2/lib3.h index c250ed769..66bc52a7f 100644 --- a/Tests/SimpleInstallS2/lib3.h +++ b/Tests/SimpleInstallS2/lib3.h @@ -5,7 +5,7 @@ # define CM_TEST_LIB_EXPORT __declspec( dllimport ) # endif #else -# define CM_TEST_LIB_EXPORT +# define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float Lib3Func(); diff --git a/Tests/SimpleInstallS2/lib4.h b/Tests/SimpleInstallS2/lib4.h index 4b94ea207..11c127247 100644 --- a/Tests/SimpleInstallS2/lib4.h +++ b/Tests/SimpleInstallS2/lib4.h @@ -5,7 +5,7 @@ # define CM_TEST_LIB_EXPORT __declspec( dllimport ) # endif #else -# define CM_TEST_LIB_EXPORT +# define CM_TEST_LIB_EXPORT #endif CM_TEST_LIB_EXPORT float Lib4Func(); diff --git a/Tests/SimpleInstallS2/scripts/CMakeLists.txt b/Tests/SimpleInstallS2/scripts/CMakeLists.txt index d46c1652e..ec34e8c50 100644 --- a/Tests/SimpleInstallS2/scripts/CMakeLists.txt +++ b/Tests/SimpleInstallS2/scripts/CMakeLists.txt @@ -1 +1 @@ -INSTALL_PROGRAMS(/MyTest/share/old3 "^sample_script(\\.bat)?$") +install_programs(/MyTest/share/old3 "^sample_script(\\.bat)?$") diff --git a/Tests/SourceGroups/CMakeLists.txt b/Tests/SourceGroups/CMakeLists.txt index c3cf38c7a..6573c8241 100644 --- a/Tests/SourceGroups/CMakeLists.txt +++ b/Tests/SourceGroups/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required (VERSION 2.6) project(SourceGroups) # this is not really a test which can fail -# it is more an example with several source_group() +# it is more an example with several source_group() # commands. -# The created projects have to be loaded manually +# The created projects have to be loaded manually # in Visual Studio/Xcode/Eclipse/... # to see whether the correct groups have been created. @@ -19,7 +19,7 @@ source_group(Base\\Sub1\\Sub2 FILES sub1/foobar.c) # a group with empty name source_group("" FILES foo.c) -# a group, whose name consists only of the delimiter +# a group, whose name consists only of the delimiter #should be handled the same way as an empty name source_group("\\" FILES baz.c) diff --git a/Tests/SourceGroups/README.txt b/Tests/SourceGroups/README.txt index 1a4baf536..8b1378917 100644 --- a/Tests/SourceGroups/README.txt +++ b/Tests/SourceGroups/README.txt @@ -1 +1 @@ - + diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt index 7792a353d..6d798b067 100644 --- a/Tests/StringFileTest/CMakeLists.txt +++ b/Tests/StringFileTest/CMakeLists.txt @@ -1,164 +1,164 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(StringFileTest) -INCLUDE_DIRECTORIES(${StringFileTest_BINARY_DIR}) +project(StringFileTest) +include_directories(${StringFileTest_BINARY_DIR}) # Read file test -FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in" infile) +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in" infile) # Test reading a binary file into hex representation -FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/test.bin" hexContents HEX) +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/test.bin" hexContents HEX) -IF("${hexContents}" STREQUAL "0001027700") - MESSAGE("FILE(READ HEX) correctly read [${hexContents}]") -ELSE("${hexContents}" STREQUAL "0001027700") - MESSAGE(SEND_ERROR "FILE(READ HEX) incorrectly read [${hexContents}], but expected was [0001027700]") -ENDIF("${hexContents}" STREQUAL "0001027700") +if("${hexContents}" STREQUAL "0001027700") + message("file(READ HEX) correctly read [${hexContents}]") +else() + message(SEND_ERROR "file(READ HEX) incorrectly read [${hexContents}], but expected was [0001027700]") +endif() -# FILE(STRINGS) test -FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in" infile_strings +# file(STRINGS) test +file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in" infile_strings LIMIT_COUNT 1 LIMIT_INPUT 1024 LIMIT_OUTPUT 1024 LENGTH_MINIMUM 10 LENGTH_MAXIMUM 23 REGEX include NEWLINE_CONSUME) -SET(infile_strings_goal "#include \"includefile\"\n") -IF("${infile_strings}" STREQUAL "${infile_strings_goal}") - MESSAGE("FILE(STRINGS) correctly read [${infile_strings}]") -ELSE("${infile_strings}" STREQUAL "${infile_strings_goal}") - MESSAGE(SEND_ERROR - "FILE(STRINGS) incorrectly read [${infile_strings}]") -ENDIF("${infile_strings}" STREQUAL "${infile_strings_goal}") +set(infile_strings_goal "#include \"includefile\"\n") +if("${infile_strings}" STREQUAL "${infile_strings_goal}") + message("file(STRINGS) correctly read [${infile_strings}]") +else() + message(SEND_ERROR + "file(STRINGS) incorrectly read [${infile_strings}]") +endif() # test reading a file and getting its binary data as hex string -FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/main.srec" infilehex LIMIT 4 HEX) -IF(NOT "${infilehex}" STREQUAL "53313036") - MESSAGE(SEND_ERROR - "FILE(READ ... HEX) error, read: \"${infilehex}\", expected \"53313036\"") -ENDIF(NOT "${infilehex}" STREQUAL "53313036") +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/main.srec" infilehex LIMIT 4 HEX) +if(NOT "${infilehex}" STREQUAL "53313036") + message(SEND_ERROR + "file(READ ... HEX) error, read: \"${infilehex}\", expected \"53313036\"") +endif() -# test that FILE(STRINGS) also work with Intel hex and Motorola S-record files +# test that file(STRINGS) also work with Intel hex and Motorola S-record files # this file has been created with "sdcc main.c" -FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/main.ihx" infile_strings REGEX INFO) -SET(infile_strings_goal "INFO:compiler\\[SDCC-HEX\\]") -IF("${infile_strings}" MATCHES "${infile_strings_goal}") - MESSAGE("FILE(STRINGS) correctly read from hex file [${infile_strings}]") -ELSE("${infile_strings}" MATCHES "${infile_strings_goal}") - MESSAGE(SEND_ERROR - "FILE(STRINGS) incorrectly read from hex file [${infile_strings}]") -ENDIF("${infile_strings}" MATCHES "${infile_strings_goal}") +file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/main.ihx" infile_strings REGEX INFO) +set(infile_strings_goal "INFO:compiler\\[SDCC-HEX\\]") +if("${infile_strings}" MATCHES "${infile_strings_goal}") + message("file(STRINGS) correctly read from hex file [${infile_strings}]") +else() + message(SEND_ERROR + "file(STRINGS) incorrectly read from hex file [${infile_strings}]") +endif() # this file has been created with "sdcc main.c --out-fmt-s19" -FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/main.srec" infile_strings REGEX INFO) -SET(infile_strings_goal "INFO:compiler\\[SDCC-SREC\\]") -IF("${infile_strings}" MATCHES "${infile_strings_goal}") - MESSAGE("FILE(STRINGS) correctly read from srec file [${infile_strings}]") -ELSE("${infile_strings}" MATCHES "${infile_strings_goal}") - MESSAGE(SEND_ERROR - "FILE(STRINGS) incorrectly read from srec file [${infile_strings}]") -ENDIF("${infile_strings}" MATCHES "${infile_strings_goal}") +file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/main.srec" infile_strings REGEX INFO) +set(infile_strings_goal "INFO:compiler\\[SDCC-SREC\\]") +if("${infile_strings}" MATCHES "${infile_strings_goal}") + message("file(STRINGS) correctly read from srec file [${infile_strings}]") +else() + message(SEND_ERROR + "file(STRINGS) incorrectly read from srec file [${infile_strings}]") +endif() # String test -STRING(REGEX MATCH "[cC][mM][aA][kK][eE]" rmvar "CMake is great") -STRING(REGEX MATCHALL "[cC][mM][aA][kK][eE]" rmallvar "CMake is better than cmake or CMake") -STRING(REGEX REPLACE "[Aa][uU][tT][oO]([cC][oO][nN][fF]|[mM][aA][kK][eE])" +string(REGEX MATCH "[cC][mM][aA][kK][eE]" rmvar "CMake is great") +string(REGEX MATCHALL "[cC][mM][aA][kK][eE]" rmallvar "CMake is better than cmake or CMake") +string(REGEX REPLACE "[Aa][uU][tT][oO]([cC][oO][nN][fF]|[mM][aA][kK][eE])" "CMake" rrepvar "People should use Autoconf and Automake") -STRING(COMPARE EQUAL "CMake" "Autoconf" nceqvar) -STRING(COMPARE EQUAL "CMake" "CMake" ceqvar) -STRING(COMPARE NOTEQUAL "CMake" "Autoconf" cneqvar) -STRING(COMPARE NOTEQUAL "CMake" "CMake" ncneqvar) -STRING(COMPARE LESS "before" "after" nclvar) -STRING(COMPARE LESS "max" "min" clvar) -STRING(COMPARE GREATER "before" "after" cgvar) -STRING(COMPARE GREATER "max" "min" ncgvar) -STRING(ASCII 67 109 97 107 101 savar) -STRING(TOUPPER "CMake" tuvar) -STRING(TOLOWER "CMake" tlvar) -STRING(REPLACE "Autoconf" "CMake" repvar "People should use Autoconf") - -IF("abc" STREQUAL "xyz") - MESSAGE(SEND_ERROR "Problem with the IF(STREQUAL), \"abc\" and \"xyz\" considered equal") -ENDIF("abc" STREQUAL "xyz") - -IF("CMake is cool" MATCHES "(CMake) (is).+") - IF(NOT "${CMAKE_MATCH_0}" STREQUAL "CMake is cool") - MESSAGE(SEND_ERROR "CMAKE_MATCH_0 wrong: \"${CMAKE_MATCH_0}\", expected \"CMake is cool\"") - ENDIF(NOT "${CMAKE_MATCH_0}" STREQUAL "CMake is cool") - IF(NOT "${CMAKE_MATCH_1}" STREQUAL "CMake") - MESSAGE(SEND_ERROR "CMAKE_MATCH_1 wrong: \"${CMAKE_MATCH_1}\", expected \"CMake\"") - ENDIF(NOT "${CMAKE_MATCH_1}" STREQUAL "CMake") - IF(NOT "${CMAKE_MATCH_2}" STREQUAL "is") - MESSAGE(SEND_ERROR "CMAKE_MATCH_2 wrong: \"${CMAKE_MATCH_2}\", expected \"is\"") - ENDIF(NOT "${CMAKE_MATCH_2}" STREQUAL "is") -ELSE("CMake is cool" MATCHES "(CMake) (is).+") - MESSAGE(SEND_ERROR "Problem with the IF(MATCHES), no match found") -ENDIF("CMake is cool" MATCHES "(CMake) (is).+") - -STRING(REGEX MATCH "(People).+CMake" matchResultVar "People should use CMake") -IF(NOT "${matchResultVar}" STREQUAL "People should use CMake") - MESSAGE(SEND_ERROR "STRING(REGEX MATCH) problem: \"${matchResultVar}\", expected \"People should use CMake\"") -ENDIF(NOT "${matchResultVar}" STREQUAL "People should use CMake") -IF(NOT "${CMAKE_MATCH_0}" STREQUAL "People should use CMake") - MESSAGE(SEND_ERROR "CMAKE_MATCH_0 wrong: \"${CMAKE_MATCH_0}\", expected \"People should use CMake\"") -ENDIF(NOT "${CMAKE_MATCH_0}" STREQUAL "People should use CMake") -IF(NOT "${CMAKE_MATCH_1}" STREQUAL "People") - MESSAGE(SEND_ERROR "CMAKE_MATCH_1 wrong: \"${CMAKE_MATCH_1}\", expected \"People\"") -ENDIF(NOT "${CMAKE_MATCH_1}" STREQUAL "People") -IF(NOT "${CMAKE_MATCH_2}" STREQUAL "") - MESSAGE(SEND_ERROR "CMAKE_MATCH_2 wrong: \"${CMAKE_MATCH_2}\", expected empty string") -ENDIF(NOT "${CMAKE_MATCH_2}" STREQUAL "") - - -STRING(STRIP " +string(COMPARE EQUAL "CMake" "Autoconf" nceqvar) +string(COMPARE EQUAL "CMake" "CMake" ceqvar) +string(COMPARE NOTEQUAL "CMake" "Autoconf" cneqvar) +string(COMPARE NOTEQUAL "CMake" "CMake" ncneqvar) +string(COMPARE LESS "before" "after" nclvar) +string(COMPARE LESS "max" "min" clvar) +string(COMPARE GREATER "before" "after" cgvar) +string(COMPARE GREATER "max" "min" ncgvar) +string(ASCII 67 109 97 107 101 savar) +string(TOUPPER "CMake" tuvar) +string(TOLOWER "CMake" tlvar) +string(REPLACE "Autoconf" "CMake" repvar "People should use Autoconf") + +if("abc" STREQUAL "xyz") + message(SEND_ERROR "Problem with the if(STREQUAL), \"abc\" and \"xyz\" considered equal") +endif() + +if("CMake is cool" MATCHES "(CMake) (is).+") + if(NOT "${CMAKE_MATCH_0}" STREQUAL "CMake is cool") + message(SEND_ERROR "CMAKE_MATCH_0 wrong: \"${CMAKE_MATCH_0}\", expected \"CMake is cool\"") + endif() + if(NOT "${CMAKE_MATCH_1}" STREQUAL "CMake") + message(SEND_ERROR "CMAKE_MATCH_1 wrong: \"${CMAKE_MATCH_1}\", expected \"CMake\"") + endif() + if(NOT "${CMAKE_MATCH_2}" STREQUAL "is") + message(SEND_ERROR "CMAKE_MATCH_2 wrong: \"${CMAKE_MATCH_2}\", expected \"is\"") + endif() +else() + message(SEND_ERROR "Problem with the if(MATCHES), no match found") +endif() + +string(REGEX MATCH "(People).+CMake" matchResultVar "People should use CMake") +if(NOT "${matchResultVar}" STREQUAL "People should use CMake") + message(SEND_ERROR "string(REGEX MATCH) problem: \"${matchResultVar}\", expected \"People should use CMake\"") +endif() +if(NOT "${CMAKE_MATCH_0}" STREQUAL "People should use CMake") + message(SEND_ERROR "CMAKE_MATCH_0 wrong: \"${CMAKE_MATCH_0}\", expected \"People should use CMake\"") +endif() +if(NOT "${CMAKE_MATCH_1}" STREQUAL "People") + message(SEND_ERROR "CMAKE_MATCH_1 wrong: \"${CMAKE_MATCH_1}\", expected \"People\"") +endif() +if(NOT "${CMAKE_MATCH_2}" STREQUAL "") + message(SEND_ERROR "CMAKE_MATCH_2 wrong: \"${CMAKE_MATCH_2}\", expected empty string") +endif() + + +string(STRIP " ST1 " ST1) -STRING(STRIP "ST2 " ST2) -STRING(STRIP " ST3" ST3) +string(STRIP "ST2 " ST2) +string(STRIP " ST3" ST3) -FOREACH(var ST1 ST2 ST3) - IF("${var}" STREQUAL "${${var}}") - MESSAGE("[${var}] == [${${var}}]") - ELSE("${var}" STREQUAL "${${var}}") - MESSAGE(SEND_ERROR "Problem with the STRIP command for ${var}: [${${var}}]") - ENDIF("${var}" STREQUAL "${${var}}") -ENDFOREACH(var) +foreach(var ST1 ST2 ST3) + if("${var}" STREQUAL "${${var}}") + message("[${var}] == [${${var}}]") + else() + message(SEND_ERROR "Problem with the STRIP command for ${var}: [${${var}}]") + endif() +endforeach() -STRING(SUBSTRING "People should use Autoconf" 7 10 substringres) -SET(substringres "Everybody ${substringres} CMake") +string(SUBSTRING "People should use Autoconf" 7 10 substringres) +set(substringres "Everybody ${substringres} CMake") -STRING(LENGTH ${substringres} lengthres) +string(LENGTH ${substringres} lengthres) -FILE(RELATIVE_PATH relpath "/usr/local/bin" "/usr/X11R6/bin/xnest") +file(RELATIVE_PATH relpath "/usr/local/bin" "/usr/X11R6/bin/xnest") # Escaping test -SET(var "\\ \" \ \t \n \r \# \( \) \0") -MESSAGE("Output: [${var}]") -SET(var \\ \" \ \t \n \r \# \( \) \0) -MESSAGE("Output: [${var}]") +set(var "\\ \" \ \t \n \r \# \( \) \0") +message("Output: [${var}]") +set(var \\ \" \ \t \n \r \# \( \) \0) +message("Output: [${var}]") # Make-style unquoted argument test -SET(var $(VAR1)$(VAR2)/$(VAR3)) -MESSAGE("Output: [${var}]") -STRING(COMPARE EQUAL "${var}" "$(VAR1)$(VAR2)/$(VAR3)" result) -IF(NOT result) - MESSAGE(SEND_ERROR "Unquoted $(VAR) syntax is broken.") -ENDIF(NOT result) +set(var $(VAR1)$(VAR2)/$(VAR3)) +message("Output: [${var}]") +string(COMPARE EQUAL "${var}" "$(VAR1)$(VAR2)/$(VAR3)" result) +if(NOT result) + message(SEND_ERROR "Unquoted $(VAR) syntax is broken.") +endif() # Obscure environment variable name -SET("ENV{x+(y)}" "Obscure environment variable value") -MESSAGE("Output: [$ENV{x+(y)}]") -IF(NOT "$ENV{x+(y)}" STREQUAL "Obscure environment variable value") - MESSAGE(SEND_ERROR "Environment variable \"ENV{x+(y)}\" does not work.") -ENDIF() +set("ENV{x+(y)}" "Obscure environment variable value") +message("Output: [$ENV{x+(y)}]") +if(NOT "$ENV{x+(y)}" STREQUAL "Obscure environment variable value") + message(SEND_ERROR "Environment variable \"ENV{x+(y)}\" does not work.") +endif() # Make directories test -FILE(MAKE_DIRECTORY - "${CMAKE_CURRENT_BINARY_DIR}/Includes" +file(MAKE_DIRECTORY + "${CMAKE_CURRENT_BINARY_DIR}/Includes" "${CMAKE_CURRENT_BINARY_DIR}/Directory1" "${CMAKE_CURRENT_BINARY_DIR}/Directory2" ) # Write results to the file (test write file) -SET(file "${CMAKE_CURRENT_BINARY_DIR}/Includes/Values.h") -FILE(WRITE "${file}" "/* this file is generated */\n") -FOREACH(var +set(file "${CMAKE_CURRENT_BINARY_DIR}/Includes/Values.h") +file(WRITE "${file}" "/* this file is generated */\n") +foreach(var rmvar rmallvar rrepvar @@ -177,28 +177,28 @@ FOREACH(var savar tuvar tlvar) - FILE(APPEND "${file}" "#define ${var} \"${${var}}\"\n") -ENDFOREACH(var) + file(APPEND "${file}" "#define ${var} \"${${var}}\"\n") +endforeach() # Verify that the file was created recently. -IF(NOT "${file}" IS_NEWER_THAN "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in") - MESSAGE(FATAL_ERROR "IF(FILE_IS_NEWER) does not seem to work.") -ENDIF(NOT "${file}" IS_NEWER_THAN "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in") +if(NOT "${file}" IS_NEWER_THAN "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in") + message(FATAL_ERROR "if(FILE_IS_NEWER) does not seem to work.") +endif() # Test configuration of the string -SET(TEST_DEFINED 123) -SET(TEST_NOT_DEFINED) -STRING(CONFIGURE "${infile}" infile+-/out @ONLY) -SET(infile "${infile+-/out}") +set(TEST_DEFINED 123) +set(TEST_NOT_DEFINED) +string(CONFIGURE "${infile}" infile+-/out @ONLY) +set(infile "${infile+-/out}") # Write include file to a file -STRING(REGEX REPLACE "includefile" "${file}" outfile "${infile}") -FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h-tmp" "${outfile}") -FILE(RENAME "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h-tmp" +string(REGEX REPLACE "includefile" "${file}" outfile "${infile}") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h-tmp" "${outfile}") +file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h-tmp" "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h") # Test file copy with relative paths -FILE(COPY . +file(COPY . DESTINATION src FILE_PERMISSIONS OWNER_READ # test no OWNER_WRITE DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE @@ -207,31 +207,31 @@ FILE(COPY . ) # Test file glob -FILE(GLOB_RECURSE src_files "${CMAKE_CURRENT_SOURCE_DIR}/*") -MESSAGE("Files in ${CMAKE_CURRENT_SOURCE_DIR} are ${src_files}") -SET(expr "${CMAKE_CURRENT_BINARY_DIR}/src/[sS][!a-su-zA-Z0-9][^a-qs-zA-Z0-9]ing?ile*.cxx") -MESSAGE("Glob expression is [${expr}].") -FILE(GLOB src_files "${expr}") -MESSAGE("Globbed files [${src_files}].") -ADD_EXECUTABLE(StringFileTest ${src_files}) - -SET(expr "${CMAKE_CURRENT_SOURCE_DIR}/../*.cxx") -FILE(GLOB_RECURSE rel_src_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/.." "${expr}") -MESSAGE("Globbed files [${rel_src_files}].") +file(GLOB_RECURSE src_files "${CMAKE_CURRENT_SOURCE_DIR}/*") +message("Files in ${CMAKE_CURRENT_SOURCE_DIR} are ${src_files}") +set(expr "${CMAKE_CURRENT_BINARY_DIR}/src/[sS][!a-su-zA-Z0-9][^a-qs-zA-Z0-9]ing?ile*.cxx") +message("Glob expression is [${expr}].") +file(GLOB src_files "${expr}") +message("Globbed files [${src_files}].") +add_executable(StringFileTest ${src_files}) + +set(expr "${CMAKE_CURRENT_SOURCE_DIR}/../*.cxx") +file(GLOB_RECURSE rel_src_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/.." "${expr}") +message("Globbed files [${rel_src_files}].") # Test FOREACH range -MESSAGE("Cheack if FOREACH with RANGE works") -MACRO(TEST_RANGE ARGS CHECK) - SET(r) - FOREACH(a RANGE ${ARGS}) - SET(r ${r} ${a}) - ENDFOREACH(a) - MESSAGE("FOREACH with RANGE ${ARGS} produces ${r}") - IF("x${r}x" MATCHES "^x${CHECK}x$") - ELSE("x${r}x" MATCHES "^x${CHECK}x$") - MESSAGE(SEND_ERROR "The range resulted in: ${r} should be ${CHECK}") - ENDIF("x${r}x" MATCHES "^x${CHECK}x$") -ENDMACRO(TEST_RANGE) +message("Cheack if FOREACH with RANGE works") +macro(TEST_RANGE ARGS CHECK) + set(r) + foreach(a RANGE ${ARGS}) + set(r ${r} ${a}) + endforeach() + message("FOREACH with RANGE ${ARGS} produces ${r}") + if("x${r}x" MATCHES "^x${CHECK}x$") + else() + message(SEND_ERROR "The range resulted in: ${r} should be ${CHECK}") + endif() +endmacro() TEST_RANGE("5" "0;1;2;3;4;5") TEST_RANGE("3;5" "3;4;5") TEST_RANGE("5;3" "5;4;3") @@ -246,7 +246,7 @@ set(var_a) set(var_b) foreach(item IN LISTS list1 list2 ITEMS "" a "") set(var_${item} "${var_${item}}x") -endforeach(item) +endforeach() if(NOT "${var_}" STREQUAL "xxxxx") message(FATAL_ERROR "count incorrect for \"\": [${var_}]") endif() @@ -258,25 +258,25 @@ if(NOT "${var_b}" STREQUAL "x") endif() # Test SUBSTRING command -SET(ST_INPUTSTRING "0123456789") -STRING(SUBSTRING ${ST_INPUTSTRING} 3 0 ST_EMPTY) -STRING(SUBSTRING ${ST_INPUTSTRING} 1 1 ST_ONE) -STRING(SUBSTRING ${ST_INPUTSTRING} 0 10 ST_ALL) -STRING(SUBSTRING ${ST_INPUTSTRING} 0 -1 ST_ALL_MINUS) -STRING(SUBSTRING ${ST_INPUTSTRING} 9 -1 ST_NINE) - -IF(ST_EMPTY) - MESSAGE(SEND_ERROR "SUBSTRING with length 0 does not return an empty string") -ENDIF(ST_EMPTY) -IF(NOT ST_ONE STREQUAL "1") - MESSAGE(SEND_ERROR "SUBSTING command does not cut the correct selected character, was \"" ${ST_ONE} "\", should be \"1\"") -ENDIF(NOT ST_ONE STREQUAL "1") -IF(NOT ST_INPUTSTRING STREQUAL ST_ALL) - MESSAGE(SEND_ERROR "SUBSTRING does not return the whole string when selected with length") -ENDIF(NOT ST_INPUTSTRING STREQUAL ST_ALL) -IF(NOT ST_INPUTSTRING STREQUAL ST_ALL_MINUS) - MESSAGE(SEND_ERROR "SUBSTRING does not return the whole string when selected with -1") -ENDIF(NOT ST_INPUTSTRING STREQUAL ST_ALL_MINUS) -IF(NOT ST_NINE STREQUAL "9") - MESSAGE(SEND_ERROR "SUBSTRING does not return the tail when selected with -1") -ENDIF(NOT ST_NINE STREQUAL "9") +set(ST_INPUTSTRING "0123456789") +string(SUBSTRING ${ST_INPUTSTRING} 3 0 ST_EMPTY) +string(SUBSTRING ${ST_INPUTSTRING} 1 1 ST_ONE) +string(SUBSTRING ${ST_INPUTSTRING} 0 10 ST_ALL) +string(SUBSTRING ${ST_INPUTSTRING} 0 -1 ST_ALL_MINUS) +string(SUBSTRING ${ST_INPUTSTRING} 9 -1 ST_NINE) + +if(ST_EMPTY) + message(SEND_ERROR "SUBSTRING with length 0 does not return an empty string") +endif() +if(NOT ST_ONE STREQUAL "1") + message(SEND_ERROR "SUBSTING command does not cut the correct selected character, was \"" ${ST_ONE} "\", should be \"1\"") +endif() +if(NOT ST_INPUTSTRING STREQUAL ST_ALL) + message(SEND_ERROR "SUBSTRING does not return the whole string when selected with length") +endif() +if(NOT ST_INPUTSTRING STREQUAL ST_ALL_MINUS) + message(SEND_ERROR "SUBSTRING does not return the whole string when selected with -1") +endif() +if(NOT ST_NINE STREQUAL "9") + message(SEND_ERROR "SUBSTRING does not return the tail when selected with -1") +endif() diff --git a/Tests/StringFileTest/InputFile.h.in b/Tests/StringFileTest/InputFile.h.in index 3e70a36e8..0f01ccfc6 100644 --- a/Tests/StringFileTest/InputFile.h.in +++ b/Tests/StringFileTest/InputFile.h.in @@ -3,7 +3,7 @@ /* This should be configured to a define. */ #cmakedefine TEST_DEFINED @TEST_DEFINED@ /* This should be configured to a commented undef with the curlies in place */ -#cmakedefine TEST_NOT_DEFINED ${TEST_NOT_DEFINED} +#cmakedefine TEST_NOT_DEFINED ${TEST_NOT_DEFINED} /* This complicated line should be configured unchanged: */ static const char* configvar = @@ -34,5 +34,5 @@ int CheckMethod(const char* var, const char* val ) return 1; #else return 0; -#endif +#endif } diff --git a/Tests/StringFileTest/StringFile.cxx b/Tests/StringFileTest/StringFile.cxx index 609ebaf20..9eba6bff9 100644 --- a/Tests/StringFileTest/StringFile.cxx +++ b/Tests/StringFileTest/StringFile.cxx @@ -26,6 +26,6 @@ int main(int, char*[]) res += CheckMethod(relpath, "../../X11R6/bin/xnest"); res += CheckMethod(configvar, "@$@$junk =~ s/#$xyz#/$foo_bar{$wibble}->{$xyz}/;@@"); - + return res; } diff --git a/Tests/SubDir/CMakeLists.txt b/Tests/SubDir/CMakeLists.txt index 9cfbe25ce..6822e6bd9 100644 --- a/Tests/SubDir/CMakeLists.txt +++ b/Tests/SubDir/CMakeLists.txt @@ -1,46 +1,46 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(SUBDIR) -SUBDIRS(Executable EXCLUDE_FROM_ALL Examples) -WRITE_FILE(${SUBDIR_BINARY_DIR}/ShouldBeHere "This file should exist.") +project(SUBDIR) +subdirs(Executable EXCLUDE_FROM_ALL Examples) +write_file(${SUBDIR_BINARY_DIR}/ShouldBeHere "This file should exist.") #WATCOM WMAKE does not support + in the name of a file! -IF(WATCOM) - SET(PLUS_NAME_FILES +if(WATCOM) + set(PLUS_NAME_FILES AnotherSubdir/pair_int.int.c vcl_algorithm_vcl_pair_double.foo.c) -ELSE(WATCOM) - SET(PLUS_NAME_FILES +else() + set(PLUS_NAME_FILES AnotherSubdir/pair+int.int.c vcl_algorithm+vcl_pair+double.foo.c) -ENDIF(WATCOM) +endif() -ADD_EXECUTABLE(TestFromSubdir +add_executable(TestFromSubdir AnotherSubdir/testfromsubdir.c AnotherSubdir/secondone ${PLUS_NAME_FILES} ) -AUX_SOURCE_DIRECTORY(ThirdSubDir SOURCES) -IF(WATCOM) - FOREACH(f ${SOURCES}) - IF("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c") - ELSE("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c") - SET(SOURCES2 ${f} ${SOURCES2}) - ENDIF("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c") - ENDFOREACH(f) - SET(SOURCES ${SOURCES2}) - SET(SOURCES ${SOURCES} +aux_source_directory(ThirdSubDir SOURCES) +if(WATCOM) + foreach(f ${SOURCES}) + if("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c") + else() + set(SOURCES2 ${f} ${SOURCES2}) + endif() + endforeach() + set(SOURCES ${SOURCES2}) + set(SOURCES ${SOURCES} vcl_algorithm_vcl_pair_double.foo.c) -ELSE(WATCOM) - FOREACH(f ${SOURCES}) - IF("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c") - ELSE("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c") - SET(SOURCES2 ${f} ${SOURCES2}) - MESSAGE("${f}") - ENDIF("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c") - ENDFOREACH(f) - SET(SOURCES ${SOURCES2}) - SET(SOURCES ${SOURCES} +else() + foreach(f ${SOURCES}) + if("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c") + else() + set(SOURCES2 ${f} ${SOURCES2}) + message("${f}") + endif() + endforeach() + set(SOURCES ${SOURCES2}) + set(SOURCES ${SOURCES} vcl_algorithm+vcl_pair+double.foo.c) -ENDIF(WATCOM) -MESSAGE("Sources: ${SOURCES}") -ADD_EXECUTABLE(TestWithAuxSourceDir ${SOURCES}) +endif() +message("Sources: ${SOURCES}") +add_executable(TestWithAuxSourceDir ${SOURCES}) diff --git a/Tests/SubDir/Examples/CMakeLists.txt b/Tests/SubDir/Examples/CMakeLists.txt index b0f1e896c..8cd7e24e1 100644 --- a/Tests/SubDir/Examples/CMakeLists.txt +++ b/Tests/SubDir/Examples/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(Examples) -SUBDIRS(example1 example2) +project(Examples) +subdirs(example1 example2) diff --git a/Tests/SubDir/Examples/example1/CMakeLists.txt b/Tests/SubDir/Examples/example1/CMakeLists.txt index 303618321..20d065e54 100644 --- a/Tests/SubDir/Examples/example1/CMakeLists.txt +++ b/Tests/SubDir/Examples/example1/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(example1) -ADD_EXECUTABLE(example1 example1.cxx) +project(example1) +add_executable(example1 example1.cxx) -ADD_CUSTOM_COMMAND(TARGET example1 POST_BUILD +add_custom_command(TARGET example1 POST_BUILD COMMAND "${CMAKE_COMMAND}" ARGS -E remove ${SUBDIR_BINARY_DIR}/ShouldBeHere COMMENT "Remove marker file that should exist because this should not be run") diff --git a/Tests/SubDir/Examples/example2/CMakeLists.txt b/Tests/SubDir/Examples/example2/CMakeLists.txt index 19a537686..388e33c3d 100644 --- a/Tests/SubDir/Examples/example2/CMakeLists.txt +++ b/Tests/SubDir/Examples/example2/CMakeLists.txt @@ -1,2 +1,2 @@ -PROJECT(example2) -ADD_EXECUTABLE(example2 example2.cxx) +project(example2) +add_executable(example2 example2.cxx) diff --git a/Tests/SubDir/Executable/CMakeLists.txt b/Tests/SubDir/Executable/CMakeLists.txt index d679168d8..77e6751cd 100644 --- a/Tests/SubDir/Executable/CMakeLists.txt +++ b/Tests/SubDir/Executable/CMakeLists.txt @@ -1 +1 @@ -ADD_EXECUTABLE(test test.cxx) +add_executable(test test.cxx) diff --git a/Tests/SubDirSpaces/CMakeLists.txt b/Tests/SubDirSpaces/CMakeLists.txt index 879530b56..69f1d6833 100644 --- a/Tests/SubDirSpaces/CMakeLists.txt +++ b/Tests/SubDirSpaces/CMakeLists.txt @@ -1,16 +1,16 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(SUBDIR) +project(SUBDIR) # Some systems do not seem to support rpath with spaces. -IF("${CMAKE_SYSTEM}" MATCHES "IRIX|QNX") - SET(CMAKE_SKIP_BUILD_RPATH 1) -ENDIF("${CMAKE_SYSTEM}" MATCHES "IRIX|QNX") +if("${CMAKE_SYSTEM}" MATCHES "IRIX|QNX") + set(CMAKE_SKIP_BUILD_RPATH 1) +endif() # be able to see output from make on dashboards -SET(CMAKE_VERBOSE_MAKEFILE 1) +set(CMAKE_VERBOSE_MAKEFILE 1) message("${CMAKE_MAKE_PROGRAM}") set(CMAKE_PAREN TRUE) -IF("${CMAKE_MAKE_PROGRAM}" MATCHES "wmake") +if("${CMAKE_MAKE_PROGRAM}" MATCHES "wmake") message("wmake does not support () in path") set(CMAKE_PAREN FALSE) elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "make") @@ -23,55 +23,55 @@ elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "make") endif() endif() -IF(CMAKE_PAREN) - ADD_DEFINITIONS(-DCMAKE_PAREN=1) - SUBDIRS("Executable Sources" "Some(x86) Sources" EXCLUDE_FROM_ALL "Some Examples") -ELSE(CMAKE_PAREN) - SUBDIRS("Executable Sources" EXCLUDE_FROM_ALL "Some Examples") -ENDIF(CMAKE_PAREN) +if(CMAKE_PAREN) + add_definitions(-DCMAKE_PAREN=1) + subdirs("Executable Sources" "Some(x86) Sources" EXCLUDE_FROM_ALL "Some Examples") +else() + subdirs("Executable Sources" EXCLUDE_FROM_ALL "Some Examples") +endif() -WRITE_FILE(${SUBDIR_BINARY_DIR}/ShouldBeHere "This file should exist.") +write_file(${SUBDIR_BINARY_DIR}/ShouldBeHere "This file should exist.") #WATCOM WMAKE does not support + in the name of a file! -IF(WATCOM) - SET(PLUS_NAME_FILES +if(WATCOM) + set(PLUS_NAME_FILES "Another Subdir/pair_int.int.c" vcl_algorithm_vcl_pair_double.foo.c) -ELSE(WATCOM) - SET(PLUS_NAME_FILES +else() + set(PLUS_NAME_FILES "Another Subdir/pair+int.int.c" vcl_algorithm+vcl_pair+double.foo.c) -ENDIF(WATCOM) +endif() -ADD_EXECUTABLE(TestFromSubdir +add_executable(TestFromSubdir "Another Subdir/testfromsubdir.c" "Another Subdir/secondone" ${PLUS_NAME_FILES} ) -AUX_SOURCE_DIRECTORY(ThirdSubDir SOURCES) -IF(WATCOM) - FOREACH(f ${SOURCES}) - IF("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c") - ELSE("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c") - SET(SOURCES2 ${f} ${SOURCES2}) - ENDIF("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c") - ENDFOREACH(f) - SET(SOURCES ${SOURCES2}) - SET(SOURCES ${SOURCES} +aux_source_directory(ThirdSubDir SOURCES) +if(WATCOM) + foreach(f ${SOURCES}) + if("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c") + else() + set(SOURCES2 ${f} ${SOURCES2}) + endif() + endforeach() + set(SOURCES ${SOURCES2}) + set(SOURCES ${SOURCES} vcl_algorithm_vcl_pair_double.foo.c) -ELSE(WATCOM) - FOREACH(f ${SOURCES}) - IF("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c") - ELSE("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c") - SET(SOURCES2 ${f} ${SOURCES2}) - ENDIF("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c") - ENDFOREACH(f) - SET(SOURCES ${SOURCES2}) - SET(SOURCES ${SOURCES} +else() + foreach(f ${SOURCES}) + if("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c") + else() + set(SOURCES2 ${f} ${SOURCES2}) + endif() + endforeach() + set(SOURCES ${SOURCES2}) + set(SOURCES ${SOURCES} vcl_algorithm+vcl_pair+double.foo.c) -ENDIF(WATCOM) -ADD_EXECUTABLE(TestWithAuxSourceDir ${SOURCES}) -IF(CMAKE_PAREN) +endif() +add_executable(TestWithAuxSourceDir ${SOURCES}) +if(CMAKE_PAREN) target_link_libraries(TestWithAuxSourceDir testOddPath) -ENDIF(CMAKE_PAREN) +endif() diff --git a/Tests/SubDirSpaces/Executable Sources/CMakeLists.txt b/Tests/SubDirSpaces/Executable Sources/CMakeLists.txt index d679168d8..77e6751cd 100644 --- a/Tests/SubDirSpaces/Executable Sources/CMakeLists.txt +++ b/Tests/SubDirSpaces/Executable Sources/CMakeLists.txt @@ -1 +1 @@ -ADD_EXECUTABLE(test test.cxx) +add_executable(test test.cxx) diff --git a/Tests/SubDirSpaces/Executable/CMakeLists.txt b/Tests/SubDirSpaces/Executable/CMakeLists.txt index d679168d8..77e6751cd 100644 --- a/Tests/SubDirSpaces/Executable/CMakeLists.txt +++ b/Tests/SubDirSpaces/Executable/CMakeLists.txt @@ -1 +1 @@ -ADD_EXECUTABLE(test test.cxx) +add_executable(test test.cxx) diff --git a/Tests/SubDirSpaces/Some Examples/CMakeLists.txt b/Tests/SubDirSpaces/Some Examples/CMakeLists.txt index b0f1e896c..8cd7e24e1 100644 --- a/Tests/SubDirSpaces/Some Examples/CMakeLists.txt +++ b/Tests/SubDirSpaces/Some Examples/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(Examples) -SUBDIRS(example1 example2) +project(Examples) +subdirs(example1 example2) diff --git a/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt b/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt index 303618321..20d065e54 100644 --- a/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt +++ b/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(example1) -ADD_EXECUTABLE(example1 example1.cxx) +project(example1) +add_executable(example1 example1.cxx) -ADD_CUSTOM_COMMAND(TARGET example1 POST_BUILD +add_custom_command(TARGET example1 POST_BUILD COMMAND "${CMAKE_COMMAND}" ARGS -E remove ${SUBDIR_BINARY_DIR}/ShouldBeHere COMMENT "Remove marker file that should exist because this should not be run") diff --git a/Tests/SubDirSpaces/Some Examples/example2/CMakeLists.txt b/Tests/SubDirSpaces/Some Examples/example2/CMakeLists.txt index 19a537686..388e33c3d 100644 --- a/Tests/SubDirSpaces/Some Examples/example2/CMakeLists.txt +++ b/Tests/SubDirSpaces/Some Examples/example2/CMakeLists.txt @@ -1,2 +1,2 @@ -PROJECT(example2) -ADD_EXECUTABLE(example2 example2.cxx) +project(example2) +add_executable(example2 example2.cxx) diff --git a/Tests/SwigTest/CMakeLists.txt b/Tests/SwigTest/CMakeLists.txt index 5a8e61922..17a502d7e 100644 --- a/Tests/SwigTest/CMakeLists.txt +++ b/Tests/SwigTest/CMakeLists.txt @@ -1,50 +1,50 @@ -SET(language "python") +set(language "python") cmake_minimum_required (VERSION 2.6) -PROJECT(example_${language}_class) +project(example_${language}_class) -FIND_PACKAGE(SWIG REQUIRED) -INCLUDE(${SWIG_USE_FILE}) +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) -IF(${language} MATCHES python) - FIND_PACKAGE(PythonLibs) - INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) - SET(SWIG_LANG_LIBRARIES ${PYTHON_LIBRARIES}) -ENDIF(${language} MATCHES python) -IF(${language} MATCHES perl) - FIND_PACKAGE(PerlLibs) - INCLUDE_DIRECTORIES(${PERL_INCLUDE_PATH}) - ADD_DEFINITIONS(${PERL_EXTRA_C_FLAGS}) - SET(SWIG_LANG_LIBRARIES ${PERL_LIBRARY}) -ENDIF(${language} MATCHES perl) -IF(${language} MATCHES tcl) - FIND_PACKAGE(TCL) - INCLUDE_DIRECTORIES(${TCL_INCLUDE_PATH}) - SET(SWIG_LANG_LIBRARIES ${TCL_LIBRARY}) -ENDIF(${language} MATCHES tcl) -IF(${language} MATCHES ruby) - FIND_PACKAGE(Ruby) - INCLUDE_DIRECTORIES(${RUBY_INCLUDE_PATH}) - SET(SWIG_LANG_LIBRARIES ${RUBY_LIBRARY}) -ENDIF(${language} MATCHES ruby) -IF(${language} MATCHES php4) - FIND_PACKAGE(PHP4) - INCLUDE_DIRECTORIES(${PHP4_INCLUDE_PATH}) - SET(SWIG_LANG_LIBRARIES ${PHP4_LIBRARY}) -ENDIF(${language} MATCHES php4) -IF(${language} MATCHES pike) - FIND_PACKAGE(Pike) - INCLUDE_DIRECTORIES(${PIKE_INCLUDE_PATH}) - SET(SWIG_LANG_LIBRARIES ${PIKE_LIBRARY}) -ENDIF(${language} MATCHES pike) +if(${language} MATCHES python) + find_package(PythonLibs) + include_directories(${PYTHON_INCLUDE_PATH}) + set(SWIG_LANG_LIBRARIES ${PYTHON_LIBRARIES}) +endif() +if(${language} MATCHES perl) + find_package(PerlLibs) + include_directories(${PERL_INCLUDE_PATH}) + add_definitions(${PERL_EXTRA_C_FLAGS}) + set(SWIG_LANG_LIBRARIES ${PERL_LIBRARY}) +endif() +if(${language} MATCHES tcl) + find_package(TCL) + include_directories(${TCL_INCLUDE_PATH}) + set(SWIG_LANG_LIBRARIES ${TCL_LIBRARY}) +endif() +if(${language} MATCHES ruby) + find_package(Ruby) + include_directories(${RUBY_INCLUDE_PATH}) + set(SWIG_LANG_LIBRARIES ${RUBY_LIBRARY}) +endif() +if(${language} MATCHES php4) + find_package(PHP4) + include_directories(${PHP4_INCLUDE_PATH}) + set(SWIG_LANG_LIBRARIES ${PHP4_LIBRARY}) +endif() +if(${language} MATCHES pike) + find_package(Pike) + include_directories(${PIKE_INCLUDE_PATH}) + set(SWIG_LANG_LIBRARIES ${PIKE_LIBRARY}) +endif() -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -SET(CMAKE_SWIG_FLAGS "") +set(CMAKE_SWIG_FLAGS "") -SET_SOURCE_FILES_PROPERTIES(example.i PROPERTIES CPLUSPLUS ON) -SET_SOURCE_FILES_PROPERTIES(example.i PROPERTIES SWIG_FLAGS "-includeall") +set_source_files_properties(example.i PROPERTIES CPLUSPLUS ON) +set_source_files_properties(example.i PROPERTIES SWIG_FLAGS "-includeall") SWIG_ADD_MODULE(example "${language}" example.i example.cxx) SWIG_LINK_LIBRARIES(example ${SWIG_LANG_LIBRARIES}) diff --git a/Tests/SwigTest/example.h b/Tests/SwigTest/example.h index 46d901361..c9d59f22b 100644 --- a/Tests/SwigTest/example.h +++ b/Tests/SwigTest/example.h @@ -8,7 +8,7 @@ public: virtual ~Shape() { nshapes--; }; - double x, y; + double x, y; void move(double dx, double dy); virtual double area(void) = 0; virtual double perimeter(void) = 0; @@ -36,4 +36,4 @@ public: - + diff --git a/Tests/SwigTest/runme.pike b/Tests/SwigTest/runme.pike index a6377600e..ec28dd70e 100755 --- a/Tests/SwigTest/runme.pike +++ b/Tests/SwigTest/runme.pike @@ -42,12 +42,12 @@ int main() /* See if we can force 's' to be garbage-collected */ s = 0; - + /* Now we should be down to only 1 shape */ write("%d shapes remain\n", Shape_nshapes_get()); - + /* Done */ write("Goodbye\n"); - + return 0; } diff --git a/Tests/SwigTest/runme.py b/Tests/SwigTest/runme.py index 42a5aa363..ed3909e30 100644 --- a/Tests/SwigTest/runme.py +++ b/Tests/SwigTest/runme.py @@ -3,7 +3,7 @@ # This file illustrates the shadow-class C++ interface generated # by SWIG. -import example +import example # ----- Object creation ----- diff --git a/Tests/SystemInformation/CMakeLists.txt b/Tests/SystemInformation/CMakeLists.txt index c4285758e..838fd4aa1 100644 --- a/Tests/SystemInformation/CMakeLists.txt +++ b/Tests/SystemInformation/CMakeLists.txt @@ -1,61 +1,61 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(SystemInformation) +project(SystemInformation) -INCLUDE_DIRECTORIES("This does not exists") -GET_DIRECTORY_PROPERTY(incl INCLUDE_DIRECTORIES) -SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${SystemInformation_BINARY_DIR};${SystemInformation_SOURCE_DIR}") +include_directories("This does not exists") +get_directory_property(incl INCLUDE_DIRECTORIES) +set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${SystemInformation_BINARY_DIR};${SystemInformation_SOURCE_DIR}") -MESSAGE("To prevent CTest from stripping output, you have to display: CTEST_FULL_OUTPUT") +message("To prevent CTest from stripping output, you have to display: CTEST_FULL_OUTPUT") -CONFIGURE_FILE(${SystemInformation_SOURCE_DIR}/SystemInformation.in +configure_file(${SystemInformation_SOURCE_DIR}/SystemInformation.in ${SystemInformation_BINARY_DIR}/SystemInformation.out) -CONFIGURE_FILE(${SystemInformation_SOURCE_DIR}/DumpInformation.h.in +configure_file(${SystemInformation_SOURCE_DIR}/DumpInformation.h.in ${SystemInformation_BINARY_DIR}/DumpInformation.h) -ADD_EXECUTABLE(SystemInformation DumpInformation.cxx) +add_executable(SystemInformation DumpInformation.cxx) -MACRO(FOO args) - MESSAGE("Test macro") -ENDMACRO(FOO) +macro(FOO args) + message("Test macro") +endmacro() FOO(lala) -FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AllVariables.txt "") -GET_CMAKE_PROPERTY(res VARIABLES) -FOREACH(var ${res}) - FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/AllVariables.txt +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AllVariables.txt "") +get_cmake_property(res VARIABLES) +foreach(var ${res}) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/AllVariables.txt "${var} \"${${var}}\"\n") -ENDFOREACH(var ${res}) +endforeach() -FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AllCommands.txt "") -GET_CMAKE_PROPERTY(res COMMANDS) -FOREACH(var ${res}) - FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/AllCommands.txt +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AllCommands.txt "") +get_cmake_property(res COMMANDS) +foreach(var ${res}) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/AllCommands.txt "${var}\n") -ENDFOREACH(var ${res}) +endforeach() -FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AllMacros.txt "") -GET_CMAKE_PROPERTY(res MACROS) -FOREACH(var ${res}) - FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/AllMacros.txt +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AllMacros.txt "") +get_cmake_property(res MACROS) +foreach(var ${res}) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/AllMacros.txt "${var}\n") -ENDFOREACH(var ${res}) +endforeach() -FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/OtherProperties.txt "") -GET_DIRECTORY_PROPERTY(res INCLUDE_DIRECTORIES) -FOREACH(var ${res}) - FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/OtherProperties.txt +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/OtherProperties.txt "") +get_directory_property(res INCLUDE_DIRECTORIES) +foreach(var ${res}) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/OtherProperties.txt "INCLUDE_DIRECTORY: ${var}\n") -ENDFOREACH(var) +endforeach() -GET_DIRECTORY_PROPERTY(res LINK_DIRECTORIES) -FOREACH(var ${res}) - FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/OtherProperties.txt +get_directory_property(res LINK_DIRECTORIES) +foreach(var ${res}) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/OtherProperties.txt "LINK_DIRECTORIES: ${var}\n") -ENDFOREACH(var) +endforeach() -GET_DIRECTORY_PROPERTY(res INCLUDE_REGULAR_EXPRESSION) -FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/OtherProperties.txt +get_directory_property(res INCLUDE_REGULAR_EXPRESSION) +file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/OtherProperties.txt "INCLUDE_REGULAR_EXPRESSION: ${res}\n") diff --git a/Tests/SystemInformation/DumpInformation.cxx b/Tests/SystemInformation/DumpInformation.cxx index 579dcbcf2..acafa874d 100644 --- a/Tests/SystemInformation/DumpInformation.cxx +++ b/Tests/SystemInformation/DumpInformation.cxx @@ -15,7 +15,7 @@ void cmDumpInformationPrintFile(const char* name, FILE* fout) fflush(fout); return; } - + FILE* fin = fopen(name, "r"); if(fin) { @@ -59,7 +59,7 @@ int main(int,char *[]) DumpInformation_BINARY_DIR "/AllMacros.txt", DumpInformation_BINARY_DIR "/OtherProperties.txt", DumpInformation_BINARY_DIR "/../../Source/cmConfigure.h", - DumpInformation_BINARY_DIR "/../../CMakeCache.txt", + DumpInformation_BINARY_DIR "/../../CMakeCache.txt", DumpInformation_BINARY_DIR "/../../CMakeFiles/CMakeOutput.log", DumpInformation_BINARY_DIR "/../../CMakeFiles/CMakeError.log", DumpInformation_BINARY_DIR "/../../Bootstrap.cmk/cmake_bootstrap.log", @@ -75,6 +75,6 @@ int main(int,char *[]) { cmDumpInformationPrintFile(*f, stdout); } - + return 0; -} +} diff --git a/Tests/SystemInformation/SystemInformation.in b/Tests/SystemInformation/SystemInformation.in index ecbc05408..df3bf49d5 100644 --- a/Tests/SystemInformation/SystemInformation.in +++ b/Tests/SystemInformation/SystemInformation.in @@ -96,7 +96,9 @@ CMAKE_CXX_LINK_EXECUTABLE == "${CMAKE_CXX_LINK_EXECUTABLE}" // implicit link info CMAKE_C_IMPLICIT_LINK_LIBRARIES == "${CMAKE_C_IMPLICIT_LINK_LIBRARIES}" CMAKE_C_IMPLICIT_LINK_DIRECTORIES == "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}" +CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES == "${CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES}" CMAKE_CXX_IMPLICIT_LINK_LIBRARIES == "${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}" CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES == "${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}" +CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES == "${CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES}" XCODE_VERSION == "${XCODE_VERSION}" diff --git a/Tests/TarTest/CMakeLists.txt b/Tests/TarTest/CMakeLists.txt index a3c5b31ff..bcc340bb3 100644 --- a/Tests/TarTest/CMakeLists.txt +++ b/Tests/TarTest/CMakeLists.txt @@ -1,20 +1,20 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(TarTest) +project(TarTest) # this is macro that we will be running -MACRO(EXEC_TAR_COMMAND DIR ARGS) - EXEC_PROGRAM("${CMAKE_COMMAND}" "${DIR}" ARGS "-E tar ${ARGS}" RETURN_VALUE RET) - IF(${RET}) - MESSAGE(FATAL_ERROR "CMake tar command failed with arguments \"${ARGS}\"") - ENDIF(${RET}) -ENDMACRO(EXEC_TAR_COMMAND) +macro(EXEC_TAR_COMMAND DIR ARGS) + exec_program("${CMAKE_COMMAND}" "${DIR}" ARGS "-E tar ${ARGS}" RETURN_VALUE RET) + if(${RET}) + message(FATAL_ERROR "CMake tar command failed with arguments \"${ARGS}\"") + endif() +endmacro() # Create a directory structure -SET(CHECK_FILES) -MACRO(COPY F1 F2) - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/${F1}" "${CMAKE_CURRENT_BINARY_DIR}/tar_dir/${F2}" COPYONLY) - SET(CHECK_FILES ${CHECK_FILES} "${F2}") -ENDMACRO(COPY) +set(CHECK_FILES) +macro(COPY F1 F2) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${F1}" "${CMAKE_CURRENT_BINARY_DIR}/tar_dir/${F2}" COPYONLY) + set(CHECK_FILES ${CHECK_FILES} "${F2}") +endmacro() COPY("CMakeLists.txt" "f1.txt") COPY("CMakeLists.txt" "d1/f1.txt") COPY("CMakeLists.txt" "d 2/f1.txt") @@ -23,22 +23,22 @@ COPY("CMakeLists.txt" "d_4/f1.txt") COPY("CMakeLists.txt" "d-4/f1.txt") COPY("CMakeLists.txt" "My Special Directory/f1.txt") -IF(UNIX) - EXEC_PROGRAM("ln" ARGS "-sf f1.txt \"${CMAKE_CURRENT_BINARY_DIR}/tar_dir/d1/f2.txt\"") - SET(CHECK_FILES ${CHECK_FILES} "d1/f2.txt") -ENDIF(UNIX) +if(UNIX) + exec_program("ln" ARGS "-sf f1.txt \"${CMAKE_CURRENT_BINARY_DIR}/tar_dir/d1/f2.txt\"") + set(CHECK_FILES ${CHECK_FILES} "d1/f2.txt") +endif() # cleanup first in case there are files left from previous runs # if the umask is odd on the machine it might create files that # are not automatically over written. These tests are run # each time the configure step is run. -FILE(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test_tar.tar") -FILE(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test_tgz.tgz") -FILE(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/test_output_tar") -FILE(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/test_output_tgz") +file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test_tar.tar") +file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test_tgz.tgz") +file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/test_output_tar") +file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/test_output_tgz") -MAKE_DIRECTORY("${CMAKE_CURRENT_BINARY_DIR}/test_output_tar") -MAKE_DIRECTORY("${CMAKE_CURRENT_BINARY_DIR}/test_output_tgz") +make_directory("${CMAKE_CURRENT_BINARY_DIR}/test_output_tar") +make_directory("${CMAKE_CURRENT_BINARY_DIR}/test_output_tgz") # Run tests @@ -48,22 +48,22 @@ EXEC_TAR_COMMAND("${CMAKE_CURRENT_BINARY_DIR}" "cvfz \"${CMAKE_CURRENT_BINARY_DI EXEC_TAR_COMMAND("${CMAKE_CURRENT_BINARY_DIR}/test_output_tar" "xvf \"${CMAKE_CURRENT_BINARY_DIR}/test_tar.tar\"") EXEC_TAR_COMMAND("${CMAKE_CURRENT_BINARY_DIR}/test_output_tgz" "xvfz \"${CMAKE_CURRENT_BINARY_DIR}/test_tgz.tgz\"") -MACRO(CHECK_DIR_STRUCTURE DIR) - FOREACH(file ${CHECK_FILES}) - SET(sfile "${DIR}/${file}") - SET(rfile "${CMAKE_CURRENT_BINARY_DIR}/tar_dir/${file}") - IF(NOT EXISTS "${sfile}") - MESSAGE(SEND_ERROR "Cannot find file ${sfile}") - ELSE(NOT EXISTS "${sfile}") - EXEC_PROGRAM("${CMAKE_COMMAND}" ARGS "-E compare_files \"${sfile}\" \"${rfile}\"" RETURN_VALUE ret) - IF(${ret}) - MESSAGE(SEND_ERROR "Files \"${sfile}\" \"${rfile}\" are different") - ENDIF(${ret}) - ENDIF(NOT EXISTS "${sfile}") - ENDFOREACH(file) -ENDMACRO(CHECK_DIR_STRUCTURE) +macro(CHECK_DIR_STRUCTURE DIR) + foreach(file ${CHECK_FILES}) + set(sfile "${DIR}/${file}") + set(rfile "${CMAKE_CURRENT_BINARY_DIR}/tar_dir/${file}") + if(NOT EXISTS "${sfile}") + message(SEND_ERROR "Cannot find file ${sfile}") + else() + exec_program("${CMAKE_COMMAND}" ARGS "-E compare_files \"${sfile}\" \"${rfile}\"" RETURN_VALUE ret) + if(${ret}) + message(SEND_ERROR "Files \"${sfile}\" \"${rfile}\" are different") + endif() + endif() + endforeach() +endmacro() CHECK_DIR_STRUCTURE("${CMAKE_CURRENT_BINARY_DIR}/test_output_tar/tar_dir") -ADD_EXECUTABLE(TarTest TestTarExec.cxx) +add_executable(TarTest TestTarExec.cxx) diff --git a/Tests/TargetName/scripts/CMakeLists.txt b/Tests/TargetName/scripts/CMakeLists.txt index 40d4e2fb0..58af64d65 100644 --- a/Tests/TargetName/scripts/CMakeLists.txt +++ b/Tests/TargetName/scripts/CMakeLists.txt @@ -1,7 +1,7 @@ if(NOT CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}") add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hello_world - COMMAND ${CMAKE_COMMAND} -E copy + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/hello_world ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/hello_world ) @@ -10,4 +10,4 @@ if(NOT CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}") DEPENDS #hello_world ${CMAKE_CURRENT_BINARY_DIR}/hello_world ) -endif(NOT CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}") +endif() diff --git a/Tests/TestDriver/CMakeLists.txt b/Tests/TestDriver/CMakeLists.txt index bd5e97414..663ecab55 100644 --- a/Tests/TestDriver/CMakeLists.txt +++ b/Tests/TestDriver/CMakeLists.txt @@ -1,15 +1,15 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(TestDriverTest) +project(TestDriverTest) -SET(Extra_SRCS testExtraStuff.cxx testExtraStuff2.cxx ) -SET(Extra_SRCS ${Extra_SRCS};testExtraStuff3.cxx ) -INCLUDE_DIRECTORIES(${TestDriverTest_SOURCE_DIR}) -CREATE_TEST_SOURCELIST(testSrcs - TestDriverTest.cxx - test1.cxx - test2.cxx - subdir/test3.cxx +set(Extra_SRCS testExtraStuff.cxx testExtraStuff2.cxx ) +set(Extra_SRCS ${Extra_SRCS};testExtraStuff3.cxx ) +include_directories(${TestDriverTest_SOURCE_DIR}) +create_test_sourcelist(testSrcs + TestDriverTest.cxx + test1.cxx + test2.cxx + subdir/test3.cxx EXTRA_INCLUDE testArgs.h FUNCTION testProccessArgs) -ADD_EXECUTABLE(TestDriverTest ${testSrcs} ${Extra_SRCS}) +add_executable(TestDriverTest ${testSrcs} ${Extra_SRCS}) diff --git a/Tests/TestDriver/test1.cxx b/Tests/TestDriver/test1.cxx index ac82f8ae9..b998fdae6 100644 --- a/Tests/TestDriver/test1.cxx +++ b/Tests/TestDriver/test1.cxx @@ -17,7 +17,7 @@ int test1(int ac, char* av[]) { return -1; } - + printf("test1\n"); for(int i =0; i < ac; i++) printf("arg %d is %s\n", ac, av[i]); diff --git a/Tests/Testing/CMakeLists.txt b/Tests/Testing/CMakeLists.txt index 815b52b58..8f69cbe44 100644 --- a/Tests/Testing/CMakeLists.txt +++ b/Tests/Testing/CMakeLists.txt @@ -2,58 +2,58 @@ # Testing # cmake_minimum_required (VERSION 2.7) -PROJECT (Testing) +project (Testing) # # Lib and exe path # -SET (LIBRARY_OUTPUT_PATH - ${Testing_BINARY_DIR}/bin/ CACHE PATH +set (LIBRARY_OUTPUT_PATH + ${Testing_BINARY_DIR}/bin/ CACHE PATH "Single output directory for building all libraries.") -SET (EXECUTABLE_OUTPUT_PATH - ${Testing_BINARY_DIR}/bin/ CACHE PATH +set (EXECUTABLE_OUTPUT_PATH + ${Testing_BINARY_DIR}/bin/ CACHE PATH "Single output directory for building all executables.") # # Where will executable tests be written ? # -IF (EXECUTABLE_OUTPUT_PATH) - SET (CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH}) -ELSE (EXECUTABLE_OUTPUT_PATH) - SET (CXX_TEST_PATH .) -ENDIF (EXECUTABLE_OUTPUT_PATH) +if (EXECUTABLE_OUTPUT_PATH) + set (CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH}) +else () + set (CXX_TEST_PATH .) +endif () # # Include Dart # (will also set NSLOOKUP, HOSTNAME, etc.) # -INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake) +include (${CMAKE_ROOT}/Modules/Dart.cmake) # # Extra coverage # -BUILD_COMMAND(BUILD_COMMAND_VAR ${CMAKE_MAKE_PROGRAM}) -BUILD_NAME(BUILD_NAME_VAR) -SITE_NAME(SITE_NAME_VAR) +build_command(BUILD_COMMAND_VAR ${CMAKE_MAKE_PROGRAM}) +build_name(BUILD_NAME_VAR) +site_name(SITE_NAME_VAR) # # Enable testing # -ENABLE_TESTING() +enable_testing() # # Add test # -ADD_EXECUTABLE(testing testing.cxx) -ADD_TEST(testing.1 ${Testing_BINARY_DIR}/bin/testing) +add_executable(testing testing.cxx) +add_test(testing.1 ${Testing_BINARY_DIR}/bin/testing) # # skip level test # -ADD_SUBDIRECTORY(Sub/Sub2) +add_subdirectory(Sub/Sub2) # Per-config target name and generator expressions. -ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../PerConfig PerConfig) -ADD_TEST(NAME testing.perconfig COMMAND perconfig) -ADD_TEST(NAME testing.driver COMMAND ${PerConfig_COMMAND}) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../PerConfig PerConfig) +add_test(NAME testing.perconfig COMMAND perconfig) +add_test(NAME testing.driver COMMAND ${PerConfig_COMMAND}) diff --git a/Tests/Testing/DartConfig.cmake b/Tests/Testing/DartConfig.cmake index 26af720ac..de6ea4b41 100644 --- a/Tests/Testing/DartConfig.cmake +++ b/Tests/Testing/DartConfig.cmake @@ -1,24 +1,24 @@ # Dashboard is opened for submissions for a 24 hour period starting at # the specified NIGHLY_START_TIME. Time is specified in 24 hour format. -SET (NIGHTLY_START_TIME "23:00:00 EST") +set (NIGHTLY_START_TIME "23:00:00 EST") # Dart server to submit results (used by client) -SET (DROP_SITE "") -SET (DROP_LOCATION "") -SET (DROP_SITE_USER "") -SET (DROP_SITE_PASSWORD "") -SET (TRIGGER_SITE "") +set (DROP_SITE "") +set (DROP_LOCATION "") +set (DROP_SITE_USER "") +set (DROP_SITE_PASSWORD "") +set (TRIGGER_SITE "") -# Dart server configuration -# SET (CVS_WEB_URL "") -# SET (CVS_WEB_CVSROOT "") -# SET (USE_DOXYGEN "Off") -# SET (DOXYGEN_URL "") -# SET (GNATS_WEB_URL "") +# Dart server configuration +# set (CVS_WEB_URL "") +# set (CVS_WEB_CVSROOT "") +# set (USE_DOXYGEN "Off") +# set (DOXYGEN_URL "") +# set (GNATS_WEB_URL "") # Continuous email delivery variables -# SET (CONTINUOUS_FROM "") -# SET (SMTP_MAILHOST "") -# SET (CONTINUOUS_MONITOR_LIST "") -# SET (CONTINUOUS_BASE_URL "") +# set (CONTINUOUS_FROM "") +# set (SMTP_MAILHOST "") +# set (CONTINUOUS_MONITOR_LIST "") +# set (CONTINUOUS_BASE_URL "") diff --git a/Tests/Testing/Sub/Sub2/CMakeLists.txt b/Tests/Testing/Sub/Sub2/CMakeLists.txt index fb9e8619e..78f4d1a95 100644 --- a/Tests/Testing/Sub/Sub2/CMakeLists.txt +++ b/Tests/Testing/Sub/Sub2/CMakeLists.txt @@ -1,8 +1,8 @@ # # Add test # -ADD_EXECUTABLE(testing2 testing2.cxx) -ADD_TEST(testing.2 ${Testing_BINARY_DIR}/bin/testing2) +add_executable(testing2 testing2.cxx) +add_test(testing.2 ${Testing_BINARY_DIR}/bin/testing2) add_test(NotCycle.a ${CMAKE_COMMAND} -E echo a) add_test(NotCycle.test1 ${CMAKE_COMMAND} -E echo test1) diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index 938c092c0..b6b66d8ee 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -1,120 +1,120 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(TryCompile) +project(TryCompile) -MACRO(TEST_ASSERT value msg) - IF (NOT ${value}) - MESSAGE (SEND_ERROR "Assertion failure:" ${msg} ) - ENDIF (NOT ${value}) -ENDMACRO(TEST_ASSERT) +macro(TEST_ASSERT value msg) + if (NOT ${value}) + message (SEND_ERROR "Assertion failure:" ${msg} ) + endif () +endmacro() -MACRO(TEST_FAIL value msg) - IF (${value}) - MESSAGE (SEND_ERROR "Failing test succeeded:" ${msg} ) - ENDIF (${value}) -ENDMACRO(TEST_FAIL) +macro(TEST_FAIL value msg) + if (${value}) + message (SEND_ERROR "Failing test succeeded:" ${msg} ) + endif () +endmacro() -MACRO(TEST_EXPECT_EXACT command expected) - IF(NOT "x${result}" STREQUAL "x${expected}") - MESSAGE(SEND_ERROR "${CMAKE_CURRENT_LIST_LINE}: TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"") - ENDIF(NOT "x${result}" STREQUAL "x${expected}") -ENDMACRO(TEST_EXPECT_EXACT command expected) +macro(TEST_EXPECT_EXACT command expected) + if(NOT "x${result}" STREQUAL "x${expected}") + message(SEND_ERROR "${CMAKE_CURRENT_LIST_LINE}: TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"") + endif() +endmacro() -MACRO(TEST_EXPECT_CONTAINS command expected) - IF(NOT "${result}" MATCHES "${expected}") - MESSAGE(SEND_ERROR "${CMAKE_CURRENT_LIST_LINE}: TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"") - ENDIF(NOT "${result}" MATCHES "${expected}") -ENDMACRO(TEST_EXPECT_CONTAINS command expected) +macro(TEST_EXPECT_CONTAINS command expected) + if(NOT "${result}" MATCHES "${expected}") + message(SEND_ERROR "${CMAKE_CURRENT_LIST_LINE}: TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"") + endif() +endmacro() # try to compile a file that should compile # also check that COPY_FILE works -TRY_COMPILE(SHOULD_PASS - ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp +try_compile(SHOULD_PASS + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp ${TryCompile_SOURCE_DIR}/pass.c OUTPUT_VARIABLE TRY_OUT COPY_FILE ${TryCompile_BINARY_DIR}/CopyOfPass ) -IF(NOT SHOULD_PASS) - MESSAGE(SEND_ERROR "should pass failed ${TRY_OUT}") -ENDIF(NOT SHOULD_PASS) -IF(NOT EXISTS "${TryCompile_BINARY_DIR}/CopyOfPass") - MESSAGE(SEND_ERROR "COPY_FILE to \"${TryCompile_BINARY_DIR}/CopyOfPass\" failed") -ELSE(NOT EXISTS "${TryCompile_BINARY_DIR}/CopyOfPass") - FILE(REMOVE "${TryCompile_BINARY_DIR}/CopyOfPass") -ENDIF(NOT EXISTS "${TryCompile_BINARY_DIR}/CopyOfPass") +if(NOT SHOULD_PASS) + message(SEND_ERROR "should pass failed ${TRY_OUT}") +endif() +if(NOT EXISTS "${TryCompile_BINARY_DIR}/CopyOfPass") + message(SEND_ERROR "COPY_FILE to \"${TryCompile_BINARY_DIR}/CopyOfPass\" failed") +else() + file(REMOVE "${TryCompile_BINARY_DIR}/CopyOfPass") +endif() # try to compile a file that should not compile -TRY_COMPILE(SHOULD_FAIL - ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp +try_compile(SHOULD_FAIL + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp ${TryCompile_SOURCE_DIR}/fail.c OUTPUT_VARIABLE TRY_OUT) -IF(SHOULD_FAIL) - MESSAGE(SEND_ERROR "Should fail passed ${TRY_OUT}") -ENDIF(SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "Should fail passed ${TRY_OUT}") +endif() # try to compile a file that should compile -TRY_COMPILE(SHOULD_PASS - ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp +try_compile(SHOULD_PASS + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp ${TryCompile_SOURCE_DIR}/pass.c OUTPUT_VARIABLE TRY_OUT) -IF(NOT SHOULD_PASS) - MESSAGE(SEND_ERROR "should pass failed ${TRY_OUT}") -ENDIF(NOT SHOULD_PASS) +if(NOT SHOULD_PASS) + message(SEND_ERROR "should pass failed ${TRY_OUT}") +endif() # try to compile a file that should not compile -TRY_COMPILE(SHOULD_FAIL - ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp +try_compile(SHOULD_FAIL + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp ${TryCompile_SOURCE_DIR}/fail.c OUTPUT_VARIABLE TRY_OUT) -IF(SHOULD_FAIL) - MESSAGE(SEND_ERROR "Should fail passed ${TRY_OUT}") -ENDIF(SHOULD_FAIL) - -IF(NOT SHOULD_FAIL) - IF(SHOULD_PASS) - MESSAGE("All Tests passed, ignore all previous output.") - ELSE(SHOULD_PASS) - MESSAGE("Test failed") - ENDIF(SHOULD_PASS) -ELSE(NOT SHOULD_FAIL) - MESSAGE("Test failed") -ENDIF(NOT SHOULD_FAIL) -TRY_COMPILE(CMAKE_ANSI_FOR_SCOPE - ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp +if(SHOULD_FAIL) + message(SEND_ERROR "Should fail passed ${TRY_OUT}") +endif() + +if(NOT SHOULD_FAIL) + if(SHOULD_PASS) + message("All Tests passed, ignore all previous output.") + else() + message("Test failed") + endif() +else() + message("Test failed") +endif() +try_compile(CMAKE_ANSI_FOR_SCOPE + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx OUTPUT_VARIABLE OUT) -IF (CMAKE_ANSI_FOR_SCOPE) - MESSAGE("Compiler supports ansi for") -ELSE(CMAKE_ANSI_FOR_SCOPE) - MESSAGE("Compiler does not support ansi for scope") -ENDIF(CMAKE_ANSI_FOR_SCOPE) - -TRY_COMPILE(CMAKE_ANSI_FOR_SCOPE - ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp +if (CMAKE_ANSI_FOR_SCOPE) + message("Compiler supports ansi for") +else() + message("Compiler does not support ansi for scope") +endif() + +try_compile(CMAKE_ANSI_FOR_SCOPE + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx OUTPUT_VARIABLE OUT) -IF (CMAKE_ANSI_FOR_SCOPE) - MESSAGE("Compiler supports ansi for") -ELSE(CMAKE_ANSI_FOR_SCOPE) - MESSAGE("Compiler does not support ansi for scope") -ENDIF(CMAKE_ANSI_FOR_SCOPE) - -MESSAGE("use the module now") -INCLUDE(${CMAKE_ROOT}/Modules/TestForANSIForScope.cmake) -IF (CMAKE_ANSI_FOR_SCOPE) - MESSAGE("Compiler supports ansi for") -ELSE(CMAKE_ANSI_FOR_SCOPE) - MESSAGE("Compiler does not support ansi for scope") -ENDIF(CMAKE_ANSI_FOR_SCOPE) - -MESSAGE("Testing try_compile project mode") -TRY_COMPILE(TEST_INNER +if (CMAKE_ANSI_FOR_SCOPE) + message("Compiler supports ansi for") +else() + message("Compiler does not support ansi for scope") +endif() + +message("use the module now") +include(${CMAKE_ROOT}/Modules/TestForANSIForScope.cmake) +if (CMAKE_ANSI_FOR_SCOPE) + message("Compiler supports ansi for") +else() + message("Compiler does not support ansi for scope") +endif() + +message("Testing try_compile project mode") +try_compile(TEST_INNER ${TryCompile_BINARY_DIR}/CMakeFiles/Inner ${TryCompile_SOURCE_DIR}/Inner TryCompileInner innerexe OUTPUT_VARIABLE output) TEST_ASSERT(TEST_INNER "try_compile project mode failed:\n${output}") -ADD_EXECUTABLE(TryCompile pass.c) +add_executable(TryCompile pass.c) ###################################### @@ -123,73 +123,73 @@ ADD_EXECUTABLE(TryCompile pass.c) # try to run a file that should compile and run without error # also check that OUTPUT_VARIABLE contains both the compile output # and the run output -TRY_RUN(SHOULD_RUN SHOULD_COMPILE - ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp +try_run(SHOULD_RUN SHOULD_COMPILE + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp ${TryCompile_SOURCE_DIR}/exit_success.c OUTPUT_VARIABLE TRY_OUT) -IF(NOT SHOULD_COMPILE) - MESSAGE(SEND_ERROR "exit_success failed compiling: ${TRY_OUT}") -ENDIF(NOT SHOULD_COMPILE) -IF(NOT "${SHOULD_RUN}" STREQUAL "0") - MESSAGE(SEND_ERROR "exit_success failed running with exit code ${SHOULD_RUN}") -ENDIF(NOT "${SHOULD_RUN}" STREQUAL "0") +if(NOT SHOULD_COMPILE) + message(SEND_ERROR "exit_success failed compiling: ${TRY_OUT}") +endif() +if(NOT "${SHOULD_RUN}" STREQUAL "0") + message(SEND_ERROR "exit_success failed running with exit code ${SHOULD_RUN}") +endif() # check the compile output for the filename -IF(NOT "${TRY_OUT}" MATCHES "exit_success") - MESSAGE(SEND_ERROR " TRY_OUT didn't contain \"exit_success\": \"${TRY_OUT}\"") -ENDIF(NOT "${TRY_OUT}" MATCHES "exit_success") +if(NOT "${TRY_OUT}" MATCHES "exit_success") + message(SEND_ERROR " TRY_OUT didn't contain \"exit_success\": \"${TRY_OUT}\"") +endif() # check the run output -IF(NOT "${TRY_OUT}" MATCHES "hello world") - MESSAGE(SEND_ERROR " TRY_OUT didn't contain \"hello world\": \"${TRY_OUT}\"") -ENDIF(NOT "${TRY_OUT}" MATCHES "hello world") +if(NOT "${TRY_OUT}" MATCHES "hello world") + message(SEND_ERROR " TRY_OUT didn't contain \"hello world\": \"${TRY_OUT}\"") +endif() -TRY_RUN(ARG_TEST_RUN ARG_TEST_COMPILE - ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp +try_run(ARG_TEST_RUN ARG_TEST_COMPILE + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp ${TryCompile_SOURCE_DIR}/expect_arg.c OUTPUT_VARIABLE TRY_OUT ARGS arg1 arg2) -IF(NOT ARG_TEST_COMPILE) - MESSAGE(SEND_ERROR "expect_arg failed compiling: ${TRY_OUT}") -ENDIF(NOT ARG_TEST_COMPILE) -IF(NOT "${ARG_TEST_RUN}" STREQUAL "0") - MESSAGE(SEND_ERROR "expect_arg failed running with exit code ${ARG_TEST_RUN} ${TRY_OUT}") -ENDIF(NOT "${ARG_TEST_RUN}" STREQUAL "0") +if(NOT ARG_TEST_COMPILE) + message(SEND_ERROR "expect_arg failed compiling: ${TRY_OUT}") +endif() +if(NOT "${ARG_TEST_RUN}" STREQUAL "0") + message(SEND_ERROR "expect_arg failed running with exit code ${ARG_TEST_RUN} ${TRY_OUT}") +endif() # try to run a file that should compile and run, but return an error -TRY_RUN(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE - ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp +try_run(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp ${TryCompile_SOURCE_DIR}/exit_with_error.c COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT RUN_OUTPUT_VARIABLE RUN_OUTPUT) -IF(NOT SHOULD_COMPILE) - MESSAGE(STATUS " exit_with_error failed compiling: ${COMPILE_OUTPUT}") -ENDIF(NOT SHOULD_COMPILE) -IF("${SHOULD_EXIT_WITH_ERROR}" STREQUAL "0") - MESSAGE(SEND_ERROR " exit_with_error passed with exit code ${SHOULD_EXIT_WITH_ERROR}") -ENDIF("${SHOULD_EXIT_WITH_ERROR}" STREQUAL "0") +if(NOT SHOULD_COMPILE) + message(STATUS " exit_with_error failed compiling: ${COMPILE_OUTPUT}") +endif() +if("${SHOULD_EXIT_WITH_ERROR}" STREQUAL "0") + message(SEND_ERROR " exit_with_error passed with exit code ${SHOULD_EXIT_WITH_ERROR}") +endif() # check the compile output, it should contain the filename -IF(NOT "${COMPILE_OUTPUT}" MATCHES "exit_with_error") - MESSAGE(SEND_ERROR " COMPILE_OUT didn't contain \"exit_with_error\": \"${COMPILE_OUTPUT}\"") -ENDIF(NOT "${COMPILE_OUTPUT}" MATCHES "exit_with_error") +if(NOT "${COMPILE_OUTPUT}" MATCHES "exit_with_error") + message(SEND_ERROR " COMPILE_OUT didn't contain \"exit_with_error\": \"${COMPILE_OUTPUT}\"") +endif() #... but not the run time output -IF("${COMPILE_OUTPUT}" MATCHES "hello world") - MESSAGE(SEND_ERROR " COMPILE_OUT contains the run output: \"${COMPILE_OUTPUT}\"") -ENDIF("${COMPILE_OUTPUT}" MATCHES "hello world") +if("${COMPILE_OUTPUT}" MATCHES "hello world") + message(SEND_ERROR " COMPILE_OUT contains the run output: \"${COMPILE_OUTPUT}\"") +endif() # check the run output, it should stdout -IF(NOT "${RUN_OUTPUT}" MATCHES "hello world") - MESSAGE(SEND_ERROR " RUN_OUTPUT didn't contain \"hello world\": \"${RUN_OUTPUT}\"") -ENDIF(NOT "${RUN_OUTPUT}" MATCHES "hello world") +if(NOT "${RUN_OUTPUT}" MATCHES "hello world") + message(SEND_ERROR " RUN_OUTPUT didn't contain \"hello world\": \"${RUN_OUTPUT}\"") +endif() ####################################################################### # # also test that the CHECK_C_SOURCE_COMPILES, CHECK_CXX_SOURCE_COMPILES # CHECK_C_SOURCE_RUNS and CHECK_CXX_SOURCE_RUNS macros work -INCLUDE(CheckCSourceCompiles) -INCLUDE(CheckCXXSourceCompiles) -INCLUDE(CheckCSourceRuns) -INCLUDE(CheckCXXSourceRuns) +include(CheckCSourceCompiles) +include(CheckCXXSourceCompiles) +include(CheckCSourceRuns) +include(CheckCXXSourceRuns) CHECK_C_SOURCE_COMPILES("I dont build" C_BUILD_SHOULD_FAIL) CHECK_C_SOURCE_COMPILES("int main() {return 0;}" C_BUILD_SHOULD_WORK) @@ -211,27 +211,27 @@ TEST_ASSERT(CXX_BUILD_SHOULD_WORK "CHECK_CXX_SOURCE_COMPILES() failed") TEST_FAIL(CXX_RUN_SHOULD_FAIL "CHECK_CXX_SOURCE_RUNS() succeeded, but should have failed") TEST_ASSERT(CXX_RUN_SHOULD_WORK "CHECK_CXX_SOURCE_RUNS() failed") -FOREACH(lang C CXX) - IF(NOT "${CMAKE_${lang}_COMPILER_ID}" MATCHES "^(PathScale)$") - SET(${lang}_DD --) - ENDIF() -ENDFOREACH() +foreach(lang C CXX) + if(NOT "${CMAKE_${lang}_COMPILER_ID}" MATCHES "^(PathScale)$") + set(${lang}_DD --) + endif() +endforeach() -UNSET(C_BOGUS_FLAG CACHE) -INCLUDE(CheckCCompilerFlag) +unset(C_BOGUS_FLAG CACHE) +include(CheckCCompilerFlag) CHECK_C_COMPILER_FLAG(${C_DD}-_this_is_not_a_flag_ C_BOGUS_FLAG) TEST_FAIL(C_BOGUS_FLAG "CHECK_C_COMPILER_FLAG() succeeded, but should have failed") -UNSET(CXX_BOGUS_FLAG CACHE) -INCLUDE(CheckCXXCompilerFlag) +unset(CXX_BOGUS_FLAG CACHE) +include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG(${CXX_DD}-_this_is_not_a_flag_ CXX_BOGUS_FLAG) TEST_FAIL(CXX_BOGUS_FLAG "CHECK_CXX_COMPILER_FLAG() succeeded, but should have failed") -IF("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") - UNSET(C_STRICT_PROTOTYPES CACHE) +if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") + unset(C_STRICT_PROTOTYPES CACHE) CHECK_C_COMPILER_FLAG("-Werror;-Wstrict-prototypes" C_STRICT_PROTOTYPES) TEST_ASSERT(C_STRICT_PROTOTYPES "CHECK_C_COMPILER_FLAG failed -Werror -Wstrict-prototypes") -ENDIF() +endif() ####################################################################### # diff --git a/Tests/TryCompile/expect_arg.c b/Tests/TryCompile/expect_arg.c index 7ca49aa43..f18e03f60 100644 --- a/Tests/TryCompile/expect_arg.c +++ b/Tests/TryCompile/expect_arg.c @@ -10,7 +10,7 @@ int main(int ac, char*av[]) } if(ac == 3) { - if(strcmp(av[1], "arg1") ==0 + if(strcmp(av[1], "arg1") ==0 && strcmp(av[2], "arg2") ==0) { printf("arg1 and arg2 present and accounted for!\n"); diff --git a/Tests/TryCompile/pass.c b/Tests/TryCompile/pass.c index 40bc5e2dd..43e8a7ee0 100644 --- a/Tests/TryCompile/pass.c +++ b/Tests/TryCompile/pass.c @@ -3,4 +3,4 @@ int main() return 0; } - + diff --git a/Tests/Tutorial/Step2/CMakeLists.txt b/Tests/Tutorial/Step2/CMakeLists.txt index c82b7df98..cf1d30ee2 100644 --- a/Tests/Tutorial/Step2/CMakeLists.txt +++ b/Tests/Tutorial/Step2/CMakeLists.txt @@ -24,7 +24,7 @@ if (USE_MYMATH) include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") add_subdirectory (MathFunctions) set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) -endif (USE_MYMATH) +endif () # add the executable add_executable (Tutorial tutorial.cxx) diff --git a/Tests/Tutorial/Step2/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step2/MathFunctions/mysqrt.cxx index 76b8e2d9d..62523f69f 100644 --- a/Tests/Tutorial/Step2/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step2/MathFunctions/mysqrt.cxx @@ -8,9 +8,9 @@ double mysqrt(double x) { return 0; } - + double result; - double delta; + double delta; result = x; // do ten iterations diff --git a/Tests/Tutorial/Step3/CMakeLists.txt b/Tests/Tutorial/Step3/CMakeLists.txt index 0b05fd737..762302bc5 100644 --- a/Tests/Tutorial/Step3/CMakeLists.txt +++ b/Tests/Tutorial/Step3/CMakeLists.txt @@ -24,7 +24,7 @@ if (USE_MYMATH) include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") add_subdirectory (MathFunctions) set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) -endif (USE_MYMATH) +endif () # add the executable add_executable (Tutorial tutorial.cxx) @@ -32,7 +32,7 @@ target_link_libraries (Tutorial ${EXTRA_LIBS}) # add the install targets install (TARGETS Tutorial DESTINATION bin) -install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" +install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" DESTINATION include) @@ -44,7 +44,7 @@ add_test (TutorialRuns Tutorial 25) # does it sqrt of 25 add_test (TutorialComp25 Tutorial 25) -set_tests_properties (TutorialComp25 +set_tests_properties (TutorialComp25 PROPERTIES PASS_REGULAR_EXPRESSION "25 is 5" ) @@ -63,6 +63,6 @@ set_tests_properties (TutorialSmall # does the usage message work? add_test (TutorialUsage Tutorial) set_tests_properties (TutorialUsage - PROPERTIES + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" ) diff --git a/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx index 76b8e2d9d..62523f69f 100644 --- a/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx @@ -8,9 +8,9 @@ double mysqrt(double x) { return 0; } - + double result; - double delta; + double delta; result = x; // do ten iterations diff --git a/Tests/Tutorial/Step4/CMakeLists.txt b/Tests/Tutorial/Step4/CMakeLists.txt index 3b24b4416..6994aa1ce 100644 --- a/Tests/Tutorial/Step4/CMakeLists.txt +++ b/Tests/Tutorial/Step4/CMakeLists.txt @@ -29,7 +29,7 @@ if (USE_MYMATH) include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") add_subdirectory (MathFunctions) set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) -endif (USE_MYMATH) +endif () # add the executable add_executable (Tutorial tutorial.cxx) @@ -37,7 +37,7 @@ target_link_libraries (Tutorial ${EXTRA_LIBS}) # add the install targets install (TARGETS Tutorial DESTINATION bin) -install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" +install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" DESTINATION include) # enable testing @@ -49,7 +49,7 @@ add_test (TutorialRuns Tutorial 25) # does the usage message work? add_test (TutorialUsage Tutorial) set_tests_properties (TutorialUsage - PROPERTIES + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" ) @@ -59,7 +59,7 @@ macro (do_test arg result) set_tests_properties (TutorialComp${arg} PROPERTIES PASS_REGULAR_EXPRESSION ${result} ) -endmacro (do_test) +endmacro () # do a bunch of result based tests do_test (25 "25 is 5") diff --git a/Tests/Tutorial/Step4/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step4/MathFunctions/mysqrt.cxx index 0cf7db480..d081d11d2 100644 --- a/Tests/Tutorial/Step4/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step4/MathFunctions/mysqrt.cxx @@ -11,7 +11,7 @@ double mysqrt(double x) { return 0; } - + double result; // if we have both log and exp then use them @@ -19,7 +19,7 @@ double mysqrt(double x) result = exp(log(x)*0.5); fprintf(stdout,"Computing sqrt of %g to be %g using log\n",x,result); #else - double delta; + double delta; result = x; // do ten iterations diff --git a/Tests/Tutorial/Step5/CMakeLists.txt b/Tests/Tutorial/Step5/CMakeLists.txt index 3002ea084..e40b676b4 100644 --- a/Tests/Tutorial/Step5/CMakeLists.txt +++ b/Tests/Tutorial/Step5/CMakeLists.txt @@ -29,7 +29,7 @@ if (USE_MYMATH) include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") add_subdirectory (MathFunctions) set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) -endif (USE_MYMATH) +endif () # add the executable add_executable (Tutorial tutorial.cxx) @@ -37,7 +37,7 @@ target_link_libraries (Tutorial ${EXTRA_LIBS}) # add the install targets install (TARGETS Tutorial DESTINATION bin) -install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" +install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" DESTINATION include) # enable testing @@ -49,7 +49,7 @@ add_test (TutorialRuns Tutorial 25) # does the usage message work? add_test (TutorialUsage Tutorial) set_tests_properties (TutorialUsage - PROPERTIES + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" ) @@ -59,7 +59,7 @@ macro (do_test arg result) set_tests_properties (TutorialComp${arg} PROPERTIES PASS_REGULAR_EXPRESSION ${result} ) -endmacro (do_test) +endmacro () # do a bunch of result based tests do_test (4 "4 is 2") diff --git a/Tests/Tutorial/Step5/MathFunctions/MakeTable.cxx b/Tests/Tutorial/Step5/MathFunctions/MakeTable.cxx index 540254271..ef98d5fdc 100644 --- a/Tests/Tutorial/Step5/MathFunctions/MakeTable.cxx +++ b/Tests/Tutorial/Step5/MathFunctions/MakeTable.cxx @@ -1,4 +1,4 @@ -// A simple program that builds a sqrt table +// A simple program that builds a sqrt table #include #include @@ -12,14 +12,14 @@ int main (int argc, char *argv[]) { return 1; } - + // open the output file FILE *fout = fopen(argv[1],"w"); if (!fout) { return 1; } - + // create a source file with a table of square roots fprintf(fout,"double sqrtTable[] = {\n"); for (i = 0; i < 10; ++i) diff --git a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx index 33659b740..1f9b88719 100644 --- a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx @@ -14,11 +14,11 @@ double mysqrt(double x) { return 0; } - + double result; // if we have both log and exp then use them - double delta; + double delta; // use the table to help find an initial value result = x; diff --git a/Tests/Tutorial/Step6/CMakeLists.txt b/Tests/Tutorial/Step6/CMakeLists.txt index 4f70f4fc4..0fb7cac5f 100644 --- a/Tests/Tutorial/Step6/CMakeLists.txt +++ b/Tests/Tutorial/Step6/CMakeLists.txt @@ -29,7 +29,7 @@ if (USE_MYMATH) include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") add_subdirectory (MathFunctions) set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) -endif (USE_MYMATH) +endif () # add the executable add_executable (Tutorial tutorial.cxx) @@ -37,7 +37,7 @@ target_link_libraries (Tutorial ${EXTRA_LIBS}) # add the install targets install (TARGETS Tutorial DESTINATION bin) -install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" +install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" DESTINATION include) # enable testing @@ -49,7 +49,7 @@ add_test (TutorialRuns Tutorial 25) # does the usage message work? add_test (TutorialUsage Tutorial) set_tests_properties (TutorialUsage - PROPERTIES + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" ) @@ -59,7 +59,7 @@ macro (do_test arg result) set_tests_properties (TutorialComp${arg} PROPERTIES PASS_REGULAR_EXPRESSION ${result} ) -endmacro (do_test) +endmacro () # do a bunch of result based tests do_test (4 "4 is 2") diff --git a/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt index d606ac03e..9961e6945 100644 --- a/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt +++ b/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt @@ -12,7 +12,7 @@ add_custom_command ( ) set_source_files_properties ( - mysqrt.cxx PROPERTIES + mysqrt.cxx PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Table.h ) diff --git a/Tests/Tutorial/Step6/MathFunctions/MakeTable.cxx b/Tests/Tutorial/Step6/MathFunctions/MakeTable.cxx index 540254271..ef98d5fdc 100644 --- a/Tests/Tutorial/Step6/MathFunctions/MakeTable.cxx +++ b/Tests/Tutorial/Step6/MathFunctions/MakeTable.cxx @@ -1,4 +1,4 @@ -// A simple program that builds a sqrt table +// A simple program that builds a sqrt table #include #include @@ -12,14 +12,14 @@ int main (int argc, char *argv[]) { return 1; } - + // open the output file FILE *fout = fopen(argv[1],"w"); if (!fout) { return 1; } - + // create a source file with a table of square roots fprintf(fout,"double sqrtTable[] = {\n"); for (i = 0; i < 10; ++i) diff --git a/Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx index 33659b740..1f9b88719 100644 --- a/Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx @@ -14,11 +14,11 @@ double mysqrt(double x) { return 0; } - + double result; // if we have both log and exp then use them - double delta; + double delta; // use the table to help find an initial value result = x; diff --git a/Tests/Tutorial/Step7/CMakeLists.txt b/Tests/Tutorial/Step7/CMakeLists.txt index 42f73f221..d9a92fbef 100644 --- a/Tests/Tutorial/Step7/CMakeLists.txt +++ b/Tests/Tutorial/Step7/CMakeLists.txt @@ -29,7 +29,7 @@ if (USE_MYMATH) include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") add_subdirectory (MathFunctions) set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) -endif (USE_MYMATH) +endif () # add the executable add_executable (Tutorial tutorial.cxx) @@ -37,7 +37,7 @@ target_link_libraries (Tutorial ${EXTRA_LIBS}) # add the install targets install (TARGETS Tutorial DESTINATION bin) -install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" +install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" DESTINATION include) # enable testing @@ -49,7 +49,7 @@ add_test (TutorialRuns Tutorial 25) # does the usage message work? add_test (TutorialUsage Tutorial) set_tests_properties (TutorialUsage - PROPERTIES + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" ) @@ -59,7 +59,7 @@ macro (do_test arg result) set_tests_properties (TutorialComp${arg} PROPERTIES PASS_REGULAR_EXPRESSION ${result} ) -endmacro (do_test) +endmacro () # do a bunch of result based tests do_test (4 "4 is 2") diff --git a/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt index d606ac03e..9961e6945 100644 --- a/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt +++ b/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt @@ -12,7 +12,7 @@ add_custom_command ( ) set_source_files_properties ( - mysqrt.cxx PROPERTIES + mysqrt.cxx PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Table.h ) diff --git a/Tests/Tutorial/Step7/MathFunctions/MakeTable.cxx b/Tests/Tutorial/Step7/MathFunctions/MakeTable.cxx index 540254271..ef98d5fdc 100644 --- a/Tests/Tutorial/Step7/MathFunctions/MakeTable.cxx +++ b/Tests/Tutorial/Step7/MathFunctions/MakeTable.cxx @@ -1,4 +1,4 @@ -// A simple program that builds a sqrt table +// A simple program that builds a sqrt table #include #include @@ -12,14 +12,14 @@ int main (int argc, char *argv[]) { return 1; } - + // open the output file FILE *fout = fopen(argv[1],"w"); if (!fout) { return 1; } - + // create a source file with a table of square roots fprintf(fout,"double sqrtTable[] = {\n"); for (i = 0; i < 10; ++i) diff --git a/Tests/Tutorial/Step7/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step7/MathFunctions/mysqrt.cxx index 33659b740..1f9b88719 100644 --- a/Tests/Tutorial/Step7/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step7/MathFunctions/mysqrt.cxx @@ -14,11 +14,11 @@ double mysqrt(double x) { return 0; } - + double result; // if we have both log and exp then use them - double delta; + double delta; // use the table to help find an initial value result = x; diff --git a/Tests/Tutorial/Step7/build1.cmake b/Tests/Tutorial/Step7/build1.cmake index 039d5569b..baa475f28 100644 --- a/Tests/Tutorial/Step7/build1.cmake +++ b/Tests/Tutorial/Step7/build1.cmake @@ -1,5 +1,5 @@ -SET(CTEST_SOURCE_DIRECTORY "$ENV{HOME}/Dashboards/My Tests/CMake/Tests/Tutorial/Step7") -SET(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}-build1") +set(CTEST_SOURCE_DIRECTORY "$ENV{HOME}/Dashboards/My Tests/CMake/Tests/Tutorial/Step7") +set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}-build1") -SET(CTEST_CMAKE_COMMAND "cmake") -SET(CTEST_COMMAND "ctest -D Experimental") +set(CTEST_CMAKE_COMMAND "cmake") +set(CTEST_COMMAND "ctest -D Experimental") diff --git a/Tests/Tutorial/Step7/build2.cmake b/Tests/Tutorial/Step7/build2.cmake index 5112355b2..c2f2e2e10 100644 --- a/Tests/Tutorial/Step7/build2.cmake +++ b/Tests/Tutorial/Step7/build2.cmake @@ -1,6 +1,6 @@ -SET(CTEST_SOURCE_DIRECTORY "$ENV{HOME}/Dashboards/My Tests/CMake/Tests/Tutorial/Step7") -SET(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}-build2") -SET(CTEST_CMAKE_GENERATOR "Visual Studio 8 2005") +set(CTEST_SOURCE_DIRECTORY "$ENV{HOME}/Dashboards/My Tests/CMake/Tests/Tutorial/Step7") +set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}-build2") +set(CTEST_CMAKE_GENERATOR "Visual Studio 8 2005") CTEST_START("Experimental") CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}") diff --git a/Tests/Unset/CMakeLists.txt b/Tests/Unset/CMakeLists.txt index bacb6d21f..781da3fa6 100644 --- a/Tests/Unset/CMakeLists.txt +++ b/Tests/Unset/CMakeLists.txt @@ -5,51 +5,51 @@ project(Unset C) set(x 42) if(NOT x EQUAL 42) message(FATAL_ERROR "x!=42") -endif(NOT x EQUAL 42) +endif() if(NOT DEFINED x) message(FATAL_ERROR "x should be defined!") -endif(NOT DEFINED x) +endif() unset(x) if(DEFINED x) message(FATAL_ERROR "x should be undefined now!") -endif(DEFINED x) +endif() # Local variable test unset via set() set(x 43) if(NOT x EQUAL 43) message(FATAL_ERROR "x!=43") -endif(NOT x EQUAL 43) +endif() set(x) if(DEFINED x) message(FATAL_ERROR "x should be undefined now!") -endif(DEFINED x) +endif() # Cache variable set(BAR "test" CACHE STRING "documentation") if(NOT DEFINED BAR) message(FATAL_ERROR "BAR not defined") -endif(NOT DEFINED BAR) +endif() # Test interaction of cache entries with variables. set(BAR "test-var") if(NOT "$CACHE{BAR}" STREQUAL "test") message(FATAL_ERROR "\$CACHE{BAR} changed by variable BAR") -endif(NOT "$CACHE{BAR}" STREQUAL "test") +endif() if(NOT "${BAR}" STREQUAL "test-var") message(FATAL_ERROR "\${BAR} not separate from \$CACHE{BAR}") -endif(NOT "${BAR}" STREQUAL "test-var") +endif() unset(BAR) if(NOT "${BAR}" STREQUAL "test") message(FATAL_ERROR "\${BAR} does not fall through to \$CACHE{BAR}") -endif(NOT "${BAR}" STREQUAL "test") +endif() # Test unsetting of CACHE entry. unset(BAR CACHE) if(DEFINED BAR) message(FATAL_ERROR "BAR still defined") -endif(DEFINED BAR) +endif() add_executable(Unset unset.c) diff --git a/Tests/VSExcludeFromDefaultBuild/CMakeLists.txt b/Tests/VSExcludeFromDefaultBuild/CMakeLists.txt new file mode 100644 index 000000000..d30414b4b --- /dev/null +++ b/Tests/VSExcludeFromDefaultBuild/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 2.8.9) +project(VSExcludeFromDefaultBuild) + +# First step is to clear all .exe files in output so that possible past +# failures of this test do not prevent it from succeeding. +add_custom_target(ClearExes ALL + COMMAND "${CMAKE_COMMAND}" + -Ddir=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} + -P ${CMAKE_CURRENT_SOURCE_DIR}/ClearExes.cmake + VERBATIM) + +# Make sure ClearExes is executed before other targets are built +function(add_test_executable target) + add_executable("${target}" ${ARGN}) + add_dependencies("${target}" ClearExes) +endfunction() + +add_test_executable(DefaultBuilt main.c) + +add_test_executable(AlwaysBuilt main.c) +set_target_properties(AlwaysBuilt PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD FALSE) + +add_test_executable(NeverBuilt main.c) +set_target_properties(NeverBuilt PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE) + +foreach(config ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER ${config} Config) + add_test_executable(BuiltIn${config} main.c) + set_target_properties(BuiltIn${config} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE EXCLUDE_FROM_DEFAULT_BUILD_${Config} FALSE) + add_test_executable(ExcludedIn${config} main.c) + set_target_properties(ExcludedIn${config} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD_${Config} TRUE) +endforeach() diff --git a/Tests/VSExcludeFromDefaultBuild/ClearExes.cmake b/Tests/VSExcludeFromDefaultBuild/ClearExes.cmake new file mode 100644 index 000000000..ece30ad00 --- /dev/null +++ b/Tests/VSExcludeFromDefaultBuild/ClearExes.cmake @@ -0,0 +1,4 @@ +file(GLOB exeFiles "${dir}/*.exe") +foreach(exeFile IN LISTS exeFiles) + file(REMOVE "${exeFile}") +endforeach() diff --git a/Tests/VSExcludeFromDefaultBuild/ResultTest.cmake b/Tests/VSExcludeFromDefaultBuild/ResultTest.cmake new file mode 100644 index 000000000..8fb00bfad --- /dev/null +++ b/Tests/VSExcludeFromDefaultBuild/ResultTest.cmake @@ -0,0 +1,23 @@ +message(STATUS "Testing configuration ${activeConfig}.") + +macro(TestExists exeName) + set(exeFile "${dir}/${activeConfig}/${exeName}.exe") + if(${ARGN} EXISTS "${exeFile}") + message(STATUS "File ${exeFile} was correctly found ${ARGN} to exist.") + else() + message(FATAL_ERROR "File ${exeFile} was expected ${ARGN} to exist!") + endif() +endmacro() + +TestExists(DefaultBuilt) +TestExists(AlwaysBuilt) +TestExists(NeverBuilt NOT) +foreach(config ${allConfigs}) + if(config STREQUAL activeConfig) + TestExists(BuiltIn${config}) + TestExists(ExcludedIn${config} NOT) + else() + TestExists(BuiltIn${config} NOT) + TestExists(ExcludedIn${config}) + endif() +endforeach() diff --git a/Tests/VSExcludeFromDefaultBuild/main.c b/Tests/VSExcludeFromDefaultBuild/main.c new file mode 100644 index 000000000..8488f4e58 --- /dev/null +++ b/Tests/VSExcludeFromDefaultBuild/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/VSExternalInclude/CMakeLists.txt b/Tests/VSExternalInclude/CMakeLists.txt index a2fd61973..5ce15e05d 100644 --- a/Tests/VSExternalInclude/CMakeLists.txt +++ b/Tests/VSExternalInclude/CMakeLists.txt @@ -1,54 +1,62 @@ cmake_minimum_required (VERSION 2.6) -PROJECT(VSExternalInclude) +project(VSExternalInclude) -IF(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") - SET(PROJECT_EXT dsp) -ELSE(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") - SET(PROJECT_EXT vcproj) -ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") -IF(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[01]") - SET(PROJECT_EXT vcxproj) -ENDIF() +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") + set(PROJECT_EXT dsp) +else() + set(PROJECT_EXT vcproj) +endif() +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[01]") + set(PROJECT_EXT vcxproj) +endif() # make sure directories exists -SET(LIB1_BINARY_DIR ${VSExternalInclude_BINARY_DIR}/Lib1) -MAKE_DIRECTORY("${LIB1_BINARY_DIR}") +set(LIB1_BINARY_DIR ${VSExternalInclude_BINARY_DIR}/Lib1) +make_directory("${LIB1_BINARY_DIR}") -SET(LIB2_BINARY_DIR ${VSExternalInclude_BINARY_DIR}/Lib2) -MAKE_DIRECTORY("${LIB2_BINARY_DIR}") +set(LIB2_BINARY_DIR ${VSExternalInclude_BINARY_DIR}/Lib2) +make_directory("${LIB2_BINARY_DIR}") # generate lib1 -EXEC_PROGRAM("${CMAKE_COMMAND}" "${LIB1_BINARY_DIR}" ARGS -G\"${CMAKE_GENERATOR}\" - \"${VSExternalInclude_SOURCE_DIR}/Lib1\" OUTPUT_VARIABLE OUT) -MESSAGE("CMAKE Ran with the following output:\n\"${OUT}\"") +execute_process( + COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -T "${CMAKE_GENERATOR_TOOLSET}" "${VSExternalInclude_SOURCE_DIR}/Lib1" + WORKING_DIRECTORY ${LIB1_BINARY_DIR} + OUTPUT_VARIABLE OUT + ERROR_VARIABLE OUT + ) +message("CMAKE Ran with the following output:\n\"${OUT}\"") # generate lib2 -EXEC_PROGRAM("${CMAKE_COMMAND}" "${LIB2_BINARY_DIR}" ARGS -G\"${CMAKE_GENERATOR}\" - \"${VSExternalInclude_SOURCE_DIR}/Lib2\" OUTPUT_VARIABLE OUT) -MESSAGE("CMAKE Ran with the following output:\n\"${OUT}\"") +execute_process( + COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -T "${CMAKE_GENERATOR_TOOLSET}" "${VSExternalInclude_SOURCE_DIR}/Lib2" + WORKING_DIRECTORY ${LIB2_BINARY_DIR} + OUTPUT_VARIABLE OUT + ERROR_VARIABLE OUT + ) +message("CMAKE Ran with the following output:\n\"${OUT}\"") -INCLUDE_EXTERNAL_MSPROJECT(lib1 ${VSExternalInclude_BINARY_DIR}/Lib1/LIB1.${PROJECT_EXT}) +include_external_msproject(lib1 ${VSExternalInclude_BINARY_DIR}/Lib1/LIB1.${PROJECT_EXT}) # lib2 depends on lib1 -INCLUDE_EXTERNAL_MSPROJECT(lib2 ${VSExternalInclude_BINARY_DIR}/Lib2/LIB2.${PROJECT_EXT} lib1) +include_external_msproject(lib2 ${VSExternalInclude_BINARY_DIR}/Lib2/LIB2.${PROJECT_EXT} lib1) -INCLUDE_DIRECTORIES(${VSExternalInclude_SOURCE_DIR}/Lib2 ${VSExternalInclude_SOURCE_DIR}/Lib1) +include_directories(${VSExternalInclude_SOURCE_DIR}/Lib2 ${VSExternalInclude_SOURCE_DIR}/Lib1) -SET(SOURCES main.cpp) +set(SOURCES main.cpp) -ADD_EXECUTABLE(VSExternalInclude ${SOURCES}) +add_executable(VSExternalInclude ${SOURCES}) # target depends on lib2 -ADD_DEPENDENCIES(VSExternalInclude lib2) +add_dependencies(VSExternalInclude lib2) # VS 10 vcxproj files have depends in them # Since lib1 and lib2 do not depend on each other # then the vcxproj files do not depend on each other # and the sln file can no longer be the only source # of that depend. So, for VS 10 make the executable # depend on lib1 and lib2 -IF(MSVC10 OR MSVC11) - ADD_DEPENDENCIES(VSExternalInclude lib1) -ENDIF() +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[01]") + add_dependencies(VSExternalInclude lib1) +endif() # Interaction testing between the FOLDER target property and # INCLUDE_EXTERNAL_MSPROJECT targets: diff --git a/Tests/VSExternalInclude/Lib1/CMakeLists.txt b/Tests/VSExternalInclude/Lib1/CMakeLists.txt index 72ffcedc1..9dfac8616 100644 --- a/Tests/VSExternalInclude/Lib1/CMakeLists.txt +++ b/Tests/VSExternalInclude/Lib1/CMakeLists.txt @@ -1,5 +1,6 @@ -PROJECT(LIB1) +set(CMAKE_SUPPRESS_REGENERATION 1) +project(LIB1) -SET(SOURCES lib1.cpp) +set(SOURCES lib1.cpp) -ADD_LIBRARY(lib1 ${SOURCES}) +add_library(lib1 ${SOURCES}) diff --git a/Tests/VSExternalInclude/Lib2/CMakeLists.txt b/Tests/VSExternalInclude/Lib2/CMakeLists.txt index 31e40e4e1..f4513548d 100644 --- a/Tests/VSExternalInclude/Lib2/CMakeLists.txt +++ b/Tests/VSExternalInclude/Lib2/CMakeLists.txt @@ -1,7 +1,8 @@ -PROJECT(VSEXTERNAL_LIB2) +set(CMAKE_SUPPRESS_REGENERATION 1) +project(VSEXTERNAL_LIB2) -INCLUDE_DIRECTORIES(${VSEXTERNAL_LIB2_SOURCE_DIR}/../Lib1) +include_directories(${VSEXTERNAL_LIB2_SOURCE_DIR}/../Lib1) -SET(SOURCES lib2.cpp) +set(SOURCES lib2.cpp) -ADD_LIBRARY(lib2 ${SOURCES}) +add_library(lib2 ${SOURCES}) diff --git a/Tests/Wrapping/CMakeLists.txt b/Tests/Wrapping/CMakeLists.txt index c84dedc47..58e9c3242 100644 --- a/Tests/Wrapping/CMakeLists.txt +++ b/Tests/Wrapping/CMakeLists.txt @@ -2,82 +2,82 @@ # Wrapping # cmake_minimum_required (VERSION 2.6) -PROJECT (Wrapping) +project (Wrapping) # Disable cleaning of custom command outputs to preserve the hacks # used to generate the files using CONFIGURE_FILE. -SET_DIRECTORY_PROPERTIES(PROPERTIES CLEAN_NO_CUSTOM 1) +set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM 1) # # Lib and exe path # -SET (LIBRARY_OUTPUT_PATH - ${Wrapping_BINARY_DIR}/bin/ CACHE INTERNAL +set (LIBRARY_OUTPUT_PATH + ${Wrapping_BINARY_DIR}/bin/ CACHE INTERNAL "Single output directory for building all libraries.") -SET (EXECUTABLE_OUTPUT_PATH - ${Wrapping_BINARY_DIR}/bin/ CACHE INTERNAL +set (EXECUTABLE_OUTPUT_PATH + ${Wrapping_BINARY_DIR}/bin/ CACHE INTERNAL "Single output directory for building all executables.") # # Where will executable tests be written ? # -IF (EXECUTABLE_OUTPUT_PATH) - SET (CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH}) -ELSE (EXECUTABLE_OUTPUT_PATH) - SET (CXX_TEST_PATH .) -ENDIF (EXECUTABLE_OUTPUT_PATH) +if (EXECUTABLE_OUTPUT_PATH) + set (CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH}) +else () + set (CXX_TEST_PATH .) +endif () # # Add exe # -ADD_EXECUTABLE (wrapping wrapping.cxx) +add_executable (wrapping wrapping.cxx) -ADD_EXECUTABLE (Wrap Wrap.c) -IF(WIN32) - SET(EXE_EXT ".exe") -ENDIF(WIN32) -SET(WRAP ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/Wrap${EXE_EXT}) +add_executable (Wrap Wrap.c) +if(WIN32) + set(EXE_EXT ".exe") +endif() +set(WRAP ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/Wrap${EXE_EXT}) # -# QT Wrappers +# Qt Wrappers # -SET (QT_WRAP_CPP "On") -SET (QT_MOC_EXE "echo") -INCLUDE( FindQt3 ) +set (QT_WRAP_CPP "On") +set (QT_MOC_EXE "echo") +include( FindQt3 ) -IF (QT_FOUND AND QT_WRAP_UI) - message("found qt 3 test it...") - INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} ) - INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ) +if (QT_FOUND AND QT_WRAP_UI) + message("found Qt 3 test it...") + include_directories( ${QT_INCLUDE_DIR} ) + include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/foo.ui.in + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/foo.ui.in ${CMAKE_CURRENT_BINARY_DIR}/foo.ui IMMEDIATE) - SET (QT_WRAP_UI "On") - SET (QT_UIC_EXE "${QT_UIC_EXECUTABLE}") + set (QT_WRAP_UI "On") + set (QT_UIC_EXE "${QT_UIC_EXECUTABLE}") - SET (QTUI_SRCS + set (QTUI_SRCS qtwrapping.ui ${CMAKE_CURRENT_BINARY_DIR}/foo.ui ) - QT_WRAP_UI (myqtlib QTUI_H_SRCS QTUI_S_SRCS ${QTUI_SRCS}) - QT_WRAP_CPP (myqtlib QT_MOC_SRCS ${SRCS} vtkTestMoc.h) + qt_wrap_ui (myqtlib QTUI_H_SRCS QTUI_S_SRCS ${QTUI_SRCS}) + qt_wrap_cpp (myqtlib QT_MOC_SRCS ${SRCS} vtkTestMoc.h) - MESSAGE("QT files are ${QTUI_S_SRCS}") - MESSAGE("QT other files are ${QTUI_H_SRCS}") - ADD_DEFINITIONS(${QT_DEFINITIONS}) - ADD_LIBRARY(myqtlib ${QTUI_S_SRCS} ${QT_MOC_SRCS}) - ADD_EXECUTABLE (qtwrapping qtwrappingmain.cxx) - TARGET_LINK_LIBRARIES(qtwrapping myqtlib) + message("Qt files are ${QTUI_S_SRCS}") + message("Qt other files are ${QTUI_H_SRCS}") + add_definitions(${QT_DEFINITIONS}) + add_library(myqtlib ${QTUI_S_SRCS} ${QT_MOC_SRCS}) + add_executable (qtwrapping qtwrappingmain.cxx) + target_link_libraries(qtwrapping myqtlib) - TARGET_LINK_LIBRARIES( qtwrapping ${QT_LIBRARIES} ) -ELSE (QT_FOUND AND QT_WRAP_UI) - ADD_EXECUTABLE (qtwrapping qtnoqtmain.cxx) -ENDIF (QT_FOUND AND QT_WRAP_UI) + target_link_libraries( qtwrapping ${QT_LIBRARIES} ) +else () + add_executable (qtwrapping qtnoqtmain.cxx) +endif () # # FLTK Wrappers @@ -85,23 +85,23 @@ ENDIF (QT_FOUND AND QT_WRAP_UI) # Since FLTK_FLUID_EXE is supposed to create a .cxx/.h from a .fl/.fld, # create an empty one so that the dependencies can be met. # -SET (FLTK_SRCS +set (FLTK_SRCS fltk1.fl ) -ADD_EXECUTABLE(fakefluid fakefluid.cxx) -GET_TARGET_PROPERTY(FLUID_LOC fakefluid LOCATION) -SET (FLTK_WRAP_UI "On") -SET (FLTK_FLUID_EXECUTABLE "${FLUID_LOC}") -FLTK_WRAP_UI (wraplibFLTK ${FLTK_SRCS}) -ADD_LIBRARY(wraplibFLTK ${wraplibFLTK_FLTK_UI_SRCS}) -ADD_DEPENDENCIES(wraplibFLTK fakefluid) -ADD_DEPENDENCIES(fakefluid Wrap) +add_executable(fakefluid fakefluid.cxx) +get_target_property(FLUID_LOC fakefluid LOCATION) +set (FLTK_WRAP_UI "On") +set (FLTK_FLUID_EXECUTABLE "${FLUID_LOC}") +fltk_wrap_ui (wraplibFLTK ${FLTK_SRCS}) +add_library(wraplibFLTK ${wraplibFLTK_FLTK_UI_SRCS}) +add_dependencies(wraplibFLTK fakefluid) +add_dependencies(fakefluid Wrap) # # Mangled Mesa # -CONFIGURE_FILE( +configure_file( ${Wrapping_SOURCE_DIR}/dummy ${Wrapping_BINARY_DIR}/gl.h COPYONLY IMMEDIATE) -USE_MANGLED_MESA (${Wrapping_BINARY_DIR} ${Wrapping_BINARY_DIR}/mangled_mesa) +use_mangled_mesa (${Wrapping_BINARY_DIR} ${Wrapping_BINARY_DIR}/mangled_mesa) diff --git a/Tests/Wrapping/qtnoqtmain.cxx b/Tests/Wrapping/qtnoqtmain.cxx index 8b7334a18..92594d52e 100644 --- a/Tests/Wrapping/qtnoqtmain.cxx +++ b/Tests/Wrapping/qtnoqtmain.cxx @@ -2,4 +2,4 @@ int main(int ac, char** av) { return 0; } - + diff --git a/Tests/X11/CMakeLists.txt b/Tests/X11/CMakeLists.txt index 03aa09578..76ae58c74 100644 --- a/Tests/X11/CMakeLists.txt +++ b/Tests/X11/CMakeLists.txt @@ -1,40 +1,40 @@ # a simple C only test case cmake_minimum_required (VERSION 2.6) -PROJECT (UseX11 CXX C) +project (UseX11 CXX C) -INCLUDE (${CMAKE_ROOT}/Modules/FindX11.cmake) -MESSAGE("X11_FOUND: ${X11_FOUND}") +include (${CMAKE_ROOT}/Modules/FindX11.cmake) +message("X11_FOUND: ${X11_FOUND}") -ADD_EXECUTABLE (UseX11 X11.c) +add_executable (UseX11 X11.c) install(TARGETS UseX11 DESTINATION bin) -# so for universal binaries this test will fail if -# -IF(APPLE) - LIST(LENGTH CMAKE_OSX_ARCHITECTURES NUMARCH) - IF(NUMARCH GREATER 1) - IF(NOT EXISTS /usr/X11R6/lib//libSM.6.dylib) - SET(X11_FOUND FALSE) - MESSAGE("disable X11, because of universal binary and sysroot") - ENDIF(NOT EXISTS /usr/X11R6/lib//libSM.6.dylib) - ENDIF(NUMARCH GREATER 1) -ENDIF(APPLE) +# so for universal binaries this test will fail if +# +if(APPLE) + list(LENGTH CMAKE_OSX_ARCHITECTURES NUMARCH) + if(NUMARCH GREATER 1) + if(NOT EXISTS /usr/X11R6/lib//libSM.6.dylib) + set(X11_FOUND FALSE) + message("disable X11, because of universal binary and sysroot") + endif() + endif() +endif() -IF(X11_FOUND) - ADD_DEFINITIONS(-DCMAKE_HAS_X) - INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(UseX11 ${X11_LIBRARIES}) - IF(APPLE) - ADD_EXECUTABLE(HelloWorldX11 HelloWorldX11.cxx) - TARGET_LINK_LIBRARIES(HelloWorldX11 ${X11_LIBRARIES}) +if(X11_FOUND) + add_definitions(-DCMAKE_HAS_X) + include_directories(${X11_INCLUDE_DIR}) + target_link_libraries(UseX11 ${X11_LIBRARIES}) + if(APPLE) + add_executable(HelloWorldX11 HelloWorldX11.cxx) + target_link_libraries(HelloWorldX11 ${X11_LIBRARIES}) install(TARGETS HelloWorldX11 DESTINATION bin) set(CPACK_BINARY_OSXX11 ON CACHE BOOL "" FORCE) set(CPACK_BINARY_PACKAGEMAKER OFF CACHE BOOL "" FORCE ) set(CPACK_PACKAGE_NAME HelloWorldX11Package) set(CPACK_PACKAGE_EXECUTABLES HelloWorldX11 HelloWorldX11) - ENDIF(APPLE) -ENDIF(X11_FOUND) + endif() +endif() # build a CPack driven installer package include(CPack) diff --git a/Tests/X11/HelloWorldX11.cxx b/Tests/X11/HelloWorldX11.cxx index e3c9dd9cf..f2b8bdd47 100644 --- a/Tests/X11/HelloWorldX11.cxx +++ b/Tests/X11/HelloWorldX11.cxx @@ -9,7 +9,7 @@ * Copyright (c) 2004 __MyCompanyName__. All rights reserved. * */ - + #ifndef MAIN_H #define MAIN_H 1 @@ -28,10 +28,10 @@ public: // constructor Main(int argc, char * const argv[]); //virtual ~Main(); - + private: - + /* here are our X variables */ Display *dis; @@ -53,7 +53,7 @@ private: /*** START MAIN.CPP ***/ -// modified from Brian Hammond's Howdy program at +// modified from Brian Hammond's Howdy program at // http://www.insanityengine.com/doc/x11/xintro.html // jeff louie 02.05.2004 @@ -73,11 +73,11 @@ Main::Main (int argc, char * const argv[]) { init_x(); // event loop - while(1) { + while(1) { // get the next event and stuff it into our event variable. // Note: only events we set the mask for are detected! XNextEvent(dis, &event); - + switch (event.type) { int x; @@ -115,19 +115,19 @@ Main::Main (int argc, char * const argv[]) { } } -void Main::init_x() { +void Main::init_x() { unsigned long black,white; dis=XOpenDisplay(NULL); screen=DefaultScreen(dis); black=BlackPixel(dis,screen), white=WhitePixel(dis, screen); - win=XCreateSimpleWindow(dis,DefaultRootWindow(dis),0,0, + win=XCreateSimpleWindow(dis,DefaultRootWindow(dis),0,0, 300, 300, 5,black, white); XSetStandardProperties(dis,win,"Hello World","Hi",None,NULL,0,NULL); XSelectInput(dis, win, ExposureMask|ButtonPressMask|KeyPressMask); // get Graphics Context - gc=XCreateGC(dis, win, 0,0); + gc=XCreateGC(dis, win, 0,0); XSetBackground(dis,gc,white); XSetForeground(dis,gc,black); XClearWindow(dis, win); @@ -137,8 +137,8 @@ void Main::init_x() { void Main::close_x() { XFreeGC(dis, gc); XDestroyWindow(dis,win); - XCloseDisplay(dis); - exit(1); + XCloseDisplay(dis); + exit(1); }; void Main::redraw() { diff --git a/Tests/test_clean.cmake.in b/Tests/test_clean.cmake.in index ce5e62b79..d700749ca 100644 --- a/Tests/test_clean.cmake.in +++ b/Tests/test_clean.cmake.in @@ -1,2 +1,2 @@ -SET(TEST_BUILD_DIRS "@TEST_BUILD_DIRS@") -FILE(REMOVE_RECURSE ${TEST_BUILD_DIRS}) +set(TEST_BUILD_DIRS "@TEST_BUILD_DIRS@") +file(REMOVE_RECURSE ${TEST_BUILD_DIRS}) diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index 798c16397..b8f6b3cb6 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -9,14 +9,14 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -SUBDIRS(Doxygen KWStyle) +subdirs(Doxygen KWStyle) -MAKE_DIRECTORY(${CMake_BINARY_DIR}/Docs) +make_directory(${CMake_BINARY_DIR}/Docs) # Add a documentation target. -SET(DOC_FILES "") +set(DOC_FILES "") -SET(MAN_FILES +set(MAN_FILES ${CMake_BINARY_DIR}/Docs/cmake.1 ${CMake_BINARY_DIR}/Docs/cmakecommands.1 ${CMake_BINARY_DIR}/Docs/cmakecompat.1 @@ -25,9 +25,8 @@ SET(MAN_FILES ${CMake_BINARY_DIR}/Docs/cmakevars.1 ${CMake_BINARY_DIR}/Docs/cmakemodules.1 ) -SET(TEXT_FILES +set(TEXT_FILES ${CMake_BINARY_DIR}/Docs/cmake.txt - ${CMake_BINARY_DIR}/Docs/cmake.docbook ${CMake_BINARY_DIR}/Docs/cmake-policies.txt ${CMake_BINARY_DIR}/Docs/cmake-properties.txt ${CMake_BINARY_DIR}/Docs/cmake-variables.txt @@ -35,7 +34,7 @@ SET(TEXT_FILES ${CMake_BINARY_DIR}/Docs/cmake-commands.txt ${CMake_BINARY_DIR}/Docs/cmake-compatcommands.txt ) -SET(HTML_FILES +set(HTML_FILES ${CMake_BINARY_DIR}/Docs/cmake.html ${CMake_BINARY_DIR}/Docs/cmake-policies.html ${CMake_BINARY_DIR}/Docs/cmake-properties.html @@ -44,13 +43,16 @@ SET(HTML_FILES ${CMake_BINARY_DIR}/Docs/cmake-commands.html ${CMake_BINARY_DIR}/Docs/cmake-compatcommands.html ) +set(DOCBOOK_FILES + ${CMake_BINARY_DIR}/Docs/cmake.docbook + ) -MACRO(ADD_DOCS target dependency) +macro(ADD_DOCS target dependency) # Generate documentation for "ctest" executable. - GET_TARGET_PROPERTY(CMD ${target} LOCATION) + get_target_property(CMD ${target} LOCATION) # only generate the documentation if the target is actually built - IF(CMD) - ADD_CUSTOM_COMMAND( + if(CMD) + add_custom_command( OUTPUT ${CMake_BINARY_DIR}/Docs/${target}.txt ${${target}-PATH} # Possibly set PATH, see below. COMMAND ${CMD} @@ -61,28 +63,25 @@ MACRO(ADD_DOCS target dependency) DEPENDS ${target} MAIN_DEPENDENCY ${dependency} ) - SET(DOC_FILES ${DOC_FILES} ${CMake_BINARY_DIR}/Docs/${target}.txt) - LIST(APPEND MAN_FILES ${CMake_BINARY_DIR}/Docs/${target}.1) - LIST(APPEND TEXT_FILES - ${CMake_BINARY_DIR}/Docs/${target}.txt - ${CMake_BINARY_DIR}/Docs/${target}.docbook - ) - LIST(APPEND HTML_FILES ${CMake_BINARY_DIR}/Docs/${target}.html) - ENDIF(CMD) -ENDMACRO(ADD_DOCS target dependency) + set(DOC_FILES ${DOC_FILES} ${CMake_BINARY_DIR}/Docs/${target}.txt) + list(APPEND MAN_FILES ${CMake_BINARY_DIR}/Docs/${target}.1) + list(APPEND TEXT_FILES ${CMake_BINARY_DIR}/Docs/${target}.txt) + list(APPEND HTML_FILES ${CMake_BINARY_DIR}/Docs/${target}.html) + list(APPEND DOCBOOK_FILES ${CMake_BINARY_DIR}/Docs/${target}.docbook) + endif() +endmacro() # Help cmake-gui find the Qt DLLs on Windows. -SET(WIN_SHELL_GENS "Visual Studio|NMake|MinGW|Watcom|Borland") -IF(BUILD_QtDialog AND "${CMAKE_GENERATOR}" MATCHES "${WIN_SHELL_GENS}" +set(WIN_SHELL_GENS "Visual Studio|NMake|MinGW|Watcom|Borland") +if(BUILD_QtDialog AND "${CMAKE_GENERATOR}" MATCHES "${WIN_SHELL_GENS}" AND EXISTS "${QT_QMAKE_EXECUTABLE}" AND NOT CMAKE_NO_AUTO_QT_ENV) - GET_FILENAME_COMPONENT(Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH) - IF(EXISTS "${Qt_BIN_DIR}/QtCore4.dll") + get_filename_component(Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH) + if(EXISTS "${Qt_BIN_DIR}/QtCore4.dll") # Tell the macro to set the path before running cmake-gui. - STRING(REPLACE ";" "\\;" _PATH "PATH=${Qt_BIN_DIR};%PATH%") - SET(cmake-gui-PATH COMMAND set "${_PATH}") - ENDIF(EXISTS "${Qt_BIN_DIR}/QtCore4.dll") -ENDIF(BUILD_QtDialog AND "${CMAKE_GENERATOR}" MATCHES "${WIN_SHELL_GENS}" - AND EXISTS "${QT_QMAKE_EXECUTABLE}" AND NOT CMAKE_NO_AUTO_QT_ENV) + string(REPLACE ";" "\\;" _PATH "PATH=${Qt_BIN_DIR};%PATH%") + set(cmake-gui-PATH COMMAND set "${_PATH}") + endif() +endif() # add the docs for the executables ADD_DOCS(ctest ${CMake_SOURCE_DIR}/Utilities/Doxygen/authors.txt) @@ -93,10 +92,10 @@ ADD_DOCS(cmake-gui ${CMake_SOURCE_DIR}/Utilities/Doxygen/doxyfile.in) # add the documentation for cmake itself -GET_TARGET_PROPERTY(CMD cmake LOCATION) -ADD_CUSTOM_COMMAND( +get_target_property(CMD cmake LOCATION) +add_custom_command( OUTPUT ${CMake_BINARY_DIR}/Docs/cmake.txt - COMMAND ${CMD} + COMMAND ${CMD} ARGS --copyright ${CMake_BINARY_DIR}/Docs/Copyright.txt --help-full ${CMake_BINARY_DIR}/Docs/cmake.txt --help-full ${CMake_BINARY_DIR}/Docs/cmake.html @@ -124,12 +123,16 @@ ADD_CUSTOM_COMMAND( MAIN_DEPENDENCY ${CMake_SOURCE_DIR}/Utilities/Doxygen/authors.txt ) -INSTALL_FILES(${CMAKE_MAN_DIR}/man1 FILES ${MAN_FILES}) -INSTALL_FILES(${CMAKE_DOC_DIR} FILES ${HTML_FILES} ${TEXT_FILES}) -INSTALL(FILES cmake.m4 DESTINATION share/aclocal) +install_files(${CMAKE_MAN_DIR}/man1 FILES ${MAN_FILES}) +install_files(${CMAKE_DOC_DIR} FILES + ${TEXT_FILES} + ${HTML_FILES} + ${DOCBOOK_FILES} + ) +install(FILES cmake.m4 DESTINATION share/aclocal) # Drive documentation generation. -ADD_CUSTOM_TARGET(documentation ALL DEPENDS ${DOC_FILES} ${CMake_BINARY_DIR}/Docs/cmake.txt ) +add_custom_target(documentation ALL DEPENDS ${DOC_FILES} ${CMake_BINARY_DIR}/Docs/cmake.txt ) # Documentation testing. if(BUILD_TESTING) @@ -142,17 +145,22 @@ if(BUILD_TESTING) execute_process(COMMAND ${LIBXML2_XMLLINT_EXECUTABLE} --help OUTPUT_VARIABLE _help ERROR_VARIABLE _err) if("${_help}" MATCHES "--path" AND "${_help}" MATCHES "--nonet") - # We provide the XHTML DTD and its dependencies in the 'xml' - # directory so that xmllint can run without network access. - # However, it's --path option accepts a space-separated list of - # paths so it cannot handle spaces in the path to the source tree. - # Therefore we run the tool with the current work directory set to - # the 'xml' directory and use '.' as the path. + # We provide DTDs in the 'xml' directory so that xmllint can run without + # network access. Note that xmllints's --path option accepts a + # space-separated list of url-encoded paths. + set(_dtd_dir "${CMAKE_CURRENT_SOURCE_DIR}/xml") + string(REPLACE " " "%20" _dtd_dir "${_dtd_dir}") + string(REPLACE ":" "%3A" _dtd_dir "${_dtd_dir}") add_test(CMake.HTML - ${CMAKE_CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}/xml - ${LIBXML2_XMLLINT_EXECUTABLE} --valid --noout --nonet --path . + ${LIBXML2_XMLLINT_EXECUTABLE} --valid --noout --nonet + --path ${_dtd_dir}/xhtml1 ${HTML_FILES} ) + add_test(CMake.DocBook + ${LIBXML2_XMLLINT_EXECUTABLE} --valid --noout --nonet + --path ${_dtd_dir}/docbook-4.5 + ${DOCBOOK_FILES} + ) endif() endif() endif() diff --git a/Utilities/Doxygen/CMakeLists.txt b/Utilities/Doxygen/CMakeLists.txt index 2430391fd..813e34daf 100644 --- a/Utilities/Doxygen/CMakeLists.txt +++ b/Utilities/Doxygen/CMakeLists.txt @@ -13,27 +13,27 @@ # # Build the documentation # -INCLUDE (${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL) +include (${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL) -IF (BUILD_DOCUMENTATION) +if (BUILD_DOCUMENTATION) # # Configure the script and the doxyfile, then add target # - IF(NOT DOT_PATH) - GET_FILENAME_COMPONENT(DOT_PATH ${DOT} PATH) - ENDIF(NOT DOT_PATH) + if(NOT DOT_PATH) + get_filename_component(DOT_PATH ${DOT} PATH) + endif() - CONFIGURE_FILE( + configure_file( ${CMake_SOURCE_DIR}/Utilities/Doxygen/doxyfile.in ${CMake_BINARY_DIR}/Utilities/Doxygen/doxyfile) - CONFIGURE_FILE( + configure_file( ${CMake_SOURCE_DIR}/Utilities/Doxygen/doc_makeall.sh.in ${CMake_BINARY_DIR}/Utilities/Doxygen/doc_makeall.sh) - ADD_CUSTOM_TARGET(DoxygenDoc + add_custom_target(DoxygenDoc ${BASH} ${CMake_BINARY_DIR}/Utilities/Doxygen/doc_makeall.sh) -ENDIF (BUILD_DOCUMENTATION) +endif () diff --git a/Utilities/Doxygen/doc_makeall.sh.in b/Utilities/Doxygen/doc_makeall.sh.in index a1b00e7d0..ed7b521e4 100755 --- a/Utilities/Doxygen/doc_makeall.sh.in +++ b/Utilities/Doxygen/doc_makeall.sh.in @@ -4,7 +4,7 @@ # ------------------------------------------------------------------------- # Path to several tools (_PROG to avoid the typical GZIP env var pb) -# Example: +# Example: # DOXYGEN_PROG=@DOXYGEN@ (INCLUDE(${CMAKE_ROOT}/Modules/FindDoxygen.cmake)) # GZIP_PROG=@GZIP@ (INCLUDE(${CMAKE_ROOT}/Modules/FindCygwin.cmake)) # HHC_PROG=@HHC@ (INCLUDE(${CMAKE_ROOT}/Modules/FindHhc.cmake)) @@ -26,26 +26,26 @@ export WGET_PROG="@WGET@" # wget (remote file retrieval) # PROJECT_NAME: # Documentation/project name. Used in some of the resulting file names and -# xrefs to uniquify two or more projects linked together through their +# xrefs to uniquify two or more projects linked together through their # Doxygen's tag files. Mandatory for each documentation set. # Note: might be the same as the doxyfile's PROJECT_NAME -# Example: +# Example: # PROJECT_NAME=VTK # export PROJECT_NAME=CMake # PATH_TO_VTK_DOX_SCRIPTS: # Path to the directory holding the Perl scripts used to produce the VTK doc -# in Doxygen format. You need the VTK source files or a local copy of +# in Doxygen format. You need the VTK source files or a local copy of # these scripts. -# Example: +# Example: # PATH_TO_VTK_DOX_SCRIPTS=@VTK_SOURCE_DIR@/Utilities/Doxygen # export PATH_TO_VTK_DOX_SCRIPTS="@VTK_SOURCE_DIR@/Utilities/Doxygen" # SOURCE_DIR: # Source directory. The top directory of the source files. -# Example: +# Example: # SOURCE_DIR=@VTK_SOURCE_DIR@ # export SOURCE_DIR="@CMake_SOURCE_DIR@" @@ -54,7 +54,7 @@ export SOURCE_DIR="@CMake_SOURCE_DIR@" # Relative path from the top directory of the source files to the directory # (or top directory) holding the files to document. Useful if several parts # of the same source directory should be documented separately. -# Example: +# Example: # REL_PATH_TO_TOP=. # REL_PATH_TO_TOP=framework/src # @@ -67,7 +67,7 @@ export REL_PATH_TO_TOP=. # This directory is erased at the end of this script, unless you comment # the corresponding line. # DOXTEMP might be used to simplify the syntax. -# Example: +# Example: # DOXTEMP=DOXTEMP=@VTK_BINARY_DIR@/Utilities/Doxygen # INTERMEDIATE_DOX_DIR=$DOXTEMP/dox # @@ -76,7 +76,7 @@ export INTERMEDIATE_DOX_DIR="$DOXTEMP/dox" # DOXYFILE: # Path to the Doxygen configuration file (i.e. doxyfile). -# Example: +# Example: # DOXYFILE=$DOXTEMP/doxyfile # export DOXYFILE="$DOXTEMP/doxyfile" @@ -86,7 +86,7 @@ export DOXYFILE="$DOXTEMP/doxyfile" # Note: should be the same as your doxyfile's OUTPUT_DIRECTORY # If ON, allows the output directory to be erased when some advanced output # file have been produced (HTML Help, or TAR archive for example). -# Example: +# Example: # OUTPUT_DIRECTORY=$DOXTEMP/doc # ALLOW_ERASE_OUTPUT_DIRECTORY=ON # @@ -94,16 +94,16 @@ export OUTPUT_DIRECTORY="$DOXTEMP/doc" export ALLOW_ERASE_OUTPUT_DIRECTORY=ON # COMPILE_HTML_HELP RESULTING_HTML_HELP_FILE: -# Compile the CHM (Compressed HTML) HTML Help file, name of the resulting -# file. If set to ON and name is non-empty these options will actually +# Compile the CHM (Compressed HTML) HTML Help file, name of the resulting +# file. If set to ON and name is non-empty these options will actually # trigger the HTML-Help compiler to create the CHM. The resulting # file (usually index.chm) will be renamed to this name. # Note: if ON, the whole $OUTPUT_DIRECTORY will be erased at the end of -# this script, since this file is considered to be one of the +# this script, since this file is considered to be one of the # advanced final output, unless ALLOW_ERASE_OUTPUT_DIRECTORY is OFF -# Note: your doxyfile should be configured to enable HTML Help creation +# Note: your doxyfile should be configured to enable HTML Help creation # (using GENERATE_HTML = YES, GENERATE_HTMLHELP = YES) -# Example: +# Example: # COMPILE_HTML_HELP=ON # COMPILE_HTML_HELP=@DOCUMENTATION_HTML_HELP@ # RESULTING_HTML_HELP_FILE=$DOXTEMP/vtk4.chm @@ -113,10 +113,10 @@ export RESULTING_HTML_HELP_FILE="$DOXTEMP/$PROJECT_NAME.chm" # CREATE_HTML_TARZ_ARCHIVE RESULTING_HTML_TARZ_ARCHIVE_FILE: # Create a compressed (gzip) tar archive of the html directory (located -# under the OUTPUT_DIRECTORY), and name of the resulting archive file. -# Note: your doxyfile should be configured to enable HTML creation +# under the OUTPUT_DIRECTORY), and name of the resulting archive file. +# Note: your doxyfile should be configured to enable HTML creation # (using GENERATE_HTML = YES) -# Example: +# Example: # CREATE_HTML_TARZ_ARCHIVE=ON # CREATE_HTML_TARZ_ARCHIVE=@DOCUMENTATION_HTML_TARZ@ # RESULTING_HTML_TARZ_ARCHIVE_FILE=$DOXTEMP/vtk4-html.tar.gz diff --git a/Utilities/Git/pre-commit b/Utilities/Git/pre-commit index d308a81b5..a35d11102 100755 --- a/Utilities/Git/pre-commit +++ b/Utilities/Git/pre-commit @@ -47,18 +47,16 @@ if test -z "$HOOKS_ALLOW_KWSYS"; then '"$(echo "$files" | sed 's/^/ /')"' -cannot be committed through Git. KWSys is kept in a CVS repository -shared by several projects. A robot replays changes committed there -into the Source/kwsys directory in CMake. Please send changes to -this directory separately. Run +should not be made directly in CMake. KWSys is kept in its own Git +repository and shared by several projects. Please visit - git reset HEAD -- Source/kwsys + http://public.kitware.com/Wiki/KWSys/Git -to unstage these changes and then +to contribute changes directly to KWSys. Run - git diff -- Source/kwsys > kwsys.patch + git reset HEAD -- Source/kwsys -to construct the patch. Alternatively, set environment variable +to unstage these changes. Alternatively, set environment variable HOOKS_ALLOW_KWSYS=1 diff --git a/Utilities/KWIML/ABI.h.in b/Utilities/KWIML/ABI.h.in index 060a520db..b71cdfb9f 100644 --- a/Utilities/KWIML/ABI.h.in +++ b/Utilities/KWIML/ABI.h.in @@ -253,7 +253,9 @@ suppression macro @KWIML@_ABI_NO_VERIFY was defined. # else # define @KWIML@_ABI_SIZEOF_LONG_LONG 0 # endif -# elif defined(__hpux) && !defined(__GNUC__) /* Old HP: no __HP_cc/__HP_aCC above */ +# elif defined(__GNUC__) /* GNU */ +# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */ # define @KWIML@_ABI_SIZEOF_LONG_LONG 8 # endif #endif @@ -414,6 +416,18 @@ suppression macro @KWIML@_ABI_NO_VERIFY was defined. #elif defined(__SYSC_ZARCH__) # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG +/* VAX */ +#elif defined(__vax__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG + +/* Aarch64 */ +#elif defined(__aarch64__) +# if !defined(__AARCH64EB__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE +# else +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG +# endif + /* Unknown CPU */ #elif !defined(@KWIML@_ABI_NO_ERROR_ENDIAN) # error "Byte order of target CPU unknown." diff --git a/Utilities/KWIML/CMakeLists.txt b/Utilities/KWIML/CMakeLists.txt index 6a8641adc..62b6fffb7 100644 --- a/Utilities/KWIML/CMakeLists.txt +++ b/Utilities/KWIML/CMakeLists.txt @@ -13,8 +13,8 @@ # Import the KWIML directory tree into a subdirectory under a parent # project and configure the library as follows: # -# SET(KWIML myIML) -# SUBDIRS(KWIML) +# set(KWIML myIML) +# subdirs(KWIML) # # Optional settings are as follows: # @@ -22,8 +22,8 @@ # Headers will go in a directory called "${KWIML}" under this root. # For example: # -# SET(KWIML_HEADER_ROOT ${PROJECT_BINARY_DIR}) -# INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) +# set(KWIML_HEADER_ROOT ${PROJECT_BINARY_DIR}) +# include_directories(${PROJECT_BINARY_DIR}) # # KWIML_INSTALL_INCLUDE_DIR = install KWIML with "make install" # Specify a value relative to the install prefix and do NOT start with '/'. diff --git a/Utilities/KWStyle/CMakeLists.txt b/Utilities/KWStyle/CMakeLists.txt index 5b0c84e8b..b2c798c0f 100644 --- a/Utilities/KWStyle/CMakeLists.txt +++ b/Utilities/KWStyle/CMakeLists.txt @@ -16,63 +16,63 @@ # Search for a built-from-source KWStyle under Dashboards/Support on a typical # dashboard machines: # -SET(home "$ENV{HOME}") -IF(NOT home) - STRING(REPLACE "\\" "/" home "$ENV{USERPROFILE}") -ENDIF() +set(home "$ENV{HOME}") +if(NOT home) + string(REPLACE "\\" "/" home "$ENV{USERPROFILE}") +endif() -FIND_PROGRAM(KWSTYLE_EXECUTABLE - NAMES KWStyle +find_program(KWSTYLE_EXECUTABLE + NAMES KWStyle PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware Inc.\\KWStyle 1.0.0]/bin" "${home}/Dashboards/Support/KWStyle/bin" ) -MARK_AS_ADVANCED(KWSTYLE_EXECUTABLE) +mark_as_advanced(KWSTYLE_EXECUTABLE) -SET(CMAKE_USE_KWSTYLE_DEFAULT OFF) -IF(KWSTYLE_EXECUTABLE) - SET(CMAKE_USE_KWSTYLE_DEFAULT ON) -ENDIF() +set(CMAKE_USE_KWSTYLE_DEFAULT OFF) +if(KWSTYLE_EXECUTABLE) + set(CMAKE_USE_KWSTYLE_DEFAULT ON) +endif() -OPTION(CMAKE_USE_KWSTYLE +option(CMAKE_USE_KWSTYLE "Add StyleCheck target and KWStyle test: run KWStyle to check for coding standard violations." ${CMAKE_USE_KWSTYLE_DEFAULT}) -MARK_AS_ADVANCED(CMAKE_USE_KWSTYLE) +mark_as_advanced(CMAKE_USE_KWSTYLE) -IF(CMAKE_USE_KWSTYLE) - OPTION(KWSTYLE_USE_VIM_FORMAT "Set KWStyle to generate errors with a VIM-compatible format." OFF) - OPTION(KWSTYLE_USE_MSVC_FORMAT "Set KWStyle to generate errors with a VisualStudio-compatible format." OFF) - MARK_AS_ADVANCED(KWSTYLE_USE_VIM_FORMAT) - MARK_AS_ADVANCED(KWSTYLE_USE_MSVC_FORMAT) +if(CMAKE_USE_KWSTYLE) + option(KWSTYLE_USE_VIM_FORMAT "Set KWStyle to generate errors with a VIM-compatible format." OFF) + option(KWSTYLE_USE_MSVC_FORMAT "Set KWStyle to generate errors with a VisualStudio-compatible format." OFF) + mark_as_advanced(KWSTYLE_USE_VIM_FORMAT) + mark_as_advanced(KWSTYLE_USE_MSVC_FORMAT) - IF(KWSTYLE_USE_VIM_FORMAT) - SET(KWSTYLE_ARGUMENTS -vim ${KWSTYLE_ARGUMENTS}) - ENDIF(KWSTYLE_USE_VIM_FORMAT) + if(KWSTYLE_USE_VIM_FORMAT) + set(KWSTYLE_ARGUMENTS -vim ${KWSTYLE_ARGUMENTS}) + endif() - IF(KWSTYLE_USE_MSVC_FORMAT) - SET(KWSTYLE_ARGUMENTS -msvc ${KWSTYLE_ARGUMENTS}) - ENDIF(KWSTYLE_USE_MSVC_FORMAT) + if(KWSTYLE_USE_MSVC_FORMAT) + set(KWSTYLE_ARGUMENTS -msvc ${KWSTYLE_ARGUMENTS}) + endif() - CONFIGURE_FILE(${CMake_SOURCE_DIR}/Utilities/KWStyle/CMake.kws.xml.in + configure_file(${CMake_SOURCE_DIR}/Utilities/KWStyle/CMake.kws.xml.in ${CMake_BINARY_DIR}/CMake.kws.xml) - CONFIGURE_FILE(${CMake_SOURCE_DIR}/Utilities/KWStyle/CMakeMoreChecks.kws.xml.in + configure_file(${CMake_SOURCE_DIR}/Utilities/KWStyle/CMakeMoreChecks.kws.xml.in ${CMake_BINARY_DIR}/CMakeMoreChecks.kws.xml) - CONFIGURE_FILE(${CMake_SOURCE_DIR}/Utilities/KWStyle/CMakeFiles.txt.in + configure_file(${CMake_SOURCE_DIR}/Utilities/KWStyle/CMakeFiles.txt.in ${CMake_BINARY_DIR}/CMakeKWSFiles.txt) - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${CMake_BINARY_DIR}/KWStyleReport.txt COMMAND ${KWSTYLE_EXECUTABLE} ARGS -xml ${CMake_BINARY_DIR}/CMake.kws.xml -o ${CMake_SOURCE_DIR}/Utilities/KWStyle/CMakeOverwrite.txt -v ${KWSTYLE_ARGUMENTS} -D ${CMake_BINARY_DIR}/CMakeKWSFiles.txt COMMENT "Coding Style Checker" ) - ADD_CUSTOM_TARGET(MoreStyleChecks + add_custom_target(MoreStyleChecks COMMAND ${KWSTYLE_EXECUTABLE} -xml ${CMake_BINARY_DIR}/CMakeMoreChecks.kws.xml -html ${CMake_BINARY_DIR}/html -o ${CMake_SOURCE_DIR}/Utilities/KWStyle/CMakeOverwrite.txt -v ${KWSTYLE_ARGUMENTS} -D ${CMake_BINARY_DIR}/CMakeKWSFiles.txt COMMENT "Coding Style Checker, more checks enabled" ) - ADD_CUSTOM_TARGET(StyleCheck DEPENDS ${CMake_BINARY_DIR}/KWStyleReport.txt) -ENDIF(CMAKE_USE_KWSTYLE) + add_custom_target(StyleCheck DEPENDS ${CMake_BINARY_DIR}/KWStyleReport.txt) +endif() diff --git a/Utilities/KWStyle/CMakeMoreChecks.kws.xml.in b/Utilities/KWStyle/CMakeMoreChecks.kws.xml.in index b7078e0cf..c48e92f77 100644 --- a/Utilities/KWStyle/CMakeMoreChecks.kws.xml.in +++ b/Utilities/KWStyle/CMakeMoreChecks.kws.xml.in @@ -1,6 +1,6 @@ - 10 + 10 79
"@CMake_SOURCE_DIR@/Utilities/KWStyle/Headers",false,true
diff --git a/Utilities/Release/Cygwin/CMakeLists.txt b/Utilities/Release/Cygwin/CMakeLists.txt index 2420c97d9..c59a6fa94 100644 --- a/Utilities/Release/Cygwin/CMakeLists.txt +++ b/Utilities/Release/Cygwin/CMakeLists.txt @@ -1,25 +1,25 @@ -FILE(GLOB INSTALLED_CURSES /usr/bin/cygncurses-*.dll) -SET(MAX 0) -FOREACH(f ${INSTALLED_CURSES}) - IF(NOT "${f}" MATCHES "\\+") - STRING(REGEX REPLACE ".*-([0-9]*).dll" "\\1" NUMBER "${f}") - IF(NUMBER GREATER MAX) - SET(MAX ${NUMBER}) - ENDIF(NUMBER GREATER MAX) - ENDIF(NOT "${f}" MATCHES "\\+") -ENDFOREACH(f) -STRING(REGEX REPLACE "/usr/bin/" "\\1" NUMBER "${f}") -SET(CMAKE_NCURSES_VERSION "libncurses${MAX}") -MESSAGE(STATUS "Using curses version: libncurses${MAX}") -CONFIGURE_FILE("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-setup.hint.in" +file(GLOB INSTALLED_CURSES /usr/bin/cygncurses-*.dll) +set(MAX 0) +foreach(f ${INSTALLED_CURSES}) + if(NOT "${f}" MATCHES "\\+") + string(REGEX REPLACE ".*-([0-9]*).dll" "\\1" NUMBER "${f}") + if(NUMBER GREATER MAX) + set(MAX ${NUMBER}) + endif() + endif() +endforeach() +string(REGEX REPLACE "/usr/bin/" "\\1" NUMBER "${f}") +set(CMAKE_NCURSES_VERSION "libncurses${MAX}") +message(STATUS "Using curses version: libncurses${MAX}") +configure_file("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-setup.hint.in" "${CMake_BINARY_DIR}/setup.hint") -CONFIGURE_FILE("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/README.cygwin.in" +configure_file("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/README.cygwin.in" "${CMake_BINARY_DIR}/Docs/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.README") -INSTALL_FILES(/share/doc/Cygwin FILES +install_files(/share/doc/Cygwin FILES ${CMake_BINARY_DIR}/Docs/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.README ) -CONFIGURE_FILE("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-package.sh.in" +configure_file("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-package.sh.in" ${CPACK_CYGWIN_BUILD_SCRIPT}) -CONFIGURE_FILE("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-patch.diff.in" +configure_file("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-patch.diff.in" ${CPACK_CYGWIN_PATCH_FILE}) diff --git a/Utilities/Release/Cygwin/cygwin-package.sh.in b/Utilities/Release/Cygwin/cygwin-package.sh.in index 9730b3332..dff27f14d 100755 --- a/Utilities/Release/Cygwin/cygwin-package.sh.in +++ b/Utilities/Release/Cygwin/cygwin-package.sh.in @@ -4,11 +4,11 @@ TOP_DIR=`cd \`echo "$0" | sed -n '/\//{s/\/[^\/]*$//;p;}'\`;pwd` mkdirs() { ( - mkdir -p "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" + mkdir -p "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" ) } -# cd into +# cd into # untar source tree and apply patch prep() { @@ -23,7 +23,7 @@ prep() conf() { ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && + cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && ../bootstrap --parallel=2 ) } @@ -49,8 +49,8 @@ pkg() { ( cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - ./bin/cpack && - mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.tar.bz2 "$TOP_DIR" + ./bin/cpack && + mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.tar.bz2 "$TOP_DIR" ) } @@ -59,7 +59,7 @@ spkg() ( cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && ./bin/cpack --config CPackSourceConfig.cmake && - mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 "$TOP_DIR" + mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 "$TOP_DIR" ) } diff --git a/Utilities/Release/create-cmake-release.cmake b/Utilities/Release/create-cmake-release.cmake index c304e6777..37e223d28 100644 --- a/Utilities/Release/create-cmake-release.cmake +++ b/Utilities/Release/create-cmake-release.cmake @@ -32,7 +32,7 @@ ${CMAKE_COMMAND} -DCMAKE_CREATE_VERSION=${CMAKE_CREATE_VERSION} -P ${CMAKE_ROOT} xterm -geometry 64x6+${x}+${y} -sb -sl 2000 -T ${f}-${CMAKE_CREATE_VERSION}.log -e tail -f ${CMAKE_CURRENT_SOURCE_DIR}/logs/${f}-${CMAKE_CREATE_VERSION}.log& ") math(EXPR i "${i}+1") - endforeach(f) + endforeach() execute_process(COMMAND chmod a+x ${filename}) endfunction() diff --git a/Utilities/Release/dash2win64_cygwin.cmake b/Utilities/Release/dash2win64_cygwin.cmake index 78e8df0af..663c61581 100644 --- a/Utilities/Release/dash2win64_cygwin.cmake +++ b/Utilities/Release/dash2win64_cygwin.cmake @@ -16,4 +16,12 @@ set(CC gcc) set(SCRIPT_NAME dash2win64cygwin) set(GIT_EXTRA "git config core.autocrlf true") get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) + +# WARNING: Temporary fix!! This exclusion of the ExternalProject test +# is temporary until we can set up a new cygwin build machine. +# It only fails because of cygwin/non-cygwin "svn" mismatches in this +# particular environment. This is less than ideal, but at least it +# allows us to produce cygwin builds in the short term. +set(EXTRA_CTEST_ARGS "-E ExternalProject") + include(${path}/release_cmake.cmake) diff --git a/Utilities/Release/dash2win64_release.cmake b/Utilities/Release/dash2win64_release.cmake index fb82de0d0..6d1ac767e 100644 --- a/Utilities/Release/dash2win64_release.cmake +++ b/Utilities/Release/dash2win64_release.cmake @@ -8,6 +8,7 @@ set(CPACK_SOURCE_GENERATORS "ZIP") set(MAKE_PROGRAM "make") set(MAKE "${MAKE_PROGRAM} -j8") set(INITIAL_CACHE "CMAKE_BUILD_TYPE:STRING=Release +CMAKE_USE_OPENSSL:BOOL=ON CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CMAKE_Fortran_COMPILER:FILEPATH=FALSE CMAKE_GENERATOR:INTERNAL=Unix Makefiles diff --git a/Utilities/Release/dashmacmini2_release.cmake b/Utilities/Release/dashmacmini2_release.cmake index 3e6b04973..5e57a70b2 100644 --- a/Utilities/Release/dashmacmini2_release.cmake +++ b/Utilities/Release/dashmacmini2_release.cmake @@ -9,6 +9,10 @@ set(CPACK_BINARY_GENERATORS "PackageMaker TGZ TZ") set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release CMAKE_OSX_ARCHITECTURES:STRING=ppc;i386 +CMAKE_USE_OPENSSL:BOOL=ON +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1c-install/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/Users/kitware/openssl-1.0.1c-install/include +OPENSSL_SSL_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1c-install/lib/libssl.a CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CPACK_SYSTEM_NAME:STRING=Darwin-universal BUILD_QtDialog:BOOL=TRUE diff --git a/Utilities/Release/dashmacmini5_release.cmake b/Utilities/Release/dashmacmini5_release.cmake index bd93a8733..36b095287 100644 --- a/Utilities/Release/dashmacmini5_release.cmake +++ b/Utilities/Release/dashmacmini5_release.cmake @@ -8,6 +8,10 @@ set(MAKE "${MAKE_PROGRAM} -j5") set(CPACK_BINARY_GENERATORS "PackageMaker TGZ TZ") set(CPACK_SOURCE_GENERATORS "TGZ TZ") set(INITIAL_CACHE " +CMAKE_USE_OPENSSL:BOOL=ON +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1c-install/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/Users/kitware/openssl-1.0.1c-install/include +OPENSSL_SSL_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1c-install/lib/libssl.a CMAKE_BUILD_TYPE:STRING=Release CMAKE_OSX_ARCHITECTURES:STRING=x86_64;i386 CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.5 diff --git a/Utilities/Release/magrathea_release.cmake b/Utilities/Release/magrathea_release.cmake index 1b2ae02c7..4783fdad3 100644 --- a/Utilities/Release/magrathea_release.cmake +++ b/Utilities/Release/magrathea_release.cmake @@ -3,11 +3,17 @@ set(HOST magrathea) set(MAKE_PROGRAM "make") set(CC gcc332s) set(CXX c++332s) +set(CFLAGS -DDT_RUNPATH=29) +set(CXXFLAGS -DDT_RUNPATH=29) set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release CURSES_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libncurses.a CURSES_INCLUDE_PATH:PATH=/usr/i686-gcc-332s/include/ncurses FORM_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libform.a +CMAKE_USE_OPENSSL:BOOL=ON +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1c-install/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.1c-install/include +OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1c-install/lib/libssl.a CPACK_SYSTEM_NAME:STRING=Linux-i386 BUILD_QtDialog:BOOL:=TRUE QT_QMAKE_EXECUTABLE:FILEPATH=/home/kitware/qt-4.43-install/bin/qmake diff --git a/Utilities/Release/release_cmake.cmake b/Utilities/Release/release_cmake.cmake index 0c9b3f9c5..f351ac8c0 100644 --- a/Utilities/Release/release_cmake.cmake +++ b/Utilities/Release/release_cmake.cmake @@ -3,31 +3,31 @@ get_filename_component(SCRIPT_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH) # default to self extracting tgz, tgz, and tar.Z if(NOT DEFINED CPACK_BINARY_GENERATORS) set(CPACK_BINARY_GENERATORS "STGZ TGZ TZ") -endif(NOT DEFINED CPACK_BINARY_GENERATORS) +endif() if(DEFINED EXTRA_COPY) set(HAS_EXTRA_COPY 1) -endif(DEFINED EXTRA_COPY) +endif() if(NOT DEFINED CMAKE_RELEASE_DIRECTORY) set(CMAKE_RELEASE_DIRECTORY "~/CMakeReleaseDirectory") -endif(NOT DEFINED CMAKE_RELEASE_DIRECTORY) +endif() if(NOT DEFINED SCRIPT_NAME) set(SCRIPT_NAME "${HOST}") -endif(NOT DEFINED SCRIPT_NAME) +endif() if(NOT DEFINED MAKE_PROGRAM) message(FATAL_ERROR "MAKE_PROGRAM must be set") -endif(NOT DEFINED MAKE_PROGRAM) +endif() if(NOT DEFINED MAKE) set(MAKE "${MAKE_PROGRAM}") -endif(NOT DEFINED MAKE) +endif() if(NOT DEFINED RUN_SHELL) set(RUN_SHELL "/bin/sh") -endif(NOT DEFINED RUN_SHELL) +endif() if(NOT DEFINED PROCESSORS) set(PROCESSORS 1) -endif(NOT DEFINED PROCESSORS) +endif() if(NOT DEFINED CMAKE_CREATE_VERSION) message(FATAL_ERROR "CMAKE_CREATE_VERSION not defined") -endif(NOT DEFINED CMAKE_CREATE_VERSION) +endif() if(NOT DEFINED GIT_COMMAND) set(GIT_COMMAND git) endif() @@ -40,15 +40,15 @@ endif() if(NOT DEFINED FINAL_PATH ) set(FINAL_PATH ${CMAKE_RELEASE_DIRECTORY}/${CMAKE_CREATE_VERSION}-build) -endif(NOT DEFINED FINAL_PATH ) +endif() if(NOT HOST) message(FATAL_ERROR "HOST must be specified with -DHOST=host") -endif(NOT HOST) +endif() if(NOT DEFINED MAKE) message(FATAL_ERROR "MAKE must be specified with -DMAKE=\"make -j2\"") -endif(NOT DEFINED MAKE) - +endif() + message("Creating CMake release ${CMAKE_CREATE_VERSION} on ${HOST} with parallel = ${PROCESSORS}") # define a macro to run a remote command @@ -57,14 +57,14 @@ macro(remote_command comment command) if(${ARGC} GREATER 2) message("ssh ${HOST} ${EXTRA_HOP} ${command}") execute_process(COMMAND ssh ${HOST} ${EXTRA_HOP} ${command} RESULT_VARIABLE result INPUT_FILE ${ARGV2}) - else(${ARGC} GREATER 2) - message("ssh ${HOST} ${EXTRA_HOP} ${command}") - execute_process(COMMAND ssh ${HOST} ${EXTRA_HOP} ${command} RESULT_VARIABLE result) - endif(${ARGC} GREATER 2) + else() + message("ssh ${HOST} ${EXTRA_HOP} ${command}") + execute_process(COMMAND ssh ${HOST} ${EXTRA_HOP} ${command} RESULT_VARIABLE result) + endif() if(${result} GREATER 0) message(FATAL_ERROR "Error running command: ${command}, return value = ${result}") - endif(${result} GREATER 0) -endmacro(remote_command) + endif() +endmacro() # set this so configure file will work from script mode # create the script specific for the given host @@ -73,64 +73,64 @@ configure_file(${SCRIPT_PATH}/release_cmake.sh.in ${SCRIPT_FILE} @ONLY) # run the script by starting a shell on the remote machine # then using the script file as input to the shell -IF(RUN_LOCAL) +if(RUN_LOCAL) message(FATAL_ERROR "run this command: ${RUN_SHELL} ${SCRIPT_FILE}") -ELSE(RUN_LOCAL) +else() remote_command("run release_cmake-${HOST}.sh on server" "${RUN_SHELL}" ${SCRIPT_FILE}) -ENDIF(RUN_LOCAL) +endif() -# now figure out which types of packages were created +# now figure out which types of packages were created set(generators ${CPACK_BINARY_GENERATORS} ${CPACK_SOURCE_GENERATORS}) separate_arguments(generators) foreach(gen ${generators}) if("${gen}" STREQUAL "TGZ") set(SUFFIXES ${SUFFIXES} "*.tar.gz") - endif("${gen}" STREQUAL "TGZ") + endif() if("${gen}" STREQUAL "STGZ") set(SUFFIXES ${SUFFIXES} "*.sh") - endif("${gen}" STREQUAL "STGZ") + endif() if("${gen}" STREQUAL "PackageMaker") set(SUFFIXES ${SUFFIXES} "*.dmg") - endif("${gen}" STREQUAL "PackageMaker") + endif() if("${gen}" STREQUAL "TBZ2") set(SUFFIXES ${SUFFIXES} "*.tar.bz2") - endif("${gen}" STREQUAL "TBZ2") + endif() if("${gen}" MATCHES "Cygwin") set(SUFFIXES ${SUFFIXES} "*.tar.bz2") set(extra_files setup.hint) - endif("${gen}" MATCHES "Cygwin") + endif() if("${gen}" STREQUAL "TZ") set(SUFFIXES ${SUFFIXES} "*.tar.Z") - endif("${gen}" STREQUAL "TZ") + endif() if("${gen}" STREQUAL "ZIP") set(SUFFIXES ${SUFFIXES} "*.zip") - endif("${gen}" STREQUAL "ZIP") + endif() if("${gen}" STREQUAL "NSIS") set(SUFFIXES ${SUFFIXES} "*.exe") - endif("${gen}" STREQUAL "NSIS") -endforeach(gen) + endif() +endforeach() # copy all the files over from the remote machine set(PROJECT_PREFIX cmake-) foreach(suffix ${SUFFIXES}) message("scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} .") - execute_process(COMMAND + execute_process(COMMAND scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} . - RESULT_VARIABLE result) + RESULT_VARIABLE result) if(${result} GREATER 0) message("error getting file back scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} .") - endif(${result} GREATER 0) -endforeach(suffix) + endif() +endforeach() # if there are extra files to copy get them as well if(extra_files) foreach(f ${extra_files}) message("scp ${HOST}:${FINAL_PATH}/${f} .") - execute_process(COMMAND + execute_process(COMMAND scp ${HOST}:${FINAL_PATH}/${f} . RESULT_VARIABLE result) if(${result} GREATER 0) message("error getting file back scp ${HOST}:${FINAL_PATH}/${f} .") - endif(${result} GREATER 0) - endforeach(f) -endif(extra_files) + endif() + endforeach() +endif() diff --git a/Utilities/Release/release_cmake.sh.in b/Utilities/Release/release_cmake.sh.in index 50882c5de..82c039b43 100755 --- a/Utilities/Release/release_cmake.sh.in +++ b/Utilities/Release/release_cmake.sh.in @@ -3,7 +3,7 @@ echo "Start release" date echo "" echo "remove and create working directory @CMAKE_RELEASE_DIRECTORY@" -rm -rf @CMAKE_RELEASE_DIRECTORY@ +rm -rf @CMAKE_RELEASE_DIRECTORY@ mkdir @CMAKE_RELEASE_DIRECTORY@ check_exit_value() @@ -12,7 +12,7 @@ check_exit_value() if [ "$VALUE" != "0" ]; then echo "error in $2" exit 1 - fi + fi } if [ ! -z "@CC@" ]; then @@ -77,7 +77,7 @@ if [ ! -z "@USER_OVERRIDE@" ]; then fi echo "Checkout the source for @CMAKE_CREATE_VERSION@" -cd @CMAKE_RELEASE_DIRECTORY@ +cd @CMAKE_RELEASE_DIRECTORY@ if [ ! -z "@GIT_COMMAND@" ]; then # clone the repo without creating any source files in the directory # matching the branch being built (i.e. master CMake-2-8, etc) @@ -97,9 +97,9 @@ else exit 1 fi -cd @CMAKE_RELEASE_DIRECTORY@/@CMAKE_CREATE_VERSION@-build +cd @CMAKE_RELEASE_DIRECTORY@/@CMAKE_CREATE_VERSION@-build -if [ ! -z "@CONFIGURE_WITH_CMAKE@" ]; then +if [ ! -z "@CONFIGURE_WITH_CMAKE@" ]; then echo "Run cmake to configure cmake" @CMAKE_CONFIGURE_PATH@ ../@CMAKE_CREATE_VERSION@ check_exit_value $? "Configure cmake" || exit 1 @@ -121,11 +121,11 @@ check_exit_value $? "Build cmake" || exit 1 if [ -z "@SKIP_TESTS@" ]; then echo "Run cmake tests" - ./bin/ctest --output-on-failure -j @PROCESSORS@ test + ./bin/ctest --output-on-failure -j @PROCESSORS@ @EXTRA_CTEST_ARGS@ check_exit_value $? "Test cmake" || exit 1 fi -# loop over binary generators +# loop over binary generators generators="@CPACK_BINARY_GENERATORS@" for GEN in $generators; do echo "Create $GEN package" @@ -133,7 +133,7 @@ for GEN in $generators; do check_exit_value $? "Create $GEN package" || exit 1 done -# loop over source generators +# loop over source generators generators="@CPACK_SOURCE_GENERATORS@" for GEN in $generators; do echo "Create $GEN package" diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake index dc6c78f38..9bf35236d 100644 --- a/Utilities/Release/upload_release.cmake +++ b/Utilities/Release/upload_release.cmake @@ -1,4 +1,7 @@ -set(PROJECT_PREFIX cmake-) +set(CTEST_RUN_CURRENT_SCRIPT 0) +if(NOT DEFINED PROJECT_PREFIX) + set(PROJECT_PREFIX cmake-) +endif() if(NOT VERSION) set(VERSION 2.8) endif() @@ -16,15 +19,22 @@ set(count 0) foreach(file ${FILES}) if(NOT IS_DIRECTORY ${file}) message("upload ${file} ${UPLOAD_LOC}") - execute_process(COMMAND + execute_process(COMMAND scp ${file} ${UPLOAD_LOC} - RESULT_VARIABLE result) - math(EXPR count "${count} + 1") + RESULT_VARIABLE result) if("${result}" GREATER 0) message(FATAL_ERROR "failed to upload file to ${UPLOAD_LOC}") endif() + + # Pause to give each upload a distinct (to the nearest second) + # time stamp + if(COMMAND ctest_sleep) + ctest_sleep(2) + endif() + + math(EXPR count "${count} + 1") endif() -endforeach(file) +endforeach() if(${count} EQUAL 0) message(FATAL_ERROR "Error no files uploaded.") endif() diff --git a/Utilities/Release/v20n250_aix_release.cmake b/Utilities/Release/v20n250_aix_release.cmake index 53c34d7ce..cc8cd058b 100644 --- a/Utilities/Release/v20n250_aix_release.cmake +++ b/Utilities/Release/v20n250_aix_release.cmake @@ -7,6 +7,7 @@ set(MAKE_PROGRAM "make") set(CC "xlc_r") set(CXX "xlC_r") set(FC "xlf") +set(LDFLAGS "-Wl,-bmaxdata:0x80000000") # Push "Segmentation fault in extend_brk" over horizon set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index caa44f1d6..ef000a16a 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -169,27 +169,42 @@ IF(NOT CURL_SPECIAL_LIBZ) CHECK_LIBRARY_EXISTS_CONCAT("z" inflateEnd HAVE_LIBZ) ENDIF(NOT CURL_SPECIAL_LIBZ) -OPTION(CMAKE_USE_OPENSSL "Use OpenSSL code." OFF) +OPTION(CMAKE_USE_OPENSSL "Use OpenSSL code with curl." OFF) MARK_AS_ADVANCED(CMAKE_USE_OPENSSL) IF(CMAKE_USE_OPENSSL) SET(USE_SSLEAY TRUE) SET(USE_OPENSSL TRUE) - IF(WIN32) - FIND_PATH(SSLINCLUDE openssl/crypto.h - PATHS c:/hoffman/Tools/openssl_w32vc6-0.9.8g/inc32) - INCLUDE_DIRECTORIES(${SSLINCLUDE}) - FIND_LIBRARY(LIBEAY NAMES libeay32) - FIND_LIBRARY(SSLEAY NAMES ssleay32) - SET(CURL_LIBS ${CURL_LIBS} ${LIBEAY} ${SSLEAY} ) - ELSE(WIN32) - CHECK_LIBRARY_EXISTS_CONCAT("crypto" CRYPTO_lock HAVE_LIBCRYPTO) - CHECK_LIBRARY_EXISTS_CONCAT("ssl" SSL_connect HAVE_LIBSSL) - ENDIF(WIN32) + FIND_PACKAGE(OpenSSL REQUIRED) + INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) + SET(CURL_LIBS ${CURL_LIBS} ${OPENSSL_LIBRARIES}) SET(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle") MARK_AS_ADVANCED(CURL_CA_BUNDLE) IF(CURL_CA_BUNDLE) ADD_DEFINITIONS(-DCURL_CA_BUNDLE="${CURL_CA_BUNDLE}") ENDIF(CURL_CA_BUNDLE) + # for windows we want to install OPENSSL_LIBRARIES dlls + # and also copy them into the build tree so that testing + # can find them. + IF(WIN32) + FIND_FILE(CMAKE_EAY_DLL NAME libeay32.dll HINTS ${OPENSSL_INCLUDE_DIR}/..) + FIND_FILE(CMAKE_SSL_DLL NAME ssleay32.dll HINTS ${OPENSSL_INCLUDE_DIR}/..) + MARK_AS_ADVANCED(CMAKE_EAY_DLL CMAKE_SSL_DLL) + IF(CMAKE_SSL_DLL AND CMAKE_EAY_DLL) + SET(CMAKE_CURL_SSL_DLLS ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll) + ADD_CUSTOM_COMMAND(OUTPUT + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll + DEPENDS ${CMAKE_EAY_DLL} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_EAY_DLL} + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll) + ADD_CUSTOM_COMMAND(OUTPUT + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll + DEPENDS ${CMAKE_SSL_DLL} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SSL_DLL} + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll) + INSTALL(PROGRAMS ${CMAKE_EAY_DLL} ${CMAKE_SSL_DLL} DESTINATION bin) + ENDIF() + ENDIF() ENDIF(CMAKE_USE_OPENSSL) # Check for idn @@ -698,8 +713,7 @@ ENDFOREACH() CONFIGURE_FILE(${LIBCURL_SOURCE_DIR}/config.h.in ${LIBCURL_BINARY_DIR}/config.h) - -ADD_LIBRARY(cmcurl ${LIBRARY_TYPE} ${libCurl_SRCS}) +ADD_LIBRARY(cmcurl ${LIBRARY_TYPE} ${libCurl_SRCS} ${CMAKE_CURL_SSL_DLLS}) TARGET_LINK_LIBRARIES(cmcurl ${CURL_LIBS}) IF(CMAKE_BUILD_CURL_SHARED) SET_TARGET_PROPERTIES(cmcurl PROPERTIES DEFINE_SYMBOL BUILDING_LIBCURL diff --git a/Utilities/cmcurl/config.h.in b/Utilities/cmcurl/config.h.in index 6e74935a3..e18af8ffe 100644 --- a/Utilities/cmcurl/config.h.in +++ b/Utilities/cmcurl/config.h.in @@ -255,9 +255,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LIBSSH2_H ${HAVE_LIBSSH2_H} -/* Define to 1 if you have the `ssl' library (-lssl). */ -#cmakedefine HAVE_LIBSSL ${HAVE_LIBSSL} - /* if zlib is available */ #cmakedefine HAVE_LIBZ ${HAVE_LIBZ} diff --git a/Utilities/cmcurl/curl/curl.h b/Utilities/cmcurl/curl/curl.h index 157c634a4..e586c4a8c 100644 --- a/Utilities/cmcurl/curl/curl.h +++ b/Utilities/cmcurl/curl/curl.h @@ -312,7 +312,7 @@ typedef enum { CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ CURLE_FAILED_INIT, /* 2 */ CURLE_URL_MALFORMAT, /* 3 */ - CURLE_URL_MALFORMAT_USER, /* 4 - NOT USED */ + CURLE_NOT_BUILT_IN, /* 4 */ CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ CURLE_COULDNT_RESOLVE_HOST, /* 6 */ CURLE_COULDNT_CONNECT, /* 7 */ diff --git a/Utilities/cmcurl/ssluse.c b/Utilities/cmcurl/ssluse.c index 55afb2446..14d05ac65 100644 --- a/Utilities/cmcurl/ssluse.c +++ b/Utilities/cmcurl/ssluse.c @@ -1285,8 +1285,13 @@ Curl_ossl_connect_step1(struct connectdata *conn, req_method = TLSv1_client_method(); break; case CURL_SSLVERSION_SSLv2: +#ifdef OPENSSL_NO_SSL2 + failf(data, "OpenSSL was built without SSLv2 support"); + return CURLE_NOT_BUILT_IN; +#else req_method = SSLv2_client_method(); break; +#endif case CURL_SSLVERSION_SSLv3: req_method = SSLv3_client_method(); break; diff --git a/Utilities/cmcurl/strerror.c b/Utilities/cmcurl/strerror.c index 6304fe89d..74c345779 100644 --- a/Utilities/cmcurl/strerror.c +++ b/Utilities/cmcurl/strerror.c @@ -69,6 +69,10 @@ curl_easy_strerror(CURLcode error) case CURLE_URL_MALFORMAT: return "URL using bad/illegal format or missing URL"; + case CURLE_NOT_BUILT_IN: + return "A requested feature, protocol or option was not found built-in in" + " this libcurl due to a build-time decision."; + case CURLE_COULDNT_RESOLVE_PROXY: return "couldn't resolve proxy name"; @@ -287,7 +291,6 @@ curl_easy_strerror(CURLcode error) return "Error in the SSH layer"; /* error codes not used by current libcurl */ - case CURLE_URL_MALFORMAT_USER: case CURLE_FTP_USER_PASSWORD_INCORRECT: case CURLE_MALFORMAT_USER: case CURLE_BAD_CALLING_ORDER: diff --git a/Utilities/cmlibarchive/libarchive/archive_endian.h b/Utilities/cmlibarchive/libarchive/archive_endian.h index bbf58fd10..3c039f702 100644 --- a/Utilities/cmlibarchive/libarchive/archive_endian.h +++ b/Utilities/cmlibarchive/libarchive/archive_endian.h @@ -64,7 +64,13 @@ archive_be16dec(const void *pp) { unsigned char const *p = (unsigned char const *)pp; - return ((p[0] << 8) | p[1]); + /* Store into unsigned temporaries before left shifting, to avoid + promotion to signed int and then left shifting into the sign bit, + which is undefined behaviour. */ + unsigned int p1 = p[1]; + unsigned int p0 = p[0]; + + return ((p0 << 8) | p1); } static inline uint32_t @@ -72,7 +78,15 @@ archive_be32dec(const void *pp) { unsigned char const *p = (unsigned char const *)pp; - return ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]); + /* Store into unsigned temporaries before left shifting, to avoid + promotion to signed int and then left shifting into the sign bit, + which is undefined behaviour. */ + unsigned int p3 = p[3]; + unsigned int p2 = p[2]; + unsigned int p1 = p[1]; + unsigned int p0 = p[0]; + + return ((p0 << 24) | (p1 << 16) | (p2 << 8) | p3); } static inline uint64_t @@ -88,7 +102,13 @@ archive_le16dec(const void *pp) { unsigned char const *p = (unsigned char const *)pp; - return ((p[1] << 8) | p[0]); + /* Store into unsigned temporaries before left shifting, to avoid + promotion to signed int and then left shifting into the sign bit, + which is undefined behaviour. */ + unsigned int p1 = p[1]; + unsigned int p0 = p[0]; + + return ((p1 << 8) | p0); } static inline uint32_t @@ -96,7 +116,15 @@ archive_le32dec(const void *pp) { unsigned char const *p = (unsigned char const *)pp; - return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]); + /* Store into unsigned temporaries before left shifting, to avoid + promotion to signed int and then left shifting into the sign bit, + which is undefined behaviour. */ + unsigned int p3 = p[3]; + unsigned int p2 = p[2]; + unsigned int p1 = p[1]; + unsigned int p0 = p[0]; + + return ((p3 << 24) | (p2 << 16) | (p1 << 8) | p0); } static inline uint64_t diff --git a/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c b/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c index 7d7eecadc..365a874a9 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c @@ -925,7 +925,7 @@ _archive_read_next_header2(struct archive *_a, struct archive_entry *entry) if (fd < 0) tree_enter_working_dir(t); - /* The current direcotry fd is needed at + /* The current directory fd is needed at * archive_read_disk_entry_from_file() function to read link data * with readlinkat(). */ a->entry_wd_fd = tree_current_dir_fd(t); diff --git a/Utilities/cmlibarchive/libarchive/archive_read_disk_windows.c b/Utilities/cmlibarchive/libarchive/archive_read_disk_windows.c index d8a1f5577..217a91a86 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_disk_windows.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_disk_windows.c @@ -955,7 +955,7 @@ _archive_read_disk_open_w(struct archive *_a, const wchar_t *pathname) a->tree = tree_open(pathname, a->symlink_mode, a->restore_time); if (a->tree == NULL) { archive_set_error(&a->archive, ENOMEM, - "Can't allocate direcotry traversal data"); + "Can't allocate directory traversal data"); a->archive.state = ARCHIVE_STATE_FATAL; return (ARCHIVE_FATAL); } diff --git a/Utilities/xml/.gitattributes b/Utilities/xml/.gitattributes new file mode 100644 index 000000000..562b12e16 --- /dev/null +++ b/Utilities/xml/.gitattributes @@ -0,0 +1 @@ +* -whitespace diff --git a/Utilities/xml/docbook-4.5/ChangeLog b/Utilities/xml/docbook-4.5/ChangeLog new file mode 100644 index 000000000..06f59ce5c --- /dev/null +++ b/Utilities/xml/docbook-4.5/ChangeLog @@ -0,0 +1,106 @@ +2006-10-03 13:23 nwalsh + + * trunk/docbook/sgml/catalog.xml, trunk/docbook/sgml/docbook.cat, + trunk/docbook/sgml/docbook.dcl, trunk/docbook/sgml/docbook.dtd, + calstblx.dtd, catalog.xml, dbcentx.mod, dbgenent.mod, + dbhierx.mod, dbnotnx.mod, dbpoolx.mod, docbook.cat, + docbookx.dtd, htmltblx.mod: DocBook V4.5 released + +2006-06-02 11:28 nwalsh + + * calstblx.dtd, catalog.xml, dbcentx.mod, dbgenent.mod, + dbhierx.mod, dbnotnx.mod, dbpoolx.mod, docbook.cat, + docbookx.dtd, freshmeat.xsl, htmltblx.mod: Changed copyright + dates and version numbers + +2006-05-30 20:58 nwalsh + + * htmltblx.mod: Supply tag omission markers in SGML; suppress + xml:lang in SGML + +2006-03-07 13:11 nwalsh + + * trunk/docbook/sgml/catalog.xml, trunk/docbook/sgml/docbook.cat, + trunk/docbook/sgml/docbook.dcl, trunk/docbook/sgml/docbook.dtd, + calstblx.dtd, catalog.xml, dbcentx.mod, dbgenent.mod, + dbhierx.mod, dbnotnx.mod, dbpoolx.mod, docbook.cat, + docbookx.dtd, freshmeat.xsl, htmltblx.mod: Change version + numbers to 4.5CR2 + +2006-03-07 13:03 nwalsh + + * dbpoolx.mod: Allow citebiblioid anywhere the other citation + elements are allowed + +2006-02-16 21:12 nwalsh + + * calstblx.dtd, catalog.xml, dbcentx.mod, dbgenent.mod, + dbhierx.mod, dbnotnx.mod, dbpoolx.mod, docbook.cat, + docbookx.dtd, freshmeat.xsl, htmltblx.mod: DocBook V4.5 released + +2005-06-29 10:59 nwalsh + + * trunk/docbook/sgml/docbook.dtd, docbookx.dtd: DocBook V4.5CR1 + Released + +2005-06-29 10:58 nwalsh + + * trunk/docbook/sgml/catalog.xml, trunk/docbook/sgml/docbook.cat, + trunk/docbook/sgml/docbook.dcl, calstblx.dtd, catalog.xml, + dbcentx.mod, dbgenent.mod, dbhierx.mod, dbnotnx.mod, + dbpoolx.mod, docbook.cat, htmltblx.mod: Updated version number + +2005-06-29 10:53 nwalsh + + * freshmeat.xsl: Tweaked freshmeat changes + +2005-06-24 21:09 nwalsh + + * calstblx.dtd, dbhierx.mod, dbpoolx.mod, htmltblx.mod, + soextblx.dtd: Added doc: structured comments + +2005-05-05 11:41 nwalsh + + * trunk/docbook/sgml/docbook.dtd, docbookx.dtd: DocBook V4.5b1 + Released + +2005-05-05 11:40 nwalsh + + * trunk/docbook/sgml/catalog.xml, trunk/docbook/sgml/docbook.cat, + trunk/docbook/sgml/docbook.dcl, calstblx.dtd, catalog.xml, + dbcentx.mod, dbgenent.mod, dbhierx.mod, dbnotnx.mod, + dbpoolx.mod, docbook.cat, htmltblx.mod: Updated version number + +2005-05-05 11:37 nwalsh + + * freshmeat.xsl: Prepare for 4.5b1 + +2005-05-05 10:59 nwalsh + + * dbpoolx.mod: RFE 1055480: Make revnumber optional + +2005-05-05 10:54 nwalsh + + * dbpoolx.mod, htmltblx.mod: Allow common attributes on HTML table + elements + +2005-05-05 10:48 nwalsh + + * dbpoolx.mod: Added termdef + +2005-05-05 10:39 nwalsh + + * dbpoolx.mod: Added mathphrase + +2005-05-05 10:33 nwalsh + + * dbhierx.mod: RFE 1070458: Allow colophon in article + +2005-05-05 10:32 nwalsh + + * dbpoolx.mod: RFE 1070770: Allow procedure in example + +2005-05-05 10:21 nwalsh + + * dbpoolx.mod: Add isrn to list of biblioid class attribute values + diff --git a/Utilities/xml/docbook-4.5/README b/Utilities/xml/docbook-4.5/README new file mode 100644 index 000000000..6fc60c4bf --- /dev/null +++ b/Utilities/xml/docbook-4.5/README @@ -0,0 +1,8 @@ +README for the DocBook XML DTD + +For more information about DocBook, please see + + http://www.oasis-open.org/docbook/ + +Please send all questions, comments, concerns, and bug reports to the +DocBook mailing list: docbook@lists.oasis-open.org diff --git a/Utilities/xml/docbook-4.5/calstblx.dtd b/Utilities/xml/docbook-4.5/calstblx.dtd new file mode 100644 index 000000000..fac58d77e --- /dev/null +++ b/Utilities/xml/docbook-4.5/calstblx.dtd @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/catalog.xml b/Utilities/xml/docbook-4.5/catalog.xml new file mode 100644 index 000000000..f75c1d764 --- /dev/null +++ b/Utilities/xml/docbook-4.5/catalog.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/dbcentx.mod b/Utilities/xml/docbook-4.5/dbcentx.mod new file mode 100644 index 000000000..60de99f86 --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbcentx.mod @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/dbgenent.mod b/Utilities/xml/docbook-4.5/dbgenent.mod new file mode 100644 index 000000000..ff5ba90d1 --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbgenent.mod @@ -0,0 +1,41 @@ + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/dbhierx.mod b/Utilities/xml/docbook-4.5/dbhierx.mod new file mode 100644 index 000000000..5f839f567 --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbhierx.mod @@ -0,0 +1,2193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbhier; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbhier2; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + +]]> + + + + +]]> + + + + + +]]> + + + + +]]> + + + + + +]]> + +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + diff --git a/Utilities/xml/docbook-4.5/dbnotnx.mod b/Utilities/xml/docbook-4.5/dbnotnx.mod new file mode 100644 index 000000000..2416049bf --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbnotnx.mod @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/dbpoolx.mod b/Utilities/xml/docbook-4.5/dbpoolx.mod new file mode 100644 index 000000000..53b07044a --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbpoolx.mod @@ -0,0 +1,8701 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbpool; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + +%htmltbl; +]]> + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + +]]> + +%tablemodel; + +]]> + + + + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> + + + + +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + + +]]> + + + +]]> + ]]> + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + ]]> + + + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + + +]]> + + + + + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + + +]]> + + + + + +]]> + + + + +]]> + + + + + +]]> + + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> +]]> +]]> + + + diff --git a/Utilities/xml/docbook-4.5/docbook.cat b/Utilities/xml/docbook-4.5/docbook.cat new file mode 100644 index 000000000..25ac4dff0 --- /dev/null +++ b/Utilities/xml/docbook-4.5/docbook.cat @@ -0,0 +1,113 @@ + -- ...................................................................... -- + -- Catalog data for DocBook XML V4.5 .................................... -- + -- File docbook.cat ..................................................... -- + + -- Please direct all questions, bug reports, or suggestions for + changes to the docbook@lists.oasis-open.org mailing list. For more + information, see http://www.oasis-open.org/. + -- + + -- This is the catalog data file for DocBook XML V4.5. It is provided as + a convenience in building your own catalog files. You need not use + the filenames listed here, and need not use the filename method of + identifying storage objects at all. See the documentation for + detailed information on the files associated with the DocBook DTD. + See SGML Open Technical Resolution 9401 for detailed information + on supplying and using catalog data. + -- + + -- ...................................................................... -- + -- DocBook driver file .................................................. -- + +PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "docbookx.dtd" + + -- ...................................................................... -- + -- DocBook modules ...................................................... -- + +PUBLIC "-//OASIS//DTD DocBook CALS Table Model V4.5//EN" + "calstblx.dtd" + +PUBLIC "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.5//EN" + "htmltblx.mod" + +PUBLIC "-//OASIS//DTD XML Exchange Table Model 19990315//EN" + "soextblx.dtd" + +PUBLIC "-//OASIS//ELEMENTS DocBook Information Pool V4.5//EN" + "dbpoolx.mod" + +PUBLIC "-//OASIS//ELEMENTS DocBook Document Hierarchy V4.5//EN" + "dbhierx.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Additional General Entities V4.5//EN" + "dbgenent.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Notations V4.5//EN" + "dbnotnx.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Character Entities V4.5//EN" + "dbcentx.mod" + + -- ...................................................................... -- + -- ISO entity sets ...................................................... -- + +PUBLIC "ISO 8879:1986//ENTITIES Diacritical Marks//EN//XML" + "ent/isodia.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN//XML" + "ent/isonum.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Publishing//EN//XML" + "ent/isopub.ent" + +PUBLIC "ISO 8879:1986//ENTITIES General Technical//EN//XML" + "ent/isotech.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN//XML" + "ent/isolat1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Latin 2//EN//XML" + "ent/isolat2.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Greek Letters//EN//XML" + "ent/isogrk1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Monotoniko Greek//EN//XML" + "ent/isogrk2.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Greek Symbols//EN//XML" + "ent/isogrk3.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN//XML" + "ent/isogrk4.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN//XML" + "ent/isoamsa.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN//XML" + "ent/isoamsb.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN//XML" + "ent/isoamsc.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN//XML" + "ent/isoamsn.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN//XML" + "ent/isoamso.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN//XML" + "ent/isoamsr.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Box and Line Drawing//EN//XML" + "ent/isobox.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Russian Cyrillic//EN//XML" + "ent/isocyr1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN//XML" + "ent/isocyr2.ent" + + -- End of catalog data for DocBook XML V4.5 ............................. -- + -- ...................................................................... -- diff --git a/Utilities/xml/docbook-4.5/docbookx.dtd b/Utilities/xml/docbook-4.5/docbookx.dtd new file mode 100644 index 000000000..8b43c59b6 --- /dev/null +++ b/Utilities/xml/docbook-4.5/docbookx.dtd @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + +]]> + + + +]]> + + + + + + +%dbnotn; +]]> + + + + + + + +]]> + +]]> +]]> + + +%dbcent; +]]> + + + + + + + + +%dbpool; +]]> + + + + + + +%rdbmods; +]]> + + + + + +%dbhier; +]]> + + + + + + +%dbgenent; +]]> + + + diff --git a/Utilities/xml/docbook-4.5/ent/README b/Utilities/xml/docbook-4.5/ent/README new file mode 100644 index 000000000..c0da542a6 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/README @@ -0,0 +1,14 @@ +XML Entity Declarations for Characters + +The character entity sets distributed with DocBook XML are direct +copies of the official entities located at + + http://www.w3.org/2003/entities/ + +They are distributed for historical compatibility and user convenience. +The DocBook Technical Committee no longer attempts to maintain these +definitions and will periodically update them from the W3C site if and +as they are updated there. + +Please direct all questions or comments about the entities to the +individuals or working groups who maintain the official sets. diff --git a/Utilities/xml/docbook-4.5/ent/isoamsa.ent b/Utilities/xml/docbook-4.5/ent/isoamsa.ent new file mode 100644 index 000000000..dac3e6242 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsa.ent @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamsb.ent b/Utilities/xml/docbook-4.5/ent/isoamsb.ent new file mode 100644 index 000000000..4065b66c4 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsb.ent @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamsc.ent b/Utilities/xml/docbook-4.5/ent/isoamsc.ent new file mode 100644 index 000000000..2fad41752 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsc.ent @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamsn.ent b/Utilities/xml/docbook-4.5/ent/isoamsn.ent new file mode 100644 index 000000000..ddca8d14c --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsn.ent @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamso.ent b/Utilities/xml/docbook-4.5/ent/isoamso.ent new file mode 100644 index 000000000..278e4b409 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamso.ent @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamsr.ent b/Utilities/xml/docbook-4.5/ent/isoamsr.ent new file mode 100644 index 000000000..18e64bffd --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsr.ent @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isobox.ent b/Utilities/xml/docbook-4.5/ent/isobox.ent new file mode 100644 index 000000000..9ae27d4fa --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isobox.ent @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isocyr1.ent b/Utilities/xml/docbook-4.5/ent/isocyr1.ent new file mode 100644 index 000000000..364b6d841 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isocyr1.ent @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isocyr2.ent b/Utilities/xml/docbook-4.5/ent/isocyr2.ent new file mode 100644 index 000000000..6432d74c4 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isocyr2.ent @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isodia.ent b/Utilities/xml/docbook-4.5/ent/isodia.ent new file mode 100644 index 000000000..b49c30947 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isodia.ent @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isogrk1.ent b/Utilities/xml/docbook-4.5/ent/isogrk1.ent new file mode 100644 index 000000000..7826f8109 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isogrk1.ent @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isogrk2.ent b/Utilities/xml/docbook-4.5/ent/isogrk2.ent new file mode 100644 index 000000000..726b7dd70 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isogrk2.ent @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isogrk3.ent b/Utilities/xml/docbook-4.5/ent/isogrk3.ent new file mode 100644 index 000000000..28b5c2766 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isogrk3.ent @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isogrk4.ent b/Utilities/xml/docbook-4.5/ent/isogrk4.ent new file mode 100644 index 000000000..27c6a514f --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isogrk4.ent @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isolat1.ent b/Utilities/xml/docbook-4.5/ent/isolat1.ent new file mode 100644 index 000000000..381bd0900 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isolat1.ent @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isolat2.ent b/Utilities/xml/docbook-4.5/ent/isolat2.ent new file mode 100644 index 000000000..e91ffdbee --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isolat2.ent @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isonum.ent b/Utilities/xml/docbook-4.5/ent/isonum.ent new file mode 100644 index 000000000..884c0c4d0 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isonum.ent @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isopub.ent b/Utilities/xml/docbook-4.5/ent/isopub.ent new file mode 100644 index 000000000..a11787828 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isopub.ent @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isotech.ent b/Utilities/xml/docbook-4.5/ent/isotech.ent new file mode 100644 index 000000000..07e81008d --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isotech.ent @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/htmltblx.mod b/Utilities/xml/docbook-4.5/htmltblx.mod new file mode 100644 index 000000000..cdaefed41 --- /dev/null +++ b/Utilities/xml/docbook-4.5/htmltblx.mod @@ -0,0 +1,245 @@ + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/soextblx.dtd b/Utilities/xml/docbook-4.5/soextblx.dtd new file mode 100644 index 000000000..4a92e1162 --- /dev/null +++ b/Utilities/xml/docbook-4.5/soextblx.dtd @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/xhtml-lat1.ent b/Utilities/xml/xhtml1/xhtml-lat1.ent similarity index 100% rename from Utilities/xml/xhtml-lat1.ent rename to Utilities/xml/xhtml1/xhtml-lat1.ent diff --git a/Utilities/xml/xhtml-special.ent b/Utilities/xml/xhtml1/xhtml-special.ent similarity index 100% rename from Utilities/xml/xhtml-special.ent rename to Utilities/xml/xhtml1/xhtml-special.ent diff --git a/Utilities/xml/xhtml-symbol.ent b/Utilities/xml/xhtml1/xhtml-symbol.ent similarity index 100% rename from Utilities/xml/xhtml-symbol.ent rename to Utilities/xml/xhtml1/xhtml-symbol.ent diff --git a/Utilities/xml/xhtml1-strict.dtd b/Utilities/xml/xhtml1/xhtml1-strict.dtd similarity index 100% rename from Utilities/xml/xhtml1-strict.dtd rename to Utilities/xml/xhtml1/xhtml1-strict.dtd diff --git a/bootstrap b/bootstrap index 801882d7a..5c2addb50 100755 --- a/bootstrap +++ b/bootstrap @@ -19,7 +19,7 @@ die() { cmake_version_component() { cat "${cmake_source_dir}/Source/CMakeVersion.cmake" | sed -n " -/^SET(CMake_VERSION_${1}/ {s/SET(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;} +/^set(CMake_VERSION_${1}/ {s/set(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;} " } @@ -93,6 +93,19 @@ else cmake_system_openvms=false fi +# Determine whether this is Linux +if echo "${cmake_system}" | grep Linux >/dev/null 2>&1; then + cmake_system_linux=true + # find out if it is a HP PA-RISC machine + if uname -m | grep parisc >/dev/null 2>&1; then + cmake_machine_parisc=true + else + cmake_machine_parisc=false + fi +else + cmake_system_linux=false +fi + # Choose the generator to use for bootstrapping. if ${cmake_system_mingw}; then # Bootstrapping from an MSYS prompt. @@ -146,7 +159,9 @@ if ${cmake_system_mingw}; then cmake_default_prefix="c:/Program Files/CMake" fi elif ${cmake_system_haiku}; then - cmake_default_prefix=`/bin/finddir B_COMMON_DIRECTORY` + cmake_default_prefix=`finddir B_COMMON_DIRECTORY` + cmake_man_dir="/documentation/man" + cmake_doc_dir="/documentation/doc/cmake-${cmake_version}" else cmake_default_prefix="/usr/local" fi @@ -160,6 +175,9 @@ CMAKE_PROBLEMATIC_FILES="\ CMakeSystem.cmake \ CMakeCCompiler.cmake \ CMakeCXXCompiler.cmake \ + */CMakeSystem.cmake \ + */CMakeCCompiler.cmake \ + */CMakeCXXCompiler.cmake \ Source/cmConfigure.h \ Source/CTest/Curl/config.h \ Utilities/cmexpat/expatConfig.h \ @@ -196,9 +214,16 @@ CMAKE_CXX_SOURCES="\ cmMakefile \ cmExportFileGenerator \ cmExportInstallFileGenerator \ + cmExportTryCompileFileGenerator \ + cmExportSet \ + cmExportSetMap \ cmInstallDirectoryGenerator \ cmGeneratedFileStream \ cmGeneratorTarget \ + cmGeneratorExpressionDAGChecker \ + cmGeneratorExpressionEvaluator \ + cmGeneratorExpressionLexer \ + cmGeneratorExpressionParser \ cmGeneratorExpression \ cmGlobalGenerator \ cmLocalGenerator \ @@ -262,18 +287,11 @@ if ${cmake_system_mingw}; then ProcessWin32 \ String \ System" - KWSYS_C_MINGW_SOURCES="\ - ProcessFwd9x \ - EncodeExecutable" - KWSYS_C_GENERATED_SOURCES="\ - cmsysProcessFwd9xEnc" else KWSYS_C_SOURCES="\ ProcessUNIX \ String \ System" - KWSYS_C_MINGW_SOURCES="" - KWSYS_C_GENERATED_SOURCES="" fi KWSYS_CXX_SOURCES="\ @@ -348,7 +366,7 @@ Directory and file names: # Display CMake bootstrap usage cmake_version_display() { - echo "CMake ${cmake_version}, Copyright 2000-2011 Kitware, Inc." + echo "CMake ${cmake_version}, Copyright 2000-2012 Kitware, Inc." } # Display CMake bootstrap error, display the log file and exit @@ -669,6 +687,14 @@ if ${cmake_system_haiku}; then cmake_ld_flags="${LDFLAGS} -lroot -lbe" fi +if ${cmake_system_linux}; then + # avoid binutils problem with large binaries, e.g. when building CMake in debug mode + # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230 + if ${cmake_machine_parisc}; then + cmake_ld_flags="${LDFLAGS} -Wl,--unique=.text.*" + fi +fi + #----------------------------------------------------------------------------- # Detect known toolchains on some platforms. cmake_toolchains='' @@ -1321,7 +1347,7 @@ cmake_compiler_settings_comment="/* * Sources: * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} * kwSys Sources: - * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES} + * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} */ " @@ -1417,7 +1443,7 @@ done # Generate Makefile dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h" objs="" -for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_GENERATED_SOURCES}; do +for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do objs="${objs} ${a}.o" done @@ -1458,7 +1484,7 @@ for a in ${CMAKE_C_SOURCES}; do echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile" echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile" done -for a in ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}; do +for a in ${KWSYS_C_SOURCES}; do src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"` src_flags=`eval echo \\${cmake_c_flags_\${a}}` echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile" @@ -1470,20 +1496,6 @@ for a in ${KWSYS_CXX_SOURCES}; do echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile" echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile" done -if ${cmake_system_mingw}; then - src=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9xEnc.c"` - in=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9x.exe"` - cmd=`cmake_escape "${cmake_bootstrap_dir}/cmsysEncodeExecutable.exe"` - a="cmsysProcessFwd9xEnc" - echo "${cmd} : EncodeExecutable.o" >> "${cmake_bootstrap_dir}/Makefile" - echo " ${cmake_c_compiler} ${cmake_ld_flags} ${cmake_c_flags} EncodeExecutable.o -o ${cmd}" >> "${cmake_bootstrap_dir}/Makefile" - echo "${in} : ProcessFwd9x.o" >> "${cmake_bootstrap_dir}/Makefile" - echo " ${cmake_c_compiler} ${cmake_ld_flags} ${cmake_c_flags} ProcessFwd9x.o -o ${in}" >> "${cmake_bootstrap_dir}/Makefile" - echo "${src} : ${cmd} ${in}" >> "${cmake_bootstrap_dir}/Makefile" - echo " ${cmd} ${in} ${src} cmsys ProcessFwd9x" >> "${cmake_bootstrap_dir}/Makefile" - echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile" - echo " ${cmake_c_compiler} ${cmake_c_flags} -I`cmake_escape \"${cmake_source_dir}/Source/kwsys\"` -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile" -fi echo ' rebuild_cache: cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap" @@ -1493,21 +1505,29 @@ rebuild_cache: echo ' # Generated by '"${cmake_source_dir}"'/bootstrap # Default cmake settings. These may be overridden any settings below. -SET (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE) -SET (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE) -SET (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE) -SET (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE) +set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE) +set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE) +set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE) +set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE) ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" +# Suppress -isysroot if user-provided flags already have it. +if echo "${cmake_c_flags}" | grep isysroot >/dev/null 2>&1 && + echo "${cmake_cxx_flags}" | grep isysroot >/dev/null 2>&1; then + echo ' +set(CMAKE_OSX_SYSROOT "" CACHE PATH "" FORCE) +' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" +fi + # Add configuration settings given as command-line options. if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then echo ' -SET (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE) +set (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi if [ "x${cmake_bootstrap_qt_qmake}" != "x" ]; then echo ' -SET (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE) +set (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in index 03137d5af..7cd7fc1c9 100644 --- a/cmake_uninstall.cmake.in +++ b/cmake_uninstall.cmake.in @@ -1,22 +1,22 @@ -IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") -ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +endif() -FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) -STRING(REGEX REPLACE "\n" ";" files "${files}") -FOREACH(file ${files}) - MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") - IF(EXISTS "$ENV{DESTDIR}${file}") - EXEC_PROGRAM( +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + if(EXISTS "$ENV{DESTDIR}${file}") + exec_program( "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval ) - IF("${rm_retval}" STREQUAL 0) - ELSE("${rm_retval}" STREQUAL 0) - MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") - ENDIF("${rm_retval}" STREQUAL 0) - ELSE(EXISTS "$ENV{DESTDIR}${file}") - MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") - ENDIF(EXISTS "$ENV{DESTDIR}${file}") -ENDFOREACH(file) + if("${rm_retval}" STREQUAL 0) + else() + message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + endif() + else() + message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + endif() +endforeach() diff --git a/doxygen.config b/doxygen.config index c22f2650d..82add731e 100644 --- a/doxygen.config +++ b/doxygen.config @@ -11,219 +11,219 @@ # General configuration options #--------------------------------------------------------------------------- -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. PROJECT_NAME = CMAKE -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = 0.0.1 -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = ./Doxygen -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese, +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese, # Spanish and Russian OUTPUT_LANGUAGE = English -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. DISABLE_INDEX = NO -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. EXTRACT_PRIVATE = NO -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. EXTRACT_STATIC = YES -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO -# If the HIDE_UNDOC_CLASSESS tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these class will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. +# If the HIDE_UNDOC_CLASSESS tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these class will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. BRIEF_MEMBER_DESC = YES -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. REPEAT_BRIEF = YES -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. ALWAYS_DETAILED_SEC = NO -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. -STRIP_FROM_PATH = +STRIP_FROM_PATH = -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. INTERNAL_DOCS = NO -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a class diagram (in Html and LaTeX) for classes with base or -# super classes. Setting the tag to NO turns the diagrams off. +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a class diagram (in Html and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. CLASS_DIAGRAMS = YES -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. SOURCE_BROWSER = YES -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. INLINE_SOURCES = NO -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES -# If the CASE_SENSE_NAMES tag is set to NO (the default) then Doxygen -# will only generate file names in lower case letters. If set to -# YES upper case letters are also allowed. This is useful if you have -# classes or files whose names only differ in case and if your file system -# supports case sensitive file names. +# If the CASE_SENSE_NAMES tag is set to NO (the default) then Doxygen +# will only generate file names in lower case letters. If set to +# YES upper case letters are also allowed. This is useful if you have +# classes or files whose names only differ in case and if your file system +# supports case sensitive file names. CASE_SENSE_NAMES = YES -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put list of the files that are included by a file in the documentation -# of that file. +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put list of the files that are included by a file in the documentation +# of that file. SHOW_INCLUDE_FILES = YES -# If the JAVADOC_AUTOBRIEF tag is set to YES (the default) then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the Javadoc-style will -# behave just like the Qt-style comments. +# If the JAVADOC_AUTOBRIEF tag is set to YES (the default) then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the Javadoc-style will +# behave just like the Qt-style comments. JAVADOC_AUTOBRIEF = NO -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# reimplements. +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# reimplements. INHERIT_DOCS = YES -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. INLINE_INFO = YES -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. SORT_MEMBER_DOCS = YES -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 -# The ENABLE_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. +# The ENABLE_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. -ENABLED_SECTIONS = +ENABLED_SECTIONS = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. WARNINGS = YES -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. WARN_IF_UNDOCUMENTED = YES -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. WARN_FORMAT = "$file:$line: $text" @@ -231,133 +231,133 @@ WARN_FORMAT = "$file:$line: $text" # configuration options related to the input files #--------------------------------------------------------------------------- -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. INPUT = "Source" -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. FILE_PATTERNS = *.h *.txx *.cxx -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. RECURSIVE = YES -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. +EXCLUDE = -EXCLUDE_PATTERNS = +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). +EXCLUDE_PATTERNS = -EXAMPLE_PATH = +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. +EXAMPLE_PATH = -EXAMPLE_PATTERNS = +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). +EXAMPLE_PATTERNS = -IMAGE_PATH = +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. +IMAGE_PATH = -INPUT_FILTER = +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. + +INPUT_FILTER = #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 3 -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. -IGNORE_PREFIX = +IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. GENERATE_HTML = YES -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a # standard header. -HTML_HEADER = +HTML_HEADER = -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a # standard footer. -HTML_FOOTER = +HTML_FOOTER = -# The HTML_STYLESHEET tag can be used to specify a user defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet +# The HTML_STYLESHEET tag can be used to specify a user defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet -HTML_STYLESHEET = +HTML_STYLESHEET = -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. GENERATE_HTMLHELP = NO @@ -365,52 +365,52 @@ GENERATE_HTMLHELP = NO # configuration options related to the LaTeX output #--------------------------------------------------------------------------- -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. GENERATE_LATEX = YES -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. COMPACT_LATEX = NO -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. PAPER_TYPE = a4wide -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. -EXTRA_PACKAGES = +EXTRA_PACKAGES = -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! -LATEX_HEADER = +LATEX_HEADER = -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO @@ -418,31 +418,31 @@ LATEX_BATCHMODE = NO # configuration options related to the RTF output #--------------------------------------------------------------------------- -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# For now this is experimental and is disabled by default. The RTF output -# is optimised for Word 97 and may not look too pretty with other readers +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# For now this is experimental and is disabled by default. The RTF output +# is optimised for Word 97 and may not look too pretty with other readers # or editors. GENERATE_RTF = YES -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. COMPACT_RTF = NO -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using a WORD or other. -# programs which support those fields. -# Note: wordpad (write) and others do not support links. +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using a WORD or other. +# programs which support those fields. +# Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO @@ -450,54 +450,54 @@ RTF_HYPERLINKS = NO # configuration options related to the man page output #--------------------------------------------------------------------------- -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages GENERATE_MAN = YES -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 #--------------------------------------------------------------------------- -# Configuration options related to the preprocessor +# Configuration options related to the preprocessor #--------------------------------------------------------------------------- -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. ENABLE_PREPROCESSING = YES -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. MACRO_EXPANSION = YES -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = NO -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. -INCLUDE_PATH = +INCLUDE_PATH = -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. PREDEFINED = "itkNotUsed(x)="\ "itkSetMacro(name,type)= \ @@ -558,140 +558,140 @@ PREDEFINED = "itkNotUsed(x)="\ "ITK_NUMERIC_LIMITS= \ std::numeric_limits" -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED tag. +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED tag. EXPAND_ONLY_PREDEF = YES #--------------------------------------------------------------------------- -# Configuration::addtions related to external references +# Configuration::addtions related to external references #--------------------------------------------------------------------------- -# The TAGFILES tag can be used to specify one or more tagfiles. +# The TAGFILES tag can be used to specify one or more tagfiles. -TAGFILES = +TAGFILES = -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. -GENERATE_TAGFILE = +GENERATE_TAGFILE = -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. ALLEXTERNALS = NO -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to the dot tool #--------------------------------------------------------------------------- -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) HAVE_DOT = YES -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES -# If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to -# YES then doxygen will generate a graph for each documented file showing -# the direct and indirect include dependencies of the file with other -# documented files. +# If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to +# YES then doxygen will generate a graph for each documented file showing +# the direct and indirect include dependencies of the file with other +# documented files. INCLUDE_GRAPH = YES -# If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to -# YES then doxygen will generate a graph for each documented header file showing -# the documented files that directly or indirectly include this file +# If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to +# YES then doxygen will generate a graph for each documented header file showing +# the documented files that directly or indirectly include this file INCLUDED_BY_GRAPH = YES -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found on the path. +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. DOT_PATH = -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. MAX_DOT_GRAPH_WIDTH = 1024 -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. MAX_DOT_GRAPH_HEIGHT = 1024 #--------------------------------------------------------------------------- -# Configuration::addtions related to the search engine +# Configuration::addtions related to the search engine #--------------------------------------------------------------------------- -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO -# The CGI_NAME tag should be the name of the CGI script that -# starts the search engine (doxysearch) with the correct parameters. -# A script with this name will be generated by doxygen. +# The CGI_NAME tag should be the name of the CGI script that +# starts the search engine (doxysearch) with the correct parameters. +# A script with this name will be generated by doxygen. CGI_NAME = search.cgi -# The CGI_URL tag should be the absolute URL to the directory where the -# cgi binaries are located. See the documentation of your http daemon for -# details. +# The CGI_URL tag should be the absolute URL to the directory where the +# cgi binaries are located. See the documentation of your http daemon for +# details. -CGI_URL = +CGI_URL = -# The DOC_URL tag should be the absolute URL to the directory where the -# documentation is located. If left blank the absolute path to the -# documentation, with file:// prepended to it, will be used. +# The DOC_URL tag should be the absolute URL to the directory where the +# documentation is located. If left blank the absolute path to the +# documentation, with file:// prepended to it, will be used. -DOC_URL = +DOC_URL = -# The DOC_ABSPATH tag should be the absolute path to the directory where the -# documentation is located. If left blank the directory on the local machine -# will be used. +# The DOC_ABSPATH tag should be the absolute path to the directory where the +# documentation is located. If left blank the directory on the local machine +# will be used. -DOC_ABSPATH = +DOC_ABSPATH = -# The BIN_ABSPATH tag must point to the directory where the doxysearch binary -# is installed. +# The BIN_ABSPATH tag must point to the directory where the doxysearch binary +# is installed. BIN_ABSPATH = /usr/local/bin/ -# The EXT_DOC_PATHS tag can be used to specify one or more paths to -# documentation generated for other projects. This allows doxysearch to search -# the documentation for these projects as well. +# The EXT_DOC_PATHS tag can be used to specify one or more paths to +# documentation generated for other projects. This allows doxysearch to search +# the documentation for these projects as well. -EXT_DOC_PATHS = +EXT_DOC_PATHS =