Merge branch 'use-generator-target' into AutomocUseTargetProperties

This commit is contained in:
Stephen Kelly 2012-09-19 18:33:11 +02:00
commit 9d8e59db71
224 changed files with 19951 additions and 2171 deletions

View File

@ -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)

View File

@ -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"

View File

@ -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)

View File

@ -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)

View File

@ -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()

View File

@ -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)

View File

@ -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")

View File

@ -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
)

View File

@ -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")

View File

@ -30,7 +30,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
string(REGEX REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}")
# Compute the directory in which to run the test.
set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang})
set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang})
# Try building with no extra flags and then try each set
# of helper flags. Stop when the compiler is identified.
@ -66,6 +66,15 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
message(STATUS "The ${lang} compiler identification is unknown")
endif()
# Check if compiler id detection gave us the compiler tool.
if(NOT CMAKE_${lang}_COMPILER)
if(CMAKE_${lang}_COMPILER_ID_TOOL)
set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_ID_TOOL}" PARENT_SCOPE)
else()
set(CMAKE_${lang}_COMPILER "CMAKE_${lang}_COMPILER-NOTFOUND" PARENT_SCOPE)
endif()
endif()
set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE)
set(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE)
set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
@ -98,28 +107,126 @@ Id flags: ${testflags}
")
# Compile the compiler identification source.
if(COMMAND EXECUTE_PROCESS)
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)( .NET)?( 200[358])? *((Win64|IA64|ARM))?")
set(vs_version ${CMAKE_MATCH_1})
set(vs_arch ${CMAKE_MATCH_4})
set(id_lang "${lang}")
set(id_cl cl.exe)
if(NOT "${vs_version}" VERSION_LESS 10)
set(v 10)
set(ext vcxproj)
elseif(NOT "${vs_version}" VERSION_LESS 7)
set(id_version ${vs_version}.00)
set(v 7)
set(ext vcproj)
else()
set(v 6)
set(ext dsp)
endif()
if("${vs_arch}" STREQUAL "Win64")
set(id_machine_7 17)
set(id_machine_10 MachineX64)
set(id_arch x64)
elseif("${vs_arch}" STREQUAL "IA64")
set(id_machine_7 5)
set(id_machine_10 MachineIA64)
set(id_arch ia64)
else()
set(id_machine_6 x86)
set(id_machine_7 1)
set(id_machine_10 MachineX86)
set(id_arch Win32)
endif()
if(CMAKE_VS_PLATFORM_TOOLSET)
set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>")
else()
set(id_toolset "")
endif()
if("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Bb][Uu][Ii][Ll][Dd]")
set(build /p:Configuration=Debug /p:Platform=@id_arch@)
elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Dd][Ee][Vv]")
set(build /make)
else()
set(build /build Debug)
endif()
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
get_filename_component(id_src "${src}" NAME)
configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
${id_dir}/CompilerId${lang}.${ext} @ONLY IMMEDIATE)
execute_process(
COMMAND ${CMAKE_${lang}_COMPILER}
${CMAKE_${lang}_COMPILER_ID_ARG1}
${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
${testflags}
"${src}"
COMMAND ${CMAKE_MAKE_PROGRAM} CompilerId${lang}.${ext} ${build}
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
)
else()
exec_program(
${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_DIR}
ARGS ${CMAKE_${lang}_COMPILER_ID_ARG1}
${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
${testflags}
\"${src}\"
# Match the compiler location line printed out.
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CMAKE_${lang}_COMPILER=([^%\r\n]+)[\r\n]")
set(_comp "${CMAKE_MATCH_1}")
if(EXISTS "${_comp}")
file(TO_CMAKE_PATH "${_comp}" _comp)
set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
endif()
endif()
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
set(id_lang "${lang}")
set(id_type ${CMAKE_${lang}_COMPILER_XCODE_TYPE})
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
get_filename_component(id_src "${src}" NAME)
if(NOT ${XCODE_VERSION} VERSION_LESS 3)
set(v 3)
set(ext xcodeproj)
elseif(NOT ${XCODE_VERSION} VERSION_LESS 2)
set(v 2)
set(ext xcodeproj)
else()
set(v 1)
set(ext xcode)
endif()
configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-${v}.pbxproj.in
${id_dir}/CompilerId${lang}.${ext}/project.pbxproj @ONLY IMMEDIATE)
execute_process(COMMAND xcodebuild
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT
ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
)
# Match the link line from xcodebuild output of the form
# Ld ...
# ...
# /path/to/cc ...CompilerId${lang}/...
# to extract the compiler front-end for the language.
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/\\./CompilerId${lang}[ \t\n\\\"]")
set(_comp "${CMAKE_MATCH_2}")
if(EXISTS "${_comp}")
set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
endif()
endif()
else()
if(COMMAND EXECUTE_PROCESS)
execute_process(
COMMAND ${CMAKE_${lang}_COMPILER}
${CMAKE_${lang}_COMPILER_ID_ARG1}
${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
${testflags}
"${src}"
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
)
else()
exec_program(
${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_DIR}
ARGS ${CMAKE_${lang}_COMPILER_ID_ARG1}
${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
${testflags}
\"${src}\"
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT
)
endif()
endif()
# Check the result of compilation.
@ -153,14 +260,18 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
# Find the executable produced by the compiler, try all files in the
# binary dir.
file(GLOB COMPILER_${lang}_PRODUCED_FILES
file(GLOB files
RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR}
${CMAKE_${lang}_COMPILER_ID_DIR}/*)
list(REMOVE_ITEM COMPILER_${lang}_PRODUCED_FILES "${src}")
foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Compilation of the ${lang} compiler identification source \""
"${src}\" produced \"${file}\"\n\n")
list(REMOVE_ITEM files "${src}")
set(COMPILER_${lang}_PRODUCED_FILES "")
foreach(file ${files})
if(NOT IS_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}/${file})
list(APPEND COMPILER_${lang}_PRODUCED_FILES ${file})
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Compilation of the ${lang} compiler identification source \""
"${src}\" produced \"${file}\"\n\n")
endif()
endforeach()
if(NOT COMPILER_${lang}_PRODUCED_FILES)
@ -282,7 +393,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
# We get here when this function is called not from within CMAKE_DETERMINE_COMPILER_ID()
# This is done e.g. for detecting the compiler ID for assemblers.
# Compute the directory in which to run the test and Create a clean working directory.
set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang})
set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang})
file(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR})
file(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
endif()

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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()

View File

@ -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:

View File

@ -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.

View File

@ -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)

View File

@ -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

View File

@ -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})

View File

@ -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})

View File

@ -1,3 +0,0 @@
#include<iostream>
int main(){return 0;}

View File

@ -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})

View File

@ -1,2 +0,0 @@
VERSION=_MSC_VER

View File

@ -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()

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|@id_arch@">
<Configuration>Debug</Configuration>
<Platform>@id_arch@</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid>
<RootNamespace>CompilerId@id_lang@</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_arch@'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
@id_toolset@
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|@id_arch@'">.\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|@id_arch@'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|@id_arch@'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_arch@'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>@id_machine_10@</TargetMachine>
</Link>
<PostBuildEvent>
<Command>for %%i in (@id_cl@) do %40echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="@id_src@" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -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

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="@id_version@"
Name="CompilerId@id_lang@"
ProjectGUID="{CAE07175-D007-4FC3-BFE8-47B392814159}"
RootNamespace="CompilerId@id_lang@"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="@id_arch@"
/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|@id_arch@"
OutputDirectory="."
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions=""
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="0"
DebugInformationFormat="0"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="false"
SubSystem="1"
TargetMachine="@id_machine_7@"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="for %%i in (@id_cl@) do @echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i"
/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="@id_src@"
>
</File>
</Filter>
</Files>
</VisualStudioProject>

View File

@ -0,0 +1,120 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 39;
objects = {
014CEA460018CE2711CA2923 = {
buildSettings = {
};
isa = PBXBuildStyle;
name = Development;
};
08FB7793FE84155DC02AAC07 = {
buildSettings = {
};
buildStyles = (
014CEA460018CE2711CA2923,
);
hasScannedForEncodings = 1;
isa = PBXProject;
mainGroup = 08FB7794FE84155DC02AAC07;
projectDirPath = "";
targets = (
8DD76FA90486AB0100D96B5E,
);
};
08FB7794FE84155DC02AAC07 = {
children = (
08FB7795FE84155DC02AAC07,
1AB674ADFE9D54B511CA2CBB,
);
isa = PBXGroup;
name = CompilerId@id_lang@;
refType = 4;
sourceTree = "<group>";
};
08FB7795FE84155DC02AAC07 = {
children = (
2C18F0B415DC1DC700593670,
);
isa = PBXGroup;
name = Source;
refType = 4;
sourceTree = "<group>";
};
1AB674ADFE9D54B511CA2CBB = {
children = (
8DD76F6C0486A84900D96B5E,
);
isa = PBXGroup;
name = Products;
refType = 4;
sourceTree = "<group>";
};
2C18F0B415DC1DC700593670 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = @id_type@;
path = @id_src@;
refType = 4;
sourceTree = "<group>";
};
2C18F0B615DC1E0300593670 = {
fileRef = 2C18F0B415DC1DC700593670;
isa = PBXBuildFile;
settings = {
};
};
2C8FEB8E15DC1A1A00E56A5D = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"GCC_VERSION=$GCC_VERSION\"";
};
8DD76FA90486AB0100D96B5E = {
buildPhases = (
2C18F0B515DC1DCE00593670,
2C8FEB8E15DC1A1A00E56A5D,
);
buildRules = (
);
buildSettings = {
PRODUCT_NAME = CompilerId@id_lang@;
SYMROOT = .;
};
dependencies = (
);
isa = PBXNativeTarget;
name = CompilerId@id_lang@;
productName = CompilerId@id_lang@;
productReference = 8DD76F6C0486A84900D96B5E;
productType = "com.apple.product-type.tool";
};
2C18F0B515DC1DCE00593670 = {
buildActionMask = 2147483647;
files = (
2C18F0B615DC1E0300593670,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
8DD76F6C0486A84900D96B5E = {
explicitFileType = "compiled.mach-o.executable";
includeInIndex = 0;
isa = PBXFileReference;
path = CompilerId@id_lang@;
refType = 3;
sourceTree = BUILT_PRODUCTS_DIR;
};
};
rootObject = 08FB7793FE84155DC02AAC07;
}

View File

@ -0,0 +1,119 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
2C18F0B615DC1E0300593670 = {isa = PBXBuildFile; fileRef = 2C18F0B415DC1DC700593670; };
2C18F0B415DC1DC700593670 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = @id_type@; path = @id_src@; sourceTree = "<group>"; };
8DD76F6C0486A84900D96B5E = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CompilerId@id_lang@; sourceTree = BUILT_PRODUCTS_DIR; };
08FB7794FE84155DC02AAC07 = {
isa = PBXGroup;
children = (
08FB7795FE84155DC02AAC07,
1AB674ADFE9D54B511CA2CBB,
);
name = CompilerId@id_lang@;
sourceTree = "<group>";
};
08FB7795FE84155DC02AAC07 = {
isa = PBXGroup;
children = (
2C18F0B415DC1DC700593670,
);
name = Source;
sourceTree = "<group>";
};
1AB674ADFE9D54B511CA2CBB = {
isa = PBXGroup;
children = (
8DD76F6C0486A84900D96B5E,
);
name = Products;
sourceTree = "<group>";
};
8DD76FA90486AB0100D96B5E = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB928508733DD80010E9CD;
buildPhases = (
2C18F0B515DC1DCE00593670,
2C8FEB8E15DC1A1A00E56A5D,
);
buildRules = (
);
dependencies = (
);
name = CompilerId@id_lang@;
productName = CompilerId@id_lang@;
productReference = 8DD76F6C0486A84900D96B5E;
productType = "com.apple.product-type.tool";
};
08FB7793FE84155DC02AAC07 = {
isa = PBXProject;
buildConfigurationList = 1DEB928908733DD80010E9CD;
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07;
projectDirPath = "";
targets = (
8DD76FA90486AB0100D96B5E,
);
};
2C8FEB8E15DC1A1A00E56A5D = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"GCC_VERSION=$GCC_VERSION\"";
};
2C18F0B515DC1DCE00593670 = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2C18F0B615DC1E0300593670,
);
runOnlyForDeploymentPostprocessing = 0;
};
1DEB928608733DD80010E9CD = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = CompilerId@id_lang@;
};
name = Debug;
};
1DEB928A08733DD80010E9CD = {
isa = XCBuildConfiguration;
buildSettings = {
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
SYMROOT = .;
};
name = Debug;
};
1DEB928508733DD80010E9CD = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB928608733DD80010E9CD,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
1DEB928908733DD80010E9CD = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB928A08733DD80010E9CD,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
};
rootObject = 08FB7793FE84155DC02AAC07;
}

View File

@ -0,0 +1,107 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
2C18F0B615DC1E0300593670 = {isa = PBXBuildFile; fileRef = 2C18F0B415DC1DC700593670; };
2C18F0B415DC1DC700593670 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = @id_type@; path = @id_src@; sourceTree = "<group>"; };
08FB7794FE84155DC02AAC07 = {
isa = PBXGroup;
children = (
2C18F0B415DC1DC700593670,
);
name = CompilerId@id_lang@;
sourceTree = "<group>";
};
8DD76FA90486AB0100D96B5E = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB928508733DD80010E9CD;
buildPhases = (
2C18F0B515DC1DCE00593670,
2C8FEB8E15DC1A1A00E56A5D,
);
buildRules = (
);
dependencies = (
);
name = CompilerId@id_lang@;
productName = CompilerId@id_lang@;
productType = "com.apple.product-type.tool";
};
08FB7793FE84155DC02AAC07 = {
isa = PBXProject;
buildConfigurationList = 1DEB928908733DD80010E9CD;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 08FB7794FE84155DC02AAC07;
projectDirPath = "";
projectRoot = "";
targets = (
8DD76FA90486AB0100D96B5E,
);
};
2C8FEB8E15DC1A1A00E56A5D = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"GCC_VERSION=$GCC_VERSION\"";
showEnvVarsInLog = 0;
};
2C18F0B515DC1DCE00593670 = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2C18F0B615DC1E0300593670,
);
runOnlyForDeploymentPostprocessing = 0;
};
1DEB928608733DD80010E9CD = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = CompilerId@id_lang@;
};
name = Debug;
};
1DEB928A08733DD80010E9CD = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
ONLY_ACTIVE_ARCH = YES;
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
SYMROOT = .;
};
name = Debug;
};
1DEB928508733DD80010E9CD = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB928608733DD80010E9CD,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
1DEB928908733DD80010E9CD = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB928A08733DD80010E9CD,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
};
rootObject = 08FB7793FE84155DC02AAC07;
}

View File

@ -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}")

View File

@ -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)

View File

@ -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_<CONFIG> 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_<CONFIG>
# -- 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_<CONFIG> to be string (instead of a list
# like it is currently), we can remove the quotes around the
# ${CUDA_NVCC_FLAGS_${config_upper}} variable like the CMAKE_HOST_FLAGS_<CONFIG> variable.
set(CUDA_NVCC_FLAGS_CONFIG "${CUDA_NVCC_FLAGS_CONFIG}\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})")
set(_cuda_nvcc_flags_config "${_cuda_nvcc_flags_config}\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})")
endforeach()
if(compile_to_ptx)
# Don't use any of the host compilation flags for PTX targets.
set(CUDA_HOST_FLAGS)
set(CUDA_NVCC_FLAGS_CONFIG)
endif()
# Get the list of definitions from the directory property
get_directory_property(CUDA_NVCC_DEFINITIONS COMPILE_DEFINITIONS)
if(CUDA_NVCC_DEFINITIONS)
@ -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}")

View File

@ -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.

View File

@ -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()

View File

@ -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

30
Modules/FindGLEW.cmake Normal file
View File

@ -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)

View File

@ -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})

View File

@ -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

View File

@ -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})

View File

@ -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)

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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)

View File

@ -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})

View File

@ -0,0 +1,2 @@
include(Platform/Windows-MSVC)
__windows_compiler_msvc(C)

View File

@ -0,0 +1,3 @@
include(Platform/Windows-MSVC)
set(_COMPILE_CXX " /TP")
__windows_compiler_msvc(CXX)

View File

@ -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 <FLAGS> /fo<OBJECT> <SOURCE>")
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 "<CMAKE_COMMAND> -E vs_link_dll ")
set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe ")
endif()
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
"${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY})
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
set(CMAKE_${lang}_COMPILE_OBJECT
"<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<TARGET_PDB> -c <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
"<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE
"<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /FoNUL /FAs /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
set(CMAKE_${lang}_LINK_EXECUTABLE
"${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> -link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_FLAGS_INIT "${_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()

View File

@ -1,253 +0,0 @@
# try to load any previously computed information for C on this platform
include( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL)
# try to load any previously computed information for CXX on this platform
include( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL)
set(WIN32 1)
include(Platform/cl)
set(CMAKE_CREATE_WIN32_EXE /subsystem:windows)
set(CMAKE_CREATE_CONSOLE_EXE /subsystem:console)
if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
set (CMAKE_NO_BUILD_TYPE 1)
endif()
if(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio")
set (CMAKE_NO_BUILD_TYPE 1)
set (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING
"Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.")
mark_as_advanced(CMAKE_CONFIGURATION_TYPES)
endif()
# does the compiler support pdbtype and is it the newer compiler
if(CMAKE_GENERATOR MATCHES "Visual Studio 8")
set(CMAKE_COMPILER_2005 1)
endif()
# make sure to enable languages after setting configuration types
enable_language(RC)
set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
# for nmake we need to compute some information about the compiler
# that is being used.
# the compiler may be free command line, 6, 7, or 71, and
# each have properties that must be determined.
# to avoid running these tests with each cmake run, the
# test results are saved in CMakeCPlatform.cmake, a file
# that is automatically copied into try_compile directories
# by the global generator.
set(MSVC_IDE 1)
if(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja")
set(MSVC_IDE 0)
if(NOT CMAKE_VC_COMPILER_TESTS_RUN)
set(CMAKE_VC_COMPILER_TESTS 1)
set(testNmakeCLVersionFile
"${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c")
string(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}")
message(STATUS "Check for CL compiler version")
set(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER})
if (NOT CMAKE_C_COMPILER)
set(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER})
endif()
exec_program(${CMAKE_TEST_COMPILER}
ARGS /nologo -EP \"${testNmakeCLVersionFile}\"
OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT
RETURN_VALUE CMAKE_COMPILER_RETURN
)
if(NOT CMAKE_COMPILER_RETURN)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining the version of compiler passed with the following output:\n"
"${CMAKE_COMPILER_OUTPUT}\n\n")
string(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}")
string(REGEX REPLACE ".*VERSION=(.*)" "\\1"
compilerVersion "${compilerVersion}")
message(STATUS "Check for CL compiler version - ${compilerVersion}")
set(MSVC60)
set(MSVC70)
set(MSVC71)
set(MSVC80)
set(CMAKE_COMPILER_2005)
if("${compilerVersion}" LESS 1300)
set(MSVC60 1)
set(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1)
endif()
if("${compilerVersion}" EQUAL 1300)
set(MSVC70 1)
set(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0)
endif()
if("${compilerVersion}" EQUAL 1310)
set(MSVC71 1)
set(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0)
endif()
if("${compilerVersion}" EQUAL 1400)
set(MSVC80 1)
set(CMAKE_COMPILER_2005 1)
endif()
if("${compilerVersion}" EQUAL 1500)
set(MSVC90 1)
endif()
if("${compilerVersion}" EQUAL 1600)
set(MSVC10 1)
endif()
set(MSVC_VERSION "${compilerVersion}")
else()
message(STATUS "Check for CL compiler version - failed")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining the version of compiler failed with the following output:\n"
"${CMAKE_COMPILER_OUTPUT}\n\n")
endif()
# try to figure out if we are running the free command line
# tools from Microsoft. These tools do not provide debug libraries,
# so the link flags used have to be different.
make_directory("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2")
set(testForFreeVCFile
"${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx")
string(REGEX REPLACE "/" "\\\\" testForFreeVCFile "${testForFreeVCFile}")
message(STATUS "Check if this is a free VC compiler")
exec_program(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2
ARGS /nologo /MD /EHsc
\"${testForFreeVCFile}\"
OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT
RETURN_VALUE CMAKE_COMPILER_RETURN
)
if(CMAKE_COMPILER_RETURN)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if this is a free VC compiler failed with the following output:\n"
"${CMAKE_COMPILER_OUTPUT}\n\n")
message(STATUS "Check if this is a free VC compiler - yes")
set(CMAKE_USING_VC_FREE_TOOLS 1)
else()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if this is a free VC compiler passed with the following output:\n"
"${CMAKE_COMPILER_OUTPUT}\n\n")
message(STATUS "Check if this is a free VC compiler - no")
set(CMAKE_USING_VC_FREE_TOOLS 0)
endif()
make_directory("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3")
endif()
endif()
if(MSVC_C_ARCHITECTURE_ID MATCHES 64)
set(CMAKE_CL_64 1)
else()
set(CMAKE_CL_64 0)
endif()
if(CMAKE_FORCE_WIN64 OR CMAKE_FORCE_IA64)
set(CMAKE_CL_64 1)
endif()
if("${MSVC_VERSION}" GREATER 1599)
set(MSVC_INCREMENTAL_DEFAULT ON)
endif()
# default to Debug builds
if(MSVC_VERSION GREATER 1310)
# for 2005 make sure the manifest is put in the dll with mt
set(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
set(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}")
# create a C shared library
set(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
# create a C shared module just copy the shared library rule
set(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}")
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}")
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}")
set(CMAKE_BUILD_TYPE_INIT Debug)
set (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR")
set (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
set (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
set (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")
set (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
set (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
set (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
set (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ")
set (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}")
else()
if(CMAKE_USING_VC_FREE_TOOLS)
message(STATUS "Using FREE VC TOOLS, NO DEBUG available")
set(CMAKE_BUILD_TYPE_INIT Release)
set (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR")
set (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ")
set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG")
set (CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG")
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")
set (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")
set (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ")
set (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG")
set (CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG")
set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")
else()
set(CMAKE_BUILD_TYPE_INIT Debug)
set (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR")
set (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ")
set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
set (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
set (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")
set (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ")
set (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
set (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
endif()
set (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib")
endif()
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
# executable linker flags
set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
# set the stack size and the machine type
set(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID})
if(NOT _MACHINE_ARCH_FLAG)
set(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID})
endif()
set (CMAKE_EXE_LINKER_FLAGS_INIT
"${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}")
# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype
# on versions that support it
set( MSVC_INCREMENTAL_YES_FLAG "")
if(NOT MSVC_INCREMENTAL_DEFAULT)
set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES")
else()
set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" )
endif()
if (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
else ()
set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}")
set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}")
endif ()
# for release and minsize release default to no incremental linking
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO")
# copy the EXE_LINKER flags to SHARED and MODULE linker flags
# shared linker flags
set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
set (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})
set (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
# module linker flags
set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
# save computed information for this platform
if(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake")
configure_file(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCPlatform.cmake IMMEDIATE)
endif()
if(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake")
configure_file(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE)
endif()

View File

@ -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)

View File

@ -0,0 +1 @@
include(Platform/Windows-MSVC-C)

View File

@ -0,0 +1 @@
include(Platform/Windows-MSVC-CXX)

View File

@ -0,0 +1 @@
include(Platform/Windows-MSVC)

View File

@ -0,0 +1 @@
include(Platform/Windows)

View File

@ -1,62 +0,0 @@
set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:")
set(CMAKE_LINK_LIBRARY_FLAG "")
set(MSVC 1)
# hack: if a new cmake (which uses CMAKE__LINKER) runs on an old build tree
# (where link was hardcoded) and where CMAKE_LINKER isn't in the cache
# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun)
# hardcode CMAKE_LINKER here to link, so it behaves as it did before, Alex
if(NOT DEFINED CMAKE_LINKER)
set(CMAKE_LINKER link)
endif()
if(CMAKE_VERBOSE_MAKEFILE)
set(CMAKE_CL_NOLOGO)
else()
set(CMAKE_CL_NOLOGO "/nologo")
endif()
# create a shared C++ library
set(CMAKE_CXX_CREATE_SHARED_LIBRARY
"<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
set(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
# create a C shared library
set(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
# create a C shared module
set(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}")
# create a C++ static library
set(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
# create a C static library
set(CMAKE_C_CREATE_STATIC_LIBRARY "${CMAKE_CXX_CREATE_STATIC_LIBRARY}")
# compile a C++ file into an object file
set(CMAKE_CXX_COMPILE_OBJECT
"<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /TP /Fo<OBJECT> /Fd<TARGET_PDB> -c <SOURCE>${CMAKE_END_TEMP_FILE}")
# compile a C file into an object file
set(CMAKE_C_COMPILE_OBJECT
"<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<TARGET_PDB> -c <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1)
set(CMAKE_C_LINK_EXECUTABLE
"<CMAKE_C_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> -link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1)
set(CMAKE_CXX_LINK_EXECUTABLE
"<CMAKE_CXX_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> -link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
set(CMAKE_C_CREATE_PREPROCESSED_SOURCE
"<CMAKE_C_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE
"<CMAKE_CXX_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /TP -E <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_C_CREATE_ASSEMBLY_SOURCE
"<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /FAs /FoNUL /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE
"<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /TP /FAs /FoNUL /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}")

View File

@ -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 "<file[^>]*>[^<]+")
foreach(_RC_FILE IN LISTS _RC_FILES)
string(REGEX REPLACE "^<file[^>]*>([^<]*)" "\\1" _RC_FILE "${_RC_FILE}")
file(READ "${infile}" _RC_FILE_CONTENTS)
string(REGEX MATCHALL "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}")
foreach(_RC_FILE ${_RC_FILES})
string(REGEX REPLACE "^<file[^>]*>" "" _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.

View File

@ -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 ()

View File

@ -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)

View File

@ -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)

View File

@ -18,6 +18,11 @@
#include <cmsys/RegularExpression.hxx>
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<SVNInfo>::iterator itbeg = this->Repositories.begin();
std::list<SVNInfo>::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<SVNInfo>::iterator itbeg = this->Repositories.begin();
std::list<SVNInfo>::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<Change> const& changes)
void cmCTestSVN::GuessBase(SVNInfo& svninfo,
std::vector<Change> 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<Change>::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<Change> 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<SVNInfo>::iterator itbeg = this->Repositories.begin();
std::list<SVNInfo>::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<Change> const& changes)
void cmCTestSVN::DoRevisionSVN(Revision const& revision,
std::vector<Change> 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<SVNPath>" << this->Base << "</SVNPath>\n";
xml << "\t<SVNPath>" << this->RootInfo->Base << "</SVNPath>\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;
}

View File

@ -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<SVNInfo> 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<Change> const& changes);
const char* LocalPath(std::string const& path);
void GuessBase(SVNInfo &svninfo, std::vector<Change> const& changes);
void DoRevision(Revision const& revision,
std::vector<Change> const& changes);
void DoRevisionSVN(Revision const& revision,
std::vector<Change> 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

View File

@ -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)

View File

@ -348,7 +348,11 @@ void QCMake::interrupt()
bool QCMake::interruptCallback(void* cd)
{
QCMake* self = reinterpret_cast<QCMake*>(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)

View File

@ -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 "

View File

@ -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)
{

View File

@ -98,7 +98,7 @@ bool cmDepends::Check(const char *makeFile, const char *internalFile,
// Check whether dependencies must be regenerated.
bool okay = true;
std::ifstream fin(internalFile);
if(!(fin && this->CheckDependencies(fin, validDeps)))
if(!(fin && this->CheckDependencies(fin, internalFile, validDeps)))
{
// Clear all dependencies so they will be regenerated.
this->Clear(makeFile);
@ -143,6 +143,7 @@ bool cmDepends::WriteDependencies(const char*, const char*,
//----------------------------------------------------------------------------
bool cmDepends::CheckDependencies(std::istream& internalDepends,
const char* internalDependsFileName,
std::map<std::string, DependencyVector>& validDeps)
{
// Parse dependencies from the stream. If any dependee is missing
@ -186,8 +187,11 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
}
*/
// Dependencies must be regenerated if the dependee does not exist
// or if the depender exists and is older than the dependee.
// Dependencies must be regenerated
// * if the dependee does not exist
// * if the depender exists and is older than the dependee.
// * if the depender does not exist, but the dependee is newer than the
// depends file
bool regenerate = false;
const char* dependee = this->Dependee+1;
const char* depender = this->Depender;
@ -211,24 +215,49 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
cmSystemTools::Stdout(msg.str().c_str());
}
}
else if(dependerExists)
else
{
// The dependee and depender both exist. Compare file times.
int result = 0;
if((!this->FileComparison->FileTimeCompare(depender, dependee,
&result) || result < 0))
if(dependerExists)
{
// The depender is older than the dependee.
regenerate = true;
// 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());
}
}
}
}

View File

@ -83,6 +83,7 @@ protected:
// Return false if dependencies must be regenerated and true
// otherwise.
virtual bool CheckDependencies(std::istream& internalDepends,
const char* internalDependsFileName,
std::map<std::string, DependencyVector>& validDeps);
// Finalize the dependency information for the target.

View File

@ -38,7 +38,7 @@ bool cmDependsJava::WriteDependencies(const char *src, const char *,
return true;
}
bool cmDependsJava::CheckDependencies(std::istream&,
bool cmDependsJava::CheckDependencies(std::istream&, const char*,
std::map<std::string, DependencyVector >&)
{
return true;

View File

@ -32,7 +32,8 @@ protected:
virtual bool WriteDependencies(const char *src, const char *file,
std::ostream& makeDepends, std::ostream& internalDepends);
virtual bool CheckDependencies(std::istream& internalDepends,
std::map<std::string, DependencyVector >& validDeps);
const char* internalDependsFileName,
std::map<std::string, DependencyVector>& validDeps);
private:
cmDependsJava(cmDependsJava const&); // Purposely not implemented.

View File

@ -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_<LANG>_COMPILER_ID", cmProperty::VARIABLE,
"An internal variable subject to change.",
"This is used in determining the compiler and is subject to change.",
"Compiler identification string.",
"A short string unique to the compiler vendor. "
"Possible values include:\n"
" Absoft = Absoft Fortran (absoft.com)\n"
" ADSP = Analog VisualDSP++ (analog.com)\n"
" Clang = LLVM Clang (clang.llvm.org)\n"
" Cray = Cray Compiler (cray.com)\n"
" Embarcadero, Borland = Embarcadero (embarcadero.com)\n"
" G95 = G95 Fortran (g95.org)\n"
" GNU = GNU Compiler Collection (gcc.gnu.org)\n"
" HP = Hewlett-Packard Compiler (hp.com)\n"
" Intel = Intel Compiler (intel.com)\n"
" MIPSpro = SGI MIPSpro (sgi.com)\n"
" MSVC = Microsoft Visual Studio (microsoft.com)\n"
" PGI = The Portland Group (pgroup.com)\n"
" PathScale = PathScale (pathscale.com)\n"
" SDCC = Small Device C Compiler (sdcc.sourceforge.net)\n"
" SunPro = Oracle Solaris Studio (oracle.com)\n"
" TI_DSP = Texas Instruments (ti.com)\n"
" TinyCC = Tiny C Compiler (tinycc.org)\n"
" Watcom = Open Watcom (openwatcom.org)\n"
" XL, VisualAge, zOS = IBM XL (ibm.com)\n"
"This variable is not guaranteed to be defined for all "
"compilers or languages.",
false,
"Variables for Languages");
@ -1416,10 +1442,10 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cm->DefineProperty
("CMAKE_<LANG>_COMPILER_VERSION", cmProperty::VARIABLE,
"An internal variable subject to change.",
"Compiler version string.",
"Compiler version in major[.minor[.patch[.tweak]]] format. "
"This variable is reserved for internal use by CMake and is not "
"guaranteed to be set.",
"This variable is not guaranteed to be defined for all "
"compilers or languages.",
false,
"Variables for Languages");

View File

@ -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}
};

