diff options
195 files changed, 3659 insertions, 1696 deletions
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 480fc62..a27d000 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -99,13 +99,14 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") 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") + "${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") + "${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 diff --git a/CMakeLists.txt b/CMakeLists.txt index f0789a3..ea1c033 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,8 +135,7 @@ macro(CMAKE_SETUP_TESTING) 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() endif() set(CMAKE_TEST_SYSTEM_LIBRARIES 0) @@ -561,8 +560,7 @@ if (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(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() endif () diff --git a/Docs/bash-completion/cpack b/Docs/bash-completion/cpack index 84dcfd5..a0c1f83 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/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index b4eabe5..17d63eb 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -9,6 +9,8 @@ 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) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 06aa9bf..c5bde9a 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -67,6 +67,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 +95,25 @@ # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) # endif -#elif defined(__PATHSCALE__) +#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(_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/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index b6477df..7f66be5 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -9,6 +9,8 @@ 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) diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 95fc852..2c8dd4b 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" @@ -69,6 +72,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 +100,25 @@ # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) # endif -#elif defined(__PATHSCALE__) +#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(_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/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index 4cf29dd..9f0b30a 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -163,7 +163,7 @@ 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) + ${CMAKE_PLATFORM_INFO_DIR}/CMakeASM${ASM_DIALECT}Compiler.cmake IMMEDIATE @ONLY) set(_CMAKE_ASM_COMPILER) set(_CMAKE_ASM_COMPILER_ARG1) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 171eadd..275fc47 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -39,76 +39,66 @@ if(NOT CMAKE_C_COMPILER_NAMES) set(CMAKE_C_COMPILER_NAMES cc) endif() -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") +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() - if(NOT EXISTS ${CMAKE_C_COMPILER_INIT}) - message(FATAL_ERROR "Could not find compiler set in environment variable CC:\n$ENV{CC}.") + + # 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() - endif() - # next try prefer the compiler specified by the generator - if(CMAKE_GENERATOR_CC) + # finally list compilers to try if(NOT CMAKE_C_COMPILER_INIT) - set(CMAKE_C_COMPILER_INIT ${CMAKE_GENERATOR_CC}) + set(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}cc ${_CMAKE_TOOLCHAIN_PREFIX}gcc cl bcc xlc clang) 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) + _cmake_find_compiler(C) -else() + 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 + # 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() + 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) + # 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() -endif() -mark_as_advanced(CMAKE_C_COMPILER) - -if (NOT _CMAKE_TOOLCHAIN_LOCATION) - get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH) -endif () - -# 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() - -if(NOT CMAKE_C_COMPILER_ID_RUN) - set(CMAKE_C_COMPILER_ID_RUN 1) + 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 @@ -120,6 +110,11 @@ if(NOT CMAKE_C_COMPILER_ID_RUN) # 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) @@ -139,6 +134,10 @@ if(NOT CMAKE_C_COMPILER_ID_RUN) 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 # with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2). @@ -160,9 +159,7 @@ if (CMAKE_CROSSCOMPILING set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) endif () -endif (CMAKE_CROSSCOMPILING - AND "${CMAKE_C_COMPILER_ID}" MATCHES "GNU" - AND NOT _CMAKE_TOOLCHAIN_PREFIX) +endif () include(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake) include(CMakeFindBinUtils) @@ -172,7 +169,7 @@ if(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" + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) set(CMAKE_C_COMPILER_ENV_VAR "CC") diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 898947a..59da3e6 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -38,87 +38,66 @@ if(NOT CMAKE_CXX_COMPILER_NAMES) set(CMAKE_CXX_COMPILER_NAMES CC) endif() -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") +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() - 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}") + + # 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() - endif() - # next prefer the generator specified compiler - if(CMAKE_GENERATOR_CXX) + # finally list compilers to try if(NOT CMAKE_CXX_COMPILER_INIT) - set(CMAKE_CXX_COMPILER_INIT ${CMAKE_GENERATOR_CXX}) + set(CMAKE_CXX_COMPILER_LIST CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC clang++) 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() - _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 -# 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() + 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) + # 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() -endif() -mark_as_advanced(CMAKE_CXX_COMPILER) - -if (NOT _CMAKE_TOOLCHAIN_LOCATION) - get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH) -endif () - -# 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() - -# 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() -if(NOT CMAKE_CXX_COMPILER_ID_RUN) - set(CMAKE_CXX_COMPILER_ID_RUN 1) + 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 @@ -127,6 +106,11 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN) # 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) @@ -146,6 +130,10 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN) 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 # with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2). @@ -167,9 +155,7 @@ if (CMAKE_CROSSCOMPILING set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) endif () -endif (CMAKE_CROSSCOMPILING - AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" - AND NOT _CMAKE_TOOLCHAIN_PREFIX) +endif () include(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake) include(CMakeFindBinUtils) @@ -179,7 +165,7 @@ if(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 + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index ae2eb9b..75247d9 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -19,16 +19,16 @@ include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake) function(CMAKE_DETERMINE_COMPILER_ABI lang src) - if(NOT DEFINED CMAKE_DETERMINE_${lang}_ABI_COMPILED) + 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(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_DETERMINE_${lang}_ABI_COMPILED + try_compile(CMAKE_${lang}_ABI_COMPILED ${CMAKE_BINARY_DIR} ${src} CMAKE_FLAGS "${CMAKE_FLAGS}" "-DCMAKE_${lang}_STANDARD_LIBRARIES=" @@ -39,9 +39,13 @@ 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) + 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") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index f574978..3df17c7 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -30,7 +30,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) 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. @@ -66,6 +66,15 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) 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}" @@ -98,28 +107,126 @@ Id flags: ${testflags} ") # Compile the compiler identification source. - if(COMMAND EXECUTE_PROCESS) + if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)( .NET)?( 200[358])? *((Win64|IA64|ARM))?") + set(vs_version ${CMAKE_MATCH_1}) + set(vs_arch ${CMAKE_MATCH_4}) + set(id_lang "${lang}") + set(id_cl cl.exe) + 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("${vs_arch}" STREQUAL "Win64") + set(id_machine_7 17) + set(id_machine_10 MachineX64) + set(id_arch x64) + elseif("${vs_arch}" STREQUAL "IA64") + set(id_machine_7 5) + set(id_machine_10 MachineIA64) + set(id_arch ia64) + else() + set(id_machine_6 x86) + set(id_machine_7 1) + set(id_machine_10 MachineX86) + set(id_arch Win32) + endif() + if(CMAKE_VS_PLATFORM_TOOLSET) + set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>") + else() + set(id_toolset "") + endif() + if("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Bb][Uu][Ii][Ll][Dd]") + set(build /p:Configuration=Debug /p:Platform=@id_arch@) + 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_${lang}_COMPILER} - ${CMAKE_${lang}_COMPILER_ID_ARG1} - ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} - ${testflags} - "${src}" + 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() - 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(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) + 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 ) + + # 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. @@ -153,14 +260,18 @@ ${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") + 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) @@ -282,7 +393,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) # 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}) + 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() diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index da77e21..051f832 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -25,105 +25,102 @@ if(NOT CMAKE_Fortran_COMPILER_NAMES) set(CMAKE_Fortran_COMPILER_NAMES f95) endif() -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") +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() - if(EXISTS ${CMAKE_Fortran_COMPILER_INIT}) - else() - message(FATAL_ERROR "Could not find compiler set in environment variable FC:\n$ENV{FC}.") + + # 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() - endif() - # next try prefer the compiler specified by the generator - if(CMAKE_GENERATOR_FC) + # finally list compilers to try if(NOT CMAKE_Fortran_COMPILER_INIT) - set(CMAKE_Fortran_COMPILER_INIT ${CMAKE_GENERATOR_FC}) + # 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() - 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) - _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 -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() + 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) + # 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() -endif() - -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() - -if(NOT CMAKE_Fortran_COMPILER_ID_RUN) - set(CMAKE_Fortran_COMPILER_ID_RUN 1) + 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 @@ -135,6 +132,11 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) # 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) @@ -195,7 +197,7 @@ if(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 + ${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) set(CMAKE_Fortran_COMPILER_ENV_VAR "FC") diff --git a/Modules/CMakeDetermineJavaCompiler.cmake b/Modules/CMakeDetermineJavaCompiler.cmake index 3f430b4..c4217f5 100644 --- a/Modules/CMakeDetermineJavaCompiler.cmake +++ b/Modules/CMakeDetermineJavaCompiler.cmake @@ -98,5 +98,5 @@ 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) + ${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 669dd16..fa78da0 100644 --- a/Modules/CMakeDetermineRCCompiler.cmake +++ b/Modules/CMakeDetermineRCCompiler.cmake @@ -63,5 +63,5 @@ 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) + ${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 22c5016..cd33447 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -170,7 +170,7 @@ if(CMAKE_BINARY_DIR) # 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 + ${CMAKE_PLATFORM_INFO_DIR}/CMakeSystem.cmake IMMEDIATE @ONLY) endif() diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake index 54a6418..1fa0157 100644 --- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake +++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake @@ -42,7 +42,10 @@ macro(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines # 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) + # 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() diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 362052f..e08c1c6 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -39,9 +39,7 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" 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}) @@ -58,9 +56,7 @@ else("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" 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 diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake index 30d62bc..c9f58e3 100644 --- a/Modules/CMakeFindPackageMode.cmake +++ b/Modules/CMakeFindPackageMode.cmake @@ -47,6 +47,8 @@ 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: diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake index 980cc17..207c8ad 100644 --- a/Modules/CMakeForceCompiler.cmake +++ b/Modules/CMakeForceCompiler.cmake @@ -46,7 +46,6 @@ 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) # Set old compiler id variables. @@ -59,7 +58,6 @@ 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) # Set old compiler id variables. @@ -72,7 +70,6 @@ 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) # Set old compiler id variables. diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index c7529fc..55f8277 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -7,6 +7,8 @@ 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) diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake index 14291a7..2c75147 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,8 +12,19 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +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 @@ -36,6 +47,9 @@ if(NOT CMAKE_C_COMPILER_WORKS) try_compile(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c OUTPUT_VARIABLE __CMAKE_C_COMPILER_OUTPUT) + # 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() @@ -44,11 +58,6 @@ if(NOT CMAKE_C_COMPILER_WORKS) 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}\" " "is not able to compile a simple test program.\nIt fails " "with the following output:\n ${__CMAKE_C_COMPILER_OUTPUT}\n\n" @@ -60,22 +69,19 @@ else() "Determining if the C compiler works passed with " "the following output:\n${__CMAKE_C_COMPILER_OUTPUT}\n\n") endif() - set(CMAKE_C_COMPILER_WORKS 1 CACHE INTERNAL "") - if(CMAKE_C_COMPILER_FORCED) - # The compiler configuration was forced by the user. - # Assume the user has configured all compiler information. - else() - # 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() + # 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_SIZEOF_DATA_PTR) foreach(f ${CMAKE_C_ABI_FILES}) include(${f}) diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake index 5ed826b..a5cdf56 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,8 +12,19 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +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 @@ -29,16 +40,14 @@ if(NOT CMAKE_CXX_COMPILER_WORKS) try_compile(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx OUTPUT_VARIABLE __CMAKE_CXX_COMPILER_OUTPUT) + # 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) 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 "Determining if the CXX compiler works failed with " "the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n") @@ -53,22 +62,19 @@ else() "Determining if the CXX compiler works passed with " "the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n") endif() - set(CMAKE_CXX_COMPILER_WORKS 1 CACHE INTERNAL "") - if(CMAKE_CXX_COMPILER_FORCED) - # The compiler configuration was forced by the user. - # Assume the user has configured all compiler information. - else() - # 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() + # 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_SIZEOF_DATA_PTR) foreach(f ${CMAKE_CXX_ABI_FILES}) include(${f}) diff --git a/Modules/CMakeTestForFreeVC.cxx b/Modules/CMakeTestForFreeVC.cxx deleted file mode 100644 index e580c1f..0000000 --- a/Modules/CMakeTestForFreeVC.cxx +++ /dev/null @@ -1,3 +0,0 @@ -#include<iostream> - -int main(){return 0;} diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake index b388d1e..e263345 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,8 +12,19 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +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 @@ -29,6 +40,9 @@ if(NOT CMAKE_Fortran_COMPILER_WORKS) try_compile(CMAKE_Fortran_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f OUTPUT_VARIABLE OUTPUT) + # 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() @@ -48,50 +62,46 @@ else() "Determining if the Fortran compiler works passed with " "the following output:\n${OUTPUT}\n\n") endif() - set(CMAKE_Fortran_COMPILER_WORKS 1 CACHE INTERNAL "") - if(CMAKE_Fortran_COMPILER_FORCED) - # The compiler configuration was forced by the user. - # Assume the user has configured all compiler information. - else() - # 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() - 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) + 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() - - 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) + 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) + if(CMAKE_Fortran_SIZEOF_DATA_PTR) foreach(f ${CMAKE_Fortran_ABI_FILES}) include(${f}) diff --git a/Modules/CMakeTestNMakeCLVersion.c b/Modules/CMakeTestNMakeCLVersion.c deleted file mode 100644 index 3cece2a..0000000 --- a/Modules/CMakeTestNMakeCLVersion.c +++ /dev/null @@ -1,2 +0,0 @@ -VERSION=_MSC_VER - diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 066b295..b5826ef 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -259,7 +259,7 @@ if(RPMBUILD_EXECUTABLE) 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) diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 1b9dc9f..7285b8a 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: # diff --git a/Modules/Compiler/Clang-ASM.cmake b/Modules/Compiler/Clang-ASM.cmake new file mode 100644 index 0000000..a908b60 --- /dev/null +++ b/Modules/Compiler/Clang-ASM.cmake @@ -0,0 +1 @@ +include(Compiler/GNU-ASM) diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 0827e43..faad416 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -45,7 +45,7 @@ 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 "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") if(NOT APPLE) diff --git a/Modules/Compiler/Intel-ASM.cmake b/Modules/Compiler/Intel-ASM.cmake index 1f064c9..74ceb0a 100644 --- a/Modules/Compiler/Intel-ASM.cmake +++ b/Modules/Compiler/Intel-ASM.cmake @@ -4,7 +4,7 @@ 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_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") if(UNIX) set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S) diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index bca86a0..e23317c 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -4,7 +4,7 @@ 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_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 354bb17..ae6021a 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -4,7 +4,7 @@ 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_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") diff --git a/Modules/Compiler/SunPro-ASM.cmake b/Modules/Compiler/SunPro-ASM.cmake index 97776da..2fa8b99 100644 --- a/Modules/Compiler/SunPro-ASM.cmake +++ b/Modules/Compiler/SunPro-ASM.cmake @@ -12,7 +12,7 @@ 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_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 diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake index 9e36051..c5b5203 100644 --- a/Modules/Compiler/SunPro-C.cmake +++ b/Modules/Compiler/SunPro-C.cmake @@ -12,7 +12,7 @@ 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_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 diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index af31c7b..5968712 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -12,7 +12,7 @@ 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_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 diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake index 223a6c6..18e75b9 100644 --- a/Modules/Compiler/SunPro-Fortran.cmake +++ b/Modules/Compiler/SunPro-Fortran.cmake @@ -13,6 +13,6 @@ 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_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG") set(CMAKE_Fortran_MODDIR_FLAG "-moddir=") set(CMAKE_Fortran_MODPATH_FLAG "-M") diff --git a/Modules/Compiler/TinyCC-C.cmake b/Modules/Compiler/TinyCC-C.cmake index 178dd0c..f7937ac 100644 --- a/Modules/Compiler/TinyCC-C.cmake +++ b/Modules/Compiler/TinyCC-C.cmake @@ -5,4 +5,4 @@ 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_RELWITHDEBINFO_INIT "-g -DNDEBUG") diff --git a/Modules/Compiler/XL-ASM.cmake b/Modules/Compiler/XL-ASM.cmake index 95af2ea..07507f9 100644 --- a/Modules/Compiler/XL-ASM.cmake +++ b/Modules/Compiler/XL-ASM.cmake @@ -8,6 +8,6 @@ set(CMAKE_ASM_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e -qsourcetype=assemb 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_RELWITHDEBINFO_INIT "-g -DNDEBUG") set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s ) diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in new file mode 100644 index 0000000..ab4705f --- /dev/null +++ b/Modules/CompilerId/VS-10.vcxproj.in @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|@id_arch@"> + <Configuration>Debug</Configuration> + <Platform>@id_arch@</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid> + <RootNamespace>CompilerId@id_lang@</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_arch@'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + @id_toolset@ + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|@id_arch@'">.\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|@id_arch@'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|@id_arch@'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_arch@'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>TurnOffAllWarnings</WarningLevel> + <DebugInformationFormat> + </DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>@id_machine_10@</TargetMachine> + </Link> + <PostBuildEvent> + <Command>for %%i in (@id_cl@) do %40echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="@id_src@" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> +</Project> diff --git a/Modules/CompilerId/VS-6.dsp.in b/Modules/CompilerId/VS-6.dsp.in new file mode 100644 index 0000000..4f7e676 --- /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 0000000..71bf64d --- /dev/null +++ b/Modules/CompilerId/VS-7.vcproj.in @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="@id_version@" + Name="CompilerId@id_lang@" + ProjectGUID="{CAE07175-D007-4FC3-BFE8-47B392814159}" + RootNamespace="CompilerId@id_lang@" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="@id_arch@" + /> + </Platforms> + <Configurations> + <Configuration + Name="Debug|@id_arch@" + OutputDirectory="." + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="" + MinimalRebuild="false" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="0" + DebugInformationFormat="0" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="false" + SubSystem="1" + TargetMachine="@id_machine_7@" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="for %%i in (@id_cl@) do @echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i" + /> + </Configuration> + </Configurations> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="@id_src@" + > + </File> + </Filter> + </Files> +</VisualStudioProject> diff --git a/Modules/CompilerId/Xcode-1.pbxproj.in b/Modules/CompilerId/Xcode-1.pbxproj.in new file mode 100644 index 0000000..f06960f --- /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 = "<group>"; + }; + 08FB7795FE84155DC02AAC07 = { + children = ( + 2C18F0B415DC1DC700593670, + ); + isa = PBXGroup; + name = Source; + refType = 4; + sourceTree = "<group>"; + }; + 1AB674ADFE9D54B511CA2CBB = { + children = ( + 8DD76F6C0486A84900D96B5E, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = "<group>"; + }; + 2C18F0B415DC1DC700593670 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = @id_type@; + path = @id_src@; + refType = 4; + sourceTree = "<group>"; + }; + 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 0000000..e3c7aa9 --- /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 = "<group>"; }; + 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 = "<group>"; + }; + 08FB7795FE84155DC02AAC07 = { + isa = PBXGroup; + children = ( + 2C18F0B415DC1DC700593670, + ); + name = Source; + sourceTree = "<group>"; + }; + 1AB674ADFE9D54B511CA2CBB = { + isa = PBXGroup; + children = ( + 8DD76F6C0486A84900D96B5E, + ); + name = Products; + sourceTree = "<group>"; + }; + + 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 0000000..41ca7db --- /dev/null +++ b/Modules/CompilerId/Xcode-3.pbxproj.in @@ -0,0 +1,107 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + + 2C18F0B615DC1E0300593670 = {isa = PBXBuildFile; fileRef = 2C18F0B415DC1DC700593670; }; + 2C18F0B415DC1DC700593670 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = @id_type@; path = @id_src@; sourceTree = "<group>"; }; + 08FB7794FE84155DC02AAC07 = { + isa = PBXGroup; + children = ( + 2C18F0B415DC1DC700593670, + ); + name = CompilerId@id_lang@; + sourceTree = "<group>"; + }; + 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 = .; + }; + 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/DeployQt4.cmake b/Modules/DeployQt4.cmake index 6190abe..309fce3 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -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() @@ -295,7 +295,7 @@ function(install_qt4_executable executable) 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}\")" + FIXUP_QT4_EXECUTABLE(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${executable}\" \"\" \"${libs}\" \"${dirs}\" \"${plugins_dir}\" \"${request_qt_conf}\")" ${component} ) endfunction() diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index f0471ff..cd77ba4 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -21,6 +21,8 @@ # [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 # [TIMEOUT seconds] # Time allowed for file download operations @@ -331,6 +333,67 @@ endif() 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() + +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_downloadfile_script script_filename remote local timeout md5) if(timeout) @@ -1027,6 +1090,7 @@ 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) # TODO: Perhaps file:// should be copied to download dir before extraction. @@ -1148,6 +1212,46 @@ 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(md5 TARGET ${name} PROPERTY _EP_URL_MD5) @@ -1196,7 +1300,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() @@ -1226,6 +1330,7 @@ function(_ep_add_update_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 ) set(work_dir) set(comment) @@ -1280,6 +1385,27 @@ function(_ep_add_update_command name) COMMAND ${GIT_EXECUTABLE} submodule update --recursive ) 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() get_property(log TARGET ${name} PROPERTY _EP_LOG_UPDATE) diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake index aad22d2..bc0357e 100644 --- a/Modules/FindArmadillo.cmake +++ b/Modules/FindArmadillo.cmake @@ -58,14 +58,15 @@ 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}") + unset(_armadillo_HEADER_CONTENTS) endif() set(ARMADILLO_VERSION_STRING "${ARMADILLO_VERSION_MAJOR}.${ARMADILLO_VERSION_MINOR}.${ARMADILLO_VERSION_PATCH}") diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 607e249..17aba1b 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -729,7 +729,7 @@ set(Boost_ERROR_REASON) # set(BOOST_VERSION 0) set(BOOST_LIB_VERSION "") - file(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS) + file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ") if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") @@ -737,6 +737,7 @@ set(Boost_ERROR_REASON) 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}") + unset(_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") diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index f152437..0a98bf5 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -650,9 +650,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" ) @@ -898,14 +900,6 @@ 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.") - endif() - # Set up all the command line flags here, so that they can be overridden on a per target basis. set(nvcc_flags "") @@ -1002,12 +996,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 +1010,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_<CONFIG> 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_<CONFIG> 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 +1057,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}") diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake index 13e19be..a2b2926 100644 --- a/Modules/FindDart.cmake +++ b/Modules/FindDart.cmake @@ -17,14 +17,18 @@ # 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] + 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?" ) diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake index a02d031..24cfb87 100644 --- a/Modules/FindFLTK.cmake +++ b/Modules/FindFLTK.cmake @@ -93,11 +93,13 @@ if(NOT FLTK_DIR) # 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 diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake index 3ea558c..071c318 100644 --- a/Modules/FindFLTK2.cmake +++ b/Modules/FindFLTK2.cmake @@ -73,7 +73,7 @@ if(NOT FLTK2_DIR) # 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} diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 08b4a0d..c7cf0eb 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -44,7 +44,7 @@ # everything still works. find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h HINTS - $ENV{FREETYPE_DIR} + ENV FREETYPE_DIR PATHS /usr/local/X11R6/include /usr/local/X11/include @@ -53,19 +53,19 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.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/local/X11R6 + /usr/local/X11 + /usr/freeware + PATH_SUFFIXES include/freetype2 include ) find_library(FREETYPE_LIBRARY NAMES freetype libfreetype freetype219 HINTS - $ENV{FREETYPE_DIR} - PATH_SUFFIXES lib64 lib + ENV FREETYPE_DIR + PATH_SUFFIXES lib PATHS /usr/local/X11R6 /usr/local/X11 diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake index 1e09b82..6e89847 100644 --- a/Modules/FindGDAL.cmake +++ b/Modules/FindGDAL.cmake @@ -42,8 +42,8 @@ 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 @@ -64,8 +64,8 @@ if(UNIX) # libgdal.so... 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 @@ -88,10 +88,10 @@ endif() 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 ff1d396..6a665ad 100644 --- a/Modules/FindGIF.cmake +++ b/Modules/FindGIF.cmake @@ -28,7 +28,7 @@ find_path(GIF_INCLUDE_DIR gif_lib.h HINTS - $ENV{GIF_DIR} + ENV GIF_DIR PATH_SUFFIXES include PATHS ~/Library/Frameworks @@ -41,8 +41,8 @@ set(POTENTIAL_GIF_LIBS gif libgif ungif libungif giflib giflib4) 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 diff --git a/Modules/FindGTK.cmake b/Modules/FindGTK.cmake index 505a051..8a44ade 100644 --- a/Modules/FindGTK.cmake +++ b/Modules/FindGTK.cmake @@ -139,11 +139,7 @@ if(UNIX) ) 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( GTK_gdk_LIBRARY diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index d10b419..49af0f2 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -114,7 +114,7 @@ # _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}") @@ -172,7 +172,7 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) sigc++-2.0 ) - set(_suffixes) + set(_suffixes include lib) foreach(_d ${_relatives}) list(APPEND _suffixes ${_d}) list(APPEND _suffixes ${_d}/include) # for /usr/lib/gtk-2.0/include @@ -186,23 +186,15 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) find_path(${_var} ${_hdr} PATHS /usr/local/lib64 - /usr/local/lib /usr/lib64 - /usr/lib - /opt/gnome/include - /opt/gnome/lib - /opt/openwin/include - /usr/openwin/lib - /sw/include - /sw/lib - /opt/local/include - /opt/local/lib - $ENV{GTKMM_BASEPATH}/include - $ENV{GTKMM_BASEPATH}/lib - [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/include - [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib - [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/include - [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib + /opt/gnome + /opt/openwin + /usr/openwin + /sw + /opt/local + ENV GTKMM_BASEPATH + [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] PATH_SUFFIXES ${_suffixes} ) @@ -469,6 +461,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (GTK2_GTKMM_LIBRARY gtkmm 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_PANGOMM_INCLUDE_DIR pangomm.h) diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index 6cffb5c..d531dd1 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/FindHSPELL.cmake b/Modules/FindHSPELL.cmake index 05b5505..71e55da 100644 --- a/Modules/FindHSPELL.cmake +++ b/Modules/FindHSPELL.cmake @@ -29,10 +29,11 @@ find_path(HSPELL_INCLUDE_DIR hspell.h) find_library(HSPELL_LIBRARIES NAMES hspell) if (HSPELL_INCLUDE_DIR) - file(READ "${HSPELL_INCLUDE_DIR}/hspell.h" HSPELL_H) + 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 diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake new file mode 100644 index 0000000..a6a4aef --- /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 <eike@sf-mail.de> +# +# 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/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake index 37cace8..f8ea18b 100644 --- a/Modules/FindLibLZMA.cmake +++ b/Modules/FindLibLZMA.cmake @@ -33,13 +33,14 @@ 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) + 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}") 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 diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake index 2b8ee97..0276a98 100644 --- a/Modules/FindLua50.cmake +++ b/Modules/FindLua50.cmake @@ -26,7 +26,7 @@ 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 @@ -40,8 +40,8 @@ find_path(LUA_INCLUDE_DIR lua.h 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 @@ -59,9 +59,9 @@ 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 diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake index b5a5471..eac25f5 100644 --- a/Modules/FindLua51.cmake +++ b/Modules/FindLua51.cmake @@ -27,7 +27,7 @@ find_path(LUA_INCLUDE_DIR lua.h HINTS - $ENV{LUA_DIR} + ENV LUA_DIR PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include PATHS ~/Library/Frameworks @@ -41,8 +41,8 @@ find_path(LUA_INCLUDE_DIR lua.h 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 diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index 311a11a..78fd632 100644 --- a/Modules/FindOpenAL.cmake +++ b/Modules/FindOpenAL.cmake @@ -63,7 +63,7 @@ find_path(OPENAL_INCLUDE_DIR al.h HINTS - $ENV{OPENALDIR} + ENV OPENALDIR PATH_SUFFIXES include/AL include/OpenAL include PATHS ~/Library/Frameworks @@ -78,7 +78,7 @@ find_path(OPENAL_INCLUDE_DIR al.h 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 diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake index 17ab057..1f30fe3 100644 --- a/Modules/FindOpenSceneGraph.cmake +++ b/Modules/FindOpenSceneGraph.cmake @@ -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 <philip@yhbt.com> +# Copyright 2009-2012 Philip Lowman <philip@yhbt.com> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -103,7 +107,8 @@ if(OSG_INCLUDE_DIR) 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") diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake index 4f6e920..e059960 100644 --- a/Modules/FindOpenThreads.cmake +++ b/Modules/FindOpenThreads.cmake @@ -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 <philip@yhbt.com> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -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 @@ -74,40 +80,44 @@ find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread 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 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/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index 449fd9f..888e109 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -247,7 +247,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) 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}\", required is \"${${_NAME}_FIND_VERSION}\")") + set(VERSION_MSG "(found suitable version \"${VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")") endif () endif() diff --git a/Modules/FindPhysFS.cmake b/Modules/FindPhysFS.cmake index ae78b27..a2d6abf 100644 --- a/Modules/FindPhysFS.cmake +++ b/Modules/FindPhysFS.cmake @@ -25,7 +25,7 @@ find_path(PHYSFS_INCLUDE_DIR physfs.h HINTS - $ENV{PHYSFSDIR} + ENV PHYSFSDIR PATH_SUFFIXES include/physfs include PATHS ~/Library/Frameworks @@ -39,8 +39,8 @@ find_path(PHYSFS_INCLUDE_DIR physfs.h find_library(PHYSFS_LIBRARY NAMES physfs HINTS - $ENV{PHYSFSDIR} - PATH_SUFFIXES lib64 lib + ENV PHYSFSDIR + PATH_SUFFIXES lib PATHS ~/Library/Frameworks /Library/Frameworks diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index 699cd41..b9440a8 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -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() - set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") @@ -89,7 +84,7 @@ if ( WIN32 ) endforeach() endif() set( PostgreSQL_ROOT_DIRECTORIES - ${PostgreSQL_ROOT_DIRECTORIES} + ENV PostgreSQL_ROOT ${PostgreSQL_ROOT} ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} ) diff --git a/Modules/FindProducer.cmake b/Modules/FindProducer.cmake index 20266cb..3099062 100644 --- a/Modules/FindProducer.cmake +++ b/Modules/FindProducer.cmake @@ -44,9 +44,9 @@ # Try the user's environment request before anything else. 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 @@ -62,10 +62,10 @@ find_path(PRODUCER_INCLUDE_DIR Producer/CameraGroup 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/FindQt3.cmake b/Modules/FindQt3.cmake index 15fbc0b..0665063 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -74,9 +74,9 @@ endif() 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}") + 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 @@ -91,17 +91,18 @@ if (QT_MT_REQUIRED) 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 () @@ -111,17 +112,18 @@ else () 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 () @@ -129,35 +131,37 @@ endif () 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 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/qt + /usr/lib/qt + /usr/lib/qt3 + /usr/share/qt3 + C:/Progra~1/qt + /usr/X11R6 + PATH_SUFFIXES + bin ) if(QT_MOC_EXECUTABLE) @@ -168,18 +172,20 @@ endif() find_program(QT_UIC_EXECUTABLE NAMES uic-qt3 uic 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) @@ -189,13 +195,15 @@ endif() 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 () diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index e7d25c9..f133ae9 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -163,6 +163,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 <target> use the <modules> 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 <link_type> 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. @@ -486,11 +497,11 @@ get_filename_component(qt_install_version "[HKEY_CURRENT_USER\\Software\\trollte # 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 +find_program(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 qmake-mac + 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" ) @@ -1149,7 +1160,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) # 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_MINOR "${QTVERSION}") string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}") endif() diff --git a/Modules/FindQuickTime.cmake b/Modules/FindQuickTime.cmake index 57de737..42a0dce 100644 --- a/Modules/FindQuickTime.cmake +++ b/Modules/FindQuickTime.cmake @@ -22,24 +22,18 @@ # (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() - 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() +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 diff --git a/Modules/FindRTI.cmake b/Modules/FindRTI.cmake index eef0dae..60990b7 100644 --- a/Modules/FindRTI.cmake +++ b/Modules/FindRTI.cmake @@ -35,18 +35,13 @@ macro(RTI_MESSAGE_QUIETLY QUIET 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 () - 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} + 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]" diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index 806b659..487c5d3 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -67,7 +67,7 @@ find_path(SDL_INCLUDE_DIR SDL.h HINTS - $ENV{SDLDIR} + ENV SDLDIR PATH_SUFFIXES include/SDL include PATHS ~/Library/Frameworks @@ -87,8 +87,8 @@ find_path(SDL_INCLUDE_DIR SDL.h find_library(SDL_LIBRARY_TEMP NAMES SDL SDL-1.1 HINTS - $ENV{SDLDIR} - PATH_SUFFIXES lib64 lib + ENV SDLDIR + PATH_SUFFIXES lib PATHS /sw /opt/local @@ -105,8 +105,8 @@ if(NOT SDL_BUILDING_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 diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake index 3c1f7a0..8c9e891 100644 --- a/Modules/FindSDL_image.cmake +++ b/Modules/FindSDL_image.cmake @@ -27,34 +27,28 @@ find_path(SDLIMAGE_INCLUDE_DIR SDL_image.h HINTS - $ENV{SDLIMAGEDIR} - $ENV{SDLDIR} - PATH_SUFFIXES include + ENV SDLIMAGEDIR + ENV SDLDIR + PATH_SUFFIXES include include/SDL 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 + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt ) find_library(SDLIMAGE_LIBRARY NAMES SDL_image HINTS - $ENV{SDLIMAGEDIR} - $ENV{SDLDIR} - PATH_SUFFIXES lib64 lib + ENV SDLIMAGEDIR + ENV SDLDIR + PATH_SUFFIXES lib PATHS ~/Library/Frameworks /Library/Frameworks diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake index ed333ee..97a8330 100644 --- a/Modules/FindSDL_mixer.cmake +++ b/Modules/FindSDL_mixer.cmake @@ -27,34 +27,28 @@ find_path(SDLMIXER_INCLUDE_DIR SDL_mixer.h HINTS - $ENV{SDLMIXERDIR} - $ENV{SDLDIR} - PATH_SUFFIXES include + ENV SDLMIXERDIR + ENV SDLDIR + PATH_SUFFIXES include include/SDL 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 + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt ) find_library(SDLMIXER_LIBRARY NAMES SDL_mixer HINTS - $ENV{SDLMIXERDIR} - $ENV{SDLDIR} - PATH_SUFFIXES lib64 lib + ENV SDLMIXERDIR + ENV SDLDIR + PATH_SUFFIXES lib PATHS ~/Library/Frameworks /Library/Frameworks diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake index dcab3fd..7e90e90 100644 --- a/Modules/FindSDL_net.cmake +++ b/Modules/FindSDL_net.cmake @@ -27,33 +27,27 @@ find_path(SDLNET_INCLUDE_DIR SDL_net.h HINTS - $ENV{SDLNETDIR} - $ENV{SDLDIR} - PATH_SUFFIXES include + ENV SDLNETDIR + ENV SDLDIR + PATH_SUFFIXES include include/SDL 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 + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt ) find_library(SDLNET_LIBRARY NAMES SDL_net HINTS - $ENV{SDLNETDIR} - $ENV{SDLDIR} - PATH_SUFFIXES lib64 lib + ENV SDLNETDIR + ENV SDLDIR + PATH_SUFFIXES lib PATHS ~/Library/Frameworks /Library/Frameworks diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake index 3685956..a9153c1 100644 --- a/Modules/FindSDL_sound.cmake +++ b/Modules/FindSDL_sound.cmake @@ -75,39 +75,33 @@ mark_as_advanced(SDL_SOUND_EXTRAS) # Find SDL_sound.h find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h HINTS - $ENV{SDLSOUNDDIR}/include - $ENV{SDLSOUNDDIR} - $ENV{SDLDIR}/include - $ENV{SDLDIR} + ENV SDLSOUNDDIR + ENV SDLDIR + PATH_SUFFIXES + include include/SDL 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 + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt ) find_library(SDL_SOUND_LIBRARY NAMES SDL_sound HINTS - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLSOUNDDIR} - $ENV{SDLDIR}/lib - $ENV{SDLDIR} + ENV SDLSOUNDDIR + ENV SDLDIR + PATH_SUFFIXES + lib PATHS - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib + /sw + /opt/local + /opt/csw + /opt ) if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) @@ -212,37 +206,35 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) 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 + 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() - endif() + endif(MIKMOD_LIBRARY) + endif("${MY_OUTPUT}" MATCHES "MikMod_") # Find ModPlug 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}) @@ -255,18 +247,16 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) 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}) @@ -275,18 +265,16 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) 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}) @@ -299,16 +287,15 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) 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}) @@ -321,16 +308,15 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) 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}) @@ -346,16 +332,15 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) 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}) @@ -367,20 +352,16 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_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}) diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake index 6f238e6..1e68ccf 100644 --- a/Modules/FindSDL_ttf.cmake +++ b/Modules/FindSDL_ttf.cmake @@ -27,33 +27,27 @@ find_path(SDLTTF_INCLUDE_DIR SDL_ttf.h HINTS - $ENV{SDLTTFDIR} - $ENV{SDLDIR} - PATH_SUFFIXES include + ENV SDLTTFDIR + ENV SDLDIR + PATH_SUFFIXES include include/SDL 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 + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt ) find_library(SDLTTF_LIBRARY NAMES SDL_ttf HINTS - $ENV{SDLTTFDIR} - $ENV{SDLDIR} + ENV SDLTTFDIR + ENV SDLDIR PATHS ~/Library/Frameworks /Library/Frameworks @@ -61,7 +55,7 @@ find_library(SDLTTF_LIBRARY /opt/local /opt/csw /opt - PATH_SUFFIXES lib64 lib + PATH_SUFFIXES lib ) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake index b44ba70..a032496 100644 --- a/Modules/FindSquish.cmake +++ b/Modules/FindSquish.cmake @@ -54,8 +54,9 @@ if(NOT SQUISH_INSTALL_DIR) # Look for an installation 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} diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake index b60845d..fa090ff 100644 --- a/Modules/FindVTK.cmake +++ b/Modules/FindVTK.cmake @@ -90,7 +90,7 @@ if(_VTK_40_ALLOW AND NOT VTK_DIR) find_path(VTK_DIR NAMES UseVTK.cmake PATH_SUFFIXES vtk-4.0 vtk - HINTS $ENV{VTK_DIR} + HINTS ENV VTK_DIR PATHS diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 0b63bc9..e12dc0a 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -324,6 +324,11 @@ if (UNIX) 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) diff --git a/Modules/Findosg_functions.cmake b/Modules/Findosg_functions.cmake index 30c0876..2e90837 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 <philip@yhbt.com> +# Copyright 2009-2012 Philip Lowman <philip@yhbt.com> # # 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 @@ -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 diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index c186eb5..218d476 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -421,12 +421,12 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") 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} + ENV ProgramFiles PATH_SUFFIXES wxWidgets-2.9.4 wxWidgets-2.9.3 diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake index 06db751..5030bcc 100644 --- a/Modules/FindwxWindows.cmake +++ b/Modules/FindwxWindows.cmake @@ -106,18 +106,6 @@ 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) @@ -132,7 +120,18 @@ if(WIN32_STYLE_FIND) ## 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} ) + 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}") @@ -600,8 +599,10 @@ else() # 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 + HINTS + ENV WXWIN + $ENV{WXWIN}/bin + PATHS ../wx/bin ../../wx/bin ) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index e51055f..8f2754e 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -168,6 +168,7 @@ function(is_file_executable file result_var) if(UNIX) if(NOT file_cmd) find_program(file_cmd "file") + mark_as_advanced(file_cmd) endif() if(file_cmd) diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 19b06d5..bd97501 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -312,13 +312,14 @@ if(MSVC) 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() diff --git a/Modules/KDE3Macros.cmake b/Modules/KDE3Macros.cmake index 6d6cdb0..07864f5 100644 --- a/Modules/KDE3Macros.cmake +++ b/Modules/KDE3Macros.cmake @@ -223,31 +223,30 @@ macro(KDE3_AUTOMOC) 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) - 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}) - - endforeach () - endif() + ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) + endforeach () + unset(_match) + unset(_header) + unset(_moc) endif () endforeach () endmacro() diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index 3370557..3a30a2e 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -61,7 +61,7 @@ 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 /? @@ -70,8 +70,8 @@ if(NOT _INTEL_XILINK_TEST_RUN) if(_XILINK_HELP MATCHES MANIFEST) set(_INTEL_COMPILER_SUPPORTS_MANIFEST 1) endif() - if(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake") - file(WRITE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake + 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}) diff --git a/Modules/Platform/Windows-MSVC-C.cmake b/Modules/Platform/Windows-MSVC-C.cmake new file mode 100644 index 0000000..e81df9f --- /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 0000000..fdd1dae --- /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 0000000..b3cb19b --- /dev/null +++ b/Modules/Platform/Windows-MSVC.cmake @@ -0,0 +1,204 @@ + +#============================================================================= +# 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) + +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() +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 <FLAGS> /fo<OBJECT> <SOURCE>") + +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") + set(MSVC_IDE 0) +else() + set(MSVC_IDE 1) +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) + 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(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() + +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() +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 () + 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 "<CMAKE_COMMAND> -E vs_link_dll ") + set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe ") + endif() + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + + set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") + + set(CMAKE_${lang}_COMPILE_OBJECT + "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<TARGET_PDB> -c <SOURCE>${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + "<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE + "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /FoNUL /FAs /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}") + + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) + set(CMAKE_${lang}_LINK_EXECUTABLE + "${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> -link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${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 /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 05df946..0000000 --- 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() -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() -# does the compiler support pdbtype and is it the newer compiler -if(CMAKE_GENERATOR MATCHES "Visual Studio 8") - set(CMAKE_COMPILER_2005 1) -endif() - -# make sure to enable languages after setting configuration types -enable_language(RC) -set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") - -# 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() - 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() - if("${compilerVersion}" EQUAL 1300) - set(MSVC70 1) - set(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) - endif() - if("${compilerVersion}" EQUAL 1310) - set(MSVC71 1) - set(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) - endif() - if("${compilerVersion}" EQUAL 1400) - set(MSVC80 1) - set(CMAKE_COMPILER_2005 1) - endif() - if("${compilerVersion}" EQUAL 1500) - set(MSVC90 1) - endif() - if("${compilerVersion}" EQUAL 1600) - set(MSVC10 1) - endif() - set(MSVC_VERSION "${compilerVersion}") - else() - 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() - # 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() - 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() - make_directory("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3") - endif() -endif() - -if(MSVC_C_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 -if(MSVC_VERSION GREATER 1310) - # for 2005 make sure the manifest is put in the dll with mt - set(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") - set(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -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 "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}") - set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -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() - 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() - 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() - 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() - -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() -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 () - 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}) - -# 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() - -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() diff --git a/Modules/Platform/Windows-cl.cmake.in b/Modules/Platform/Windows-cl.cmake.in deleted file mode 100644 index 4f3ec3e..0000000 --- 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/cl.cmake b/Modules/Platform/cl.cmake deleted file mode 100644 index 9e4d607..0000000 --- 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() - -if(CMAKE_VERBOSE_MAKEFILE) - set(CMAKE_CL_NOLOGO) -else() - set(CMAKE_CL_NOLOGO "/nologo") -endif() -# create a shared C++ library -set(CMAKE_CXX_CREATE_SHARED_LIBRARY - "<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_FLAGS> <LINK_LIBRARIES> ${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 "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") - -# 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_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /TP /Fo<OBJECT> /Fd<TARGET_PDB> -c <SOURCE>${CMAKE_END_TEMP_FILE}") - -# compile a C file into an object file -set(CMAKE_C_COMPILE_OBJECT - "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<TARGET_PDB> -c <SOURCE>${CMAKE_END_TEMP_FILE}") - -set(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) -set(CMAKE_C_LINK_EXECUTABLE - "<CMAKE_C_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> -link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") - -set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) -set(CMAKE_CXX_LINK_EXECUTABLE - "<CMAKE_CXX_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> -link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") - -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE - "<CMAKE_C_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}") - -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE - "<CMAKE_CXX_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /TP -E <SOURCE>${CMAKE_END_TEMP_FILE}") - -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE - "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /FAs /FoNUL /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}") - -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /TP /FAs /FoNUL /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}") - diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake index eff4766..0d1dfda 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/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 4324347..8e8680c 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -187,7 +187,7 @@ macro (QT4_ADD_RESOURCES outfiles ) 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) + file(STRINGS "${infile}" _RC_FILE_CONTENTS REGEX "<file[^>]*>[^<]+") string(REGEX MATCHALL "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}") foreach(_RC_FILE ${_RC_FILES}) string(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}") @@ -196,6 +196,8 @@ macro (QT4_ADD_RESOURCES outfiles ) 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. @@ -439,3 +441,24 @@ macro(QT4_ADD_TRANSLATION _qm_files) 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/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6954d1d..c5c5326 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20120816) +set(CMake_VERSION_TWEAK 20120830) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx index edbef45..7fa401c 100644 --- a/Source/CPack/cmCPackDocumentVariables.cxx +++ b/Source/CPack/cmCPackDocumentVariables.cxx @@ -45,17 +45,18 @@ void cmCPackDocumentVariables::DefineVariables(cmake* cm) " 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/cmDepends.cxx b/Source/cmDepends.cxx index 545fe97..166a584 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -98,7 +98,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); @@ -143,6 +143,7 @@ bool cmDepends::WriteDependencies(const char*, const char*, //---------------------------------------------------------------------------- bool cmDepends::CheckDependencies(std::istream& internalDepends, + const char* internalDependsFileName, std::map<std::string, DependencyVector>& validDeps) { // Parse dependencies from the stream. If any dependee is missing @@ -186,8 +187,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 +215,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 100e187..f7dc881 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -83,6 +83,7 @@ protected: // Return false if dependencies must be regenerated and true // otherwise. virtual bool CheckDependencies(std::istream& internalDepends, + const char* internalDependsFileName, std::map<std::string, DependencyVector>& validDeps); // Finalize the dependency information for the target. diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx index 1d84914..ba0e8fb 100644 --- a/Source/cmDependsJava.cxx +++ b/Source/cmDependsJava.cxx @@ -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<std::string, DependencyVector >&) { return true; diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h index fe6fef5..bf7e234 100644 --- a/Source/cmDependsJava.h +++ b/Source/cmDependsJava.h @@ -32,7 +32,8 @@ protected: virtual bool WriteDependencies(const char *src, const char *file, std::ostream& makeDepends, std::ostream& internalDepends); virtual bool CheckDependencies(std::istream& internalDepends, - std::map<std::string, DependencyVector >& validDeps); + const char* internalDependsFileName, + std::map<std::string, DependencyVector>& validDeps); private: cmDependsJava(cmDependsJava const&); // Purposely not implemented. diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h index 5359013..74c673a 100644 --- a/Source/cmDocumentGeneratorExpressions.h +++ b/Source/cmDocumentGeneratorExpressions.h @@ -16,6 +16,9 @@ "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" \ + " $<CONFIG:cfg> = '1' if config is \"cfg\", else '0'\n" \ " $<CONFIGURATION> = configuration name\n" \ " $<TARGET_FILE:tgt> = main file (.exe, .so.1.2, .a)\n" \ " $<TARGET_LINKER_FILE:tgt> = file used to link (.a, .lib, .so)\n" \ @@ -25,6 +28,12 @@ "versions can produce the directory and file name components:\n" \ " $<TARGET_FILE_DIR:tgt>/$<TARGET_FILE_NAME:tgt>\n" \ " $<TARGET_LINKER_FILE_DIR:tgt>/$<TARGET_LINKER_FILE_NAME:tgt>\n" \ - " $<TARGET_SONAME_FILE_DIR:tgt>/$<TARGET_SONAME_FILE_NAME:tgt>\n" + " $<TARGET_SONAME_FILE_DIR:tgt>/$<TARGET_SONAME_FILE_NAME:tgt>\n" \ + "Boolean expressions:\n" \ + " $<AND:?[,?]...> = '1' if all '?' are '1', else '0'\n" \ + " $<OR:?[,?]...> = '0' if all '?' are '0', else '1'\n" \ + " $<NOT:?> = '0' if '?' is '1', else '1'\n" \ + "where '?' is always either '0' or '1'.\n" \ + "" #endif diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 05ef8fc..94cd5c2 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -283,6 +283,16 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "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_MINOR_VERSION", cmProperty::VARIABLE, "The Minor version of cmake (i.e. the 4 in X.4.X).", "This specifies the minor version of the CMake" @@ -373,12 +383,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "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.", "This variable defaults to false. You can set " @@ -595,7 +599,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 @@ -827,9 +845,9 @@ 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" @@ -1351,7 +1369,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 +1399,30 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("CMAKE_<LANG>_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 +1442,10 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("CMAKE_<LANG>_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"); diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 5c7d400..1f976f7 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -462,18 +462,6 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() this->CreateLinksForTargets(fout); } - // I'm not sure this makes too much sense. There can be different - // output directories in different subdirs, so we would need more of them. - - // for EXECUTABLE_OUTPUT_PATH when not in binary dir - this->AppendOutLinkedResource(fout, - mf->GetSafeDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY"), - mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH")); - // for LIBRARY_OUTPUT_PATH when not in binary dir - this->AppendOutLinkedResource(fout, - mf->GetSafeDefinition("CMAKE_LIBRARY_OUTPUT_DIRECTORY"), - mf->GetSafeDefinition("LIBRARY_OUTPUT_PATH")); - fout << "\t</linkedResources>\n"; fout << "</projectDescription>\n"; @@ -610,6 +598,16 @@ void cmExtraEclipseCDT4Generator::AppendIncludeDirectories( if (!inc->empty()) { std::string dir = cmSystemTools::CollapseFullPath(inc->c_str()); + + // handle framework include dirs on OSX, the remainder after the + // Frameworks/ part has to be stripped + // /System/Library/Frameworks/GLUT.framework/Headers + cmsys::RegularExpression frameworkRx("(.+/Frameworks)/.+\\.framework/"); + if(frameworkRx.find(dir.c_str())) + { + dir = frameworkRx.match(1); + } + if(emittedDirs.find(dir) == emittedDirs.end()) { emittedDirs.insert(dir); @@ -761,18 +759,6 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const excludeFromOut += "**/CMakeFiles/"; fout << "<pathentry excluding=\"" << excludeFromOut << "\" kind=\"out\" path=\"\"/>\n"; - // add output entry for EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH - // - if it is a subdir of homeOutputDirectory, there is no need to add it - // - if it is not then create a linked resource and add the linked name - // but check it doesn't conflict with other linked resources names - for (std::vector<std::string>::const_iterator - it = this->OutLinkedResources.begin(); - it != this->OutLinkedResources.end(); - ++it) - { - fout << "<pathentry kind=\"out\" path=\"" << this->EscapeForXML(*it) - << "\"/>\n"; - } // add pre-processor definitions to allow eclipse to gray out sections emmited.clear(); @@ -1317,65 +1303,3 @@ void cmExtraEclipseCDT4Generator "\t\t</link>\n" ; } - -bool cmExtraEclipseCDT4Generator -::AppendOutLinkedResource(cmGeneratedFileStream& fout, - const std::string& defname, - const std::string& altdefname) -{ - if (defname.empty() && altdefname.empty()) - { - return false; - } - - std::string outputPath = (defname.empty() ? altdefname : defname); - - if (!cmSystemTools::FileIsFullPath(outputPath.c_str())) - { - outputPath = this->HomeOutputDirectory + "/" + outputPath; - } - - // in this case it's not necessary: - if (cmSystemTools::IsSubDirectory(outputPath.c_str(), - this->HomeOutputDirectory.c_str())) - { - return false; - } - - // in these two cases Eclipse would complain: - if (cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(), - outputPath.c_str())) - { - return false; - } - if (cmSystemTools::GetRealPath(outputPath.c_str()) - == cmSystemTools::GetRealPath(this->HomeOutputDirectory.c_str())) - { - return false; - } - - std::string name = this->GetPathBasename(outputPath); - - // make sure linked resource name is unique - while (this->GlobalGenerator->GetProjectMap().find(name) - != this->GlobalGenerator->GetProjectMap().end()) - { - name += "_"; - } - - if (std::find(this->OutLinkedResources.begin(), - this->OutLinkedResources.end(), - name) - != this->OutLinkedResources.end()) - { - return false; - } - else - { - this->AppendLinkedResource(fout, name, - this->GetEclipsePath(outputPath), LinkToFolder); - this->OutLinkedResources.push_back(name); - return true; - } -} - diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index ebd8c08..37ce65e 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -93,10 +93,6 @@ private: const std::string& path, LinkType linkType); - bool AppendOutLinkedResource(cmGeneratedFileStream& fout, - const std::string& defname, - const std::string& altdefname); - static void AppendIncludeDirectories(cmGeneratedFileStream& fout, const std::vector<std::string>& includeDirs, std::set<std::string>& emittedDirs); @@ -109,7 +105,6 @@ private: void CreateLinksForTargets(cmGeneratedFileStream& fout); std::vector<std::string> SrcLinkedResources; - std::vector<std::string> OutLinkedResources; std::string HomeDirectory; std::string HomeOutputDirectory; bool IsOutOfSourceBuild; diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index f88ab0b..92bbf1d 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -14,6 +14,8 @@ #include "cmMakefile.h" #include "cmTarget.h" +#include <cmsys/String.h> + //---------------------------------------------------------------------------- cmGeneratorExpression::cmGeneratorExpression( cmMakefile* mf, const char* config, @@ -25,6 +27,7 @@ cmGeneratorExpression::cmGeneratorExpression( "_FILE(|_NAME|_DIR):" // Filename component. "([A-Za-z0-9_.-]+)" // Target name. ">$"); + this->TestConfig.compile("^\\$<CONFIG:([A-Za-z0-9_]*)>$"); } //---------------------------------------------------------------------------- @@ -103,6 +106,26 @@ bool cmGeneratorExpression::Evaluate() } //---------------------------------------------------------------------------- +static bool cmGeneratorExpressionBool(const char* c, std::string& result, + const char* name, + const char* a, const char* b) +{ + result = a; + while((c[0] == '0' || c[0] == '1') && (c[1] == ',' || c[1] == '>')) + { + if(c[0] == b[0]) { result = b; } + c += 2; + } + if(c[0]) + { + result = name; + result += " requires one or more comma-separated '0' or '1' values."; + return false; + } + return true; +} + +//---------------------------------------------------------------------------- bool cmGeneratorExpression::Evaluate(const char* expr, std::string& result) { if(this->TargetInfo.find(expr)) @@ -116,6 +139,38 @@ bool cmGeneratorExpression::Evaluate(const char* expr, std::string& result) { result = this->Config? this->Config : ""; } + else if(strncmp(expr, "$<0:",4) == 0) + { + result = ""; + } + else if(strncmp(expr, "$<1:",4) == 0) + { + result = std::string(expr+4, strlen(expr)-5); + } + else if(strncmp(expr, "$<NOT:",6) == 0) + { + const char* c = expr+6; + if((c[0] != '0' && c[0] != '1') || c[1] != '>' || c[2]) + { + result = "NOT requires exactly one '0' or '1' value."; + return false; + } + result = c[0] == '1'? "0" : "1"; + } + else if(strncmp(expr, "$<AND:",6) == 0) + { + return cmGeneratorExpressionBool(expr+6, result, "AND", "1", "0"); + } + else if(strncmp(expr, "$<OR:",5) == 0) + { + return cmGeneratorExpressionBool(expr+5, result, "OR", "0", "1"); + } + else if(this->TestConfig.find(expr)) + { + result = cmsysString_strcasecmp(this->TestConfig.match(1).c_str(), + this->Config? this->Config:"") == 0 + ? "1":"0"; + } else { result = "Expression syntax not recognized."; diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 1a9d4c6..a023eb0 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -51,6 +51,7 @@ private: std::vector<char> Data; std::stack<size_t> Barriers; cmsys::RegularExpression TargetInfo; + cmsys::RegularExpression TestConfig; std::set<cmTarget*> Targets; bool Evaluate(); bool Evaluate(const char* expr, std::string& result); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a47ca36..578fa9e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -315,9 +315,11 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& 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 +378,16 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& 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())) diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 48ead25..d188980 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -29,9 +29,12 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator() //---------------------------------------------------------------------------- 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()); + } } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio10IA64Generator.cxx b/Source/cmGlobalVisualStudio10IA64Generator.cxx index 5f70f6b..25dd88f 100644 --- a/Source/cmGlobalVisualStudio10IA64Generator.cxx +++ b/Source/cmGlobalVisualStudio10IA64Generator.cxx @@ -16,6 +16,7 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudio10IA64Generator::cmGlobalVisualStudio10IA64Generator() { + this->ArchitectureId = "x64"; } //---------------------------------------------------------------------------- @@ -33,8 +34,6 @@ void cmGlobalVisualStudio10IA64Generator { this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf); mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64"); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio10Win64Generator.cxx b/Source/cmGlobalVisualStudio10Win64Generator.cxx index 49dc473..d0a0c49 100644 --- a/Source/cmGlobalVisualStudio10Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio10Win64Generator.cxx @@ -16,6 +16,7 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudio10Win64Generator::cmGlobalVisualStudio10Win64Generator() { + this->ArchitectureId = "x64"; } //---------------------------------------------------------------------------- @@ -33,8 +34,6 @@ void cmGlobalVisualStudio10Win64Generator { this->cmGlobalVisualStudio10Generator::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/cmGlobalVisualStudio11ARMGenerator.cxx b/Source/cmGlobalVisualStudio11ARMGenerator.cxx index fef1aba..efd71c6 100644 --- a/Source/cmGlobalVisualStudio11ARMGenerator.cxx +++ b/Source/cmGlobalVisualStudio11ARMGenerator.cxx @@ -14,19 +14,16 @@ #include "cmake.h" //---------------------------------------------------------------------------- -void cmGlobalVisualStudio11ARMGenerator -::GetDocumentation(cmDocumentationEntry& entry) const +cmGlobalVisualStudio11ARMGenerator::cmGlobalVisualStudio11ARMGenerator() { - entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio 11 ARM project files."; - entry.Full = ""; + this->ArchitectureId = "ARM"; } //---------------------------------------------------------------------------- void cmGlobalVisualStudio11ARMGenerator -::AddPlatformDefinitions(cmMakefile* mf) +::GetDocumentation(cmDocumentationEntry& entry) const { - this->cmGlobalVisualStudio11Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "ARM"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "ARM"); + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 11 ARM project files."; + entry.Full = ""; } diff --git a/Source/cmGlobalVisualStudio11ARMGenerator.h b/Source/cmGlobalVisualStudio11ARMGenerator.h index 77e1429..71dbf2e 100644 --- a/Source/cmGlobalVisualStudio11ARMGenerator.h +++ b/Source/cmGlobalVisualStudio11ARMGenerator.h @@ -18,7 +18,7 @@ class cmGlobalVisualStudio11ARMGenerator : public cmGlobalVisualStudio11Generator { public: - cmGlobalVisualStudio11ARMGenerator() {} + cmGlobalVisualStudio11ARMGenerator(); static cmGlobalGenerator* New() { return new cmGlobalVisualStudio11ARMGenerator; } @@ -31,7 +31,5 @@ public: /** 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 be7fd55..7bb4d0c 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -22,14 +22,6 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator() } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio11Generator::AddPlatformDefinitions(cmMakefile* mf) -{ - mf->AddDefinition("MSVC11", "1"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); -} - -//---------------------------------------------------------------------------- void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout) { fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 7e8f6aa..56337a4 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -28,7 +28,6 @@ public: virtual const char* GetName() const { return cmGlobalVisualStudio11Generator::GetActualName();} static const char* GetActualName() {return "Visual Studio 11";} - virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void WriteSLNHeader(std::ostream& fout); diff --git a/Source/cmGlobalVisualStudio11Win64Generator.cxx b/Source/cmGlobalVisualStudio11Win64Generator.cxx index 10c9027..94e07bf 100644 --- a/Source/cmGlobalVisualStudio11Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio11Win64Generator.cxx @@ -14,6 +14,12 @@ #include "cmake.h" //---------------------------------------------------------------------------- +cmGlobalVisualStudio11Win64Generator::cmGlobalVisualStudio11Win64Generator() +{ + this->ArchitectureId = "x64"; +} + +//---------------------------------------------------------------------------- void cmGlobalVisualStudio11Win64Generator ::GetDocumentation(cmDocumentationEntry& entry) const { @@ -28,6 +34,4 @@ void cmGlobalVisualStudio11Win64Generator { 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 index 53f1953..9445d15 100644 --- a/Source/cmGlobalVisualStudio11Win64Generator.h +++ b/Source/cmGlobalVisualStudio11Win64Generator.h @@ -18,7 +18,7 @@ class cmGlobalVisualStudio11Win64Generator : public cmGlobalVisualStudio11Generator { public: - cmGlobalVisualStudio11Win64Generator() {} + cmGlobalVisualStudio11Win64Generator(); static cmGlobalGenerator* New() { return new cmGlobalVisualStudio11Win64Generator; } diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index cc70341..e8ca788 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -40,14 +40,12 @@ void cmGlobalVisualStudio6Generator cmMakefile *mf, bool optional) { + cmGlobalVisualStudioGenerator::AddPlatformDefinitions(mf); 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_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); } diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 1da575e..ab2308f 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -34,14 +34,6 @@ cmLocalGenerator *cmGlobalVisualStudio71Generator::CreateLocalGenerator() } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio71Generator::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio7Generator::AddPlatformDefinitions(mf); - mf->RemoveDefinition("MSVC70"); - mf->AddDefinition("MSVC71", "1"); -} - -//---------------------------------------------------------------------------- std::string cmGlobalVisualStudio71Generator::GetUserMacrosDirectory() { // Macros not supported on Visual Studio 7.1 and earlier because diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 285f202..a8daad6 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -53,7 +53,6 @@ public: protected: virtual const char* GetIDEVersion() { return "7.1"; } - virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index d485d6e..b6eea5d 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -55,13 +55,6 @@ void cmGlobalVisualStudio7Generator } -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, diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 9b9107d..1df58f9 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -112,7 +112,6 @@ protected: 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, diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index a74a4ee..2e3b530 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -21,7 +21,6 @@ cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator() { this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; - this->ArchitectureId = "X86"; } //---------------------------------------------------------------------------- @@ -54,14 +53,6 @@ void cmGlobalVisualStudio8Generator } //---------------------------------------------------------------------------- -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() { this->cmGlobalVisualStudio7Generator::Configure(); diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 31501bc..5009f29 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -72,7 +72,6 @@ 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, @@ -82,7 +81,5 @@ protected: virtual bool ComputeTargetDepends(); virtual void WriteProjectDepends(std::ostream& fout, const char* name, const char* path, cmTarget &t); - - const char* ArchitectureId; }; #endif diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index fcf00d5..70af50d 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -23,14 +23,6 @@ cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator() } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio9Generator::AddPlatformDefinitions(cmMakefile* mf) -{ - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId); - mf->AddDefinition("MSVC90", "1"); -} - -//---------------------------------------------------------------------------- void cmGlobalVisualStudio9Generator::WriteSLNHeader(std::ostream& fout) { fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index 361b58c..0b0d143 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -32,7 +32,6 @@ public: 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; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index a2b4c65..0968b77 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -21,6 +21,7 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator() { + this->ArchitectureId = "X86"; } //---------------------------------------------------------------------------- @@ -489,6 +490,13 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) } //---------------------------------------------------------------------------- +void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId); + mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId); +} + +//---------------------------------------------------------------------------- std::string cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget* target) { UtilityDependsMap::iterator i = this->UtilityDepends.find(target); diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 27fc8cf..cebf7d7 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -84,6 +84,8 @@ protected: virtual const char* GetIDEVersion() = 0; + virtual void AddPlatformDefinitions(cmMakefile* mf); + virtual bool ComputeTargetDepends(); class VSDependSet: public std::set<cmStdString> {}; class VSDependMap: public std::map<cmTarget*, VSDependSet> {}; @@ -96,6 +98,8 @@ protected: std::string GetUtilityDepend(cmTarget* target); typedef std::map<cmTarget*, cmStdString> UtilityDependsMap; UtilityDependsMap UtilityDepends; + const char* ArchitectureId; + private: void ComputeTargetObjects(cmGeneratorTarget* gt) const; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ae92a0a..e8ab38f 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -787,6 +787,10 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext, { sourcecode += ".fortran.f90"; } + else if(lang == "ASM") + { + sourcecode += ".asm"; + } //else // { // // Already specialized above or we leave sourcecode == "sourcecode" diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 4893a17..0a1fe06 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -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" diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 76e622e..7c06009 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/cmListCommand.cxx b/Source/cmListCommand.cxx index 9d4f175..7848424 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -429,6 +429,12 @@ bool cmListCommand this->SetError("sub-command REVERSE requires a list as an argument."); return false; } + else if(args.size() > 2) + { + this->SetError( + "sub-command REVERSE only takes one argument."); + return false; + } const std::string& listName = args[1]; // expand the variable @@ -463,6 +469,12 @@ bool cmListCommand "sub-command REMOVE_DUPLICATES requires a list as an argument."); return false; } + else if(args.size() > 2) + { + this->SetError( + "sub-command REMOVE_DUPLICATES only takes one argument."); + return false; + } const std::string& listName = args[1]; // expand the variable @@ -506,6 +518,12 @@ bool cmListCommand this->SetError("sub-command SORT requires a list as an argument."); return false; } + else if(args.size() > 2) + { + this->SetError( + "sub-command SORT only takes one argument."); + return false; + } const std::string& listName = args[1]; // expand the variable diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0cfb36b..cf2af0a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2101,9 +2101,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<std::string>& defines, + const char* defines_list) { // Short-circuit if there are no definitions. if(!defines_list) @@ -2115,12 +2114,23 @@ void cmLocalGenerator::AppendDefines(std::string& defines, std::vector<std::string> defines_vec; cmSystemTools::ExpandListArgument(defines_list, defines_vec); - // Short-circuit if there are no definitions. - if(defines_vec.empty()) + for(std::vector<std::string>::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<std::string>& defines, + std::string &definesString, + const char* lang) +{ // Lookup the define flag for the current language. std::string dflag = "-D"; if(lang) @@ -2135,23 +2145,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<std::string>::const_iterator di = defines_vec.begin(); - di != defines_vec.end(); ++di) + std::set<std::string>::const_iterator defineIt = defines.begin(); + const std::set<std::string>::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 +2164,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 39b493f..b3396e3 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -154,8 +154,14 @@ public: * 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<std::string>& defines, + const char* defines_list); + /** + * Join a set of defines into a definesString with a space separator. + */ + void JoinDefines(const std::set<std::string>& defines, + std::string &definesString, + const char* lang); /** Lookup and append options associated with a particular feature. */ void AppendFeatureOptions(std::string& flags, const char* lang, diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 1a7e611..9f2a863 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -418,25 +418,42 @@ void cmLocalVisualStudio6Generator // Add per-source and per-configuration preprocessor definitions. std::map<cmStdString, cmStdString> cdmap; - this->AppendDefines(compileFlags, - (*sf)->GetProperty("COMPILE_DEFINITIONS"), lang); + + { + std::set<std::string> 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<std::string> 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<std::string> 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<std::string> 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<std::string> relwithdebinfoCompileDefinitions; + this->AppendDefines(relwithdebinfoCompileDefinitions, cdefs); + this->JoinDefines(relwithdebinfoCompileDefinitions, + cdmap["RELWITHDEBINFO"], lang); } bool excludedFromBuild = @@ -1653,43 +1670,56 @@ 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<std::string> definesSet; + std::set<std::string> debugDefinesSet; + std::set<std::string> releaseDefinesSet; + std::set<std::string> minsizeDefinesSet; + std::set<std::string> debugrelDefinesSet; this->AppendDefines( - defines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS"), 0); + definesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS")); this->AppendDefines( - debugDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_DEBUG"),0); + debugDefinesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_DEBUG")); this->AppendDefines( - releaseDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0); + releaseDefinesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELEASE")); this->AppendDefines( - minsizeDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0); + minsizeDefinesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL")); this->AppendDefines( - debugrelDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0); + debugrelDefinesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO")); this->AppendDefines( - defines, - target.GetProperty("COMPILE_DEFINITIONS"), 0); + definesSet, + target.GetProperty("COMPILE_DEFINITIONS")); this->AppendDefines( - debugDefines, - target.GetProperty("COMPILE_DEFINITIONS_DEBUG"), 0); + debugDefinesSet, + target.GetProperty("COMPILE_DEFINITIONS_DEBUG")); this->AppendDefines( - releaseDefines, - target.GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0); + releaseDefinesSet, + target.GetProperty("COMPILE_DEFINITIONS_RELEASE")); this->AppendDefines( - minsizeDefines, - target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0); + minsizeDefinesSet, + target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL")); this->AppendDefines( - debugrelDefines, - target.GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0); + debugrelDefinesSet, + target.GetProperty("COMPILE_DEFINITIONS_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); + flags += defines; flagsDebug += debugDefines; flagsRelease += releaseDefines; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0de182e..95738c4 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -292,28 +292,31 @@ 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<std::string> 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); + (defines, this->Makefile->GetProperty("COMPILE_DEFINITIONS")); this->LocalGenerator->AppendDefines - (defines, this->Target->GetProperty("COMPILE_DEFINITIONS"), lang); + (defines, this->Target->GetProperty("COMPILE_DEFINITIONS")); std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName); this->LocalGenerator->AppendDefines - (defines, this->Makefile->GetProperty(defPropName.c_str()), lang); + (defines, this->Makefile->GetProperty(defPropName.c_str())); this->LocalGenerator->AppendDefines - (defines, this->Target->GetProperty(defPropName.c_str()), lang); + (defines, this->Target->GetProperty(defPropName.c_str())); - ByLanguageMap::value_type entry(l, defines); + std::string definesString; + this->LocalGenerator->JoinDefines(defines, definesString, lang); + + ByLanguageMap::value_type entry(l, definesString); i = this->DefinesByLanguage.insert(entry).first; } return i->second; @@ -587,14 +590,12 @@ cmMakefileTargetGenerator } // Add language-specific defines. - std::string defines = "$("; - defines += lang; - defines += "_DEFINES)"; + std::set<std::string> 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 +608,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 @@ -676,7 +677,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)); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index a923d60..9dc860e 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -459,25 +459,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 +485,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 +518,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"] = diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 3532c8b..918f582 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -184,46 +184,43 @@ std::string cmNinjaTargetGenerator:: ComputeDefines(cmSourceFile *source, const std::string& language) { - std::string defines; + std::set<std::string> 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->Makefile->GetProperty("COMPILE_DEFINITIONS")); this->LocalGenerator->AppendDefines (defines, - this->Target->GetProperty("COMPILE_DEFINITIONS"), - language.c_str()); + this->Target->GetProperty("COMPILE_DEFINITIONS")); 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->Makefile->GetProperty(defPropName.c_str())); this->LocalGenerator->AppendDefines (defines, - this->Target->GetProperty(defPropName.c_str()), - language.c_str()); + this->Target->GetProperty(defPropName.c_str())); 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 +292,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->GetDirectory(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) @@ -342,24 +349,26 @@ cmNinjaTargetGenerator 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() && + !this->GetGlobalGenerator()->GetCMakeInstance()->GetIsInTryCompile()) { - // 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"; } } @@ -393,16 +402,14 @@ cmNinjaTargetGenerator i != compileCmds.end(); ++i) this->GetLocalGenerator()->ExpandRuleVariables(*i, vars); - std::string cmdLine = - this->GetLocalGenerator()->BuildCommandLine(compileCmds); - + std::string cmdLine; if(useClDeps) { - std::string cl = mf->GetDefinition("CMAKE_C_COMPILER"); - cl = "\"" + cl + "\" "; - cmdLine = clDepsBinary + " " + lang + " $in \"$DEP_FILE\" $out " - + clShowPrefix + " " + cl + cmdLine; + cmdLine = clDepsBinary + lang + " $in \"$DEP_FILE\" $out " + + clShowPrefix + clBinary; } + cmdLine += this->GetLocalGenerator()->BuildCommandLine(compileCmds); + // Write the rule for compiling file of the given language. cmOStringStream comment; @@ -537,15 +544,7 @@ 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); - } + this->SetMsvcTargetPdbVariable(vars); if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS")) { @@ -641,14 +640,14 @@ cmNinjaTargetGenerator void cmNinjaTargetGenerator -::EnsureDirectoryExists(const std::string& dir) +::EnsureDirectoryExists(const std::string& dir) const { cmSystemTools::MakeDirectory(dir.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 84573ce..cd20694 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -40,10 +40,12 @@ public: virtual void Generate() = 0; - std::string GetTargetPDB() const; std::string GetTargetName() const; protected: + + bool SetMsvcTargetPdbVariable(cmNinjaVars&) const; + cmGeneratedFileStream& GetBuildFileStream() const; cmGeneratedFileStream& GetRulesFileStream() const; @@ -112,8 +114,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/cmTarget.cxx b/Source/cmTarget.cxx index 775662c..65b586d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -761,7 +761,10 @@ void cmTarget::DefineProperties(cmake *cm) "The POSITION_INDEPENDENT_CODE property determines whether position " "independent executables or shared libraries will be created. " "This property is true by default for SHARED and MODULE library " - "targets and false otherwise."); + "targets and false otherwise. " + "This property is initialized by the value of the variable " + "CMAKE_POSITION_INDEPENDENT_CODE if it is set when a target is" + "created."); cm->DefineProperty ("POST_INSTALL_SCRIPT", cmProperty::TARGET, @@ -903,7 +906,7 @@ void cmTarget::DefineProperties(cmake *cm) "Build an executable with a WinMain entry point on windows.", "When this property is set to true the executable when linked " "on Windows will be created with a WinMain() entry point instead " - "of of just main()." + "of just main(). " "This makes it a GUI executable instead of a console application. " "See the CMAKE_MFC_FLAG variable documentation to configure use " "of MFC for WinMain executables. " diff --git a/Source/cmTarget.h b/Source/cmTarget.h index a89c5d9..98eaeec 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -158,9 +158,6 @@ public: void AddSources(std::vector<std::string> const& srcs); cmSourceFile* AddSource(const char* src); - /** - * Get the list of the source files used by this target - */ enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED}; //* how we identify a library, by name and type diff --git a/Source/cmVS11CLFlagTable.h b/Source/cmVS11CLFlagTable.h new file mode 100644 index 0000000..5ab8ebb --- /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 0000000..9429442 --- /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 0000000..ea0d0f0 --- /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/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 53b6a9b..3d2828d 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 <cmsys/auto_ptr.hxx> +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, "&", "&"); @@ -413,7 +440,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() } if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { - this->WriteString("<Immersive>true</Immersive>\n", 2); + this->WriteString("<WindowsAppContainer>true" + "</WindowsAppContainer>\n", 2); } this->WriteString("</PropertyGroup>\n", 1); } @@ -957,7 +985,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( 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()); @@ -1151,7 +1179,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( cmsys::auto_ptr<Options> pOptions( new Options(this->LocalGenerator, Options::Compiler, - cmVS10CLFlagTable)); + cmVSGetCLFlagTable(this->LocalGenerator))); Options& clOptions = *pOptions; std::string flags; @@ -1204,6 +1232,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( // 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 @@ -1311,7 +1340,7 @@ 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, " ", ""); @@ -1391,7 +1420,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& cmVisualStudioGeneratorOptions linkOptions(this->LocalGenerator, cmVisualStudioGeneratorOptions::Linker, - cmVS10LinkFlagTable, 0, this); + cmVSGetLinkFlagTable(this->LocalGenerator), 0, this); if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") ) { flags += " /SUBSYSTEM:WINDOWS"; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 08c2329..c6787b9 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2449,9 +2449,6 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) this->PreLoadCMakeFiles(); - std::string systemFile = this->GetHomeOutputDirectory(); - systemFile += "/CMakeSystem.cmake"; - if ( noconfigure ) { return 0; diff --git a/Source/cmparseMSBuildXML.py b/Source/cmparseMSBuildXML.py index a0c7ec4..35b55ca 100755 --- a/Source/cmparseMSBuildXML.py +++ b/Source/cmparseMSBuildXML.py @@ -6,6 +6,9 @@ # "${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 <Name>true|false</Name> # simple example: @@ -148,7 +151,7 @@ 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) @@ -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,15 +229,15 @@ 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" @@ -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 diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt index 5f71036..94a6325 100644 --- a/Tests/Assembler/CMakeLists.txt +++ b/Tests/Assembler/CMakeLists.txt @@ -7,8 +7,9 @@ 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) set(SRCS main.s) diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index d3b1f3c..2a70b6e 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -93,16 +93,14 @@ if(EXISTS message("found debug") 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 "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}" ) message("found debug") 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) @@ -178,13 +176,11 @@ 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}") +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) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9512ea6..e03b926 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -70,11 +70,6 @@ if(BUILD_TESTING) "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 () # Should tests that use CVS be run? @@ -218,6 +213,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(Unset Unset) ADD_TEST_MACRO(PolicyScope PolicyScope) ADD_TEST_MACRO(EmptyLibrary EmptyLibrary) + ADD_TEST_MACRO(CompileDefinitions CompileDefinitions) set_tests_properties(EmptyLibrary PROPERTIES PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target:test") ADD_TEST_MACRO(CrossCompile CrossCompile) @@ -551,6 +547,16 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ FAIL_REGULAR_EXPRESSION "Unexpected: ") 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 ${CMAKE_TEST_GENERATOR} + --build-project GeneratorExpression + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GeneratorExpression") + add_test(CustomCommand ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CustomCommand" @@ -794,9 +800,7 @@ ${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() endif() if(CTEST_RUN_CPackTestAllGenerators) @@ -1217,9 +1221,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${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") + endif () if (WIN32) add_test(SubDir ${CMAKE_CTEST_COMMAND} @@ -2106,43 +2108,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ endif () endif () - if (CMAKE_RUN_LONG_TESTS AND TEST_KDE4_STABLE_BRANCH) - if(UNIX) - if(NOT QT4_FOUND) - find_package(Qt4) - endif() - - 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() - else() - set(TRY_BUILD_KDE4 FALSE) - endif() - - find_package(Perl) - if(NOT PERL_FOUND) - set(TRY_BUILD_KDE4 FALSE) - endif() - - find_package(ZLIB) - if(NOT ZLIB_FOUND) - set(TRY_BUILD_KDE4 FALSE) - endif() - - 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() - - endif() - endif () - if("${CMAKE_TEST_GENERATOR}" MATCHES Xcode) set(CMAKE_SKIP_BOOTSTRAP_TEST 1) endif() diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index fb0bd15..212c758 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -70,7 +70,7 @@ 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 +foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG HSPELL JASPER LIBLZMA LIBXML2 LIBXSLT PERL PKG_CONFIG PostgreSQL TIFF ZLIB) check_version_string(${VTEST} ${VTEST}_VERSION_STRING) endforeach() diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 6fe91c7..ba681d8 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -19,6 +19,12 @@ 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(TargetScope) diff --git a/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt new file mode 100644 index 0000000..848ffdd --- /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 0000000..94ac31e --- /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 0000000..3a2bdeb --- /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/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in index 07fc7c6..a167503 100644 --- a/Tests/CMakeTests/ListTest.cmake.in +++ b/Tests/CMakeTests/ListTest.cmake.in @@ -86,3 +86,14 @@ TEST("REVERSE result" "ken;brad;bill;andy") 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" "") diff --git a/Tests/CMakeTests/ToolchainTest.cmake.in b/Tests/CMakeTests/ToolchainTest.cmake.in index c010fca..96e7196 100644 --- a/Tests/CMakeTests/ToolchainTest.cmake.in +++ b/Tests/CMakeTests/ToolchainTest.cmake.in @@ -6,7 +6,7 @@ macro(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) diff --git a/Tests/CompileDefinitions/CMakeLists.txt b/Tests/CompileDefinitions/CMakeLists.txt new file mode 100644 index 0000000..e7d91bf --- /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 0000000..a6372af --- /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 0000000..e415390 --- /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 0000000..6db6f3f --- /dev/null +++ b/Tests/CompileDefinitions/compiletest.cpp @@ -0,0 +1,33 @@ + +#ifndef CMAKE_IS_FUN +#error Expect CMAKE_IS_FUN definition +#endif + +#if CMAKE_IS != Fun +#error Expect CMAKE_IS=Fun definition +#endif + + +template<bool test> +struct CMakeStaticAssert; + +template<> +struct CMakeStaticAssert<true> {}; + +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<sizeof(CMAKE_IS_) == sizeof("Fun")>) +#ifndef NO_SPACES_IN_DEFINE_VALUES + , + StringLiteralTest2 = sizeof(CMakeStaticAssert<sizeof(CMAKE_IS_REALLY) == sizeof("Very Fun")>) +#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 0000000..e2b6ba9 --- /dev/null +++ b/Tests/CompileDefinitions/target_prop/CMakeLists.txt @@ -0,0 +1,9 @@ + +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") diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index 7a76261..33ffe2e 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) @@ -511,6 +512,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_DIR> + 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_DIR> + 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_DIR> + INSTALL_COMMAND "" + DEPENDS "SetupLocalHGRepository" + LOG_UPDATE 1 + ) + set_property(TARGET ${proj} PROPERTY FOLDER "HG") + endif() +endif() + # Test the testable built/installed products: # @@ -581,5 +652,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/hgrepo.tgz b/Tests/ExternalProject/hgrepo.tgz Binary files differnew file mode 100644 index 0000000..0d75ce2 --- /dev/null +++ b/Tests/ExternalProject/hgrepo.tgz diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt new file mode 100644 index 0000000..2b135dc --- /dev/null +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required (VERSION 2.8.8) +project(GeneratorExpression NONE) + +add_custom_target(check ALL + COMMAND ${CMAKE_COMMAND} + -Dtest_0=$<0:nothing> + -Dtest_1=$<1:content> + -Dconfig=$<CONFIGURATION> + -Dtest_and_0=$<AND:0> + -Dtest_and_0_0=$<AND:0,0> + -Dtest_and_0_1=$<AND:0,1> + -Dtest_and_1=$<AND:1> + -Dtest_and_1_0=$<AND:1,0> + -Dtest_and_1_1=$<AND:1,1> + -Dtest_config_0=$<CONFIG:$<CONFIGURATION>x> + -Dtest_config_1=$<CONFIG:$<CONFIGURATION>> + -Dtest_not_0=$<NOT:0> + -Dtest_not_1=$<NOT:1> + -Dtest_or_0=$<OR:0> + -Dtest_or_0_0=$<OR:0,0> + -Dtest_or_0_1=$<OR:0,1> + -Dtest_or_1=$<OR:1> + -Dtest_or_1_0=$<OR:1,0> + -Dtest_or_1_1=$<OR:1,1> + -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake + COMMAND ${CMAKE_COMMAND} -E echo "check done" + VERBATIM + ) diff --git a/Tests/GeneratorExpression/check.cmake b/Tests/GeneratorExpression/check.cmake new file mode 100644 index 0000000..e243d85 --- /dev/null +++ b/Tests/GeneratorExpression/check.cmake @@ -0,0 +1,25 @@ +macro(check var val) + if(NOT "${${var}}" STREQUAL "${val}") + message(SEND_ERROR "${var} is \"${${var}}\", not \"${val}\"") + endif() +endmacro() + +message(STATUS "config=[${config}]") +check(test_0 "") +check(test_1 "content") +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_config_0 "0") +check(test_config_1 "1") +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") diff --git a/Tests/KDE4StableBranchTest/test_kde4.sh.in b/Tests/KDE4StableBranchTest/test_kde4.sh.in deleted file mode 100755 index bc90b9d..0000000 --- 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. -# -# <neundorf AT kde.org> - -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/Module/CheckTypeSize/CMakeLists.txt b/Tests/Module/CheckTypeSize/CMakeLists.txt index 45e9f67..abe617a 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 602c834..32e395c 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 <sys/types.h> @@ -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 b5bfbf6..c601075 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 0000000..e08efc4 --- /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/ObjectLibrary/A/CMakeLists.txt b/Tests/ObjectLibrary/A/CMakeLists.txt index 04ab02f..36c86e7 100644 --- a/Tests/ObjectLibrary/A/CMakeLists.txt +++ b/Tests/ObjectLibrary/A/CMakeLists.txt @@ -1,4 +1,4 @@ -project(ObjectLibraryA) +project(ObjectLibraryA C) # Add -fPIC so objects can be used in shared libraries. # TODO: Need property for this. if(CMAKE_SHARED_LIBRARY_C_FLAGS AND NOT WATCOM) diff --git a/Tests/ObjectLibrary/B/CMakeLists.txt b/Tests/ObjectLibrary/B/CMakeLists.txt index 4b0b07d..32d8ceb 100644 --- a/Tests/ObjectLibrary/B/CMakeLists.txt +++ b/Tests/ObjectLibrary/B/CMakeLists.txt @@ -1,4 +1,4 @@ -project(ObjectLibraryB) +project(ObjectLibraryB C) if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") # VS 6 generator does not use per-target object locations. set(vs6 _vs6) diff --git a/Tests/Properties/CMakeLists.txt b/Tests/Properties/CMakeLists.txt index 7bf9c2d..285d596 100644 --- a/Tests/Properties/CMakeLists.txt +++ b/Tests/Properties/CMakeLists.txt @@ -53,15 +53,13 @@ get_property(SOURCERESULT 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) +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) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eca96f9..3ea54f1 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -45,6 +45,7 @@ macro(add_RunCMake_test test) ) endmacro() +add_RunCMake_test(GeneratorExpression) add_RunCMake_test(Languages) add_RunCMake_test(ObjectLibrary) diff --git a/Tests/RunCMake/GeneratorExpression/BadAND-result.txt b/Tests/RunCMake/GeneratorExpression/BadAND-result.txt new file mode 100644 index 0000000..d00491f --- /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 0000000..ced21d8 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<AND:> + + AND requires one or more comma-separated '0' or '1' values. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<AND:,> + + AND requires one or more comma-separated '0' or '1' values. +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 0000000..7926540 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadAND.cmake @@ -0,0 +1,4 @@ +add_custom_target(check ALL COMMAND check + $<AND:> + $<AND:,> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-result.txt new file mode 100644 index 0000000..d00491f --- /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 0000000..7c86b25 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<CONFIG:.> + + 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 0000000..0c13f89 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake @@ -0,0 +1,3 @@ +add_custom_target(check ALL COMMAND check + $<CONFIG:.> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT-result.txt b/Tests/RunCMake/GeneratorExpression/BadNOT-result.txt new file mode 100644 index 0000000..d00491f --- /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 0000000..5721f5f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt @@ -0,0 +1,26 @@ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<NOT:> + + NOT requires 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: + + \$<NOT:,> + + NOT requires 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: + + \$<NOT:0,1> + + NOT requires 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 0000000..452293b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadNOT.cmake @@ -0,0 +1,5 @@ +add_custom_target(check ALL COMMAND check + $<NOT:> + $<NOT:,> + $<NOT:0,1> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadOR-result.txt b/Tests/RunCMake/GeneratorExpression/BadOR-result.txt new file mode 100644 index 0000000..d00491f --- /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 0000000..72ef2dd --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<OR:> + + OR requires one or more comma-separated '0' or '1' values. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<OR:,> + + OR requires one or more comma-separated '0' or '1' values. +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 0000000..f16f56a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadOR.cmake @@ -0,0 +1,4 @@ +add_custom_target(check ALL COMMAND check + $<OR:> + $<OR:,> + VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/CMakeLists.txt b/Tests/RunCMake/GeneratorExpression/CMakeLists.txt new file mode 100644 index 0000000..e8db6b0 --- /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 0000000..ed18f25 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(BadCONFIG) +run_cmake(BadOR) +run_cmake(BadAND) +run_cmake(BadNOT) diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index c39be8b..233d5e2 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -81,8 +81,7 @@ if(BUILD_QtDialog AND "${CMAKE_GENERATOR}" MATCHES "${WIN_SHELL_GENS}" string(REPLACE ";" "\\;" _PATH "PATH=${Qt_BIN_DIR};%PATH%") set(cmake-gui-PATH COMMAND set "${_PATH}") endif() -endif(BUILD_QtDialog AND "${CMAKE_GENERATOR}" MATCHES "${WIN_SHELL_GENS}" - AND EXISTS "${QT_QMAKE_EXECUTABLE}" AND NOT CMAKE_NO_AUTO_QT_ENV) +endif() # add the docs for the executables ADD_DOCS(ctest ${CMake_SOURCE_DIR}/Utilities/Doxygen/authors.txt) @@ -160,6 +160,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 \ |