diff options
105 files changed, 923 insertions, 573 deletions
diff --git a/Help/release/dev/FindOpenGL-target.rst b/Help/release/dev/FindOpenGL-target.rst new file mode 100644 index 0000000..670507e --- /dev/null +++ b/Help/release/dev/FindOpenGL-target.rst @@ -0,0 +1,5 @@ +FindOpenGL-target +----------------- + +* The :module:`FindOpenGL` module now provides imported targets + ``OpenGL::GL`` and ``OpenGL::GLU`` when the libraries are found. diff --git a/Help/release/dev/OpenWatcom.rst b/Help/release/dev/OpenWatcom.rst new file mode 100644 index 0000000..63f6e8c --- /dev/null +++ b/Help/release/dev/OpenWatcom.rst @@ -0,0 +1,9 @@ +OpenWatcom +---------- + +* Support for the Open Watcom compiler has been overhauled. + The :variable:`CMAKE_<LANG>_COMPILER_ID` is now ``OpenWatcom``, + and the :variable:`CMAKE_<LANG>_COMPILER_VERSION` now uses + the Open Watcom external version numbering. The external + version numbers are lower than the internal version number + by 11. diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst index cf9c386..f554f4e 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst @@ -20,13 +20,13 @@ include: Intel = Intel Compiler (intel.com) MIPSpro = SGI MIPSpro (sgi.com) MSVC = Microsoft Visual Studio (microsoft.com) + OpenWatcom = Open Watcom (openwatcom.org) PGI = The Portland Group (pgroup.com) PathScale = PathScale (pathscale.com) SDCC = Small Device C Compiler (sdcc.sourceforge.net) SunPro = Oracle Solaris Studio (oracle.com) TI = Texas Instruments (ti.com) TinyCC = Tiny C Compiler (tinycc.org) - Watcom = Open Watcom (openwatcom.org) XL, VisualAge, zOS = IBM XL (ibm.com) This variable is not guaranteed to be defined for all compilers or diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index d8a0d67..7f82a9d 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -17,6 +17,7 @@ function(_readFile file) get_filename_component(name ${file} NAME_WE) string(REGEX REPLACE "-.*" "" CompilerId ${name}) set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE) + set(_compiler_id_simulate_${CompilerId} ${_compiler_id_simulate} PARENT_SCOPE) set(_compiler_id_pp_test_${CompilerId} ${_compiler_id_pp_test} PARENT_SCOPE) endfunction() @@ -114,7 +115,9 @@ function(compiler_id_detection outvar lang) endif() set(id_content "${pp_if} ${_compiler_id_pp_test_${Id}}\n") if (CID_ID_STRING) - set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_ID \"${Id}\"") + set(PREFIX ${CID_PREFIX}) + string(CONFIGURE "${_compiler_id_simulate_${Id}}" SIMULATE_BLOCK @ONLY) + set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_ID \"${Id}\"${SIMULATE_BLOCK}") endif() if (CID_ID_DEFINE) set(id_content "${id_content}# undef ${CID_PREFIX}COMPILER_IS_${Id}\n") @@ -122,6 +125,8 @@ function(compiler_id_detection outvar lang) endif() if (CID_VERSION_STRINGS) set(PREFIX ${CID_PREFIX}) + set(MACRO_DEC DEC) + set(MACRO_HEX HEX) string(CONFIGURE "${_compiler_id_version_compute_${Id}}" VERSION_BLOCK @ONLY) set(id_content "${id_content}${VERSION_BLOCK}\n") endif() diff --git a/Modules/CMakeRCCompiler.cmake.in b/Modules/CMakeRCCompiler.cmake.in index 0fc3142..8257cd6 100644 --- a/Modules/CMakeRCCompiler.cmake.in +++ b/Modules/CMakeRCCompiler.cmake.in @@ -1,6 +1,6 @@ set(CMAKE_RC_COMPILER "@CMAKE_RC_COMPILER@") set(CMAKE_RC_COMPILER_ARG1 "@CMAKE_RC_COMPILER_ARG1@") set(CMAKE_RC_COMPILER_LOADED 1) -set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc) +set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc;RC) set(CMAKE_RC_OUTPUT_EXTENSION @CMAKE_RC_OUTPUT_EXTENSION@) set(CMAKE_RC_COMPILER_ENV_VAR "RC") diff --git a/Modules/Compiler/ADSP-DetermineCompiler.cmake b/Modules/Compiler/ADSP-DetermineCompiler.cmake index 0b5af0d..0340f69 100644 --- a/Modules/Compiler/ADSP-DetermineCompiler.cmake +++ b/Modules/Compiler/ADSP-DetermineCompiler.cmake @@ -4,7 +4,7 @@ set(_compiler_id_pp_test "defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFI set(_compiler_id_version_compute " #if defined(__VISUALDSPVERSION__) /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ -# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) -# define @PREFIX@COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) -# define @PREFIX@COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__VISUALDSPVERSION__>>24) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__VISUALDSPVERSION__>>16 & 0xFF) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__VISUALDSPVERSION__>>8 & 0xFF) #endif") diff --git a/Modules/Compiler/AppleClang-DetermineCompiler.cmake b/Modules/Compiler/AppleClang-DetermineCompiler.cmake index d293b7b..397f95c 100644 --- a/Modules/Compiler/AppleClang-DetermineCompiler.cmake +++ b/Modules/Compiler/AppleClang-DetermineCompiler.cmake @@ -4,4 +4,4 @@ set(_compiler_id_pp_test "defined(__clang__) && defined(__apple_build_version__) include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake") set(_compiler_id_version_compute "${_compiler_id_version_compute} -# define @PREFIX@COMPILER_VERSION_TWEAK DEC(__apple_build_version__)") +# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__apple_build_version__)") diff --git a/Modules/Compiler/Borland-DetermineCompiler.cmake b/Modules/Compiler/Borland-DetermineCompiler.cmake index 2e8a948..ef3083b 100644 --- a/Modules/Compiler/Borland-DetermineCompiler.cmake +++ b/Modules/Compiler/Borland-DetermineCompiler.cmake @@ -3,5 +3,5 @@ set(_compiler_id_pp_test "defined(__BORLANDC__)") set(_compiler_id_version_compute " /* __BORLANDC__ = 0xVRR */ -# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) -# define @PREFIX@COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__BORLANDC__>>8) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__BORLANDC__ & 0xFF)") diff --git a/Modules/Compiler/Clang-DetermineCompilerInternal.cmake b/Modules/Compiler/Clang-DetermineCompilerInternal.cmake index 9a37a63..08c1230 100644 --- a/Modules/Compiler/Clang-DetermineCompilerInternal.cmake +++ b/Modules/Compiler/Clang-DetermineCompilerInternal.cmake @@ -1,11 +1,15 @@ set(_compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__clang_major__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__clang_minor__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__clang_patchlevel__) # if defined(_MSC_VER) -# define @PREFIX@SIMULATE_ID \"MSVC\" /* _MSC_VER = VVRR */ -# define @PREFIX@SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define @PREFIX@SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100) +# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100) +# endif") + +set(_compiler_id_simulate " +# if defined(_MSC_VER) +# define @PREFIX@SIMULATE_ID \"MSVC\" # endif") diff --git a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake index e4def4d..2265e5e 100644 --- a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake +++ b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake @@ -3,5 +3,5 @@ set(_compiler_id_pp_test "defined(__COMO__)") set(_compiler_id_version_compute " /* __COMO_VERSION__ = VRR */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__COMO_VERSION__ / 100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__COMO_VERSION__ % 100)") diff --git a/Modules/Compiler/Compaq-C-DetermineCompiler.cmake b/Modules/Compiler/Compaq-C-DetermineCompiler.cmake index 56fedb1..02e99dc 100644 --- a/Modules/Compiler/Compaq-C-DetermineCompiler.cmake +++ b/Modules/Compiler/Compaq-C-DetermineCompiler.cmake @@ -3,6 +3,6 @@ set(_compiler_id_pp_test "defined(__DECC)") set(_compiler_id_version_compute " /* __DECC_VER = VVRRTPPPP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__DECC_VER/10000000) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__DECC_VER/100000 % 100) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__DECC_VER % 10000)") diff --git a/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake index 5855c24..c7d0565 100644 --- a/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake +++ b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake @@ -3,6 +3,6 @@ set(_compiler_id_pp_test "defined(__DECCXX)") set(_compiler_id_version_compute " /* __DECCXX_VER = VVRRTPPPP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__DECCXX_VER/10000000) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__DECCXX_VER/100000 % 100) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__DECCXX_VER % 10000)") diff --git a/Modules/Compiler/Cray-DetermineCompiler.cmake b/Modules/Compiler/Cray-DetermineCompiler.cmake index 6e4eaf9..881b82c 100644 --- a/Modules/Compiler/Cray-DetermineCompiler.cmake +++ b/Modules/Compiler/Cray-DetermineCompiler.cmake @@ -2,5 +2,5 @@ set(_compiler_id_pp_test "defined(_CRAYC)") set(_compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(_RELEASE) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_RELEASE) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_RELEASE_MINOR)") diff --git a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake index f52d79b..2feedac 100644 --- a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake +++ b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake @@ -2,6 +2,6 @@ set(_compiler_id_pp_test "defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)") set(_compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) -# define @PREFIX@COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define @PREFIX@COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__CODEGEARC_VERSION__ & 0xFFFF)") diff --git a/Modules/Compiler/GNU-DetermineCompiler.cmake b/Modules/Compiler/GNU-DetermineCompiler.cmake index f0c25dd..261f148 100644 --- a/Modules/Compiler/GNU-DetermineCompiler.cmake +++ b/Modules/Compiler/GNU-DetermineCompiler.cmake @@ -2,8 +2,8 @@ set(_compiler_id_pp_test "defined(__GNUC__)") set(_compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__GNUC__) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__GNUC__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__) # if defined(__GNUC_PATCHLEVEL__) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__) # endif") diff --git a/Modules/Compiler/HP-C-DetermineCompiler.cmake b/Modules/Compiler/HP-C-DetermineCompiler.cmake index 024a658..4269799 100644 --- a/Modules/Compiler/HP-C-DetermineCompiler.cmake +++ b/Modules/Compiler/HP-C-DetermineCompiler.cmake @@ -3,6 +3,6 @@ set(_compiler_id_pp_test "defined(__HP_cc)") set(_compiler_id_version_compute " /* __HP_cc = VVRRPP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__HP_cc % 100)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__HP_cc/10000) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__HP_cc/100 % 100) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__HP_cc % 100)") diff --git a/Modules/Compiler/HP-CXX-DetermineCompiler.cmake b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake index 6999492..3d4d7e4 100644 --- a/Modules/Compiler/HP-CXX-DetermineCompiler.cmake +++ b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake @@ -3,6 +3,6 @@ set(_compiler_id_pp_test "defined(__HP_aCC)") set(_compiler_id_version_compute " /* __HP_aCC = VVRRPP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__HP_aCC/10000) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__HP_aCC/100 % 100) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__HP_aCC % 100)") diff --git a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake index 6169ab4..899e284 100644 --- a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake +++ b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake @@ -1,6 +1,6 @@ set(_compiler_id_version_compute " /* __IBMC__ = VRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMC__/100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMC__/10 % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMC__ % 10)") diff --git a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake index f673d72..73aa2b4 100644 --- a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake +++ b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake @@ -1,6 +1,6 @@ set(_compiler_id_version_compute " /* __IBMCPP__ = VRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMCPP__/100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMCPP__/10 % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMCPP__ % 10)") diff --git a/Modules/Compiler/Intel-DetermineCompiler.cmake b/Modules/Compiler/Intel-DetermineCompiler.cmake index 6fada1c..d7e4532 100644 --- a/Modules/Compiler/Intel-DetermineCompiler.cmake +++ b/Modules/Compiler/Intel-DetermineCompiler.cmake @@ -3,20 +3,24 @@ set(_compiler_id_pp_test "defined(__INTEL_COMPILER) || defined(__ICC)") set(_compiler_id_version_compute " /* __INTEL_COMPILER = VRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEL_COMPILER/100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEL_COMPILER/10 % 10) # if defined(__INTEL_COMPILER_UPDATE) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_COMPILER_UPDATE) # else -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_COMPILER % 10) # endif # if defined(__INTEL_COMPILER_BUILD_DATE) /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ -# define @PREFIX@COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__INTEL_COMPILER_BUILD_DATE) # endif # if defined(_MSC_VER) -# define @PREFIX@SIMULATE_ID \"MSVC\" /* _MSC_VER = VVRR */ -# define @PREFIX@SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define @PREFIX@SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100) +# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100) +# endif") + +set(_compiler_id_simulate " +# if defined(_MSC_VER) +# define @PREFIX@SIMULATE_ID \"MSVC\" # endif") diff --git a/Modules/Compiler/MIPSpro-DetermineCompiler.cmake b/Modules/Compiler/MIPSpro-DetermineCompiler.cmake index 31eb345..9e48553 100644 --- a/Modules/Compiler/MIPSpro-DetermineCompiler.cmake +++ b/Modules/Compiler/MIPSpro-DetermineCompiler.cmake @@ -4,12 +4,12 @@ set(_compiler_id_pp_test "defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VE set(_compiler_id_version_compute " # if defined(_SGI_COMPILER_VERSION) /* _SGI_COMPILER_VERSION = VRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_SGI_COMPILER_VERSION/100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_SGI_COMPILER_VERSION/10 % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_SGI_COMPILER_VERSION % 10) # else /* _COMPILER_VERSION = VRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_COMPILER_VERSION/100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_COMPILER_VERSION/10 % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_COMPILER_VERSION % 10) # endif") diff --git a/Modules/Compiler/MSVC-DetermineCompiler.cmake b/Modules/Compiler/MSVC-DetermineCompiler.cmake index d462d07..313de89 100644 --- a/Modules/Compiler/MSVC-DetermineCompiler.cmake +++ b/Modules/Compiler/MSVC-DetermineCompiler.cmake @@ -3,17 +3,17 @@ set(_compiler_id_pp_test "defined(_MSC_VER)") set(_compiler_id_version_compute " /* _MSC_VER = VVRR */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100) # if defined(_MSC_FULL_VER) # if _MSC_VER >= 1400 /* _MSC_FULL_VER = VVRRPPPPP */ -# define @PREFIX@COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_MSC_FULL_VER % 100000) # else /* _MSC_FULL_VER = VVRRPPPP */ -# define @PREFIX@COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_MSC_FULL_VER % 10000) # endif # endif # if defined(_MSC_BUILD) -# define @PREFIX@COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(_MSC_BUILD) # endif") diff --git a/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake b/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake index 6d416c1..2ed116c 100644 --- a/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake +++ b/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake @@ -3,8 +3,8 @@ set(_compiler_id_pp_test "defined(__WATCOMC__)") set(_compiler_id_version_compute " /* __WATCOMC__ = VVRP + 1100 */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__WATCOMC__ - 1100) / 100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__WATCOMC__ / 10) % 10) # if (__WATCOMC__ % 10) > 0 -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__WATCOMC__ % 10) # endif") diff --git a/Modules/Compiler/PGI-DetermineCompiler.cmake b/Modules/Compiler/PGI-DetermineCompiler.cmake index 8e68bd6..8d3dc9c 100644 --- a/Modules/Compiler/PGI-DetermineCompiler.cmake +++ b/Modules/Compiler/PGI-DetermineCompiler.cmake @@ -2,8 +2,8 @@ set(_compiler_id_pp_test "defined(__PGI)") set(_compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__PGIC__) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__PGIC__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__PGIC_MINOR__) # if defined(__PGIC_PATCHLEVEL__) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__PGIC_PATCHLEVEL__) # endif") diff --git a/Modules/Compiler/PathScale-DetermineCompiler.cmake b/Modules/Compiler/PathScale-DetermineCompiler.cmake index 3335e26..4eb81de 100644 --- a/Modules/Compiler/PathScale-DetermineCompiler.cmake +++ b/Modules/Compiler/PathScale-DetermineCompiler.cmake @@ -2,8 +2,8 @@ set(_compiler_id_pp_test "defined(__PATHCC__)") set(_compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__PATHCC__) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__PATHCC__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__PATHCC_MINOR__) # if defined(__PATHCC_PATCHLEVEL__) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__PATHCC_PATCHLEVEL__) # endif") diff --git a/Modules/Compiler/SDCC-C-DetermineCompiler.cmake b/Modules/Compiler/SDCC-C-DetermineCompiler.cmake index 8fe60d9..1d7dd78 100644 --- a/Modules/Compiler/SDCC-C-DetermineCompiler.cmake +++ b/Modules/Compiler/SDCC-C-DetermineCompiler.cmake @@ -5,6 +5,6 @@ set(_compiler_id_pp_test "defined(SDCC)") set(_compiler_id_version_compute " /* SDCC = VRP */ -# define COMPILER_VERSION_MAJOR DEC(SDCC/100) -# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) -# define COMPILER_VERSION_PATCH DEC(SDCC % 10)") +# define COMPILER_VERSION_MAJOR @MACRO_DEC@(SDCC/100) +# define COMPILER_VERSION_MINOR @MACRO_DEC@(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH @MACRO_DEC@(SDCC % 10)") diff --git a/Modules/Compiler/SunPro-C-DetermineCompiler.cmake b/Modules/Compiler/SunPro-C-DetermineCompiler.cmake index 7db1a97..e9d7457 100644 --- a/Modules/Compiler/SunPro-C-DetermineCompiler.cmake +++ b/Modules/Compiler/SunPro-C-DetermineCompiler.cmake @@ -4,12 +4,12 @@ set(_compiler_id_pp_test "defined(__SUNPRO_C)") set(_compiler_id_version_compute " # if __SUNPRO_C >= 0x5100 /* __SUNPRO_C = 0xVRRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) -# define @PREFIX@COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) -# define @PREFIX@COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_C>>12) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_C>>4 & 0xFF) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_C & 0xF) # else /* __SUNPRO_CC = 0xVRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) -# define @PREFIX@COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) -# define @PREFIX@COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_C>>8) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_C>>4 & 0xF) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_C & 0xF) # endif") diff --git a/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake index 0a48cc6..5c23a95 100644 --- a/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake +++ b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake @@ -4,12 +4,12 @@ set(_compiler_id_pp_test "defined(__SUNPRO_CC)") set(_compiler_id_version_compute " # if __SUNPRO_CC >= 0x5100 /* __SUNPRO_CC = 0xVRRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) -# define @PREFIX@COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) -# define @PREFIX@COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_CC>>12) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_CC>>4 & 0xFF) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_CC & 0xF) # else /* __SUNPRO_CC = 0xVRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) -# define @PREFIX@COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) -# define @PREFIX@COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_CC>>8) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_CC>>4 & 0xF) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_CC & 0xF) # endif") diff --git a/Modules/Compiler/TI-DetermineCompiler.cmake b/Modules/Compiler/TI-DetermineCompiler.cmake index 1856c9b..19aa9e3 100644 --- a/Modules/Compiler/TI-DetermineCompiler.cmake +++ b/Modules/Compiler/TI-DetermineCompiler.cmake @@ -3,6 +3,6 @@ set(_compiler_id_pp_test "defined(__TI_COMPILER_VERSION__)") set(_compiler_id_version_compute " /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__TI_COMPILER_VERSION__/1000000) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__TI_COMPILER_VERSION__/1000 % 1000) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__TI_COMPILER_VERSION__ % 1000)") diff --git a/Modules/Compiler/Watcom-DetermineCompiler.cmake b/Modules/Compiler/Watcom-DetermineCompiler.cmake index cc59abf..153e350 100644 --- a/Modules/Compiler/Watcom-DetermineCompiler.cmake +++ b/Modules/Compiler/Watcom-DetermineCompiler.cmake @@ -3,8 +3,8 @@ set(_compiler_id_pp_test "defined(__WATCOMC__) && __WATCOMC__ < 1200") set(_compiler_id_version_compute " /* __WATCOMC__ = VVRR */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__WATCOMC__ / 100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__WATCOMC__ / 10) % 10) # if (__WATCOMC__ % 10) > 0 -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__WATCOMC__ % 10) # endif") diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index a83a6c3..2b3bd14 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -4,6 +4,16 @@ # # FindModule for OpenGL and GLU. # +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines the :prop_tgt:`IMPORTED` targets: +# +# ``OpenGL::GL`` +# Defined if the system has OpenGL. +# ``OpenGL::GLU`` +# Defined if the system has GLU. +# # Result Variables # ^^^^^^^^^^^^^^^^ # @@ -181,6 +191,36 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS}) unset(_OpenGL_REQUIRED_VARS) +# OpenGL:: targets +if(OPENGL_FOUND) + if(NOT TARGET OpenGL::GL) + add_library(OpenGL::GL UNKNOWN IMPORTED) + set_target_properties(OpenGL::GL PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}") + if(OPENGL_gl_LIBRARY MATCHES "/([^/]+)\\.framework$") + set_target_properties(OpenGL::GL PROPERTIES + IMPORTED_LOCATION "${OPENGL_gl_LIBRARY}/${CMAKE_MATCH_1}") + else() + set_target_properties(OpenGL::GL PROPERTIES + IMPORTED_LOCATION "${OPENGL_gl_LIBRARY}") + endif() + endif() + + if(OPENGL_GLU_FOUND AND NOT TARGET OpenGL::GLU) + add_library(OpenGL::GLU UNKNOWN IMPORTED) + set_target_properties(OpenGL::GLU PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES OpenGL::GL) + if(OPENGL_glu_LIBRARY MATCHES "/([^/]+)\\.framework$") + set_target_properties(OpenGL::GLU PROPERTIES + IMPORTED_LOCATION "${OPENGL_glu_LIBRARY}/${CMAKE_MATCH_1}") + else() + set_target_properties(OpenGL::GLU PROPERTIES + IMPORTED_LOCATION "${OPENGL_glu_LIBRARY}") + endif() + endif() +endif() + mark_as_advanced( OPENGL_INCLUDE_DIR OPENGL_xmesa_INCLUDE_DIR diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake new file mode 100644 index 0000000..e6d4fcf --- /dev/null +++ b/Modules/Platform/Android.cmake @@ -0,0 +1,9 @@ +include(Platform/Linux) + +# Android has soname, but binary names must end in ".so" so we cannot append +# a version number. Also we cannot portably represent symlinks on the host. +set(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1) + +# Android reportedly ignores RPATH, and we cannot predict the install +# location anyway. +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake index e034a28..8f21adf 100644 --- a/Modules/ProcessorCount.cmake +++ b/Modules/ProcessorCount.cmake @@ -103,6 +103,10 @@ function(ProcessorCount var) OUTPUT_VARIABLE machinfo_output) string(REGEX MATCHALL "Number of CPUs = ([0-9]+)" procs "${machinfo_output}") set(count "${CMAKE_MATCH_1}") + if(NOT count) + string(REGEX MATCHALL "([0-9]+) logical processors" procs "${machinfo_output}") + set(count "${CMAKE_MATCH_1}") + endif() #message("ProcessorCount: trying machinfo '${ProcessorCount_cmd_machinfo}'") else() find_program(ProcessorCount_cmd_mpsched mpsched) diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index f80943d..d7992fe 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -52,7 +52,15 @@ # Feature Test Macros # =================== # -# For each compiler, a preprocessor test of the compiler version is generated +# For each compiler, a preprocessor macro is generated matching +# ``<PREFIX>_COMPILER_IS_<compiler>`` which has the content either ``0`` +# or ``1``, depending on the compiler in use. Preprocessor macros for +# compiler version components are generated matching +# ``<PREFIX>_COMPILER_VERSION_MAJOR`` ``<PREFIX>_COMPILER_VERSION_MINOR`` +# and ``<PREFIX>_COMPILER_VERSION_PATCH`` containing decimal values +# for the corresponding compiler version components, if defined. +# +# A preprocessor test is generated based on the compiler version # denoting whether each feature is enabled. A preprocessor macro # matching ``<PREFIX>_COMPILER_<FEATURE>``, where ``<FEATURE>`` is the # upper-case ``<feature>`` name, is generated to contain the value @@ -133,16 +141,47 @@ # ``static_assert``, or ignored if using the backward compatibility # implementation. # -# ====================== ================================ =================== -# Feature Define Symbol -# ====================== ================================ =================== -# ``cxx_alignas`` ``<PREFIX>_ALIGNAS`` ``alignas`` -# ``cxx_alignof`` ``<PREFIX>_ALIGNOF`` ``alignof`` -# ``cxx_nullptr`` ``<PREFIX>_NULLPTR`` ``nullptr`` -# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT`` ``static_assert`` -# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT_MSG`` ``static_assert`` -# ====================== ================================ =================== - +# The ``cxx_attribute_deprecated`` feature provides a macro definition +# ``<PREFIX>_DEPRECATED``, which expands to either the standard +# ``[[deprecated]]`` attribute or a compiler-specific decorator such +# as ``__attribute__((__deprecated__))`` used by GNU compilers. +# +# The ``cxx_alignas`` feature provides a macro definition +# ``<PREFIX>_ALIGNAS`` which expands to either the standard ``alignas`` +# decorator or a compiler-specific decorator such as +# ``__attribute__ ((__aligned__))`` used by GNU compilers. +# +# The ``cxx_alignof`` feature provides a macro definition +# ``<PREFIX>_ALIGNOF`` which expands to either the standard ``alignof`` +# decorator or a compiler-specific decorator such as ``__alignof__`` +# used by GNU compilers. +# +# ============================= ================================ ===================== +# Feature Define Symbol +# ============================= ================================ ===================== +# ``cxx_alignas`` ``<PREFIX>_ALIGNAS`` ``alignas`` +# ``cxx_alignof`` ``<PREFIX>_ALIGNOF`` ``alignof`` +# ``cxx_nullptr`` ``<PREFIX>_NULLPTR`` ``nullptr`` +# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT`` ``static_assert`` +# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT_MSG`` ``static_assert`` +# ``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED`` ``[[deprecated]]`` +# ``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED_MSG`` ``[[deprecated]]`` +# ============================= ================================ ===================== +# +# A use-case which arises with such deprecation macros is the deprecation +# of an entire library. In that case, all public API in the library may +# be decorated with the ``<PREFIX>_DEPRECATED`` macro. This results in +# very noisy build output when building the library itself, so the macro +# may be may be defined to empty in that case when building the deprecated +# library: +# +# .. code-block:: cmake +# +# add_library(compat_support ${srcs}) +# target_compile_definitions(compat_support +# PRIVATE +# CompatSupport_DEPRECATED= +# ) #============================================================================= # Copyright 2014 Stephen Kelly <steveire@gmail.com> @@ -166,6 +205,8 @@ function(_load_compiler_variables CompilerId lang) foreach(feature ${ARGN}) set(_cmake_feature_test_${CompilerId}_${feature} ${_cmake_feature_test_${feature}} PARENT_SCOPE) endforeach() + include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-DetermineCompiler.cmake" OPTIONAL) + set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE) endfunction() function(write_compiler_detection_header @@ -197,19 +238,33 @@ function(write_compiler_detection_header if(NOT _WCD_VERSION) set(_WCD_VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION}) endif() - if (_WCD_VERSION VERSION_LESS 3.1.0) # Version which introduced this function - message(FATAL_ERROR "VERSION parameter too low.") + set(_min_version 3.1.0) # Version which introduced this function + if (_WCD_VERSION VERSION_LESS _min_version) + set(err "VERSION compatibility for write_compiler_detection_header is set to ${_WCD_VERSION}, which is too low.") + set(err "${err} It must be set to at least ${_min_version}. ") + set(err "${err} Either set the VERSION parameter to the write_compiler_detection_header function, or update") + set(err "${err} your minimum required CMake version with the cmake_minimum_required command.") + message(FATAL_ERROR "${err}") endif() set(compilers GNU Clang ) + + set(_hex_compilers ADSP Borland Embarcadero SunPro) + foreach(_comp ${_WCD_COMPILERS}) list(FIND compilers ${_comp} idx) if (idx EQUAL -1) message(FATAL_ERROR "Unsupported compiler ${_comp}.") endif() + if (NOT _need_hex_conversion) + list(FIND _hex_compilers ${_comp} idx) + if (NOT idx EQUAL -1) + set(_need_hex_conversion TRUE) + endif() + endif() endforeach() set(file_content " @@ -223,6 +278,21 @@ function(write_compiler_detection_header set(file_content "${file_content}\n${_WCD_PROLOG}\n") endif() + if (_need_hex_conversion) + set(file_content "${file_content} +#define ${prefix_arg}_DEC(X) (X) +#define ${prefix_arg}_HEX(X) ( \\ + ((X)>>28 & 0xF) * 10000000 + \\ + ((X)>>24 & 0xF) * 1000000 + \\ + ((X)>>20 & 0xF) * 100000 + \\ + ((X)>>16 & 0xF) * 10000 + \\ + ((X)>>12 & 0xF) * 1000 + \\ + ((X)>>8 & 0xF) * 100 + \\ + ((X)>>4 & 0xF) * 10 + \\ + ((X) & 0xF) \\ + )\n") + endif() + foreach(feature ${_WCD_FEATURES}) if (feature MATCHES "^cxx_") list(APPEND _langs CXX) @@ -266,6 +336,21 @@ function(write_compiler_detection_header # if !(${_cmake_oldestSupported_${compiler}}) # error Unsupported compiler version # endif\n") + + set(PREFIX ${prefix_arg}_) + if (_need_hex_conversion) + set(MACRO_DEC ${prefix_arg}_DEC) + set(MACRO_HEX ${prefix_arg}_HEX) + else() + set(MACRO_DEC) + set(MACRO_HEX) + endif() + string(CONFIGURE "${_compiler_id_version_compute_${compiler}}" VERSION_BLOCK @ONLY) + set(file_content "${file_content}${VERSION_BLOCK}\n") + set(PREFIX) + set(MACRO_DEC) + set(MACRO_HEX) + set(pp_if "elif") foreach(feature ${${_lang}_features}) string(TOUPPER ${feature} feature_upper) @@ -402,6 +487,27 @@ function(write_compiler_detection_header # endif \n") endif() + if (feature STREQUAL cxx_attribute_deprecated) + set(def_name ${prefix_arg}_${feature_PP}) + set(def_value "${prefix_arg}_DEPRECATED") + set(file_content "${file_content} +# ifndef ${def_value} +# if ${def_name} +# define ${def_value} [[deprecated]] +# define ${def_value}_MSG(MSG) [[deprecated(MSG)]] +# elif defined(__GNUC__) || defined(__clang__) +# define ${def_value} __attribute__((__deprecated__)) +# define ${def_value}_MSG(MSG) __attribute__((__deprecated__(MSG))) +# elif defined(_MSC_VER) +# define ${def_value} __declspec(deprecated) +# define ${def_value}_MSG(MSG) __declspec(deprecated(MSG)) +# else +# define ${def_value} +# define ${def_value}_MSG(MSG) +# endif +# endif +\n") + endif() endforeach() set(file_content "${file_content}#endif\n") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 59ccf51..b8fbc7e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140606) +set(CMake_VERSION_PATCH 20140613) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 0113698..a5eee6b 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -588,8 +588,8 @@ void cmCPackNSISGenerator::CreateMenuLinks( cmOStringStream& str, return; } - cmsys::RegularExpression urlRegex; - urlRegex.compile("^(mailto:|(ftps?|https?|news)://).*$"); + static cmsys::RegularExpression + urlRegex("^(mailto:|(ftps?|https?|news)://).*$"); std::vector<std::string>::iterator it; for ( it = cpackMenuLinksVector.begin(); diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index ad37c42..98c62d5 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -101,7 +101,7 @@ int cpackDefinitionArgument(const char* argument, const char* cValue, // this is CPack. int main (int argc, char const* const* argv) { - setlocale(LC_ALL, ""); + setlocale(LC_CTYPE, ""); cmsys::Encoding::CommandLineArguments args = cmsys::Encoding::CommandLineArguments::Main(argc, argv); argc = args.argc(); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 1d1dde4..f21d166 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -509,7 +509,7 @@ int cmCTestTestHandler::ProcessHandler() if ( val ) { this->UseExcludeLabelRegExpFlag = true; - this->ExcludeLabelRegularExpression = val; + this->ExcludeLabelRegExp = val; } val = this->GetOption("IncludeRegularExpression"); if ( val ) @@ -1558,7 +1558,7 @@ void cmCTestTestHandler::GetListOfTests() this->IncludeLabelRegularExpression. compile(this->IncludeLabelRegExp.c_str()); } - if ( !this->IncludeLabelRegExp.empty() ) + if ( !this->ExcludeLabelRegExp.empty() ) { this->ExcludeLabelRegularExpression. compile(this->ExcludeLabelRegExp.c_str()); diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index a9d4d98..54f2151 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -83,7 +83,7 @@ void CMakeMessageHandler(const char* message, const char* title, bool&, int main(int argc, char const* const* argv) { - setlocale(LC_ALL, ""); + setlocale(LC_CTYPE, ""); cmsys::Encoding::CommandLineArguments encoding_args = cmsys::Encoding::CommandLineArguments::Main(argc, argv); diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index a7f6b49..64b67c9 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -137,7 +137,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) this->Makefile->GetHomeOutputDirectory())) { cmOStringStream msg; - cmListFileBacktrace bt; + cmListFileBacktrace bt(this->Makefile->GetLocalGenerator()); cmListFileContext lfc; lfc.FilePath = this->FileName; lfc.Line = this->FileLine; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index ea8536f..0ce04a5 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1811,7 +1811,7 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath) } } - is_shared_library = this->ExtractSharedLibraryName.find(file.c_str()); + is_shared_library = this->ExtractSharedLibraryName.find(file); if(!is_shared_library) { @@ -1831,8 +1831,8 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath) { if(fullPath.find(".framework") != std::string::npos) { - cmsys::RegularExpression splitFramework; - splitFramework.compile("^(.*)/(.*).framework/(.*)$"); + static cmsys::RegularExpression + splitFramework("^(.*)/(.*).framework/(.*)$"); if(splitFramework.find(fullPath) && (std::string::npos != splitFramework.match(3).find(splitFramework.match(2)))) diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index eb62455..f28217f 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -386,15 +386,17 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, e << "The dependency target \"" << dependee_name << "\" of target \"" << depender->GetName() << "\" does not exist."; - cmListFileBacktrace nullBacktrace; cmListFileBacktrace const* backtrace = depender->GetUtilityBacktrace(dependee_name); - if(!backtrace) + if(backtrace) { - backtrace = &nullBacktrace; + cm->IssueMessage(messageType, e.str(), *backtrace); + } + else + { + cm->IssueMessage(messageType, e.str()); } - cm->IssueMessage(messageType, e.str(), *backtrace); } } diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index ac2eef8..c161eb6 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -17,6 +17,7 @@ //---------------------------------------------------------------------------- cmCustomCommand::cmCustomCommand() + : Backtrace(NULL) { this->HaveComment = false; this->EscapeOldStyle = true; @@ -33,7 +34,7 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r): WorkingDirectory(r.WorkingDirectory), EscapeAllowMakeVars(r.EscapeAllowMakeVars), EscapeOldStyle(r.EscapeOldStyle), - Backtrace(new cmListFileBacktrace(*r.Backtrace)) + Backtrace(r.Backtrace) { } @@ -54,11 +55,7 @@ cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r) this->EscapeAllowMakeVars = r.EscapeAllowMakeVars; this->EscapeOldStyle = r.EscapeOldStyle; this->ImplicitDepends = r.ImplicitDepends; - - cmsys::auto_ptr<cmListFileBacktrace> - newBacktrace(new cmListFileBacktrace(*r.Backtrace)); - delete this->Backtrace; - this->Backtrace = newBacktrace.release(); + this->Backtrace = r.Backtrace; return *this; } @@ -78,20 +75,19 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf, WorkingDirectory(workingDirectory?workingDirectory:""), EscapeAllowMakeVars(false), EscapeOldStyle(true), - Backtrace(new cmListFileBacktrace) + Backtrace(NULL) { this->EscapeOldStyle = true; this->EscapeAllowMakeVars = false; if(mf) { - mf->GetBacktrace(*this->Backtrace); + this->Backtrace = mf->GetBacktrace(); } } //---------------------------------------------------------------------------- cmCustomCommand::~cmCustomCommand() { - delete this->Backtrace; } //---------------------------------------------------------------------------- @@ -166,7 +162,7 @@ void cmCustomCommand::SetEscapeAllowMakeVars(bool b) //---------------------------------------------------------------------------- cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const { - return *this->Backtrace; + return this->Backtrace; } //---------------------------------------------------------------------------- diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index b5d7e62..21dbefb 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -13,8 +13,8 @@ #define cmCustomCommand_h #include "cmStandardIncludes.h" +#include "cmListFileCache.h" class cmMakefile; -class cmListFileBacktrace; /** \class cmCustomCommand * \brief A class to encapsulate a custom command @@ -88,7 +88,7 @@ private: std::string WorkingDirectory; bool EscapeAllowMakeVars; bool EscapeOldStyle; - cmListFileBacktrace* Backtrace; + cmListFileBacktrace Backtrace; ImplicitDependsList ImplicitDepends; }; diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index ebfbf7c..1bca6e6 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -21,7 +21,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( cmCustomCommand const& cc, const std::string& config, cmMakefile* mf): CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()), OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), - GE(new cmGeneratorExpression(cc.GetBacktrace())), DependsDone(false) + GE(new cmGeneratorExpression(&cc.GetBacktrace())), DependsDone(false) { } diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index babf1c4..5515f35 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -15,7 +15,8 @@ cmDefinitions::Def cmDefinitions::NoDef; //---------------------------------------------------------------------------- -cmDefinitions::cmDefinitions(cmDefinitions* parent): Up(parent) +cmDefinitions::cmDefinitions(cmDefinitions* parent) + : Up(parent) { } @@ -28,18 +29,17 @@ void cmDefinitions::Reset(cmDefinitions* parent) //---------------------------------------------------------------------------- cmDefinitions::Def const& -cmDefinitions::GetInternal(const std::string& key) +cmDefinitions::GetInternal(const std::string& key) const { MapType::const_iterator i = this->Map.find(key); if(i != this->Map.end()) { return i->second; } - else if(cmDefinitions* up = this->Up) + if(cmDefinitions* up = this->Up) { - // Query the parent scope and store the result locally. - Def def = up->GetInternal(key); - return this->Map.insert(MapType::value_type(key, def)).first->second; + // Query the parent scope. + return up->GetInternal(key); } return this->NoDef; } @@ -51,16 +51,7 @@ cmDefinitions::SetInternal(const std::string& key, Def const& def) if(this->Up || def.Exists) { // In lower scopes we store keys, defined or not. - MapType::iterator i = this->Map.find(key); - if(i == this->Map.end()) - { - i = this->Map.insert(MapType::value_type(key, def)).first; - } - else - { - i->second = def; - } - return i->second; + return (this->Map[key] = def); } else { @@ -71,13 +62,26 @@ cmDefinitions::SetInternal(const std::string& key, Def const& def) } //---------------------------------------------------------------------------- -const char* cmDefinitions::Get(const std::string& key) +const char* cmDefinitions::Get(const std::string& key) const { Def const& def = this->GetInternal(key); return def.Exists? def.c_str() : 0; } //---------------------------------------------------------------------------- +void cmDefinitions::Pull(const std::string& key) +{ + if (this->Up) + { + Def const& def = this->Up->GetInternal(key); + if (def.Exists) + { + this->SetInternal(key, def); + } + } +} + +//---------------------------------------------------------------------------- const char* cmDefinitions::Set(const std::string& key, const char* value) { Def const& def = this->SetInternal(key, Def(value)); diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index d615fb0..5209a8b 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -13,6 +13,9 @@ #define cmDefinitions_h #include "cmStandardIncludes.h" +#if defined(CMAKE_BUILD_WITH_CMAKE) +#include "cmsys/hash_map.hxx" +#endif /** \class cmDefinitions * \brief Store a scope of variable definitions for CMake language. @@ -33,9 +36,11 @@ public: /** Returns the parent scope, if any. */ cmDefinitions* GetParent() const { return this->Up; } - /** Get the value associated with a key; null if none. - Store the result locally if it came from a parent. */ - const char* Get(const std::string& key); + /** Get the value associated with a key; null if none. */ + const char* Get(const std::string& key) const; + + /** Pull a variable from the parent. */ + void Pull(const std::string& key); /** Set (or unset if null) a value associated with a key. */ const char* Set(const std::string& key, const char* value); @@ -69,11 +74,15 @@ private: cmDefinitions* Up; // Local definitions, set or unset. +#if defined(CMAKE_BUILD_WITH_CMAKE) + typedef cmsys::hash_map<std::string, Def> MapType; +#else typedef std::map<std::string, Def> MapType; +#endif MapType Map; // Internal query and update methods. - Def const& GetInternal(const std::string& key); + Def const& GetInternal(const std::string& key) const; Def const& SetInternal(const std::string& key, Def const& def); // Implementation of Closure() method. diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 6c8ebb6..30a52d4 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -18,6 +18,7 @@ //---------------------------------------------------------------------------- cmExportBuildFileGenerator::cmExportBuildFileGenerator() + : Backtrace(NULL) { this->Makefile = 0; this->ExportSet = 0; diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h index c1bdb5b..8b5694c 100644 --- a/Source/cmExportBuildFileGenerator.h +++ b/Source/cmExportBuildFileGenerator.h @@ -45,7 +45,7 @@ public: void SetMakefile(cmMakefile *mf) { this->Makefile = mf; - this->Makefile->GetBacktrace(this->Backtrace); + this->Backtrace = this->Makefile->GetBacktrace(); } protected: diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 2db4086..9f5eee5 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -377,8 +377,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( const char *propName = "INTERFACE_INCLUDE_DIRECTORIES"; const char *input = target->GetProperty(propName); - cmListFileBacktrace lfbt; - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; std::string dirs = cmGeneratorExpression::Preprocess( tei->InterfaceIncludeDirectories, diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index 3350d7c..eb8d193 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -57,10 +57,9 @@ std::string cmExportTryCompileFileGenerator::FindTargets( return std::string(); } - cmListFileBacktrace lfbt; - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; - cmGeneratorExpressionDAGChecker dagChecker(lfbt, + cmGeneratorExpressionDAGChecker dagChecker( tgt->GetName(), propName, 0, 0); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 4ee34df..655f3ba 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3270,14 +3270,13 @@ void cmFileCommand::AddEvaluationFile(const std::string &inputName, bool inputIsContent ) { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression outputGe(lfbt); + cmGeneratorExpression outputGe(&lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> outputCge = outputGe.Parse(outputExpr); - cmGeneratorExpression conditionGe(lfbt); + cmGeneratorExpression conditionGe(&lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> conditionCge = conditionGe.Parse(condition); diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index d53bdd7..2b4d955 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -24,7 +24,7 @@ //---------------------------------------------------------------------------- cmGeneratorExpression::cmGeneratorExpression( - cmListFileBacktrace const& backtrace): + cmListFileBacktrace const* backtrace): Backtrace(backtrace) { } @@ -33,10 +33,18 @@ cmGeneratorExpression::cmGeneratorExpression( cmsys::auto_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(std::string const& input) { +#if !defined(__BORLANDC__) return cmsys::auto_ptr<cmCompiledGeneratorExpression>( - new cmCompiledGeneratorExpression( - this->Backtrace, - input)); + new cmCompiledGeneratorExpression( + this->Backtrace ? *this->Backtrace : cmListFileBacktrace(NULL), + input)); +#else + cmListFileBacktrace emptyBacktrace(NULL); + return cmsys::auto_ptr<cmCompiledGeneratorExpression>( + new cmCompiledGeneratorExpression( + this->Backtrace ? *this->Backtrace : emptyBacktrace, + input)); +#endif } //---------------------------------------------------------------------------- @@ -461,12 +469,11 @@ std::string::size_type cmGeneratorExpression::Find(const std::string &input) //---------------------------------------------------------------------------- bool cmGeneratorExpression::IsValidTargetName(const std::string &input) { - cmsys::RegularExpression targetNameValidator; // The ':' is supported to allow use with IMPORTED targets. At least // Qt 4 and 5 IMPORTED targets use ':' as the namespace delimiter. - targetNameValidator.compile("^[A-Za-z0-9_.:+-]+$"); + static cmsys::RegularExpression targetNameValidator("^[A-Za-z0-9_.:+-]+$"); - return targetNameValidator.find(input.c_str()); + return targetNameValidator.find(input); } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index ef5360e..324d23c 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -41,7 +41,7 @@ class cmGeneratorExpression { public: /** Construct. */ - cmGeneratorExpression(cmListFileBacktrace const& backtrace); + cmGeneratorExpression(cmListFileBacktrace const* backtrace = NULL); ~cmGeneratorExpression(); cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse( @@ -70,7 +70,7 @@ private: cmGeneratorExpression(const cmGeneratorExpression &); void operator=(const cmGeneratorExpression &); - cmListFileBacktrace const& Backtrace; + cmListFileBacktrace const* Backtrace; }; class cmCompiledGeneratorExpression diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index 7f8e694..75a84cb 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -24,6 +24,25 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( : Parent(parent), Target(target), Property(property), Content(content), Backtrace(backtrace), TransitivePropertiesOnly(false) { + Initialize(); +} + +//---------------------------------------------------------------------------- +cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( + const std::string &target, + const std::string &property, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *parent) + : Parent(parent), Target(target), Property(property), + Content(content), Backtrace(NULL), TransitivePropertiesOnly(false) +{ + Initialize(); +} + +//---------------------------------------------------------------------------- +void +cmGeneratorExpressionDAGChecker::Initialize() +{ const cmGeneratorExpressionDAGChecker *top = this; const cmGeneratorExpressionDAGChecker *p = this->Parent; while (p) @@ -43,11 +62,12 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( #undef TEST_TRANSITIVE_PROPERTY_METHOD { std::map<std::string, std::set<std::string> >::const_iterator it - = top->Seen.find(target); + = top->Seen.find(this->Target); if (it != top->Seen.end()) { const std::set<std::string> &propSet = it->second; - const std::set<std::string>::const_iterator i = propSet.find(property); + const std::set<std::string>::const_iterator i + = propSet.find(this->Property); if (i != propSet.end()) { this->CheckResult = ALREADY_SEEN; @@ -55,7 +75,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( } } const_cast<cmGeneratorExpressionDAGChecker *>(top) - ->Seen[target].insert(property); + ->Seen[this->Target].insert(this->Property); } } diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h index 7217a56..10f9fa7 100644 --- a/Source/cmGeneratorExpressionDAGChecker.h +++ b/Source/cmGeneratorExpressionDAGChecker.h @@ -46,6 +46,10 @@ struct cmGeneratorExpressionDAGChecker const std::string &property, const GeneratorExpressionContent *content, cmGeneratorExpressionDAGChecker *parent); + cmGeneratorExpressionDAGChecker(const std::string &target, + const std::string &property, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *parent); enum Result { DAG, @@ -76,6 +80,7 @@ struct cmGeneratorExpressionDAGChecker private: Result CheckGraph() const; + void Initialize(); private: const cmGeneratorExpressionDAGChecker * const Parent; diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 01d31d3..f9067cf 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -115,7 +115,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() } cmListFileBacktrace lfbt = this->OutputFileExpr->GetBacktrace(); - cmGeneratorExpression contentGE(lfbt); + cmGeneratorExpression contentGE(&lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> inputExpression = contentGE.Parse(inputContent); diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index a15e3ff..7dcb335 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -401,9 +401,8 @@ struct CompilerIdNode : public cmGeneratorExpressionNode { return compilerId ? compilerId : ""; } - cmsys::RegularExpression compilerIdValidator; - compilerIdValidator.compile("^[A-Za-z0-9_]*$"); - if (!compilerIdValidator.find(parameters.begin()->c_str())) + static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$"); + if (!compilerIdValidator.find(*parameters.begin())) { reportError(context, content->GetOriginalExpression(), "Expression syntax not recognized."); @@ -509,9 +508,8 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode return compilerVersion ? compilerVersion : ""; } - cmsys::RegularExpression compilerIdValidator; - compilerIdValidator.compile("^[0-9\\.]*$"); - if (!compilerIdValidator.find(parameters.begin()->c_str())) + static cmsys::RegularExpression compilerIdValidator("^[0-9\\.]*$"); + if (!compilerIdValidator.find(*parameters.begin())) { reportError(context, content->GetOriginalExpression(), "Expression syntax not recognized."); @@ -711,9 +709,8 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode { return configurationNode.Evaluate(parameters, context, content, 0); } - cmsys::RegularExpression configValidator; - configValidator.compile("^[A-Za-z0-9_]*$"); - if (!configValidator.find(parameters.begin()->c_str())) + static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$"); + if (!configValidator.find(*parameters.begin())) { reportError(context, content->GetOriginalExpression(), "Expression syntax not recognized."); @@ -809,7 +806,7 @@ std::string getLinkedTargetsContent(const std::vector<cmTarget*> &targets, cmGeneratorExpressionDAGChecker *dagChecker, const std::string &interfacePropertyName) { - cmGeneratorExpression ge(context->Backtrace); + cmGeneratorExpression ge(&context->Backtrace); std::string sep; std::string depString; @@ -884,8 +881,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode "$<TARGET_PROPERTY:...> expression requires one or two parameters"); return std::string(); } - cmsys::RegularExpression propertyNameValidator; - propertyNameValidator.compile("^[A-Za-z0-9_]+$"); + static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); cmTarget const* target = context->HeadTarget; std::string propertyName = *parameters.begin(); @@ -973,7 +969,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode return std::string(); } - if (!propertyNameValidator.find(propertyName.c_str())) + if (!propertyNameValidator.find(propertyName)) { ::reportError(context, content->GetOriginalExpression(), "Property name not supported."); @@ -1196,7 +1192,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode { if (targetPropertyTransitiveWhitelist[i] == interfacePropertyName) { - cmGeneratorExpression ge(context->Backtrace); + cmGeneratorExpression ge(&context->Backtrace); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); std::string result = cge->Evaluate(context->Makefile, context->Config, diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index eb76d7f..0ffb860 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -22,6 +22,11 @@ class cmTarget; //---------------------------------------------------------------------------- struct cmGeneratorExpressionContext { + cmGeneratorExpressionContext() + : Backtrace(NULL) + { + } + cmListFileBacktrace Backtrace; std::set<cmTarget*> DependTargets; std::set<cmTarget const*> AllTargets; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 153c611..a7576ed 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -259,12 +259,10 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt, std::vector<std::string>& result, bool excludeImported) { - cmListFileBacktrace lfbt; - if (const char* dirs = depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES")) { - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; cmSystemTools::ExpandListArgument(ge.Parse(dirs) ->Evaluate(mf, config, false, headTarget, @@ -278,7 +276,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt, if (const char* dirs = depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")) { - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; cmSystemTools::ExpandListArgument(ge.Parse(dirs) ->Evaluate(mf, config, false, headTarget, @@ -457,8 +455,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, return false; } - cmListFileBacktrace lfbt; - cmGeneratorExpressionDAGChecker dagChecker(lfbt, + cmGeneratorExpressionDAGChecker dagChecker( this->GetName(), "SYSTEM_INCLUDE_DIRECTORIES", 0, 0); @@ -470,7 +467,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, it = this->Target->GetSystemIncludeDirectories().begin(); it != this->Target->GetSystemIncludeDirectories().end(); ++it) { - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; cmSystemTools::ExpandListArgument(ge.Parse(*it) ->Evaluate(this->Makefile, config, false, this->Target, @@ -808,7 +805,7 @@ cmTargetTraceDependencies { // Transform command names that reference targets built in this // project to corresponding target-level dependencies. - cmGeneratorExpression ge(cc.GetBacktrace()); + cmGeneratorExpression ge(&cc.GetBacktrace()); // Add target-level dependencies referenced by generator expressions. std::set<cmTarget*> targets; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index bb818eb..6c8be72 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1282,8 +1282,7 @@ void cmGlobalGenerator::Generate() if(!this->GenerateCPackPropertiesFile()) { this->GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, "Could not write CPack properties file.", - cmListFileBacktrace()); + cmake::FATAL_ERROR, "Could not write CPack properties file."); } for (std::map<std::string, cmExportBuildFileGenerator*>::iterator @@ -1294,8 +1293,7 @@ void cmGlobalGenerator::Generate() && !cmSystemTools::GetErrorOccuredFlag()) { this->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, "Could not write export file.", - cmListFileBacktrace()); + ->IssueMessage(cmake::FATAL_ERROR, "Could not write export file."); return; } } @@ -1324,8 +1322,7 @@ void cmGlobalGenerator::Generate() { w << " " << *iter << "\n"; } - this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str(), - cmListFileBacktrace()); + this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } this->CMakeInstance->UpdateProgress("Generating done", -1); @@ -1525,8 +1522,7 @@ cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) const if(ti == this->GeneratorTargets.end()) { this->CMakeInstance->IssueMessage( - cmake::INTERNAL_ERROR, "Missing cmGeneratorTarget instance!", - cmListFileBacktrace()); + cmake::INTERNAL_ERROR, "Missing cmGeneratorTarget instance!"); return 0; } return ti->second; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 86d0de3..a6d1c31 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -48,17 +48,19 @@ public: const char* p = cmVS10GenName(name, genName); if(!p) { return 0; } - if(strcmp(p, "") == 0) + if(!*p) { return new cmGlobalVisualStudio10Generator( genName, "", ""); } - if(strcmp(p, " Win64") == 0) + if(*p++ != ' ') + { return 0; } + if(strcmp(p, "Win64") == 0) { return new cmGlobalVisualStudio10Generator( genName, "x64", "CMAKE_FORCE_WIN64"); } - if(strcmp(p, " IA64") == 0) + if(strcmp(p, "IA64") == 0) { return new cmGlobalVisualStudio10Generator( genName, "Itanium", "CMAKE_FORCE_IA64"); diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 7033f2a..fa134fc 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -43,27 +43,24 @@ public: const char* p = cmVS11GenName(name, genName); if(!p) { return 0; } - if(strcmp(p, "") == 0) + if(!*p) { return new cmGlobalVisualStudio11Generator( genName, "", ""); } - if(strcmp(p, " Win64") == 0) + if(*p++ != ' ') + { return 0; } + if(strcmp(p, "Win64") == 0) { return new cmGlobalVisualStudio11Generator( genName, "x64", "CMAKE_FORCE_WIN64"); } - if(strcmp(p, " ARM") == 0) + if(strcmp(p, "ARM") == 0) { return new cmGlobalVisualStudio11Generator( genName, "ARM", ""); } - if(*p++ != ' ') - { - return 0; - } - std::set<std::string> installedSDKs = cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs(); diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 40f8b05..698624d 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -43,17 +43,19 @@ public: const char* p = cmVS12GenName(name, genName); if(!p) { return 0; } - if(strcmp(p, "") == 0) + if(!*p) { return new cmGlobalVisualStudio12Generator( genName, "", ""); } - if(strcmp(p, " Win64") == 0) + if(*p++ != ' ') + { return 0; } + if(strcmp(p, "Win64") == 0) { return new cmGlobalVisualStudio12Generator( genName, "x64", "CMAKE_FORCE_WIN64"); } - if(strcmp(p, " ARM") == 0) + if(strcmp(p, "ARM") == 0) { return new cmGlobalVisualStudio12Generator( genName, "ARM", ""); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 87ccfbd..29a5955 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2440,8 +2440,8 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) } else { - const char* theConfig = - this->CurrentMakefile->GetDefinition("CMAKE_BUILD_TYPE"); + std::string theConfig = + this->CurrentMakefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); cmXCodeObject* buildSettings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); this->CreateBuildSettings(cmtarget, buildSettings, theConfig); @@ -2819,11 +2819,7 @@ void cmGlobalXCodeGenerator i != this->CurrentConfigurationTypes.end(); ++i) { // Get the current configuration name. - const char* configName = i->c_str(); - if(!*configName) - { - configName = 0; - } + std::string configName = *i; if(this->XcodeVersion >= 50) { @@ -3510,11 +3506,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( ct = this->CurrentConfigurationTypes.begin(); ct != this->CurrentConfigurationTypes.end(); ++ct) { - const char* configName = 0; - if(!ct->empty()) - { - configName = ct->c_str(); - } + std::string configName = *ct; for(std::vector<cmXCodeObject*>::iterator i = targets.begin(); i != targets.end(); ++i) { @@ -3967,7 +3959,7 @@ bool cmGlobalXCodeGenerator::IsMultiConfig() void cmGlobalXCodeGenerator ::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const { - const char* configName = this->GetCMakeCFGIntDir(); + std::string configName = this->GetCMakeCFGIntDir(); std::string dir = this->GetObjectsNormalDirectory( "$(PROJECT_NAME)", configName, gt->Target); if(this->XcodeVersion >= 21) diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 6594218..b2be82e 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -12,6 +12,7 @@ #include "cmInstallFilesGenerator.h" #include "cmGeneratorExpression.h" +#include "cmMakefile.h" #include "cmSystemTools.h" //---------------------------------------------------------------------------- @@ -84,8 +85,7 @@ void cmInstallFilesGenerator::GenerateScriptForConfig(std::ostream& os, Indent const& indent) { std::vector<std::string> files; - cmListFileBacktrace lfbt; - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; for(std::vector<std::string>::const_iterator i = this->Files.begin(); i != this->Files.end(); ++i) { diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx index 7e78ec0..7813fcc 100644 --- a/Source/cmInstalledFile.cxx +++ b/Source/cmInstalledFile.cxx @@ -32,9 +32,8 @@ cmInstalledFile::~cmInstalledFile() //---------------------------------------------------------------------------- void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name) { - cmListFileBacktrace backtrace; - mf->GetBacktrace(backtrace); - cmGeneratorExpression ge(backtrace); + cmListFileBacktrace backtrace = mf->GetBacktrace(); + cmGeneratorExpression ge(&backtrace); this->Name = name; this->NameExpression = ge.Parse(name).release(); @@ -70,9 +69,8 @@ void cmInstalledFile::SetProperty(cmMakefile const* mf, void cmInstalledFile::AppendProperty(cmMakefile const* mf, const std::string& prop, const char* value, bool /*asString*/) { - cmListFileBacktrace backtrace; - mf->GetBacktrace(backtrace); - cmGeneratorExpression ge(backtrace); + cmListFileBacktrace backtrace = mf->GetBacktrace(); + cmGeneratorExpression ge(&backtrace); Property& property = this->Properties[prop]; property.ValueExpressions.push_back(ge.Parse(value).release()); diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 34781d3..3fc5b69 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -12,6 +12,7 @@ #include "cmListFileCache.h" #include "cmListFileLexer.h" +#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmVersion.h" @@ -141,7 +142,8 @@ bool cmListFile::ParseFile(const char* filename, bool topLevel, cmMakefile *mf) { - if(!cmSystemTools::FileExists(filename)) + if(!cmSystemTools::FileExists(filename) || + cmSystemTools::FileIsDirectory(filename)) { return false; } @@ -408,6 +410,23 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, } //---------------------------------------------------------------------------- +void cmListFileBacktrace::MakeRelative() +{ + if (this->Relative) + { + return; + } + for (cmListFileBacktrace::iterator i = this->begin(); + i != this->end(); ++i) + { + i->FilePath = this->LocalGenerator->Convert(i->FilePath, + cmLocalGenerator::HOME); + } + this->Relative = true; +} + + +//---------------------------------------------------------------------------- std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc) { os << lfc.FilePath; diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index bede25e..2ca9b8e 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -14,6 +14,8 @@ #include "cmStandardIncludes.h" +class cmLocalGenerator; + /** \class cmListFileCache * \brief A class to cache list file contents. * @@ -66,7 +68,20 @@ struct cmListFileFunction: public cmListFileContext std::vector<cmListFileArgument> Arguments; }; -class cmListFileBacktrace: public std::vector<cmListFileContext> {}; +class cmListFileBacktrace: public std::vector<cmListFileContext> +{ + public: + cmListFileBacktrace(cmLocalGenerator* localGen) + : LocalGenerator(localGen) + , Relative(localGen ? false : true) + { + } + + void MakeRelative(); + private: + cmLocalGenerator* LocalGenerator; + bool Relative; +}; struct cmListFile { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 543d58d..c8c8c79 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -875,6 +875,13 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, return replaceValues.ObjectDir; } } + if(replaceValues.ObjectFileDir) + { + if(variable == "OBJECT_FILE_DIR") + { + return replaceValues.ObjectFileDir; + } + } if(replaceValues.Objects) { if(variable == "OBJECTS") diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 32da21b..ad73073 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -269,6 +269,7 @@ public: const char* Output; const char* Object; const char* ObjectDir; + const char* ObjectFileDir; const char* Flags; const char* ObjectsQuoted; const char* SONameFlag; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 2620471..412c998 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -310,14 +310,19 @@ void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text) const { // Collect context information. - cmListFileBacktrace backtrace; + cmLocalGenerator* localGen = this->GetLocalGenerator(); + if(this->CallStack.empty() && this->GetCMakeInstance()->GetIsInTryCompile()) + { + localGen = 0; + } + cmListFileBacktrace backtrace(localGen); if(!this->CallStack.empty()) { if((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) { this->CallStack.back().Status->SetNestedError(true); } - this->GetBacktrace(backtrace); + backtrace = this->GetBacktrace(); } else { @@ -335,11 +340,6 @@ void cmMakefile::IssueMessage(cmake::MessageType t, lfc.FilePath = this->ListFileStack.back(); } lfc.Line = 0; - if(!this->GetCMakeInstance()->GetIsInTryCompile()) - { - lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, - cmLocalGenerator::HOME); - } backtrace.push_back(lfc); } @@ -348,21 +348,15 @@ void cmMakefile::IssueMessage(cmake::MessageType t, } //---------------------------------------------------------------------------- -bool cmMakefile::GetBacktrace(cmListFileBacktrace& backtrace) const +cmListFileBacktrace cmMakefile::GetBacktrace() const { - if(this->CallStack.empty()) - { - return false; - } + cmListFileBacktrace backtrace(this->GetLocalGenerator()); for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); i != this->CallStack.rend(); ++i) { - cmListFileContext lfc = *(*i).Context; - lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, - cmLocalGenerator::HOME); - backtrace.push_back(lfc); + backtrace.push_back(*i->Context); } - return true; + return backtrace; } //---------------------------------------------------------------------------- @@ -1745,8 +1739,7 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs, before ? this->IncludeDirectoriesEntries.begin() : this->IncludeDirectoriesEntries.end(); - cmListFileBacktrace lfbt; - this->GetBacktrace(lfbt); + cmListFileBacktrace lfbt = this->GetBacktrace(); cmValueWithOrigin entry(incString, lfbt); this->IncludeDirectoriesEntries.insert(position, entry); @@ -1923,7 +1916,7 @@ void cmMakefile::CheckForUnused(const char* reason, if (this->WarnUnused && !this->VariableUsed(name)) { std::string path; - cmListFileBacktrace bt; + cmListFileBacktrace bt(this->GetLocalGenerator()); if (this->CallStack.size()) { const cmListFileContext* file = this->CallStack.back().Context; @@ -2874,7 +2867,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( this->GetHomeOutputDirectory())) { cmOStringStream msg; - cmListFileBacktrace bt; + cmListFileBacktrace bt(this->GetLocalGenerator()); cmListFileContext lfc; lfc.FilePath = filename; lfc.Line = line; @@ -4013,8 +4006,7 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) { return; } - cmListFileBacktrace lfbt; - this->GetBacktrace(lfbt); + cmListFileBacktrace lfbt = this->GetBacktrace(); this->IncludeDirectoriesEntries.push_back( cmValueWithOrigin(value, lfbt)); return; @@ -4026,8 +4018,7 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) { return; } - cmListFileBacktrace lfbt; - this->GetBacktrace(lfbt); + cmListFileBacktrace lfbt = this->GetBacktrace(); this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt)); return; } @@ -4038,8 +4029,7 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) { return; } - cmListFileBacktrace lfbt; - this->GetBacktrace(lfbt); + cmListFileBacktrace lfbt = this->GetBacktrace(); cmValueWithOrigin entry(value, lfbt); this->CompileDefinitionsEntries.push_back(entry); return; @@ -4070,24 +4060,21 @@ void cmMakefile::AppendProperty(const std::string& prop, { if (prop == "INCLUDE_DIRECTORIES") { - cmListFileBacktrace lfbt; - this->GetBacktrace(lfbt); + cmListFileBacktrace lfbt = this->GetBacktrace(); this->IncludeDirectoriesEntries.push_back( cmValueWithOrigin(value, lfbt)); return; } if (prop == "COMPILE_OPTIONS") { - cmListFileBacktrace lfbt; - this->GetBacktrace(lfbt); + cmListFileBacktrace lfbt = this->GetBacktrace(); this->CompileOptionsEntries.push_back( cmValueWithOrigin(value, lfbt)); return; } if (prop == "COMPILE_DEFINITIONS") { - cmListFileBacktrace lfbt; - this->GetBacktrace(lfbt); + cmListFileBacktrace lfbt = this->GetBacktrace(); this->CompileDefinitionsEntries.push_back( cmValueWithOrigin(value, lfbt)); return; @@ -4435,7 +4422,7 @@ void cmMakefile::RaiseScope(const std::string& var, const char *varDef) if(cmDefinitions* up = cur.GetParent()) { // First localize the definition in the current scope. - cur.Get(var); + cur.Pull(var); // Now update the definition in the parent scope. up->Set(var, varDef); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index e3b83af..d5ffd98 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -655,7 +655,7 @@ public: /** * Get the current context backtrace. */ - bool GetBacktrace(cmListFileBacktrace& backtrace) const; + cmListFileBacktrace GetBacktrace() const; /** * Get the vector of files created by this makefile diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index a08d731..403f6e6 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -137,8 +137,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() this->Makefile->GetProperty ("ADDITIONAL_MAKE_CLEAN_FILES")) { - cmListFileBacktrace lfbt; - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(additional_clean_files); @@ -684,6 +683,11 @@ cmMakefileTargetGenerator cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); vars.ObjectDir = objectDir.c_str(); + std::string objectFileDir = cmSystemTools::GetFilenamePath(obj); + objectFileDir = this->Convert(objectFileDir, + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); + vars.ObjectFileDir = objectFileDir.c_str(); vars.Flags = flags.c_str(); std::string definesString = "$("; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index c3b4c75..24689fb 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -385,6 +385,7 @@ cmNinjaTargetGenerator vars.TargetPDB = "$TARGET_PDB"; vars.TargetCompilePDB = "$TARGET_COMPILE_PDB"; vars.ObjectDir = "$OBJECT_DIR"; + vars.ObjectFileDir = "$OBJECT_FILE_DIR"; cmMakefile* mf = this->GetMakefile(); @@ -623,6 +624,10 @@ cmNinjaTargetGenerator vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat( ConvertToNinjaPath(objectDir.c_str()), cmLocalGenerator::SHELL); + std::string objectFileDir = cmSystemTools::GetFilenamePath(objectFileName); + vars["OBJECT_FILE_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat( + ConvertToNinjaPath(objectFileDir.c_str()), + cmLocalGenerator::SHELL); this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetTarget(), vars); @@ -651,6 +656,7 @@ cmNinjaTargetGenerator compileObjectVars.Source = escapedSourceFileName.c_str(); compileObjectVars.Object = objectFileName.c_str(); compileObjectVars.ObjectDir = objectDir.c_str(); + compileObjectVars.ObjectFileDir = objectFileDir.c_str(); compileObjectVars.Flags = vars["FLAGS"].c_str(); compileObjectVars.Defines = vars["DEFINES"].c_str(); diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index ec671fc..71a3497 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -39,8 +39,8 @@ public: if(file.rfind(".framework") != std::string::npos) { - cmsys::RegularExpression splitFramework; - splitFramework.compile("^(.*)/(.*).framework/(.*)$"); + static cmsys::RegularExpression + splitFramework("^(.*)/(.*).framework/(.*)$"); if(splitFramework.find(file) && (std::string::npos != splitFramework.match(3).find(splitFramework.match(2)))) @@ -326,8 +326,8 @@ void cmOrderDirectories::AddRuntimeLibrary(std::string const& fullPath, if(fullPath.rfind(".framework") != std::string::npos) { - cmsys::RegularExpression splitFramework; - splitFramework.compile("^(.*)/(.*).framework/(.*)$"); + static cmsys::RegularExpression + splitFramework("^(.*)/(.*).framework/(.*)$"); if(splitFramework.find(fullPath) && (std::string::npos != splitFramework.match(3).find(splitFramework.match(2)))) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 15acfdd..01edde9 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -87,10 +87,12 @@ class cmTargetInternals { public: cmTargetInternals() + : Backtrace(NULL) { this->PolicyWarnedCMP0022 = false; } cmTargetInternals(cmTargetInternals const&) + : Backtrace(NULL) { this->PolicyWarnedCMP0022 = false; } @@ -366,7 +368,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) } // Save the backtrace of target construction. - this->Makefile->GetBacktrace(this->Internal->Backtrace); + this->Internal->Backtrace = this->Makefile->GetBacktrace(); if (!this->IsImported()) { @@ -443,7 +445,7 @@ void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile) { if(this->Utilities.insert(u).second && makefile) { - makefile->GetBacktrace(UtilityBacktraces[u]); + UtilityBacktraces.insert(std::make_pair(u, makefile->GetBacktrace())); } } @@ -710,11 +712,8 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, this->DebugSourcesDone = true; } - cmListFileBacktrace lfbt; - - cmGeneratorExpressionDAGChecker dagChecker(lfbt, - this->GetName(), - "SOURCES", 0, 0); + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), + "SOURCES", 0, 0); std::set<std::string> uniqueSrcs; bool contextDependentDirectSources = processSources(this, @@ -739,7 +738,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, continue; } { - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(it->Value); std::string targetResult = cge->Evaluate(this->Makefile, config, @@ -758,7 +757,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, // TARGET_PROPERTY expression. sourceGenex = "$<$<BOOL:" + it->Value + ">:" + sourceGenex + ">"; } - cmGeneratorExpression ge(it->Backtrace); + cmGeneratorExpression ge(&it->Backtrace); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse( sourceGenex); @@ -910,9 +909,8 @@ void cmTarget::AddTracedSources(std::vector<std::string> const& srcs) { this->Internal->SourceFilesMap.clear(); this->LinkImplementationLanguageIsContextDependent = true; - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(&lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); cge->SetEvaluateForBuildsystem(true); this->Internal->SourceEntries.push_back( @@ -948,9 +946,8 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs) { this->Internal->SourceFilesMap.clear(); this->LinkImplementationLanguageIsContextDependent = true; - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(&lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); cge->SetEvaluateForBuildsystem(true); this->Internal->SourceEntries.push_back( @@ -1084,9 +1081,8 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) { this->Internal->SourceFilesMap.clear(); this->LinkImplementationLanguageIsContextDependent = true; - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(&lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); cge->SetEvaluateForBuildsystem(true); this->Internal->SourceEntries.push_back( @@ -1206,11 +1202,10 @@ void cmTarget::GetDirectLinkLibraries(const std::string& config, const char *prop = this->GetProperty("LINK_LIBRARIES"); if (prop) { - cmListFileBacktrace lfbt; - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); - cmGeneratorExpressionDAGChecker dagChecker(lfbt, + cmGeneratorExpressionDAGChecker dagChecker( this->GetName(), "LINK_LIBRARIES", 0, 0); cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, @@ -1241,11 +1236,10 @@ void cmTarget::GetInterfaceLinkLibraries(const std::string& config, const char *prop = this->GetProperty("INTERFACE_LINK_LIBRARIES"); if (prop) { - cmListFileBacktrace lfbt; - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); - cmGeneratorExpressionDAGChecker dagChecker(lfbt, + cmGeneratorExpressionDAGChecker dagChecker( this->GetName(), "INTERFACE_LINK_LIBRARIES", 0, 0); cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, @@ -1306,8 +1300,7 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature) ret = false; } } - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->TLLCommands.push_back(std::make_pair(signature, lfbt)); return ret; } @@ -1333,9 +1326,10 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s, : "plain"); s << "The uses of the " << sigString << " signature are here:\n"; std::set<std::string> emitted; - for(std::vector<cmListFileBacktrace>::const_iterator it = sigs.begin(); + for(std::vector<cmListFileBacktrace>::iterator it = sigs.begin(); it != sigs.end(); ++it) { + it->MakeRelative(); cmListFileBacktrace::const_iterator i = it->begin(); if(i != it->end()) { @@ -1796,9 +1790,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) } if(prop == "INCLUDE_DIRECTORIES") { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(&lfbt); deleteAndClear(this->Internal->IncludeDirectoriesEntries); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); this->Internal->IncludeDirectoriesEntries.push_back( @@ -1807,9 +1800,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) } if(prop == "COMPILE_OPTIONS") { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(&lfbt); deleteAndClear(this->Internal->CompileOptionsEntries); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); this->Internal->CompileOptionsEntries.push_back( @@ -1818,9 +1810,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) } if(prop == "COMPILE_FEATURES") { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(&lfbt); deleteAndClear(this->Internal->CompileFeaturesEntries); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); this->Internal->CompileFeaturesEntries.push_back( @@ -1829,9 +1820,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) } if(prop == "COMPILE_DEFINITIONS") { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(&lfbt); deleteAndClear(this->Internal->CompileDefinitionsEntries); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); this->Internal->CompileDefinitionsEntries.push_back( @@ -1849,8 +1839,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) if (prop == "LINK_LIBRARIES") { this->Internal->LinkImplementationPropertyEntries.clear(); - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmValueWithOrigin entry(value, lfbt); this->Internal->LinkImplementationPropertyEntries.push_back(entry); return; @@ -1866,9 +1855,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) return; } this->Internal->SourceFilesMap.clear(); - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(&lfbt); this->Internal->SourceEntries.clear(); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); this->Internal->SourceEntries.push_back( @@ -1901,36 +1889,32 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, } if(prop == "INCLUDE_DIRECTORIES") { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(&lfbt); this->Internal->IncludeDirectoriesEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); return; } if(prop == "COMPILE_OPTIONS") { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(&lfbt); this->Internal->CompileOptionsEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); return; } if(prop == "COMPILE_FEATURES") { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(&lfbt); this->Internal->CompileFeaturesEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); return; } if(prop == "COMPILE_DEFINITIONS") { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(&lfbt); this->Internal->CompileDefinitionsEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); return; @@ -1945,8 +1929,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, } if (prop == "LINK_LIBRARIES") { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmValueWithOrigin entry(value, lfbt); this->Internal->LinkImplementationPropertyEntries.push_back(entry); return; @@ -1962,9 +1945,8 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, return; } this->Internal->SourceFilesMap.clear(); - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(&lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); this->Internal->SourceEntries.push_back( new cmTargetInternals::TargetPropertyEntry(cge)); @@ -2030,7 +2012,7 @@ void cmTarget::AppendBuildInterfaceIncludes() void cmTarget::InsertInclude(const cmValueWithOrigin &entry, bool before) { - cmGeneratorExpression ge(entry.Backtrace); + cmGeneratorExpression ge(&entry.Backtrace); std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position = before ? this->Internal->IncludeDirectoriesEntries.begin() @@ -2044,7 +2026,7 @@ void cmTarget::InsertInclude(const cmValueWithOrigin &entry, void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry, bool before) { - cmGeneratorExpression ge(entry.Backtrace); + cmGeneratorExpression ge(&entry.Backtrace); std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position = before ? this->Internal->CompileOptionsEntries.begin() @@ -2057,7 +2039,7 @@ void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry, //---------------------------------------------------------------------------- void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry) { - cmGeneratorExpression ge(entry.Backtrace); + cmGeneratorExpression ge(&entry.Backtrace); this->Internal->CompileDefinitionsEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value))); @@ -2098,14 +2080,13 @@ static void processIncludeDirectories(cmTarget const* tgt, } } std::string usedIncludes; - cmListFileBacktrace lfbt; for(std::vector<std::string>::iterator li = entryIncludes.begin(); li != entryIncludes.end(); ++li) { std::string targetName = (*it)->TargetName; std::string evaluatedTargetName; { - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(targetName); evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0); @@ -2238,10 +2219,8 @@ cmTarget::GetIncludeDirectories(const std::string& config) const { std::vector<std::string> includes; std::set<std::string> uniqueIncludes; - cmListFileBacktrace lfbt; - cmGeneratorExpressionDAGChecker dagChecker(lfbt, - this->GetName(), + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "INCLUDE_DIRECTORIES", 0, 0); std::vector<std::string> debugProperties; @@ -2284,7 +2263,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const continue; } { - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(it->Value); std::string result = cge->Evaluate(this->Makefile, config, @@ -2303,7 +2282,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const // TARGET_PROPERTY expression. includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">"; } - cmGeneratorExpression ge(it->Backtrace); + cmGeneratorExpression ge(&it->Backtrace); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse( includeGenex); @@ -2332,7 +2311,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const libDir = frameworkCheck.match(1); - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(libDir.c_str()); this->Internal @@ -2446,10 +2425,9 @@ void cmTarget::GetAutoUicOptions(std::vector<std::string> &result, { return; } - cmListFileBacktrace lfbt; - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; - cmGeneratorExpressionDAGChecker dagChecker(lfbt, + cmGeneratorExpressionDAGChecker dagChecker( this->GetName(), "AUTOUIC_OPTIONS", 0, 0); cmSystemTools::ExpandListArgument(ge.Parse(prop) @@ -2466,11 +2444,9 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result, const std::string& config) const { std::set<std::string> uniqueOptions; - cmListFileBacktrace lfbt; - cmGeneratorExpressionDAGChecker dagChecker(lfbt, - this->GetName(), - "COMPILE_OPTIONS", 0, 0); + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), + "COMPILE_OPTIONS", 0, 0); std::vector<std::string> debugProperties; const char *debugProp = @@ -2512,7 +2488,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result, continue; } { - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(it->Value); std::string targetResult = cge->Evaluate(this->Makefile, config, @@ -2531,7 +2507,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result, // TARGET_PROPERTY expression. optionGenex = "$<$<BOOL:" + it->Value + ">:" + optionGenex + ">"; } - cmGeneratorExpression ge(it->Backtrace); + cmGeneratorExpression ge(&it->Backtrace); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse( optionGenex); @@ -2578,11 +2554,9 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, const std::string& config) const { std::set<std::string> uniqueOptions; - cmListFileBacktrace lfbt; - cmGeneratorExpressionDAGChecker dagChecker(lfbt, - this->GetName(), - "COMPILE_DEFINITIONS", 0, 0); + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), + "COMPILE_DEFINITIONS", 0, 0); std::vector<std::string> debugProperties; const char *debugProp = @@ -2624,7 +2598,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, continue; } { - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(it->Value); std::string targetResult = cge->Evaluate(this->Makefile, config, @@ -2643,7 +2617,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, // TARGET_PROPERTY expression. defsGenex = "$<$<BOOL:" + it->Value + ">:" + defsGenex + ">"; } - cmGeneratorExpression ge(it->Backtrace); + cmGeneratorExpression ge(&it->Backtrace); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse( defsGenex); @@ -2671,7 +2645,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, } case cmPolicies::OLD: { - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(configProp); this->Internal @@ -2726,10 +2700,8 @@ void cmTarget::GetCompileFeatures(std::vector<std::string> &result, const std::string& config) const { std::set<std::string> uniqueFeatures; - cmListFileBacktrace lfbt; - cmGeneratorExpressionDAGChecker dagChecker(lfbt, - this->GetName(), + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "COMPILE_FEATURES", 0, 0); @@ -2773,7 +2745,7 @@ void cmTarget::GetCompileFeatures(std::vector<std::string> &result, continue; } { - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(it->Value); std::string targetResult = cge->Evaluate(this->Makefile, config, @@ -2792,7 +2764,7 @@ void cmTarget::GetCompileFeatures(std::vector<std::string> &result, // TARGET_PROPERTY expression. featureGenex = "$<$<BOOL:" + it->Value + ">:" + featureGenex + ">"; } - cmGeneratorExpression ge(it->Backtrace); + cmGeneratorExpression ge(&it->Backtrace); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse( featureGenex); @@ -4348,6 +4320,7 @@ void cmTarget::GetLibraryNames(std::string& name, const char* version = this->GetProperty("VERSION"); const char* soversion = this->GetProperty("SOVERSION"); if(!this->HasSOName(config) || + this->Makefile->IsOn("CMAKE_PLATFORM_NO_VERSIONED_SONAME") || this->IsFrameworkOnApple()) { // Versioning is supported only for shared libraries and modules, @@ -5183,8 +5156,7 @@ cmTarget::ReportPropertyOrigin(const std::string &p, areport += result; areport += "\"):\n" + report; - cmListFileBacktrace lfbt; - this->Makefile->GetCMakeInstance()->IssueMessage(cmake::LOG, areport, lfbt); + this->Makefile->GetCMakeInstance()->IssueMessage(cmake::LOG, areport); } //---------------------------------------------------------------------------- @@ -5921,10 +5893,9 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, } if(propertyLibs) { - cmListFileBacktrace lfbt; - cmGeneratorExpression ge(lfbt); + cmGeneratorExpression ge; - cmGeneratorExpressionDAGChecker dagChecker(lfbt, + cmGeneratorExpressionDAGChecker dagChecker( this->GetName(), linkProp, 0, 0); cmSystemTools::ExpandListArgument(ge.Parse(propertyLibs) @@ -6175,7 +6146,6 @@ void processILibs(const std::string& config, if (emitted.insert(tgt).second) { tgts.push_back(tgt); - std::vector<std::string> ilibs; cmTarget::LinkInterface const* iface = tgt->GetLinkInterfaceLibraries(config, headTarget); if (iface) @@ -6244,10 +6214,9 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, } // The interface libraries have been explicitly set. - cmListFileBacktrace lfbt; - cmGeneratorExpression ge(lfbt); - cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(), - linkIfaceProp, 0, 0); + cmGeneratorExpression ge; + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), + linkIfaceProp, 0, 0); dagChecker.SetTransitivePropertiesOnly(); std::vector<std::string> libs; cmSystemTools::ExpandListArgument(ge.Parse(interfaceLibs)->Evaluate( @@ -6356,9 +6325,8 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, if(explicitLibraries) { // The interface libraries have been explicitly set. - cmListFileBacktrace lfbt; - cmGeneratorExpression ge(lfbt); - cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(), + cmGeneratorExpression ge; + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), linkIfaceProp, 0, 0); cmSystemTools::ExpandListArgument(ge.Parse(explicitLibraries)->Evaluate( this->Makefile, @@ -6383,9 +6351,8 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, { // Compare the link implementation fallback link interface to the // preferred new link interface property and warn if different. - cmListFileBacktrace lfbt; - cmGeneratorExpression ge(lfbt); - cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(), + cmGeneratorExpression ge; + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "INTERFACE_LINK_LIBRARIES", 0, 0); std::vector<std::string> ifaceLibs; const char* newExplicitLibraries = diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx index 18499fd..3fb76a6 100644 --- a/Source/cmTargetCompileOptionsCommand.cxx +++ b/Source/cmTargetCompileOptionsCommand.cxx @@ -55,8 +55,7 @@ bool cmTargetCompileOptionsCommand ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content, bool, bool) { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmValueWithOrigin entry(this->Join(content), lfbt); tgt->InsertCompileOption(entry); return true; diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx index caec7eb..e9f0e04 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.cxx +++ b/Source/cmTargetIncludeDirectoriesCommand.cxx @@ -70,8 +70,7 @@ bool cmTargetIncludeDirectoriesCommand ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content, bool prepend, bool system) { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmValueWithOrigin entry(this->Join(content), lfbt); tgt->InsertInclude(entry, prepend); if (system) diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index 28a7bb1..ff5d411 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -17,24 +17,22 @@ //---------------------------------------------------------------------------- cmTest::cmTest(cmMakefile* mf) + : Backtrace(mf->GetBacktrace()) { this->Makefile = mf; this->OldStyle = true; this->Properties.SetCMakeInstance(mf->GetCMakeInstance()); - this->Backtrace = new cmListFileBacktrace; - this->Makefile->GetBacktrace(*this->Backtrace); } //---------------------------------------------------------------------------- cmTest::~cmTest() { - delete this->Backtrace; } //---------------------------------------------------------------------------- cmListFileBacktrace const& cmTest::GetBacktrace() const { - return *this->Backtrace; + return this->Backtrace; } //---------------------------------------------------------------------------- diff --git a/Source/cmTest.h b/Source/cmTest.h index a93eff5..c6e7e42 100644 --- a/Source/cmTest.h +++ b/Source/cmTest.h @@ -14,8 +14,8 @@ #include "cmCustomCommand.h" #include "cmPropertyMap.h" +#include "cmListFileCache.h" class cmMakefile; -class cmListFileBacktrace; /** \class cmTest * \brief Represent a test @@ -71,7 +71,7 @@ private: bool OldStyle; cmMakefile* Makefile; - cmListFileBacktrace* Backtrace; + cmListFileBacktrace Backtrace; }; #endif diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index c1b1f8b..f87a535 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -70,7 +70,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, this->TestGenerated = true; // Set up generator expression evaluation context. - cmGeneratorExpression ge(this->Test->GetBacktrace()); + cmGeneratorExpression ge(&this->Test->GetBacktrace()); // Start the test command. os << indent << "add_test(" << this->Test->GetName() << " "; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 72bb020..acf3930 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -32,34 +32,37 @@ #include <cmsys/auto_ptr.hxx> -static cmVS7FlagTable const* -cmVSGetCLFlagTable(cmLocalVisualStudioGenerator* lg) +cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const { - if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS12) + cmLocalVisualStudioGenerator::VSVersion + v = this->LocalGenerator->GetVersion(); + if(v >= cmLocalVisualStudioGenerator::VS12) { return cmVS12CLFlagTable; } - else if(lg->GetVersion() == cmLocalVisualStudioGenerator::VS11) + else if(v == cmLocalVisualStudioGenerator::VS11) { return cmVS11CLFlagTable; } else { return cmVS10CLFlagTable; } } -static cmVS7FlagTable const* -cmVSGetLibFlagTable(cmLocalVisualStudioGenerator* lg) +cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLibFlagTable() const { - if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS12) + cmLocalVisualStudioGenerator::VSVersion + v = this->LocalGenerator->GetVersion(); + if(v >= cmLocalVisualStudioGenerator::VS12) { return cmVS12LibFlagTable; } - else if(lg->GetVersion() == cmLocalVisualStudioGenerator::VS11) + else if(v == cmLocalVisualStudioGenerator::VS11) { return cmVS11LibFlagTable; } else { return cmVS10LibFlagTable; } } -static cmVS7FlagTable const* -cmVSGetLinkFlagTable(cmLocalVisualStudioGenerator* lg) +cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLinkFlagTable() const { - if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS12) + cmLocalVisualStudioGenerator::VSVersion + v = this->LocalGenerator->GetVersion(); + if(v >= cmLocalVisualStudioGenerator::VS12) { return cmVS12LinkFlagTable; } - else if(lg->GetVersion() == cmLocalVisualStudioGenerator::VS11) + else if(v == cmLocalVisualStudioGenerator::VS11) { return cmVS11LinkFlagTable; } else { return cmVS10LinkFlagTable; } @@ -464,8 +467,6 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations() void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() { - cmGlobalVisualStudio10Generator* gg = - static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator); std::vector<std::string> *configs = static_cast<cmGlobalVisualStudio7Generator *> (this->GlobalGenerator)->GetConfigurations(); @@ -500,52 +501,61 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() configType += "</ConfigurationType>\n"; this->WriteString(configType.c_str(), 2); - const char* mfcFlag = - this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG"); - std::string mfcFlagValue = mfcFlag ? mfcFlag : "0"; + this->WriteMSToolConfigurationValues(*i); - std::string useOfMfcValue = "false"; - if(mfcFlagValue == "1") - { - useOfMfcValue = "Static"; - } - else if(mfcFlagValue == "2") - { - useOfMfcValue = "Dynamic"; - } - std::string mfcLine = "<UseOfMfc>"; - mfcLine += useOfMfcValue + "</UseOfMfc>\n"; - this->WriteString(mfcLine.c_str(), 2); + this->WriteString("</PropertyGroup>\n", 1); + } +} - if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY && - this->ClOptions[*i]->UsingUnicode()) || - this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) - { - this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2); - } - else if (this->Target->GetType() <= cmTarget::MODULE_LIBRARY && - this->ClOptions[*i]->UsingSBCS()) - { - this->WriteString("<CharacterSet>NotSet</CharacterSet>\n", 2); - } - else - { - this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2); - } - if(const char* toolset = gg->GetPlatformToolset()) - { - std::string pts = "<PlatformToolset>"; - pts += toolset; - pts += "</PlatformToolset>\n"; - this->WriteString(pts.c_str(), 2); - } - if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) - { - this->WriteString("<WindowsAppContainer>true" - "</WindowsAppContainer>\n", 2); - } +//---------------------------------------------------------------------------- +void cmVisualStudio10TargetGenerator +::WriteMSToolConfigurationValues(std::string const& config) +{ + cmGlobalVisualStudio10Generator* gg = + static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator); + const char* mfcFlag = + this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG"); + std::string mfcFlagValue = mfcFlag ? mfcFlag : "0"; - this->WriteString("</PropertyGroup>\n", 1); + std::string useOfMfcValue = "false"; + if(mfcFlagValue == "1") + { + useOfMfcValue = "Static"; + } + else if(mfcFlagValue == "2") + { + useOfMfcValue = "Dynamic"; + } + std::string mfcLine = "<UseOfMfc>"; + mfcLine += useOfMfcValue + "</UseOfMfc>\n"; + this->WriteString(mfcLine.c_str(), 2); + + if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY && + this->ClOptions[config]->UsingUnicode()) || + this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) + { + this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2); + } + else if (this->Target->GetType() <= cmTarget::MODULE_LIBRARY && + this->ClOptions[config]->UsingSBCS()) + { + this->WriteString("<CharacterSet>NotSet</CharacterSet>\n", 2); + } + else + { + this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2); + } + if(const char* toolset = gg->GetPlatformToolset()) + { + std::string pts = "<PlatformToolset>"; + pts += toolset; + pts += "</PlatformToolset>\n"; + this->WriteString(pts.c_str(), 2); + } + if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) + { + this->WriteString("<WindowsAppContainer>true" + "</WindowsAppContainer>\n", 2); } } @@ -1144,17 +1154,18 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( } // if the source file does not match the linker language // then force c or c++ + const char* compileAs = 0; if(needForceLang || (linkLanguage != lang)) { if(lang == "CXX") { // force a C++ file type - flags += " /TP "; + compileAs = "CompileAsCpp"; } else if(lang == "C") { // force to c - flags += " /TC "; + compileAs = "CompileAsC"; } } bool hasFlags = false; @@ -1190,7 +1201,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( } // if we have flags or defines for this config then // use them - if(flags.size() || configDefines.size()) + if(!flags.empty() || !configDefines.empty() || compileAs) { (*this->BuildFileStream ) << firstString; firstString = ""; // only do firstString once @@ -1198,7 +1209,11 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( cmVisualStudioGeneratorOptions clOptions(this->LocalGenerator, cmVisualStudioGeneratorOptions::Compiler, - cmVSGetCLFlagTable(this->LocalGenerator), 0, this); + this->GetClFlagTable(), 0, this); + if(compileAs) + { + clOptions.AddFlag("CompileAs", compileAs); + } clOptions.Parse(flags.c_str()); clOptions.AddDefines(configDefines.c_str()); clOptions.SetConfiguration((*config).c_str()); @@ -1260,23 +1275,28 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() this->ConvertToWindowsSlash(outDir); this->WritePlatformConfigTag("OutDir", config->c_str(), 3); - *this->BuildFileStream << outDir + *this->BuildFileStream << cmVS10EscapeXML(outDir) << "</OutDir>\n"; this->WritePlatformConfigTag("IntDir", config->c_str(), 3); - *this->BuildFileStream << intermediateDir + *this->BuildFileStream << cmVS10EscapeXML(intermediateDir) << "</IntDir>\n"; + std::string name = + cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull); this->WritePlatformConfigTag("TargetName", config->c_str(), 3); - *this->BuildFileStream - << cmSystemTools::GetFilenameWithoutLastExtension( - targetNameFull.c_str()) - << "</TargetName>\n"; + *this->BuildFileStream << cmVS10EscapeXML(name) << "</TargetName>\n"; + std::string ext = + cmSystemTools::GetFilenameLastExtension(targetNameFull); + if(ext.empty()) + { + // An empty TargetExt causes a default extension to be used. + // A single "." appears to be treated as an empty extension. + ext = "."; + } this->WritePlatformConfigTag("TargetExt", config->c_str(), 3); - *this->BuildFileStream - << cmSystemTools::GetFilenameLastExtension(targetNameFull.c_str()) - << "</TargetExt>\n"; + *this->BuildFileStream << cmVS10EscapeXML(ext) << "</TargetExt>\n"; this->OutputLinkIncremental(*config); } @@ -1355,48 +1375,44 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( cmsys::auto_ptr<Options> pOptions( new Options(this->LocalGenerator, Options::Compiler, - cmVSGetCLFlagTable(this->LocalGenerator))); + this->GetClFlagTable())); Options& clOptions = *pOptions; std::string flags; - // collect up flags for - if(this->Target->GetType() < cmTarget::UTILITY) + const std::string& linkLanguage = + this->Target->GetLinkerLanguage(configName.c_str()); + if(linkLanguage.empty()) { - const std::string& linkLanguage = - this->Target->GetLinkerLanguage(configName.c_str()); - if(linkLanguage.empty()) - { - cmSystemTools::Error - ("CMake can not determine linker language for target: ", - this->Name.c_str()); - return false; - } - if(linkLanguage == "C" || linkLanguage == "CXX" - || linkLanguage == "Fortran") - { - std::string baseFlagVar = "CMAKE_"; - baseFlagVar += linkLanguage; - baseFlagVar += "_FLAGS"; - flags = this-> - Target->GetMakefile()->GetRequiredDefinition(baseFlagVar.c_str()); - std::string flagVar = baseFlagVar + std::string("_") + - cmSystemTools::UpperCase(configName); - flags += " "; - flags += this-> - Target->GetMakefile()->GetRequiredDefinition(flagVar.c_str()); - } - // set the correct language - if(linkLanguage == "C") - { - flags += " /TC "; - } - if(linkLanguage == "CXX") - { - flags += " /TP "; - } - this->LocalGenerator->AddCompileOptions(flags, this->Target, - linkLanguage, configName.c_str()); + cmSystemTools::Error + ("CMake can not determine linker language for target: ", + this->Name.c_str()); + return false; + } + if(linkLanguage == "C" || linkLanguage == "CXX" + || linkLanguage == "Fortran") + { + std::string baseFlagVar = "CMAKE_"; + baseFlagVar += linkLanguage; + baseFlagVar += "_FLAGS"; + flags = this-> + Target->GetMakefile()->GetRequiredDefinition(baseFlagVar.c_str()); + std::string flagVar = baseFlagVar + std::string("_") + + cmSystemTools::UpperCase(configName); + flags += " "; + flags += this-> + Target->GetMakefile()->GetRequiredDefinition(flagVar.c_str()); + } + // set the correct language + if(linkLanguage == "C") + { + clOptions.AddFlag("CompileAs", "CompileAsC"); } + if(linkLanguage == "CXX") + { + clOptions.AddFlag("CompileAs", "CompileAsCpp"); + } + this->LocalGenerator->AddCompileOptions(flags, this->Target, + linkLanguage, configName.c_str()); // Get preprocessor definitions for this directory. std::string defineFlags = this->Target->GetMakefile()->GetDefineFlags(); @@ -1436,6 +1452,10 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); this->OutputIncludes(includes); clOptions.OutputFlagMap(*this->BuildFileStream, " "); + clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", + "\n", "CXX"); + + this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3); // If not in debug mode, write the DebugInformationFormat field // without value so PDBs don't get generated uselessly. @@ -1445,10 +1465,6 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( "</DebugInformationFormat>\n", 3); } - clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", - "\n", "CXX"); - this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3); - // Specify the compiler program database file if configured. std::string pdb = this->Target->GetCompilePDBPath(configName.c_str()); if(!pdb.empty()) @@ -1508,7 +1524,7 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config) cmVisualStudioGeneratorOptions libOptions(this->LocalGenerator, cmVisualStudioGeneratorOptions::Linker, - cmVSGetLibFlagTable(this->LocalGenerator), 0, this); + this->GetLibFlagTable(), 0, this); libOptions.Parse(libflags.c_str()); libOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); libOptions.OutputFlagMap(*this->BuildFileStream, " "); @@ -1543,7 +1559,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) { cmsys::auto_ptr<Options> pOptions( new Options(this->LocalGenerator, Options::Linker, - cmVSGetLinkFlagTable(this->LocalGenerator), 0, this)); + this->GetLinkFlagTable(), 0, this)); Options& linkOptions = *pOptions; const std::string& linkLanguage = @@ -1567,16 +1583,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) { linkType = "EXE"; } - std::string stackVar = "CMAKE_"; - stackVar += linkLanguage; - stackVar += "_STACK_SIZE"; - const char* stackVal = this->Makefile->GetDefinition(stackVar.c_str()); std::string flags; - if(stackVal) - { - flags += " /STACK:"; - flags += stackVal; - } std::string linkFlagVarBase = "CMAKE_"; linkFlagVarBase += linkType; linkFlagVarBase += "_LINKER_FLAGS"; @@ -1600,14 +1607,6 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) flags += " "; flags += flagsConfig; } - if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") ) - { - linkOptions.AddFlag("SubSystem", "Windows"); - } - else - { - linkOptions.AddFlag("SubSystem", "Console"); - } std::string standardLibsVar = "CMAKE_"; standardLibsVar += linkLanguage; standardLibsVar += "_STANDARD_LIBRARIES"; @@ -1661,15 +1660,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) linkDirs += "%(AdditionalLibraryDirectories)"; linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs.c_str()); linkOptions.AddFlag("AdditionalDependencies", libs.c_str()); - linkOptions.AddFlag("Version", ""); - if(linkOptions.IsDebug() || flags.find("/debug") != flags.npos) - { - linkOptions.AddFlag("GenerateDebugInformation", "true"); - } - else - { - linkOptions.AddFlag("GenerateDebugInformation", "false"); - } + std::string targetName; std::string targetNameSO; std::string targetNameFull; @@ -1688,6 +1679,31 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) config.c_str()); } + linkOptions.AddFlag("Version", ""); + + if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") ) + { + linkOptions.AddFlag("SubSystem", "Windows"); + } + else + { + linkOptions.AddFlag("SubSystem", "Console"); + } + + if(const char* stackVal = + this->Makefile->GetDefinition("CMAKE_"+linkLanguage+"_STACK_SIZE")) + { + linkOptions.AddFlag("StackReserveSize", stackVal); + } + + if(linkOptions.IsDebug() || flags.find("/debug") != flags.npos) + { + linkOptions.AddFlag("GenerateDebugInformation", "true"); + } + else + { + linkOptions.AddFlag("GenerateDebugInformation", "false"); + } std::string pdb = this->Target->GetPDBDirectory(config.c_str()); pdb += "/"; pdb += targetNamePDB; diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index d72c6fd..8f2faca 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -23,6 +23,7 @@ class cmCustomCommand; class cmLocalVisualStudio7Generator; class cmComputeLinkInformation; class cmVisualStudioGeneratorOptions; +struct cmIDEFlagTable; #include "cmSourceGroup.h" class cmVisualStudio10TargetGenerator @@ -55,6 +56,7 @@ private: void WriteString(const char* line, int indentLevel); void WriteProjectConfigurations(); void WriteProjectConfigurationValues(); + void WriteMSToolConfigurationValues(std::string const& config); void WriteSource(const char* tool, cmSourceFile const* sf, const char* end = 0); void WriteSources(const char* tool, @@ -98,6 +100,10 @@ private: const std::vector<cmSourceGroup>& allGroups); bool IsResxHeader(const std::string& headerFile); + cmIDEFlagTable const* GetClFlagTable() const; + cmIDEFlagTable const* GetLibFlagTable() const; + cmIDEFlagTable const* GetLinkFlagTable() const; + private: typedef cmVisualStudioGeneratorOptions Options; typedef std::map<std::string, Options*> OptionsMap; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 16dc724..e3bebbd 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2562,8 +2562,11 @@ static bool cmakeCheckStampList(const char* stampList) //---------------------------------------------------------------------------- void cmake::IssueMessage(cmake::MessageType t, std::string const& text, - cmListFileBacktrace const& backtrace) + cmListFileBacktrace const& bt) { + cmListFileBacktrace backtrace = bt; + backtrace.MakeRelative(); + cmOStringStream msg; bool isError = false; // Construct the message header. @@ -2786,7 +2789,7 @@ void cmake::RunCheckForUnusedVariables() } if(haveUnused) { - this->IssueMessage(cmake::WARNING, msg.str(), cmListFileBacktrace()); + this->IssueMessage(cmake::WARNING, msg.str()); } #endif } diff --git a/Source/cmake.h b/Source/cmake.h index 329b439..2d04902 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -13,6 +13,7 @@ #ifndef cmake_h #define cmake_h +#include "cmListFileCache.h" #include "cmSystemTools.h" #include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" @@ -29,7 +30,6 @@ class cmFileTimeComparison; class cmExternalMakefileProjectGenerator; class cmDocumentationSection; class cmPolicies; -class cmListFileBacktrace; class cmTarget; class cmGeneratedFileStream; @@ -360,7 +360,7 @@ class cmake /** Display a message to the user. */ void IssueMessage(cmake::MessageType t, std::string const& text, - cmListFileBacktrace const& backtrace); + cmListFileBacktrace const& backtrace = cmListFileBacktrace(NULL)); ///! run the --build option int Build(const std::string& dir, const std::string& target, diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 9f9f6bb..d8540cb 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -163,7 +163,7 @@ static void cmakemainProgressCallback(const char *m, float prog, int main(int ac, char const* const* av) { - setlocale(LC_ALL, ""); + setlocale(LC_CTYPE, ""); cmsys::Encoding::CommandLineArguments args = cmsys::Encoding::CommandLineArguments::Main(ac, av); ac = args.argc(); diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 167e348..ff32de9 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -116,7 +116,7 @@ static const char * cmDocumentationOptions[][2] = // this is a test driver program for cmCTest. int main (int argc, char const* const* argv) { - setlocale(LC_ALL, ""); + setlocale(LC_CTYPE, ""); cmsys::Encoding::CommandLineArguments encoding_args = cmsys::Encoding::CommandLineArguments::Main(argc, argv); diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index 0e1fe8d..8c99f64 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -13,6 +13,8 @@ set(CMakeLib_TESTS testXMLSafe ) +set(testRST_ARGS ${CMAKE_CURRENT_SOURCE_DIR}) + if(WIN32) list(APPEND CMakeLib_TESTS testVisualStudioSlnParser @@ -39,7 +41,7 @@ if(CMAKE_OSX_ARCHITECTURES AND XCODE endif() foreach(test ${CMakeLib_TESTS}) - add_test(CMakeLib.${test} CMakeLibTests ${test}) + add_test(CMakeLib.${test} CMakeLibTests ${test} ${${test}_ARGS}) endforeach() if(TEST_CompileCommandOutput) diff --git a/Tests/CMakeLib/testRST.cxx b/Tests/CMakeLib/testRST.cxx index bad9560..37cb3fa 100644 --- a/Tests/CMakeLib/testRST.cxx +++ b/Tests/CMakeLib/testRST.cxx @@ -25,9 +25,14 @@ void reportLine(std::ostream& os, bool ret, std::string line, bool eol) } } -int testRST(int, char*[]) +int testRST(int argc, char* argv[]) { - std::string dir = cmSystemTools::GetFilenamePath(__FILE__); + if(argc != 2) + { + std::cerr << "Usage: testRST <dir>" << std::endl; + return 1; + } + std::string dir = argv[1]; if(dir.empty()) { dir = "."; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 852f78f..273a541 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1820,9 +1820,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --build-options ${build_options} "--warn-unused-vars") set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES - PASS_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:7 \\(set\\):") + PASS_REGULAR_EXPRESSION "CMake Warning \\(dev\\) at CMakeLists.txt:7 \\(set\\):") set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES - FAIL_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:5 \\(set\\):") + FAIL_REGULAR_EXPRESSION "CMakeLists.txt:5 \\(set\\):") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset") if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND NOT WIN32) @@ -2359,6 +2359,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "All Labels:.* Label1.* Label2") configure_file( + "${CMake_SOURCE_DIR}/Tests/CTestTestLabelRegExp/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestLabelRegExp/test.cmake" + @ONLY ESCAPE_QUOTES) + add_test(NAME CTestTestLabelRegExp + COMMAND ${CMAKE_CMAKE_COMMAND} + -DSOURCE_DIR=${CMAKE_SOURCE_DIR}/Tests/CTestTestLabelRegExp + -P ${CMAKE_BINARY_DIR}/Tests/CTestTestLabelRegExp/test.cmake + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Tests/CTestTestLabelRegExp + ) + + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestResourceLock/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestResourceLock/test.cmake" @ONLY ESCAPE_QUOTES) diff --git a/Tests/CTestTestLabelRegExp/CTestTestfile.cmake.in b/Tests/CTestTestLabelRegExp/CTestTestfile.cmake.in new file mode 100644 index 0000000..657f382 --- /dev/null +++ b/Tests/CTestTestLabelRegExp/CTestTestfile.cmake.in @@ -0,0 +1,8 @@ +add_test(test1 ${CMAKE_COMMAND} -E echo test1) +set_tests_properties(test1 PROPERTIES LABELS "foo") + +add_test(test2 ${CMAKE_COMMAND} -E echo test2) +set_tests_properties(test2 PROPERTIES LABELS "bar") + +add_test(test3 ${CMAKE_COMMAND} -E echo test3) +set_tests_properties(test3 PROPERTIES LABELS "foo;bar") diff --git a/Tests/CTestTestLabelRegExp/test.cmake.in b/Tests/CTestTestLabelRegExp/test.cmake.in new file mode 100644 index 0000000..5c0c9d7 --- /dev/null +++ b/Tests/CTestTestLabelRegExp/test.cmake.in @@ -0,0 +1,37 @@ +configure_file(${SOURCE_DIR}/CTestTestfile.cmake.in CTestTestfile.cmake) + +function(get_test_list TEST_LIST) + set(QUERY_COMMAND ${CMAKE_CTEST_COMMAND} -N ${ARGN}) + + execute_process(COMMAND ${QUERY_COMMAND} + RESULT_VARIABLE RESULT + OUTPUT_VARIABLE OUTPUT + ERROR_VARIABLE ERROR) + + if(NOT ${RESULT} STREQUAL "0") + message(FATAL_ERROR "command [${QUERY_COMMAND}] failed: RESULT[${RESULT}] OUTPUT[${OUTPUT}] ERROR[${ERROR}]") + endif() + + set(${TEST_LIST} "${OUTPUT}" PARENT_SCOPE) +endfunction() + +function(expect_test_list EXPECTED_OUTPUT) + get_test_list(TEST_LIST ${ARGN}) + + if(NOT "${TEST_LIST}" MATCHES "${EXPECTED_OUTPUT}") + message(FATAL_ERROR "actual output [${TEST_LIST}] does not match expected output [${EXPECTED_OUTPUT}] for given arguments [${ARGN}]") + endif() +endfunction() + +expect_test_list("test1.*test3.*Total Tests: 2" --label-regex foo) +expect_test_list("test2.*test3.*Total Tests: 2" --label-regex bar) +expect_test_list("test1.*test2.*test3.*Total Tests: 3" --label-regex foo|bar) +expect_test_list("Total Tests: 0" --label-regex baz) + +expect_test_list("test2.*Total Tests: 1" --label-exclude foo) +expect_test_list("test1.*Total Tests: 1" --label-exclude bar) +expect_test_list("Total Tests: 0" --label-exclude foo|bar) +expect_test_list("test1.*test2.*test3.*Total Tests: 3" --label-exclude baz) + +expect_test_list("test1.*Total Tests: 1" --label-regex foo --label-exclude bar) +expect_test_list("test2.*Total Tests: 1" --label-regex bar --label-exclude foo) diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 5fa46bf..222250c 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -83,6 +83,14 @@ set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_RELEASE CMAKE_IS_FUN_IN_RELEASE_MODE ) +set_property(DIRECTORY + PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO + CMAKE_IS_FUN_IN_RELEASE_MODE + ) +set_property(DIRECTORY + PROPERTY COMPILE_DEFINITIONS_MINSIZEREL + CMAKE_IS_FUN_IN_RELEASE_MODE + ) set(TEST_SEP "a b c") separate_arguments(TEST_SEP) diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index d3d9132..3f17dcc 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -83,6 +83,14 @@ set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_RELEASE CMAKE_IS_FUN_IN_RELEASE_MODE ) +set_property(DIRECTORY + PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO + CMAKE_IS_FUN_IN_RELEASE_MODE + ) +set_property(DIRECTORY + PROPERTY COMPILE_DEFINITIONS_MINSIZEREL + CMAKE_IS_FUN_IN_RELEASE_MODE + ) set(TEST_SEP "a b c") separate_arguments(TEST_SEP) diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index ab0ebc3..645cc65 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -35,6 +35,10 @@ if (NOT CMAKE_CXX_COMPILE_FEATURES AND NOT CMAKE_C_COMPILE_FEATURES) return() endif() +string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" COMPILER_VERSION_MAJOR "${CMAKE_CXX_COMPILER_VERSION}") +string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" COMPILER_VERSION_MINOR "${CMAKE_CXX_COMPILER_VERSION}") +string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" COMPILER_VERSION_PATCH "${CMAKE_CXX_COMPILER_VERSION}") + macro(set_defines target true_defs false_defs) set(defines) foreach(def ${true_defs}) @@ -46,6 +50,9 @@ macro(set_defines target true_defs false_defs) target_compile_definitions(${target} PRIVATE ${defines} + EXPECTED_COMPILER_VERSION_MAJOR=${COMPILER_VERSION_MAJOR} + EXPECTED_COMPILER_VERSION_MINOR=${COMPILER_VERSION_MINOR} + EXPECTED_COMPILER_VERSION_PATCH=${COMPILER_VERSION_PATCH} ) endmacro() diff --git a/Tests/Module/WriteCompilerDetectionHeader/main.cpp b/Tests/Module/WriteCompilerDetectionHeader/main.cpp index 8b4ea52..b807ad5 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/main.cpp +++ b/Tests/Module/WriteCompilerDetectionHeader/main.cpp @@ -13,6 +13,18 @@ #error cxx_variadic_templates expected availability did not match. #endif +#if !CHECK(VERSION_MAJOR) +#error Compiler major version did not match. +#endif + +#if !CHECK(VERSION_MINOR) +#error Compiler minor version did not match. +#endif + +#if !CHECK(VERSION_PATCH) +#error Compiler patch version did not match. +#endif + int main() { return 0; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d5af542..06272ce 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -16,6 +16,10 @@ if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3) set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1) endif() +if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2) + set(TargetSources_ARGS -DXCODE_BELOW_2=1) +endif() + add_RunCMake_test(CMP0019) add_RunCMake_test(CMP0022) add_RunCMake_test(CMP0026) diff --git a/Tests/RunCMake/CommandLine/P_directory-result.txt b/Tests/RunCMake/CommandLine/P_directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/P_directory-stderr.txt b/Tests/RunCMake/CommandLine/P_directory-stderr.txt new file mode 100644 index 0000000..b8319a1 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_directory-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Error processing file: .*/Tests/RunCMake/CommandLine$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 3aaeac0..f3d9637 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -35,3 +35,5 @@ run_cmake_command(E_sleep-no-args ${CMAKE_COMMAND} -E sleep) run_cmake_command(E_sleep-bad-arg1 ${CMAKE_COMMAND} -E sleep x) run_cmake_command(E_sleep-bad-arg2 ${CMAKE_COMMAND} -E sleep 1 -1) run_cmake_command(E_sleep-one-tenth ${CMAKE_COMMAND} -E sleep 0.1) + +run_cmake_command(P_directory ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}) diff --git a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt b/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt index 0200dcb..11bc96c 100644 --- a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt +++ b/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt @@ -5,7 +5,7 @@ CMake Debug Log at OriginDebug.cmake:13 \(add_library\): Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) -+ +.* CMake Debug Log at OriginDebug.cmake:16 \(set_property\): Used sources for target OriginDebug: @@ -13,7 +13,7 @@ CMake Debug Log at OriginDebug.cmake:16 \(set_property\): Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) -+ +.* CMake Debug Log at OriginDebug.cmake:20 \(target_sources\): Used sources for target OriginDebug: @@ -21,7 +21,7 @@ CMake Debug Log at OriginDebug.cmake:20 \(target_sources\): Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) -+ +.* CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\): Used sources for target OriginDebug: diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake index 01e505c..1d2eaec 100644 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -1,7 +1,6 @@ include(RunCMake) -if(RunCMake_GENERATOR MATCHES Xcode - OR RunCMake_GENERATOR MATCHES "Visual Studio") +if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode" AND NOT XCODE_BELOW_2) run_cmake(ConfigNotAllowed) run_cmake(OriginDebugIDE) else() diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt index 842eb3f..8d4db34 100644 --- a/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt @@ -1,5 +1,9 @@ CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): - VERSION parameter too low. + VERSION compatibility for write_compiler_detection_header is set to 3.0, + which is too low. It must be set to at least 3.1.0. Either set the + VERSION parameter to the write_compiler_detection_header function, or + update your minimum required CMake version with the cmake_minimum_required + command. Call Stack \(most recent call first\): OldVersion.cmake:4 \(write_compiler_detection_header\) CMakeLists.txt:3 \(include\) diff --git a/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c b/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c index 80389ee..a3d350b 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c @@ -2862,7 +2862,7 @@ set_time(int fd, int mode, const char *name, #endif } -#ifdef F_SETTIMES /* Tru64 */ +#ifdef F_SETTIMES static int set_time_tru64(int fd, int mode, const char *name, time_t atime, long atime_nsec, @@ -2870,19 +2870,21 @@ set_time_tru64(int fd, int mode, const char *name, time_t ctime, long ctime_nsec) { struct attr_timbuf tstamp; - struct timeval times[3]; - times[0].tv_sec = atime; - times[0].tv_usec = atime_nsec / 1000; - times[1].tv_sec = mtime; - times[1].tv_usec = mtime_nsec / 1000; - times[2].tv_sec = ctime; - times[2].tv_usec = ctime_nsec / 1000; - tstamp.atime = times[0]; - tstamp.mtime = times[1]; - tstamp.ctime = times[2]; + tstamp.atime.tv_sec = atime; + tstamp.mtime.tv_sec = mtime; + tstamp.ctime.tv_sec = ctime; +#if defined (__hpux) && defined (__ia64) + tstamp.atime.tv_nsec = atime_nsec; + tstamp.mtime.tv_nsec = mtime_nsec; + tstamp.ctime.tv_nsec = ctime_nsec; +#else + tstamp.atime.tv_usec = atime_nsec / 1000; + tstamp.mtime.tv_usec = mtime_nsec / 1000; + tstamp.ctime.tv_usec = ctime_nsec / 1000; +#endif return (fcntl(fd,F_SETTIMES,&tstamp)); } -#endif /* Tru64 */ +#endif /* F_SETTIMES */ static int set_times(struct archive_write_disk *a, |