View File

@ -11,6 +11,14 @@
============================================================================*/
#include "cmDocumentationFormatterDocbook.h"
#include "cmDocumentationSection.h"
#include <algorithm>
#include <ctype.h> // 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 &section,
const char* name)
{
if(name)
{
std::string id = "section_";
id += name;
if (this->EmittedLinkIds.find(id) == this->EmittedLinkIds.end())
{
this->EmittedLinkIds.insert(id);
os << "<sect1 id=\"section_" << name << "\">\n"
"<title>\n" << name << "</title>\n";
}
else
{
static unsigned int i=0;
i++;
os << "<sect1 id=\"section_" << name << i << "\">\n"
"<title>\n" << name << "</title>\n";
}
}
os << "<sect1 id=\"";
this->PrintId(os, 0, name);
os << "\">\n<title>" << name << "</title>\n";
std::string prefix = this->ComputeSectionLinkPrefix(name);
const std::vector<cmDocumentationEntry> &entries = section.GetEntries();
const std::vector<cmDocumentationEntry> &entries =
section.GetEntries();
if (!entries.empty())
{
os << "<itemizedlist>\n";
for(std::vector<cmDocumentationEntry>::const_iterator op
= entries.begin(); op != entries.end(); ++ op )
{
if(op->Name.size())
{
os << " <listitem><link linkend=\"" << prefix << "_";
cmDocumentationPrintDocbookEscapes(os, op->Name.c_str());
os << "\"><emphasis><literal>";
cmDocumentationPrintDocbookEscapes(os, op->Name.c_str());
os << "</literal></emphasis></link></listitem>\n";
}
}
os << "</itemizedlist>\n" ;
}
bool hasSubSections = false;
for(std::vector<cmDocumentationEntry>::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<cmDocumentationEntry>::const_iterator op = entries.begin();
op != entries.end(); ++op)
{
if(op->Name.size())
{
if(inAbstract)
{
if(op->Name.size())
{
os << " <para id=\"" << prefix << "_";
cmDocumentationPrintDocbookEscapes(os, op->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 << "\"><sect2><title>";
cmDocumentationPrintDocbookEscapes(os, op->Name.c_str());
os << "</title></sect2> ";
}
cmDocumentationPrintDocbookEscapes(os, op->Brief.c_str());
if(op->Name.size())
{
os << "</para>\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 << "</abstract>\n";
inAbstract = false;
}
os << "<sect2 id=\"";
this->PrintId(os, prefix.c_str(), op->Name);
os << "\">\n<title>";
cmDocumentationPrintDocbookEscapes(os, op->Name.c_str());
os << "</title>\n";
if(op->Full.size())
{
os << "<abstract>\n<para>";
cmDocumentationPrintDocbookEscapes(os, op->Brief.c_str());
os << "</para>\n</abstract>\n";
this->PrintFormatted(os, op->Full.c_str());
}
else
{
this->PrintFormatted(os, op->Brief.c_str());
}
os << "</sect2>\n";
}
else
{
if(hasSubSections && op == entries.begin())
{
os << "<abstract>\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 << "</sect1>\n";
os << "<para/>\n";
}
}
void cmDocumentationFormatterDocbook::PrintPreformatted(std::ostream& os,
const char* text)
{
os << "<literallayout>";
cmDocumentationPrintDocbookEscapes(os, text);
os << "</literallayout>\n ";
}
void cmDocumentationFormatterDocbook::PrintParagraph(std::ostream& os,
const char* text)
{
os << "<para>";
cmDocumentationPrintDocbookEscapes(os, text);
os << "</para>";
os << "</sect1>\n";
}
//----------------------------------------------------------------------------
void cmDocumentationFormatterDocbook::PrintHeader(const char* docname,
const char* appname,
std::ostream& os)
void cmDocumentationFormatterDocbook
::PrintPreformatted(std::ostream& os, const char* text)
{
os << "<para>\n<programlisting>";
cmDocumentationPrintDocbookEscapes(os, text);
os << "</programlisting>\n</para>\n";
}
void cmDocumentationFormatterDocbook
::PrintParagraph(std::ostream& os, const char* text)
{
os << "<para>";
cmDocumentationPrintDocbookEscapes(os, text);
os << "</para>\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 << "<?xml version=\"1.0\" ?>\n"
"<!DOCTYPE article PUBLIC \"-//OASIS//DTD DocBook V4.2//EN\" "
"\"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\" [\n"
"<!DOCTYPE article PUBLIC \"-//OASIS//DTD DocBook V4.5//EN\" "
"\"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\" [\n"
"<!ENTITY % addindex \"IGNORE\">\n"
"<!ENTITY % English \"INCLUDE\"> ]>\n"
"<article>\n"
@ -253,3 +226,29 @@ void cmDocumentationFormatterDocbook::PrintFooter(std::ostream& os)
os << "</article>\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++;
}
}

View File

@ -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<std::string> EmittedLinkIds;
std::string Docname;
};
#endif

View File

@ -636,9 +636,11 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
// the include directories for this target
std::set<std::string> uniqIncludeDirs;
cmGeneratorTarget *gtgt = this->GlobalGenerator
->GetGeneratorTarget(target);
std::vector<std::string> includes;
target->GetMakefile()->GetLocalGenerator()->
GetIncludeDirectories(includes, target);
GetIncludeDirectories(includes, gtgt);
for(std::vector<std::string>::const_iterator dirIt=includes.begin();
dirIt != includes.end();
++dirIt)

View File

@ -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<std::string> includeDirs;
(*it)->GetIncludeDirectories(includeDirs, &l->second);
(*it)->GetIncludeDirectories(includeDirs, l->second);
this->AppendIncludeDirectories(fout, includeDirs, emmited);
}
}

