diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index b4eabe599..17d63ebab 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 06aa9bf06..c5bde9a92 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 b6477dfe4..7f66be506 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 95fc852d6..2c8dd4bc7 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/CMakeClDeps.cmake b/Modules/CMakeClDeps.cmake index b52641c53..0214ead2b 100644 --- a/Modules/CMakeClDeps.cmake +++ b/Modules/CMakeClDeps.cmake @@ -26,12 +26,9 @@ if(MSVC_C_ARCHITECTURE_ID AND CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_C_COMPIL file(WRITE ${showdir}/foo.h "\n") file(WRITE ${showdir}/main.c "#include \"foo.h\" \nint main(){}\n") execute_process(COMMAND ${CMAKE_C_COMPILER} /nologo /showIncludes ${showdir}/main.c - WORKING_DIRECTORY ${showdir} OUTPUT_VARIABLE showOut) - string(REPLACE main.c "" showOut1 ${showOut}) - string(REPLACE "/" "\\" header1 ${showdir}/foo.h) - string(TOLOWER ${header1} header2) - string(REPLACE ${header2} "" showOut2 ${showOut1}) - string(REPLACE "\n" "" showOut3 ${showOut2}) + WORKING_DIRECTORY ${showdir} OUTPUT_VARIABLE outLine) + string(REGEX MATCH "\n([^:]*:[^:]*:[ \t]*)" tmp "${outLine}") + set(localizedPrefix "${CMAKE_MATCH_1}") set(SET_CMAKE_CMCLDEPS_EXECUTABLE "set(CMAKE_CMCLDEPS_EXECUTABLE \"${CMAKE_CMCLDEPS_EXECUTABLE}\")") - set(SET_CMAKE_CL_SHOWINCLUDE_PREFIX "set(CMAKE_CL_SHOWINCLUDE_PREFIX \"${showOut3}\")") + set(SET_CMAKE_CL_SHOWINCLUDE_PREFIX "set(CMAKE_CL_SHOWINCLUDE_PREFIX \"${localizedPrefix}\")") endif() diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index 4cf29dd34..9f0b30ab4 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 16e2f53b3..275fc4758 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") - endif() - if(NOT EXISTS ${CMAKE_C_COMPILER_INIT}) - message(FATAL_ERROR "Could not find compiler set in environment variable CC:\n$ENV{CC}.") - endif() - endif() - - # next try prefer the compiler specified by the generator - if(CMAKE_GENERATOR_CC) - if(NOT CMAKE_C_COMPILER_INIT) - set(CMAKE_C_COMPILER_INIT ${CMAKE_GENERATOR_CC}) - endif() - endif() - - # finally list compilers to try - if(NOT CMAKE_C_COMPILER_INIT) - set(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}cc ${_CMAKE_TOOLCHAIN_PREFIX}gcc cl bcc xlc clang) - endif() - - _cmake_find_compiler(C) - -else() - - # we only get here if CMAKE_C_COMPILER was specified using -D or a pre-made CMakeCache.txt - # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE - # if CMAKE_C_COMPILER is a list of length 2, use the first item as - # CMAKE_C_COMPILER and the 2nd one as CMAKE_C_COMPILER_ARG1 - - list(LENGTH CMAKE_C_COMPILER _CMAKE_C_COMPILER_LIST_LENGTH) - if("${_CMAKE_C_COMPILER_LIST_LENGTH}" EQUAL 2) - list(GET CMAKE_C_COMPILER 1 CMAKE_C_COMPILER_ARG1) - list(GET CMAKE_C_COMPILER 0 CMAKE_C_COMPILER) - endif() - - # if a compiler was specified by the user but without path, - # now try to find it with the full path - # if it is found, force it into the cache, - # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" - # if the C compiler already had a path, reuse it for searching the CXX compiler - get_filename_component(_CMAKE_USER_C_COMPILER_PATH "${CMAKE_C_COMPILER}" PATH) - if(NOT _CMAKE_USER_C_COMPILER_PATH) - find_program(CMAKE_C_COMPILER_WITH_PATH NAMES ${CMAKE_C_COMPILER}) - mark_as_advanced(CMAKE_C_COMPILER_WITH_PATH) - if(CMAKE_C_COMPILER_WITH_PATH) - set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_WITH_PATH} CACHE STRING "C compiler" FORCE) - endif() - endif() -endif() -mark_as_advanced(CMAKE_C_COMPILER) - -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() +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) -if(NOT CMAKE_C_COMPILER_ID_RUN) - set(CMAKE_C_COMPILER_ID_RUN 1) + # prefer the environment variable CC + if($ENV{CC} MATCHES ".+") + get_filename_component(CMAKE_C_COMPILER_INIT $ENV{CC} PROGRAM PROGRAM_ARGS CMAKE_C_FLAGS_ENV_INIT) + if(CMAKE_C_FLAGS_ENV_INIT) + set(CMAKE_C_COMPILER_ARG1 "${CMAKE_C_FLAGS_ENV_INIT}" CACHE STRING "First argument to C compiler") + endif() + if(NOT EXISTS ${CMAKE_C_COMPILER_INIT}) + message(FATAL_ERROR "Could not find compiler set in environment variable CC:\n$ENV{CC}.") + endif() + endif() + + # next try prefer the compiler specified by the generator + if(CMAKE_GENERATOR_CC) + if(NOT CMAKE_C_COMPILER_INIT) + set(CMAKE_C_COMPILER_INIT ${CMAKE_GENERATOR_CC}) + endif() + endif() + + # finally list compilers to try + if(NOT CMAKE_C_COMPILER_INIT) + set(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}cc ${_CMAKE_TOOLCHAIN_PREFIX}gcc cl bcc xlc clang) + endif() + + _cmake_find_compiler(C) + + else() + + # we only get here if CMAKE_C_COMPILER was specified using -D or a pre-made CMakeCache.txt + # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE + # if CMAKE_C_COMPILER is a list of length 2, use the first item as + # CMAKE_C_COMPILER and the 2nd one as CMAKE_C_COMPILER_ARG1 + + list(LENGTH CMAKE_C_COMPILER _CMAKE_C_COMPILER_LIST_LENGTH) + if("${_CMAKE_C_COMPILER_LIST_LENGTH}" EQUAL 2) + list(GET CMAKE_C_COMPILER 1 CMAKE_C_COMPILER_ARG1) + list(GET CMAKE_C_COMPILER 0 CMAKE_C_COMPILER) + endif() + + # if a compiler was specified by the user but without path, + # now try to find it with the full path + # if it is found, force it into the cache, + # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" + # if the C compiler already had a path, reuse it for searching the CXX compiler + get_filename_component(_CMAKE_USER_C_COMPILER_PATH "${CMAKE_C_COMPILER}" PATH) + if(NOT _CMAKE_USER_C_COMPILER_PATH) + find_program(CMAKE_C_COMPILER_WITH_PATH NAMES ${CMAKE_C_COMPILER}) + mark_as_advanced(CMAKE_C_COMPILER_WITH_PATH) + if(CMAKE_C_COMPILER_WITH_PATH) + set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_WITH_PATH} CACHE STRING "C compiler" FORCE) + endif() + endif() + endif() + mark_as_advanced(CMAKE_C_COMPILER) # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce @@ -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). @@ -170,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 8e4d59ff1..59da3e60d 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") - endif() - if(NOT EXISTS ${CMAKE_CXX_COMPILER_INIT}) - message(FATAL_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}.\n${CMAKE_CXX_COMPILER_INIT}") - endif() - endif() - - # next prefer the generator specified compiler - if(CMAKE_GENERATOR_CXX) - if(NOT CMAKE_CXX_COMPILER_INIT) - set(CMAKE_CXX_COMPILER_INIT ${CMAKE_GENERATOR_CXX}) - endif() - endif() - - # finally list compilers to try - if(NOT CMAKE_CXX_COMPILER_INIT) - set(CMAKE_CXX_COMPILER_LIST CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC clang++) - endif() - - _cmake_find_compiler(CXX) -else() - -# we only get here if CMAKE_CXX_COMPILER was specified using -D or a pre-made CMakeCache.txt -# (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE -# -# if CMAKE_CXX_COMPILER is a list of length 2, use the first item as -# CMAKE_CXX_COMPILER and the 2nd one as CMAKE_CXX_COMPILER_ARG1 - - list(LENGTH CMAKE_CXX_COMPILER _CMAKE_CXX_COMPILER_LIST_LENGTH) - if("${_CMAKE_CXX_COMPILER_LIST_LENGTH}" EQUAL 2) - list(GET CMAKE_CXX_COMPILER 1 CMAKE_CXX_COMPILER_ARG1) - list(GET CMAKE_CXX_COMPILER 0 CMAKE_CXX_COMPILER) - endif() - -# if a compiler was specified by the user but without path, -# now try to find it with the full path -# if it is found, force it into the cache, -# if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" -# if the CXX compiler already had a path, reuse it for searching the C compiler - get_filename_component(_CMAKE_USER_CXX_COMPILER_PATH "${CMAKE_CXX_COMPILER}" PATH) - if(NOT _CMAKE_USER_CXX_COMPILER_PATH) - find_program(CMAKE_CXX_COMPILER_WITH_PATH NAMES ${CMAKE_CXX_COMPILER}) - mark_as_advanced(CMAKE_CXX_COMPILER_WITH_PATH) - if(CMAKE_CXX_COMPILER_WITH_PATH) - set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_WITH_PATH} CACHE STRING "CXX compiler" FORCE) - endif() - endif() -endif() -mark_as_advanced(CMAKE_CXX_COMPILER) - -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) +elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") + set(CMAKE_CXX_COMPILER_XCODE_TYPE sourcecode.cpp.cpp) +else() + if(NOT CMAKE_CXX_COMPILER) + set(CMAKE_CXX_COMPILER_INIT NOTFOUND) + + # prefer the environment variable CXX + if($ENV{CXX} MATCHES ".+") + get_filename_component(CMAKE_CXX_COMPILER_INIT $ENV{CXX} PROGRAM PROGRAM_ARGS CMAKE_CXX_FLAGS_ENV_INIT) + if(CMAKE_CXX_FLAGS_ENV_INIT) + set(CMAKE_CXX_COMPILER_ARG1 "${CMAKE_CXX_FLAGS_ENV_INIT}" CACHE STRING "First argument to CXX compiler") + endif() + if(NOT EXISTS ${CMAKE_CXX_COMPILER_INIT}) + message(FATAL_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}.\n${CMAKE_CXX_COMPILER_INIT}") + endif() + endif() + + # next prefer the generator specified compiler + if(CMAKE_GENERATOR_CXX) + if(NOT CMAKE_CXX_COMPILER_INIT) + set(CMAKE_CXX_COMPILER_INIT ${CMAKE_GENERATOR_CXX}) + endif() + endif() + + # finally list compilers to try + if(NOT CMAKE_CXX_COMPILER_INIT) + set(CMAKE_CXX_COMPILER_LIST CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC clang++) + endif() + + _cmake_find_compiler(CXX) + else() + + # we only get here if CMAKE_CXX_COMPILER was specified using -D or a pre-made CMakeCache.txt + # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE + # + # if CMAKE_CXX_COMPILER is a list of length 2, use the first item as + # CMAKE_CXX_COMPILER and the 2nd one as CMAKE_CXX_COMPILER_ARG1 + + list(LENGTH CMAKE_CXX_COMPILER _CMAKE_CXX_COMPILER_LIST_LENGTH) + if("${_CMAKE_CXX_COMPILER_LIST_LENGTH}" EQUAL 2) + list(GET CMAKE_CXX_COMPILER 1 CMAKE_CXX_COMPILER_ARG1) + list(GET CMAKE_CXX_COMPILER 0 CMAKE_CXX_COMPILER) + endif() + + # if a compiler was specified by the user but without path, + # now try to find it with the full path + # if it is found, force it into the cache, + # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" + # if the CXX compiler already had a path, reuse it for searching the C compiler + get_filename_component(_CMAKE_USER_CXX_COMPILER_PATH "${CMAKE_CXX_COMPILER}" PATH) + if(NOT _CMAKE_USER_CXX_COMPILER_PATH) + find_program(CMAKE_CXX_COMPILER_WITH_PATH NAMES ${CMAKE_CXX_COMPILER}) + mark_as_advanced(CMAKE_CXX_COMPILER_WITH_PATH) + if(CMAKE_CXX_COMPILER_WITH_PATH) + set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_WITH_PATH} CACHE STRING "CXX compiler" FORCE) + endif() + endif() + endif() + mark_as_advanced(CMAKE_CXX_COMPILER) # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce @@ -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). @@ -177,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 ae2eb9b23..75247d955 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 f574978d7..3df17c7c6 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 "${CMAKE_VS_PLATFORM_TOOLSET}") + 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 da77e21d6..f861e3954 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") - endif() - if(EXISTS ${CMAKE_Fortran_COMPILER_INIT}) - else() - message(FATAL_ERROR "Could not find compiler set in environment variable FC:\n$ENV{FC}.") - endif() - endif() - - # next try prefer the compiler specified by the generator - if(CMAKE_GENERATOR_FC) - if(NOT CMAKE_Fortran_COMPILER_INIT) - set(CMAKE_Fortran_COMPILER_INIT ${CMAKE_GENERATOR_FC}) - endif() - endif() - - # finally list compilers to try - if(NOT CMAKE_Fortran_COMPILER_INIT) - # Known compilers: - # f77/f90/f95: generic compiler names - # g77: GNU Fortran 77 compiler - # gfortran: putative GNU Fortran 95+ compiler (in progress) - # fort77: native F77 compiler under HP-UX (and some older Crays) - # frt: Fujitsu F77 compiler - # pathf90/pathf95/pathf2003: PathScale Fortran compiler - # pgf77/pgf90/pgf95/pgfortran: Portland Group F77/F90/F95 compilers - # xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers - # lf95: Lahey-Fujitsu F95 compiler - # fl32: Microsoft Fortran 77 "PowerStation" compiler - # af77: Apogee F77 compiler for Intergraph hardware running CLIX - # epcf90: "Edinburgh Portable Compiler" F90 - # fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha - # ifc: Intel Fortran 95 compiler for Linux/x86 - # efc: Intel Fortran 95 compiler for IA64 - # - # The order is 95 or newer compilers first, then 90, - # then 77 or older compilers, gnu is always last in the group, - # so if you paid for a compiler it is picked by default. - set(CMAKE_Fortran_COMPILER_LIST - ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 pgfortran lf95 xlf95 - fort gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77 - frt pgf77 xlf fl32 af77 g77 f77 - ) - - # Vendor-specific compiler names. - set(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77) - set(_Fortran_COMPILER_NAMES_Intel ifort ifc efc) - set(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77) - set(_Fortran_COMPILER_NAMES_PGI pgf95 pgfortran pgf90 pgf77) - set(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90) - set(_Fortran_COMPILER_NAMES_XL xlf) - set(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf) - endif() - - _cmake_find_compiler(Fortran) - -else() - # we only get here if CMAKE_Fortran_COMPILER was specified using -D or a pre-made CMakeCache.txt - # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE - # if CMAKE_Fortran_COMPILER is a list of length 2, use the first item as - # CMAKE_Fortran_COMPILER and the 2nd one as CMAKE_Fortran_COMPILER_ARG1 - - list(LENGTH CMAKE_Fortran_COMPILER _CMAKE_Fortran_COMPILER_LIST_LENGTH) - if("${_CMAKE_Fortran_COMPILER_LIST_LENGTH}" EQUAL 2) - list(GET CMAKE_Fortran_COMPILER 1 CMAKE_Fortran_COMPILER_ARG1) - list(GET CMAKE_Fortran_COMPILER 0 CMAKE_Fortran_COMPILER) - endif() - - # if a compiler was specified by the user but without path, - # now try to find it with the full path - # if it is found, force it into the cache, - # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" - # if the C compiler already had a path, reuse it for searching the CXX compiler - get_filename_component(_CMAKE_USER_Fortran_COMPILER_PATH "${CMAKE_Fortran_COMPILER}" PATH) - if(NOT _CMAKE_USER_Fortran_COMPILER_PATH) - find_program(CMAKE_Fortran_COMPILER_WITH_PATH NAMES ${CMAKE_Fortran_COMPILER}) - mark_as_advanced(CMAKE_Fortran_COMPILER_WITH_PATH) - if(CMAKE_Fortran_COMPILER_WITH_PATH) - set(CMAKE_Fortran_COMPILER ${CMAKE_Fortran_COMPILER_WITH_PATH} - CACHE STRING "Fortran compiler" FORCE) - endif() - endif() -endif() - -mark_as_advanced(CMAKE_Fortran_COMPILER) - -# 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() + 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(NOT CMAKE_Fortran_COMPILER_ID_RUN) - set(CMAKE_Fortran_COMPILER_ID_RUN 1) + # next try prefer the compiler specified by the generator + if(CMAKE_GENERATOR_FC) + if(NOT CMAKE_Fortran_COMPILER_INIT) + set(CMAKE_Fortran_COMPILER_INIT ${CMAKE_GENERATOR_FC}) + endif() + endif() + + # finally list compilers to try + if(NOT CMAKE_Fortran_COMPILER_INIT) + # Known compilers: + # f77/f90/f95: generic compiler names + # g77: GNU Fortran 77 compiler + # gfortran: putative GNU Fortran 95+ compiler (in progress) + # fort77: native F77 compiler under HP-UX (and some older Crays) + # frt: Fujitsu F77 compiler + # pathf90/pathf95/pathf2003: PathScale Fortran compiler + # pgf77/pgf90/pgf95/pgfortran: Portland Group F77/F90/F95 compilers + # xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers + # lf95: Lahey-Fujitsu F95 compiler + # fl32: Microsoft Fortran 77 "PowerStation" compiler + # af77: Apogee F77 compiler for Intergraph hardware running CLIX + # epcf90: "Edinburgh Portable Compiler" F90 + # fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha + # ifc: Intel Fortran 95 compiler for Linux/x86 + # efc: Intel Fortran 95 compiler for IA64 + # + # The order is 95 or newer compilers first, then 90, + # then 77 or older compilers, gnu is always last in the group, + # so if you paid for a compiler it is picked by default. + set(CMAKE_Fortran_COMPILER_LIST + ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 pgfortran lf95 xlf95 + fort gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77 + frt pgf77 xlf fl32 af77 g77 f77 + ) + + # Vendor-specific compiler names. + set(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77) + set(_Fortran_COMPILER_NAMES_Intel ifort ifc efc) + set(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77) + set(_Fortran_COMPILER_NAMES_PGI pgf95 pgfortran pgf90 pgf77) + set(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90) + set(_Fortran_COMPILER_NAMES_XL xlf) + set(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf) + endif() + + _cmake_find_compiler(Fortran) + + else() + # we only get here if CMAKE_Fortran_COMPILER was specified using -D or a pre-made CMakeCache.txt + # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE + # if CMAKE_Fortran_COMPILER is a list of length 2, use the first item as + # CMAKE_Fortran_COMPILER and the 2nd one as CMAKE_Fortran_COMPILER_ARG1 + + list(LENGTH CMAKE_Fortran_COMPILER _CMAKE_Fortran_COMPILER_LIST_LENGTH) + if("${_CMAKE_Fortran_COMPILER_LIST_LENGTH}" EQUAL 2) + list(GET CMAKE_Fortran_COMPILER 1 CMAKE_Fortran_COMPILER_ARG1) + list(GET CMAKE_Fortran_COMPILER 0 CMAKE_Fortran_COMPILER) + endif() + + # if a compiler was specified by the user but without path, + # now try to find it with the full path + # if it is found, force it into the cache, + # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" + # if the C compiler already had a path, reuse it for searching the CXX compiler + get_filename_component(_CMAKE_USER_Fortran_COMPILER_PATH "${CMAKE_Fortran_COMPILER}" PATH) + if(NOT _CMAKE_USER_Fortran_COMPILER_PATH) + find_program(CMAKE_Fortran_COMPILER_WITH_PATH NAMES ${CMAKE_Fortran_COMPILER}) + mark_as_advanced(CMAKE_Fortran_COMPILER_WITH_PATH) + if(CMAKE_Fortran_COMPILER_WITH_PATH) + set(CMAKE_Fortran_COMPILER ${CMAKE_Fortran_COMPILER_WITH_PATH} + CACHE STRING "Fortran compiler" FORCE) + endif() + endif() + endif() + mark_as_advanced(CMAKE_Fortran_COMPILER) # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce @@ -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) @@ -187,6 +189,32 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) endif() endif() +if (NOT _CMAKE_TOOLCHAIN_LOCATION) + get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Fortran_COMPILER}" PATH) +endif () + +# if we have a fortran cross compiler, they have usually some prefix, like +# e.g. powerpc-linux-gfortran, arm-elf-gfortran or i586-mingw32msvc-gfortran , optionally +# with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2). +# The other tools of the toolchain usually have the same prefix +# NAME_WE cannot be used since then this test will fail for names lile +# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be +# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" +if (CMAKE_CROSSCOMPILING + AND "${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU" + AND NOT _CMAKE_TOOLCHAIN_PREFIX) + get_filename_component(COMPILER_BASENAME "${CMAKE_Fortran_COMPILER}" NAME) + if (COMPILER_BASENAME MATCHES "^(.+-)g?fortran(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + endif () + + # if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils + # but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.) + if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + endif () +endif () + include(CMakeFindBinUtils) if(MSVC_Fortran_ARCHITECTURE_ID) @@ -195,7 +223,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 3f430b477..c4217f552 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 669dd16b1..fa78da03c 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 22c501614..cd3344756 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/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake index 30d62bc38..c9f58e3f3 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 980cc17aa..207c8ad35 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 c7529fc8e..55f827773 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/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index 4b360f776..c37341411 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -100,6 +100,12 @@ # elif defined(_M_ARM) # define ARCHITECTURE_ID "ARM" +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + # else /* unknown architecture */ # define ARCHITECTURE_ID "" # endif diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake index 14291a7e7..2c751471a 100644 --- a/Modules/CMakeTestCCompiler.cmake +++ b/Modules/CMakeTestCCompiler.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2003-2009 Kitware, Inc. +# Copyright 2003-2012 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -12,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 5ed826b78..a5cdf5669 100644 --- a/Modules/CMakeTestCXXCompiler.cmake +++ b/Modules/CMakeTestCXXCompiler.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2003-2009 Kitware, Inc. +# Copyright 2003-2012 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -12,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 e580c1f6b..000000000 --- a/Modules/CMakeTestForFreeVC.cxx +++ /dev/null @@ -1,3 +0,0 @@ -#include - -int main(){return 0;} diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake index b388d1ec7..e26334514 100644 --- a/Modules/CMakeTestFortranCompiler.cmake +++ b/Modules/CMakeTestFortranCompiler.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2004-2009 Kitware, Inc. +# Copyright 2004-2012 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -12,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 3cece2a63..000000000 --- a/Modules/CMakeTestNMakeCLVersion.c +++ /dev/null @@ -1,2 +0,0 @@ -VERSION=_MSC_VER - diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index b5826ef2f..0cec8973a 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -728,18 +728,24 @@ if(CPACK_RPM_USER_FILELIST_INTERNAL) set(CPACK_RPM_USER_INSTALL_FILES "") foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL) - string(REGEX REPLACE "%[A-Za-z\(\)]* " "" F_PATH ${F}) - string(REGEX MATCH "%[A-Za-z\(\)]*" F_PREFIX ${F}) + string(REGEX REPLACE "%[A-Za-z0-9\(\),-]* " "" F_PATH ${F}) + string(REGEX MATCH "%[A-Za-z0-9\(\),-]*" F_PREFIX ${F}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>") + endif() if(F_PREFIX) - set(F_PREFIX "${F_PREFIX} ") + set(F_PREFIX "${F_PREFIX} ") endif() # Rebuild the user list file set(CPACK_RPM_USER_INSTALL_FILES "${CPACK_RPM_USER_INSTALL_FILES}${F_PREFIX}\"${F_PATH}\"\n") # Remove from CPACK_RPM_INSTALL_FILES and CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${F_PATH}) - list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH}) + # ABSOLUTE destination files list may not exists at all + if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) + list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH}) + endif() endforeach() diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in new file mode 100644 index 000000000..ab4705fa3 --- /dev/null +++ b/Modules/CompilerId/VS-10.vcxproj.in @@ -0,0 +1,53 @@ + + + + + Debug + @id_arch@ + + + + {CAE07175-D007-4FC3-BFE8-47B392814159} + CompilerId@id_lang@ + Win32Proj + + + + Application + @id_toolset@ + MultiByte + + + + <_ProjectFileVersion>10.0.30319.1 + .\ + $(Configuration)\ + false + + + + Disabled + %(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDebugDLL + + + TurnOffAllWarnings + + + + + false + Console + @id_machine_10@ + + + for %%i in (@id_cl@) do %40echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i + + + + + + + diff --git a/Modules/CompilerId/VS-6.dsp.in b/Modules/CompilerId/VS-6.dsp.in new file mode 100644 index 000000000..4f7e67613 --- /dev/null +++ b/Modules/CompilerId/VS-6.dsp.in @@ -0,0 +1,48 @@ +# Microsoft Developer Studio Project File - Name="CompilerId@id_lang@" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 + +# TARGTYPE "Win32 (@id_machine_6@) Application" 0x0101 + +CFG=CompilerId@id_lang@ - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CompilerId@id_lang@.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CompilerId@id_lang@.mak" CFG="CompilerId@id_lang@ - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CompilerId@id_lang@ - Win32 Debug" (based on "Win32 (@id_machine_6@) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +CPP=cl.exe +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "." +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD CPP /nologo /MDd /c +LINK32=link.exe +# ADD LINK32 /nologo /version:0.0 /subsystem:console /machine:@id_machine_6@ /out:"CompilerId@id_lang@.exe" /IGNORE:4089 +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Cmds=for %%i in (@id_cl@) do @echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i +# End Special Build Tool +# Begin Target + +# Name "CompilerId@id_lang@ - Win32 Debug" +# Begin Group "Source Files" + +# Begin Source File + +SOURCE="@id_src@" +# End Source File +# End Group +# End Target +# End Project diff --git a/Modules/CompilerId/VS-7.vcproj.in b/Modules/CompilerId/VS-7.vcproj.in new file mode 100644 index 000000000..71bf64de2 --- /dev/null +++ b/Modules/CompilerId/VS-7.vcproj.in @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Modules/CompilerId/Xcode-1.pbxproj.in b/Modules/CompilerId/Xcode-1.pbxproj.in new file mode 100644 index 000000000..f06960fec --- /dev/null +++ b/Modules/CompilerId/Xcode-1.pbxproj.in @@ -0,0 +1,120 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + 014CEA460018CE2711CA2923 = { + buildSettings = { + }; + isa = PBXBuildStyle; + name = Development; + }; + 08FB7793FE84155DC02AAC07 = { + buildSettings = { + }; + buildStyles = ( + 014CEA460018CE2711CA2923, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 08FB7794FE84155DC02AAC07; + projectDirPath = ""; + targets = ( + 8DD76FA90486AB0100D96B5E, + ); + }; + 08FB7794FE84155DC02AAC07 = { + children = ( + 08FB7795FE84155DC02AAC07, + 1AB674ADFE9D54B511CA2CBB, + ); + isa = PBXGroup; + name = CompilerId@id_lang@; + refType = 4; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 = { + children = ( + 2C18F0B415DC1DC700593670, + ); + isa = PBXGroup; + name = Source; + refType = 4; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB = { + children = ( + 8DD76F6C0486A84900D96B5E, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = ""; + }; + 2C18F0B415DC1DC700593670 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = @id_type@; + path = @id_src@; + refType = 4; + sourceTree = ""; + }; + 2C18F0B615DC1E0300593670 = { + fileRef = 2C18F0B415DC1DC700593670; + isa = PBXBuildFile; + settings = { + }; + }; + 2C8FEB8E15DC1A1A00E56A5D = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"GCC_VERSION=$GCC_VERSION\""; + }; + 8DD76FA90486AB0100D96B5E = { + buildPhases = ( + 2C18F0B515DC1DCE00593670, + 2C8FEB8E15DC1A1A00E56A5D, + ); + buildRules = ( + ); + buildSettings = { + PRODUCT_NAME = CompilerId@id_lang@; + SYMROOT = .; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = CompilerId@id_lang@; + productName = CompilerId@id_lang@; + productReference = 8DD76F6C0486A84900D96B5E; + productType = "com.apple.product-type.tool"; + }; + 2C18F0B515DC1DCE00593670 = { + buildActionMask = 2147483647; + files = ( + 2C18F0B615DC1E0300593670, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8DD76F6C0486A84900D96B5E = { + explicitFileType = "compiled.mach-o.executable"; + includeInIndex = 0; + isa = PBXFileReference; + path = CompilerId@id_lang@; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; + }; + rootObject = 08FB7793FE84155DC02AAC07; +} diff --git a/Modules/CompilerId/Xcode-2.pbxproj.in b/Modules/CompilerId/Xcode-2.pbxproj.in new file mode 100644 index 000000000..e3c7aa910 --- /dev/null +++ b/Modules/CompilerId/Xcode-2.pbxproj.in @@ -0,0 +1,119 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + + 2C18F0B615DC1E0300593670 = {isa = PBXBuildFile; fileRef = 2C18F0B415DC1DC700593670; }; + 2C18F0B415DC1DC700593670 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = @id_type@; path = @id_src@; sourceTree = ""; }; + 8DD76F6C0486A84900D96B5E = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CompilerId@id_lang@; sourceTree = BUILT_PRODUCTS_DIR; }; + + 08FB7794FE84155DC02AAC07 = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07, + 1AB674ADFE9D54B511CA2CBB, + ); + name = CompilerId@id_lang@; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 = { + isa = PBXGroup; + children = ( + 2C18F0B415DC1DC700593670, + ); + name = Source; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB = { + isa = PBXGroup; + children = ( + 8DD76F6C0486A84900D96B5E, + ); + name = Products; + sourceTree = ""; + }; + + 8DD76FA90486AB0100D96B5E = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB928508733DD80010E9CD; + buildPhases = ( + 2C18F0B515DC1DCE00593670, + 2C8FEB8E15DC1A1A00E56A5D, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CompilerId@id_lang@; + productName = CompilerId@id_lang@; + productReference = 8DD76F6C0486A84900D96B5E; + productType = "com.apple.product-type.tool"; + }; + 08FB7793FE84155DC02AAC07 = { + isa = PBXProject; + buildConfigurationList = 1DEB928908733DD80010E9CD; + hasScannedForEncodings = 1; + mainGroup = 08FB7794FE84155DC02AAC07; + projectDirPath = ""; + targets = ( + 8DD76FA90486AB0100D96B5E, + ); + }; + 2C8FEB8E15DC1A1A00E56A5D = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"GCC_VERSION=$GCC_VERSION\""; + }; + 2C18F0B515DC1DCE00593670 = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2C18F0B615DC1E0300593670, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1DEB928608733DD80010E9CD = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = CompilerId@id_lang@; + }; + name = Debug; + }; + 1DEB928A08733DD80010E9CD = { + isa = XCBuildConfiguration; + buildSettings = { + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; + SYMROOT = .; + }; + name = Debug; + }; + 1DEB928508733DD80010E9CD = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB928608733DD80010E9CD, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 1DEB928908733DD80010E9CD = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB928A08733DD80010E9CD, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + }; + rootObject = 08FB7793FE84155DC02AAC07; +} diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in new file mode 100644 index 000000000..41ca7db72 --- /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 = ""; }; + 08FB7794FE84155DC02AAC07 = { + isa = PBXGroup; + children = ( + 2C18F0B415DC1DC700593670, + ); + name = CompilerId@id_lang@; + sourceTree = ""; + }; + 8DD76FA90486AB0100D96B5E = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB928508733DD80010E9CD; + buildPhases = ( + 2C18F0B515DC1DCE00593670, + 2C8FEB8E15DC1A1A00E56A5D, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CompilerId@id_lang@; + productName = CompilerId@id_lang@; + productType = "com.apple.product-type.tool"; + }; + 08FB7793FE84155DC02AAC07 = { + isa = PBXProject; + buildConfigurationList = 1DEB928908733DD80010E9CD; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76FA90486AB0100D96B5E, + ); + }; + 2C8FEB8E15DC1A1A00E56A5D = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"GCC_VERSION=$GCC_VERSION\""; + showEnvVarsInLog = 0; + }; + 2C18F0B515DC1DCE00593670 = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2C18F0B615DC1E0300593670, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1DEB928608733DD80010E9CD = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = CompilerId@id_lang@; + }; + name = Debug; + }; + 1DEB928A08733DD80010E9CD = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + ONLY_ACTIVE_ARCH = YES; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; + SYMROOT = .; + }; + 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/ExternalProject.cmake b/Modules/ExternalProject.cmake index cd77ba4e2..39236859b 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -24,7 +24,10 @@ # [HG_REPOSITORY url] # URL of mercurial repo # [HG_TAG tag] # Mercurial branch name, commit id or tag # [URL /.../src.tgz] # Full path or URL of source -# [URL_MD5 md5] # MD5 checksum of file at URL +# [URL_HASH ALGO=value] # Hash of file at URL +# [URL_MD5 md5] # Equivalent to URL_HASH MD5=md5 +# [TLS_VERIFY bool] # Should certificate for https be checked +# [TLS_CAINFO file] # Path to a certificate authority file # [TIMEOUT seconds] # Time allowed for file download operations # #--Update/Patch step---------- # [UPDATE_COMMAND cmd...] # Source work-tree update command @@ -184,6 +187,9 @@ if(_ep_func) set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$") endif() +# Save regex matching supported hash algorithm names. +set(_ep_hash_algos "MD5|SHA1|SHA224|SHA256|SHA384|SHA512") +set(_ep_hash_regex "^(${_ep_hash_algos})=([0-9A-Fa-f]+)$") function(_ep_parse_arguments f name ns args) # Transfer the arguments to this function into target properties for the @@ -395,7 +401,7 @@ endif() endfunction() -function(_ep_write_downloadfile_script script_filename remote local timeout md5) +function(_ep_write_downloadfile_script script_filename remote local timeout hash tls_verify tls_cainfo) if(timeout) set(timeout_args TIMEOUT ${timeout}) set(timeout_msg "${timeout} seconds") @@ -404,10 +410,31 @@ function(_ep_write_downloadfile_script script_filename remote local timeout md5) set(timeout_msg "none") endif() - if(md5) - set(md5_args EXPECTED_MD5 ${md5}) + if("${hash}" MATCHES "${_ep_hash_regex}") + set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}) else() - set(md5_args "# no EXPECTED_MD5") + set(hash_args "# no EXPECTED_HASH") + endif() + # check for curl globals in the project + if(DEFINED CMAKE_TLS_VERIFY) + set(tls_verify "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})") + endif() + if(DEFINED CMAKE_TLS_CAINFO) + set(tls_cainfo "set(CMAKE_TLS_CAINFO \"${CMAKE_TLS_CAINFO}\")") + endif() + + # now check for curl locals so that the local values + # will override the globals + + # check for tls_verify argument + string(LENGTH "${tls_verify}" tls_verify_len) + if(tls_verify_len GREATER 0) + set(tls_verify "set(CMAKE_TLS_VERIFY ${tls_verify})") + endif() + # check for tls_cainfo argument + string(LENGTH "${tls_cainfo}" tls_cainfo_len) + if(tls_cainfo_len GREATER 0) + set(tls_cainfo "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")") endif() file(WRITE ${script_filename} @@ -416,11 +443,14 @@ function(_ep_write_downloadfile_script script_filename remote local timeout md5) dst='${local}' timeout='${timeout_msg}'\") +${tls_verify} +${tls_cainfo} + file(DOWNLOAD \"${remote}\" \"${local}\" SHOW_PROGRESS - ${md5_args} + ${hash_args} ${timeout_args} STATUS status LOG log) @@ -443,48 +473,30 @@ message(STATUS \"downloading... done\") endfunction() -function(_ep_write_verifyfile_script script_filename local md5) - file(WRITE ${script_filename} -"message(STATUS \"verifying file... - file='${local}'\") - -set(verified 0) - -# If an expected md5 checksum exists, compare against it: -# -if(NOT \"${md5}\" STREQUAL \"\") - execute_process(COMMAND \${CMAKE_COMMAND} -E md5sum \"${local}\" - OUTPUT_VARIABLE ov - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE rv) - - if(NOT rv EQUAL 0) - message(FATAL_ERROR \"error: computing md5sum of '${local}' failed\") - endif() - - string(REGEX MATCH \"^([0-9A-Fa-f]+)\" md5_actual \"\${ov}\") - - string(TOLOWER \"\${md5_actual}\" md5_actual) - string(TOLOWER \"${md5}\" md5) - - if(NOT \"\${md5}\" STREQUAL \"\${md5_actual}\") - message(FATAL_ERROR \"error: md5sum of '${local}' does not match expected value - md5_expected: \${md5} - md5_actual: \${md5_actual} -\") - endif() - - set(verified 1) -endif() - -if(verified) +function(_ep_write_verifyfile_script script_filename local hash) + if("${hash}" MATCHES "${_ep_hash_regex}") + set(algo "${CMAKE_MATCH_1}") + string(TOLOWER "${CMAKE_MATCH_2}" expect_value) + set(script_content "set(expect_value \"${expect_value}\") +file(${algo} \"\${file}\" actual_value) +if(\"\${actual_value}\" STREQUAL \"\${expect_value}\") message(STATUS \"verifying file... done\") else() - message(STATUS \"verifying file... warning: did not verify file - no URL_MD5 checksum argument? corrupt file?\") -endif() -" -) - + message(FATAL_ERROR \"error: ${algo} hash of + \${file} +does not match expected value + expected: \${expect_value} + actual: \${actual_value} +\") +endif()") + else() + set(script_content "message(STATUS \"verifying file... warning: did not verify file - no URL_HASH specified?\")") + endif() + file(WRITE ${script_filename} "set(file \"${local}\") +message(STATUS \"verifying file... + file='\${file}'\") +${script_content} +") endfunction() @@ -1254,10 +1266,22 @@ function(_ep_add_download_command name) list(APPEND depends ${stamp_dir}/${name}-hginfo.txt) elseif(url) get_filename_component(work_dir "${source_dir}" PATH) + get_property(hash TARGET ${name} PROPERTY _EP_URL_HASH) + if(hash AND NOT "${hash}" MATCHES "${_ep_hash_regex}") + message(FATAL_ERROR "URL_HASH is set to\n ${hash}\n" + "but must be ALGO=value where ALGO is\n ${_ep_hash_algos}\n" + "and value is a hex string.") + endif() get_property(md5 TARGET ${name} PROPERTY _EP_URL_MD5) + if(md5 AND NOT "MD5=${md5}" MATCHES "${_ep_hash_regex}") + message(FATAL_ERROR "URL_MD5 is set to\n ${md5}\nbut must be a hex string.") + endif() + if(md5 AND NOT hash) + set(hash "MD5=${md5}") + endif() set(repository "external project URL") set(module "${url}") - set(tag "${md5}") + set(tag "${hash}") configure_file( "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in" "${stamp_dir}/${name}-urlinfo.txt" @@ -1283,7 +1307,10 @@ function(_ep_add_download_command name) string(REPLACE ";" "-" fname "${fname}") set(file ${download_dir}/${fname}) get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) - _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}" "${md5}") + get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY) + get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO) + _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" + "${url}" "${file}" "${timeout}" "${hash}" "${tls_verify}" "${tls_cainfo}") set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake COMMAND) set(comment "Performing download step (download, verify and extract) for '${name}'") @@ -1291,7 +1318,7 @@ function(_ep_add_download_command name) set(file "${url}") set(comment "Performing download step (verify and extract) for '${name}'") endif() - _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${md5}") + _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}") list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake COMMAND) _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${name}" "${file}" "${source_dir}") diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake index bc0357e98..4758534d7 100644 --- a/Modules/FindArmadillo.cmake +++ b/Modules/FindArmadillo.cmake @@ -76,7 +76,7 @@ endif () # Checks 'REQUIRED', 'QUIET' and versions. -include(FindPackageHandleStandardArgs) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(Armadillo REQUIRED_VARS ARMADILLO_LIBRARY ARMADILLO_INCLUDE_DIR VERSION_VAR ARMADILLO_VERSION_STRING) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 6a6be47c6..5a834b128 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -68,6 +68,13 @@ # CUDA_HOST_COMPILATION_CPP (Default ON) # -- Set to OFF for C compilation of host code. # +# CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER, $(VCInstallDir)/bin for VS) +# -- Set the host compiler to be used by nvcc. Ignored if -ccbin or +# --compiler-bindir is already present in the CUDA_NVCC_FLAGS or +# CUDA_NVCC_FLAGS_ variables. For Visual Studio targets +# $(VCInstallDir)/bin is a special value that expands out to the path when +# the command is run from withing VS. +# # CUDA_NVCC_FLAGS # CUDA_NVCC_FLAGS_ # -- Additional NVCC command line arguments. NOTE: multiple arguments must be @@ -390,6 +397,12 @@ option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON) # Extra user settable flags set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.") +if(CMAKE_GENERATOR MATCHES "Visual Studio") + set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC") +else() + set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC") +endif() + # Propagate the host flags to the host compiler via -Xcompiler option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" ON) @@ -900,14 +913,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 "") @@ -940,12 +945,11 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) endif() # This needs to be passed in at this stage, because VS needs to fill out the - # value of VCInstallDir from within VS. + # value of VCInstallDir from within VS. Note that CCBIN is only used if + # -ccbin or --compiler-bindir isn't used and CUDA_HOST_COMPILER matches + # $(VCInstallDir)/bin. if(CMAKE_GENERATOR MATCHES "Visual Studio") - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - # Add nvcc flag for 64b Windows - set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" ) - endif() + set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" ) endif() # Figure out which configure we will use and pass that in as an argument to @@ -1004,12 +1008,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) @@ -1018,27 +1022,31 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) if(CUDA_PROPAGATE_HOST_FLAGS) # nvcc chokes on -g3 in versions previous to 3.0, so replace it with -g - if(CMAKE_COMPILER_IS_GNUCC AND CUDA_VERSION VERSION_LESS "3.0") + set(_cuda_fix_g3 FALSE) + + if(CMAKE_COMPILER_IS_GNUCC) + if (CUDA_VERSION VERSION_LESS "3.0" OR + CUDA_VERSION VERSION_EQUAL "4.1" OR + CUDA_VERSION VERSION_EQUAL "4.2" + ) + set(_cuda_fix_g3 TRUE) + endif() + endif() + if(_cuda_fix_g3) string(REPLACE "-g3" "-g" _cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") else() set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") endif() - set(CUDA_HOST_FLAGS "${CUDA_HOST_FLAGS}\nset(CMAKE_HOST_FLAGS_${config_upper} ${_cuda_C_FLAGS})") + set(_cuda_host_flags "${_cuda_host_flags}\nset(CMAKE_HOST_FLAGS_${config_upper} ${_cuda_C_FLAGS})") endif() # Note that if we ever want CUDA_NVCC_FLAGS_ to be string (instead of a list # like it is currently), we can remove the quotes around the # ${CUDA_NVCC_FLAGS_${config_upper}} variable like the CMAKE_HOST_FLAGS_ variable. - set(CUDA_NVCC_FLAGS_CONFIG "${CUDA_NVCC_FLAGS_CONFIG}\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})") + set(_cuda_nvcc_flags_config "${_cuda_nvcc_flags_config}\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})") endforeach() - if(compile_to_ptx) - # Don't use any of the host compilation flags for PTX targets. - set(CUDA_HOST_FLAGS) - set(CUDA_NVCC_FLAGS_CONFIG) - endif() - # Get the list of definitions from the directory property get_directory_property(CUDA_NVCC_DEFINITIONS COMPILE_DEFINITIONS) if(CUDA_NVCC_DEFINITIONS) @@ -1061,6 +1069,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/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index 8274cc718..f0aac8487 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -62,6 +62,7 @@ set(cmake_dependency_file "@cmake_dependency_file@") # path set(CUDA_make2cmake "@CUDA_make2cmake@") # path set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path set(build_cubin @build_cubin@) # bool +set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # bool # We won't actually use these variables for now, but we need to set this, in # order to force this file to be run again if it changes. set(generated_file_path "@generated_file_path@") # path @@ -102,8 +103,15 @@ endif() # Add the build specific configuration flags list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}}) -if(DEFINED CCBIN) - set(CCBIN -ccbin "${CCBIN}") +# Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority +list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 ) +list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 ) +if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 ) + if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN) + set(CCBIN -ccbin "${CCBIN}") + else() + set(CCBIN -ccbin "${CUDA_HOST_COMPILER}") + endif() endif() # cuda_execute_process - Executes a command with optional command echo and status message. diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index e397d284f..daae94fad 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -94,7 +94,7 @@ if(FLEX_EXECUTABLE) # older versions of flex printed "/full/path/to/executable version X.Y" # newer versions use "basename(executable) X.Y" get_filename_component(FLEX_EXE_NAME "${FLEX_EXECUTABLE}" NAME) - string(REGEX REPLACE "^.*${FLEX_EXE_NAME}\"? (version )?([0-9]+[^ ]*)$" "\\2" + string(REGEX REPLACE "^.*${FLEX_EXE_NAME}\"? (version )?([0-9]+[^ ]*)( .*)?$" "\\2" FLEX_VERSION "${FLEX_version_output}") unset(FLEX_EXE_NAME) endif() diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index c7cf0eb6b..cdb46beff 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -46,9 +46,10 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h HINTS ENV FREETYPE_DIR PATHS - /usr/local/X11R6/include - /usr/local/X11/include - /usr/freeware/include + /usr/local/X11R6 + /usr/local/X11 + /usr/freeware + PATH_SUFFIXES include/freetype2 include ) find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake new file mode 100644 index 000000000..37dff0324 --- /dev/null +++ b/Modules/FindGLEW.cmake @@ -0,0 +1,30 @@ +# - Find the OpenGL Extension Wrangler Library (GLEW) +# This module defines the following variables: +# GLEW_INCLUDE_DIRS - include directories for GLEW +# GLEW_LIBRARIES - libraries to link against GLEW +# GLEW_FOUND - true if GLEW has been found and can be used + +#============================================================================= +# Copyright 2012 Benjamin Eikel +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +find_path(GLEW_INCLUDE_DIR GL/glew.h) +find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64) + +set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR}) +set(GLEW_LIBRARIES ${GLEW_LIBRARY}) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(GLEW + REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY) + +mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY) diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index c4774d94b..f1c78ae6d 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -54,12 +54,12 @@ if(GETTEXT_MSGMERGE_EXECUTABLE) unset(gettext_version) endif() -include(FindPackageHandleStandardArgs) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE VERSION_VAR GETTEXT_VERSION_STRING) -include(CMakeParseArguments) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) function(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name) set(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}") @@ -210,11 +210,4 @@ function(GETTEXT_PROCESS_PO_FILES _lang) endfunction() -if (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) - set(GETTEXT_FOUND TRUE) -else () - set(GETTEXT_FOUND FALSE) - if (GetText_REQUIRED) - message(FATAL_ERROR "GetText not found") - endif () -endif () +set(GETTEXT_FOUND ${Gettext_FOUND}) diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake index f8ea18bce..837e63324 100644 --- a/Modules/FindLibLZMA.cmake +++ b/Modules/FindLibLZMA.cmake @@ -47,13 +47,13 @@ endif() # it can be found in http://tukaani.org/xz/ # Avoid using old codebase if (LIBLZMA_LIBRARY) - include(CheckLibraryExists) + include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET) endif () -include(FindPackageHandleStandardArgs) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibLZMA REQUIRED_VARS LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY LIBLZMA_HAS_AUTO_DECODER diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake index 1f30fe3f1..4a5aaba41 100644 --- a/Modules/FindOpenSceneGraph.cmake +++ b/Modules/FindOpenSceneGraph.cmake @@ -145,23 +145,6 @@ if(OSG_INCLUDE_DIR) endif() endif() -# -# Version checking -# -if(OpenSceneGraph_FIND_VERSION AND OPENSCENEGRAPH_VERSION) - if(OpenSceneGraph_FIND_VERSION_EXACT) - if(NOT OPENSCENEGRAPH_VERSION VERSION_EQUAL ${OpenSceneGraph_FIND_VERSION}) - set(_osg_version_not_exact TRUE) - endif() - else() - # version is too low - if(NOT OPENSCENEGRAPH_VERSION VERSION_EQUAL ${OpenSceneGraph_FIND_VERSION} AND - NOT OPENSCENEGRAPH_VERSION VERSION_GREATER ${OpenSceneGraph_FIND_VERSION}) - set(_osg_version_not_high_enough TRUE) - endif() - endif() -endif() - set(_osg_quiet) if(OpenSceneGraph_FIND_QUIETLY) set(_osg_quiet "QUIET") @@ -190,63 +173,22 @@ if(OPENSCENEGRAPH_INCLUDE_DIR) endif() # -# Inform the users with an error message based on -# what version they have vs. what version was -# required. +# Check each module to see if it's found # +set(_osg_component_founds) if(OpenSceneGraph_FIND_REQUIRED) - set(_osg_version_output_type FATAL_ERROR) -else() - set(_osg_version_output_type STATUS) -endif() -if(_osg_version_not_high_enough) - set(_osg_EPIC_FAIL TRUE) - if(NOT OpenSceneGraph_FIND_QUIETLY) - message(${_osg_version_output_type} - "ERROR: Version ${OpenSceneGraph_FIND_VERSION} or higher of the OSG " - "is required. Version ${OPENSCENEGRAPH_VERSION} was found.") - endif() -elseif(_osg_version_not_exact) - set(_osg_EPIC_FAIL TRUE) - if(NOT OpenSceneGraph_FIND_QUIETLY) - message(${_osg_version_output_type} - "ERROR: Version ${OpenSceneGraph_FIND_VERSION} of the OSG is required " - "(exactly), version ${OPENSCENEGRAPH_VERSION} was found.") - endif() -else() - - # - # Check each module to see if it's found - # - if(OpenSceneGraph_FIND_REQUIRED) - set(_osg_missing_message) - foreach(_osg_module ${_osg_modules_to_process}) - string(TOUPPER ${_osg_module} _osg_module_UC) - if(NOT ${_osg_module_UC}_FOUND) - set(_osg_missing_nodekit_fail true) - set(_osg_missing_message "${_osg_missing_message} ${_osg_module}") - endif() - endforeach() - - if(_osg_missing_nodekit_fail) - message(FATAL_ERROR "ERROR: Missing the following osg " - "libraries: ${_osg_missing_message}.\n" - "Consider using CMAKE_PREFIX_PATH or the OSG_DIR " - "environment variable. See the " - "${CMAKE_CURRENT_LIST_FILE} for more details.") - endif() - endif() - - include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph DEFAULT_MSG OPENSCENEGRAPH_LIBRARIES OPENSCENEGRAPH_INCLUDE_DIR) + foreach(_osg_module ${_osg_modules_to_process}) + string(TOUPPER ${_osg_module} _osg_module_UC) + list(APPEND _osg_component_founds ${_osg_module_UC}_FOUND) + endforeach() endif() -if(_osg_EPIC_FAIL) - # Zero out everything, we didn't meet version requirements - set(OPENSCENEGRAPH_FOUND FALSE) - set(OPENSCENEGRAPH_LIBRARIES) - set(OPENSCENEGRAPH_INCLUDE_DIR) -endif() +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph + REQUIRED_VARS OPENSCENEGRAPH_LIBRARIES OPENSCENEGRAPH_INCLUDE_DIR ${_osg_component_founds} + VERSION_VAR OPENSCENEGRAPH_VERSION) + +unset(_osg_component_founds) set(OPENSCENEGRAPH_INCLUDE_DIRS ${OPENSCENEGRAPH_INCLUDE_DIR}) diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index b9440a8f3..6a1d349fa 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -146,7 +146,7 @@ if (PostgreSQL_INCLUDE_DIR AND EXISTS "${PostgreSQL_INCLUDE_DIR}/pg_config.h") endif() # Did we find anything? -include(FindPackageHandleStandardArgs) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(PostgreSQL REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR VERSION_VAR PostgreSQL_VERSION_STRING) diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index eeeaf5958..13f18fe7a 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -1,7 +1,7 @@ -# - Searches for all installed versions of QT. +# - Searches for all installed versions of Qt. # This should only be used if your project can work with multiple -# versions of QT. If not, you should just directly use FindQt4 or FindQt3. -# If multiple versions of QT are found on the machine, then +# versions of Qt. If not, you should just directly use FindQt4 or FindQt3. +# If multiple versions of Qt are found on the machine, then # The user must set the option DESIRED_QT_VERSION to the version # they want to use. If only one version of qt is found on the machine, # then the DESIRED_QT_VERSION is set to that version and the @@ -10,7 +10,7 @@ # is included. # # QT_REQUIRED if this is set to TRUE then if CMake can -# not find QT4 or QT3 an error is raised +# not find Qt4 or Qt3 an error is raised # and a message is sent to the user. # # DESIRED_QT_VERSION OPTION is created @@ -62,7 +62,7 @@ if(QT_QMAKE_EXECUTABLE_FINDQT) exec_program(${QT_QMAKE_EXECUTABLE_FINDQT} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) if(QTVERSION MATCHES "4.*") - set(QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE_FINDQT} CACHE PATH "QT4 qmake program.") + set(QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE_FINDQT} CACHE PATH "Qt4 qmake program.") set(QT4_INSTALLED TRUE) endif() if(QTVERSION MATCHES "Unknown") @@ -115,14 +115,14 @@ endif() if(QT3_INSTALLED AND QT4_INSTALLED ) # force user to pick if we have both - set(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of QT to use: 3 or 4") + set(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of Qt to use: 3 or 4") else() # if only one found then pick that one if(QT3_INSTALLED) - set(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of QT to use: 3 or 4") + set(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of Qt to use: 3 or 4") endif() if(QT4_INSTALLED) - set(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of QT to use: 3 or 4") + set(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of Qt to use: 3 or 4") endif() endif() @@ -139,21 +139,21 @@ endif() if(NOT QT3_INSTALLED AND NOT QT4_INSTALLED) if(QT_REQUIRED) - message(SEND_ERROR "CMake was unable to find any QT versions, put qmake in your path, or set QT_QMAKE_EXECUTABLE.") + message(SEND_ERROR "CMake was unable to find any Qt versions, put qmake in your path, or set QT_QMAKE_EXECUTABLE.") endif() else() if(NOT QT_FOUND AND NOT DESIRED_QT_VERSION) if(QT_REQUIRED) - message(SEND_ERROR "Multiple versions of QT found please set DESIRED_QT_VERSION") + message(SEND_ERROR "Multiple versions of Qt found please set DESIRED_QT_VERSION") else() - message("Multiple versions of QT found please set DESIRED_QT_VERSION") + message("Multiple versions of Qt found please set DESIRED_QT_VERSION") endif() endif() if(NOT QT_FOUND AND DESIRED_QT_VERSION) if(QT_REQUIRED) - message(FATAL_ERROR "CMake was unable to find QT version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE, if those are set then QT_QT_LIBRARY or QT_LIBRARY_DIR.") + message(FATAL_ERROR "CMake was unable to find Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE, if those are set then QT_QT_LIBRARY or QT_LIBRARY_DIR.") else() - message( "CMake was unable to find desired QT version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE.") + message( "CMake was unable to find desired Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE.") endif() endif() endif() diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index 066506305..07b6fef34 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -144,7 +144,7 @@ find_library(QT_QASSISTANTCLIENT_LIBRARY lib ) -# qt 3 should prefer QTDIR over the PATH +# Qt 3 should prefer QTDIR over the PATH find_program(QT_MOC_EXECUTABLE NAMES moc-qt3 moc HINTS @@ -168,7 +168,7 @@ if(QT_MOC_EXECUTABLE) set ( QT_WRAP_CPP "YES") endif() -# qt 3 should prefer QTDIR over the PATH +# Qt 3 should prefer QTDIR over the PATH find_program(QT_UIC_EXECUTABLE NAMES uic-qt3 uic HINTS diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index f133ae9e2..a84074b53 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -1,4 +1,4 @@ -# - Find QT 4 +# - Find Qt 4 # This module can be used to find Qt4. # The most important issue is that the Qt4 qmake is available via the system path. # This qmake is then used to detect basically everything else. @@ -482,7 +482,7 @@ endmacro () function(_QT4_QUERY_QMAKE VAR RESULT) execute_process(COMMAND "${QT_QMAKE_EXECUTABLE}" -query ${VAR} RESULT_VARIABLE return_code - OUTPUT_VARIABLE output ERROR_VARIABLE output + OUTPUT_VARIABLE output OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE) if(NOT return_code) file(TO_CMAKE_PATH "${output}" output) @@ -885,6 +885,18 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) NAMES ${QT_MODULE}${QT_LIBINFIX}_debug ${QT_MODULE}${QT_LIBINFIX}d ${QT_MODULE}${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) + if(QT_${_upper_qt_module}_LIBRARY_RELEASE MATCHES "/${QT_MODULE}\\.framework$") + if(NOT EXISTS "${QT_${_upper_qt_module}_LIBRARY_RELEASE}/${QT_MODULE}") + # Release framework library file does not exist... Force to NOTFOUND: + set(QT_${_upper_qt_module}_LIBRARY_RELEASE "QT_${_upper_qt_module}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library." FORCE) + endif() + endif() + if(QT_${_upper_qt_module}_LIBRARY_DEBUG MATCHES "/${QT_MODULE}\\.framework$") + if(NOT EXISTS "${QT_${_upper_qt_module}_LIBRARY_DEBUG}/${QT_MODULE}") + # Debug framework library file does not exist... Force to NOTFOUND: + set(QT_${_upper_qt_module}_LIBRARY_DEBUG "QT_${_upper_qt_module}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library." FORCE) + endif() + endif() endforeach() # QtUiTools is sometimes not in the same directory as the other found libraries diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index 487c5d346..adaec95a2 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -133,10 +133,12 @@ endif() if(SDL_LIBRARY_TEMP) # For SDLmain - if(NOT SDL_BUILDING_LIBRARY) - if(SDLMAIN_LIBRARY) - set(SDL_LIBRARY_TEMP ${SDLMAIN_LIBRARY} ${SDL_LIBRARY_TEMP}) + if(SDLMAIN_LIBRARY AND NOT SDL_BUILDING_LIBRARY) + list(FIND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" _SDL_MAIN_INDEX) + if(_SDL_MAIN_INDEX EQUAL -1) + list(APPEND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}") endif() + unset(_SDL_MAIN_INDEX) endif() # For OS X, SDL uses Cocoa as a backend so it must link to Cocoa. diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 50ba80ba6..2bb7a2076 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -57,6 +57,10 @@ if("${_help}" MATCHES "GNU ld .* 2\\.1[1-6]") set(__WINDOWS_GNU_LD_RESPONSE 0) endif() +if(NOT CMAKE_GENERATOR_RC AND CMAKE_GENERATOR MATCHES "Unix Makefiles") + set(CMAKE_GENERATOR_RC windres) +endif() + enable_language(RC) macro(__windows_compiler_gnu lang) diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index 337055742..3a30a2e0c 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 000000000..e81df9f83 --- /dev/null +++ b/Modules/Platform/Windows-MSVC-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-MSVC) +__windows_compiler_msvc(C) diff --git a/Modules/Platform/Windows-MSVC-CXX.cmake b/Modules/Platform/Windows-MSVC-CXX.cmake new file mode 100644 index 000000000..fdd1dae05 --- /dev/null +++ b/Modules/Platform/Windows-MSVC-CXX.cmake @@ -0,0 +1,3 @@ +include(Platform/Windows-MSVC) +set(_COMPILE_CXX " /TP") +__windows_compiler_msvc(CXX) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake new file mode 100644 index 000000000..cc48cfe29 --- /dev/null +++ b/Modules/Platform/Windows-MSVC.cmake @@ -0,0 +1,240 @@ + +#============================================================================= +# Copyright 2001-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_MSVC) + return() +endif() +set(__WINDOWS_MSVC 1) + +set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") +set(CMAKE_LINK_LIBRARY_FLAG "") +set(MSVC 1) + +# hack: if a new cmake (which uses CMAKE__LINKER) runs on an old build tree +# (where link was hardcoded) and where CMAKE_LINKER isn't in the cache +# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun) +# hardcode CMAKE_LINKER here to link, so it behaves as it did before, Alex +if(NOT DEFINED CMAKE_LINKER) + set(CMAKE_LINKER link) +endif() + +if(CMAKE_VERBOSE_MAKEFILE) + set(CMAKE_CL_NOLOGO) +else() + set(CMAKE_CL_NOLOGO "/nologo") +endif() + +set(WIN32 1) + +if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE") + set(CMAKE_CREATE_WIN32_EXE "/subsystem:windowsce /entry:WinMainCRTStartup") + set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /entry:mainACRTStartup") +else() + set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows") + set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console") +endif() + +if(CMAKE_GENERATOR MATCHES "Visual Studio 6") + set (CMAKE_NO_BUILD_TYPE 1) +endif() +if(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") + set (CMAKE_NO_BUILD_TYPE 1) + set (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING + "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") + mark_as_advanced(CMAKE_CONFIGURATION_TYPES) +endif() + +# make sure to enable languages after setting configuration types +enable_language(RC) +set(CMAKE_COMPILE_RESOURCE "rc /fo ") + +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") + set(MSVC_IDE 1) +else() + set(MSVC_IDE 0) +endif() + +if(NOT MSVC_VERSION) + if(CMAKE_C_COMPILER_VERSION) + set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) + else() + set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION}) + endif() + if("${_compiler_version}" MATCHES "^([0-9]+)\\.([0-9]+)") + math(EXPR MSVC_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}") + else() + message(FATAL_ERROR "MSVC compiler version not detected properly: ${_compiler_version}") + endif() + + set(MSVC10) + set(MSVC11) + set(MSVC60) + set(MSVC70) + set(MSVC71) + set(MSVC80) + set(MSVC90) + set(CMAKE_COMPILER_2005) + set(CMAKE_COMPILER_SUPPORTS_PDBTYPE) + if(NOT "${_compiler_version}" VERSION_LESS 17) + set(MSVC11 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 16) + set(MSVC10 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 15) + set(MSVC90 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 14) + set(MSVC80 1) + set(CMAKE_COMPILER_2005 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 13.10) + set(MSVC71 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 13) + set(MSVC70 1) + else() + set(MSVC60 1) + set(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + endif() +endif() + +if(MSVC_C_ARCHITECTURE_ID MATCHES 64) + 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(CMAKE_SYSTEM_NAME MATCHES "WindowsCE") + string(TOUPPER "${MSVC_C_ARCHITECTURE_ID}" _MSVC_C_ARCHITECTURE_ID_UPPER) + string(TOUPPER "${MSVC_CXX_ARCHITECTURE_ID}" _MSVC_CXX_ARCHITECTURE_ID_UPPER) + + if("${CMAKE_SYSTEM_VERSION}" MATCHES "^([0-9]+)\\.([0-9]+)") + math(EXPR _CE_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}") + elseif("${CMAKE_SYSTEM_VERSION}" STREQUAL "") + set(_CE_VERSION "500") + else() + message(FATAL_ERROR "Invalid Windows CE version: ${CMAKE_SYSTEM_VERSION}") + endif() + + set(_PLATFORM_DEFINES "/D_WIN32_WCE=0x${_CE_VERSION} /DUNDER_CE") + set(_PLATFORM_DEFINES_C " /D${MSVC_C_ARCHITECTURE_ID} /D_${_MSVC_C_ARCHITECTURE_ID_UPPER}_") + set(_PLATFORM_DEFINES_CXX " /D${MSVC_CXX_ARCHITECTURE_ID} /D_${_MSVC_CXX_ARCHITECTURE_ID_UPPER}_") + + set(_RTC1 "") + set(_FLAGS_CXX " /GR /EHsc") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib") + set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib") +else() + set(_PLATFORM_DEFINES "/DWIN32") + + if(MSVC_VERSION GREATER 1310) + set(_RTC1 "/RTC1") + set(_FLAGS_CXX " /GR /EHsc") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib") + else() + set(_RTC1 "/GZ") + set(_FLAGS_CXX " /GR /GX") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + endif() +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() +if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE") + if(_MACHINE_ARCH_FLAG MATCHES "ARM") + set(_MACHINE_ARCH_FLAG "THUMB") + elseif(_MACHINE_ARCH_FLAG MATCHES "SH") + set(_MACHINE_ARCH_FLAG "SH4") + endif() +endif() +set (CMAKE_EXE_LINKER_FLAGS_INIT + "${CMAKE_EXE_LINKER_FLAGS_INIT} /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 " -E vs_link_dll ") + set(_CMAKE_VS_LINK_EXE " -E vs_link_exe ") + endif() + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "${_CMAKE_VS_LINK_DLL} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll /version:. ${CMAKE_END_TEMP_FILE}") + + set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY " /lib ${CMAKE_CL_NOLOGO} /out: ") + + set(CMAKE_${lang}_COMPILE_OBJECT + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo /Fd -c ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} -E ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /FoNUL /FAs /Fa /c ${CMAKE_END_TEMP_FILE}") + + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) + set(CMAKE_${lang}_LINK_EXECUTABLE + "${_CMAKE_VS_LINK_EXE} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /Fd -link /implib: /version:. ${CMAKE_END_TEMP_FILE}") + + set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3 /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 05df9467a..000000000 --- a/Modules/Platform/Windows-cl.cmake +++ /dev/null @@ -1,253 +0,0 @@ -# try to load any previously computed information for C on this platform -include( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL) -# try to load any previously computed information for CXX on this platform -include( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL) - -set(WIN32 1) - -include(Platform/cl) - -set(CMAKE_CREATE_WIN32_EXE /subsystem:windows) -set(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) - -if(CMAKE_GENERATOR MATCHES "Visual Studio 6") - set (CMAKE_NO_BUILD_TYPE 1) -endif() -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 /fo ") - -# for nmake we need to compute some information about the compiler -# that is being used. -# the compiler may be free command line, 6, 7, or 71, and -# each have properties that must be determined. -# to avoid running these tests with each cmake run, the -# test results are saved in CMakeCPlatform.cmake, a file -# that is automatically copied into try_compile directories -# by the global generator. -set(MSVC_IDE 1) -if(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") - set(MSVC_IDE 0) - if(NOT CMAKE_VC_COMPILER_TESTS_RUN) - set(CMAKE_VC_COMPILER_TESTS 1) - set(testNmakeCLVersionFile - "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") - string(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") - message(STATUS "Check for CL compiler version") - set(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER}) - if (NOT CMAKE_C_COMPILER) - set(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER}) - endif() - 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 " -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") - set(CMAKE_CXX_CREATE_SHARED_MODULE " -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}") - # create a C shared library - set(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") - # create a C shared module just copy the shared library rule - set(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") - set(CMAKE_CXX_LINK_EXECUTABLE " -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}") - set(CMAKE_C_LINK_EXECUTABLE " -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}") - - set(CMAKE_BUILD_TYPE_INIT Debug) - set (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR") - set (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") - set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") - set (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - set (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") - set (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") - set (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") - set (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - set (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ") - set (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}") -else() - 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 4f3ec3ee8..000000000 --- a/Modules/Platform/Windows-cl.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -set(CMAKE_VC_COMPILER_TESTS_RUN 1) -set(CMAKE_COMPILER_SUPPORTS_PDBTYPE @CMAKE_COMPILER_SUPPORTS_PDBTYPE@) -set(CMAKE_COMPILER_2005 @CMAKE_COMPILER_2005@) -set(CMAKE_USING_VC_FREE_TOOLS @CMAKE_USING_VC_FREE_TOOLS@) -set(CMAKE_CL_64 @CMAKE_CL_64@) -set(MSVC60 @MSVC60@) -set(MSVC70 @MSVC70@) -set(MSVC71 @MSVC71@) -set(MSVC80 @MSVC80@) -set(MSVC90 @MSVC90@) -set(MSVC10 @MSVC10@) -set(MSVC_IDE @MSVC_IDE@) -set(MSVC_VERSION @MSVC_VERSION@) -set(WIN32 1) diff --git a/Modules/Platform/WindowsCE-MSVC-C.cmake b/Modules/Platform/WindowsCE-MSVC-C.cmake new file mode 100644 index 000000000..ce8060bed --- /dev/null +++ b/Modules/Platform/WindowsCE-MSVC-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-C) diff --git a/Modules/Platform/WindowsCE-MSVC-CXX.cmake b/Modules/Platform/WindowsCE-MSVC-CXX.cmake new file mode 100644 index 000000000..281eadc10 --- /dev/null +++ b/Modules/Platform/WindowsCE-MSVC-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-CXX) diff --git a/Modules/Platform/WindowsCE-MSVC.cmake b/Modules/Platform/WindowsCE-MSVC.cmake new file mode 100644 index 000000000..d28b4aba0 --- /dev/null +++ b/Modules/Platform/WindowsCE-MSVC.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC) diff --git a/Modules/Platform/WindowsCE.cmake b/Modules/Platform/WindowsCE.cmake new file mode 100644 index 000000000..65b2eaed4 --- /dev/null +++ b/Modules/Platform/WindowsCE.cmake @@ -0,0 +1 @@ +include(Platform/Windows) diff --git a/Modules/Platform/cl.cmake b/Modules/Platform/cl.cmake deleted file mode 100644 index 9e4d6070e..000000000 --- a/Modules/Platform/cl.cmake +++ /dev/null @@ -1,62 +0,0 @@ -set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") -set(CMAKE_LINK_LIBRARY_FLAG "") -set(MSVC 1) - -# hack: if a new cmake (which uses CMAKE__LINKER) runs on an old build tree -# (where link was hardcoded) and where CMAKE_LINKER isn't in the cache -# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun) -# hardcode CMAKE_LINKER here to link, so it behaves as it did before, Alex -if(NOT DEFINED CMAKE_LINKER) - set(CMAKE_LINKER link) -endif() - -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_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll /version:. ${CMAKE_END_TEMP_FILE}") -set(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) - -# create a C shared library -set(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") - -# create a C shared module -set(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") - -# create a C++ static library -set(CMAKE_CXX_CREATE_STATIC_LIBRARY " /lib ${CMAKE_CL_NOLOGO} /out: ") - -# create a C static library -set(CMAKE_C_CREATE_STATIC_LIBRARY "${CMAKE_CXX_CREATE_STATIC_LIBRARY}") - -# compile a C++ file into an object file -set(CMAKE_CXX_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP /Fo /Fd -c ${CMAKE_END_TEMP_FILE}") - -# compile a C file into an object file -set(CMAKE_C_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /Fo /Fd -c ${CMAKE_END_TEMP_FILE}") - -set(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) -set(CMAKE_C_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /Fd -link /implib: /version:. ${CMAKE_END_TEMP_FILE}") - -set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) -set(CMAKE_CXX_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /Fd -link /implib: /version:. ${CMAKE_END_TEMP_FILE}") - -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE - " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} -E ${CMAKE_END_TEMP_FILE}") - -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE - " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP -E ${CMAKE_END_TEMP_FILE}") - -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /FAs /FoNUL /Fa /c ${CMAKE_END_TEMP_FILE}") - -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP /FAs /FoNUL /Fa /c ${CMAKE_END_TEMP_FILE}") - diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 7c9dc9ef1..251d57c3d 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -187,15 +187,17 @@ 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(STRINGS "${infile}" _RC_FILES REGEX "]*>[^<]+") - foreach(_RC_FILE IN LISTS _RC_FILES) - string(REGEX REPLACE "^]*>([^<]*)" "\\1" _RC_FILE "${_RC_FILE}") + file(READ "${infile}" _RC_FILE_CONTENTS) + string(REGEX MATCHALL "]*>" "" _RC_FILE "${_RC_FILE}") if(NOT IS_ABSOLUTE "${_RC_FILE}") set(_RC_FILE "${rc_path}/${_RC_FILE}") endif() set(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}") endforeach() unset(_RC_FILES) + unset(_RC_FILE_CONTENTS) # Since this cmake macro is doing the dependency scanning for these files, # let's make a configured file and add it as a dependency so cmake is run # again when dependencies need to be recomputed. diff --git a/Modules/SquishTestScript.cmake b/Modules/SquishTestScript.cmake index 5cdd2123c..d5653051b 100644 --- a/Modules/SquishTestScript.cmake +++ b/Modules/SquishTestScript.cmake @@ -44,7 +44,7 @@ foreach(i ${squish_env_vars}) endforeach() if (QT4_INSTALLED) - # record qt lib directory + # record Qt lib directory set ( ENV{${SQUISH_LIBQTDIR}} ${squish_libqtdir} ) endif () diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index e79689b08..354f12341 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -183,6 +183,12 @@ set(SRCS cmFileTimeComparison.cxx cmFileTimeComparison.h cmGeneratedFileStream.cxx + cmGeneratorExpressionEvaluator.cxx + cmGeneratorExpressionEvaluator.h + cmGeneratorExpressionLexer.cxx + cmGeneratorExpressionLexer.h + cmGeneratorExpressionParser.cxx + cmGeneratorExpressionParser.h cmGeneratorExpression.cxx cmGeneratorExpression.h cmGeneratorTarget.cxx @@ -548,7 +554,7 @@ endif() # Qt GUI option(BUILD_QtDialog "Build Qt dialog for CMake" FALSE) if(BUILD_QtDialog) - subdirs(QtDialog) + add_subdirectory(QtDialog) endif() include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cda0163aa..7b6af1e0d 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 20120822) +set(CMake_VERSION_TWEAK 20120919) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index fab9a8cba..49cea2e05 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -18,6 +18,11 @@ #include +struct cmCTestSVN::Revision: public cmCTestVC::Revision +{ + cmCTestSVN::SVNInfo* SVNInfo; +}; + //---------------------------------------------------------------------------- cmCTestSVN::cmCTestSVN(cmCTest* ct, std::ostream& log): cmCTestGlobalVC(ct, log) @@ -44,8 +49,11 @@ void cmCTestSVN::CleanupImpl() class cmCTestSVN::InfoParser: public cmCTestVC::LineParser { public: - InfoParser(cmCTestSVN* svn, const char* prefix, std::string& rev): - SVN(svn), Rev(rev) + InfoParser(cmCTestSVN* svn, + const char* prefix, + std::string& rev, + SVNInfo& svninfo): + Rev(rev), SVNRepo(svninfo) { this->SetLog(&svn->Log, prefix); this->RegexRev.compile("^Revision: ([0-9]+)"); @@ -53,8 +61,8 @@ public: this->RegexRoot.compile("^Repository Root: +([^ ]+) *$"); } private: - cmCTestSVN* SVN; std::string& Rev; + cmCTestSVN::SVNInfo& SVNRepo; cmsys::RegularExpression RegexRev; cmsys::RegularExpression RegexURL; cmsys::RegularExpression RegexRoot; @@ -66,11 +74,11 @@ private: } else if(this->RegexURL.find(this->Line)) { - this->SVN->URL = this->RegexURL.match(1); + this->SVNRepo.URL = this->RegexURL.match(1); } else if(this->RegexRoot.find(this->Line)) { - this->SVN->Root = this->RegexRoot.match(1); + this->SVNRepo.Root = this->RegexRoot.match(1); } return true; } @@ -95,13 +103,13 @@ static bool cmCTestSVNPathStarts(std::string const& p1, std::string const& p2) } //---------------------------------------------------------------------------- -std::string cmCTestSVN::LoadInfo() +std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo) { // Run "svn info" to get the repository info from the work tree. const char* svn = this->CommandLineTool.c_str(); - const char* svn_info[] = {svn, "info", 0}; + const char* svn_info[] = {svn, "info", svninfo.LocalPath.c_str(), 0}; std::string rev; - InfoParser out(this, "info-out> ", rev); + InfoParser out(this, "info-out> ", rev, svninfo); OutputLogger err(this->Log, "info-err> "); this->RunChild(svn_info, &out, &err); return rev; @@ -110,55 +118,94 @@ std::string cmCTestSVN::LoadInfo() //---------------------------------------------------------------------------- void cmCTestSVN::NoteOldRevision() { - this->OldRevision = this->LoadInfo(); - this->Log << "Revision before update: " << this->OldRevision << "\n"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Old revision of repository is: " - << this->OldRevision << "\n"); + // Info for root repository + this->Repositories.push_back( SVNInfo("") ); + this->RootInfo = &(this->Repositories.back()); + // Info for the external repositories + this->LoadExternals(); + + // Get info for all the repositories + std::list::iterator itbeg = this->Repositories.begin(); + std::list::iterator itend = this->Repositories.end(); + for( ; itbeg != itend ; itbeg++) + { + SVNInfo& svninfo = *itbeg; + svninfo.OldRevision = this->LoadInfo(svninfo); + this->Log << "Revision for repository '" << svninfo.LocalPath + << "' before update: " << svninfo.OldRevision << "\n"; + cmCTestLog(this->CTest, HANDLER_OUTPUT, + " Old revision of external repository '" + << svninfo.LocalPath << "' is: " + << svninfo.OldRevision << "\n"); + } + + // Set the global old revision to the one of the root + this->OldRevision = this->RootInfo->OldRevision; this->PriorRev.Rev = this->OldRevision; } //---------------------------------------------------------------------------- void cmCTestSVN::NoteNewRevision() { - this->NewRevision = this->LoadInfo(); - this->Log << "Revision after update: " << this->NewRevision << "\n"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, " New revision of repository is: " - << this->NewRevision << "\n"); - - // this->Root = ""; // uncomment to test GuessBase - this->Log << "URL = " << this->URL << "\n"; - this->Log << "Root = " << this->Root << "\n"; - - // Compute the base path the working tree has checked out under - // the repository root. - if(!this->Root.empty() && cmCTestSVNPathStarts(this->URL, this->Root)) + // Get info for the external repositories + std::list::iterator itbeg = this->Repositories.begin(); + std::list::iterator itend = this->Repositories.end(); + for( ; itbeg != itend ; itbeg++) { - this->Base = cmCTest::DecodeURL(this->URL.substr(this->Root.size())); - this->Base += "/"; - } - this->Log << "Base = " << this->Base << "\n"; + SVNInfo& svninfo = *itbeg; + svninfo.NewRevision = this->LoadInfo(svninfo); + this->Log << "Revision for repository '" << svninfo.LocalPath + << "' after update: " << svninfo.NewRevision << "\n"; + cmCTestLog(this->CTest, HANDLER_OUTPUT, + " New revision of external repository '" + << svninfo.LocalPath << "' is: " + << svninfo.NewRevision << "\n"); + + // svninfo.Root = ""; // uncomment to test GuessBase + this->Log << "Repository '" << svninfo.LocalPath + << "' URL = " << svninfo.URL << "\n"; + this->Log << "Repository '" << svninfo.LocalPath + << "' Root = " << svninfo.Root << "\n"; + + // Compute the base path the working tree has checked out under + // the repository root. + if(!svninfo.Root.empty() + && cmCTestSVNPathStarts(svninfo.URL, svninfo.Root)) + { + svninfo.Base = cmCTest::DecodeURL( + svninfo.URL.substr(svninfo.Root.size())); + svninfo.Base += "/"; + } + this->Log << "Repository '" << svninfo.LocalPath + << "' Base = " << svninfo.Base << "\n"; + + } + + // Set the global new revision to the one of the root + this->NewRevision = this->RootInfo->NewRevision; } //---------------------------------------------------------------------------- -void cmCTestSVN::GuessBase(std::vector const& changes) +void cmCTestSVN::GuessBase(SVNInfo& svninfo, + std::vector const& changes) { // Subversion did not give us a good repository root so we need to // guess the base path from the URL and the paths in a revision with // changes under it. // Consider each possible URL suffix from longest to shortest. - for(std::string::size_type slash = this->URL.find('/'); - this->Base.empty() && slash != std::string::npos; - slash = this->URL.find('/', slash+1)) + for(std::string::size_type slash = svninfo.URL.find('/'); + svninfo.Base.empty() && slash != std::string::npos; + slash = svninfo.URL.find('/', slash+1)) { // If the URL suffix is a prefix of at least one path then it is the base. - std::string base = cmCTest::DecodeURL(this->URL.substr(slash)); + std::string base = cmCTest::DecodeURL(svninfo.URL.substr(slash)); for(std::vector::const_iterator ci = changes.begin(); - this->Base.empty() && ci != changes.end(); ++ci) + svninfo.Base.empty() && ci != changes.end(); ++ci) { if(cmCTestSVNPathStarts(ci->Path, base)) { - this->Base = base; + svninfo.Base = base; } } } @@ -167,25 +214,9 @@ void cmCTestSVN::GuessBase(std::vector const& changes) // base lie under its path. If no base was found then the working // tree must be a checkout of the entire repo and this will match // the leading slash in all paths. - this->Base += "/"; + svninfo.Base += "/"; - this->Log << "Guessed Base = " << this->Base << "\n"; -} - -//---------------------------------------------------------------------------- -const char* cmCTestSVN::LocalPath(std::string const& path) -{ - if(path.size() > this->Base.size() && - strncmp(path.c_str(), this->Base.c_str(), this->Base.size()) == 0) - { - // This path lies under the base, so return a relative path. - return path.c_str() + this->Base.size(); - } - else - { - // This path does not lie under the base, so ignore it. - return 0; - } + this->Log << "Guessed Base = " << svninfo.Base << "\n"; } //---------------------------------------------------------------------------- @@ -274,11 +305,13 @@ class cmCTestSVN::LogParser: public cmCTestVC::OutputLogger, private cmXMLParser { public: - LogParser(cmCTestSVN* svn, const char* prefix): - OutputLogger(svn->Log, prefix), SVN(svn) { this->InitializeParser(); } + LogParser(cmCTestSVN* svn, const char* prefix, SVNInfo& svninfo): + OutputLogger(svn->Log, prefix), SVN(svn), SVNRepo(svninfo) + { this->InitializeParser(); } ~LogParser() { this->CleanupParser(); } private: cmCTestSVN* SVN; + cmCTestSVN::SVNInfo& SVNRepo; typedef cmCTestSVN::Revision Revision; typedef cmCTestSVN::Change Change; @@ -300,6 +333,7 @@ private: if(strcmp(name, "logentry") == 0) { this->Rev = Revision(); + this->Rev.SVNInfo = &SVNRepo; if(const char* rev = this->FindAttribute(atts, "revision")) { this->Rev.Rev = rev; @@ -325,11 +359,13 @@ private: { if(strcmp(name, "logentry") == 0) { - this->SVN->DoRevision(this->Rev, this->Changes); + this->SVN->DoRevisionSVN(this->Rev, this->Changes); } else if(strcmp(name, "path") == 0 && !this->CData.empty()) { - this->CurChange.Path.assign(&this->CData[0], this->CData.size()); + std::string orig_path(&this->CData[0], this->CData.size()); + std::string new_path = SVNRepo.BuildLocalPath( orig_path ); + this->CurChange.Path.assign(new_path); this->Changes.push_back(this->CurChange); } else if(strcmp(name, "author") == 0 && !this->CData.empty()) @@ -355,37 +391,59 @@ private: //---------------------------------------------------------------------------- void cmCTestSVN::LoadRevisions() +{ + // Get revisions for all the external repositories + std::list::iterator itbeg = this->Repositories.begin(); + std::list::iterator itend = this->Repositories.end(); + for( ; itbeg != itend ; itbeg++) + { + SVNInfo& svninfo = *itbeg; + LoadRevisions(svninfo); + } +} + +//---------------------------------------------------------------------------- +void cmCTestSVN::LoadRevisions(SVNInfo &svninfo) { // We are interested in every revision included in the update. std::string revs; - if(atoi(this->OldRevision.c_str()) < atoi(this->NewRevision.c_str())) + if(atoi(svninfo.OldRevision.c_str()) < atoi(svninfo.NewRevision.c_str())) { - revs = "-r" + this->OldRevision + ":" + this->NewRevision; + revs = "-r" + svninfo.OldRevision + ":" + svninfo.NewRevision; } else { - revs = "-r" + this->NewRevision; + revs = "-r" + svninfo.NewRevision; } // Run "svn log" to get all global revisions of interest. const char* svn = this->CommandLineTool.c_str(); - const char* svn_log[] = {svn, "log", "--xml", "-v", revs.c_str(), 0}; + const char* svn_log[] = {svn, "log", "--xml", "-v", revs.c_str(), + svninfo.LocalPath.c_str(), 0}; { - LogParser out(this, "log-out> "); + LogParser out(this, "log-out> ", svninfo); OutputLogger err(this->Log, "log-err> "); this->RunChild(svn_log, &out, &err); } } //---------------------------------------------------------------------------- -void cmCTestSVN::DoRevision(Revision const& revision, - std::vector const& changes) +void cmCTestSVN::DoRevisionSVN(Revision const& revision, + std::vector const& changes) { // Guess the base checkout path from the changes if necessary. - if(this->Base.empty() && !changes.empty()) + if(this->RootInfo->Base.empty() && !changes.empty()) { - this->GuessBase(changes); + this->GuessBase(*this->RootInfo, changes); } + + // Ignore changes in the old revision for external repositories + if(revision.Rev == revision.SVNInfo->OldRevision + && revision.SVNInfo->LocalPath != "") + { + return; + } + this->cmCTestGlobalVC::DoRevision(revision, changes); } @@ -446,5 +504,81 @@ void cmCTestSVN::WriteXMLGlobal(std::ostream& xml) { this->cmCTestGlobalVC::WriteXMLGlobal(xml); - xml << "\t" << this->Base << "\n"; + xml << "\t" << this->RootInfo->Base << "\n"; +} + +//---------------------------------------------------------------------------- +class cmCTestSVN::ExternalParser: public cmCTestVC::LineParser +{ +public: + ExternalParser(cmCTestSVN* svn, const char* prefix): SVN(svn) + { + this->SetLog(&svn->Log, prefix); + this->RegexExternal.compile("^X..... +(.+)$"); + } +private: + cmCTestSVN* SVN; + cmsys::RegularExpression RegexExternal; + bool ProcessLine() + { + if(this->RegexExternal.find(this->Line)) + { + this->DoPath(this->RegexExternal.match(1)); + } + return true; + } + + void DoPath(std::string const& path) + { + // Get local path relative to the source directory + std::string local_path; + if(path.size() > this->SVN->SourceDirectory.size() && + strncmp(path.c_str(), this->SVN->SourceDirectory.c_str(), + this->SVN->SourceDirectory.size()) == 0) + { + local_path = path.c_str() + this->SVN->SourceDirectory.size() + 1; + } + else + { + local_path = path; + } + this->SVN->Repositories.push_back( SVNInfo(local_path.c_str()) ); + } +}; + +//---------------------------------------------------------------------------- +void cmCTestSVN::LoadExternals() +{ + // Run "svn status" to get the list of external repositories + const char* svn = this->CommandLineTool.c_str(); + const char* svn_status[] = {svn, "status", 0}; + ExternalParser out(this, "external-out> "); + OutputLogger err(this->Log, "external-err> "); + this->RunChild(svn_status, &out, &err); +} + +//---------------------------------------------------------------------------- +std::string cmCTestSVN::SVNInfo::BuildLocalPath(std::string const& path) const +{ + std::string local_path; + + // Add local path prefix if not empty + if (!this->LocalPath.empty()) + { + local_path += this->LocalPath; + local_path += "/"; + } + + // Add path with base prefix removed + if(path.size() > this->Base.size() && + strncmp(path.c_str(), this->Base.c_str(), this->Base.size()) == 0) + { + local_path += (path.c_str() + this->Base.size()); + } + else + { + local_path += path; + } + + return local_path; } diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index f72c58fb0..56265d008 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -33,24 +33,50 @@ private: virtual void NoteNewRevision(); virtual bool UpdateImpl(); - // URL of repository directory checked out in the working tree. - std::string URL; + // Information about an SVN repository (root repository or external) + struct SVNInfo { - // URL of repository root directory. - std::string Root; + SVNInfo(const char* path) : LocalPath(path) {} + // Remove base from the filename + std::string BuildLocalPath(std::string const& path) const; - // Directory under repository root checked out in working tree. - std::string Base; + // LocalPath relative to the main source directory. + std::string LocalPath; - std::string LoadInfo(); + // URL of repository directory checked out in the working tree. + std::string URL; + + // URL of repository root directory. + std::string Root; + + // Directory under repository root checked out in working tree. + std::string Base; + + // Old and new repository revisions. + std::string OldRevision; + std::string NewRevision; + + }; + + // Extended revision structure to include info about external it refers to. + struct Revision; + + // Info of all the repositories (root, externals and nested ones). + std::list Repositories; + + // Pointer to the infos of the root repository. + SVNInfo* RootInfo; + + std::string LoadInfo(SVNInfo& svninfo); + void LoadExternals(); void LoadModifications(); void LoadRevisions(); + void LoadRevisions(SVNInfo& svninfo); - void GuessBase(std::vector const& changes); - const char* LocalPath(std::string const& path); + void GuessBase(SVNInfo &svninfo, std::vector const& changes); - void DoRevision(Revision const& revision, - std::vector const& changes); + void DoRevisionSVN(Revision const& revision, + std::vector const& changes); void WriteXMLGlobal(std::ostream& xml); @@ -59,10 +85,12 @@ private: class LogParser; class StatusParser; class UpdateParser; + class ExternalParser; friend class InfoParser; friend class LogParser; friend class StatusParser; friend class UpdateParser; + friend class ExternalParser; }; #endif diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 0969aea01..a1ffa2076 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -9,115 +9,129 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -project(QtDialog) -set(QT_MIN_VERSION "4.4.0") -find_package(Qt4 REQUIRED) -if(NOT QT4_FOUND) - message(SEND_ERROR "Failed to find Qt 4.4 or greater.") +project(QtDialog) +find_package(Qt5Widgets QUIET) +if (Qt5Widgets_FOUND) + include_directories(${Qt5Widgets_INCLUDE_DIRS}) + add_definitions(${Qt5Widgets_DEFINITONS}) + macro(qt4_wrap_ui) + qt5_wrap_ui(${ARGN}) + endmacro() + macro(qt4_wrap_cpp) + qt5_wrap_cpp(${ARGN}) + endmacro() + macro(qt4_add_resources) + qt5_add_resources(${ARGN}) + endmacro() + set(QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) else() + set(QT_MIN_VERSION "4.4.0") + find_package(Qt4 REQUIRED) + if(NOT QT4_FOUND) + message(SEND_ERROR "Failed to find Qt 4.4 or greater.") + return() + endif() include(${QT_USE_FILE}) - set(CMAKE_PACKAGE_QTGUI TRUE) - set(SRCS - AddCacheEntry.cxx - AddCacheEntry.h - CMakeSetup.cxx - CMakeSetupDialog.cxx - CMakeSetupDialog.h - FirstConfigure.cxx - FirstConfigure.h - QCMake.cxx - QCMake.h - QCMakeCacheView.cxx - QCMakeCacheView.h - QCMakeWidgets.cxx - QCMakeWidgets.h - QMacInstallDialog.cxx - QMacInstallDialog.h - ) - QT4_WRAP_UI(UI_SRCS - CMakeSetupDialog.ui - Compilers.ui - CrossCompiler.ui - AddCacheEntry.ui - MacInstallDialog.ui - ) - QT4_WRAP_CPP(MOC_SRCS - AddCacheEntry.h - Compilers.h - CMakeSetupDialog.h - FirstConfigure.h - QCMake.h - QCMakeCacheView.h - QCMakeWidgets.h - QMacInstallDialog.h - ) - QT4_ADD_RESOURCES(RC_SRCS CMakeSetup.qrc) - - set(SRCS ${SRCS} ${UI_SRCS} ${MOC_SRCS} ${RC_SRCS}) - if(Q_WS_WIN) - set(SRCS ${SRCS} CMakeSetup.rc) - endif() - if(Q_WS_MAC) - set(SRCS ${SRCS} CMakeSetup.icns) - set(MACOSX_BUNDLE_ICON_FILE CMakeSetup.icns) - set_source_files_properties(CMakeSetup.icns PROPERTIES - MACOSX_PACKAGE_LOCATION Resources) - endif() - - include_directories(${CMAKE_CURRENT_BINARY_DIR}) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - - add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS}) - target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES}) - if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4) - if(APPLE) - set_target_properties(cmake-gui PROPERTIES - OUTPUT_NAME ${CMAKE_BUNDLE_NAME}) - endif() - set(CMAKE_INSTALL_DESTINATION_ARGS - BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}") - endif() - - install(TARGETS cmake-gui RUNTIME DESTINATION bin ${CMAKE_INSTALL_DESTINATION_ARGS}) - - if(UNIX) - # install a desktop file so CMake appears in the application start menu - # with an icon - install(FILES CMake.desktop DESTINATION share/applications ) - install(FILES CMakeSetup32.png DESTINATION share/pixmaps ) - install(FILES cmakecache.xml DESTINATION share/mime/packages ) - endif() - - if(APPLE) - set(CMAKE_POSTFLIGHT_SCRIPT - "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh") - set(CMAKE_POSTUPGRADE_SCRIPT - "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh") - configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postflight.sh.in" - "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh") - configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postupgrade.sh.in" - "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh") - install(CODE "execute_process(COMMAND ln -s \"../MacOS/${CMAKE_BUNDLE_NAME}\" cmake-gui - WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)") - endif() - - if(APPLE OR WIN32) - # install rules for including 3rd party libs such as Qt - # if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation - set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/cmake-gui${CMAKE_EXECUTABLE_SUFFIX}") - if(APPLE) - set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/${CMAKE_BUNDLE_NAME}") - endif() - install(CODE " - include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\") - set(BU_CHMOD_BUNDLE_ITEMS ON) - fixup_bundle(\"${fixup_exe}\" \"\" \"${QT_LIBRARY_DIR};${QT_BINARY_DIR}\") - ") - endif() - - configure_file("${QtDialog_SOURCE_DIR}/QtDialogCPack.cmake.in" - "${QtDialog_BINARY_DIR}/QtDialogCPack.cmake" @ONLY) endif() +set(SRCS + AddCacheEntry.cxx + AddCacheEntry.h + CMakeSetup.cxx + CMakeSetupDialog.cxx + CMakeSetupDialog.h + FirstConfigure.cxx + FirstConfigure.h + QCMake.cxx + QCMake.h + QCMakeCacheView.cxx + QCMakeCacheView.h + QCMakeWidgets.cxx + QCMakeWidgets.h + QMacInstallDialog.cxx + QMacInstallDialog.h + ) +QT4_WRAP_UI(UI_SRCS + CMakeSetupDialog.ui + Compilers.ui + CrossCompiler.ui + AddCacheEntry.ui + MacInstallDialog.ui + ) +QT4_WRAP_CPP(MOC_SRCS + AddCacheEntry.h + Compilers.h + CMakeSetupDialog.h + FirstConfigure.h + QCMake.h + QCMakeCacheView.h + QCMakeWidgets.h + QMacInstallDialog.h + ) +QT4_ADD_RESOURCES(RC_SRCS CMakeSetup.qrc) + +set(SRCS ${SRCS} ${UI_SRCS} ${MOC_SRCS} ${RC_SRCS}) +if(WIN32) + set(SRCS ${SRCS} CMakeSetup.rc) +endif() +if(APPLE) + set(SRCS ${SRCS} CMakeSetup.icns) + set(MACOSX_BUNDLE_ICON_FILE CMakeSetup.icns) + set_source_files_properties(CMakeSetup.icns PROPERTIES + MACOSX_PACKAGE_LOCATION Resources) +endif() + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS}) +target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES}) + +if(APPLE) + set_target_properties(cmake-gui PROPERTIES + OUTPUT_NAME ${CMAKE_BUNDLE_NAME}) +endif() +set(CMAKE_INSTALL_DESTINATION_ARGS + BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}") + +install(TARGETS cmake-gui RUNTIME DESTINATION bin ${CMAKE_INSTALL_DESTINATION_ARGS}) + +if(UNIX) + # install a desktop file so CMake appears in the application start menu + # with an icon + install(FILES CMake.desktop DESTINATION share/applications ) + install(FILES CMakeSetup32.png DESTINATION share/pixmaps ) + install(FILES cmakecache.xml DESTINATION share/mime/packages ) +endif() + +if(APPLE) + set(CMAKE_POSTFLIGHT_SCRIPT + "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh") + set(CMAKE_POSTUPGRADE_SCRIPT + "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh") + configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postflight.sh.in" + "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh") + configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postupgrade.sh.in" + "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh") + install(CODE "execute_process(COMMAND ln -s \"../MacOS/${CMAKE_BUNDLE_NAME}\" cmake-gui + WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)") +endif() + +if(APPLE OR WIN32) + # install rules for including 3rd party libs such as Qt + # if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation + set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/cmake-gui${CMAKE_EXECUTABLE_SUFFIX}") + if(APPLE) + set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/${CMAKE_BUNDLE_NAME}") + endif() + install(CODE " + include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\") + set(BU_CHMOD_BUNDLE_ITEMS ON) + fixup_bundle(\"${fixup_exe}\" \"\" \"${QT_LIBRARY_DIR};${QT_BINARY_DIR}\") + ") +endif() + +set(CMAKE_PACKAGE_QTGUI TRUE) +configure_file("${QtDialog_SOURCE_DIR}/QtDialogCPack.cmake.in" + "${QtDialog_BINARY_DIR}/QtDialogCPack.cmake" @ONLY) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index a2b1567bf..0d0118164 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -348,7 +348,11 @@ void QCMake::interrupt() bool QCMake::interruptCallback(void* cd) { QCMake* self = reinterpret_cast(cd); +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) return self->InterruptFlag; +#else + return self->InterruptFlag.load(); +#endif } void QCMake::progressCallback(const char* msg, float percent, void* cd) diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h index b330e68c8..c14456535 100644 --- a/Source/cmAddLibraryCommand.h +++ b/Source/cmAddLibraryCommand.h @@ -78,7 +78,9 @@ public: "functionality. " "If no type is given explicitly the type is STATIC or SHARED based " "on whether the current value of the variable BUILD_SHARED_LIBS is " - "true." + "true. " + "For SHARED and MODULE libraries the POSITION_INDEPENDENT_CODE " + "target property is set to TRUE automatically." "\n" "By default the library file will be created in the build tree " "directory corresponding to the source tree directory in which " diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index a65012905..07df7d5e0 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -21,7 +21,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( cmCustomCommand const& cc, const char* config, cmMakefile* mf): CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()), OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), - GE(new cmGeneratorExpression(mf, config, cc.GetBacktrace())) + GE(new cmGeneratorExpression(cc.GetBacktrace())) { } @@ -47,7 +47,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { return target->GetLocation(this->Config); } - return this->GE->Process(argv0); + return this->GE->Parse(argv0).Evaluate(this->Makefile, this->Config); } //---------------------------------------------------------------------------- @@ -58,7 +58,8 @@ cmCustomCommandGenerator cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c]; for(unsigned int j=1;j < commandLine.size(); ++j) { - std::string arg = this->GE->Process(commandLine[j]); + std::string arg = this->GE->Parse(commandLine[j]).Evaluate(this->Makefile, + this->Config); cmd += " "; if(this->OldStyle) { diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 545fe97e8..166a58461 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& 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; - - // Print verbose output. - if(this->Verbose) + // The dependee and depender both exist. Compare file times. + int result = 0; + if((!this->FileComparison->FileTimeCompare(depender, dependee, + &result) || result < 0)) { - cmOStringStream msg; - msg << "Dependee \"" << dependee - << "\" is newer than depender \"" - << depender << "\"." << std::endl; - cmSystemTools::Stdout(msg.str().c_str()); + // The depender is older than the dependee. + regenerate = true; + + // 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)) + { + // 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 100e187b4..f7dc8811e 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& validDeps); // Finalize the dependency information for the target. diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx index 1d849145c..ba0e8fbe6 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&) { return true; diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h index fe6fef50d..bf7e234dc 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& validDeps); + const char* internalDependsFileName, + std::map& validDeps); private: cmDependsJava(cmDependsJava const&); // Purposely not implemented. diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index c2197f2db..94cd5c2f6 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -282,6 +282,16 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "This variable is around for backwards compatibility, " "see CMAKE_BUILD_TOOL.",false, "Variables that Provide Information"); + cm->DefineProperty + ("CMAKE_VS_PLATFORM_TOOLSET", cmProperty::VARIABLE, + "Visual Studio Platform Toolset name.", + "VS 10 and above use MSBuild under the hood and support multiple " + "compiler toolchains. " + "CMake may specify a toolset explicitly, such as \"v110\" for " + "VS 11 or \"Windows7.1SDK\" for 64-bit support in VS 10 Express. " + "CMake provides the name of the chosen toolset in this variable." + ,false, + "Variables that Provide Information"); cm->DefineProperty ("CMAKE_MINOR_VERSION", cmProperty::VARIABLE, "The Minor version of cmake (i.e. the 4 in X.4.X).", @@ -372,12 +382,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "This is the list of libraries that are linked " "into all executables and libraries.",false, "Variables that Provide Information"); - cm->DefineProperty - ("CMAKE_USING_VC_FREE_TOOLS", cmProperty::VARIABLE, - "True if free visual studio tools being used.", - "This is set to true if the compiler is Visual " - "Studio free tools.",false, - "Variables that Provide Information"); cm->DefineProperty ("CMAKE_VERBOSE_MAKEFILE", cmProperty::VARIABLE, "Create verbose makefiles if on.", @@ -841,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" @@ -1365,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. " @@ -1395,8 +1399,30 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("CMAKE__COMPILER_ID", cmProperty::VARIABLE, - "An internal variable subject to change.", - "This is used in determining the compiler and is subject to change.", + "Compiler identification string.", + "A short string unique to the compiler vendor. " + "Possible values include:\n" + " Absoft = Absoft Fortran (absoft.com)\n" + " ADSP = Analog VisualDSP++ (analog.com)\n" + " Clang = LLVM Clang (clang.llvm.org)\n" + " Cray = Cray Compiler (cray.com)\n" + " Embarcadero, Borland = Embarcadero (embarcadero.com)\n" + " G95 = G95 Fortran (g95.org)\n" + " GNU = GNU Compiler Collection (gcc.gnu.org)\n" + " HP = Hewlett-Packard Compiler (hp.com)\n" + " Intel = Intel Compiler (intel.com)\n" + " MIPSpro = SGI MIPSpro (sgi.com)\n" + " MSVC = Microsoft Visual Studio (microsoft.com)\n" + " PGI = The Portland Group (pgroup.com)\n" + " PathScale = PathScale (pathscale.com)\n" + " SDCC = Small Device C Compiler (sdcc.sourceforge.net)\n" + " SunPro = Oracle Solaris Studio (oracle.com)\n" + " TI_DSP = Texas Instruments (ti.com)\n" + " TinyCC = Tiny C Compiler (tinycc.org)\n" + " Watcom = Open Watcom (openwatcom.org)\n" + " XL, VisualAge, zOS = IBM XL (ibm.com)\n" + "This variable is not guaranteed to be defined for all " + "compilers or languages.", false, "Variables for Languages"); @@ -1416,10 +1442,10 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("CMAKE__COMPILER_VERSION", cmProperty::VARIABLE, - "An internal variable subject to change.", + "Compiler version string.", "Compiler version in major[.minor[.patch[.tweak]]] format. " - "This variable is reserved for internal use by CMake and is not " - "guaranteed to be set.", + "This variable is not guaranteed to be defined for all " + "compilers or languages.", false, "Variables for Languages"); diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 1b042ae6f..c1360efca 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -148,13 +148,6 @@ static const char *cmDocumentationStandardSeeAlso[][3] = "The list is member-post-only but one may sign up on the CMake web page. " "Please first read the full documentation at " "http://www.cmake.org before posting questions to the list."}, - {0, - "Summary of helpful links:\n" - " Home: http://www.cmake.org\n" - " Docs: http://www.cmake.org/HTML/Documentation.html\n" - " Mail: http://www.cmake.org/HTML/MailingLists.html\n" - " FAQ: http://www.cmake.org/Wiki/CMake_FAQ\n" - , 0}, {0,0,0} }; diff --git a/Source/cmDocumentationFormatterDocbook.cxx b/Source/cmDocumentationFormatterDocbook.cxx index eabdbc128..706ce0a02 100644 --- a/Source/cmDocumentationFormatterDocbook.cxx +++ b/Source/cmDocumentationFormatterDocbook.cxx @@ -11,6 +11,14 @@ ============================================================================*/ #include "cmDocumentationFormatterDocbook.h" #include "cmDocumentationSection.h" +#include +#include // for isalnum + +static int cmIsAlnum(int c) +{ + return isalnum(c); +} + //---------------------------------------------------------------------------- // this function is a copy of the one in the HTML formatter @@ -94,151 +102,116 @@ void cmDocumentationPrintDocbookEscapes(std::ostream& os, const char* text) } } - +//---------------------------------------------------------------------------- cmDocumentationFormatterDocbook::cmDocumentationFormatterDocbook() :cmDocumentationFormatter() { } +//---------------------------------------------------------------------------- void cmDocumentationFormatterDocbook ::PrintSection(std::ostream& os, const cmDocumentationSection §ion, const char* name) { - if(name) - { - std::string id = "section_"; - id += name; - if (this->EmittedLinkIds.find(id) == this->EmittedLinkIds.end()) - { - this->EmittedLinkIds.insert(id); - os << "\n" - "\n" << name << "\n"; - } - else - { - static unsigned int i=0; - i++; - os << "\n" - "\n" << name << "\n"; - } - } + os << "PrintId(os, 0, name); + os << "\">\n" << name << "\n"; std::string prefix = this->ComputeSectionLinkPrefix(name); + const std::vector &entries = section.GetEntries(); - const std::vector &entries = - section.GetEntries(); - - if (!entries.empty()) - { - os << "\n"; - for(std::vector::const_iterator op - = entries.begin(); op != entries.end(); ++ op ) - { - if(op->Name.size()) - { - os << " Name.c_str()); - os << "\">"; - cmDocumentationPrintDocbookEscapes(os, op->Name.c_str()); - os << "\n"; - } - } - os << "\n" ; - } - + bool hasSubSections = false; for(std::vector::const_iterator op = entries.begin(); - op != entries.end();) + op != entries.end(); ++op) { if(op->Name.size()) { - for(;op != entries.end() && op->Name.size(); ++op) + hasSubSections = true; + break; + } + } + + bool inAbstract = false; + for(std::vector::const_iterator op = entries.begin(); + op != entries.end(); ++op) + { + if(op->Name.size()) + { + if(inAbstract) { - if(op->Name.size()) - { - os << " Name.c_str()); - - // make sure that each id exists only once. Since it seems - // not easily possible to determine which link refers to which id, - // we have at least to make sure that the duplicated id's get a - // different name (by appending an increasing number), Alex - std::string id = prefix; - id += "_"; - id += op->Name; - if (this->EmittedLinkIds.find(id) == this->EmittedLinkIds.end()) - { - this->EmittedLinkIds.insert(id); - } - else - { - static unsigned int i=0; - i++; - os << i; - } - // continue as normal... - - os << "\">"; - cmDocumentationPrintDocbookEscapes(os, op->Name.c_str()); - os << " "; - } - cmDocumentationPrintDocbookEscapes(os, op->Brief.c_str()); - if(op->Name.size()) - { - os << "\n"; - } - - if(op->Full.size()) - { - // a line break seems to be simply a line break with docbook - os << "\n "; - this->PrintFormatted(os, op->Full.c_str()); - } - os << "\n"; + os << "\n"; + inAbstract = false; } + os << "PrintId(os, prefix.c_str(), op->Name); + os << "\">\n"; + cmDocumentationPrintDocbookEscapes(os, op->Name.c_str()); + os << "\n"; + if(op->Full.size()) + { + os << "\n"; + cmDocumentationPrintDocbookEscapes(os, op->Brief.c_str()); + os << "\n\n"; + this->PrintFormatted(os, op->Full.c_str()); + } + else + { + this->PrintFormatted(os, op->Brief.c_str()); + } + os << "\n"; } else { + if(hasSubSections && op == entries.begin()) + { + os << "\n"; + inAbstract = true; + } this->PrintFormatted(os, op->Brief.c_str()); - os << "\n"; - ++op; } } - if(name) + + // empty sections are not allowed in docbook. + if(entries.empty()) { - os << "\n"; + os << "\n"; } -} -void cmDocumentationFormatterDocbook::PrintPreformatted(std::ostream& os, - const char* text) -{ - os << ""; - cmDocumentationPrintDocbookEscapes(os, text); - os << "\n "; -} - -void cmDocumentationFormatterDocbook::PrintParagraph(std::ostream& os, - const char* text) -{ - os << ""; - cmDocumentationPrintDocbookEscapes(os, text); - os << ""; + os << "\n"; } //---------------------------------------------------------------------------- -void cmDocumentationFormatterDocbook::PrintHeader(const char* docname, - const char* appname, - std::ostream& os) +void cmDocumentationFormatterDocbook +::PrintPreformatted(std::ostream& os, const char* text) { + os << "\n"; + cmDocumentationPrintDocbookEscapes(os, text); + os << "\n\n"; +} + +void cmDocumentationFormatterDocbook +::PrintParagraph(std::ostream& os, const char* text) +{ + os << ""; + cmDocumentationPrintDocbookEscapes(os, text); + os << "\n"; +} + +//---------------------------------------------------------------------------- +void cmDocumentationFormatterDocbook +::PrintHeader(const char* docname, const char* appname, std::ostream& os) +{ + this->Docname = docname; + // this one is used to ensure that we don't create multiple link targets // with the same name. We can clear it here since we are at the // start of a document here. this->EmittedLinkIds.clear(); os << "\n" - "\n" " ]>\n" "
\n" @@ -253,3 +226,29 @@ void cmDocumentationFormatterDocbook::PrintFooter(std::ostream& os) os << "
\n"; } +//---------------------------------------------------------------------------- +void cmDocumentationFormatterDocbook +::PrintId(std::ostream& os, const char* prefix, std::string id) +{ + std::replace_if(id.begin(), id.end(), + std::not1(std::ptr_fun(cmIsAlnum)), '_'); + if(prefix) + { + id = std::string(prefix) + "." + id; + } + os << this->Docname << '.' << id; + + // make sure that each id exists only once. Since it seems + // not easily possible to determine which link refers to which id, + // we have at least to make sure that the duplicated id's get a + // different name (by appending an increasing number), Alex + if (this->EmittedLinkIds.find(id) == this->EmittedLinkIds.end()) + { + this->EmittedLinkIds.insert(id); + } + else + { + static unsigned int i=0; + os << i++; + } +} diff --git a/Source/cmDocumentationFormatterDocbook.h b/Source/cmDocumentationFormatterDocbook.h index 213948dcc..0352d342a 100644 --- a/Source/cmDocumentationFormatterDocbook.h +++ b/Source/cmDocumentationFormatterDocbook.h @@ -35,7 +35,9 @@ public: virtual void PrintPreformatted(std::ostream& os, const char* text); virtual void PrintParagraph(std::ostream& os, const char* text); private: + void PrintId(std::ostream& os, const char* prefix, std::string id); std::set EmittedLinkIds; + std::string Docname; }; #endif diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index ad4ab76ee..b1bbd905d 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -636,9 +636,11 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, // the include directories for this target std::set uniqIncludeDirs; + cmGeneratorTarget *gtgt = this->GlobalGenerator + ->GetGeneratorTarget(target); std::vector includes; target->GetMakefile()->GetLocalGenerator()-> - GetIncludeDirectories(includes, target); + GetIncludeDirectories(includes, gtgt); for(std::vector::const_iterator dirIt=includes.begin(); dirIt != includes.end(); ++dirIt) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 1f976f7d9..f1d9c31a8 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -884,11 +884,13 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const it != this->GlobalGenerator->GetLocalGenerators().end(); ++it) { - cmTargets & targets = (*it)->GetMakefile()->GetTargets(); - for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l) + cmGeneratorTargetsType targets = (*it)->GetMakefile() + ->GetGeneratorTargets(); + for (cmGeneratorTargetsType::iterator l = targets.begin(); + l != targets.end(); ++l) { std::vector includeDirs; - (*it)->GetIncludeDirectories(includeDirs, &l->second); + (*it)->GetIncludeDirectories(includeDirs, l->second); this->AppendIncludeDirectories(fout, includeDirs, emmited); } } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 5103d395c..4d9eb7972 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -10,6 +10,7 @@ See the License for more information. ============================================================================*/ #include "cmFileCommand.h" +#include "cmCryptoHash.h" #include "cmake.h" #include "cmHexFileConverter.h" #include "cmInstallType.h" @@ -2666,7 +2667,11 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) long inactivity_timeout = 0; std::string verboseLog; std::string statusVar; - std::string expectedMD5sum; + bool tls_verify = this->Makefile->IsOn("CMAKE_TLS_VERIFY"); + const char* cainfo = this->Makefile->GetDefinition("CMAKE_TLS_CAINFO"); + std::string expectedHash; + std::string hashMatchMSG; + cmsys::auto_ptr hash; bool showProgress = false; while(i != args.end()) @@ -2717,6 +2722,32 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) } statusVar = *i; } + else if(*i == "TLS_VERIFY") + { + ++i; + if(i != args.end()) + { + tls_verify = cmSystemTools::IsOn(i->c_str()); + } + else + { + this->SetError("TLS_VERIFY missing bool value."); + return false; + } + } + else if(*i == "TLS_CAINFO") + { + ++i; + if(i != args.end()) + { + cainfo = i->c_str(); + } + else + { + this->SetError("TLS_CAFILE missing file value."); + return false; + } + } else if(*i == "EXPECTED_MD5") { ++i; @@ -2725,48 +2756,67 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) this->SetError("DOWNLOAD missing sum value for EXPECTED_MD5."); return false; } - expectedMD5sum = cmSystemTools::LowerCase(*i); + hash = cmsys::auto_ptr(cmCryptoHash::New("MD5")); + hashMatchMSG = "MD5 sum"; + expectedHash = cmSystemTools::LowerCase(*i); } else if(*i == "SHOW_PROGRESS") { showProgress = true; } + else if(*i == "EXPECTED_HASH") + { + ++i; + if(i != args.end()) + { + hash = cmsys::auto_ptr(cmCryptoHash::New(i->c_str())); + if(!hash.get()) + { + std::string err = "DOWNLOAD bad SHA type: "; + err += *i; + this->SetError(err.c_str()); + return false; + } + hashMatchMSG = *i; + hashMatchMSG += " hash"; + + ++i; + } + if(i != args.end()) + { + expectedHash = cmSystemTools::LowerCase(*i); + } + else + { + this->SetError("DOWNLOAD missing time for EXPECTED_HASH."); + return false; + } + } ++i; } - - // If file exists already, and caller specified an expected md5 sum, - // and the existing file already has the expected md5 sum, then simply + // If file exists already, and caller specified an expected md5 or sha, + // and the existing file already has the expected hash, then simply // return. // - if(cmSystemTools::FileExists(file.c_str()) && - !expectedMD5sum.empty()) + if(cmSystemTools::FileExists(file.c_str()) && hash.get()) { - char computedMD5[32]; - - if (!cmSystemTools::ComputeFileMD5(file.c_str(), computedMD5)) - { - this->SetError("DOWNLOAD cannot compute MD5 sum on pre-existing file"); - return false; - } - - std::string actualMD5sum = cmSystemTools::LowerCase( - std::string(computedMD5, 32)); - - if (expectedMD5sum == actualMD5sum) + std::string msg; + std::string actualHash = hash->HashFile(file.c_str()); + if(actualHash == expectedHash) { + msg = "returning early; file already exists with expected "; + msg += hashMatchMSG; + msg += "\""; if(statusVar.size()) { cmOStringStream result; - result << (int)0 << ";\"" - "returning early: file already exists with expected MD5 sum\""; + result << (int)0 << ";\"" << msg; this->Makefile->AddDefinition(statusVar.c_str(), result.str().c_str()); } - return true; } } - // Make sure parent directory exists so we can write to the file // as we receive downloaded bits from curl... // @@ -2798,7 +2848,6 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) } cURLEasyGuard g_curl(curl); - ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); check_curl_result(res, "DOWNLOAD cannot set url: "); @@ -2814,6 +2863,25 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) cmFileCommandCurlDebugCallback); check_curl_result(res, "DOWNLOAD cannot set debug function: "); + // check to see if TLS verification is requested + if(tls_verify) + { + res = ::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1); + check_curl_result(res, "Unable to set TLS/SSL Verify on: "); + } + else + { + res = ::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + check_curl_result(res, "Unable to set TLS/SSL Verify off: "); + } + // check to see if a CAINFO file has been specified + // command arg comes first + if(cainfo && *cainfo) + { + res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cainfo); + check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: "); + } + cmFileCommandVectorOfChar chunkDebug; res = ::curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&fout); @@ -2888,26 +2956,22 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) // Verify MD5 sum if requested: // - if (!expectedMD5sum.empty()) + if (hash.get()) { - char computedMD5[32]; - - if (!cmSystemTools::ComputeFileMD5(file.c_str(), computedMD5)) + std::string actualHash = hash->HashFile(file.c_str()); + if (actualHash.size() == 0) { - this->SetError("DOWNLOAD cannot compute MD5 sum on downloaded file"); + this->SetError("DOWNLOAD cannot compute hash on downloaded file"); return false; } - std::string actualMD5sum = cmSystemTools::LowerCase( - std::string(computedMD5, 32)); - - if (expectedMD5sum != actualMD5sum) + if (expectedHash != actualHash) { cmOStringStream oss; - oss << "DOWNLOAD MD5 mismatch" << std::endl + oss << "DOWNLOAD HASH mismatch" << std::endl << " for file: [" << file << "]" << std::endl - << " expected MD5 sum: [" << expectedMD5sum << "]" << std::endl - << " actual MD5 sum: [" << actualMD5sum << "]" << std::endl + << " expected hash: [" << expectedHash << "]" << std::endl + << " actual hash: [" << actualHash << "]" << std::endl ; this->SetError(oss.str().c_str()); return false; diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index ced26c49b..bd6f612f1 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -83,7 +83,9 @@ public: " file(TO_NATIVE_PATH path result)\n" " file(DOWNLOAD url file [INACTIVITY_TIMEOUT timeout]\n" " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS]\n" - " [EXPECTED_MD5 sum])\n" + " [EXPECTED_HASH MD5|SHA1|SHA224|SHA256|SHA384|SHA512 hash]\n" + " [EXPECTED_MD5 sum]\n" + " [TLS_VERIFY on|off] [TLS_CAINFO file])\n" " file(UPLOAD filename url [INACTIVITY_TIMEOUT timeout]\n" " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])\n" "WRITE will write a message into a file called 'filename'. It " @@ -168,11 +170,20 @@ public: "timeout after time seconds, time should be specified as an integer. " "The INACTIVITY_TIMEOUT specifies an integer number of seconds of " "inactivity after which the operation should terminate. " - "If EXPECTED_MD5 sum is specified, the operation will verify that the " - "downloaded file's actual md5 sum matches the expected value. If it " + "If EXPECTED_HASH is specified, the operation will verify that the " + "downloaded file's actual hash matches the expected value. If it " "does not match, the operation fails with an error. " + "(EXPECTED_MD5 is short-hand for EXPECTED_HASH MD5.) " "If SHOW_PROGRESS is specified, progress information will be printed " - "as status messages until the operation is complete." + "as status messages until the operation is complete. " + "For https URLs CMake must be built with OpenSSL. " + "TLS/SSL certificates are not checked by default. " + "Set TLS_VERIFY to ON to check certificates and/or use " + "EXPECTED_HASH to verify downloaded content. " + "Set TLS_CAINFO to specify a custom Certificate Authority file. " + "If either TLS option is not given CMake will check variables " + "CMAKE_TLS_VERIFY and CMAKE_TLS_CAINFO, " + "respectively." "\n" "UPLOAD will upload the given file to the given URL. " "If LOG var is specified a log of the upload will be put in var. " diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 92bbf1d82..0885616ad 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -16,233 +16,112 @@ #include +#include "cmGeneratorExpressionEvaluator.h" +#include "cmGeneratorExpressionLexer.h" +#include "cmGeneratorExpressionParser.h" + //---------------------------------------------------------------------------- cmGeneratorExpression::cmGeneratorExpression( - cmMakefile* mf, const char* config, - cmListFileBacktrace const& backtrace, bool quiet): - Makefile(mf), Config(config), Backtrace(backtrace), Quiet(quiet) + cmListFileBacktrace const& backtrace): + Backtrace(backtrace), CompiledExpression(0) { - this->TargetInfo.compile("^\\$$"); - this->TestConfig.compile("^\\$$"); } //---------------------------------------------------------------------------- -const char* cmGeneratorExpression::Process(std::string const& input) +const cmCompiledGeneratorExpression & +cmGeneratorExpression::Parse(std::string const& input) { - return this->Process(input.c_str()); + return this->Parse(input.c_str()); } //---------------------------------------------------------------------------- -const char* cmGeneratorExpression::Process(const char* input) +const cmCompiledGeneratorExpression & +cmGeneratorExpression::Parse(const char* input) { - this->Data.clear(); + cmGeneratorExpressionLexer l; + std::vector tokens = l.Tokenize(input); + bool needsParsing = l.GetSawGeneratorExpression(); + std::vector evaluators; - // We construct and evaluate expressions directly in the output - // buffer. Each expression is replaced by its own output value - // after evaluation. A stack of barriers records the starting - // indices of open (pending) expressions. - for(const char* c = input; *c; ++c) + if (needsParsing) { - if(c[0] == '$' && c[1] == '<') - { - this->Barriers.push(this->Data.size()); - this->Data.push_back('$'); - this->Data.push_back('<'); - c += 1; - } - else if(c[0] == '>' && !this->Barriers.empty()) - { - this->Data.push_back('>'); - if(!this->Evaluate()) { break; } - this->Barriers.pop(); - } - else - { - this->Data.push_back(c[0]); - } + cmGeneratorExpressionParser p(tokens); + p.Parse(evaluators); } - // Return a null-terminated output value. - this->Data.push_back('\0'); - return &*this->Data.begin(); + delete this->CompiledExpression; + this->CompiledExpression = new cmCompiledGeneratorExpression( + this->Backtrace, + evaluators, + input, + needsParsing); + return *this->CompiledExpression; +} + +cmGeneratorExpression::~cmGeneratorExpression() +{ + delete this->CompiledExpression; } //---------------------------------------------------------------------------- -bool cmGeneratorExpression::Evaluate() +const char *cmCompiledGeneratorExpression::Evaluate( + cmMakefile* mf, const char* config, bool quiet) const { - // The top-most barrier points at the beginning of the expression. - size_t barrier = this->Barriers.top(); - - // Construct a null-terminated representation of the expression. - this->Data.push_back('\0'); - const char* expr = &*(this->Data.begin()+barrier); - - // Evaluate the expression. - std::string result; - if(this->Evaluate(expr, result)) + if (!this->NeedsParsing) { - // Success. Replace the expression with its evaluation result. - this->Data.erase(this->Data.begin()+barrier, this->Data.end()); - this->Data.insert(this->Data.end(), result.begin(), result.end()); - return true; + return this->Input; } - else if(!this->Quiet) + + this->Output = ""; + + std::vector::const_iterator it + = this->Evaluators.begin(); + const std::vector::const_iterator end + = this->Evaluators.end(); + + cmGeneratorExpressionContext context; + context.Makefile = mf; + context.Config = config; + context.Quiet = quiet; + context.HadError = false; + context.Backtrace = this->Backtrace; + + for ( ; it != end; ++it) { - // Failure. Report the error message. - cmOStringStream e; - e << "Error evaluating generator expression:\n" - << " " << expr << "\n" - << result; - this->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), - this->Backtrace); - return false; + this->Output += (*it)->Evaluate(&context); + if (context.HadError) + { + this->Output = ""; + break; + } } - return true; + + this->Targets = context.Targets; + // TODO: Return a std::string from here instead? + return this->Output.c_str(); } +cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( + cmListFileBacktrace const& backtrace, + const std::vector &evaluators, + const char *input, bool needsParsing) + : Backtrace(backtrace), Evaluators(evaluators), Input(input), + NeedsParsing(needsParsing) +{ + +} + + //---------------------------------------------------------------------------- -static bool cmGeneratorExpressionBool(const char* c, std::string& result, - const char* name, - const char* a, const char* b) +cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression() { - result = a; - while((c[0] == '0' || c[0] == '1') && (c[1] == ',' || c[1] == '>')) + std::vector::const_iterator it + = this->Evaluators.begin(); + const std::vector::const_iterator end + = this->Evaluators.end(); + + for ( ; it != end; ++it) { - if(c[0] == b[0]) { result = b; } - c += 2; + delete *it; } - 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)) - { - if(!this->EvaluateTargetInfo(result)) - { - return false; - } - } - else if(strcmp(expr, "$") == 0) - { - 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, "$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."; - return false; - } - return true; -} - -//---------------------------------------------------------------------------- -bool cmGeneratorExpression::EvaluateTargetInfo(std::string& result) -{ - // Lookup the referenced target. - std::string name = this->TargetInfo.match(3); - cmTarget* target = this->Makefile->FindTargetToUse(name.c_str()); - if(!target) - { - result = "No target \"" + name + "\""; - return false; - } - if(target->GetType() >= cmTarget::UTILITY && - target->GetType() != cmTarget::UNKNOWN_LIBRARY) - { - result = "Target \"" + name + "\" is not an executable or library."; - return false; - } - this->Targets.insert(target); - - // Lookup the target file with the given purpose. - std::string purpose = this->TargetInfo.match(1); - if(purpose == "") - { - // The target implementation file (.so.1.2, .dll, .exe, .a). - result = target->GetFullPath(this->Config, false, true); - } - else if(purpose == "_LINKER") - { - // The file used to link to the target (.so, .lib, .a). - if(!target->IsLinkable()) - { - result = ("TARGET_LINKER_FILE is allowed only for libraries and " - "executables with ENABLE_EXPORTS."); - return false; - } - result = target->GetFullPath(this->Config, target->HasImportLibrary()); - } - else if(purpose == "_SONAME") - { - // The target soname file (.so.1). - if(target->IsDLLPlatform()) - { - result = "TARGET_SONAME_FILE is not allowed for DLL target platforms."; - return false; - } - if(target->GetType() != cmTarget::SHARED_LIBRARY) - { - result = "TARGET_SONAME_FILE is allowed only for SHARED libraries."; - return false; - } - result = target->GetDirectory(this->Config); - result += "/"; - result += target->GetSOName(this->Config); - } - - // Extract the requested portion of the full path. - std::string part = this->TargetInfo.match(2); - if(part == "_NAME") - { - result = cmSystemTools::GetFilenameName(result); - } - else if(part == "_DIR") - { - result = cmSystemTools::GetFilenamePath(result); - } - return true; } diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index a023eb0c9..b8467c27c 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -19,6 +19,10 @@ class cmTarget; class cmMakefile; class cmListFileBacktrace; +struct cmGeneratorExpressionEvaluator; + +class cmCompiledGeneratorExpression; + /** \class cmGeneratorExpression * \brief Evaluate generate-time query expression syntax. * @@ -31,29 +35,48 @@ class cmListFileBacktrace; class cmGeneratorExpression { public: - /** Construct with an evaluation context and configuration. */ - cmGeneratorExpression(cmMakefile* mf, const char* config, - cmListFileBacktrace const& backtrace, - bool quiet = false); + /** Construct. */ + cmGeneratorExpression(cmListFileBacktrace const& backtrace); + ~cmGeneratorExpression(); - /** Evaluate generator expressions in a string. */ - const char* Process(std::string const& input); - const char* Process(const char* input); + const cmCompiledGeneratorExpression& Parse(std::string const& input); + const cmCompiledGeneratorExpression& Parse(const char* input); + +private: + cmGeneratorExpression(const cmGeneratorExpression &); + void operator=(const cmGeneratorExpression &); + + cmListFileBacktrace const& Backtrace; + cmCompiledGeneratorExpression *CompiledExpression; +}; + +class cmCompiledGeneratorExpression +{ +public: + const char* Evaluate(cmMakefile* mf, const char* config, + bool quiet = false) const; /** Get set of targets found during evaluations. */ std::set const& GetTargets() const { return this->Targets; } + + ~cmCompiledGeneratorExpression(); + private: - cmMakefile* Makefile; - const char* Config; + cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, + const std::vector &evaluators, + const char *input, bool needsParsing); + + friend class cmGeneratorExpression; + + cmCompiledGeneratorExpression(const cmCompiledGeneratorExpression &); + void operator=(const cmCompiledGeneratorExpression &); + cmListFileBacktrace const& Backtrace; - bool Quiet; - std::vector Data; - std::stack Barriers; - cmsys::RegularExpression TargetInfo; - cmsys::RegularExpression TestConfig; - std::set Targets; - bool Evaluate(); - bool Evaluate(const char* expr, std::string& result); - bool EvaluateTargetInfo(std::string& result); + const std::vector Evaluators; + const char* const Input; + const bool NeedsParsing; + + mutable std::set Targets; + mutable std::string Output; }; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx new file mode 100644 index 000000000..acc844a39 --- /dev/null +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -0,0 +1,568 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmMakefile.h" + +#include "cmGeneratorExpressionEvaluator.h" +#include "cmGeneratorExpressionParser.h" + +//---------------------------------------------------------------------------- +static void reportError(cmGeneratorExpressionContext *context, + const std::string &expr, const std::string &result) +{ + context->HadError = true; + if (context->Quiet) + { + return; + } + + cmOStringStream e; + e << "Error evaluating generator expression:\n" + << " " << expr << "\n" + << result; + context->Makefile->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), + context->Backtrace); +} + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionNode +{ + virtual ~cmGeneratorExpressionNode() {} + + virtual bool GeneratesContent() const { return true; } + + virtual bool AcceptsSingleArbitraryContentParameter() const + { return false; } + + virtual int NumExpectedParameters() const { return 1; } + + virtual std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content + ) const = 0; +}; + +//---------------------------------------------------------------------------- +static const struct ZeroNode : public cmGeneratorExpressionNode +{ + ZeroNode() {} + + virtual bool GeneratesContent() const { return false; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *) const + { + // Unreachable + return std::string(); + } +} zeroNode; + +//---------------------------------------------------------------------------- +static const struct OneNode : public cmGeneratorExpressionNode +{ + OneNode() {} + + virtual bool AcceptsSingleArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *) const + { + // Unreachable + return std::string(); + } +} oneNode; + +//---------------------------------------------------------------------------- +#define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \ +static const struct OP ## Node : public cmGeneratorExpressionNode \ +{ \ + OP ## Node () {} \ +/* We let -1 carry the meaning 'at least one' */ \ + virtual int NumExpectedParameters() const { return -1; } \ + \ + std::string Evaluate(const std::vector ¶meters, \ + cmGeneratorExpressionContext *context, \ + const GeneratorExpressionContent *content) const \ + { \ + std::vector::const_iterator it = parameters.begin(); \ + const std::vector::const_iterator end = parameters.end(); \ + for ( ; it != end; ++it) \ + { \ + if (*it == #FAILURE_VALUE) \ + { \ + return #FAILURE_VALUE; \ + } \ + else if (*it != #SUCCESS_VALUE) \ + { \ + reportError(context, content->GetOriginalExpression(), \ + "Parameters to $<" #OP "> must resolve to either '0' or '1'."); \ + return std::string(); \ + } \ + } \ + return #SUCCESS_VALUE; \ + } \ +} OPNAME; + +BOOLEAN_OP_NODE(andNode, AND, 1, 0) +BOOLEAN_OP_NODE(orNode, OR, 0, 1) + +#undef BOOLEAN_OP_NODE + +//---------------------------------------------------------------------------- +static const struct NotNode : public cmGeneratorExpressionNode +{ + NotNode() {} + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) const + { + if (*parameters.begin() != "0" && *parameters.begin() != "1") + { + reportError(context, content->GetOriginalExpression(), + "$ parameter must resolve to exactly one '0' or '1' value."); + return std::string(); + } + return *parameters.begin() == "0" ? "1" : "0"; + } +} notNode; + +//---------------------------------------------------------------------------- +static const struct ConfigurationNode : public cmGeneratorExpressionNode +{ + ConfigurationNode() {} + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *) const + { + return context->Config ? context->Config : ""; + } +} configurationNode; + +//---------------------------------------------------------------------------- +static const struct ConfigurationTestNode : public cmGeneratorExpressionNode +{ + ConfigurationTestNode() {} + + virtual int NumExpectedParameters() const { return 1; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) const + { + if (!context->Config) + { + return std::string(); + } + + cmsys::RegularExpression configValidator; + configValidator.compile("^[A-Za-z0-9_]*$"); + if (!configValidator.find(parameters.begin()->c_str())) + { + reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + return *parameters.begin() == context->Config ? "1" : "0"; + } +} configurationTestNode; + +//---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content); +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + // The target soname file (.so.1). + if(target->IsDLLPlatform()) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_SONAME_FILE is not allowed " + "for DLL target platforms."); + return std::string(); + } + if(target->GetType() != cmTarget::SHARED_LIBRARY) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_SONAME_FILE is allowed only for " + "SHARED libraries."); + return std::string(); + } + std::string result = target->GetDirectory(context->Config); + result += "/"; + result += target->GetSOName(context->Config); + return result; + } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + // The file used to link to the target (.so, .lib, .a). + if(!target->IsLinkable()) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_LINKER_FILE is allowed only for libraries and " + "executables with ENABLE_EXPORTS."); + return std::string(); + } + return target->GetFullPath(context->Config, + target->HasImportLibrary()); + } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *) + { + return target->GetFullPath(context->Config, false, true); + } +}; + + +//---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result); +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result) + { return cmSystemTools::GetFilenameName(result); } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result) + { return cmSystemTools::GetFilenamePath(result); } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result) + { return result; } +}; + +//---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifact : public cmGeneratorExpressionNode +{ + TargetFilesystemArtifact() {} + + virtual int NumExpectedParameters() const { return 1; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) const + { + // Lookup the referenced target. + std::string name = *parameters.begin(); + + cmsys::RegularExpression targetValidator; + targetValidator.compile("^[A-Za-z0-9_]+$"); + if (!targetValidator.find(name.c_str())) + { + ::reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + cmTarget* target = context->Makefile->FindTargetToUse(name.c_str()); + if(!target) + { + ::reportError(context, content->GetOriginalExpression(), + "No target \"" + name + "\""); + return std::string(); + } + if(target->GetType() >= cmTarget::UTILITY && + target->GetType() != cmTarget::UNKNOWN_LIBRARY) + { + ::reportError(context, content->GetOriginalExpression(), + "Target \"" + name + "\" is not an executable or library."); + return std::string(); + } + context->Targets.insert(target); + + std::string result = + TargetFilesystemArtifactResultCreator::Create( + target, + context, + content); + if (context->HadError) + { + return std::string(); + } + return + TargetFilesystemArtifactResultGetter::Get(result); + } +}; + +//---------------------------------------------------------------------------- +static const +TargetFilesystemArtifact targetFileNode; +static const +TargetFilesystemArtifact targetLinkerFileNode; +static const +TargetFilesystemArtifact targetSoNameFileNode; +static const +TargetFilesystemArtifact targetFileNameNode; +static const +TargetFilesystemArtifact targetLinkerFileNameNode; +static const +TargetFilesystemArtifact targetSoNameFileNameNode; +static const +TargetFilesystemArtifact targetFileDirNode; +static const +TargetFilesystemArtifact targetLinkerFileDirNode; +static const +TargetFilesystemArtifact targetSoNameFileDirNode; + +//---------------------------------------------------------------------------- +static const +cmGeneratorExpressionNode* GetNode(const std::string &identifier) +{ + if (identifier == "0") + return &zeroNode; + if (identifier == "1") + return &oneNode; + if (identifier == "AND") + return &andNode; + if (identifier == "OR") + return &orNode; + if (identifier == "NOT") + return ¬Node; + else if (identifier == "CONFIGURATION") + return &configurationNode; + else if (identifier == "CONFIG") + return &configurationTestNode; + else if (identifier == "TARGET_FILE") + return &targetFileNode; + else if (identifier == "TARGET_LINKER_FILE") + return &targetLinkerFileNode; + else if (identifier == "TARGET_SONAME_FILE") + return &targetSoNameFileNode; + else if (identifier == "TARGET_FILE_NAME") + return &targetFileNameNode; + else if (identifier == "TARGET_LINKER_FILE_NAME") + return &targetLinkerFileNameNode; + else if (identifier == "TARGET_SONAME_FILE_NAME") + return &targetSoNameFileNameNode; + else if (identifier == "TARGET_FILE_DIR") + return &targetFileDirNode; + else if (identifier == "TARGET_LINKER_FILE_DIR") + return &targetLinkerFileDirNode; + else if (identifier == "TARGET_SONAME_FILE_DIR") + return &targetSoNameFileDirNode; + return 0; +} + +//---------------------------------------------------------------------------- +GeneratorExpressionContent::GeneratorExpressionContent( + const char *startContent, + unsigned int length) + : StartContent(startContent), ContentLength(length) +{ + +} + +//---------------------------------------------------------------------------- +std::string GeneratorExpressionContent::GetOriginalExpression() const +{ + return std::string(this->StartContent, this->ContentLength); +} + +//---------------------------------------------------------------------------- +std::string GeneratorExpressionContent::Evaluate( + cmGeneratorExpressionContext *context) const +{ + std::string identifier; + { + std::vector::const_iterator it + = this->IdentifierChildren.begin(); + const std::vector::const_iterator end + = this->IdentifierChildren.end(); + for ( ; it != end; ++it) + { + identifier += (*it)->Evaluate(context); + if (context->HadError) + { + return std::string(); + } + } + } + + const cmGeneratorExpressionNode *node = GetNode(identifier); + + if (!node) + { + reportError(context, this->GetOriginalExpression(), + "Expression did not evaluate to a known generator expression"); + return std::string(); + } + + if (!node->GeneratesContent()) + { + return std::string(); + } + + if (node->AcceptsSingleArbitraryContentParameter()) + { + std::string result; + std::vector >::const_iterator + pit = this->ParamChildren.begin(); + const + std::vector >::const_iterator + pend = this->ParamChildren.end(); + for ( ; pit != pend; ++pit) + { + if (!result.empty()) + { + result += ","; + } + + std::vector::const_iterator it + = pit->begin(); + const std::vector::const_iterator end + = pit->end(); + for ( ; it != end; ++it) + { + result += (*it)->Evaluate(context); + if (context->HadError) + { + return std::string(); + } + } + } + return result; + } + + std::vector parameters; + { + std::vector >::const_iterator + pit = this->ParamChildren.begin(); + const + std::vector >::const_iterator + pend = this->ParamChildren.end(); + for ( ; pit != pend; ++pit) + { + std::string parameter; + std::vector::const_iterator it = + pit->begin(); + const std::vector::const_iterator end = + pit->end(); + for ( ; it != end; ++it) + { + parameter += (*it)->Evaluate(context); + if (context->HadError) + { + return std::string(); + } + } + parameters.push_back(parameter); + } + } + + int numExpected = node->NumExpectedParameters(); + if ((numExpected != -1 && (unsigned int)numExpected != parameters.size())) + { + if (numExpected == 0) + { + reportError(context, this->GetOriginalExpression(), + "$<" + identifier + "> expression requires no parameters."); + } + else if (numExpected == 1) + { + reportError(context, this->GetOriginalExpression(), + "$<" + identifier + "> expression requires " + "exactly one parameter."); + } + else + { + cmOStringStream e; + e << "$<" + identifier + "> expression requires " + << numExpected + << " comma separated parameters, but got " + << parameters.size() << " instead."; + reportError(context, this->GetOriginalExpression(), e.str()); + } + return std::string(); + } + + if (numExpected == -1 && parameters.empty()) + { + reportError(context, this->GetOriginalExpression(), "$<" + identifier + + "> expression requires at least one parameter."); + return std::string(); + } + + return node->Evaluate(parameters, context, this); +} + +//---------------------------------------------------------------------------- +static void deleteAll(const std::vector &c) +{ + std::vector::const_iterator it + = c.begin(); + const std::vector::const_iterator end + = c.end(); + for ( ; it != end; ++it) + { + delete *it; + } +} + +//---------------------------------------------------------------------------- +GeneratorExpressionContent::~GeneratorExpressionContent() +{ + deleteAll(this->IdentifierChildren); + + typedef std::vector EvaluatorVector; + typedef std::vector TokenVector; + std::vector::const_iterator pit = + this->ParamChildren.begin(); + const std::vector::const_iterator pend = + this->ParamChildren.end(); + for ( ; pit != pend; ++pit) + { + deleteAll(*pit); + } +} diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h new file mode 100644 index 000000000..5163ca002 --- /dev/null +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -0,0 +1,118 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGeneratorExpressionEvaluator_h +#define cmGeneratorExpressionEvaluator_h + +#include +#include + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionContext +{ + cmListFileBacktrace Backtrace; + std::set Targets; + cmMakefile *Makefile; + const char *Config; + cmTarget *Target; + bool Quiet; + bool HadError; +}; + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionEvaluator +{ + cmGeneratorExpressionEvaluator() {} + virtual ~cmGeneratorExpressionEvaluator() {} + + enum Type + { + Text, + Generator + }; + + virtual Type GetType() const = 0; + + virtual std::string Evaluate(cmGeneratorExpressionContext *context + ) const = 0; + +private: + cmGeneratorExpressionEvaluator(const cmGeneratorExpressionEvaluator &); + void operator=(const cmGeneratorExpressionEvaluator &); +}; + +struct TextContent : public cmGeneratorExpressionEvaluator +{ + TextContent(const char *start, unsigned int length) + : Content(start), Length(length) + { + + } + + std::string Evaluate(cmGeneratorExpressionContext *) const + { + return std::string(this->Content, this->Length); + } + + Type GetType() const + { + return cmGeneratorExpressionEvaluator::Text; + } + + void Extend(unsigned int length) + { + this->Length += length; + } + + unsigned int GetLength() + { + return this->Length; + } + +private: + const char *Content; + unsigned int Length; +}; + +//---------------------------------------------------------------------------- +struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator +{ + GeneratorExpressionContent(const char *startContent, unsigned int length); + void SetIdentifier(std::vector identifier) + { + this->IdentifierChildren = identifier; + } + + void SetParameters( + std::vector > parameters) + { + this->ParamChildren = parameters; + } + + Type GetType() const + { + return cmGeneratorExpressionEvaluator::Generator; + } + + std::string Evaluate(cmGeneratorExpressionContext *context) const; + + std::string GetOriginalExpression() const; + + ~GeneratorExpressionContent(); + +private: + std::vector IdentifierChildren; + std::vector > ParamChildren; + const char *StartContent; + unsigned int ContentLength; +}; + +#endif diff --git a/Source/cmGeneratorExpressionLexer.cxx b/Source/cmGeneratorExpressionLexer.cxx new file mode 100644 index 000000000..cd71ec033 --- /dev/null +++ b/Source/cmGeneratorExpressionLexer.cxx @@ -0,0 +1,85 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGeneratorExpressionLexer.h" + + +//---------------------------------------------------------------------------- +cmGeneratorExpressionLexer::cmGeneratorExpressionLexer() + : SawBeginExpression(false), SawGeneratorExpression(false) +{ + +} + +//---------------------------------------------------------------------------- +static void InsertText(const char *upto, const char *c, + std::vector &result) +{ + if (upto != c) + { + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::Text, upto, c - upto)); + } +} + +//---------------------------------------------------------------------------- +std::vector +cmGeneratorExpressionLexer::Tokenize(const char *input) +{ + std::vector result; + if (!input) + return result; + + const char *c = input; + const char *upto = c; + + for ( ; *c; ++c) + { + if(c[0] == '$' && c[1] == '<') + { + InsertText(upto, c, result); + upto = c; + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::BeginExpression, upto, 2)); + upto = c + 2; + ++c; + SawBeginExpression = true; + } + else if(c[0] == '>') + { + InsertText(upto, c, result); + upto = c; + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::EndExpression, upto, 1)); + upto = c + 1; + SawGeneratorExpression = SawBeginExpression; + } + else if(c[0] == ':') + { + InsertText(upto, c, result); + upto = c; + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::ColonSeparator, upto, 1)); + upto = c + 1; + } + else if(c[0] == ',') + { + InsertText(upto, c, result); + upto = c; + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::CommaSeparator, upto, 1)); + upto = c + 1; + } + } + InsertText(upto, c, result); + + return result; +} diff --git a/Source/cmGeneratorExpressionLexer.h b/Source/cmGeneratorExpressionLexer.h new file mode 100644 index 000000000..5f16712fb --- /dev/null +++ b/Source/cmGeneratorExpressionLexer.h @@ -0,0 +1,58 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGeneratorExpressionLexer_h +#define cmGeneratorExpressionLexer_h + +#include "cmStandardIncludes.h" + +#include + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionToken +{ + cmGeneratorExpressionToken(unsigned type, const char *c, unsigned l) + : TokenType(type), Content(c), Length(l) + { + } + enum { + Text, + BeginExpression, + EndExpression, + ColonSeparator, + CommaSeparator + }; + unsigned TokenType; + const char *Content; + unsigned Length; +}; + +/** \class cmGeneratorExpressionLexer + * + */ +class cmGeneratorExpressionLexer +{ +public: + cmGeneratorExpressionLexer(); + + std::vector Tokenize(const char *input); + + bool GetSawGeneratorExpression() const + { + return this->SawGeneratorExpression; + } + +private: + bool SawBeginExpression; + bool SawGeneratorExpression; +}; + +#endif diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx new file mode 100644 index 000000000..2a5cc7aae --- /dev/null +++ b/Source/cmGeneratorExpressionParser.cxx @@ -0,0 +1,235 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmGeneratorExpressionParser.h" + +#include "cmGeneratorExpressionEvaluator.h" + +//---------------------------------------------------------------------------- +cmGeneratorExpressionParser::cmGeneratorExpressionParser( + const std::vector &tokens) + : Tokens(tokens), NestingLevel(0) +{ +} + +//---------------------------------------------------------------------------- +void cmGeneratorExpressionParser::Parse( + std::vector &result) +{ + it = this->Tokens.begin(); + + while (this->it != this->Tokens.end()) + { + this->ParseContent(result); + } +} + +//---------------------------------------------------------------------------- +static void extendText(std::vector &result, + std::vector::const_iterator it) +{ + if (result.size() > 0 + && (*(result.end() - 1))->GetType() + == cmGeneratorExpressionEvaluator::Text) + { + TextContent *textContent = static_cast(*(result.end() - 1)); + textContent->Extend(it->Length); + } + else + { + TextContent *textContent = new TextContent(it->Content, it->Length); + result.push_back(textContent); + } +} + +//---------------------------------------------------------------------------- +static void extendResult(std::vector &result, + const std::vector &contents) +{ + if (result.size() > 0 + && (*(result.end() - 1))->GetType() + == cmGeneratorExpressionEvaluator::Text + && (*contents.begin())->GetType() + == cmGeneratorExpressionEvaluator::Text) + { + TextContent *textContent = static_cast(*(result.end() - 1)); + textContent->Extend( + static_cast(*contents.begin())->GetLength()); + delete *contents.begin(); + result.insert(result.end(), contents.begin() + 1, contents.end()); + } else { + result.insert(result.end(), contents.begin(), contents.end()); + } +} + +//---------------------------------------------------------------------------- +void cmGeneratorExpressionParser::ParseGeneratorExpression( + std::vector &result) +{ + unsigned int nestedLevel = this->NestingLevel; + ++this->NestingLevel; + + std::vector::const_iterator startToken + = this->it - 1; + + std::vector identifier; + while(this->it->TokenType != cmGeneratorExpressionToken::EndExpression + && this->it->TokenType != cmGeneratorExpressionToken::ColonSeparator) + { + this->ParseContent(identifier); + if (this->it == this->Tokens.end()) + { + break; + } + } + if (identifier.empty()) + { + // ERROR + } + + if (this->it->TokenType == cmGeneratorExpressionToken::EndExpression) + { + GeneratorExpressionContent *content = new GeneratorExpressionContent( + startToken->Content, this->it->Content + - startToken->Content + + this->it->Length); + ++this->it; + --this->NestingLevel; + content->SetIdentifier(identifier); + result.push_back(content); + return; + } + + std::vector > parameters; + std::vector::const_iterator> + commaTokens; + std::vector::const_iterator colonToken; + if (this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator) + { + colonToken = this->it; + parameters.resize(parameters.size() + 1); + ++this->it; + while(this->it->TokenType != cmGeneratorExpressionToken::EndExpression) + { + this->ParseContent(*(parameters.end() - 1)); + if (this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator) + { + commaTokens.push_back(this->it); + parameters.resize(parameters.size() + 1); + ++this->it; + } + if (this->it == this->Tokens.end()) + { + break; + } + } + if(this->it->TokenType == cmGeneratorExpressionToken::EndExpression) + { + --this->NestingLevel; + ++this->it; + } + if (parameters.empty()) + { + // ERROR + } + } + + if (nestedLevel != this->NestingLevel) + { + // There was a '$<' in the text, but no corresponding '>'. Rebuild to + // treat the '$<' as having been plain text, along with the + // corresponding : and , tokens that might have been found. + extendText(result, startToken); + extendResult(result, identifier); + if (!parameters.empty()) + { + extendText(result, colonToken); + + typedef std::vector EvaluatorVector; + typedef std::vector TokenVector; + std::vector::const_iterator pit = parameters.begin(); + const std::vector::const_iterator pend = + parameters.end(); + std::vector::const_iterator commaIt = + commaTokens.begin(); + for ( ; pit != pend; ++pit, ++commaIt) + { + extendResult(result, *pit); + if (commaIt != commaTokens.end()) + { + extendText(result, *commaIt); + } + } + } + return; + } + + int contentLength = ((this->it - 1)->Content + - startToken->Content) + + (this->it - 1)->Length; + GeneratorExpressionContent *content = new GeneratorExpressionContent( + startToken->Content, contentLength); + content->SetIdentifier(identifier); + content->SetParameters(parameters); + result.push_back(content); +} + +//---------------------------------------------------------------------------- +void cmGeneratorExpressionParser::ParseContent( + std::vector &result) +{ + switch(this->it->TokenType) + { + case cmGeneratorExpressionToken::Text: + { + if (this->NestingLevel == 0) + { + if (result.size() > 0 + && (*(result.end() - 1))->GetType() + == cmGeneratorExpressionEvaluator::Text) + { + // A comma in 'plain text' could have split text that should + // otherwise be continuous. Extend the last text content instead of + // creating a new one. + TextContent *textContent = + static_cast(*(result.end() - 1)); + textContent->Extend(this->it->Length); + ++this->it; + return; + } + } + cmGeneratorExpressionEvaluator* n = new TextContent(this->it->Content, + this->it->Length); + result.push_back(n); + ++this->it; + return ; + } + case cmGeneratorExpressionToken::BeginExpression: + ++this->it; + this->ParseGeneratorExpression(result); + return; + case cmGeneratorExpressionToken::EndExpression: + case cmGeneratorExpressionToken::ColonSeparator: + case cmGeneratorExpressionToken::CommaSeparator: + if (this->NestingLevel == 0) + { + extendText(result, this->it); + } + else + { + // TODO: Unreachable. Assert? + } + ++this->it; + return; + } + // Unreachable. Assert? +} diff --git a/Source/cmGeneratorExpressionParser.h b/Source/cmGeneratorExpressionParser.h new file mode 100644 index 000000000..28f14410f --- /dev/null +++ b/Source/cmGeneratorExpressionParser.h @@ -0,0 +1,45 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGeneratorExpressionParser_h +#define cmGeneratorExpressionParser_h + +#include "cmGeneratorExpressionLexer.h" + +#include +#include + +#include "cmListFileCache.h" + +class cmMakefile; +class cmTarget; +struct cmGeneratorExpressionEvaluator; + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionParser +{ + cmGeneratorExpressionParser( + const std::vector &tokens); + + void Parse(std::vector &result); + +private: + void ParseContent(std::vector &); + void ParseGeneratorExpression( + std::vector &); + +private: + std::vector::const_iterator it; + const std::vector Tokens; + unsigned int NestingLevel; +}; + +#endif diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 6e2e23da5..db88834b9 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -14,9 +14,12 @@ #include "cmTarget.h" #include "cmMakefile.h" #include "cmLocalGenerator.h" +#include "cmComputeLinkInformation.h" #include "cmGlobalGenerator.h" #include "cmSourceFile.h" +#include + //---------------------------------------------------------------------------- cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) { @@ -27,6 +30,45 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) this->LookupObjectLibraries(); } +cmGeneratorTarget::~cmGeneratorTarget() +{ + for(std::map::iterator i + = LinkInformation.begin(); i != LinkInformation.end(); ++i) + { + delete i->second; + } +} + +//---------------------------------------------------------------------------- +int cmGeneratorTarget::GetType() const +{ + return this->Target->GetType(); +} + +//---------------------------------------------------------------------------- +const char *cmGeneratorTarget::GetName() const +{ + return this->Target->GetName(); +} + +//---------------------------------------------------------------------------- +const char *cmGeneratorTarget::GetProperty(const char *prop) +{ + return this->Target->GetProperty(prop); +} + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::GetPropertyAsBool(const char *prop) +{ + return this->Target->GetPropertyAsBool(prop); +} + +//---------------------------------------------------------------------------- +std::vector const& cmGeneratorTarget::GetSourceFiles() +{ + return this->Target->GetSourceFiles(); +} + //---------------------------------------------------------------------------- void cmGeneratorTarget::ClassifySources() { @@ -175,3 +217,179 @@ void cmGeneratorTarget::UseObjectLibraries(std::vector& objs) } } } + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::GenerateTargetManifest(const char* config) +{ + cmMakefile* mf = this->Target->GetMakefile(); + cmLocalGenerator* lg = mf->GetLocalGenerator(); + cmGlobalGenerator* gg = lg->GetGlobalGenerator(); + + // Get the names. + std::string name; + std::string soName; + std::string realName; + std::string impName; + std::string pdbName; + if(this->GetType() == cmTarget::EXECUTABLE) + { + this->Target->GetExecutableNames(name, realName, impName, pdbName, + config); + } + else if(this->GetType() == cmTarget::STATIC_LIBRARY || + this->GetType() == cmTarget::SHARED_LIBRARY || + this->GetType() == cmTarget::MODULE_LIBRARY) + { + this->Target->GetLibraryNames(name, soName, realName, impName, pdbName, + config); + } + else + { + return; + } + + // Get the directory. + std::string dir = this->Target->GetDirectory(config, false); + + // Add each name. + std::string f; + if(!name.empty()) + { + f = dir; + f += "/"; + f += name; + gg->AddToManifest(config? config:"", f); + } + if(!soName.empty()) + { + f = dir; + f += "/"; + f += soName; + gg->AddToManifest(config? config:"", f); + } + if(!realName.empty()) + { + f = dir; + f += "/"; + f += realName; + gg->AddToManifest(config? config:"", f); + } + if(!pdbName.empty()) + { + f = dir; + f += "/"; + f += pdbName; + gg->AddToManifest(config? config:"", f); + } + if(!impName.empty()) + { + f = this->Target->GetDirectory(config, true); + f += "/"; + f += impName; + gg->AddToManifest(config? config:"", f); + } +} + +//---------------------------------------------------------------------------- +cmComputeLinkInformation* +cmGeneratorTarget::GetLinkInformation(const char* config) +{ + // Lookup any existing information for this configuration. + std::map::iterator + i = this->LinkInformation.find(config?config:""); + if(i == this->LinkInformation.end()) + { + // Compute information for this configuration. + cmComputeLinkInformation* info = + new cmComputeLinkInformation(this->Target, config); + if(!info || !info->Compute()) + { + delete info; + info = 0; + } + + // Store the information for this configuration. + std::map::value_type + entry(config?config:"", info); + i = this->LinkInformation.insert(entry).first; + } + return i->second; +} + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::GetAppleArchs(const char* config, + std::vector& archVec) +{ + const char* archs = 0; + if(config && *config) + { + std::string defVarName = "OSX_ARCHITECTURES_"; + defVarName += cmSystemTools::UpperCase(config); + archs = this->Target->GetProperty(defVarName.c_str()); + } + if(!archs) + { + archs = this->Target->GetProperty("OSX_ARCHITECTURES"); + } + if(archs) + { + cmSystemTools::ExpandListArgument(std::string(archs), archVec); + } +} + +//---------------------------------------------------------------------------- +const char* cmGeneratorTarget::GetCreateRuleVariable() +{ + switch(this->GetType()) + { + case cmTarget::STATIC_LIBRARY: + return "_CREATE_STATIC_LIBRARY"; + case cmTarget::SHARED_LIBRARY: + return "_CREATE_SHARED_LIBRARY"; + case cmTarget::MODULE_LIBRARY: + return "_CREATE_SHARED_MODULE"; + case cmTarget::EXECUTABLE: + return "_LINK_EXECUTABLE"; + default: + break; + } + return ""; +} + +//---------------------------------------------------------------------------- +std::vector cmGeneratorTarget::GetIncludeDirectories() +{ + std::vector includes; + const char *prop = this->Target->GetProperty("INCLUDE_DIRECTORIES"); + if(prop) + { + cmSystemTools::ExpandListArgument(prop, includes); + } + + std::set uniqueIncludes; + std::vector orderedAndUniqueIncludes; + for(std::vector::const_iterator + li = includes.begin(); li != includes.end(); ++li) + { + if(uniqueIncludes.insert(*li).second) + { + orderedAndUniqueIncludes.push_back(*li); + } + } + + return orderedAndUniqueIncludes; +} + +//---------------------------------------------------------------------------- +const char *cmGeneratorTarget::GetCompileDefinitions(const char *config) +{ + if (!config) + { + return this->Target->GetProperty("COMPILE_DEFINITIONS"); + } + std::string defPropName = "COMPILE_DEFINITIONS_"; + defPropName += + cmSystemTools::UpperCase(config); + + return this->Target->GetProperty(defPropName.c_str()); +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 5c7578d94..060e25a8b 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -14,6 +14,7 @@ #include "cmStandardIncludes.h" +class cmComputeLinkInformation; class cmCustomCommand; class cmGlobalGenerator; class cmLocalGenerator; @@ -25,6 +26,13 @@ class cmGeneratorTarget { public: cmGeneratorTarget(cmTarget*); + ~cmGeneratorTarget(); + + int GetType() const; + const char *GetName() const; + const char *GetProperty(const char *prop); + bool GetPropertyAsBool(const char *prop); + std::vector const& GetSourceFiles(); cmTarget* Target; cmMakefile* Makefile; @@ -52,6 +60,25 @@ public: void UseObjectLibraries(std::vector& objs); + /** Add the target output files to the global generator manifest. */ + void GenerateTargetManifest(const char* config); + + std::map LinkInformation; + + cmComputeLinkInformation* GetLinkInformation(const char* config); + + void GetAppleArchs(const char* config, + std::vector& archVec); + + ///! Return the rule variable used to create this type of target, + // need to add CMAKE_(LANG) for full name. + const char* GetCreateRuleVariable(); + + /** Get the include directories for this target. */ + std::vector GetIncludeDirectories(); + + const char *GetCompileDefinitions(const char *config = 0); + private: void ClassifySources(); void LookupObjectLibraries(); @@ -60,4 +87,6 @@ private: void operator=(cmGeneratorTarget const&); }; +typedef std::map cmGeneratorTargetsType; + #endif diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a47ca3677..ac75933c2 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -315,9 +315,11 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, { rootBin = this->ConfiguredFilesPath; } + rootBin += "/"; + rootBin += cmVersion::GetCMakeVersion(); // set the dir for parent files so they can be used by modules - mf->AddDefinition("CMAKE_PLATFORM_ROOT_BIN",rootBin.c_str()); + mf->AddDefinition("CMAKE_PLATFORM_INFO_DIR",rootBin.c_str()); // find and make sure CMAKE_MAKE_PROGRAM is defined this->FindMakeProgram(mf); @@ -376,21 +378,16 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, std::string loadedLang = "CMAKE_"; loadedLang += lang; loadedLang += "_COMPILER_LOADED"; - // If the existing build tree was already configured with this - // version of CMake then try to load the configured file first - // to avoid duplicate compiler tests. - unsigned int cacheMajor = mf->GetCacheMajorVersion(); - unsigned int cacheMinor = mf->GetCacheMinorVersion(); - unsigned int selfMajor = cmVersion::GetMajorVersion(); - unsigned int selfMinor = cmVersion::GetMinorVersion(); - if((this->CMakeInstance->GetIsInTryCompile() || - (selfMajor == cacheMajor && selfMinor == cacheMinor)) - && !mf->GetDefinition(loadedLang.c_str())) + if(!mf->GetDefinition(loadedLang.c_str())) { fpath = rootBin; fpath += "/CMake"; fpath += lang; fpath += "Compiler.cmake"; + + // If the existing build tree was already configured with this + // version of CMake then try to load the configured file first + // to avoid duplicate compiler tests. if(cmSystemTools::FileExists(fpath.c_str())) { if(!mf->ReadListFile(0,fpath.c_str())) @@ -1078,23 +1075,46 @@ void cmGlobalGenerator::CreateGeneratorTargets() // Construct per-target generator information. for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) { - cmTargets& targets = - this->LocalGenerators[i]->GetMakefile()->GetTargets(); + cmGeneratorTargetsType generatorTargets; + + cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); + const char *noconfig_compile_definitions = + mf->GetProperty("COMPILE_DEFINITIONS"); + + std::vector configs; + mf->GetConfigurations(configs); + + cmTargets& targets = mf->GetTargets(); for(cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) { cmTarget* t = &ti->second; + + { + t->AppendProperty("COMPILE_DEFINITIONS", noconfig_compile_definitions); + for(std::vector::const_iterator ci = configs.begin(); + ci != configs.end(); ++ci) + { + std::string defPropName = "COMPILE_DEFINITIONS_"; + defPropName += cmSystemTools::UpperCase(*ci); + t->AppendProperty(defPropName.c_str(), + mf->GetProperty(defPropName.c_str())); + } + } + cmGeneratorTarget* gt = new cmGeneratorTarget(t); this->GeneratorTargets[t] = gt; this->ComputeTargetObjects(gt); + generatorTargets[t] = gt; } + mf->SetGeneratorTargets(generatorTargets); } } //---------------------------------------------------------------------------- void cmGlobalGenerator::ClearGeneratorTargets() { - for(GeneratorTargetsType::iterator i = this->GeneratorTargets.begin(); + for(cmGeneratorTargetsType::iterator i = this->GeneratorTargets.begin(); i != this->GeneratorTargets.end(); ++i) { delete i->second; @@ -1105,7 +1125,7 @@ void cmGlobalGenerator::ClearGeneratorTargets() //---------------------------------------------------------------------------- cmGeneratorTarget* cmGlobalGenerator::GetGeneratorTarget(cmTarget* t) const { - GeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t); + cmGeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t); if(ti == this->GeneratorTargets.end()) { this->CMakeInstance->IssueMessage( @@ -1132,13 +1152,13 @@ void cmGlobalGenerator::CheckLocalGenerators() { manager = this->LocalGenerators[i]->GetMakefile()->GetCacheManager(); this->LocalGenerators[i]->ConfigureFinalPass(); - cmTargets & targets = - this->LocalGenerators[i]->GetMakefile()->GetTargets(); - for (cmTargets::iterator l = targets.begin(); + cmGeneratorTargetsType targets = + this->LocalGenerators[i]->GetMakefile()->GetGeneratorTargets(); + for (cmGeneratorTargetsType::iterator l = targets.begin(); l != targets.end(); l++) { const cmTarget::LinkLibraryVectorType& libs = - l->second.GetOriginalLinkLibraries(); + l->second->Target->GetOriginalLinkLibraries(); for(cmTarget::LinkLibraryVectorType::const_iterator lib = libs.begin(); lib != libs.end(); ++lib) { @@ -1154,14 +1174,14 @@ void cmGlobalGenerator::CheckLocalGenerators() } std::string text = notFoundMap[varName]; text += "\n linked by target \""; - text += l->second.GetName(); + text += l->second->GetName(); text += "\" in directory "; text+=this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory(); notFoundMap[varName] = text; } } std::vector incs; - this->LocalGenerators[i]->GetIncludeDirectories(incs, &l->second); + this->LocalGenerators[i]->GetIncludeDirectories(incs, l->second); for( std::vector::const_iterator incDir = incs.begin(); incDir != incs.end(); ++incDir) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index ce9179379..2f4ebc35a 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -18,6 +18,7 @@ #include "cmTarget.h" // For cmTargets #include "cmTargetDepend.h" // For cmTargetDependSet #include "cmSystemTools.h" // for cmSystemTools::OutputOption +#include "cmGeneratorTarget.h" class cmake; class cmGeneratorTarget; class cmMakefile; @@ -383,8 +384,7 @@ private: TargetDependMap TargetDependencies; // Per-target generator information. - typedef std::map GeneratorTargetsType; - GeneratorTargetsType GeneratorTargets; + cmGeneratorTargetsType GeneratorTargets; void CreateGeneratorTargets(); void ClearGeneratorTargets(); virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 48ead25db..d1889809d 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 5f70f6bba..25dd88f2a 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 49dc47364..d0a0c49a1 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 fef1aba61..efd71c65d 100644 --- a/Source/cmGlobalVisualStudio11ARMGenerator.cxx +++ b/Source/cmGlobalVisualStudio11ARMGenerator.cxx @@ -13,6 +13,12 @@ #include "cmMakefile.h" #include "cmake.h" +//---------------------------------------------------------------------------- +cmGlobalVisualStudio11ARMGenerator::cmGlobalVisualStudio11ARMGenerator() +{ + this->ArchitectureId = "ARM"; +} + //---------------------------------------------------------------------------- void cmGlobalVisualStudio11ARMGenerator ::GetDocumentation(cmDocumentationEntry& entry) const @@ -21,12 +27,3 @@ void cmGlobalVisualStudio11ARMGenerator entry.Brief = "Generates Visual Studio 11 ARM project files."; entry.Full = ""; } - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio11ARMGenerator -::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio11Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "ARM"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "ARM"); -} diff --git a/Source/cmGlobalVisualStudio11ARMGenerator.h b/Source/cmGlobalVisualStudio11ARMGenerator.h index 77e142994..71dbf2e3b 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 be7fd5572..7bb4d0c4a 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -21,14 +21,6 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator() this->PlatformToolset = "v110"; } -//---------------------------------------------------------------------------- -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) { diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 7e8f6aa4e..56337a4db 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 10c902753..94e07bf38 100644 --- a/Source/cmGlobalVisualStudio11Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio11Win64Generator.cxx @@ -13,6 +13,12 @@ #include "cmMakefile.h" #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 53f19538c..9445d156c 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 cc7034129..e8ca78873 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 1da575ef8..ab2308f50 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -33,14 +33,6 @@ cmLocalGenerator *cmGlobalVisualStudio71Generator::CreateLocalGenerator() return lg; } -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio71Generator::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio7Generator::AddPlatformDefinitions(mf); - mf->RemoveDefinition("MSVC70"); - mf->AddDefinition("MSVC71", "1"); -} - //---------------------------------------------------------------------------- std::string cmGlobalVisualStudio71Generator::GetUserMacrosDirectory() { diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 285f202dc..a8daad6a2 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& generators); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index d485d6ee3..b6eea5d0b 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 9b9107db7..1df58f97b 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 a74a4eebe..2e3b53018 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"; } //---------------------------------------------------------------------------- @@ -53,14 +52,6 @@ void cmGlobalVisualStudio8Generator entry.Full = ""; } -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) -{ - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId); - mf->AddDefinition("MSVC80", "1"); -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator::Configure() { diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 31501bc90..5009f2960 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/cmGlobalVisualStudio8Win64Generator.cxx b/Source/cmGlobalVisualStudio8Win64Generator.cxx index 60e45b840..164d11636 100644 --- a/Source/cmGlobalVisualStudio8Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio8Win64Generator.cxx @@ -22,17 +22,6 @@ cmGlobalVisualStudio8Win64Generator::cmGlobalVisualStudio8Win64Generator() this->ArchitectureId = "x64"; } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio8Win64Generator::CreateLocalGenerator() -{ - cmLocalVisualStudio7Generator *lg - = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8); - lg->SetPlatformName(this->GetPlatformName()); - lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); - lg->SetGlobalGenerator(this); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Win64Generator ::GetDocumentation(cmDocumentationEntry& entry) const diff --git a/Source/cmGlobalVisualStudio8Win64Generator.h b/Source/cmGlobalVisualStudio8Win64Generator.h index 136cdb8b4..12f80125a 100644 --- a/Source/cmGlobalVisualStudio8Win64Generator.h +++ b/Source/cmGlobalVisualStudio8Win64Generator.h @@ -38,9 +38,6 @@ public: /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry) const; - ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); - /** * Try to determine system infomation such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index fcf00d532..70af50d7b 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -22,14 +22,6 @@ cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator() this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; } -//---------------------------------------------------------------------------- -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) { diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index 361b58c76..0b0d1437f 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/cmGlobalVisualStudio9IA64Generator.cxx b/Source/cmGlobalVisualStudio9IA64Generator.cxx index 993340ae8..38dbfacc4 100644 --- a/Source/cmGlobalVisualStudio9IA64Generator.cxx +++ b/Source/cmGlobalVisualStudio9IA64Generator.cxx @@ -19,17 +19,6 @@ cmGlobalVisualStudio9IA64Generator::cmGlobalVisualStudio9IA64Generator() this->ArchitectureId = "Itanium"; } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio9IA64Generator::CreateLocalGenerator() -{ - cmLocalVisualStudio7Generator *lg = - new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9); - lg->SetPlatformName(this->GetPlatformName()); - lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); - lg->SetGlobalGenerator(this); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudio9IA64Generator ::GetDocumentation(cmDocumentationEntry& entry) const diff --git a/Source/cmGlobalVisualStudio9IA64Generator.h b/Source/cmGlobalVisualStudio9IA64Generator.h index e33ee1550..989b0d1af 100644 --- a/Source/cmGlobalVisualStudio9IA64Generator.h +++ b/Source/cmGlobalVisualStudio9IA64Generator.h @@ -38,9 +38,6 @@ public: /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry) const; - ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); - /** * Try to determine system infomation such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGlobalVisualStudio9Win64Generator.cxx b/Source/cmGlobalVisualStudio9Win64Generator.cxx index 08f537d1a..4d8a6463b 100644 --- a/Source/cmGlobalVisualStudio9Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio9Win64Generator.cxx @@ -19,17 +19,6 @@ cmGlobalVisualStudio9Win64Generator::cmGlobalVisualStudio9Win64Generator() this->ArchitectureId = "x64"; } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio9Win64Generator::CreateLocalGenerator() -{ - cmLocalVisualStudio7Generator *lg = - new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9); - lg->SetPlatformName(this->GetPlatformName()); - lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); - lg->SetGlobalGenerator(this); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudio9Win64Generator ::GetDocumentation(cmDocumentationEntry& entry) const diff --git a/Source/cmGlobalVisualStudio9Win64Generator.h b/Source/cmGlobalVisualStudio9Win64Generator.h index 0ce1afe3d..7c20cf4e2 100644 --- a/Source/cmGlobalVisualStudio9Win64Generator.h +++ b/Source/cmGlobalVisualStudio9Win64Generator.h @@ -38,9 +38,6 @@ public: /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry) const; - ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); - /** * Try to determine system infomation such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index a2b4c6519..0968b771d 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -21,6 +21,7 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator() { + this->ArchitectureId = "X86"; } //---------------------------------------------------------------------------- @@ -488,6 +489,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) { diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 27fc8cf2e..cebf7d741 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 {}; class VSDependMap: public std::map {}; @@ -96,6 +98,8 @@ protected: std::string GetUtilityDepend(cmTarget* target); typedef std::map UtilityDependsMap; UtilityDependsMap UtilityDepends; + const char* ArchitectureId; + private: void ComputeTargetObjects(cmGeneratorTarget* gt) const; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e8ab38fe1..f9a1503d5 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1713,7 +1713,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, // Set target-specific architectures. std::vector archs; - target.GetAppleArchs(configName, archs); + { + cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target); + gtgt->GetAppleArchs(configName, archs); + } if(!archs.empty()) { // Enable ARCHS attribute. @@ -1950,7 +1953,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, BuildObjectListOrString dirs(this, this->XcodeVersion >= 30); BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30); std::vector includes; - this->CurrentLocalGenerator->GetIncludeDirectories(includes, &target); + cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target); + this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt); std::set emitted; emitted.insert("/System/Library/Frameworks"); for(std::vector::iterator i = includes.begin(); @@ -2625,7 +2629,8 @@ void cmGlobalXCodeGenerator } // Compute the link library and directory information. - cmComputeLinkInformation* pcli = cmtarget->GetLinkInformation(configName); + cmGeneratorTarget* gtgt = this->GetGeneratorTarget(cmtarget); + cmComputeLinkInformation* pcli = gtgt->GetLinkInformation(configName); if(!pcli) { continue; diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index ffc0f35b8..56d717031 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -409,14 +409,18 @@ namespace enum Op { OpLess, OpEqual, OpGreater }; bool HandleVersionCompare(Op op, const char* lhs_str, const char* rhs_str) { - // Parse out up to 4 components. - unsigned int lhs[4] = {0,0,0,0}; - unsigned int rhs[4] = {0,0,0,0}; - sscanf(lhs_str, "%u.%u.%u.%u", &lhs[0], &lhs[1], &lhs[2], &lhs[3]); - sscanf(rhs_str, "%u.%u.%u.%u", &rhs[0], &rhs[1], &rhs[2], &rhs[3]); + // Parse out up to 8 components. + unsigned int lhs[8] = {0,0,0,0,0,0,0,0}; + unsigned int rhs[8] = {0,0,0,0,0,0,0,0}; + sscanf(lhs_str, "%u.%u.%u.%u.%u.%u.%u.%u", + &lhs[0], &lhs[1], &lhs[2], &lhs[3], + &lhs[4], &lhs[5], &lhs[6], &lhs[7]); + sscanf(rhs_str, "%u.%u.%u.%u.%u.%u.%u.%u", + &rhs[0], &rhs[1], &rhs[2], &rhs[3], + &rhs[4], &rhs[5], &rhs[6], &rhs[7]); // Do component-wise comparison. - for(unsigned int i=0; i < 4; ++i) + for(unsigned int i=0; i < 8; ++i) { if(lhs[i] < rhs[i]) { diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 5f9b6585e..347ad3ec5 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -16,6 +16,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmake.h" +#include "cmGeneratorTarget.h" #include @@ -26,7 +27,8 @@ cmInstallTargetGenerator std::vector const& configurations, const char* component, bool optional): cmInstallGenerator(dest, configurations, component), Target(&t), - ImportLibrary(implib), FilePermissions(file_permissions), Optional(optional) + ImportLibrary(implib), FilePermissions(file_permissions), + Optional(optional), GeneratorTarget(0) { this->ActionsPerConfig = true; this->NamelinkMode = NamelinkModeNone; @@ -484,6 +486,17 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os, this->AddStripRule(os, indent, file); } +void cmInstallTargetGenerator::CreateGeneratorTarget() +{ + if (!this->GeneratorTarget) + { + this->GeneratorTarget = this->Target->GetMakefile() + ->GetLocalGenerator() + ->GetGlobalGenerator() + ->GetGeneratorTarget(this->Target); + } +} + //---------------------------------------------------------------------------- void cmInstallTargetGenerator @@ -507,10 +520,13 @@ cmInstallTargetGenerator return; } + this->CreateGeneratorTarget(); + // Build a map of build-tree install_name to install-tree install_name for // shared libraries linked to this target. std::map install_name_remap; - if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config)) + if(cmComputeLinkInformation* cli = + this->GeneratorTarget->GetLinkInformation(config)) { std::set const& sharedLibs = cli->GetSharedLibrariesLinked(); for(std::set::const_iterator j = sharedLibs.begin(); @@ -608,9 +624,12 @@ cmInstallTargetGenerator return; } + this->CreateGeneratorTarget(); + // Get the link information for this target. // It can provide the RPATH. - cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config); + cmComputeLinkInformation* cli = + this->GeneratorTarget->GetLinkInformation(config); if(!cli) { return; @@ -639,9 +658,12 @@ cmInstallTargetGenerator return; } + this->CreateGeneratorTarget(); + // Get the link information for this target. // It can provide the RPATH. - cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config); + cmComputeLinkInformation* cli = + this->GeneratorTarget->GetLinkInformation(config); if(!cli) { return; diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 5d158b8d0..cab3e9065 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -15,6 +15,8 @@ #include "cmInstallGenerator.h" #include "cmTarget.h" +class cmGeneratorTarget; + /** \class cmInstallTargetGenerator * \brief Generate target installation rules. */ @@ -92,11 +94,14 @@ protected: void AddRanlibRule(std::ostream& os, Indent const& indent, const std::string& toDestDirPath); + void CreateGeneratorTarget(); + cmTarget* Target; bool ImportLibrary; std::string FilePermissions; bool Optional; NamelinkModeType NamelinkMode; + cmGeneratorTarget* GeneratorTarget; }; #endif diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0cfb36bc3..662f87666 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -533,10 +533,11 @@ void cmLocalGenerator::GenerateTargetManifest() this->Makefile->GetConfigurations(configNames); // Add our targets to the manifest for each configuration. - cmTargets& targets = this->Makefile->GetTargets(); - for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) + cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets(); + for(cmGeneratorTargetsType::iterator t = targets.begin(); + t != targets.end(); ++t) { - cmTarget& target = t->second; + cmGeneratorTarget& target = *t->second; if(configNames.empty()) { target.GenerateTargetManifest(0); @@ -554,9 +555,9 @@ void cmLocalGenerator::GenerateTargetManifest() } void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, - const char* lang, - cmSourceFile& source, - cmTarget& target) + const char* lang, + cmSourceFile& source, + cmGeneratorTarget& target) { std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname)); objectDir = this->Convert(objectDir.c_str(),START_OUTPUT,SHELL); @@ -635,7 +636,8 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, ); } -void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) +void cmLocalGenerator::AddBuildTargetRule(const char* llang, + cmGeneratorTarget& target) { cmStdString objs; std::vector objVector; @@ -669,7 +671,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) std::string createRule = "CMAKE_"; createRule += llang; createRule += target.GetCreateRuleVariable(); - std::string targetName = target.GetFullName(); + std::string targetName = target.Target->GetFullName(); // Executable : // Shared Library: // Static Library: @@ -677,7 +679,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) std::string linkLibs; // should be set std::string flags; // should be set std::string linkFlags; // should be set - this->GetTargetFlags(linkLibs, flags, linkFlags, target); + this->GetTargetFlags(linkLibs, flags, linkFlags, &target); cmLocalGenerator::RuleVariables vars; vars.Language = llang; vars.Objects = objs.c_str(); @@ -714,7 +716,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) // Store this command line. commandLines.push_back(commandLine); } - std::string targetFullPath = target.GetFullPath(); + std::string targetFullPath = target.Target->GetFullPath(); // Generate a meaningful comment for the command. std::string comment = "Linking "; comment += llang; @@ -728,7 +730,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) comment.c_str(), this->Makefile->GetStartOutputDirectory() ); - target.AddSourceFile + target.Target->AddSourceFile (this->Makefile->GetSource(targetFullPath.c_str())); } @@ -736,11 +738,11 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) void cmLocalGenerator ::CreateCustomTargetsAndCommands(std::set const& lang) { - cmTargets &tgts = this->Makefile->GetTargets(); - for(cmTargets::iterator l = tgts.begin(); + cmGeneratorTargetsType tgts = this->Makefile->GetGeneratorTargets(); + for(cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end(); l++) { - cmTarget& target = l->second; + cmGeneratorTarget& target = *l->second; switch(target.GetType()) { case cmTarget::STATIC_LIBRARY: @@ -748,12 +750,12 @@ void cmLocalGenerator case cmTarget::MODULE_LIBRARY: case cmTarget::EXECUTABLE: { - const char* llang = target.GetLinkerLanguage(); + const char* llang = target.Target->GetLinkerLanguage(); if(!llang) { cmSystemTools::Error ("CMake can not determine linker language for target:", - target.GetName()); + target.Target->GetName()); return; } // if the language is not in the set lang then create custom @@ -1318,7 +1320,7 @@ std::string cmLocalGenerator::GetIncludeFlags( //---------------------------------------------------------------------------- void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, - cmTarget* target, + cmGeneratorTarget* target, const char* lang) { // Need to decide whether to automatically include the source and @@ -1449,7 +1451,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, std::string& flags, std::string& linkFlags, - cmTarget& target) + cmGeneratorTarget* target) { std::string buildType = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); @@ -1457,12 +1459,12 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, const char* libraryLinkVariable = "CMAKE_SHARED_LINKER_FLAGS"; // default to shared library - switch(target.GetType()) + switch(target->GetType()) { case cmTarget::STATIC_LIBRARY: { const char* targetLinkFlags = - target.GetProperty("STATIC_LIBRARY_FLAGS"); + target->GetProperty("STATIC_LIBRARY_FLAGS"); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1472,7 +1474,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string build = "STATIC_LIBRARY_FLAGS_"; build += buildType; - targetLinkFlags = target.GetProperty(build.c_str()); + targetLinkFlags = target->GetProperty(build.c_str()); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1498,7 +1500,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, if(this->Makefile->IsOn("WIN32") && !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW"))) { - const std::vector& sources = target.GetSourceFiles(); + const std::vector& sources = target->GetSourceFiles(); for(std::vector::const_iterator i = sources.begin(); i != sources.end(); ++i) { @@ -1513,7 +1515,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, } } } - const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); + const char* targetLinkFlags = target->GetProperty("LINK_FLAGS"); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1523,7 +1525,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string configLinkFlags = "LINK_FLAGS_"; configLinkFlags += buildType; - targetLinkFlags = target.GetProperty(configLinkFlags.c_str()); + targetLinkFlags = target->GetProperty(configLinkFlags.c_str()); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1531,7 +1533,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, } } cmOStringStream linklibsStr; - this->OutputLinkLibraries(linklibsStr, target, false); + this->OutputLinkLibraries(linklibsStr, *target, false); linkLibs = linklibsStr.str(); } break; @@ -1547,17 +1549,17 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, linkFlags += this->Makefile->GetSafeDefinition(build.c_str()); linkFlags += " "; } - const char* linkLanguage = target.GetLinkerLanguage(); + const char* linkLanguage = target->Target->GetLinkerLanguage(); if(!linkLanguage) { cmSystemTools::Error ("CMake can not determine linker language for target:", - target.GetName()); + target->Target->GetName()); return; } this->AddLanguageFlags(flags, linkLanguage, buildType.c_str()); cmOStringStream linklibs; - this->OutputLinkLibraries(linklibs, target, false); + this->OutputLinkLibraries(linklibs, *target, false); linkLibs = linklibs.str(); if(cmSystemTools::IsOn (this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) @@ -1567,7 +1569,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, linkFlags += this->Makefile->GetSafeDefinition(sFlagVar.c_str()); linkFlags += " "; } - if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") ) + if ( target->GetPropertyAsBool("WIN32_EXECUTABLE") ) { linkFlags += this->Makefile->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE"); @@ -1579,7 +1581,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE"); linkFlags += " "; } - if (target.IsExecutableWithExports()) + if (target->Target->IsExecutableWithExports()) { std::string exportFlagVar = "CMAKE_EXE_EXPORTS_"; exportFlagVar += linkLanguage; @@ -1589,7 +1591,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, this->Makefile->GetSafeDefinition(exportFlagVar.c_str()); linkFlags += " "; } - const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); + const char* targetLinkFlags = target->GetProperty("LINK_FLAGS"); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1599,7 +1601,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string configLinkFlags = "LINK_FLAGS_"; configLinkFlags += buildType; - targetLinkFlags = target.GetProperty(configLinkFlags.c_str()); + targetLinkFlags = target->GetProperty(configLinkFlags.c_str()); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1651,7 +1653,7 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib) * to the name of the library. This will not link a library against itself. */ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, - cmTarget& tgt, + cmGeneratorTarget& tgt, bool relink) { const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); @@ -1778,7 +1780,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, //---------------------------------------------------------------------------- void cmLocalGenerator::AddArchitectureFlags(std::string& flags, - cmTarget* target, + cmGeneratorTarget* target, const char *lang, const char* config) { @@ -2101,9 +2103,8 @@ void cmLocalGenerator::AppendFlags(std::string& flags, } //---------------------------------------------------------------------------- -void cmLocalGenerator::AppendDefines(std::string& defines, - const char* defines_list, - const char* lang) +void cmLocalGenerator::AppendDefines(std::set& defines, + const char* defines_list) { // Short-circuit if there are no definitions. if(!defines_list) @@ -2115,12 +2116,23 @@ void cmLocalGenerator::AppendDefines(std::string& defines, std::vector defines_vec; cmSystemTools::ExpandListArgument(defines_list, defines_vec); - // Short-circuit if there are no definitions. - if(defines_vec.empty()) + for(std::vector::const_iterator di = defines_vec.begin(); + di != defines_vec.end(); ++di) { - return; + // Skip unsupported definitions. + if(!this->CheckDefinition(*di)) + { + continue; + } + defines.insert(*di); } +} +//---------------------------------------------------------------------------- +void cmLocalGenerator::JoinDefines(const std::set& defines, + std::string &definesString, + const char* lang) +{ // Lookup the define flag for the current language. std::string dflag = "-D"; if(lang) @@ -2135,23 +2147,13 @@ void cmLocalGenerator::AppendDefines(std::string& defines, } } - // Add each definition to the command line with appropriate escapes. - const char* dsep = defines.empty()? "" : " "; - for(std::vector::const_iterator di = defines_vec.begin(); - di != defines_vec.end(); ++di) + std::set::const_iterator defineIt = defines.begin(); + const std::set::const_iterator defineEnd = defines.end(); + const char* itemSeparator = definesString.empty() ? "" : " "; + for( ; defineIt != defineEnd; ++defineIt) { - // Skip unsupported definitions. - if(!this->CheckDefinition(*di)) - { - continue; - } - - // Separate from previous definitions. - defines += dsep; - dsep = " "; - // Append the definition with proper escaping. - defines += dflag; + std::string def = dflag; if(this->WatcomWMake) { // The Watcom compiler does its own command line parsing instead @@ -2164,27 +2166,30 @@ void cmLocalGenerator::AppendDefines(std::string& defines, // command line without any escapes. However we still have to // get the '$' and '#' characters through WMake as '$$' and // '$#'. - for(const char* c = di->c_str(); *c; ++c) + for(const char* c = defineIt->c_str(); *c; ++c) { if(*c == '$' || *c == '#') { - defines += '$'; + def += '$'; } - defines += *c; + def += *c; } } else { // Make the definition appear properly on the command line. Use // -DNAME="value" instead of -D"NAME=value" to help VS6 parser. - std::string::size_type eq = di->find("="); - defines += di->substr(0, eq); - if(eq != di->npos) + std::string::size_type eq = defineIt->find("="); + def += defineIt->substr(0, eq); + if(eq != defineIt->npos) { - defines += "="; - defines += this->EscapeForShell(di->c_str() + eq + 1, true); + def += "="; + def += this->EscapeForShell(defineIt->c_str() + eq + 1, true); } } + definesString += itemSeparator; + itemSeparator = " "; + definesString += def; } } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 39b493fb1..0916d4422 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -16,6 +16,7 @@ class cmMakefile; class cmGlobalGenerator; +class cmGeneratorTarget; class cmTarget; class cmTargetManifest; class cmSourceFile; @@ -135,7 +136,7 @@ public: std::vector& GetChildren() { return this->Children; }; - void AddArchitectureFlags(std::string& flags, cmTarget* target, + void AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target, const char *lang, const char* config); void AddLanguageFlags(std::string& flags, const char* lang, @@ -154,8 +155,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& defines, + const char* defines_list); + /** + * Join a set of defines into a definesString with a space separator. + */ + void JoinDefines(const std::set& defines, + std::string &definesString, + const char* lang); /** Lookup and append options associated with a particular feature. */ void AppendFeatureOptions(std::string& flags, const char* lang, @@ -199,7 +206,7 @@ public: /** Get the include flags for the current makefile and language. */ void GetIncludeDirectories(std::vector& dirs, - cmTarget* target, + cmGeneratorTarget* target, const char* lang = "C"); /** Compute the language used to compile the given source file. */ @@ -328,11 +335,12 @@ public: void GetTargetFlags(std::string& linkLibs, std::string& flags, std::string& linkFlags, - cmTarget&target); + cmGeneratorTarget* target); protected: ///! put all the libraries for a target on into the given stream - virtual void OutputLinkLibraries(std::ostream&, cmTarget&, bool relink); + virtual void OutputLinkLibraries(std::ostream&, cmGeneratorTarget&, + bool relink); // Expand rule variables in CMake of the type found in language rules void ExpandRuleVariables(std::string& string, @@ -348,12 +356,12 @@ protected: /** Convert a target to a utility target for unsupported * languages of a generator */ - void AddBuildTargetRule(const char* llang, cmTarget& target); + void AddBuildTargetRule(const char* llang, cmGeneratorTarget& target); ///! add a custom command to build a .o file that is part of a target void AddCustomCommandToCreateObject(const char* ofname, const char* lang, cmSourceFile& source, - cmTarget& target); + cmGeneratorTarget& target); // Create Custom Targets and commands for unsupported languages // The set passed in should contain the languages supported by the // generator directly. Any targets containing files that are not diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 1a7e611aa..72b56e71c 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 cdmap; - this->AppendDefines(compileFlags, - (*sf)->GetProperty("COMPILE_DEFINITIONS"), lang); + + { + std::set targetCompileDefinitions; + + this->AppendDefines(targetCompileDefinitions, + (*sf)->GetProperty("COMPILE_DEFINITIONS")); + this->JoinDefines(targetCompileDefinitions, compileFlags, lang); + } + if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_DEBUG")) { - this->AppendDefines(cdmap["DEBUG"], cdefs, lang); + std::set debugCompileDefinitions; + this->AppendDefines(debugCompileDefinitions, cdefs); + this->JoinDefines(debugCompileDefinitions, cdmap["DEBUG"], lang); } if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_RELEASE")) { - this->AppendDefines(cdmap["RELEASE"], cdefs, lang); + std::set releaseCompileDefinitions; + this->AppendDefines(releaseCompileDefinitions, cdefs); + this->JoinDefines(releaseCompileDefinitions, cdmap["RELEASE"], lang); } if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL")) { - this->AppendDefines(cdmap["MINSIZEREL"], cdefs, lang); + std::set minsizerelCompileDefinitions; + this->AppendDefines(minsizerelCompileDefinitions, cdefs); + this->JoinDefines(minsizerelCompileDefinitions, cdmap["MINSIZEREL"], + lang); } if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO")) { - this->AppendDefines(cdmap["RELWITHDEBINFO"], cdefs, lang); + std::set relwithdebinfoCompileDefinitions; + this->AppendDefines(relwithdebinfoCompileDefinitions, cdefs); + this->JoinDefines(relwithdebinfoCompileDefinitions, + cdmap["RELWITHDEBINFO"], lang); } bool excludedFromBuild = @@ -845,10 +862,13 @@ cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target) // the length threatens this problem. unsigned int maxIncludeLength = 3000; bool useShortPath = false; + + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); for(int j=0; j < 2; ++j) { std::vector includes; - this->GetIncludeDirectories(includes, &target); + this->GetIncludeDirectories(includes, gt); std::vector::iterator i; for(i = includes.begin(); i != includes.end(); ++i) @@ -1653,43 +1673,44 @@ void cmLocalVisualStudio6Generator } // Add per-target and per-configuration preprocessor definitions. + std::set definesSet; + std::set debugDefinesSet; + std::set releaseDefinesSet; + std::set minsizeDefinesSet; + std::set debugrelDefinesSet; + + + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); + + this->AppendDefines( + definesSet, + gt->GetCompileDefinitions()); + this->AppendDefines( + debugDefinesSet, + gt->GetCompileDefinitions("DEBUG")); + this->AppendDefines( + releaseDefinesSet, + gt->GetCompileDefinitions("RELEASE")); + this->AppendDefines( + minsizeDefinesSet, + gt->GetCompileDefinitions("MINSIZEREL")); + this->AppendDefines( + debugrelDefinesSet, + gt->GetCompileDefinitions("RELWITHDEBINFO")); + std::string defines = " "; std::string debugDefines = " "; std::string releaseDefines = " "; std::string minsizeDefines = " "; std::string debugrelDefines = " "; - this->AppendDefines( - defines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS"), 0); - this->AppendDefines( - debugDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_DEBUG"),0); - this->AppendDefines( - releaseDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0); - this->AppendDefines( - minsizeDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0); - this->AppendDefines( - debugrelDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0); + this->JoinDefines(definesSet, defines, 0); + this->JoinDefines(debugDefinesSet, debugDefines, 0); + this->JoinDefines(releaseDefinesSet, releaseDefines, 0); + this->JoinDefines(minsizeDefinesSet, minsizeDefines, 0); + this->JoinDefines(debugrelDefinesSet, debugrelDefines, 0); - this->AppendDefines( - defines, - target.GetProperty("COMPILE_DEFINITIONS"), 0); - this->AppendDefines( - debugDefines, - target.GetProperty("COMPILE_DEFINITIONS_DEBUG"), 0); - this->AppendDefines( - releaseDefines, - target.GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0); - this->AppendDefines( - minsizeDefines, - target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0); - this->AppendDefines( - debugrelDefines, - target.GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0); flags += defines; flagsDebug += debugDefines; flagsRelease += releaseDefines; @@ -1746,8 +1767,10 @@ void cmLocalVisualStudio6Generator const std::string extraOptions, std::string& options) { + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); // Compute the link information for this configuration. - cmComputeLinkInformation* pcli = target.GetLinkInformation(configName); + cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); if(!pcli) { return; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 2dfca025c..2ededfe0a 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -819,7 +819,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); fout << "\t\t\t\tAdditionalIncludeDirectories=\""; std::vector includes; - this->GetIncludeDirectories(includes, &target); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); + this->GetIncludeDirectories(includes, gt); std::vector::iterator i = includes.begin(); for(;i != includes.end(); ++i) { @@ -1079,7 +1081,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, targetNameImport, targetNamePDB, configName); // Compute the link library and directory information. - cmComputeLinkInformation* pcli = target.GetLinkInformation(configName); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); + cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); if(!pcli) { return; @@ -1164,7 +1168,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, targetNameImport, targetNamePDB, configName); // Compute the link library and directory information. - cmComputeLinkInformation* pcli = target.GetLinkInformation(configName); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); + cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); if(!pcli) { return; diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index a68b57c23..75a76a42e 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -58,11 +58,12 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile) // Now extract any include paths from the targets std::set uniqueIncludes; std::vector orderedAndUniqueIncludes; - cmTargets & targets = this->Makefile->GetTargets(); - for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l) + cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets(); + for (cmGeneratorTargetsType::iterator l = targets.begin(); + l != targets.end(); ++l) { const std::vector& includes = - l->second.GetIncludeDirectories(); + l->second->GetIncludeDirectories(); for(std::vector::const_iterator j = includes.begin(); j != includes.end(); ++j) { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7b6c450f1..f067da491 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -46,6 +46,7 @@ public: std::stack > VarStack; std::stack > VarInitStack; std::stack > VarUsageStack; + bool IsSourceFileTryCompile; }; // default is not to be building executables @@ -56,6 +57,7 @@ cmMakefile::cmMakefile(): Internal(new Internals) this->Internal->VarStack.push(defs); this->Internal->VarInitStack.push(globalKeys); this->Internal->VarUsageStack.push(globalKeys); + this->Internal->IsSourceFileTryCompile = false; // Initialize these first since AddDefaultDefinitions calls AddDefinition this->WarnUnused = false; @@ -2912,6 +2914,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, const std::vector *cmakeArgs, std::string *output) { + this->Internal->IsSourceFileTryCompile = fast; // does the binary directory exist ? If not create it... if (!cmSystemTools::FileIsDirectory(bindir)) { @@ -2937,6 +2940,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, "Internal CMake error, TryCompile bad GlobalGenerator"); // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); + this->Internal->IsSourceFileTryCompile = false; return 1; } cm.SetGlobalGenerator(gg); @@ -3009,6 +3013,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, "Internal CMake error, TryCompile configure of cmake failed"); // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); + this->Internal->IsSourceFileTryCompile = false; return 1; } @@ -3018,6 +3023,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, "Internal CMake error, TryCompile generation of cmake failed"); // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); + this->Internal->IsSourceFileTryCompile = false; return 1; } @@ -3031,9 +3037,15 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, this); cmSystemTools::ChangeDirectory(cwd.c_str()); + this->Internal->IsSourceFileTryCompile = false; return ret; } +bool cmMakefile::GetIsSourceFileTryCompile() const +{ + return this->Internal->IsSourceFileTryCompile; +} + cmake *cmMakefile::GetCMakeInstance() const { if ( this->LocalGenerator && this->LocalGenerator->GetGlobalGenerator() ) @@ -3972,6 +3984,12 @@ cmTarget* cmMakefile::FindTargetToUse(const char* name) return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, name); } +cmGeneratorTarget* cmMakefile::FindGeneratorTargetToUse(const char* name) +{ + cmTarget *t = this->FindTargetToUse(name); + return this->LocalGenerator->GetGlobalGenerator()->GetGeneratorTarget(t); +} + //---------------------------------------------------------------------------- bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, bool isCustom) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8a0088b1a..80a50d6e6 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -20,6 +20,7 @@ #include "cmSystemTools.h" #include "cmTarget.h" #include "cmNewLineStyle.h" +#include "cmGeneratorTarget.h" #include "cmake.h" #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -128,6 +129,8 @@ public: const std::vector *cmakeArgs, std::string *output); + bool GetIsSourceFileTryCompile() const; + /** * Specify the makefile generator. This is platform/compiler * dependent, although the interface is through a generic @@ -517,11 +520,22 @@ public: */ const cmTargets &GetTargets() const { return this->Targets; } + const cmGeneratorTargetsType &GetGeneratorTargets() const + { + return this->GeneratorTargets; + } + + void SetGeneratorTargets(const cmGeneratorTargetsType &targets) + { + this->GeneratorTargets = targets; + } + cmTarget* FindTarget(const char* name); /** Find a target to use in place of the given name. The target returned may be imported or built within the project. */ cmTarget* FindTargetToUse(const char* name); + cmGeneratorTarget* FindGeneratorTargetToUse(const char* name); /** * Mark include directories as system directories. @@ -863,6 +877,7 @@ protected: // libraries, classes, and executables cmTargets Targets; + cmGeneratorTargetsType GeneratorTargets; std::vector SourceFiles; // Tests diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index ab5150a36..ca5f26ac9 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -210,7 +210,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Add language feature flags. this->AddFeatureFlags(flags, linkLanguage); - this->LocalGenerator->AddArchitectureFlags(flags, this->Target, + this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget, linkLanguage, this->ConfigName); // Add target-specific linker flags. @@ -319,7 +319,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Collect up flags to link in needed libraries. cmOStringStream linklibs; - this->LocalGenerator->OutputLinkLibraries(linklibs, *this->Target, relink); + this->LocalGenerator->OutputLinkLibraries(linklibs, *this->GeneratorTarget, + relink); // Construct object file lists that may be needed to expand the // rule. diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 577e5fd07..368d6fc68 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -546,7 +546,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules if(this->Target->GetType() != cmTarget::STATIC_LIBRARY) { this->LocalGenerator - ->OutputLinkLibraries(linklibs, *this->Target, relink); + ->OutputLinkLibraries(linklibs, *this->GeneratorTarget, relink); } // Construct object file lists that may be needed to expand the @@ -625,7 +625,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string langFlags; this->AddFeatureFlags(langFlags, linkLanguage); - this->LocalGenerator->AddArchitectureFlags(langFlags, this->Target, + this->LocalGenerator->AddArchitectureFlags(langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName); // remove any language flags that might not work with the diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0de182ede..9560c1062 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -259,7 +259,7 @@ std::string cmMakefileTargetGenerator::GetFlags(const std::string &l) // Add language feature flags. this->AddFeatureFlags(flags, lang); - this->LocalGenerator->AddArchitectureFlags(flags, this->Target, + this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget, lang, this->ConfigName); // Fortran-specific flags computed for this target. @@ -292,28 +292,26 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) ByLanguageMap::iterator i = this->DefinesByLanguage.find(l); if (i == this->DefinesByLanguage.end()) { - std::string defines; + std::set defines; const char *lang = l.c_str(); // Add the export symbol definition for shared library objects. if(const char* exportMacro = this->Target->GetExportMacro()) { - this->LocalGenerator->AppendDefines(defines, exportMacro, lang); + this->LocalGenerator->AppendDefines(defines, exportMacro); } // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AppendDefines - (defines, this->Makefile->GetProperty("COMPILE_DEFINITIONS"), lang); - this->LocalGenerator->AppendDefines - (defines, this->Target->GetProperty("COMPILE_DEFINITIONS"), lang); - std::string defPropName = "COMPILE_DEFINITIONS_"; - defPropName += - cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName); - this->LocalGenerator->AppendDefines - (defines, this->Makefile->GetProperty(defPropName.c_str()), lang); - this->LocalGenerator->AppendDefines - (defines, this->Target->GetProperty(defPropName.c_str()), lang); + (defines, this->GeneratorTarget->GetCompileDefinitions()); - ByLanguageMap::value_type entry(l, defines); + this->LocalGenerator->AppendDefines + (defines, this->GeneratorTarget->GetCompileDefinitions( + this->LocalGenerator->ConfigurationName.c_str())); + + 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 +585,12 @@ cmMakefileTargetGenerator } // Add language-specific defines. - std::string defines = "$("; - defines += lang; - defines += "_DEFINES)"; + std::set defines; // Add source-sepcific preprocessor definitions. if(const char* compile_defs = source.GetProperty("COMPILE_DEFINITIONS")) { - this->LocalGenerator->AppendDefines(defines, compile_defs, lang); + this->LocalGenerator->AppendDefines(defines, compile_defs); *this->FlagFileStream << "# Custom defines: " << relativeObj << "_DEFINES = " << compile_defs << "\n" @@ -607,7 +603,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 +672,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)); @@ -1014,7 +1017,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "SET(CMAKE_TARGET_LINKED_INFO_FILES\n"; std::set emitted; const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); - if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) + if(cmComputeLinkInformation* cli = + this->GeneratorTarget->GetLinkInformation(cfg)) { cmComputeLinkInformation::ItemVector const& items = cli->GetItems(); for(cmComputeLinkInformation::ItemVector::const_iterator @@ -1053,7 +1057,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << "SET(CMAKE_C_TARGET_INCLUDE_PATH\n"; std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget); for(std::vector::iterator i = includes.begin(); i != includes.end(); ++i) { @@ -1538,7 +1543,8 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags() emitted.insert("/System/Library/Frameworks"); #endif std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget); std::vector::iterator i; // check all include directories for frameworks as this // will already have added a -F for the framework @@ -1582,7 +1588,8 @@ void cmMakefileTargetGenerator // Loop over all library dependencies. const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); - if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) + if(cmComputeLinkInformation* cli = + this->GeneratorTarget->GetLinkInformation(cfg)) { std::vector const& libDeps = cli->GetDepends(); for(std::vector::const_iterator j = libDeps.begin(); @@ -1842,7 +1849,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target, lang); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, lang); std::string includeFlags = this->LocalGenerator->GetIncludeFlags(includes, lang, useResponseFile); @@ -1945,7 +1953,8 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) { std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget); for(std::vector::const_iterator idi = includes.begin(); idi != includes.end(); ++idi) { diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index a923d6068..6f991e29d 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -423,7 +423,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() this->GetLocalGenerator()->GetTargetFlags(vars["LINK_LIBRARIES"], vars["FLAGS"], vars["LINK_FLAGS"], - *this->GetTarget()); + this->GetGeneratorTarget()); this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]); @@ -434,7 +434,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() ? vars["FLAGS"] : vars["ARCH_FLAGS"]); this->GetLocalGenerator()->AddArchitectureFlags(flags, - this->GetTarget(), + this->GetGeneratorTarget(), this->TargetLinkLanguage, this->GetConfigName()); if (targetType == cmTarget::EXECUTABLE) { @@ -459,25 +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 b6bdfdcdf..1d11acab9 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -134,7 +134,7 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, this->AddFeatureFlags(flags, language.c_str()); this->GetLocalGenerator()->AddArchitectureFlags(flags, - this->GetTarget(), + this->GeneratorTarget, language.c_str(), this->GetConfigName()); @@ -152,7 +152,7 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, // Add include directory flags. { std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target, + this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, language.c_str()); std::string includeFlags = this->LocalGenerator->GetIncludeFlags(includes, language.c_str(), @@ -184,46 +184,37 @@ std::string cmNinjaTargetGenerator:: ComputeDefines(cmSourceFile *source, const std::string& language) { - std::string defines; + std::set defines; // Add the export symbol definition for shared library objects. if(const char* exportMacro = this->Target->GetExportMacro()) { - this->LocalGenerator->AppendDefines(defines, exportMacro, - language.c_str()); + this->LocalGenerator->AppendDefines(defines, exportMacro); } // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AppendDefines (defines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS"), - language.c_str()); + this->GeneratorTarget->GetCompileDefinitions()); this->LocalGenerator->AppendDefines (defines, - this->Target->GetProperty("COMPILE_DEFINITIONS"), - language.c_str()); - this->LocalGenerator->AppendDefines - (defines, - source->GetProperty("COMPILE_DEFINITIONS"), - language.c_str()); + source->GetProperty("COMPILE_DEFINITIONS")); { std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += cmSystemTools::UpperCase(this->GetConfigName()); this->LocalGenerator->AppendDefines (defines, - this->Makefile->GetProperty(defPropName.c_str()), - language.c_str()); + this->GeneratorTarget->GetCompileDefinitions(this->GetConfigName())); this->LocalGenerator->AppendDefines (defines, - this->Target->GetProperty(defPropName.c_str()), - language.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 @@ -234,7 +225,7 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const return cmNinjaDeps(); cmComputeLinkInformation* cli = - this->Target->GetLinkInformation(this->GetConfigName()); + this->GeneratorTarget->GetLinkInformation(this->GetConfigName()); if(!cli) return cmNinjaDeps(); @@ -295,23 +286,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) @@ -348,8 +349,7 @@ cmNinjaTargetGenerator if (lang == "C" || lang == "CXX" || lang == "RC") { clDepsBinary = mf->GetSafeDefinition("CMAKE_CMCLDEPS_EXECUTABLE"); - if (!clDepsBinary.empty() && - !this->GetGlobalGenerator()->GetCMakeInstance()->GetIsInTryCompile()) + if (!clDepsBinary.empty() && !mf->GetIsSourceFileTryCompile()) { clShowPrefix = mf->GetSafeDefinition("CMAKE_CL_SHOWINCLUDE_PREFIX"); clBinary = mf->GetDefinition("CMAKE_C_COMPILER") ? @@ -537,15 +537,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 +633,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 84573cec2..cf06bfdf5 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -40,16 +40,21 @@ public: virtual void Generate() = 0; - std::string GetTargetPDB() const; std::string GetTargetName() const; protected: + + bool SetMsvcTargetPdbVariable(cmNinjaVars&) const; + cmGeneratedFileStream& GetBuildFileStream() const; cmGeneratedFileStream& GetRulesFileStream() const; cmTarget* GetTarget() const { return this->Target; } + cmGeneratorTarget* GetGeneratorTarget() const + { return this->GeneratorTarget; } + cmLocalNinjaGenerator* GetLocalGenerator() const { return this->LocalGenerator; } @@ -112,8 +117,8 @@ protected: // Helper to add flag for windows .def file. void AddModuleDefinitionFlag(std::string& flags); - void EnsureDirectoryExists(const std::string& dir); - void EnsureParentDirectoryExists(const std::string& path); + void EnsureDirectoryExists(const std::string& dir) const; + void EnsureParentDirectoryExists(const std::string& path) const; // write rules for Mac OS X Application Bundle content. struct MacOSXContentGeneratorType : diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h index 1af084065..4863402e4 100644 --- a/Source/cmQTWrapCPPCommand.h +++ b/Source/cmQTWrapCPPCommand.h @@ -17,9 +17,9 @@ #include "cmSourceFile.h" /** \class cmQTWrapCPPCommand - * \brief Create moc file rules for QT classes + * \brief Create moc file rules for Qt classes * - * cmQTWrapCPPCommand is used to create wrappers for QT classes into + * cmQTWrapCPPCommand is used to create wrappers for Qt classes into * normal C++ */ class cmQTWrapCPPCommand : public cmCommand diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h index 1fff04162..b15c5cde0 100644 --- a/Source/cmQTWrapUICommand.h +++ b/Source/cmQTWrapUICommand.h @@ -17,9 +17,9 @@ #include "cmSourceFile.h" /** \class cmQTWrapUICommand - * \brief Create .h and .cxx files rules for QT user interfaces files + * \brief Create .h and .cxx files rules for Qt user interfaces files * - * cmQTWrapUICommand is used to create wrappers for QT classes into normal C++ + * cmQTWrapUICommand is used to create wrappers for Qt classes into normal C++ */ class cmQTWrapUICommand : public cmCommand { diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index e04f7eb78..65c89fad4 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -138,7 +138,7 @@ public: "are used to initialize these properties.\n" "PROJECT_LABEL can be used to change the name of " "the target in an IDE like visual studio. VS_KEYWORD can be set " - "to change the visual studio keyword, for example QT integration " + "to change the visual studio keyword, for example Qt integration " "works better if this is set to Qt4VSv1.0.\n" "VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER and " "VS_SCC_AUXPATH can be set " diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 69673c938..0b2def216 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -92,7 +92,8 @@ public: static bool GetErrorOccuredFlag() { return cmSystemTools::s_ErrorOccured || - cmSystemTools::s_FatalErrorOccured; + cmSystemTools::s_FatalErrorOccured || + GetInterruptFlag(); } ///! If this is set to true, cmake stops processing commands. static void SetFatalErrorOccured() diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 775662cc3..5a47d1749 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -15,7 +15,6 @@ #include "cmSourceFile.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" -#include "cmComputeLinkInformation.h" #include "cmDocumentCompileDefinitions.h" #include "cmDocumentLocationUndefined.h" #include "cmListFileCache.h" @@ -761,7 +760,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 +905,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. " @@ -1068,7 +1070,7 @@ void cmTarget::DefineProperties(cmake *cm) ("VS_KEYWORD", cmProperty::TARGET, "Visual Studio project keyword.", "Can be set to change the visual studio keyword, for example " - "QT integration works better if this is set to Qt4VSv1.0. "); + "Qt integration works better if this is set to Qt4VSv1.0. "); cm->DefineProperty ("VS_SCC_PROVIDER", cmProperty::TARGET, "Visual Studio Source Code Control Provider.", @@ -1620,7 +1622,11 @@ cmTargetTraceDependencies { // Transform command names that reference targets built in this // project to corresponding target-level dependencies. - cmGeneratorExpression ge(this->Makefile, 0, cc.GetBacktrace(), true); + cmGeneratorExpression ge(cc.GetBacktrace()); + + // Add target-level dependencies referenced by generator expressions. + std::set targets; + for(cmCustomCommandLines::const_iterator cit = cc.GetCommandLines().begin(); cit != cc.GetCommandLines().end(); ++cit) { @@ -1642,12 +1648,17 @@ cmTargetTraceDependencies for(cmCustomCommandLine::const_iterator cli = cit->begin(); cli != cit->end(); ++cli) { - ge.Process(*cli); + const cmCompiledGeneratorExpression &cge = ge.Parse(*cli); + cge.Evaluate(this->Makefile, 0, true); + std::set geTargets = cge.GetTargets(); + for(std::set::const_iterator it = geTargets.begin(); + it != geTargets.end(); ++it) + { + targets.insert(*it); + } } } - // Add target-level dependencies referenced by generator expressions. - std::set targets = ge.GetTargets(); for(std::set::iterator ti = targets.begin(); ti != targets.end(); ++ti) { @@ -2941,25 +2952,6 @@ void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc) } } -//---------------------------------------------------------------------------- -const char* cmTarget::GetCreateRuleVariable() -{ - switch(this->GetType()) - { - case cmTarget::STATIC_LIBRARY: - return "_CREATE_STATIC_LIBRARY"; - case cmTarget::SHARED_LIBRARY: - return "_CREATE_SHARED_LIBRARY"; - case cmTarget::MODULE_LIBRARY: - return "_CREATE_SHARED_MODULE"; - case cmTarget::EXECUTABLE: - return "_LINK_EXECUTABLE"; - default: - break; - } - return ""; -} - //---------------------------------------------------------------------------- const char* cmTarget::GetSuffixVariableInternal(bool implib) { @@ -3502,76 +3494,6 @@ bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName, return false; } -//---------------------------------------------------------------------------- -void cmTarget::GenerateTargetManifest(const char* config) -{ - cmMakefile* mf = this->Makefile; - cmLocalGenerator* lg = mf->GetLocalGenerator(); - cmGlobalGenerator* gg = lg->GetGlobalGenerator(); - - // Get the names. - std::string name; - std::string soName; - std::string realName; - std::string impName; - std::string pdbName; - if(this->GetType() == cmTarget::EXECUTABLE) - { - this->GetExecutableNames(name, realName, impName, pdbName, config); - } - else if(this->GetType() == cmTarget::STATIC_LIBRARY || - this->GetType() == cmTarget::SHARED_LIBRARY || - this->GetType() == cmTarget::MODULE_LIBRARY) - { - this->GetLibraryNames(name, soName, realName, impName, pdbName, config); - } - else - { - return; - } - - // Get the directory. - std::string dir = this->GetDirectory(config, false); - - // Add each name. - std::string f; - if(!name.empty()) - { - f = dir; - f += "/"; - f += name; - gg->AddToManifest(config? config:"", f); - } - if(!soName.empty()) - { - f = dir; - f += "/"; - f += soName; - gg->AddToManifest(config? config:"", f); - } - if(!realName.empty()) - { - f = dir; - f += "/"; - f += realName; - gg->AddToManifest(config? config:"", f); - } - if(!pdbName.empty()) - { - f = dir; - f += "/"; - f += pdbName; - gg->AddToManifest(config? config:"", f); - } - if(!impName.empty()) - { - f = this->GetDirectory(config, true); - f += "/"; - f += impName; - gg->AddToManifest(config? config:"", f); - } -} - //---------------------------------------------------------------------------- void cmTarget::SetPropertyDefault(const char* property, const char* default_value) @@ -3967,27 +3889,6 @@ void cmTarget::GetLanguages(std::set& languages) const } } -//---------------------------------------------------------------------------- -void cmTarget::GetAppleArchs(const char* config, - std::vector& archVec) -{ - const char* archs = 0; - if(config && *config) - { - std::string defVarName = "OSX_ARCHITECTURES_"; - defVarName += cmSystemTools::UpperCase(config); - archs = this->GetProperty(defVarName.c_str()); - } - if(!archs) - { - archs = this->GetProperty("OSX_ARCHITECTURES"); - } - if(archs) - { - cmSystemTools::ExpandListArgument(std::string(archs), archVec); - } -} - //---------------------------------------------------------------------------- bool cmTarget::IsChrpathUsed(const char* config) { @@ -4658,56 +4559,6 @@ std::string cmTarget::CheckCMP0004(std::string const& item) return lib; } -//---------------------------------------------------------------------------- -cmComputeLinkInformation* -cmTarget::GetLinkInformation(const char* config) -{ - // Lookup any existing information for this configuration. - std::map::iterator - i = this->LinkInformation.find(config?config:""); - if(i == this->LinkInformation.end()) - { - // Compute information for this configuration. - cmComputeLinkInformation* info = - new cmComputeLinkInformation(this, config); - if(!info || !info->Compute()) - { - delete info; - info = 0; - } - - // Store the information for this configuration. - std::map::value_type - entry(config?config:"", info); - i = this->LinkInformation.insert(entry).first; - } - return i->second; -} - -//---------------------------------------------------------------------------- -std::vector cmTarget::GetIncludeDirectories() -{ - std::vector includes; - const char *prop = this->GetProperty("INCLUDE_DIRECTORIES"); - if(prop) - { - cmSystemTools::ExpandListArgument(prop, includes); - } - - std::set uniqueIncludes; - std::vector orderedAndUniqueIncludes; - for(std::vector::const_iterator - li = includes.begin(); li != includes.end(); ++li) - { - if(uniqueIncludes.insert(*li).second) - { - orderedAndUniqueIncludes.push_back(*li); - } - } - - return orderedAndUniqueIncludes; -} - //---------------------------------------------------------------------------- std::string cmTarget::GetFrameworkDirectory(const char* config) { @@ -4765,29 +4616,6 @@ std::string cmTarget::GetMacContentDirectory(const char* config, return fpath; } -//---------------------------------------------------------------------------- -cmTargetLinkInformationMap -::cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r): derived() -{ - // Ideally cmTarget instances should never be copied. However until - // we can make a sweep to remove that, this copy constructor avoids - // allowing the resources (LinkInformation) from getting copied. In - // the worst case this will lead to extra cmComputeLinkInformation - // instances. We also enforce in debug mode that the map be emptied - // when copied. - static_cast(r); - assert(r.empty()); -} - -//---------------------------------------------------------------------------- -cmTargetLinkInformationMap::~cmTargetLinkInformationMap() -{ - for(derived::iterator i = this->begin(); i != this->end(); ++i) - { - delete i->second; - } -} - //---------------------------------------------------------------------------- cmTargetInternalPointer::cmTargetInternalPointer() { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index a89c5d91b..a025eea8e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -22,18 +22,8 @@ class cmake; class cmMakefile; class cmSourceFile; class cmGlobalGenerator; -class cmComputeLinkInformation; class cmListFileBacktrace; -struct cmTargetLinkInformationMap: - public std::map -{ - typedef std::map derived; - cmTargetLinkInformationMap() {} - cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r); - ~cmTargetLinkInformationMap(); -}; - class cmTargetInternals; class cmTargetInternalPointer { @@ -158,9 +148,6 @@ public: void AddSources(std::vector 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 @@ -333,10 +320,6 @@ public: ///! Return the preferred linker language for this target const char* GetLinkerLanguage(const char* config = 0); - ///! Return the rule variable used to create this type of target, - // need to add CMAKE_(LANG) for full name. - const char* GetCreateRuleVariable(); - /** Get the full name of the target according to the settings in its makefile. */ std::string GetFullName(const char* config=0, bool implib = false); @@ -384,9 +367,6 @@ public: bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out, const char* newExt = 0); - /** Add the target output files to the global generator manifest. */ - void GenerateTargetManifest(const char* config); - /** * Compute whether this target must be relinked before installing. */ @@ -403,8 +383,6 @@ public: std::string GetInstallNameDirForInstallTree(const char* config, bool for_xcode = false); - cmComputeLinkInformation* GetLinkInformation(const char* config); - // Get the properties cmPropertyMap &GetProperties() { return this->Properties; }; @@ -422,9 +400,6 @@ public: // until we have per-target object file properties. void GetLanguages(std::set& languages) const; - /** Get the list of OS X target architectures to be built. */ - void GetAppleArchs(const char* config, std::vector& archVec); - /** Return whether this target is an executable with symbol exports enabled. */ bool IsExecutableWithExports(); @@ -462,9 +437,6 @@ public: directory. */ bool UsesDefaultOutputDir(const char* config, bool implib); - /** Get the include directories for this target. */ - std::vector GetIncludeDirectories(); - /** Append to @a base the mac content directory and return it. */ std::string BuildMacContentDirectory(const std::string& base, const char* config = 0, @@ -602,8 +574,6 @@ private: ImportInfo const* GetImportInfo(const char* config); void ComputeImportInfo(std::string const& desired_config, ImportInfo& info); - cmTargetLinkInformationMap LinkInformation; - bool ComputeLinkInterface(const char* config, LinkInterface& iface); void ComputeLinkImplementation(const char* config, diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index e0892b282..2f650e72e 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -91,8 +91,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, this->TestGenerated = true; // Set up generator expression evaluation context. - cmMakefile* mf = this->Test->GetMakefile(); - cmGeneratorExpression ge(mf, config, this->Test->GetBacktrace()); + cmGeneratorExpression ge(this->Test->GetBacktrace()); // Start the test command. os << indent << "ADD_TEST(" << this->Test->GetName() << " "; @@ -103,6 +102,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, // Check whether the command executable is a target whose name is to // be translated. std::string exe = command[0]; + cmMakefile* mf = this->Test->GetMakefile(); cmTarget* target = mf->FindTargetToUse(exe.c_str()); if(target && target->GetType() == cmTarget::EXECUTABLE) { @@ -112,7 +112,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, else { // Use the command name given. - exe = ge.Process(exe.c_str()); + exe = ge.Parse(exe.c_str()).Evaluate(mf, config); cmSystemTools::ConvertToUnixSlashes(exe); } @@ -122,7 +122,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, for(std::vector::const_iterator ci = command.begin()+1; ci != command.end(); ++ci) { - os << " " << lg->EscapeForCMake(ge.Process(*ci)); + os << " " << lg->EscapeForCMake(ge.Parse(*ci).Evaluate(mf, config)); } // Finish the test command. diff --git a/Source/cmVS11CLFlagTable.h b/Source/cmVS11CLFlagTable.h new file mode 100644 index 000000000..5ab8ebbb3 --- /dev/null +++ b/Source/cmVS11CLFlagTable.h @@ -0,0 +1,291 @@ +static cmVS7FlagTable cmVS11CLFlagTable[] = +{ + + //Enum Properties + {"DebugInformationFormat", "", + "None", "None", 0}, + {"DebugInformationFormat", "Z7", + "C7 compatible", "OldStyle", 0}, + {"DebugInformationFormat", "Zi", + "Program Database", "ProgramDatabase", 0}, + {"DebugInformationFormat", "ZI", + "Program Database for Edit And Continue", "EditAndContinue", 0}, + + {"WarningLevel", "W0", + "Turn Off All Warnings", "TurnOffAllWarnings", 0}, + {"WarningLevel", "W1", + "Level1", "Level1", 0}, + {"WarningLevel", "W2", + "Level2", "Level2", 0}, + {"WarningLevel", "W3", + "Level3", "Level3", 0}, + {"WarningLevel", "W4", + "Level4", "Level4", 0}, + {"WarningLevel", "Wall", + "EnableAllWarnings", "EnableAllWarnings", 0}, + + {"Optimization", "Od", + "Disabled", "Disabled", 0}, + {"Optimization", "O1", + "Minimize Size", "MinSpace", 0}, + {"Optimization", "O2", + "Maximize Speed", "MaxSpeed", 0}, + {"Optimization", "Ox", + "Full Optimization", "Full", 0}, + + {"InlineFunctionExpansion", "", + "Default", "Default", 0}, + {"InlineFunctionExpansion", "Ob0", + "Disabled", "Disabled", 0}, + {"InlineFunctionExpansion", "Ob1", + "Only __inline", "OnlyExplicitInline", 0}, + {"InlineFunctionExpansion", "Ob2", + "Any Suitable", "AnySuitable", 0}, + + {"FavorSizeOrSpeed", "Os", + "Favor small code", "Size", 0}, + {"FavorSizeOrSpeed", "Ot", + "Favor fast code", "Speed", 0}, + {"FavorSizeOrSpeed", "", + "Neither", "Neither", 0}, + + {"ExceptionHandling", "EHa", + "Yes with SEH Exceptions", "Async", 0}, + {"ExceptionHandling", "EHsc", + "Yes", "Sync", 0}, + {"ExceptionHandling", "EHs", + "Yes with Extern C functions", "SyncCThrow", 0}, + {"ExceptionHandling", "", + "No", "false", 0}, + + {"BasicRuntimeChecks", "RTCs", + "Stack Frames", "StackFrameRuntimeCheck", 0}, + {"BasicRuntimeChecks", "RTCu", + "Uninitialized variables", "UninitializedLocalUsageCheck", 0}, + {"BasicRuntimeChecks", "RTC1", + "Both (/RTC1, equiv. to /RTCsu)", "EnableFastChecks", 0}, + {"BasicRuntimeChecks", "", + "Default", "Default", 0}, + + {"RuntimeLibrary", "MT", + "Multi-threaded", "MultiThreaded", 0}, + {"RuntimeLibrary", "MTd", + "Multi-threaded Debug", "MultiThreadedDebug", 0}, + {"RuntimeLibrary", "MD", + "Multi-threaded DLL", "MultiThreadedDLL", 0}, + {"RuntimeLibrary", "MDd", + "Multi-threaded Debug DLL", "MultiThreadedDebugDLL", 0}, + + {"StructMemberAlignment", "Zp1", + "1 Byte", "1Byte", 0}, + {"StructMemberAlignment", "Zp2", + "2 Bytes", "2Bytes", 0}, + {"StructMemberAlignment", "Zp4", + "4 Byte", "4Bytes", 0}, + {"StructMemberAlignment", "Zp8", + "8 Bytes", "8Bytes", 0}, + {"StructMemberAlignment", "Zp16", + "16 Bytes", "16Bytes", 0}, + {"StructMemberAlignment", "", + "Default", "Default", 0}, + + {"EnableEnhancedInstructionSet", "arch:SSE", + "Streaming SIMD Extensions", "StreamingSIMDExtensions", 0}, + {"EnableEnhancedInstructionSet", "arch:SSE2", + "Streaming SIMD Extensions 2", "StreamingSIMDExtensions2", 0}, + {"EnableEnhancedInstructionSet", "arch:AVX", + "Advanced Vector Extensions", "AdvancedVectorExtensions", 0}, + {"EnableEnhancedInstructionSet", "arch:IA32", + "No Enhanced Instructions", "NoExtensions", 0}, + {"EnableEnhancedInstructionSet", "", + "Not Set", "NotSet", 0}, + + {"FloatingPointModel", "fp:precise", + "Precise", "Precise", 0}, + {"FloatingPointModel", "fp:strict", + "Strict", "Strict", 0}, + {"FloatingPointModel", "fp:fast", + "Fast", "Fast", 0}, + + {"PrecompiledHeader", "Yc", + "Create", "Create", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeader", "Yu", + "Use", "Use", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeader", "", + "Not Using Precompiled Headers", "NotUsing", 0}, + + {"AssemblerOutput", "", + "No Listing", "NoListing", 0}, + {"AssemblerOutput", "FA", + "Assembly-Only Listing", "AssemblyCode", 0}, + {"AssemblerOutput", "FAc", + "Assembly With Machine Code", "AssemblyAndMachineCode", 0}, + {"AssemblerOutput", "FAs", + "Assembly With Source Code", "AssemblyAndSourceCode", 0}, + {"AssemblerOutput", "FAcs", + "Assembly, Machine Code and Source", "All", 0}, + + {"CallingConvention", "Gd", + "__cdecl", "Cdecl", 0}, + {"CallingConvention", "Gr", + "__fastcall", "FastCall", 0}, + {"CallingConvention", "Gz", + "__stdcall", "StdCall", 0}, + + {"CompileAs", "", + "Default", "Default", 0}, + {"CompileAs", "TC", + "Compile as C Code", "CompileAsC", 0}, + {"CompileAs", "TP", + "Compile as C++ Code", "CompileAsCpp", 0}, + + {"ErrorReporting", "errorReport:none", + "Do Not Send Report", "None", 0}, + {"ErrorReporting", "errorReport:prompt", + "Prompt Immediately", "Prompt", 0}, + {"ErrorReporting", "errorReport:queue", + "Queue For Next Login", "Queue", 0}, + {"ErrorReporting", "errorReport:send", + "Send Automatically", "Send", 0}, + + {"CompileAsManaged", "", + "No Common Language RunTime Support", "false", 0}, + {"CompileAsManaged", "clr", + "Common Language RunTime Support", "true", 0}, + {"CompileAsManaged", "clr:pure", + "Pure MSIL Common Language RunTime Support", "Pure", 0}, + {"CompileAsManaged", "clr:safe", + "Safe MSIL Common Language RunTime Support", "Safe", 0}, + {"CompileAsManaged", "clr:oldSyntax", + "Common Language RunTime Support, Old Syntax", "OldSyntax", 0}, + + + //Bool Properties + {"CompileAsWinRT", "ZW", "", "true", 0}, + {"WinRTNoStdLib", "ZW:nostdlib", "", "true", 0}, + {"SuppressStartupBanner", "nologo-", "", "false", 0}, + {"SuppressStartupBanner", "nologo", "", "true", 0}, + {"TreatWarningAsError", "WX-", "", "false", 0}, + {"TreatWarningAsError", "WX", "", "true", 0}, + {"SDLCheck", "sdl-", "", "false", 0}, + {"SDLCheck", "sdl", "", "true", 0}, + {"IntrinsicFunctions", "Oi", "", "true", 0}, + {"OmitFramePointers", "Oy-", "", "false", 0}, + {"OmitFramePointers", "Oy", "", "true", 0}, + {"EnableFiberSafeOptimizations", "GT", "", "true", 0}, + {"WholeProgramOptimization", "GL", "", "true", 0}, + {"UndefineAllPreprocessorDefinitions", "u", "", "true", 0}, + {"IgnoreStandardIncludePath", "X", "", "true", 0}, + {"PreprocessToFile", "P", "", "true", 0}, + {"PreprocessSuppressLineNumbers", "EP", "", "true", 0}, + {"PreprocessKeepComments", "C", "", "true", 0}, + {"StringPooling", "GF-", "", "false", 0}, + {"StringPooling", "GF", "", "true", 0}, + {"MinimalRebuild", "Gm-", "", "false", 0}, + {"MinimalRebuild", "Gm", "", "true", 0}, + {"SmallerTypeCheck", "RTCc", "", "true", 0}, + {"BufferSecurityCheck", "GS-", "", "false", 0}, + {"BufferSecurityCheck", "GS", "", "true", 0}, + {"FunctionLevelLinking", "Gy-", "", "false", 0}, + {"FunctionLevelLinking", "Gy", "", "true", 0}, + {"EnableParallelCodeGeneration", "Qpar-", "", "false", 0}, + {"EnableParallelCodeGeneration", "Qpar", "", "true", 0}, + {"FloatingPointExceptions", "fp:except-", "", "false", 0}, + {"FloatingPointExceptions", "fp:except", "", "true", 0}, + {"CreateHotpatchableImage", "hotpatch", "", "true", 0}, + {"DisableLanguageExtensions", "Za", "", "true", 0}, + {"TreatWChar_tAsBuiltInType", "Zc:wchar_t-", "", "false", 0}, + {"TreatWChar_tAsBuiltInType", "Zc:wchar_t", "", "true", 0}, + {"ForceConformanceInForLoopScope", "Zc:forScope-", "", "false", 0}, + {"ForceConformanceInForLoopScope", "Zc:forScope", "", "true", 0}, + {"RuntimeTypeInfo", "GR-", "", "false", 0}, + {"RuntimeTypeInfo", "GR", "", "true", 0}, + {"OpenMPSupport", "openmp-", "", "false", 0}, + {"OpenMPSupport", "openmp", "", "true", 0}, + {"ExpandAttributedSource", "Fx", "", "true", 0}, + {"UseUnicodeForAssemblerListing", "FAu", "", "true", 0}, + {"ShowIncludes", "showIncludes", "", "true", 0}, + {"EnablePREfast", "analyze-", "", "false", 0}, + {"EnablePREfast", "analyze", "", "true", 0}, + {"UseFullPaths", "FC", "", "true", 0}, + {"OmitDefaultLibName", "Zl", "", "true", 0}, + + //Bool Properties With Argument + {"MultiProcessorCompilation", "MP", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"ProcessorNumber", "MP", "Multi-processor Compilation", "", + cmVS7FlagTable::UserValueRequired}, + {"GenerateXMLDocumentationFiles", "doc", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"XMLDocumentationFileName", "doc", "Generate XML Documentation Files", "", + cmVS7FlagTable::UserValueRequired}, + {"BrowseInformation", "FR", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"BrowseInformationFile", "FR", "Enable Browse Information", "", + cmVS7FlagTable::UserValueRequired}, + + //String List Properties + {"AdditionalIncludeDirectories", "I", + "Additional Include Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AdditionalUsingDirectories", "AI", + "Additional #using Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"PreprocessorDefinitions", "D ", + "Preprocessor Definitions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"UndefinePreprocessorDefinitions", "U", + "Undefine Preprocessor Definitions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"DisableSpecificWarnings", "wd", + "Disable Specific Warnings", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ForcedIncludeFiles", "FI", + "Forced Include File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ForcedUsingFiles", "FU", + "Forced #using File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"PREfastAdditionalOptions", "analyze:", + "Additional Code Analysis Native options", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"PREfastAdditionalPlugins", "analyze:plugin", + "Additional Code Analysis Native plugins", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"TreatSpecificWarningsAsErrors", "we", + "Treat Specific Warnings As Errors", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + + //String Properties + // Skip [TrackerLogDirectory] - no command line Switch. + {"PreprocessOutputPath", "Fi", + "Preprocess Output Path", + "", cmVS7FlagTable::UserValue}, + {"PrecompiledHeaderFile", "Yc", + "Precompiled Header Name", + "", cmVS7FlagTable::UserValueRequired}, + {"PrecompiledHeaderFile", "Yu", + "Precompiled Header Name", + "", cmVS7FlagTable::UserValueRequired}, + {"PrecompiledHeaderOutputFile", "Fp", + "Precompiled Header Output File", + "", cmVS7FlagTable::UserValue}, + {"AssemblerListingLocation", "Fa", + "ASM List Location", + "", cmVS7FlagTable::UserValue}, + {"ObjectFileName", "Fo", + "Object File Name", + "", cmVS7FlagTable::UserValue}, + {"ProgramDataBaseFileName", "Fd", + "Program Database File Name", + "", cmVS7FlagTable::UserValue}, + // Skip [XMLDocumentationFileName] - no command line Switch. + // Skip [BrowseInformationFile] - no command line Switch. + {"PREfastLog", "analyze:log ", + "Code Analysis Log", + "", cmVS7FlagTable::UserValue}, + // Skip [AdditionalOptions] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVS11LibFlagTable.h b/Source/cmVS11LibFlagTable.h new file mode 100644 index 000000000..942944241 --- /dev/null +++ b/Source/cmVS11LibFlagTable.h @@ -0,0 +1,102 @@ +static cmVS7FlagTable cmVS11LibFlagTable[] = +{ + + //Enum Properties + {"ErrorReporting", "ERRORREPORT:PROMPT", + "PromptImmediately", "PromptImmediately", 0}, + {"ErrorReporting", "ERRORREPORT:QUEUE", + "Queue For Next Login", "QueueForNextLogin", 0}, + {"ErrorReporting", "ERRORREPORT:SEND", + "Send Error Report", "SendErrorReport", 0}, + {"ErrorReporting", "ERRORREPORT:NONE", + "No Error Report", "NoErrorReport", 0}, + + {"TargetMachine", "MACHINE:ARM", + "MachineARM", "MachineARM", 0}, + {"TargetMachine", "MACHINE:EBC", + "MachineEBC", "MachineEBC", 0}, + {"TargetMachine", "MACHINE:IA64", + "MachineIA64", "MachineIA64", 0}, + {"TargetMachine", "MACHINE:MIPS", + "MachineMIPS", "MachineMIPS", 0}, + {"TargetMachine", "MACHINE:MIPS16", + "MachineMIPS16", "MachineMIPS16", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", + "MachineMIPSFPU", "MachineMIPSFPU", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", + "MachineMIPSFPU16", "MachineMIPSFPU16", 0}, + {"TargetMachine", "MACHINE:SH4", + "MachineSH4", "MachineSH4", 0}, + {"TargetMachine", "MACHINE:THUMB", + "MachineTHUMB", "MachineTHUMB", 0}, + {"TargetMachine", "MACHINE:X64", + "MachineX64", "MachineX64", 0}, + {"TargetMachine", "MACHINE:X86", + "MachineX86", "MachineX86", 0}, + + {"SubSystem", "SUBSYSTEM:CONSOLE", + "Console", "Console", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", + "Windows", "Windows", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", + "Native", "Native", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", + "EFI Application", "EFI Application", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", + "EFI Boot Service Driver", "EFI Boot Service Driver", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", + "EFI ROM", "EFI ROM", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", + "EFI Runtime", "EFI Runtime", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWSCE", + "WindowsCE", "WindowsCE", 0}, + {"SubSystem", "SUBSYSTEM:POSIX", + "POSIX", "POSIX", 0}, + + + //Bool Properties + {"SuppressStartupBanner", "NOLOGO", "", "true", 0}, + {"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "", "true", 0}, + {"TreatLibWarningAsErrors", "WX:NO", "", "false", 0}, + {"TreatLibWarningAsErrors", "WX", "", "true", 0}, + {"Verbose", "VERBOSE", "", "true", 0}, + {"LinkTimeCodeGeneration", "LTCG", "", "true", 0}, + + //Bool Properties With Argument + + //String List Properties + // Skip [AdditionalDependencies] - no command line Switch. + {"AdditionalLibraryDirectories", "LIBPATH:", + "Additional Library Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"IgnoreSpecificDefaultLibraries", "NODEFAULTLIB:", + "Ignore Specific Default Libraries", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ExportNamedFunctions", "EXPORT:", + "Export Named Functions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"RemoveObjects", "REMOVE:", + "Remove Objects", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + + //String Properties + {"OutputFile", "OUT:", + "Output File", + "", cmVS7FlagTable::UserValue}, + {"ModuleDefinitionFile", "DEF:", + "Module Definition File Name", + "", cmVS7FlagTable::UserValue}, + {"ForceSymbolReferences", "INCLUDE:", + "Force Symbol References", + "", cmVS7FlagTable::UserValue}, + {"DisplayLibrary", "LIST:", + "Display Library to standard output", + "", cmVS7FlagTable::UserValue}, + // Skip [MinimumRequiredVersion] - no command line Switch. + {"Name", "NAME:", + "Name", + "", cmVS7FlagTable::UserValue}, + // Skip [AdditionalOptions] - no command line Switch. + // Skip [TrackerLogDirectory] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVS11LinkFlagTable.h b/Source/cmVS11LinkFlagTable.h new file mode 100644 index 000000000..ea0d0f0b0 --- /dev/null +++ b/Source/cmVS11LinkFlagTable.h @@ -0,0 +1,343 @@ +static cmVS7FlagTable cmVS11LinkFlagTable[] = +{ + + //Enum Properties + {"ShowProgress", "", + "Not Set", "NotSet", 0}, + {"ShowProgress", "VERBOSE", + "Display all progress messages", "LinkVerbose", 0}, + {"ShowProgress", "VERBOSE:Lib", + "For Libraries Searched", "LinkVerboseLib", 0}, + {"ShowProgress", "VERBOSE:ICF", + "About COMDAT folding during optimized linking", "LinkVerboseICF", 0}, + {"ShowProgress", "VERBOSE:REF", + "About data removed during optimized linking", "LinkVerboseREF", 0}, + {"ShowProgress", "VERBOSE:SAFESEH", + "About Modules incompatible with SEH", "LinkVerboseSAFESEH", 0}, + {"ShowProgress", "VERBOSE:CLR", + "About linker activity related to managed code", "LinkVerboseCLR", 0}, + + {"ForceFileOutput", "FORCE", + "Enabled", "Enabled", 0}, + {"ForceFileOutput", "FORCE:MULTIPLE", + "Multiply Defined Symbol Only", "MultiplyDefinedSymbolOnly", 0}, + {"ForceFileOutput", "FORCE:UNRESOLVED", + "Undefined Symbol Only", "UndefinedSymbolOnly", 0}, + + {"CreateHotPatchableImage", "FUNCTIONPADMIN", + "Enabled", "Enabled", 0}, + {"CreateHotPatchableImage", "FUNCTIONPADMIN:5", + "X86 Image Only", "X86Image", 0}, + {"CreateHotPatchableImage", "FUNCTIONPADMIN:6", + "X64 Image Only", "X64Image", 0}, + {"CreateHotPatchableImage", "FUNCTIONPADMIN:16", + "Itanium Image Only", "ItaniumImage", 0}, + + {"UACExecutionLevel", "level='asInvoker'", + "asInvoker", "AsInvoker", 0}, + {"UACExecutionLevel", "level='highestAvailable'", + "highestAvailable", "HighestAvailable", 0}, + {"UACExecutionLevel", "level='requireAdministrator'", + "requireAdministrator", "RequireAdministrator", 0}, + + {"SubSystem", "", + "Not Set", "NotSet", 0}, + {"SubSystem", "SUBSYSTEM:CONSOLE", + "Console", "Console", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", + "Windows", "Windows", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", + "Native", "Native", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", + "EFI Application", "EFI Application", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", + "EFI Boot Service Driver", "EFI Boot Service Driver", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", + "EFI ROM", "EFI ROM", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", + "EFI Runtime", "EFI Runtime", 0}, + {"SubSystem", "SUBSYSTEM:POSIX", + "POSIX", "POSIX", 0}, + + {"Driver", "", + "Not Set", "NotSet", 0}, + {"Driver", "Driver", + "Driver", "Driver", 0}, + {"Driver", "DRIVER:UPONLY", + "UP Only", "UpOnly", 0}, + {"Driver", "DRIVER:WDM", + "WDM", "WDM", 0}, + + {"LinkTimeCodeGeneration", "", + "Default", "Default", 0}, + {"LinkTimeCodeGeneration", "LTCG", + "Use Link Time Code Generation", "UseLinkTimeCodeGeneration", 0}, + {"LinkTimeCodeGeneration", "LTCG:PGInstrument", + "Profile Guided Optimization - Instrument", "PGInstrument", 0}, + {"LinkTimeCodeGeneration", "LTCG:PGOptimize", + "Profile Guided Optimization - Optimization", "PGOptimization", 0}, + {"LinkTimeCodeGeneration", "LTCG:PGUpdate", + "Profile Guided Optimization - Update", "PGUpdate", 0}, + + {"GenerateWindowsMetadata", "WINMD", + "Yes", "true", 0}, + {"GenerateWindowsMetadata", "WINMD:NO", + "No", "false", 0}, + + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA1", + "SHA1", "SHA1", 0}, + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA256", + "SHA256", "SHA256", 0}, + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA384", + "SHA384", "SHA384", 0}, + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA512", + "SHA512", "SHA512", 0}, + + {"TargetMachine", "", + "Not Set", "NotSet", 0}, + {"TargetMachine", "MACHINE:ARM", + "MachineARM", "MachineARM", 0}, + {"TargetMachine", "MACHINE:EBC", + "MachineEBC", "MachineEBC", 0}, + {"TargetMachine", "MACHINE:IA64", + "MachineIA64", "MachineIA64", 0}, + {"TargetMachine", "MACHINE:MIPS", + "MachineMIPS", "MachineMIPS", 0}, + {"TargetMachine", "MACHINE:MIPS16", + "MachineMIPS16", "MachineMIPS16", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", + "MachineMIPSFPU", "MachineMIPSFPU", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", + "MachineMIPSFPU16", "MachineMIPSFPU16", 0}, + {"TargetMachine", "MACHINE:SH4", + "MachineSH4", "MachineSH4", 0}, + {"TargetMachine", "MACHINE:THUMB", + "MachineTHUMB", "MachineTHUMB", 0}, + {"TargetMachine", "MACHINE:X64", + "MachineX64", "MachineX64", 0}, + {"TargetMachine", "MACHINE:X86", + "MachineX86", "MachineX86", 0}, + + {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:MTA", + "MTA threading attribute", "MTAThreadingAttribute", 0}, + {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:STA", + "STA threading attribute", "STAThreadingAttribute", 0}, + {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:NONE", + "Default threading attribute", "DefaultThreadingAttribute", 0}, + + {"CLRImageType", "CLRIMAGETYPE:IJW", + "Force IJW image", "ForceIJWImage", 0}, + {"CLRImageType", "CLRIMAGETYPE:PURE", + "Force Pure IL Image", "ForcePureILImage", 0}, + {"CLRImageType", "CLRIMAGETYPE:SAFE", + "Force Safe IL Image", "ForceSafeILImage", 0}, + {"CLRImageType", "", + "Default image type", "Default", 0}, + + {"SignHash", "CLRSIGNHASH:SHA1", + "SHA1", "SHA1", 0}, + {"SignHash", "CLRSIGNHASH:SHA256", + "SHA256", "SHA256", 0}, + {"SignHash", "CLRSIGNHASH:SHA384", + "SHA384", "SHA384", 0}, + {"SignHash", "CLRSIGNHASH:SHA512", + "SHA512", "SHA512", 0}, + + {"LinkErrorReporting", "ERRORREPORT:PROMPT", + "PromptImmediately", "PromptImmediately", 0}, + {"LinkErrorReporting", "ERRORREPORT:QUEUE", + "Queue For Next Login", "QueueForNextLogin", 0}, + {"LinkErrorReporting", "ERRORREPORT:SEND", + "Send Error Report", "SendErrorReport", 0}, + {"LinkErrorReporting", "ERRORREPORT:NONE", + "No Error Report", "NoErrorReport", 0}, + + {"CLRSupportLastError", "CLRSupportLastError", + "Enabled", "Enabled", 0}, + {"CLRSupportLastError", "CLRSupportLastError:NO", + "Disabled", "Disabled", 0}, + {"CLRSupportLastError", "CLRSupportLastError:SYSTEMDLL", + "System Dlls Only", "SystemDlls", 0}, + + + //Bool Properties + {"LinkIncremental", "INCREMENTAL:NO", "", "false", 0}, + {"LinkIncremental", "INCREMENTAL", "", "true", 0}, + {"SuppressStartupBanner", "NOLOGO", "", "true", 0}, + {"LinkStatus", "LTCG:NOSTATUS", "", "false", 0}, + {"LinkStatus", "LTCG:STATUS", "", "true", 0}, + {"PreventDllBinding", "ALLOWBIND:NO", "", "false", 0}, + {"PreventDllBinding", "ALLOWBIND", "", "true", 0}, + {"TreatLinkerWarningAsErrors", "WX:NO", "", "false", 0}, + {"TreatLinkerWarningAsErrors", "WX", "", "true", 0}, + {"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "", "true", 0}, + {"GenerateManifest", "MANIFEST:NO", "", "false", 0}, + {"GenerateManifest", "MANIFEST", "", "true", 0}, + {"AllowIsolation", "ALLOWISOLATION:NO", "", "false", 0}, + {"UACUIAccess", "uiAccess='false'", "", "false", 0}, + {"UACUIAccess", "uiAccess='true'", "", "true", 0}, + {"ManifestEmbed", "manifest:embed", "", "true", 0}, + {"GenerateDebugInformation", "DEBUG", "", "true", 0}, + {"MapExports", "MAPINFO:EXPORTS", "", "true", 0}, + {"AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0}, + {"AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0}, + {"LargeAddressAware", "LARGEADDRESSAWARE:NO", "", "false", 0}, + {"LargeAddressAware", "LARGEADDRESSAWARE", "", "true", 0}, + {"TerminalServerAware", "TSAWARE:NO", "", "false", 0}, + {"TerminalServerAware", "TSAWARE", "", "true", 0}, + {"SwapRunFromCD", "SWAPRUN:CD", "", "true", 0}, + {"SwapRunFromNET", "SWAPRUN:NET", "", "true", 0}, + {"OptimizeReferences", "OPT:NOREF", "", "false", 0}, + {"OptimizeReferences", "OPT:REF", "", "true", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "", "false", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "", "true", 0}, + {"IgnoreEmbeddedIDL", "IGNOREIDL", "", "true", 0}, + {"AppContainer", "APPCONTAINER", "", "true", 0}, + {"WindowsMetadataLinkDelaySign", "WINMDDELAYSIGN:NO", "", "false", 0}, + {"WindowsMetadataLinkDelaySign", "WINMDDELAYSIGN", "", "true", 0}, + {"NoEntryPoint", "NOENTRY", "", "true", 0}, + {"SetChecksum", "RELEASE", "", "true", 0}, + {"RandomizedBaseAddress", "DYNAMICBASE:NO", "", "false", 0}, + {"RandomizedBaseAddress", "DYNAMICBASE", "", "true", 0}, + {"FixedBaseAddress", "FIXED:NO", "", "false", 0}, + {"FixedBaseAddress", "FIXED", "", "true", 0}, + {"DataExecutionPrevention", "NXCOMPAT:NO", "", "false", 0}, + {"DataExecutionPrevention", "NXCOMPAT", "", "true", 0}, + {"TurnOffAssemblyGeneration", "NOASSEMBLY", "", "true", 0}, + {"SupportUnloadOfDelayLoadedDLL", "DELAY:UNLOAD", "", "true", 0}, + {"SupportNobindOfDelayLoadedDLL", "DELAY:NOBIND", "", "true", 0}, + {"Profile", "PROFILE", "", "true", 0}, + {"LinkDelaySign", "DELAYSIGN:NO", "", "false", 0}, + {"LinkDelaySign", "DELAYSIGN", "", "true", 0}, + {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK:NO", "", "false", 0}, + {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK", "", "true", 0}, + {"DetectOneDefinitionRule", "ODR", "", "true", 0}, + {"ImageHasSafeExceptionHandlers", "SAFESEH:NO", "", "false", 0}, + {"ImageHasSafeExceptionHandlers", "SAFESEH", "", "true", 0}, + {"LinkDLL", "DLL", "", "true", 0}, + + //Bool Properties With Argument + {"EnableUAC", "MANIFESTUAC:NO", "", "false", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"EnableUAC", "MANIFESTUAC:NO", "Enable User Account Control (UAC)", "", + cmVS7FlagTable::UserValueRequired}, + {"EnableUAC", "MANIFESTUAC:", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"UACUIAccess", "MANIFESTUAC:", "Enable User Account Control (UAC)", "", + cmVS7FlagTable::UserValueRequired}, + {"GenerateMapFile", "MAP", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"MapFileName", "MAP", "Generate Map File", "", + cmVS7FlagTable::UserValueRequired}, + + //String List Properties + {"AdditionalLibraryDirectories", "LIBPATH:", + "Additional Library Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + // Skip [AdditionalDependencies] - no command line Switch. + {"IgnoreSpecificDefaultLibraries", "NODEFAULTLIB:", + "Ignore Specific Default Libraries", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AddModuleNamesToAssembly", "ASSEMBLYMODULE:", + "Add Module to Assembly", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"EmbedManagedResourceFile", "ASSEMBLYRESOURCE:", + "Embed Managed Resource File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ForceSymbolReferences", "INCLUDE:", + "Force Symbol References", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"DelayLoadDLLs", "DELAYLOAD:", + "Delay Loaded Dlls", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AssemblyLinkResource", "ASSEMBLYLINKRESOURCE:", + "Assembly Link Resource", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AdditionalManifestDependencies", "MANIFESTDEPENDENCY:", + "Additional Manifest Dependencies", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ManifestInput", "manifestinput:", + "Manifest Input", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + + //String Properties + {"OutputFile", "OUT:", + "Output File", + "", cmVS7FlagTable::UserValue}, + {"Version", "VERSION:", + "Version", + "", cmVS7FlagTable::UserValue}, + {"SpecifySectionAttributes", "SECTION:", + "Specify Section Attributes", + "", cmVS7FlagTable::UserValue}, + {"MSDOSStubFileName", "STUB:", + "MS-DOS Stub File Name", + "", cmVS7FlagTable::UserValue}, + // Skip [TrackerLogDirectory] - no command line Switch. + {"ModuleDefinitionFile", "DEF:", + "Module Definition File", + "", cmVS7FlagTable::UserValue}, + {"ManifestFile", "ManifestFile:", + "Manifest File", + "", cmVS7FlagTable::UserValue}, + {"ProgramDatabaseFile", "PDB:", + "Generate Program Database File", + "", cmVS7FlagTable::UserValue}, + {"StripPrivateSymbols", "PDBSTRIPPED:", + "Strip Private Symbols", + "", cmVS7FlagTable::UserValue}, + // Skip [MapFileName] - no command line Switch. + // Skip [MinimumRequiredVersion] - no command line Switch. + {"HeapReserveSize", "HEAP:", + "Heap Reserve Size", + "", cmVS7FlagTable::UserValue}, + // Skip [HeapCommitSize] - no command line Switch. + {"StackReserveSize", "STACK:", + "Stack Reserve Size", + "", cmVS7FlagTable::UserValue}, + // Skip [StackCommitSize] - no command line Switch. + {"FunctionOrder", "ORDER:@", + "Function Order", + "", cmVS7FlagTable::UserValue}, + {"ProfileGuidedDatabase", "PGD:", + "Profile Guided Database", + "", cmVS7FlagTable::UserValue}, + {"MidlCommandFile", "MIDL:@", + "MIDL Commands", + "", cmVS7FlagTable::UserValue}, + {"MergedIDLBaseFileName", "IDLOUT:", + "Merged IDL Base File Name", + "", cmVS7FlagTable::UserValue}, + {"TypeLibraryFile", "TLBOUT:", + "Type Library", + "", cmVS7FlagTable::UserValue}, + {"WindowsMetadataFile", "WINMDFILE:", + "Windows Metadata File", + "", cmVS7FlagTable::UserValue}, + {"WindowsMetadataLinkKeyFile", "WINMDKEYFILE:", + "Windows Metadata Key File", + "", cmVS7FlagTable::UserValue}, + {"WindowsMetadataKeyContainer", "WINMDKEYCONTAINER:", + "Windows Metadata Key Container", + "", cmVS7FlagTable::UserValue}, + {"EntryPointSymbol", "ENTRY:", + "Entry Point", + "", cmVS7FlagTable::UserValue}, + {"BaseAddress", "BASE:", + "Base Address", + "", cmVS7FlagTable::UserValue}, + {"ImportLibrary", "IMPLIB:", + "Import Library", + "", cmVS7FlagTable::UserValue}, + {"MergeSections", "MERGE:", + "Merge Sections", + "", cmVS7FlagTable::UserValue}, + {"LinkKeyFile", "KEYFILE:", + "Key File", + "", cmVS7FlagTable::UserValue}, + {"KeyContainer", "KEYCONTAINER:", + "Key Container", + "", cmVS7FlagTable::UserValue}, + // Skip [AdditionalOptions] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 53b6a9bb7..fea117a4f 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -22,9 +22,36 @@ #include "cmVS10CLFlagTable.h" #include "cmVS10LinkFlagTable.h" #include "cmVS10LibFlagTable.h" +#include "cmVS11CLFlagTable.h" +#include "cmVS11LinkFlagTable.h" +#include "cmVS11LibFlagTable.h" #include +static cmVS7FlagTable const* +cmVSGetCLFlagTable(cmLocalVisualStudioGenerator* lg) +{ + if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS11) + { return cmVS11CLFlagTable; } + return cmVS10CLFlagTable; +} + +static cmVS7FlagTable const* +cmVSGetLibFlagTable(cmLocalVisualStudioGenerator* lg) +{ + if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS11) + { return cmVS11LibFlagTable; } + return cmVS10LibFlagTable; +} + +static cmVS7FlagTable const* +cmVSGetLinkFlagTable(cmLocalVisualStudioGenerator* lg) +{ + if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS11) + { return cmVS11LinkFlagTable; } + return cmVS10LinkFlagTable; +} + static std::string cmVS10EscapeXML(std::string arg) { cmSystemTools::ReplaceString(arg, "&", "&"); @@ -413,7 +440,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() } if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { - this->WriteString("true\n", 2); + this->WriteString("true" + "\n", 2); } this->WriteString("\n", 1); } @@ -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 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"; @@ -1423,7 +1452,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& // Replace spaces in libs with ; cmSystemTools::ReplaceString(libs, " ", ";"); cmComputeLinkInformation* pcli = - this->Target->GetLinkInformation(config.c_str()); + this->GeneratorTarget->GetLinkInformation(config.c_str()); if(!pcli) { cmSystemTools::Error @@ -1565,7 +1594,8 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() static_cast (this->GlobalGenerator)->GetConfigurations(); std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget); for(std::vector::iterator i = configs->begin(); i != configs->end(); ++i) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 75aa4712c..e559fe0e8 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -630,7 +630,8 @@ bool cmake::FindPackage(const std::vector& args) std::string linkLibs; std::string flags; std::string linkFlags; - lg->GetTargetFlags(linkLibs, flags, linkFlags, *tgt); + cmGeneratorTarget gtgt(tgt); + lg->GetTargetFlags(linkLibs, flags, linkFlags, >gt); printf("%s\n", linkLibs.c_str() ); @@ -2326,6 +2327,17 @@ int cmake::ActualConfigure() this->CacheManager->RemoveCacheEntry("CMAKE_GENERATOR"); this->CacheManager->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR"); } + + cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); + if (mf->IsOn("CTEST_USE_LAUNCHERS") + && !this->GetProperty("RULE_LAUNCH_COMPILE", cmProperty::GLOBAL)) + { + cmSystemTools::Error("CTEST_USE_LAUNCHERS is enabled, but the " + "RULE_LAUNCH_COMPILE global property is not defined.\n" + "Did you forget to include(CTest) in the toplevel " + "CMakeLists.txt ?"); + } + // only save the cache if there were no fatal errors if ( this->GetWorkingMode() == NORMAL_MODE ) { @@ -2438,9 +2450,6 @@ int cmake::Run(const std::vector& args, bool noconfigure) this->PreLoadCMakeFiles(); - std::string systemFile = this->GetHomeOutputDirectory(); - systemFile += "/CMakeSystem.cmake"; - if ( noconfigure ) { return 0; diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx index 69df88d2a..34350bf7a 100644 --- a/Source/cmcldeps.cxx +++ b/Source/cmcldeps.cxx @@ -238,7 +238,9 @@ int main() { // needed to suppress filename output of msvc tools std::string srcfilename; std::string::size_type pos = srcfile.rfind("\\"); - if (pos != std::string::npos) { + if (pos == std::string::npos) { + srcfilename = srcfile; + } else { srcfilename = srcfile.substr(pos + 1); } diff --git a/Source/cmparseMSBuildXML.py b/Source/cmparseMSBuildXML.py index a0c7ec44a..35b55ca25 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 true|false # 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/CMakeLists.txt b/Tests/CMakeLists.txt index 35a8d413d..e03b9268e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -213,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) diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 6fe91c781..ba681d8ac 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 000000000..848ffdd36 --- /dev/null +++ b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CompilerIdC C) + +foreach(v + CMAKE_C_COMPILER + CMAKE_C_COMPILER_ID + CMAKE_C_COMPILER_VERSION + ) + if(${v}) + message(STATUS "${v}=[${${v}}]") + else() + message(SEND_ERROR "${v} not set!") + endif() +endforeach() diff --git a/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt new file mode 100644 index 000000000..94ac31e4c --- /dev/null +++ b/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CompilerIdCXX CXX) + +foreach(v + CMAKE_CXX_COMPILER + CMAKE_CXX_COMPILER_ID + CMAKE_CXX_COMPILER_VERSION + ) + if(${v}) + message(STATUS "${v}=[${${v}}]") + else() + message(SEND_ERROR "${v} not set!") + endif() +endforeach() diff --git a/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt new file mode 100644 index 000000000..3a2bdebd6 --- /dev/null +++ b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CompilerIdFortran Fortran) + +foreach(v + CMAKE_Fortran_COMPILER + CMAKE_Fortran_COMPILER_ID + ) + if(${v}) + message(STATUS "${v}=[${${v}}]") + else() + message(SEND_ERROR "${v} not set!") + endif() +endforeach() +foreach(v + CMAKE_Fortran_COMPILER_VERSION + ) + if(${v}) + message(STATUS "${v}=[${${v}}]") + else() + message(WARNING "${v} not set!") + endif() +endforeach() diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in index 9dc2ebb27..3f0ab5075 100644 --- a/Tests/CMakeTests/FileDownloadTest.cmake.in +++ b/Tests/CMakeTests/FileDownloadTest.cmake.in @@ -33,6 +33,59 @@ file(DOWNLOAD ) message(STATUS "FileDownload:4") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA1 50c614fc28b39c1281d0517bb6d5858b4359c9b7 + ) + +message(STATUS "FileDownload:5") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA224 73cd5f442b04e8320e4f907f8e1b21d4befff98b5bd77bc32526ea68 + ) + +message(STATUS "FileDownload:6") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA256 2e067f6c09cbc7cd619c8fbcc44eb64cd6b45a95e4cddb3a585eee1f731c4da9 + ) + +message(STATUS "FileDownload:7") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA384 398bf41902a7251c30e522b307e3e41e3fb617c765b3feaa99b2f7d063894708ad399267ccc25d877437a10e5e890d35 + ) + +message(STATUS "FileDownload:8") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA512 c51854d21052713968b849c2b4263cf54be03bc3a7e9847a6c71c6c8d1d13cd805fe1b9fa95f9ba1d0a5631513974f6fae21e34ab5b171d94bad48df5f073e48 + ) +message(STATUS "FileDownload:9") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH MD5 d16778650db435bda3a8c3435c3ff5d1 + ) + +message(STATUS "FileDownload:10") file(DOWNLOAD ${url} ${dir}/file3.png diff --git a/Tests/CMakeTests/ToolchainTest.cmake.in b/Tests/CMakeTests/ToolchainTest.cmake.in index c010fca7c..96e7196a5 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/CMakeTests/VersionTest.cmake.in b/Tests/CMakeTests/VersionTest.cmake.in index 215bb2b96..9e31cb431 100644 --- a/Tests/CMakeTests/VersionTest.cmake.in +++ b/Tests/CMakeTests/VersionTest.cmake.in @@ -7,3 +7,10 @@ if("${CMAKE_VERSION}" VERSION_LESS "${min_ver}") else() message("CMAKE_VERSION=[${CMAKE_VERSION}] is not less than [${min_ver}]") endif() + +set(v 1.2.3.4.5.6.7) +if("${v}.8" VERSION_LESS "${v}.9") + message(STATUS "${v}.8 is less than ${v}.9") +else() + message(FATAL_ERROR "${v}.8 is not less than ${v}.9?") +endif() diff --git a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt index 8b279a5c4..20001e6ed 100644 --- a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt +++ b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt @@ -46,6 +46,7 @@ echo_var(MSVC80) echo_var(MSVC90) echo_var(MSVC10) echo_var(MSVC11) +echo_var(MSVC_IDE) if(MSVC) # @@ -60,6 +61,13 @@ if(MSVC) else() message(FATAL_ERROR "error: ${msvc_total} MSVC** variables are defined -- exactly 1 expected") endif() + if(NOT DEFINED MSVC_IDE) + message(FATAL_ERROR "MSVC_IDE not defined but should be!") + elseif("${CMAKE_GENERATOR}" MATCHES "Visual Studio" AND NOT MSVC_IDE) + message(FATAL_ERROR "MSVC_IDE is not true but should be (${CMAKE_GENERATOR})!") + elseif(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio" AND MSVC_IDE) + message(FATAL_ERROR "MSVC_IDE is true but should not be (${CMAKE_GENERATOR})!") + endif() else() # # The compiler is something other than cl... None of the MSVC** variables @@ -70,6 +78,9 @@ else() else() message(FATAL_ERROR "error: ${msvc_total} MSVC** variables are defined -- exactly 0 expected") endif() + if(DEFINED MSVC_IDE) + message(FATAL_ERROR "MSVC_IDE is defined but should not be!") + endif() endif() diff --git a/Tests/CompileDefinitions/CMakeLists.txt b/Tests/CompileDefinitions/CMakeLists.txt new file mode 100644 index 000000000..e7d91bf94 --- /dev/null +++ b/Tests/CompileDefinitions/CMakeLists.txt @@ -0,0 +1,16 @@ + +cmake_minimum_required(VERSION 2.8) + +project(CompileDefinitions) + +if ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 6") + add_definitions(-DNO_SPACES_IN_DEFINE_VALUES) +endif() + +add_subdirectory(add_definitions_command) +add_subdirectory(target_prop) +add_subdirectory(add_definitions_command_with_target_prop) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummyexecutable.cpp" "int main(int, char **) { return 0; }\n") + +add_executable(CompileDefinitions "${CMAKE_CURRENT_BINARY_DIR}/dummyexecutable.cpp") diff --git a/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt b/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt new file mode 100644 index 000000000..a6372af74 --- /dev/null +++ b/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt @@ -0,0 +1,7 @@ + +project(add_definitions_command) + +add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun -DCMAKE_IS_="Fun" -DCMAKE_IS_REALLY="Very Fun") +add_definitions(-DCMAKE_IS_="Fun" -DCMAKE_IS_REALLY="Very Fun" -DCMAKE_IS_FUN -DCMAKE_IS=Fun) + +add_executable(add_definitions_command_executable ../compiletest.cpp) diff --git a/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt b/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt new file mode 100644 index 000000000..e415390c0 --- /dev/null +++ b/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt @@ -0,0 +1,14 @@ + +project(add_definitions_command_with_target_prop) + +add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun) + +add_executable(add_definitions_command_with_target_prop_executable ../compiletest.cpp) + +set_target_properties(add_definitions_command_with_target_prop_executable PROPERTIES COMPILE_DEFINITIONS CMAKE_IS_="Fun") + +set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_REALLY="Very Fun") + +add_definitions(-DCMAKE_IS_FUN) + +set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS=Fun CMAKE_IS_="Fun") diff --git a/Tests/CompileDefinitions/compiletest.cpp b/Tests/CompileDefinitions/compiletest.cpp new file mode 100644 index 000000000..6db6f3f96 --- /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 +struct CMakeStaticAssert; + +template<> +struct CMakeStaticAssert {}; + +static const char fun_string[] = CMAKE_IS_; +#ifndef NO_SPACES_IN_DEFINE_VALUES +static const char very_fun_string[] = CMAKE_IS_REALLY; +#endif + +enum { + StringLiteralTest1 = sizeof(CMakeStaticAssert) +#ifndef NO_SPACES_IN_DEFINE_VALUES + , + StringLiteralTest2 = sizeof(CMakeStaticAssert) +#endif +}; + +int main(int argc, char **argv) +{ + return 0; +} diff --git a/Tests/CompileDefinitions/target_prop/CMakeLists.txt b/Tests/CompileDefinitions/target_prop/CMakeLists.txt new file mode 100644 index 000000000..e2b6ba9b2 --- /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 33ffe2ede..3f8e8273d 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -189,7 +189,7 @@ set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") set(proj TutorialStep1-LocalNoDirTGZ) ExternalProject_Add(${proj} URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tgz" - URL_MD5 0b8182edcecdf40bf1c9d71d7d259f78 + URL_HASH SHA256=496229e2a5ed620a37c385ad9406004a18026beab8b55dd2c4565d4b7f1d5383 CMAKE_GENERATOR "${CMAKE_GENERATOR}" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= INSTALL_COMMAND "" diff --git a/Tests/ObjectLibrary/A/CMakeLists.txt b/Tests/ObjectLibrary/A/CMakeLists.txt index 04ab02f16..36c86e7e9 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 4b0b07d1c..32d8cebf6 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/RunCMake/GeneratorExpression/BadAND-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt index ced21d806..36302db9b 100644 --- a/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt @@ -1,9 +1,18 @@ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires at least one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ CMake Error at BadAND.cmake:1 \(add_custom_target\): Error evaluating generator expression: \$ - AND requires one or more comma-separated '0' or '1' values. + Parameters to \$ must resolve to either '0' or '1'. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + @@ -12,6 +21,24 @@ CMake Error at BadAND.cmake:1 \(add_custom_target\): \$ - AND requires one or more comma-separated '0' or '1' values. + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadAND.cmake b/Tests/RunCMake/GeneratorExpression/BadAND.cmake index 792654046..265e4149b 100644 --- a/Tests/RunCMake/GeneratorExpression/BadAND.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadAND.cmake @@ -1,4 +1,7 @@ add_custom_target(check ALL COMMAND check + $ $ $ + $ + $ VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt index 7c86b250f..1cfbf404e 100644 --- a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt @@ -1,8 +1,44 @@ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): Error evaluating generator expression: \$ + Expression syntax not recognized. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Expression syntax not recognized. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + Expression syntax not recognized. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake index 0c13f8944..c27ea5f73 100644 --- a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake @@ -1,3 +1,7 @@ add_custom_target(check ALL COMMAND check + $ $ + $ + $ + $<$:foo> VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt index 5721f5fe1..32169c537 100644 --- a/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt @@ -1,9 +1,17 @@ CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++CMake Error at BadNOT.cmake:1 \(add_custom_target\): Error evaluating generator expression: \$ - NOT requires exactly one '0' or '1' value. + \$ parameter must resolve to exactly one '0' or '1' value. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + @@ -12,7 +20,7 @@ CMake Error at BadNOT.cmake:1 \(add_custom_target\): \$ - NOT requires exactly one '0' or '1' value. + \$ parameter must resolve to exactly one '0' or '1' value. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + @@ -21,6 +29,24 @@ CMake Error at BadNOT.cmake:1 \(add_custom_target\): \$ - NOT requires exactly one '0' or '1' value. + \$ expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ parameter must resolve to exactly one '0' or '1' value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ parameter must resolve to exactly one '0' or '1' value. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT.cmake b/Tests/RunCMake/GeneratorExpression/BadNOT.cmake index 452293b8d..c2dada3c2 100644 --- a/Tests/RunCMake/GeneratorExpression/BadNOT.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadNOT.cmake @@ -1,5 +1,8 @@ add_custom_target(check ALL COMMAND check + $ $ $ $ + $ + $ VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt index 72ef2dd3c..d4ccab74c 100644 --- a/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt @@ -1,9 +1,18 @@ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ expression requires at least one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ CMake Error at BadOR.cmake:1 \(add_custom_target\): Error evaluating generator expression: \$ - OR requires one or more comma-separated '0' or '1' values. + Parameters to \$ must resolve to either '0' or '1'. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + @@ -12,6 +21,24 @@ CMake Error at BadOR.cmake:1 \(add_custom_target\): \$ - OR requires one or more comma-separated '0' or '1' values. + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadOR.cmake b/Tests/RunCMake/GeneratorExpression/BadOR.cmake index f16f56a3c..0813400d6 100644 --- a/Tests/RunCMake/GeneratorExpression/BadOR.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadOR.cmake @@ -1,4 +1,7 @@ add_custom_target(check ALL COMMAND check + $ $ $ + $ + $ VERBATIM) diff --git a/Tests/Wrapping/CMakeLists.txt b/Tests/Wrapping/CMakeLists.txt index 22233df6f..58e9c3242 100644 --- a/Tests/Wrapping/CMakeLists.txt +++ b/Tests/Wrapping/CMakeLists.txt @@ -40,7 +40,7 @@ endif() set(WRAP ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/Wrap${EXE_EXT}) # -# QT Wrappers +# Qt Wrappers # set (QT_WRAP_CPP "On") @@ -48,7 +48,7 @@ set (QT_MOC_EXE "echo") include( FindQt3 ) if (QT_FOUND AND QT_WRAP_UI) - message("found qt 3 test it...") + message("found Qt 3 test it...") include_directories( ${QT_INCLUDE_DIR} ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) @@ -67,8 +67,8 @@ if (QT_FOUND AND QT_WRAP_UI) qt_wrap_ui (myqtlib QTUI_H_SRCS QTUI_S_SRCS ${QTUI_SRCS}) qt_wrap_cpp (myqtlib QT_MOC_SRCS ${SRCS} vtkTestMoc.h) - message("QT files are ${QTUI_S_SRCS}") - message("QT other files are ${QTUI_H_SRCS}") + message("Qt files are ${QTUI_S_SRCS}") + message("Qt other files are ${QTUI_H_SRCS}") add_definitions(${QT_DEFINITIONS}) add_library(myqtlib ${QTUI_S_SRCS} ${QT_MOC_SRCS}) add_executable (qtwrapping qtwrappingmain.cxx) diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index 233d5e23a..b8f6b3cb6 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -27,7 +27,6 @@ set(MAN_FILES ) set(TEXT_FILES ${CMake_BINARY_DIR}/Docs/cmake.txt - ${CMake_BINARY_DIR}/Docs/cmake.docbook ${CMake_BINARY_DIR}/Docs/cmake-policies.txt ${CMake_BINARY_DIR}/Docs/cmake-properties.txt ${CMake_BINARY_DIR}/Docs/cmake-variables.txt @@ -44,6 +43,9 @@ set(HTML_FILES ${CMake_BINARY_DIR}/Docs/cmake-commands.html ${CMake_BINARY_DIR}/Docs/cmake-compatcommands.html ) +set(DOCBOOK_FILES + ${CMake_BINARY_DIR}/Docs/cmake.docbook + ) macro(ADD_DOCS target dependency) # Generate documentation for "ctest" executable. @@ -63,11 +65,9 @@ macro(ADD_DOCS target dependency) ) set(DOC_FILES ${DOC_FILES} ${CMake_BINARY_DIR}/Docs/${target}.txt) list(APPEND MAN_FILES ${CMake_BINARY_DIR}/Docs/${target}.1) - list(APPEND TEXT_FILES - ${CMake_BINARY_DIR}/Docs/${target}.txt - ${CMake_BINARY_DIR}/Docs/${target}.docbook - ) + list(APPEND TEXT_FILES ${CMake_BINARY_DIR}/Docs/${target}.txt) list(APPEND HTML_FILES ${CMake_BINARY_DIR}/Docs/${target}.html) + list(APPEND DOCBOOK_FILES ${CMake_BINARY_DIR}/Docs/${target}.docbook) endif() endmacro() @@ -124,7 +124,11 @@ add_custom_command( ) install_files(${CMAKE_MAN_DIR}/man1 FILES ${MAN_FILES}) -install_files(${CMAKE_DOC_DIR} FILES ${HTML_FILES} ${TEXT_FILES}) +install_files(${CMAKE_DOC_DIR} FILES + ${TEXT_FILES} + ${HTML_FILES} + ${DOCBOOK_FILES} + ) install(FILES cmake.m4 DESTINATION share/aclocal) # Drive documentation generation. @@ -141,17 +145,22 @@ if(BUILD_TESTING) execute_process(COMMAND ${LIBXML2_XMLLINT_EXECUTABLE} --help OUTPUT_VARIABLE _help ERROR_VARIABLE _err) if("${_help}" MATCHES "--path" AND "${_help}" MATCHES "--nonet") - # We provide the XHTML DTD and its dependencies in the 'xml' - # directory so that xmllint can run without network access. - # However, it's --path option accepts a space-separated list of - # paths so it cannot handle spaces in the path to the source tree. - # Therefore we run the tool with the current work directory set to - # the 'xml' directory and use '.' as the path. + # We provide DTDs in the 'xml' directory so that xmllint can run without + # network access. Note that xmllints's --path option accepts a + # space-separated list of url-encoded paths. + set(_dtd_dir "${CMAKE_CURRENT_SOURCE_DIR}/xml") + string(REPLACE " " "%20" _dtd_dir "${_dtd_dir}") + string(REPLACE ":" "%3A" _dtd_dir "${_dtd_dir}") add_test(CMake.HTML - ${CMAKE_CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}/xml - ${LIBXML2_XMLLINT_EXECUTABLE} --valid --noout --nonet --path . + ${LIBXML2_XMLLINT_EXECUTABLE} --valid --noout --nonet + --path ${_dtd_dir}/xhtml1 ${HTML_FILES} ) + add_test(CMake.DocBook + ${LIBXML2_XMLLINT_EXECUTABLE} --valid --noout --nonet + --path ${_dtd_dir}/docbook-4.5 + ${DOCBOOK_FILES} + ) endif() endif() endif() diff --git a/Utilities/Release/dash2win64_release.cmake b/Utilities/Release/dash2win64_release.cmake index fb82de0d0..6d1ac767e 100644 --- a/Utilities/Release/dash2win64_release.cmake +++ b/Utilities/Release/dash2win64_release.cmake @@ -8,6 +8,7 @@ set(CPACK_SOURCE_GENERATORS "ZIP") set(MAKE_PROGRAM "make") set(MAKE "${MAKE_PROGRAM} -j8") set(INITIAL_CACHE "CMAKE_BUILD_TYPE:STRING=Release +CMAKE_USE_OPENSSL:BOOL=ON CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CMAKE_Fortran_COMPILER:FILEPATH=FALSE CMAKE_GENERATOR:INTERNAL=Unix Makefiles diff --git a/Utilities/Release/dashmacmini2_release.cmake b/Utilities/Release/dashmacmini2_release.cmake index 3e6b04973..5e57a70b2 100644 --- a/Utilities/Release/dashmacmini2_release.cmake +++ b/Utilities/Release/dashmacmini2_release.cmake @@ -9,6 +9,10 @@ set(CPACK_BINARY_GENERATORS "PackageMaker TGZ TZ") set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release CMAKE_OSX_ARCHITECTURES:STRING=ppc;i386 +CMAKE_USE_OPENSSL:BOOL=ON +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1c-install/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/Users/kitware/openssl-1.0.1c-install/include +OPENSSL_SSL_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1c-install/lib/libssl.a CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CPACK_SYSTEM_NAME:STRING=Darwin-universal BUILD_QtDialog:BOOL=TRUE diff --git a/Utilities/Release/dashmacmini5_release.cmake b/Utilities/Release/dashmacmini5_release.cmake index bd93a8733..36b095287 100644 --- a/Utilities/Release/dashmacmini5_release.cmake +++ b/Utilities/Release/dashmacmini5_release.cmake @@ -8,6 +8,10 @@ set(MAKE "${MAKE_PROGRAM} -j5") set(CPACK_BINARY_GENERATORS "PackageMaker TGZ TZ") set(CPACK_SOURCE_GENERATORS "TGZ TZ") set(INITIAL_CACHE " +CMAKE_USE_OPENSSL:BOOL=ON +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1c-install/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/Users/kitware/openssl-1.0.1c-install/include +OPENSSL_SSL_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1c-install/lib/libssl.a CMAKE_BUILD_TYPE:STRING=Release CMAKE_OSX_ARCHITECTURES:STRING=x86_64;i386 CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.5 diff --git a/Utilities/Release/magrathea_release.cmake b/Utilities/Release/magrathea_release.cmake index 1b2ae02c7..4783fdad3 100644 --- a/Utilities/Release/magrathea_release.cmake +++ b/Utilities/Release/magrathea_release.cmake @@ -3,11 +3,17 @@ set(HOST magrathea) set(MAKE_PROGRAM "make") set(CC gcc332s) set(CXX c++332s) +set(CFLAGS -DDT_RUNPATH=29) +set(CXXFLAGS -DDT_RUNPATH=29) set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release CURSES_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libncurses.a CURSES_INCLUDE_PATH:PATH=/usr/i686-gcc-332s/include/ncurses FORM_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libform.a +CMAKE_USE_OPENSSL:BOOL=ON +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1c-install/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.1c-install/include +OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1c-install/lib/libssl.a CPACK_SYSTEM_NAME:STRING=Linux-i386 BUILD_QtDialog:BOOL:=TRUE QT_QMAKE_EXECUTABLE:FILEPATH=/home/kitware/qt-4.43-install/bin/qmake diff --git a/Utilities/Release/v20n250_aix_release.cmake b/Utilities/Release/v20n250_aix_release.cmake index 53c34d7ce..cc8cd058b 100644 --- a/Utilities/Release/v20n250_aix_release.cmake +++ b/Utilities/Release/v20n250_aix_release.cmake @@ -7,6 +7,7 @@ set(MAKE_PROGRAM "make") set(CC "xlc_r") set(CXX "xlC_r") set(FC "xlf") +set(LDFLAGS "-Wl,-bmaxdata:0x80000000") # Push "Segmentation fault in extend_brk" over horizon set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index caa44f1d6..ef000a16a 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -169,27 +169,42 @@ IF(NOT CURL_SPECIAL_LIBZ) CHECK_LIBRARY_EXISTS_CONCAT("z" inflateEnd HAVE_LIBZ) ENDIF(NOT CURL_SPECIAL_LIBZ) -OPTION(CMAKE_USE_OPENSSL "Use OpenSSL code." OFF) +OPTION(CMAKE_USE_OPENSSL "Use OpenSSL code with curl." OFF) MARK_AS_ADVANCED(CMAKE_USE_OPENSSL) IF(CMAKE_USE_OPENSSL) SET(USE_SSLEAY TRUE) SET(USE_OPENSSL TRUE) - IF(WIN32) - FIND_PATH(SSLINCLUDE openssl/crypto.h - PATHS c:/hoffman/Tools/openssl_w32vc6-0.9.8g/inc32) - INCLUDE_DIRECTORIES(${SSLINCLUDE}) - FIND_LIBRARY(LIBEAY NAMES libeay32) - FIND_LIBRARY(SSLEAY NAMES ssleay32) - SET(CURL_LIBS ${CURL_LIBS} ${LIBEAY} ${SSLEAY} ) - ELSE(WIN32) - CHECK_LIBRARY_EXISTS_CONCAT("crypto" CRYPTO_lock HAVE_LIBCRYPTO) - CHECK_LIBRARY_EXISTS_CONCAT("ssl" SSL_connect HAVE_LIBSSL) - ENDIF(WIN32) + FIND_PACKAGE(OpenSSL REQUIRED) + INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) + SET(CURL_LIBS ${CURL_LIBS} ${OPENSSL_LIBRARIES}) SET(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle") MARK_AS_ADVANCED(CURL_CA_BUNDLE) IF(CURL_CA_BUNDLE) ADD_DEFINITIONS(-DCURL_CA_BUNDLE="${CURL_CA_BUNDLE}") ENDIF(CURL_CA_BUNDLE) + # for windows we want to install OPENSSL_LIBRARIES dlls + # and also copy them into the build tree so that testing + # can find them. + IF(WIN32) + FIND_FILE(CMAKE_EAY_DLL NAME libeay32.dll HINTS ${OPENSSL_INCLUDE_DIR}/..) + FIND_FILE(CMAKE_SSL_DLL NAME ssleay32.dll HINTS ${OPENSSL_INCLUDE_DIR}/..) + MARK_AS_ADVANCED(CMAKE_EAY_DLL CMAKE_SSL_DLL) + IF(CMAKE_SSL_DLL AND CMAKE_EAY_DLL) + SET(CMAKE_CURL_SSL_DLLS ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll) + ADD_CUSTOM_COMMAND(OUTPUT + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll + DEPENDS ${CMAKE_EAY_DLL} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_EAY_DLL} + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll) + ADD_CUSTOM_COMMAND(OUTPUT + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll + DEPENDS ${CMAKE_SSL_DLL} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SSL_DLL} + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll) + INSTALL(PROGRAMS ${CMAKE_EAY_DLL} ${CMAKE_SSL_DLL} DESTINATION bin) + ENDIF() + ENDIF() ENDIF(CMAKE_USE_OPENSSL) # Check for idn @@ -698,8 +713,7 @@ ENDFOREACH() CONFIGURE_FILE(${LIBCURL_SOURCE_DIR}/config.h.in ${LIBCURL_BINARY_DIR}/config.h) - -ADD_LIBRARY(cmcurl ${LIBRARY_TYPE} ${libCurl_SRCS}) +ADD_LIBRARY(cmcurl ${LIBRARY_TYPE} ${libCurl_SRCS} ${CMAKE_CURL_SSL_DLLS}) TARGET_LINK_LIBRARIES(cmcurl ${CURL_LIBS}) IF(CMAKE_BUILD_CURL_SHARED) SET_TARGET_PROPERTIES(cmcurl PROPERTIES DEFINE_SYMBOL BUILDING_LIBCURL diff --git a/Utilities/cmcurl/config.h.in b/Utilities/cmcurl/config.h.in index 6e74935a3..e18af8ffe 100644 --- a/Utilities/cmcurl/config.h.in +++ b/Utilities/cmcurl/config.h.in @@ -255,9 +255,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LIBSSH2_H ${HAVE_LIBSSH2_H} -/* Define to 1 if you have the `ssl' library (-lssl). */ -#cmakedefine HAVE_LIBSSL ${HAVE_LIBSSL} - /* if zlib is available */ #cmakedefine HAVE_LIBZ ${HAVE_LIBZ} diff --git a/Utilities/cmcurl/curl/curl.h b/Utilities/cmcurl/curl/curl.h index 157c634a4..e586c4a8c 100644 --- a/Utilities/cmcurl/curl/curl.h +++ b/Utilities/cmcurl/curl/curl.h @@ -312,7 +312,7 @@ typedef enum { CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ CURLE_FAILED_INIT, /* 2 */ CURLE_URL_MALFORMAT, /* 3 */ - CURLE_URL_MALFORMAT_USER, /* 4 - NOT USED */ + CURLE_NOT_BUILT_IN, /* 4 */ CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ CURLE_COULDNT_RESOLVE_HOST, /* 6 */ CURLE_COULDNT_CONNECT, /* 7 */ diff --git a/Utilities/cmcurl/ssluse.c b/Utilities/cmcurl/ssluse.c index 55afb2446..14d05ac65 100644 --- a/Utilities/cmcurl/ssluse.c +++ b/Utilities/cmcurl/ssluse.c @@ -1285,8 +1285,13 @@ Curl_ossl_connect_step1(struct connectdata *conn, req_method = TLSv1_client_method(); break; case CURL_SSLVERSION_SSLv2: +#ifdef OPENSSL_NO_SSL2 + failf(data, "OpenSSL was built without SSLv2 support"); + return CURLE_NOT_BUILT_IN; +#else req_method = SSLv2_client_method(); break; +#endif case CURL_SSLVERSION_SSLv3: req_method = SSLv3_client_method(); break; diff --git a/Utilities/cmcurl/strerror.c b/Utilities/cmcurl/strerror.c index 6304fe89d..74c345779 100644 --- a/Utilities/cmcurl/strerror.c +++ b/Utilities/cmcurl/strerror.c @@ -69,6 +69,10 @@ curl_easy_strerror(CURLcode error) case CURLE_URL_MALFORMAT: return "URL using bad/illegal format or missing URL"; + case CURLE_NOT_BUILT_IN: + return "A requested feature, protocol or option was not found built-in in" + " this libcurl due to a build-time decision."; + case CURLE_COULDNT_RESOLVE_PROXY: return "couldn't resolve proxy name"; @@ -287,7 +291,6 @@ curl_easy_strerror(CURLcode error) return "Error in the SSH layer"; /* error codes not used by current libcurl */ - case CURLE_URL_MALFORMAT_USER: case CURLE_FTP_USER_PASSWORD_INCORRECT: case CURLE_MALFORMAT_USER: case CURLE_BAD_CALLING_ORDER: diff --git a/Utilities/xml/.gitattributes b/Utilities/xml/.gitattributes new file mode 100644 index 000000000..562b12e16 --- /dev/null +++ b/Utilities/xml/.gitattributes @@ -0,0 +1 @@ +* -whitespace diff --git a/Utilities/xml/docbook-4.5/ChangeLog b/Utilities/xml/docbook-4.5/ChangeLog new file mode 100644 index 000000000..06f59ce5c --- /dev/null +++ b/Utilities/xml/docbook-4.5/ChangeLog @@ -0,0 +1,106 @@ +2006-10-03 13:23 nwalsh + + * trunk/docbook/sgml/catalog.xml, trunk/docbook/sgml/docbook.cat, + trunk/docbook/sgml/docbook.dcl, trunk/docbook/sgml/docbook.dtd, + calstblx.dtd, catalog.xml, dbcentx.mod, dbgenent.mod, + dbhierx.mod, dbnotnx.mod, dbpoolx.mod, docbook.cat, + docbookx.dtd, htmltblx.mod: DocBook V4.5 released + +2006-06-02 11:28 nwalsh + + * calstblx.dtd, catalog.xml, dbcentx.mod, dbgenent.mod, + dbhierx.mod, dbnotnx.mod, dbpoolx.mod, docbook.cat, + docbookx.dtd, freshmeat.xsl, htmltblx.mod: Changed copyright + dates and version numbers + +2006-05-30 20:58 nwalsh + + * htmltblx.mod: Supply tag omission markers in SGML; suppress + xml:lang in SGML + +2006-03-07 13:11 nwalsh + + * trunk/docbook/sgml/catalog.xml, trunk/docbook/sgml/docbook.cat, + trunk/docbook/sgml/docbook.dcl, trunk/docbook/sgml/docbook.dtd, + calstblx.dtd, catalog.xml, dbcentx.mod, dbgenent.mod, + dbhierx.mod, dbnotnx.mod, dbpoolx.mod, docbook.cat, + docbookx.dtd, freshmeat.xsl, htmltblx.mod: Change version + numbers to 4.5CR2 + +2006-03-07 13:03 nwalsh + + * dbpoolx.mod: Allow citebiblioid anywhere the other citation + elements are allowed + +2006-02-16 21:12 nwalsh + + * calstblx.dtd, catalog.xml, dbcentx.mod, dbgenent.mod, + dbhierx.mod, dbnotnx.mod, dbpoolx.mod, docbook.cat, + docbookx.dtd, freshmeat.xsl, htmltblx.mod: DocBook V4.5 released + +2005-06-29 10:59 nwalsh + + * trunk/docbook/sgml/docbook.dtd, docbookx.dtd: DocBook V4.5CR1 + Released + +2005-06-29 10:58 nwalsh + + * trunk/docbook/sgml/catalog.xml, trunk/docbook/sgml/docbook.cat, + trunk/docbook/sgml/docbook.dcl, calstblx.dtd, catalog.xml, + dbcentx.mod, dbgenent.mod, dbhierx.mod, dbnotnx.mod, + dbpoolx.mod, docbook.cat, htmltblx.mod: Updated version number + +2005-06-29 10:53 nwalsh + + * freshmeat.xsl: Tweaked freshmeat changes + +2005-06-24 21:09 nwalsh + + * calstblx.dtd, dbhierx.mod, dbpoolx.mod, htmltblx.mod, + soextblx.dtd: Added doc: structured comments + +2005-05-05 11:41 nwalsh + + * trunk/docbook/sgml/docbook.dtd, docbookx.dtd: DocBook V4.5b1 + Released + +2005-05-05 11:40 nwalsh + + * trunk/docbook/sgml/catalog.xml, trunk/docbook/sgml/docbook.cat, + trunk/docbook/sgml/docbook.dcl, calstblx.dtd, catalog.xml, + dbcentx.mod, dbgenent.mod, dbhierx.mod, dbnotnx.mod, + dbpoolx.mod, docbook.cat, htmltblx.mod: Updated version number + +2005-05-05 11:37 nwalsh + + * freshmeat.xsl: Prepare for 4.5b1 + +2005-05-05 10:59 nwalsh + + * dbpoolx.mod: RFE 1055480: Make revnumber optional + +2005-05-05 10:54 nwalsh + + * dbpoolx.mod, htmltblx.mod: Allow common attributes on HTML table + elements + +2005-05-05 10:48 nwalsh + + * dbpoolx.mod: Added termdef + +2005-05-05 10:39 nwalsh + + * dbpoolx.mod: Added mathphrase + +2005-05-05 10:33 nwalsh + + * dbhierx.mod: RFE 1070458: Allow colophon in article + +2005-05-05 10:32 nwalsh + + * dbpoolx.mod: RFE 1070770: Allow procedure in example + +2005-05-05 10:21 nwalsh + + * dbpoolx.mod: Add isrn to list of biblioid class attribute values + diff --git a/Utilities/xml/docbook-4.5/README b/Utilities/xml/docbook-4.5/README new file mode 100644 index 000000000..6fc60c4bf --- /dev/null +++ b/Utilities/xml/docbook-4.5/README @@ -0,0 +1,8 @@ +README for the DocBook XML DTD + +For more information about DocBook, please see + + http://www.oasis-open.org/docbook/ + +Please send all questions, comments, concerns, and bug reports to the +DocBook mailing list: docbook@lists.oasis-open.org diff --git a/Utilities/xml/docbook-4.5/calstblx.dtd b/Utilities/xml/docbook-4.5/calstblx.dtd new file mode 100644 index 000000000..fac58d77e --- /dev/null +++ b/Utilities/xml/docbook-4.5/calstblx.dtd @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/catalog.xml b/Utilities/xml/docbook-4.5/catalog.xml new file mode 100644 index 000000000..f75c1d764 --- /dev/null +++ b/Utilities/xml/docbook-4.5/catalog.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/dbcentx.mod b/Utilities/xml/docbook-4.5/dbcentx.mod new file mode 100644 index 000000000..60de99f86 --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbcentx.mod @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/dbgenent.mod b/Utilities/xml/docbook-4.5/dbgenent.mod new file mode 100644 index 000000000..ff5ba90d1 --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbgenent.mod @@ -0,0 +1,41 @@ + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/dbhierx.mod b/Utilities/xml/docbook-4.5/dbhierx.mod new file mode 100644 index 000000000..5f839f567 --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbhierx.mod @@ -0,0 +1,2193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbhier; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbhier2; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + +]]> + + + + +]]> + + + + + +]]> + + + + +]]> + + + + + +]]> + +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + diff --git a/Utilities/xml/docbook-4.5/dbnotnx.mod b/Utilities/xml/docbook-4.5/dbnotnx.mod new file mode 100644 index 000000000..2416049bf --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbnotnx.mod @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/dbpoolx.mod b/Utilities/xml/docbook-4.5/dbpoolx.mod new file mode 100644 index 000000000..53b07044a --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbpoolx.mod @@ -0,0 +1,8701 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbpool; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + +%htmltbl; +]]> + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + +]]> + +%tablemodel; + +]]> + + + + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> + + + + +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + + +]]> + + + +]]> + ]]> + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + ]]> + + + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + + +]]> + + + + + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + + +]]> + + + + + +]]> + + + + +]]> + + + + + +]]> + + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> +]]> +]]> + + + diff --git a/Utilities/xml/docbook-4.5/docbook.cat b/Utilities/xml/docbook-4.5/docbook.cat new file mode 100644 index 000000000..25ac4dff0 --- /dev/null +++ b/Utilities/xml/docbook-4.5/docbook.cat @@ -0,0 +1,113 @@ + -- ...................................................................... -- + -- Catalog data for DocBook XML V4.5 .................................... -- + -- File docbook.cat ..................................................... -- + + -- Please direct all questions, bug reports, or suggestions for + changes to the docbook@lists.oasis-open.org mailing list. For more + information, see http://www.oasis-open.org/. + -- + + -- This is the catalog data file for DocBook XML V4.5. It is provided as + a convenience in building your own catalog files. You need not use + the filenames listed here, and need not use the filename method of + identifying storage objects at all. See the documentation for + detailed information on the files associated with the DocBook DTD. + See SGML Open Technical Resolution 9401 for detailed information + on supplying and using catalog data. + -- + + -- ...................................................................... -- + -- DocBook driver file .................................................. -- + +PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "docbookx.dtd" + + -- ...................................................................... -- + -- DocBook modules ...................................................... -- + +PUBLIC "-//OASIS//DTD DocBook CALS Table Model V4.5//EN" + "calstblx.dtd" + +PUBLIC "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.5//EN" + "htmltblx.mod" + +PUBLIC "-//OASIS//DTD XML Exchange Table Model 19990315//EN" + "soextblx.dtd" + +PUBLIC "-//OASIS//ELEMENTS DocBook Information Pool V4.5//EN" + "dbpoolx.mod" + +PUBLIC "-//OASIS//ELEMENTS DocBook Document Hierarchy V4.5//EN" + "dbhierx.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Additional General Entities V4.5//EN" + "dbgenent.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Notations V4.5//EN" + "dbnotnx.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Character Entities V4.5//EN" + "dbcentx.mod" + + -- ...................................................................... -- + -- ISO entity sets ...................................................... -- + +PUBLIC "ISO 8879:1986//ENTITIES Diacritical Marks//EN//XML" + "ent/isodia.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN//XML" + "ent/isonum.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Publishing//EN//XML" + "ent/isopub.ent" + +PUBLIC "ISO 8879:1986//ENTITIES General Technical//EN//XML" + "ent/isotech.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN//XML" + "ent/isolat1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Latin 2//EN//XML" + "ent/isolat2.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Greek Letters//EN//XML" + "ent/isogrk1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Monotoniko Greek//EN//XML" + "ent/isogrk2.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Greek Symbols//EN//XML" + "ent/isogrk3.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN//XML" + "ent/isogrk4.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN//XML" + "ent/isoamsa.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN//XML" + "ent/isoamsb.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN//XML" + "ent/isoamsc.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN//XML" + "ent/isoamsn.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN//XML" + "ent/isoamso.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN//XML" + "ent/isoamsr.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Box and Line Drawing//EN//XML" + "ent/isobox.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Russian Cyrillic//EN//XML" + "ent/isocyr1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN//XML" + "ent/isocyr2.ent" + + -- End of catalog data for DocBook XML V4.5 ............................. -- + -- ...................................................................... -- diff --git a/Utilities/xml/docbook-4.5/docbookx.dtd b/Utilities/xml/docbook-4.5/docbookx.dtd new file mode 100644 index 000000000..8b43c59b6 --- /dev/null +++ b/Utilities/xml/docbook-4.5/docbookx.dtd @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + +]]> + + + +]]> + + + + + + +%dbnotn; +]]> + + + + + + + +]]> + +]]> +]]> + + +%dbcent; +]]> + + + + + + + + +%dbpool; +]]> + + + + + + +%rdbmods; +]]> + + + + + +%dbhier; +]]> + + + + + + +%dbgenent; +]]> + + + diff --git a/Utilities/xml/docbook-4.5/ent/README b/Utilities/xml/docbook-4.5/ent/README new file mode 100644 index 000000000..c0da542a6 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/README @@ -0,0 +1,14 @@ +XML Entity Declarations for Characters + +The character entity sets distributed with DocBook XML are direct +copies of the official entities located at + + http://www.w3.org/2003/entities/ + +They are distributed for historical compatibility and user convenience. +The DocBook Technical Committee no longer attempts to maintain these +definitions and will periodically update them from the W3C site if and +as they are updated there. + +Please direct all questions or comments about the entities to the +individuals or working groups who maintain the official sets. diff --git a/Utilities/xml/docbook-4.5/ent/isoamsa.ent b/Utilities/xml/docbook-4.5/ent/isoamsa.ent new file mode 100644 index 000000000..dac3e6242 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsa.ent @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamsb.ent b/Utilities/xml/docbook-4.5/ent/isoamsb.ent new file mode 100644 index 000000000..4065b66c4 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsb.ent @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamsc.ent b/Utilities/xml/docbook-4.5/ent/isoamsc.ent new file mode 100644 index 000000000..2fad41752 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsc.ent @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamsn.ent b/Utilities/xml/docbook-4.5/ent/isoamsn.ent new file mode 100644 index 000000000..ddca8d14c --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsn.ent @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamso.ent b/Utilities/xml/docbook-4.5/ent/isoamso.ent new file mode 100644 index 000000000..278e4b409 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamso.ent @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamsr.ent b/Utilities/xml/docbook-4.5/ent/isoamsr.ent new file mode 100644 index 000000000..18e64bffd --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsr.ent @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isobox.ent b/Utilities/xml/docbook-4.5/ent/isobox.ent new file mode 100644 index 000000000..9ae27d4fa --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isobox.ent @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isocyr1.ent b/Utilities/xml/docbook-4.5/ent/isocyr1.ent new file mode 100644 index 000000000..364b6d841 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isocyr1.ent @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isocyr2.ent b/Utilities/xml/docbook-4.5/ent/isocyr2.ent new file mode 100644 index 000000000..6432d74c4 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isocyr2.ent @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isodia.ent b/Utilities/xml/docbook-4.5/ent/isodia.ent new file mode 100644 index 000000000..b49c30947 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isodia.ent @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isogrk1.ent b/Utilities/xml/docbook-4.5/ent/isogrk1.ent new file mode 100644 index 000000000..7826f8109 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isogrk1.ent @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isogrk2.ent b/Utilities/xml/docbook-4.5/ent/isogrk2.ent new file mode 100644 index 000000000..726b7dd70 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isogrk2.ent @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isogrk3.ent b/Utilities/xml/docbook-4.5/ent/isogrk3.ent new file mode 100644 index 000000000..28b5c2766 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isogrk3.ent @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isogrk4.ent b/Utilities/xml/docbook-4.5/ent/isogrk4.ent new file mode 100644 index 000000000..27c6a514f --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isogrk4.ent @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isolat1.ent b/Utilities/xml/docbook-4.5/ent/isolat1.ent new file mode 100644 index 000000000..381bd0900 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isolat1.ent @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isolat2.ent b/Utilities/xml/docbook-4.5/ent/isolat2.ent new file mode 100644 index 000000000..e91ffdbee --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isolat2.ent @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isonum.ent b/Utilities/xml/docbook-4.5/ent/isonum.ent new file mode 100644 index 000000000..884c0c4d0 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isonum.ent @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isopub.ent b/Utilities/xml/docbook-4.5/ent/isopub.ent new file mode 100644 index 000000000..a11787828 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isopub.ent @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isotech.ent b/Utilities/xml/docbook-4.5/ent/isotech.ent new file mode 100644 index 000000000..07e81008d --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isotech.ent @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/htmltblx.mod b/Utilities/xml/docbook-4.5/htmltblx.mod new file mode 100644 index 000000000..cdaefed41 --- /dev/null +++ b/Utilities/xml/docbook-4.5/htmltblx.mod @@ -0,0 +1,245 @@ + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/soextblx.dtd b/Utilities/xml/docbook-4.5/soextblx.dtd new file mode 100644 index 000000000..4a92e1162 --- /dev/null +++ b/Utilities/xml/docbook-4.5/soextblx.dtd @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/xhtml-lat1.ent b/Utilities/xml/xhtml1/xhtml-lat1.ent similarity index 100% rename from Utilities/xml/xhtml-lat1.ent rename to Utilities/xml/xhtml1/xhtml-lat1.ent diff --git a/Utilities/xml/xhtml-special.ent b/Utilities/xml/xhtml1/xhtml-special.ent similarity index 100% rename from Utilities/xml/xhtml-special.ent rename to Utilities/xml/xhtml1/xhtml-special.ent diff --git a/Utilities/xml/xhtml-symbol.ent b/Utilities/xml/xhtml1/xhtml-symbol.ent similarity index 100% rename from Utilities/xml/xhtml-symbol.ent rename to Utilities/xml/xhtml1/xhtml-symbol.ent diff --git a/Utilities/xml/xhtml1-strict.dtd b/Utilities/xml/xhtml1/xhtml1-strict.dtd similarity index 100% rename from Utilities/xml/xhtml1-strict.dtd rename to Utilities/xml/xhtml1/xhtml1-strict.dtd diff --git a/bootstrap b/bootstrap index f7bc00436..23134d091 100755 --- a/bootstrap +++ b/bootstrap @@ -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 \ @@ -199,6 +202,9 @@ CMAKE_CXX_SOURCES="\ cmInstallDirectoryGenerator \ cmGeneratedFileStream \ cmGeneratorTarget \ + cmGeneratorExpressionEvaluator \ + cmGeneratorExpressionLexer \ + cmGeneratorExpressionParser \ cmGeneratorExpression \ cmGlobalGenerator \ cmLocalGenerator \