View File

@ -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<std::string> 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<cmCryptoHash> hash;
bool showProgress = false;
while(i != args.end())
@ -2717,6 +2722,32 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> 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<std::string> const& args)
this->SetError("DOWNLOAD missing sum value for EXPECTED_MD5.");
return false;
}
expectedMD5sum = cmSystemTools::LowerCase(*i);
hash = cmsys::auto_ptr<cmCryptoHash>(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>(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<std::string> 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<std::string> 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<std::string> 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;

View File

@ -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. "

View File

@ -16,233 +16,112 @@
#include <cmsys/String.h>
#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("^\\$<TARGET"
"(|_SONAME|_LINKER)" // File with what purpose?
"_FILE(|_NAME|_DIR):" // Filename component.
"([A-Za-z0-9_.-]+)" // Target name.
">$");
this->TestConfig.compile("^\\$<CONFIG:([A-Za-z0-9_]*)>$");
}
//----------------------------------------------------------------------------
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<cmGeneratorExpressionToken> tokens = l.Tokenize(input);
bool needsParsing = l.GetSawGeneratorExpression();
std::vector<cmGeneratorExpressionEvaluator*> 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<cmGeneratorExpressionEvaluator*>::const_iterator it
= this->Evaluators.begin();
const std::vector<cmGeneratorExpressionEvaluator*>::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<cmGeneratorExpressionEvaluator*> &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<cmGeneratorExpressionEvaluator*>::const_iterator it
= this->Evaluators.begin();
const std::vector<cmGeneratorExpressionEvaluator*>::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, "$<CONFIGURATION>") == 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, "$<NOT:",6) == 0)
{
const char* c = expr+6;
if((c[0] != '0' && c[0] != '1') || c[1] != '>' || c[2])
{
result = "NOT requires exactly one '0' or '1' value.";
return false;
}
result = c[0] == '1'? "0" : "1";
}
else if(strncmp(expr, "$<AND:",6) == 0)
{
return cmGeneratorExpressionBool(expr+6, result, "AND", "1", "0");
}
else if(strncmp(expr, "$<OR:",5) == 0)
{
return cmGeneratorExpressionBool(expr+5, result, "OR", "0", "1");
}
else if(this->TestConfig.find(expr))
{
result = cmsysString_strcasecmp(this->TestConfig.match(1).c_str(),
this->Config? this->Config:"") == 0
? "1":"0";
}
else
{
result = "Expression syntax not recognized.";
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;
}

View File

@ -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<cmTarget*> const& GetTargets() const
{ return this->Targets; }
~cmCompiledGeneratorExpression();
private:
cmMakefile* Makefile;
const char* Config;
cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace,
const std::vector<cmGeneratorExpressionEvaluator*> &evaluators,
const char *input, bool needsParsing);
friend class cmGeneratorExpression;
cmCompiledGeneratorExpression(const cmCompiledGeneratorExpression &);
void operator=(const cmCompiledGeneratorExpression &);
cmListFileBacktrace const& Backtrace;
bool Quiet;
std::vector<char> Data;
std::stack<size_t> Barriers;
cmsys::RegularExpression TargetInfo;
cmsys::RegularExpression TestConfig;
std::set<cmTarget*> Targets;
bool Evaluate();
bool Evaluate(const char* expr, std::string& result);
bool EvaluateTargetInfo(std::string& result);
const std::vector<cmGeneratorExpressionEvaluator*> Evaluators;
const char* const Input;
const bool NeedsParsing;
mutable std::set<cmTarget*> Targets;
mutable std::string Output;
};

View File

@ -0,0 +1,568 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2012 Stephen Kelly <steveire@gmail.com>
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<std::string> &parameters,
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<std::string> &,
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<std::string> &,
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<std::string> &parameters, \
cmGeneratorExpressionContext *context, \
const GeneratorExpressionContent *content) const \
{ \
std::vector<std::string>::const_iterator it = parameters.begin(); \
const std::vector<std::string>::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<std::string> &parameters,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *content) const
{
if (*parameters.begin() != "0" && *parameters.begin() != "1")
{
reportError(context, content->GetOriginalExpression(),
"$<NOT> 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<std::string> &,
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<std::string> &parameters,
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<bool linker, bool soname>
struct TargetFilesystemArtifactResultCreator
{
static std::string Create(cmTarget* target,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *content);
};
//----------------------------------------------------------------------------
template<>
struct TargetFilesystemArtifactResultCreator<false, true>
{
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<true, false>
{
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<false, false>
{
static std::string Create(cmTarget* target,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *)
{
return target->GetFullPath(context->Config, false, true);
}
};
//----------------------------------------------------------------------------
template<bool dirQual, bool nameQual>
struct TargetFilesystemArtifactResultGetter
{
static std::string Get(const std::string &result);
};
//----------------------------------------------------------------------------
template<>
struct TargetFilesystemArtifactResultGetter<false, true>
{
static std::string Get(const std::string &result)
{ return cmSystemTools::GetFilenameName(result); }
};
//----------------------------------------------------------------------------
template<>
struct TargetFilesystemArtifactResultGetter<true, false>
{
static std::string Get(const std::string &result)
{ return cmSystemTools::GetFilenamePath(result); }
};
//----------------------------------------------------------------------------
template<>
struct TargetFilesystemArtifactResultGetter<false, false>
{
static std::string Get(const std::string &result)
{ return result; }
};
//----------------------------------------------------------------------------
template<bool linker, bool soname, bool dirQual, bool nameQual>
struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
{
TargetFilesystemArtifact() {}
virtual int NumExpectedParameters() const { return 1; }
std::string Evaluate(const std::vector<std::string> &parameters,
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<linker, soname>::Create(
target,
context,
content);
if (context->HadError)
{
return std::string();
}
return
TargetFilesystemArtifactResultGetter<dirQual, nameQual>::Get(result);
}
};
//----------------------------------------------------------------------------
static const
TargetFilesystemArtifact<false, false, false, false> targetFileNode;
static const
TargetFilesystemArtifact<true, false, false, false> targetLinkerFileNode;
static const
TargetFilesystemArtifact<false, true, false, false> targetSoNameFileNode;
static const
TargetFilesystemArtifact<false, false, false, true> targetFileNameNode;
static const
TargetFilesystemArtifact<true, false, false, true> targetLinkerFileNameNode;
static const
TargetFilesystemArtifact<false, true, false, true> targetSoNameFileNameNode;
static const
TargetFilesystemArtifact<false, false, true, false> targetFileDirNode;
static const
TargetFilesystemArtifact<true, false, true, false> targetLinkerFileDirNode;
static const
TargetFilesystemArtifact<false, true, true, false> 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 &notNode;
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<cmGeneratorExpressionEvaluator*>::const_iterator it
= this->IdentifierChildren.begin();
const std::vector<cmGeneratorExpressionEvaluator*>::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<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator
pit = this->ParamChildren.begin();
const
std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator
pend = this->ParamChildren.end();
for ( ; pit != pend; ++pit)
{
if (!result.empty())
{
result += ",";
}
std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it
= pit->begin();
const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end
= pit->end();
for ( ; it != end; ++it)
{
result += (*it)->Evaluate(context);
if (context->HadError)
{
return std::string();
}
}
}
return result;
}
std::vector<std::string> parameters;
{
std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator
pit = this->ParamChildren.begin();
const
std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator
pend = this->ParamChildren.end();
for ( ; pit != pend; ++pit)
{
std::string parameter;
std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it =
pit->begin();
const std::vector<cmGeneratorExpressionEvaluator*>::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<cmGeneratorExpressionEvaluator*> &c)
{
std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it
= c.begin();
const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end
= c.end();
for ( ; it != end; ++it)
{
delete *it;
}
}
//----------------------------------------------------------------------------
GeneratorExpressionContent::~GeneratorExpressionContent()
{
deleteAll(this->IdentifierChildren);
typedef std::vector<cmGeneratorExpressionEvaluator*> EvaluatorVector;
typedef std::vector<cmGeneratorExpressionToken> TokenVector;
std::vector<EvaluatorVector>::const_iterator pit =
this->ParamChildren.begin();
const std::vector<EvaluatorVector>::const_iterator pend =
this->ParamChildren.end();
for ( ; pit != pend; ++pit)
{
deleteAll(*pit);
}
}

View File

@ -0,0 +1,118 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2012 Stephen Kelly <steveire@gmail.com>
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 <vector>
#include <string>
//----------------------------------------------------------------------------
struct cmGeneratorExpressionContext
{
cmListFileBacktrace Backtrace;
std::set<cmTarget*> 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<cmGeneratorExpressionEvaluator*> identifier)
{
this->IdentifierChildren = identifier;
}
void SetParameters(
std::vector<std::vector<cmGeneratorExpressionEvaluator*> > parameters)
{
this->ParamChildren = parameters;
}
Type GetType() const
{
return cmGeneratorExpressionEvaluator::Generator;
}
std::string Evaluate(cmGeneratorExpressionContext *context) const;
std::string GetOriginalExpression() const;
~GeneratorExpressionContent();
private:
std::vector<cmGeneratorExpressionEvaluator*> IdentifierChildren;
std::vector<std::vector<cmGeneratorExpressionEvaluator*> > ParamChildren;
const char *StartContent;
unsigned int ContentLength;
};
#endif

View File

@ -0,0 +1,85 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2012 Stephen Kelly <steveire@gmail.com>
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<cmGeneratorExpressionToken> &result)
{
if (upto != c)
{
result.push_back(cmGeneratorExpressionToken(
cmGeneratorExpressionToken::Text, upto, c - upto));
}
}
//----------------------------------------------------------------------------
std::vector<cmGeneratorExpressionToken>
cmGeneratorExpressionLexer::Tokenize(const char *input)
{
std::vector<cmGeneratorExpressionToken> 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;
}

View File

@ -0,0 +1,58 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2012 Stephen Kelly <steveire@gmail.com>
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 <vector>
//----------------------------------------------------------------------------
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<cmGeneratorExpressionToken> Tokenize(const char *input);
bool GetSawGeneratorExpression() const
{
return this->SawGeneratorExpression;
}
private:
bool SawBeginExpression;
bool SawGeneratorExpression;
};
#endif

View File

@ -0,0 +1,235 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2012 Stephen Kelly <steveire@gmail.com>
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<cmGeneratorExpressionToken> &tokens)
: Tokens(tokens), NestingLevel(0)
{
}
//----------------------------------------------------------------------------
void cmGeneratorExpressionParser::Parse(
std::vector<cmGeneratorExpressionEvaluator*> &result)
{
it = this->Tokens.begin();
while (this->it != this->Tokens.end())
{
this->ParseContent(result);
}
}
//----------------------------------------------------------------------------
static void extendText(std::vector<cmGeneratorExpressionEvaluator*> &result,
std::vector<cmGeneratorExpressionToken>::const_iterator it)
{
if (result.size() > 0
&& (*(result.end() - 1))->GetType()
== cmGeneratorExpressionEvaluator::Text)
{
TextContent *textContent = static_cast<TextContent*>(*(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<cmGeneratorExpressionEvaluator*> &result,
const std::vector<cmGeneratorExpressionEvaluator*> &contents)
{
if (result.size() > 0
&& (*(result.end() - 1))->GetType()
== cmGeneratorExpressionEvaluator::Text
&& (*contents.begin())->GetType()
== cmGeneratorExpressionEvaluator::Text)
{
TextContent *textContent = static_cast<TextContent*>(*(result.end() - 1));
textContent->Extend(
static_cast<TextContent*>(*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<cmGeneratorExpressionEvaluator*> &result)
{
unsigned int nestedLevel = this->NestingLevel;
++this->NestingLevel;
std::vector<cmGeneratorExpressionToken>::const_iterator startToken
= this->it - 1;
std::vector<cmGeneratorExpressionEvaluator*> 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<std::vector<cmGeneratorExpressionEvaluator*> > parameters;
std::vector<std::vector<cmGeneratorExpressionToken>::const_iterator>
commaTokens;
std::vector<cmGeneratorExpressionToken>::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<cmGeneratorExpressionEvaluator*> EvaluatorVector;
typedef std::vector<cmGeneratorExpressionToken> TokenVector;
std::vector<EvaluatorVector>::const_iterator pit = parameters.begin();
const std::vector<EvaluatorVector>::const_iterator pend =
parameters.end();
std::vector<TokenVector::const_iterator>::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<cmGeneratorExpressionEvaluator*> &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<TextContent*>(*(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?
}

View File

@ -0,0 +1,45 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2012 Stephen Kelly <steveire@gmail.com>
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 <set>
#include <vector>
#include "cmListFileCache.h"
class cmMakefile;
class cmTarget;
struct cmGeneratorExpressionEvaluator;
//----------------------------------------------------------------------------
struct cmGeneratorExpressionParser
{
cmGeneratorExpressionParser(
const std::vector<cmGeneratorExpressionToken> &tokens);
void Parse(std::vector<cmGeneratorExpressionEvaluator*> &result);
private:
void ParseContent(std::vector<cmGeneratorExpressionEvaluator*> &);
void ParseGeneratorExpression(
std::vector<cmGeneratorExpressionEvaluator*> &);
private:
std::vector<cmGeneratorExpressionToken>::const_iterator it;
const std::vector<cmGeneratorExpressionToken> Tokens;
unsigned int NestingLevel;
};
#endif

View File

@ -14,9 +14,12 @@
#include "cmTarget.h"
#include "cmMakefile.h"
#include "cmLocalGenerator.h"
#include "cmComputeLinkInformation.h"
#include "cmGlobalGenerator.h"
#include "cmSourceFile.h"
#include <assert.h>
//----------------------------------------------------------------------------
cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
{
@ -27,6 +30,45 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
this->LookupObjectLibraries();
}
cmGeneratorTarget::~cmGeneratorTarget()
{
for(std::map<cmStdString, cmComputeLinkInformation*>::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<cmSourceFile*> const& cmGeneratorTarget::GetSourceFiles()
{
return this->Target->GetSourceFiles();
}
//----------------------------------------------------------------------------
void cmGeneratorTarget::ClassifySources()
{
@ -175,3 +217,179 @@ void cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& 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<cmStdString, cmComputeLinkInformation*>::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<cmStdString, cmComputeLinkInformation*>::value_type
entry(config?config:"", info);
i = this->LinkInformation.insert(entry).first;
}
return i->second;
}
//----------------------------------------------------------------------------
void cmGeneratorTarget::GetAppleArchs(const char* config,
std::vector<std::string>& 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<std::string> cmGeneratorTarget::GetIncludeDirectories()
{
std::vector<std::string> includes;
const char *prop = this->Target->GetProperty("INCLUDE_DIRECTORIES");
if(prop)
{
cmSystemTools::ExpandListArgument(prop, includes);
}
std::set<std::string> uniqueIncludes;
std::vector<std::string> orderedAndUniqueIncludes;
for(std::vector<std::string>::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());
}

View File

@ -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<cmSourceFile*> const& GetSourceFiles();
cmTarget* Target;
cmMakefile* Makefile;
@ -52,6 +60,25 @@ public:
void UseObjectLibraries(std::vector<std::string>& objs);
/** Add the target output files to the global generator manifest. */
void GenerateTargetManifest(const char* config);
std::map<cmStdString, cmComputeLinkInformation*> LinkInformation;
cmComputeLinkInformation* GetLinkInformation(const char* config);
void GetAppleArchs(const char* config,
std::vector<std::string>& 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<std::string> 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<cmTarget*, cmGeneratorTarget*> cmGeneratorTargetsType;
#endif

View File

@ -315,9 +315,11 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
{
rootBin = this->ConfiguredFilesPath;
}
rootBin += "/";
rootBin += cmVersion::GetCMakeVersion();
// set the dir for parent files so they can be used by modules
mf->AddDefinition("CMAKE_PLATFORM_ROOT_BIN",rootBin.c_str());
mf->AddDefinition("CMAKE_PLATFORM_INFO_DIR",rootBin.c_str());
// find and make sure CMAKE_MAKE_PROGRAM is defined
this->FindMakeProgram(mf);
@ -376,21 +378,16 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
std::string loadedLang = "CMAKE_";
loadedLang += lang;
loadedLang += "_COMPILER_LOADED";
// If the existing build tree was already configured with this
// version of CMake then try to load the configured file first
// to avoid duplicate compiler tests.
unsigned int cacheMajor = mf->GetCacheMajorVersion();
unsigned int cacheMinor = mf->GetCacheMinorVersion();
unsigned int selfMajor = cmVersion::GetMajorVersion();
unsigned int selfMinor = cmVersion::GetMinorVersion();
if((this->CMakeInstance->GetIsInTryCompile() ||
(selfMajor == cacheMajor && selfMinor == cacheMinor))
&& !mf->GetDefinition(loadedLang.c_str()))
if(!mf->GetDefinition(loadedLang.c_str()))
{
fpath = rootBin;
fpath += "/CMake";
fpath += lang;
fpath += "Compiler.cmake";
// If the existing build tree was already configured with this
// version of CMake then try to load the configured file first
// to avoid duplicate compiler tests.
if(cmSystemTools::FileExists(fpath.c_str()))
{
if(!mf->ReadListFile(0,fpath.c_str()))
@ -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<std::string> 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<std::string>::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<std::string> incs;
this->LocalGenerators[i]->GetIncludeDirectories(incs, &l->second);
this->LocalGenerators[i]->GetIncludeDirectories(incs, l->second);
for( std::vector<std::string>::const_iterator incDir = incs.begin();
incDir != incs.end(); ++incDir)

View File

@ -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<cmTarget*, cmGeneratorTarget*> GeneratorTargetsType;
GeneratorTargetsType GeneratorTargets;
cmGeneratorTargetsType GeneratorTargets;
void CreateGeneratorTargets();
void ClearGeneratorTargets();
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;

View File

@ -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());
}
}
//----------------------------------------------------------------------------

View File

@ -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");
}
//----------------------------------------------------------------------------

View File

@ -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");
}
//----------------------------------------------------------------------------

View File

@ -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");
}

View File

@ -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

View File

@ -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)
{

View File

@ -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);

View File

@ -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");
}

View File

@ -18,7 +18,7 @@ class cmGlobalVisualStudio11Win64Generator :
public cmGlobalVisualStudio11Generator
{
public:
cmGlobalVisualStudio11Win64Generator() {}
cmGlobalVisualStudio11Win64Generator();
static cmGlobalGenerator* New() {
return new cmGlobalVisualStudio11Win64Generator; }

Some files were not shown because too many files have changed in this diff Show More