diff options
Diffstat (limited to 'Modules')
64 files changed, 906 insertions, 680 deletions
diff --git a/Modules/AutogenInfo.cmake.in b/Modules/AutogenInfo.cmake.in index b6f9791..602b065 100644 --- a/Modules/AutogenInfo.cmake.in +++ b/Modules/AutogenInfo.cmake.in @@ -16,6 +16,7 @@ set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/") set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/") set(AM_QT_VERSION_MAJOR "@_target_qt_version@") set(AM_TARGET_NAME @_moc_target_name@) +set(AM_ORIGIN_TARGET_NAME @_origin_target_name@) set(AM_RELAXED_MODE "@_moc_relaxed_mode@") set(AM_UIC_TARGET_OPTIONS @_uic_target_options@) set(AM_UIC_OPTIONS_FILES @_qt_uic_options_files@) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 16e19cd..0221cbd 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -2,234 +2,11 @@ # error "A C++ compiler has been selected for C." #endif -/* Version number components: V=Version, R=Revision, P=Patch - Version date components: YYYY=Year, MM=Month, DD=Day */ - #if defined(__18CXX) # define ID_VOID_MAIN #endif -#if defined(__INTEL_COMPILER) || defined(__ICC) -# define COMPILER_ID "Intel" - /* __INTEL_COMPILER = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) -# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) -# if defined(__INTEL_COMPILER_UPDATE) -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) -# else -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) -# endif -# if defined(__INTEL_COMPILER_BUILD_DATE) - /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ -# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) -# endif -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif - -#elif defined(__PATHCC__) -# define COMPILER_ID "PathScale" -# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) -# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) -# if defined(__PATHCC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) -# endif - -#elif defined(__clang__) -# if defined(__apple_build_version__) -# define COMPILER_ID "AppleClang" -# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) -# else -# define COMPILER_ID "Clang" -# endif -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif - -#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) -# define COMPILER_ID "Embarcadero" -# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) -# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF) - -#elif defined(__BORLANDC__) -# define COMPILER_ID "Borland" - /* __BORLANDC__ = 0xVRR */ -# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) -# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) - -#elif defined(__WATCOMC__) -# if __WATCOMC__ < 1200 -# define COMPILER_ID "Watcom" - /* __WATCOMC__ = VVRP */ -# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) -# else -# define COMPILER_ID "OpenWatcom" - /* __WATCOMC__ = VVRP + 1100 */ -# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) -# endif -# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) -# if (__WATCOMC__ % 10) > 0 -# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) -# endif - -#elif defined(__SUNPRO_C) -# define COMPILER_ID "SunPro" -# if __SUNPRO_C >= 0x5100 - /* __SUNPRO_C = 0xVRRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) -# else - /* __SUNPRO_C = 0xVRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) -# endif - -#elif defined(__HP_cc) -# define COMPILER_ID "HP" - /* __HP_cc = VVRRPP */ -# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) -# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) -# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) - -#elif defined(__DECC) -# define COMPILER_ID "Compaq" - /* __DECC_VER = VVRRTPPPP */ -# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) -# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) -# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) - -#elif defined(__IBMC__) -# if defined(__COMPILER_VER__) -# define COMPILER_ID "zOS" -# else -# if __IBMC__ >= 800 -# define COMPILER_ID "XL" -# else -# define COMPILER_ID "VisualAge" -# endif - /* __IBMC__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) -# endif - -#elif defined(__PGI) -# define COMPILER_ID "PGI" -# define COMPILER_VERSION_MAJOR DEC(__PGIC__) -# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) -# if defined(__PGIC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) -# endif - -#elif defined(_CRAYC) -# define COMPILER_ID "Cray" -# define COMPILER_VERSION_MAJOR DEC(_RELEASE) -# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) - -#elif defined(__TI_COMPILER_VERSION__) -# define COMPILER_ID "TI" - /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ -# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) -# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) -# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) - -#elif defined(__TINYC__) -# define COMPILER_ID "TinyCC" - -#elif defined(__SCO_VERSION__) -# define COMPILER_ID "SCO" - -#elif defined(__GNUC__) -# define COMPILER_ID "GNU" -# define COMPILER_VERSION_MAJOR DEC(__GNUC__) -# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) -# if defined(__GNUC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif - -#elif defined(_MSC_VER) -# define COMPILER_ID "MSVC" - /* _MSC_VER = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) -# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) -# if defined(_MSC_FULL_VER) -# if _MSC_VER >= 1400 - /* _MSC_FULL_VER = VVRRPPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) -# else - /* _MSC_FULL_VER = VVRRPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) -# endif -# endif -# if defined(_MSC_BUILD) -# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) -# endif - -/* Analog VisualDSP++ >= 4.5.6 */ -#elif defined(__VISUALDSPVERSION__) -# define COMPILER_ID "ADSP" - /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ -# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) -# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) - -/* Analog VisualDSP++ < 4.5.6 */ -#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) -# define COMPILER_ID "ADSP" - -/* IAR Systems compiler for embedded systems. - http://www.iar.com */ -#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC) -# define COMPILER_ID "IAR" - -/* sdcc, the small devices C compiler for embedded systems, - http://sdcc.sourceforge.net */ -#elif defined(SDCC) -# define COMPILER_ID "SDCC" - /* SDCC = VRP */ -# define COMPILER_VERSION_MAJOR DEC(SDCC/100) -# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) -# define COMPILER_VERSION_PATCH DEC(SDCC % 10) - -#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) -# define COMPILER_ID "MIPSpro" -# if defined(_SGI_COMPILER_VERSION) - /* _SGI_COMPILER_VERSION = VRP */ -# define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100) -# define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10) -# define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10) -# else - /* _COMPILER_VERSION = VRP */ -# define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100) -# define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10) -# define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10) -# endif - -/* This compiler is either not known or is too old to define an - identification macro. Try to identify the platform and guess that - it is the native compiler. */ -#elif defined(__sgi) -# define COMPILER_ID "MIPSpro" - -#elif defined(__hpux) || defined(__hpua) -# define COMPILER_ID "HP" - -#else /* unknown compiler */ -# define COMPILER_ID "" - -#endif +@CMAKE_C_COMPILER_ID_CONTENT@ /* Construct the string literal in pieces to prevent the source from getting matched. Store it in a pointer rather than an array diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index e0cce45..332b26e 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -175,10 +175,10 @@ endif() # Create a static archive incrementally for large object file counts. # If CMAKE_C_CREATE_STATIC_LIBRARY is set it will override these. if(NOT DEFINED CMAKE_C_ARCHIVE_CREATE) - set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> cq <TARGET> <LINK_FLAGS> <OBJECTS>") endif() if(NOT DEFINED CMAKE_C_ARCHIVE_APPEND) - set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>") endif() if(NOT DEFINED CMAKE_C_ARCHIVE_FINISH) set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>") diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index fdee336..6e531ca 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -3,6 +3,7 @@ set(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@") set(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@") set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@") set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@") +set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@") set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@") set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@") diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index d81df77..9ece26d 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -5,224 +5,7 @@ # error "A C compiler has been selected for C++." #endif -/* Version number components: V=Version, R=Revision, P=Patch - Version date components: YYYY=Year, MM=Month, DD=Day */ - -#if defined(__COMO__) -# define COMPILER_ID "Comeau" - /* __COMO_VERSION__ = VRR */ -# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) -# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) - -#elif defined(__INTEL_COMPILER) || defined(__ICC) -# define COMPILER_ID "Intel" - /* __INTEL_COMPILER = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) -# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) -# if defined(__INTEL_COMPILER_UPDATE) -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) -# else -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) -# endif -# if defined(__INTEL_COMPILER_BUILD_DATE) - /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ -# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) -# endif -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif - -#elif defined(__PATHCC__) -# define COMPILER_ID "PathScale" -# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) -# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) -# if defined(__PATHCC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) -# endif - -#elif defined(__clang__) -# if defined(__apple_build_version__) -# define COMPILER_ID "AppleClang" -# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) -# else -# define COMPILER_ID "Clang" -# endif -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif - -#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) -# define COMPILER_ID "Embarcadero" -# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) -# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF) - -#elif defined(__BORLANDC__) -# define COMPILER_ID "Borland" - /* __BORLANDC__ = 0xVRR */ -# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) -# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) - -#elif defined(__WATCOMC__) -# if __WATCOMC__ < 1200 -# define COMPILER_ID "Watcom" - /* __WATCOMC__ = VVRP */ -# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) -# else -# define COMPILER_ID "OpenWatcom" - /* __WATCOMC__ = VVRP + 1100 */ -# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) -# endif -# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) -# if (__WATCOMC__ % 10) > 0 -# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) -# endif - -#elif defined(__SUNPRO_CC) -# define COMPILER_ID "SunPro" -# if __SUNPRO_CC >= 0x5100 - /* __SUNPRO_CC = 0xVRRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) -# else - /* __SUNPRO_CC = 0xVRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) -# endif - -#elif defined(__HP_aCC) -# define COMPILER_ID "HP" - /* __HP_aCC = VVRRPP */ -# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) -# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) -# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) - -#elif defined(__DECCXX) -# define COMPILER_ID "Compaq" - /* __DECCXX_VER = VVRRTPPPP */ -# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) -# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) -# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) - -#elif defined(__IBMCPP__) -# if defined(__COMPILER_VER__) -# define COMPILER_ID "zOS" -# else -# if __IBMCPP__ >= 800 -# define COMPILER_ID "XL" -# else -# define COMPILER_ID "VisualAge" -# endif - /* __IBMCPP__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) -# endif - -#elif defined(__PGI) -# define COMPILER_ID "PGI" -# define COMPILER_VERSION_MAJOR DEC(__PGIC__) -# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) -# if defined(__PGIC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) -# endif - -#elif defined(_CRAYC) -# define COMPILER_ID "Cray" -# define COMPILER_VERSION_MAJOR DEC(_RELEASE) -# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) - -#elif defined(__TI_COMPILER_VERSION__) -# define COMPILER_ID "TI" - /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ -# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) -# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) -# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) - -#elif defined(__SCO_VERSION__) -# define COMPILER_ID "SCO" - -#elif defined(__GNUC__) -# define COMPILER_ID "GNU" -# define COMPILER_VERSION_MAJOR DEC(__GNUC__) -# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) -# if defined(__GNUC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif - -#elif defined(_MSC_VER) -# define COMPILER_ID "MSVC" - /* _MSC_VER = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) -# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) -# if defined(_MSC_FULL_VER) -# if _MSC_VER >= 1400 - /* _MSC_FULL_VER = VVRRPPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) -# else - /* _MSC_FULL_VER = VVRRPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) -# endif -# endif -# if defined(_MSC_BUILD) -# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) -# endif - -/* Analog VisualDSP++ >= 4.5.6 */ -#elif defined(__VISUALDSPVERSION__) -# define COMPILER_ID "ADSP" - /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ -# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) -# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) - -/* Analog VisualDSP++ < 4.5.6 */ -#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) -# define COMPILER_ID "ADSP" - -/* IAR Systems compiler for embedded systems. - http://www.iar.com */ -#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC) -# define COMPILER_ID "IAR" - -#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) -# define COMPILER_ID "MIPSpro" -# if defined(_SGI_COMPILER_VERSION) - /* _SGI_COMPILER_VERSION = VRP */ -# define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100) -# define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10) -# define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10) -# else - /* _COMPILER_VERSION = VRP */ -# define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100) -# define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10) -# define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10) -# endif - -/* This compiler is either not known or is too old to define an - identification macro. Try to identify the platform and guess that - it is the native compiler. */ -#elif defined(__sgi) -# define COMPILER_ID "MIPSpro" - -#elif defined(__hpux) || defined(__hpua) -# define COMPILER_ID "HP" - -#else /* unknown compiler */ -# define COMPILER_ID "" - -#endif +@CMAKE_CXX_COMPILER_ID_CONTENT@ /* Construct the string literal in pieces to prevent the source from getting matched. Store it in a pointer rather than an array diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 3010a48..72b2857 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -266,10 +266,10 @@ endif() # Create a static archive incrementally for large object file counts. # If CMAKE_CXX_CREATE_STATIC_LIBRARY is set it will override these. if(NOT DEFINED CMAKE_CXX_ARCHIVE_CREATE) - set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> cq <TARGET> <LINK_FLAGS> <OBJECTS>") endif() if(NOT DEFINED CMAKE_CXX_ARCHIVE_APPEND) - set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>") endif() if(NOT DEFINED CMAKE_CXX_ARCHIVE_FINISH) set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>") diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake new file mode 100644 index 0000000..d8a0d67 --- /dev/null +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -0,0 +1,151 @@ + +#============================================================================= +# Copyright 2014 Stephen Kelly <steveire@gmail.com> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +function(_readFile file) + include(${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_pp_test_${CompilerId} ${_compiler_id_pp_test} PARENT_SCOPE) +endfunction() + +include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) + +function(compiler_id_detection outvar lang) + + if (NOT lang STREQUAL Fortran) + file(GLOB lang_files + "${CMAKE_ROOT}/Modules/Compiler/*-DetermineCompiler.cmake") + set(nonlang CXX) + if (lang STREQUAL CXX) + set(nonlang C) + endif() + + file(GLOB nonlang_files + "${CMAKE_ROOT}/Modules/Compiler/*-${nonlang}-DetermineCompiler.cmake") + list(REMOVE_ITEM lang_files ${nonlang_files}) + endif() + + set(files ${lang_files}) + if (files) + foreach(file ${files}) + _readFile(${file}) + endforeach() + + set(options ID_STRING VERSION_STRINGS ID_DEFINE PLATFORM_DEFAULT_COMPILER) + set(oneValueArgs PREFIX) + cmake_parse_arguments(CID "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + if (CID_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unrecognized arguments: \"${CID_UNPARSED_ARGUMENTS}\"") + endif() + + # Order is relevant here. For example, compilers which pretend to be + # GCC must appear before the actual GCC. + if (lang STREQUAL CXX) + list(APPEND ordered_compilers + Comeau + ) + endif() + list(APPEND ordered_compilers + Intel + PathScale + AppleClang + Clang + Embarcadero + Borland + Watcom + OpenWatcom + SunPro + HP + Compaq + zOS + XL + VisualAge + PGI + Cray + TI + ) + if (lang STREQUAL C) + list(APPEND ordered_compilers + TinyCC + ) + endif() + list(APPEND ordered_compilers + SCO + GNU + MSVC + ADSP + IAR + ) + if (lang STREQUAL C) + list(APPEND ordered_compilers + SDCC + ) + endif() + list(APPEND ordered_compilers + MIPSpro) + + if(CID_ID_DEFINE) + foreach(Id ${ordered_compilers}) + set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}# define ${CID_PREFIX}COMPILER_IS_${Id} 0\n") + endforeach() + endif() + + set(pp_if "#if") + if (CID_VERSION_STRINGS) + set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */\n") + endif() + + foreach(Id ${ordered_compilers}) + if (NOT _compiler_id_pp_test_${Id}) + message(FATAL_ERROR "No preprocessor test for \"${Id}\"") + 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}\"") + endif() + if (CID_ID_DEFINE) + set(id_content "${id_content}# undef ${CID_PREFIX}COMPILER_IS_${Id}\n") + set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_IS_${Id} 1\n") + endif() + if (CID_VERSION_STRINGS) + set(PREFIX ${CID_PREFIX}) + string(CONFIGURE "${_compiler_id_version_compute_${Id}}" VERSION_BLOCK @ONLY) + set(id_content "${id_content}${VERSION_BLOCK}\n") + endif() + set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${id_content}") + set(pp_if "#elif") + endforeach() + + if (CID_PLATFORM_DEFAULT_COMPILER) + set(platform_compiler_detection " +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__sgi) +# define ${CID_PREFIX}COMPILER_ID \"MIPSpro\" + +#elif defined(__hpux) || defined(__hpua) +# define ${CID_PREFIX}COMPILER_ID \"HP\" + +#else /* unknown compiler */ +# define ${CID_PREFIX}COMPILER_ID \"\"") + endif() + + set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${platform_compiler_detection}\n#endif") + endif() + + set(${outvar} ${CMAKE_${lang}_COMPILER_ID_CONTENT} PARENT_SCOPE) +endfunction() diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompileFeatures.cmake index 40aa9d6..583ff8d 100644 --- a/Modules/CMakeDetermineCompileFeatures.cmake +++ b/Modules/CMakeDetermineCompileFeatures.cmake @@ -17,6 +17,7 @@ function(cmake_determine_compile_features lang) if(lang STREQUAL CXX AND COMMAND cmake_record_cxx_compile_features) message(STATUS "Detecting ${lang} compile features") + set(CMAKE_CXX98_COMPILE_FEATURES) set(CMAKE_CXX11_COMPILE_FEATURES) include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake") @@ -28,13 +29,19 @@ function(cmake_determine_compile_features lang) return() endif() + if (CMAKE_CXX98_COMPILE_FEATURES) + list(REMOVE_ITEM CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES}) + endif() + if(NOT CMAKE_CXX_COMPILE_FEATURES) set(CMAKE_CXX_COMPILE_FEATURES + ${CMAKE_CXX98_COMPILE_FEATURES} ${CMAKE_CXX11_COMPILE_FEATURES} ) endif() set(CMAKE_CXX_COMPILE_FEATURES ${CMAKE_CXX_COMPILE_FEATURES} PARENT_SCOPE) + set(CMAKE_CXX98_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES} PARENT_SCOPE) message(STATUS "Detecting ${lang} compile features - done") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index f109dc4..025d296 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -97,11 +97,20 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) endfunction() +include(CMakeCompilerIdDetection) + #----------------------------------------------------------------------------- # Function to write the compiler id source file. function(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src) find_file(src_in ${src}.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) file(READ ${src_in} ID_CONTENT_IN) + + compiler_id_detection(CMAKE_${lang}_COMPILER_ID_CONTENT ${lang} + ID_STRING + VERSION_STRINGS + PLATFORM_DEFAULT_COMPILER + ) + unset(src_in CACHE) string(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY) file(WRITE ${CMAKE_${lang}_COMPILER_ID_DIR}/${src} "${ID_CONTENT_OUT}") @@ -215,6 +224,17 @@ Id flags: ${testflags} else() set(id_toolset "") endif() + if(CMAKE_OSX_DEPLOYMENT_TARGET) + set(id_deployment_target + "MACOSX_DEPLOYMENT_TARGET = \"${CMAKE_OSX_DEPLOYMENT_TARGET}\";") + else() + set(id_deployment_target "") + endif() + if(CMAKE_OSX_SYSROOT) + set(id_sdkroot "SDKROOT = \"${CMAKE_OSX_SYSROOT}\";") + else() + set(id_sdkroot "") + endif() if(NOT ${XCODE_VERSION} VERSION_LESS 3) set(v 3) set(ext xcodeproj) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 080dc68..d638207 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -194,10 +194,10 @@ endif() # Create a static archive incrementally for large object file counts. # If CMAKE_Fortran_CREATE_STATIC_LIBRARY is set it will override these. if(NOT DEFINED CMAKE_Fortran_ARCHIVE_CREATE) - set(CMAKE_Fortran_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_Fortran_ARCHIVE_CREATE "<CMAKE_AR> cq <TARGET> <LINK_FLAGS> <OBJECTS>") endif() if(NOT DEFINED CMAKE_Fortran_ARCHIVE_APPEND) - set(CMAKE_Fortran_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_Fortran_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>") endif() if(NOT DEFINED CMAKE_Fortran_ARCHIVE_FINISH) set(CMAKE_Fortran_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>") diff --git a/Modules/CMakeSystemSpecificInitialize.cmake b/Modules/CMakeSystemSpecificInitialize.cmake new file mode 100644 index 0000000..5327ac1 --- /dev/null +++ b/Modules/CMakeSystemSpecificInitialize.cmake @@ -0,0 +1,20 @@ + +#============================================================================= +# Copyright 2002-2014 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This file is included by cmGlobalGenerator::EnableLanguage. +# It is included before the compiler has been determined. + +include(Platform/${CMAKE_SYSTEM_NAME}-Initialize OPTIONAL) + +set(CMAKE_SYSTEM_SPECIFIC_INITIALIZE_LOADED 1) diff --git a/Modules/Compiler/ADSP-DetermineCompiler.cmake b/Modules/Compiler/ADSP-DetermineCompiler.cmake new file mode 100644 index 0000000..0b5af0d --- /dev/null +++ b/Modules/Compiler/ADSP-DetermineCompiler.cmake @@ -0,0 +1,10 @@ + +set(_compiler_id_pp_test "defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)") + +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) +#endif") diff --git a/Modules/Compiler/AppleClang-DetermineCompiler.cmake b/Modules/Compiler/AppleClang-DetermineCompiler.cmake new file mode 100644 index 0000000..d293b7b --- /dev/null +++ b/Modules/Compiler/AppleClang-DetermineCompiler.cmake @@ -0,0 +1,7 @@ + +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__)") diff --git a/Modules/Compiler/Borland-DetermineCompiler.cmake b/Modules/Compiler/Borland-DetermineCompiler.cmake new file mode 100644 index 0000000..2e8a948 --- /dev/null +++ b/Modules/Compiler/Borland-DetermineCompiler.cmake @@ -0,0 +1,7 @@ + +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)") diff --git a/Modules/Compiler/Clang-DetermineCompiler.cmake b/Modules/Compiler/Clang-DetermineCompiler.cmake new file mode 100644 index 0000000..89df1b6 --- /dev/null +++ b/Modules/Compiler/Clang-DetermineCompiler.cmake @@ -0,0 +1,4 @@ + +set(_compiler_id_pp_test "defined(__clang__)") + +include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake") diff --git a/Modules/Compiler/Clang-DetermineCompilerInternal.cmake b/Modules/Compiler/Clang-DetermineCompilerInternal.cmake new file mode 100644 index 0000000..9a37a63 --- /dev/null +++ b/Modules/Compiler/Clang-DetermineCompilerInternal.cmake @@ -0,0 +1,11 @@ + +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__) +# 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) +# endif") diff --git a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake new file mode 100644 index 0000000..e4def4d --- /dev/null +++ b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake @@ -0,0 +1,7 @@ + +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)") diff --git a/Modules/Compiler/Compaq-C-DetermineCompiler.cmake b/Modules/Compiler/Compaq-C-DetermineCompiler.cmake new file mode 100644 index 0000000..56fedb1 --- /dev/null +++ b/Modules/Compiler/Compaq-C-DetermineCompiler.cmake @@ -0,0 +1,8 @@ + +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)") diff --git a/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake new file mode 100644 index 0000000..5855c24 --- /dev/null +++ b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake @@ -0,0 +1,8 @@ + +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)") diff --git a/Modules/Compiler/Cray-DetermineCompiler.cmake b/Modules/Compiler/Cray-DetermineCompiler.cmake new file mode 100644 index 0000000..6e4eaf9 --- /dev/null +++ b/Modules/Compiler/Cray-DetermineCompiler.cmake @@ -0,0 +1,6 @@ + +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)") diff --git a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake new file mode 100644 index 0000000..f52d79b --- /dev/null +++ b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake @@ -0,0 +1,7 @@ + +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)") diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index 3f169d2..fe0ff0b 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -74,4 +74,5 @@ set(_cmake_feature_test_cxx_extern_templates "${_oldestSupported} && __cplusplus # TODO: Should be supported forever? set(_cmake_feature_test_cxx_func_identifier "${_oldestSupported} && __cplusplus >= 201103L") set(_cmake_feature_test_cxx_variadic_macros "${_oldestSupported} && __cplusplus >= 201103L") +set(_cmake_feature_test_cxx_template_template_parameters "${_oldestSupported} && __cplusplus >= 199711L") set(_oldestSupported) diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index 7acad52..d324985 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -24,6 +24,8 @@ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.3) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x") endif() +set(CMAKE_CXX_STANDARD_DEFAULT 98) + macro(cmake_record_cxx_compile_features) macro(_get_gcc_features std_version list) record_compiler_features(CXX "-std=${std_version}" ${list}) @@ -31,6 +33,9 @@ macro(cmake_record_cxx_compile_features) if (UNIX AND NOT APPLE AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) _get_gcc_features(c++11 CMAKE_CXX11_COMPILE_FEATURES) + if (_result EQUAL 0) + _get_gcc_features(c++98 CMAKE_CXX98_COMPILE_FEATURES) + endif() else() set(_result 0) endif() diff --git a/Modules/Compiler/GNU-DetermineCompiler.cmake b/Modules/Compiler/GNU-DetermineCompiler.cmake new file mode 100644 index 0000000..f0c25dd --- /dev/null +++ b/Modules/Compiler/GNU-DetermineCompiler.cmake @@ -0,0 +1,9 @@ + +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__) +# if defined(__GNUC_PATCHLEVEL__) +# define @PREFIX@COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif") diff --git a/Modules/Compiler/HP-C-DetermineCompiler.cmake b/Modules/Compiler/HP-C-DetermineCompiler.cmake new file mode 100644 index 0000000..024a658 --- /dev/null +++ b/Modules/Compiler/HP-C-DetermineCompiler.cmake @@ -0,0 +1,8 @@ + +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)") diff --git a/Modules/Compiler/HP-CXX-DetermineCompiler.cmake b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake new file mode 100644 index 0000000..6999492 --- /dev/null +++ b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake @@ -0,0 +1,8 @@ + +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)") diff --git a/Modules/Compiler/IAR-DetermineCompiler.cmake b/Modules/Compiler/IAR-DetermineCompiler.cmake new file mode 100644 index 0000000..c39810a --- /dev/null +++ b/Modules/Compiler/IAR-DetermineCompiler.cmake @@ -0,0 +1,4 @@ + +# IAR Systems compiler for embedded systems. +# http://www.iar.com +set(_compiler_id_pp_test "defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)") diff --git a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake new file mode 100644 index 0000000..6169ab4 --- /dev/null +++ b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake @@ -0,0 +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)") diff --git a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake new file mode 100644 index 0000000..f673d72 --- /dev/null +++ b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake @@ -0,0 +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)") diff --git a/Modules/Compiler/Intel-DetermineCompiler.cmake b/Modules/Compiler/Intel-DetermineCompiler.cmake new file mode 100644 index 0000000..6fada1c --- /dev/null +++ b/Modules/Compiler/Intel-DetermineCompiler.cmake @@ -0,0 +1,22 @@ + +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) +# if defined(__INTEL_COMPILER_UPDATE) +# define @PREFIX@COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define @PREFIX@COMPILER_VERSION_PATCH 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) +# 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) +# endif") diff --git a/Modules/Compiler/MIPSpro-DetermineCompiler.cmake b/Modules/Compiler/MIPSpro-DetermineCompiler.cmake new file mode 100644 index 0000000..31eb345 --- /dev/null +++ b/Modules/Compiler/MIPSpro-DetermineCompiler.cmake @@ -0,0 +1,15 @@ + +set(_compiler_id_pp_test "defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)") + +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) +# 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) +# endif") diff --git a/Modules/Compiler/MSVC-DetermineCompiler.cmake b/Modules/Compiler/MSVC-DetermineCompiler.cmake new file mode 100644 index 0000000..d462d07 --- /dev/null +++ b/Modules/Compiler/MSVC-DetermineCompiler.cmake @@ -0,0 +1,19 @@ + +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) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define @PREFIX@COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define @PREFIX@COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define @PREFIX@COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif") diff --git a/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake b/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake new file mode 100644 index 0000000..6d416c1 --- /dev/null +++ b/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake @@ -0,0 +1,10 @@ + +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) +# if (__WATCOMC__ % 10) > 0 +# define @PREFIX@COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif") diff --git a/Modules/Compiler/PGI-DetermineCompiler.cmake b/Modules/Compiler/PGI-DetermineCompiler.cmake new file mode 100644 index 0000000..8e68bd6 --- /dev/null +++ b/Modules/Compiler/PGI-DetermineCompiler.cmake @@ -0,0 +1,9 @@ + +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__) +# if defined(__PGIC_PATCHLEVEL__) +# define @PREFIX@COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif") diff --git a/Modules/Compiler/PathScale-DetermineCompiler.cmake b/Modules/Compiler/PathScale-DetermineCompiler.cmake new file mode 100644 index 0000000..3335e26 --- /dev/null +++ b/Modules/Compiler/PathScale-DetermineCompiler.cmake @@ -0,0 +1,9 @@ + +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__) +# if defined(__PATHCC_PATCHLEVEL__) +# define @PREFIX@COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif") diff --git a/Modules/Compiler/SCO-DetermineCompiler.cmake b/Modules/Compiler/SCO-DetermineCompiler.cmake new file mode 100644 index 0000000..a44b22b --- /dev/null +++ b/Modules/Compiler/SCO-DetermineCompiler.cmake @@ -0,0 +1,2 @@ + +set(_compiler_id_pp_test "defined(__SCO_VERSION__)") diff --git a/Modules/Compiler/SDCC-C-DetermineCompiler.cmake b/Modules/Compiler/SDCC-C-DetermineCompiler.cmake new file mode 100644 index 0000000..8fe60d9 --- /dev/null +++ b/Modules/Compiler/SDCC-C-DetermineCompiler.cmake @@ -0,0 +1,10 @@ + +# sdcc, the small devices C compiler for embedded systems, +# http://sdcc.sourceforge.net */ +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)") diff --git a/Modules/Compiler/SunPro-C-DetermineCompiler.cmake b/Modules/Compiler/SunPro-C-DetermineCompiler.cmake new file mode 100644 index 0000000..7db1a97 --- /dev/null +++ b/Modules/Compiler/SunPro-C-DetermineCompiler.cmake @@ -0,0 +1,15 @@ + +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) +# 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) +# endif") diff --git a/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake new file mode 100644 index 0000000..0a48cc6 --- /dev/null +++ b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake @@ -0,0 +1,15 @@ + +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) +# 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) +# endif") diff --git a/Modules/Compiler/TI-DetermineCompiler.cmake b/Modules/Compiler/TI-DetermineCompiler.cmake new file mode 100644 index 0000000..1856c9b --- /dev/null +++ b/Modules/Compiler/TI-DetermineCompiler.cmake @@ -0,0 +1,8 @@ + +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)") diff --git a/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake b/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake new file mode 100644 index 0000000..8d6de7e --- /dev/null +++ b/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake @@ -0,0 +1,2 @@ + +set(_compiler_id_pp_test "defined(__TINYC__)") diff --git a/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake b/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake new file mode 100644 index 0000000..97c2263 --- /dev/null +++ b/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake @@ -0,0 +1,4 @@ + +set(_compiler_id_pp_test "defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800") + +include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-C-DetermineVersionInternal.cmake") diff --git a/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake b/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake new file mode 100644 index 0000000..cd53499 --- /dev/null +++ b/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake @@ -0,0 +1,4 @@ + +set(_compiler_id_pp_test "defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800") + +include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake") diff --git a/Modules/Compiler/Watcom-DetermineCompiler.cmake b/Modules/Compiler/Watcom-DetermineCompiler.cmake new file mode 100644 index 0000000..cc59abf --- /dev/null +++ b/Modules/Compiler/Watcom-DetermineCompiler.cmake @@ -0,0 +1,10 @@ + +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) +# if (__WATCOMC__ % 10) > 0 +# define @PREFIX@COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif") diff --git a/Modules/Compiler/XL-C-DetermineCompiler.cmake b/Modules/Compiler/XL-C-DetermineCompiler.cmake new file mode 100644 index 0000000..3f4e05c --- /dev/null +++ b/Modules/Compiler/XL-C-DetermineCompiler.cmake @@ -0,0 +1,4 @@ + +set(_compiler_id_pp_test "defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800") + +include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-C-DetermineVersionInternal.cmake") diff --git a/Modules/Compiler/XL-CXX-DetermineCompiler.cmake b/Modules/Compiler/XL-CXX-DetermineCompiler.cmake new file mode 100644 index 0000000..dffa4bc --- /dev/null +++ b/Modules/Compiler/XL-CXX-DetermineCompiler.cmake @@ -0,0 +1,4 @@ + +set(_compiler_id_pp_test "defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800") + +include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake") diff --git a/Modules/Compiler/zOS-C-DetermineCompiler.cmake b/Modules/Compiler/zOS-C-DetermineCompiler.cmake new file mode 100644 index 0000000..daa3781 --- /dev/null +++ b/Modules/Compiler/zOS-C-DetermineCompiler.cmake @@ -0,0 +1,4 @@ + +set(_compiler_id_pp_test "defined(__IBMC__) && defined(__COMPILER_VER__)") + +include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-C-DetermineVersionInternal.cmake") diff --git a/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake b/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake new file mode 100644 index 0000000..a08ff57 --- /dev/null +++ b/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake @@ -0,0 +1,4 @@ + +set(_compiler_id_pp_test "defined(__IBMCPP__) && defined(__COMPILER_VER__)") + +include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake") diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in index 6f861eb..eabfc6b 100644 --- a/Modules/CompilerId/Xcode-3.pbxproj.in +++ b/Modules/CompilerId/Xcode-3.pbxproj.in @@ -84,6 +84,8 @@ CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; SYMROOT = .; @id_toolset@ + @id_deployment_target@ + @id_sdkroot@ }; name = Debug; }; diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index ee20693..73a4990 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -421,6 +421,7 @@ function(_ExternalData_arg target arg options var_file) set(external "") # Entries external to the source tree. set(internal "") # Entries internal to the source tree. set(have_original ${data_is_directory}) + set(have_original_as_dir 0) # Process options. set(series_option "") @@ -470,11 +471,18 @@ function(_ExternalData_arg target arg options var_file) endif() if(NOT have_original) - message(FATAL_ERROR "Data file referenced by argument\n" + if(have_original_as_dir) + set(msg_kind FATAL_ERROR) + set(msg "that is directory instead of a file!") + else() + set(msg_kind AUTHOR_WARNING) + set(msg "that does not exist as a file (with or without an extension)!") + endif() + message(${msg_kind} "Data file referenced by argument\n" " ${arg}\n" "corresponds to source tree path\n" " ${reldata}\n" - "that does not exist as a file (with or without an extension)!") + "${msg}") endif() if(external) @@ -591,27 +599,33 @@ function(_ExternalData_arg_find_files pattern regex) set(alg "") endif() if("x${relname}" MATCHES "^x${regex}$" # matches - AND NOT IS_DIRECTORY "${top_src}/${entry}" # not a directory AND NOT "x${relname}" MATCHES "(^x|/)\\.ExternalData_" # not staged obj ) - set(name "${top_src}/${relname}") - set(file "${top_bin}/${relname}") - if(alg) - list(APPEND external "${file}|${name}|${alg}") - elseif(ExternalData_LINK_CONTENT) - _ExternalData_link_content("${name}" alg) - list(APPEND external "${file}|${name}|${alg}") - elseif(NOT top_same) - list(APPEND internal "${file}|${name}") - endif() - if("${relname}" STREQUAL "${reldata}") - set(have_original 1) + if(IS_DIRECTORY "${top_src}/${entry}") + if("${relname}" STREQUAL "${reldata}") + set(have_original_as_dir 1) + endif() + else() + set(name "${top_src}/${relname}") + set(file "${top_bin}/${relname}") + if(alg) + list(APPEND external "${file}|${name}|${alg}") + elseif(ExternalData_LINK_CONTENT) + _ExternalData_link_content("${name}" alg) + list(APPEND external "${file}|${name}|${alg}") + elseif(NOT top_same) + list(APPEND internal "${file}|${name}") + endif() + if("${relname}" STREQUAL "${reldata}") + set(have_original 1) + endif() endif() endif() endforeach() set(external "${external}" PARENT_SCOPE) set(internal "${internal}" PARENT_SCOPE) set(have_original "${have_original}" PARENT_SCOPE) + set(have_original_as_dir "${have_original_as_dir}" PARENT_SCOPE) endfunction() #----------------------------------------------------------------------------- diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index f587985..0d35cca 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -709,7 +709,7 @@ does not match expected value Retrying download. \") file(REMOVE \"\${file}\") - execute_process(COMMAND ${CMAKE_COMMAND} -P \"${download_script}\") + execute_process(COMMAND \${CMAKE_COMMAND} -P \"${download_script}\") endif() endwhile() @@ -1176,6 +1176,8 @@ function(ExternalProject_Add_StepTargets name) _ep_get_step_stampfile(${name} ${step} stamp_file) add_custom_target(${name}-${step} DEPENDS ${stamp_file}) + set_property(TARGET ${name}-${step} PROPERTY LABELS ${name}) + set_property(TARGET ${name}-${step} PROPERTY FOLDER "ExternalProjectTargets/${name}") # Depend on other external projects (target-level). get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS) @@ -1918,6 +1920,9 @@ function(ExternalProject_Add name) # argument was passed, we explicitly set it for the target. add_custom_target(${name} ALL DEPENDS ${complete_stamp_file}) set_property(TARGET ${name} PROPERTY _EP_IS_EXTERNAL_PROJECT 1) + set_property(TARGET ${name} PROPERTY LABELS ${name}) + set_property(TARGET ${name} PROPERTY FOLDER "ExternalProjectTargets/${name}") + _ep_parse_arguments(ExternalProject_Add ${name} _EP_ "${ARGN}") _ep_set_directories(${name}) _ep_get_step_stampfile(${name} "done" done_stamp_file) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index c02809d..1f69620 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -31,8 +31,8 @@ # The following variables affect the behavior of the macros in the # script (in alphebetical order). Note that any of these flags can be # changed multiple times in the same directory before calling -# CUDA_ADD_EXECUTABLE, CUDA_ADD_LIBRARY, CUDA_COMPILE, CUDA_COMPILE_PTX -# or CUDA_WRAP_SRCS:: +# CUDA_ADD_EXECUTABLE, CUDA_ADD_LIBRARY, CUDA_COMPILE, CUDA_COMPILE_PTX, +# CUDA_COMPILE_FATBIN, CUDA_COMPILE_CUBIN or CUDA_WRAP_SRCS:: # # CUDA_64_BIT_DEVICE_CODE (Default matches host bit size) # -- Set to ON to compile for 64 bit device code, OFF for 32 bit device code. @@ -152,6 +152,12 @@ # CUDA_COMPILE_PTX( generated_files file0 file1 ... [OPTIONS ...] ) # -- Returns a list of PTX files generated from the input source files. # +# CUDA_COMPILE_FATBIN( generated_files file0 file1 ... [OPTIONS ...] ) +# -- Returns a list of FATBIN files generated from the input source files. +# +# CUDA_COMPILE_CUBIN( generated_files file0 file1 ... [OPTIONS ...] ) +# -- Returns a list of CUBIN files generated from the input source files. +# # CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME( output_file_var # cuda_target # object_files ) @@ -1016,7 +1022,7 @@ endfunction() # a .cpp or .ptx file. # INPUT: # cuda_target - Target name -# format - PTX or OBJ +# format - PTX, CUBIN, FATBIN or OBJ # FILE1 .. FILEN - The remaining arguments are the sources to be wrapped. # OPTIONS - Extra options to NVCC # OUTPUT: @@ -1202,16 +1208,22 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) set(_cuda_source_format ${format}) endif() - if( ${_cuda_source_format} MATCHES "PTX" ) - set( compile_to_ptx ON ) - elseif( ${_cuda_source_format} MATCHES "OBJ") - set( compile_to_ptx OFF ) + if( ${_cuda_source_format} MATCHES "OBJ") + set( cuda_compile_to_external_module OFF ) else() - message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS for file '${file}': '${_cuda_source_format}'. Use OBJ or PTX.") + set( cuda_compile_to_external_module ON ) + if( ${_cuda_source_format} MATCHES "PTX" ) + set( cuda_compile_to_external_module_type "ptx" ) + elseif( ${_cuda_source_format} MATCHES "CUBIN") + set( cuda_compile_to_external_module_type "cubin" ) + elseif( ${_cuda_source_format} MATCHES "FATBIN") + set( cuda_compile_to_external_module_type "fatbin" ) + else() + message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS for file '${file}': '${_cuda_source_format}'. Use OBJ, PTX, CUBIN or FATBIN.") + endif() endif() - - if(compile_to_ptx) + if(cuda_compile_to_external_module) # Don't use any of the host compilation flags for PTX targets. set(CUDA_HOST_FLAGS) set(CUDA_NVCC_FLAGS_CONFIG) @@ -1226,7 +1238,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) if(CUDA_GENERATED_OUTPUT_DIR) set(cuda_compile_output_dir "${CUDA_GENERATED_OUTPUT_DIR}") else() - if ( compile_to_ptx ) + if ( cuda_compile_to_external_module ) set(cuda_compile_output_dir "${CMAKE_CURRENT_BINARY_DIR}") else() set(cuda_compile_output_dir "${cuda_compile_intermediate_directory}") @@ -1236,10 +1248,10 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) # Add a custom target to generate a c or ptx file. ###################### get_filename_component( basename ${file} NAME ) - if( compile_to_ptx ) + if( cuda_compile_to_external_module ) set(generated_file_path "${cuda_compile_output_dir}") - set(generated_file_basename "${cuda_target}_generated_${basename}.ptx") - set(format_flag "-ptx") + set(generated_file_basename "${cuda_target}_generated_${basename}.${cuda_compile_to_external_module_type}") + set(format_flag "-${cuda_compile_to_external_module_type}") file(MAKE_DIRECTORY "${cuda_compile_output_dir}") else() set(generated_file_path "${cuda_compile_output_dir}/${CMAKE_CFG_INTDIR}") @@ -1262,7 +1274,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) set(custom_target_script "${cuda_compile_intermediate_directory}/${generated_file_basename}.cmake") # Setup properties for obj files: - if( NOT compile_to_ptx ) + if( NOT cuda_compile_to_external_module ) set_source_files_properties("${generated_file}" PROPERTIES EXTERNAL_OBJECT true # This is an object file not to be compiled, but only be linked. @@ -1277,7 +1289,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) set(source_file "${CMAKE_CURRENT_SOURCE_DIR}/${file}") endif() - if( NOT compile_to_ptx AND CUDA_SEPARABLE_COMPILATION) + if( NOT cuda_compile_to_external_module AND CUDA_SEPARABLE_COMPILATION) list(APPEND ${cuda_target}_SEPARABLE_COMPILATION_OBJECTS "${generated_file}") endif() @@ -1294,7 +1306,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) # Build the NVCC made dependency file ################################### set(build_cubin OFF) if ( NOT CUDA_BUILD_EMULATION AND CUDA_BUILD_CUBIN ) - if ( NOT compile_to_ptx ) + if ( NOT cuda_compile_to_external_module ) set ( build_cubin ON ) endif() endif() @@ -1321,8 +1333,8 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) # Create up the comment string file(RELATIVE_PATH generated_file_relative_path "${CMAKE_BINARY_DIR}" "${generated_file}") - if(compile_to_ptx) - set(cuda_build_comment_string "Building NVCC ptx file ${generated_file_relative_path}") + if(cuda_compile_to_external_module) + set(cuda_build_comment_string "Building NVCC ${cuda_compile_to_external_module_type} file ${generated_file_relative_path}") else() set(cuda_build_comment_string "Building NVCC (${cuda_build_type}) object ${generated_file_relative_path}") endif() @@ -1552,21 +1564,29 @@ endmacro() ############################################################################### ############################################################################### -# CUDA COMPILE +# (Internal) helper for manually added cuda source files with specific targets ############################################################################### ############################################################################### -macro(CUDA_COMPILE generated_files) +macro(cuda_compile_base cuda_target format generated_files) # Separate the sources from the options CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN}) # Create custom commands and targets for each file. - CUDA_WRAP_SRCS( cuda_compile OBJ _generated_files ${_sources} ${_cmake_options} + CUDA_WRAP_SRCS( ${cuda_target} ${format} _generated_files ${_sources} ${_cmake_options} OPTIONS ${_options} ) set( ${generated_files} ${_generated_files}) endmacro() +############################################################################### +############################################################################### +# CUDA COMPILE +############################################################################### +############################################################################### +macro(CUDA_COMPILE generated_files) + cuda_compile_base(cuda_compile OBJ ${generated_files} ${ARGN}) +endmacro() ############################################################################### ############################################################################### @@ -1574,17 +1594,28 @@ endmacro() ############################################################################### ############################################################################### macro(CUDA_COMPILE_PTX generated_files) + cuda_compile_base(cuda_compile_ptx PTX ${generated_files} ${ARGN}) +endmacro() - # Separate the sources from the options - CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN}) - # Create custom commands and targets for each file. - CUDA_WRAP_SRCS( cuda_compile_ptx PTX _generated_files ${_sources} ${_cmake_options} - OPTIONS ${_options} ) - - set( ${generated_files} ${_generated_files}) +############################################################################### +############################################################################### +# CUDA COMPILE FATBIN +############################################################################### +############################################################################### +macro(CUDA_COMPILE_FATBIN generated_files) + cuda_compile_base(cuda_compile_fatbin FATBIN ${generated_files} ${ARGN}) +endmacro() +############################################################################### +############################################################################### +# CUDA COMPILE CUBIN +############################################################################### +############################################################################### +macro(CUDA_COMPILE_CUBIN generated_files) + cuda_compile_base(cuda_compile_cubin CUBIN ${generated_files} ${ARGN}) endmacro() + ############################################################################### ############################################################################### # CUDA ADD CUFFT TO TARGET diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index fa420c1..9b633c7 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -40,7 +40,7 @@ find_library(CURSES_CURSES_LIBRARY NAMES curses ) find_library(CURSES_NCURSES_LIBRARY NAMES ncurses ) set(CURSES_USE_NCURSES FALSE) -if(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY) +if(CURSES_NCURSES_LIBRARY AND ((NOT CURSES_CURSES_LIBRARY) OR CURSES_NEED_NCURSES)) set(CURSES_USE_NCURSES TRUE) endif() # http://cygwin.com/ml/cygwin-announce/2010-01/msg00002.html @@ -139,10 +139,20 @@ else() CACHE FILEPATH "The curses library" ${FORCE_IT}) endif() + CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" + cbreak "" CURSES_NCURSES_HAS_CBREAK) + if(NOT CURSES_NCURSES_HAS_CBREAK) + find_library(CURSES_EXTRA_LIBRARY tinfo HINTS "${_cursesLibDir}") + find_library(CURSES_EXTRA_LIBRARY tinfo ) + CHECK_LIBRARY_EXISTS("${CURSES_EXTRA_LIBRARY}" + cbreak "" CURSES_TINFO_HAS_CBREAK) + endif() endif() -find_library(CURSES_EXTRA_LIBRARY cur_colr HINTS "${_cursesLibDir}") -find_library(CURSES_EXTRA_LIBRARY cur_colr ) +if (NOT CURSES_TINFO_HAS_CBREAK) + find_library(CURSES_EXTRA_LIBRARY cur_colr HINTS "${_cursesLibDir}") + find_library(CURSES_EXTRA_LIBRARY cur_colr ) +endif() find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}") find_library(CURSES_FORM_LIBRARY form ) @@ -186,5 +196,7 @@ mark_as_advanced( CURSES_INCLUDE_DIR CURSES_CURSES_HAS_WSYNCUP CURSES_NCURSES_HAS_WSYNCUP + CURSES_NCURSES_HAS_CBREAK + CURSES_TINFO_HAS_CBREAK ) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index a91da33..15bcab8 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -267,6 +267,8 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) /usr/local/lib /usr/lib64 /usr/lib + /usr/X11R6/include + /usr/X11R6/lib /opt/gnome/include /opt/gnome/lib /opt/openwin/include @@ -641,6 +643,10 @@ endif() foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) if(_GTK2_component STREQUAL "gtk") + # Left for compatibility with previous versions. + _GTK2_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h) + _GTK2_FIND_INCLUDE_DIR(X11 X11/Xlib.h) + _GTK2_FIND_INCLUDE_DIR(GLIB glib.h) _GTK2_FIND_INCLUDE_DIR(GLIBCONFIG glibconfig.h) _GTK2_FIND_LIBRARY (GLIB glib false true) @@ -680,11 +686,15 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (PANGOFT2 pangoft2 false true) _GTK2_ADD_TARGET (PANGOFT2 GTK2_DEPENDS pango gobject glib - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) _GTK2_FIND_LIBRARY (PANGOXFT pangoxft false true) _GTK2_ADD_TARGET (PANGOXFT GTK2_DEPENDS pangoft2 pango gobject glib - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) _GTK2_FIND_INCLUDE_DIR(GDK gdk/gdk.h) _GTK2_FIND_INCLUDE_DIR(GDKCONFIG gdkconfig.h) @@ -715,9 +725,6 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_ADD_TARGET (GTK GTK2_DEPENDS gdk atk pangoft2 pango gdk_pixbuf gthread gobject glib GTK2_OPTIONAL_DEPENDS gio pangocairo cairo) - # Left for compatibility with previous versions. It doesn't seem to be required - _GTK2_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h) - elseif(_GTK2_component STREQUAL "gtkmm") _GTK2_FIND_INCLUDE_DIR(SIGC++ sigc++/sigc++.h) @@ -743,29 +750,36 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(CAIROMMCONFIG cairommconfig.h) _GTK2_FIND_LIBRARY (CAIROMM cairomm true true) _GTK2_ADD_TARGET (CAIROMM GTK2_DEPENDS cairo sigc++ - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) _GTK2_FIND_INCLUDE_DIR(PANGOMM pangomm.h) _GTK2_FIND_INCLUDE_DIR(PANGOMMCONFIG pangommconfig.h) _GTK2_FIND_LIBRARY (PANGOMM pangomm true true) _GTK2_ADD_TARGET (PANGOMM GTK2_DEPENDS glibmm sigc++ pango gobject glib GTK2_OPTIONAL_DEPENDS cairomm pangocairo cairo - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) - + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) _GTK2_FIND_INCLUDE_DIR(GDKMM gdkmm.h) _GTK2_FIND_INCLUDE_DIR(GDKMMCONFIG gdkmmconfig.h) _GTK2_FIND_LIBRARY (GDKMM gdkmm true true) _GTK2_ADD_TARGET (GDKMM GTK2_DEPENDS pangomm gtk glibmm sigc++ gdk atk pangoft2 gdk_pixbuf pango gobject glib GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) _GTK2_FIND_INCLUDE_DIR(GTKMM gtkmm.h) _GTK2_FIND_INCLUDE_DIR(GTKMMCONFIG gtkmmconfig.h) _GTK2_FIND_LIBRARY (GTKMM gtkmm true true) _GTK2_ADD_TARGET (GTKMM GTK2_DEPENDS atkmm gdkmm pangomm gtk glibmm sigc++ gdk atk pangoft2 gdk_pixbuf pango gthread gobject glib GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) elseif(_GTK2_component STREQUAL "glade") @@ -773,7 +787,9 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (GLADE glade false true) _GTK2_ADD_TARGET (GLADE GTK2_DEPENDS gtk gdk atk gio pangoft2 gdk_pixbuf pango gobject glib GTK2_OPTIONAL_DEPENDS pangocairo cairo - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) elseif(_GTK2_component STREQUAL "glademm") @@ -782,7 +798,9 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (GLADEMM glademm true true) _GTK2_ADD_TARGET (GLADEMM GTK2_DEPENDS gtkmm glade atkmm gdkmm giomm pangomm glibmm sigc++ gtk gdk atk pangoft2 gdk_pixbuf pango gthread gobject glib GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) else() message(FATAL_ERROR "Unknown GTK2 component ${_component}") diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index c4f911d..6a36ea6 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -116,19 +116,25 @@ function(GTEST_ADD_TESTS executable extra_args) get_property(ARGN TARGET ${executable} PROPERTY SOURCES) endif() set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*") + set(gtest_test_type_regex "(TYPED_TEST|TEST_?[FP]?)") foreach(source ${ARGN}) file(READ "${source}" contents) - string(REGEX MATCHALL "TEST_?[FP]?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) + string(REGEX MATCHALL "${gtest_test_type_regex}\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) foreach(hit ${found_tests}) - string(REGEX MATCH "TEST_?[FP]?" test_type ${hit}) + string(REGEX MATCH "${gtest_test_type_regex}" test_type ${hit}) - # Parameterized tests have a different signature for the filter - if(${test_type} STREQUAL "TEST_P") - string(REGEX REPLACE ${gtest_case_name_regex} "*/\\1.\\2/*" test_name ${hit}) - else() - string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2" test_name ${hit}) - endif() - add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args}) + # Parameterized tests have a different signature for the filter + if(${test_type} STREQUAL "TEST_P") + string(REGEX REPLACE ${gtest_case_name_regex} "*/\\1.\\2/*" test_name ${hit}) + elseif(${test_type} STREQUAL "TEST_F" OR ${test_type} STREQUAL "TEST") + string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2" test_name ${hit}) + elseif(${test_type} STREQUAL "TYPED_TEST") + string(REGEX REPLACE ${gtest_case_name_regex} "\\1/*.\\2" test_name ${hit}) + else() + message(WARNING "Could not parse GTest ${hit} for adding to CTest.") + continue() + endif() + add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args}) endforeach() endforeach() endfunction() diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 4b551e6..307aafc 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -295,25 +295,42 @@ if(MSVC) macro(MFC_FILES_FOR_VERSION version) set(v "${version}") + # Multi-Byte Character Set versions of MFC are available as optional + # addon since Visual Studio 12. So for version 12 or higher, check + # whether they are available and exclude them if they are not. + if("${v}" LESS 12 OR EXISTS "${MSVC${v}_MFC_DIR}/mfc${v}0d.dll") + set(mbcs ON) + else() + set(mbcs OFF) + endif() + if(CMAKE_INSTALL_DEBUG_LIBRARIES) set(MSVC${v}_MFC_DIR "${MSVC${v}_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.DebugMFC") set(__install__libs ${__install__libs} - "${MSVC${v}_MFC_DIR}/mfc${v}0d.dll" "${MSVC${v}_MFC_DIR}/mfc${v}0ud.dll" - "${MSVC${v}_MFC_DIR}/mfcm${v}0d.dll" "${MSVC${v}_MFC_DIR}/mfcm${v}0ud.dll" ) + if(mbcs) + set(__install__libs ${__install__libs} + "${MSVC${v}_MFC_DIR}/mfc${v}0d.dll" + "${MSVC${v}_MFC_DIR}/mfcm${v}0d.dll" + ) + endif() endif() set(MSVC${v}_MFC_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.MFC") if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) set(__install__libs ${__install__libs} - "${MSVC${v}_MFC_DIR}/mfc${v}0.dll" "${MSVC${v}_MFC_DIR}/mfc${v}0u.dll" - "${MSVC${v}_MFC_DIR}/mfcm${v}0.dll" "${MSVC${v}_MFC_DIR}/mfcm${v}0u.dll" ) + if(mbcs) + set(__install__libs ${__install__libs} + "${MSVC${v}_MFC_DIR}/mfc${v}0.dll" + "${MSVC${v}_MFC_DIR}/mfcm${v}0.dll" + ) + endif() endif() # include the language dll's as well as the actuall dll's diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake index 92d262c..7bf6d91 100644 --- a/Modules/Internal/FeatureTesting.cmake +++ b/Modules/Internal/FeatureTesting.cmake @@ -5,8 +5,11 @@ macro(record_compiler_features lang compile_flags feature_list) string(TOLOWER ${lang} lang_lc) file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin") file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" " - extern const char features[] = {\"\"\n") - foreach(feature ${CMAKE_${lang}_KNOWN_FEATURES}) + const char features[] = {\"\"\n") + + get_property(known_features GLOBAL PROPERTY CMAKE_${lang}_KNOWN_FEATURES) + + foreach(feature ${known_features}) if (_cmake_feature_test_${feature}) if (${_cmake_feature_test_${feature}} STREQUAL 1) set(_feature_condition "\"1\" ") @@ -17,7 +20,7 @@ macro(record_compiler_features lang compile_flags feature_list) endif() endforeach() file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" - "\n};\n\nint main(int, char **) { return 0; }\n") + "\n};\n\nint main() { return 0; }\n") try_compile(CMAKE_${lang}_FEATURE_TEST ${CMAKE_BINARY_DIR} "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" diff --git a/Modules/Platform/Darwin-Clang.cmake b/Modules/Platform/Darwin-Clang.cmake index 528873c..4cded47 100644 --- a/Modules/Platform/Darwin-Clang.cmake +++ b/Modules/Platform/Darwin-Clang.cmake @@ -24,4 +24,7 @@ macro(__darwin_compiler_clang lang) set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot") set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=") + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.1) + set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ") + endif() endmacro() diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake index 5fee7e3..87d1d23 100644 --- a/Modules/Platform/Darwin-GNU.cmake +++ b/Modules/Platform/Darwin-GNU.cmake @@ -23,6 +23,10 @@ macro(__darwin_compiler_gnu lang) # GNU does not have -shared on OS X set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") + + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.3) + set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ") + endif() endmacro() macro(cmake_gnu_set_sysroot_flag lang) diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake new file mode 100644 index 0000000..62fb985 --- /dev/null +++ b/Modules/Platform/Darwin-Initialize.cmake @@ -0,0 +1,151 @@ +# Ask xcode-select where to find /Developer or fall back to ancient location. +execute_process(COMMAND xcode-select -print-path + OUTPUT_VARIABLE _stdout + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _stderr + RESULT_VARIABLE _failed) +if(NOT _failed AND IS_DIRECTORY ${_stdout}) + set(OSX_DEVELOPER_ROOT ${_stdout}) +elseif(IS_DIRECTORY "/Developer") + set(OSX_DEVELOPER_ROOT "/Developer") +else() + set(OSX_DEVELOPER_ROOT "") +endif() + +execute_process(COMMAND sw_vers -productVersion + OUTPUT_VARIABLE CURRENT_OSX_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + +# Save CMAKE_OSX_ARCHITECTURES from the environment. +set(CMAKE_OSX_ARCHITECTURES "$ENV{CMAKE_OSX_ARCHITECTURES}" CACHE STRING + "Build architectures for OSX") + +#---------------------------------------------------------------------------- +# _CURRENT_OSX_VERSION - as a two-component string: 10.5, 10.6, ... +# +string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1" + _CURRENT_OSX_VERSION "${CURRENT_OSX_VERSION}") + +#---------------------------------------------------------------------------- +# CMAKE_OSX_DEPLOYMENT_TARGET + +# Set cache variable - end user may change this during ccmake or cmake-gui configure. +if(_CURRENT_OSX_VERSION VERSION_GREATER 10.3) + set(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING + "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.") +endif() + +#---------------------------------------------------------------------------- +# CMAKE_OSX_SYSROOT + +if(CMAKE_OSX_SYSROOT) + # Use the existing value without further computation to choose a default. + set(_CMAKE_OSX_SYSROOT_DEFAULT "${CMAKE_OSX_SYSROOT}") +elseif(NOT "x$ENV{SDKROOT}" STREQUAL "x" AND + (NOT "x$ENV{SDKROOT}" MATCHES "/" OR IS_DIRECTORY "$ENV{SDKROOT}")) + # Use the value of SDKROOT from the environment. + set(_CMAKE_OSX_SYSROOT_DEFAULT "$ENV{SDKROOT}") +elseif("${CMAKE_GENERATOR}" MATCHES Xcode + OR CMAKE_OSX_DEPLOYMENT_TARGET + OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]" + OR NOT EXISTS "/usr/include/sys/types.h") + # Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs directory. + set(_CMAKE_OSX_SDKS_DIR "") + if(OSX_DEVELOPER_ROOT) + foreach(d Platforms/MacOSX.platform/Developer/SDKs SDKs) + file(GLOB _CMAKE_OSX_SDKS ${OSX_DEVELOPER_ROOT}/${d}/*) + if(_CMAKE_OSX_SDKS) + set(_CMAKE_OSX_SDKS_DIR ${OSX_DEVELOPER_ROOT}/${d}) + break() + endif() + endforeach() + endif() + + if(_CMAKE_OSX_SDKS_DIR) + # Select SDK for current OSX version accounting for the known + # specially named SDKs. + set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.4 "u") + set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.3 ".9") + + # find the latest SDK + set(_CMAKE_OSX_LATEST_SDK_VERSION "0.0") + file(GLOB _CMAKE_OSX_SDKS RELATIVE "${_CMAKE_OSX_SDKS_DIR}" "${_CMAKE_OSX_SDKS_DIR}/MacOSX*.sdk") + foreach(_SDK ${_CMAKE_OSX_SDKS}) + if(_SDK MATCHES "MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk" AND CMAKE_MATCH_1 VERSION_GREATER ${_CMAKE_OSX_LATEST_SDK_VERSION}) + set(_CMAKE_OSX_LATEST_SDK_VERSION "${CMAKE_MATCH_1}") + endif() + endforeach() + + # pick an SDK that works + set(_CMAKE_OSX_SYSROOT_DEFAULT) + foreach(ver ${CMAKE_OSX_DEPLOYMENT_TARGET} + ${_CURRENT_OSX_VERSION} + ${_CMAKE_OSX_LATEST_SDK_VERSION}) + set(_CMAKE_OSX_DEPLOYMENT_TARGET ${ver}) + set(_CMAKE_OSX_SDKS_VER ${_CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CMAKE_OSX_DEPLOYMENT_TARGET}}) + set(_CMAKE_OSX_SYSROOT_CHECK "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk") + if(IS_DIRECTORY "${_CMAKE_OSX_SYSROOT_CHECK}") + set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SYSROOT_CHECK}") + break() + endif() + endforeach() + + if(CMAKE_OSX_DEPLOYMENT_TARGET AND + NOT CMAKE_OSX_DEPLOYMENT_TARGET VERSION_EQUAL ${_CMAKE_OSX_DEPLOYMENT_TARGET}) + set(_CMAKE_OSX_SDKS_VER ${CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${CMAKE_OSX_DEPLOYMENT_TARGET}}) + set(_CMAKE_OSX_SYSROOT_CHECK "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk") + message(WARNING + "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' " + "but the matching SDK does not exist at:\n \"${_CMAKE_OSX_SYSROOT_CHECK}\"\n" + "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"." + ) + endif() + else() + # Assume developer files are in root (such as Xcode 4.5 command-line tools). + set(_CMAKE_OSX_SYSROOT_DEFAULT "") + endif() +endif() + +# Set cache variable - end user may change this during ccmake or cmake-gui configure. +# Choose the type based on the current value. +set(_CMAKE_OSX_SYSROOT_TYPE STRING) +foreach(v CMAKE_OSX_SYSROOT _CMAKE_OSX_SYSROOT_DEFAULT) + if("x${${v}}" MATCHES "/") + set(_CMAKE_OSX_SYSROOT_TYPE PATH) + break() + endif() +endforeach() +set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_DEFAULT}" CACHE ${_CMAKE_OSX_SYSROOT_TYPE} + "The product will be built against the headers and libraries located inside the indicated SDK.") + +# Transform the cached value to something we can use. +set(_CMAKE_OSX_SYSROOT_ORIG "${CMAKE_OSX_SYSROOT}") +set(_CMAKE_OSX_SYSROOT_PATH "") +if(CMAKE_OSX_SYSROOT) + if("x${CMAKE_OSX_SYSROOT}" MATCHES "/") + # This is a path to the SDK. Make sure it exists. + if(NOT IS_DIRECTORY "${CMAKE_OSX_SYSROOT}") + message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n" + "because the directory does not exist.") + set(CMAKE_OSX_SYSROOT "") + set(_CMAKE_OSX_SYSROOT_ORIG "") + endif() + set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}") + else() + # Transform the sdk name into a path. + execute_process( + COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path + OUTPUT_VARIABLE _stdout + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _stderr + RESULT_VARIABLE _failed + ) + if(NOT _failed AND IS_DIRECTORY "${_stdout}") + set(_CMAKE_OSX_SYSROOT_PATH "${_stdout}") + # For non-Xcode generators use the path. + if(NOT "${CMAKE_GENERATOR}" MATCHES "Xcode") + set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}") + endif() + endif() + endif() +endif() diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index df0756b..e25df1e 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -64,143 +64,6 @@ if(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) mark_as_advanced(CMAKE_INSTALL_NAME_TOOL) endif() -# Ask xcode-select where to find /Developer or fall back to ancient location. -execute_process(COMMAND xcode-select -print-path - OUTPUT_VARIABLE _stdout - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE _stderr - RESULT_VARIABLE _failed) -if(NOT _failed AND IS_DIRECTORY ${_stdout}) - set(OSX_DEVELOPER_ROOT ${_stdout}) -elseif(IS_DIRECTORY "/Developer") - set(OSX_DEVELOPER_ROOT "/Developer") -else() - set(OSX_DEVELOPER_ROOT "") -endif() - -execute_process(COMMAND sw_vers -productVersion - OUTPUT_VARIABLE CURRENT_OSX_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE) - -# Save CMAKE_OSX_ARCHITECTURES from the environment. -set(CMAKE_OSX_ARCHITECTURES "$ENV{CMAKE_OSX_ARCHITECTURES}" CACHE STRING - "Build architectures for OSX") - -#---------------------------------------------------------------------------- -# _CURRENT_OSX_VERSION - as a two-component string: 10.5, 10.6, ... -# -string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1" - _CURRENT_OSX_VERSION "${CURRENT_OSX_VERSION}") - -#---------------------------------------------------------------------------- -# CMAKE_OSX_DEPLOYMENT_TARGET - -# Set cache variable - end user may change this during ccmake or cmake-gui configure. -if(_CURRENT_OSX_VERSION VERSION_GREATER 10.3) - set(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING - "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.") -endif() - -#---------------------------------------------------------------------------- -# CMAKE_OSX_SYSROOT - -if(CMAKE_OSX_SYSROOT) - # Use the existing value without further computation to choose a default. - set(_CMAKE_OSX_SYSROOT_DEFAULT "${CMAKE_OSX_SYSROOT}") -elseif(NOT "x$ENV{SDKROOT}" STREQUAL "x" AND - (NOT "x$ENV{SDKROOT}" MATCHES "/" OR IS_DIRECTORY "$ENV{SDKROOT}")) - # Use the value of SDKROOT from the environment. - set(_CMAKE_OSX_SYSROOT_DEFAULT "$ENV{SDKROOT}") -elseif("${CMAKE_GENERATOR}" MATCHES Xcode - OR CMAKE_OSX_DEPLOYMENT_TARGET - OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]" - OR NOT EXISTS "/usr/include/sys/types.h") - # Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs directory. - set(_CMAKE_OSX_SDKS_DIR "") - if(OSX_DEVELOPER_ROOT) - foreach(d Platforms/MacOSX.platform/Developer/SDKs SDKs) - file(GLOB _CMAKE_OSX_SDKS ${OSX_DEVELOPER_ROOT}/${d}/*) - if(_CMAKE_OSX_SDKS) - set(_CMAKE_OSX_SDKS_DIR ${OSX_DEVELOPER_ROOT}/${d}) - break() - endif() - endforeach() - endif() - - if(_CMAKE_OSX_SDKS_DIR) - # Select SDK for current OSX version accounting for the known - # specially named SDKs. - set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.4 "u") - set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.3 ".9") - if(CMAKE_OSX_DEPLOYMENT_TARGET) - set(_CMAKE_OSX_SDKS_VER ${CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${CMAKE_OSX_DEPLOYMENT_TARGET}}) - set(_CMAKE_OSX_SYSROOT_CHECK "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk") - if(IS_DIRECTORY "${_CMAKE_OSX_SYSROOT_CHECK}") - set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SYSROOT_CHECK}") - else() - set(_CMAKE_OSX_SDKS_VER ${_CURRENT_OSX_VERSION}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CURRENT_OSX_VERSION}}) - set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk") - message(WARNING - "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' " - "but the matching SDK does not exist at:\n \"${_CMAKE_OSX_SYSROOT_CHECK}\"\n" - "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"\n" - "matching the host OS X version." - ) - endif() - else() - set(_CMAKE_OSX_SDKS_VER ${_CURRENT_OSX_VERSION}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CURRENT_OSX_VERSION}}) - set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk") - endif() - else() - # Assume developer files are in root (such as Xcode 4.5 command-line tools). - set(_CMAKE_OSX_SYSROOT_DEFAULT "") - endif() -endif() - -# Set cache variable - end user may change this during ccmake or cmake-gui configure. -# Choose the type based on the current value. -set(_CMAKE_OSX_SYSROOT_TYPE STRING) -foreach(v CMAKE_OSX_SYSROOT _CMAKE_OSX_SYSROOT_DEFAULT) - if("x${${v}}" MATCHES "/") - set(_CMAKE_OSX_SYSROOT_TYPE PATH) - break() - endif() -endforeach() -set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_DEFAULT}" CACHE ${_CMAKE_OSX_SYSROOT_TYPE} - "The product will be built against the headers and libraries located inside the indicated SDK.") - -# Transform the cached value to something we can use. -set(_CMAKE_OSX_SYSROOT_ORIG "${CMAKE_OSX_SYSROOT}") -set(_CMAKE_OSX_SYSROOT_PATH "") -if(CMAKE_OSX_SYSROOT) - if("x${CMAKE_OSX_SYSROOT}" MATCHES "/") - # This is a path to the SDK. Make sure it exists. - if(NOT IS_DIRECTORY "${CMAKE_OSX_SYSROOT}") - message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n" - "because the directory does not exist.") - set(CMAKE_OSX_SYSROOT "") - set(_CMAKE_OSX_SYSROOT_ORIG "") - endif() - set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}") - else() - # Transform the sdk name into a path. - execute_process( - COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path - OUTPUT_VARIABLE _stdout - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE _stderr - RESULT_VARIABLE _failed - ) - if(NOT _failed AND IS_DIRECTORY "${_stdout}") - set(_CMAKE_OSX_SYSROOT_PATH "${_stdout}") - # For non-Xcode generators use the path. - if(NOT "${CMAKE_GENERATOR}" MATCHES "Xcode") - set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}") - endif() - endif() - endif() -endif() - # Make sure the combination of SDK and Deployment Target are allowed if(CMAKE_OSX_DEPLOYMENT_TARGET) if("${_CMAKE_OSX_SYSROOT_PATH}" MATCHES "/MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk") diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index eca3280..20ee1d1 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -83,7 +83,7 @@ list(APPEND CMAKE_SYSTEM_PROGRAM_PATH ) list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES - /lib /usr/lib /usr/lib32 /usr/lib64 + /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64 ) list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index b1b12d6..8c4daac 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -135,7 +135,9 @@ function (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target set(targetincludes) set(targetdefines) else() - file(WRITE ${_moc_parameters_file} "${_moc_parameters}\n") + set(CMAKE_CONFIGURABLE_FILE_CONTENT "${_moc_parameters}") + configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" + "${_moc_parameters_file}" @ONLY) endif() set(_moc_extra_parameters_file @${_moc_parameters_file}) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index fa11585..918e2ec 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -2,9 +2,7 @@ # UseSWIG # ------- # -# SWIG module for CMake -# -# Defines the following macros: +# Defines the following macros for use with SWIG: # # :: # @@ -13,20 +11,38 @@ # SWIG_LINK_LIBRARIES(name [ libraries ]) # - Link libraries to swig module # -# All other macros are for internal use only. To get the actual name of -# the swig module, use: ${SWIG_MODULE_${name}_REAL_NAME}. Set Source -# files properties such as CPLUSPLUS and SWIG_FLAGS to specify special -# behavior of SWIG. Also global CMAKE_SWIG_FLAGS can be used to add -# special flags to all swig calls. Another special variable is -# CMAKE_SWIG_OUTDIR, it allows one to specify where to write all the -# swig generated module (swig -outdir option) The name-specific variable -# SWIG_MODULE_<name>_EXTRA_DEPS may be used to specify extra -# dependencies for the generated modules. If the source file generated -# by swig need some special flag you can use:: +# Source files properties on module files can be set before the invocation +# of the SWIG_ADD_MODULE macro to specify special behavior of SWIG. # -# set_source_files_properties( ${swig_generated_file_fullname} -# PROPERTIES COMPILE_FLAGS "-bla") - +# The source file property CPLUSPLUS calls SWIG in c++ mode, e.g.:: +# +# set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON) +# swig_add_module(mymod python mymod.i) +# +# The source file property SWIG_FLAGS adds custom flags to the SWIG executable. +# +# The source-file property SWIG_MODULE_NAME have to be provided to specify the actual +# import name of the module in the target language if it cannot be scanned automatically +# from source or different from the module file basename.:: +# +# set_property(SOURCE mymod.i PROPERTY SWIG_MODULE_NAME mymod_realname) +# +# To get the name of the swig module target library, use: ${SWIG_MODULE_${name}_REAL_NAME}. +# +# Also some variables can be set to specify special behavior of SWIG. +# +# CMAKE_SWIG_FLAGS can be used to add special flags to all swig calls. +# +# Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify +# where to write all the swig generated module (swig -outdir option) +# +# The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used to specify extra +# dependencies for the generated modules. +# +# If the source file generated by swig need some special flag you can use:: +# +# set_source_files_properties( ${swig_generated_file_fullname} +# PROPERTIES COMPILE_FLAGS "-bla") #============================================================================= # Copyright 2004-2009 Kitware, Inc. @@ -86,7 +102,30 @@ macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile) get_source_file_property(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename ${infile} SWIG_MODULE_NAME) if(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND") - get_filename_component(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${infile}" NAME_WE) + + # try to get module name from "%module foo" syntax + if ( EXISTS ${infile} ) + file ( STRINGS ${infile} _MODULE_NAME REGEX "[ ]*%module[ ]*[a-zA-Z0-9_]+.*" ) + endif () + if ( _MODULE_NAME ) + string ( REGEX REPLACE "[ ]*%module[ ]*([a-zA-Z0-9_]+).*" "\\1" _MODULE_NAME "${_MODULE_NAME}" ) + set(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${_MODULE_NAME}") + + else () + # try to get module name from "%module (options=...) foo" syntax + if ( EXISTS ${infile} ) + file ( STRINGS ${infile} _MODULE_NAME REGEX "[ ]*%module[ ]*\\(.*\\)[ ]*[a-zA-Z0-9_]+.*" ) + endif () + if ( _MODULE_NAME ) + string ( REGEX REPLACE "[ ]*%module[ ]*\\(.*\\)[ ]*([a-zA-Z0-9_]+).*" "\\1" _MODULE_NAME "${_MODULE_NAME}" ) + set(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${_MODULE_NAME}") + + else () + # fallback to file basename + get_filename_component(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename ${infile} NAME_WE) + endif () + endif () + endif() foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSION}) set(${outfiles} ${${outfiles}} @@ -205,6 +244,8 @@ macro(SWIG_ADD_MODULE name language) if ("${swig_lowercase_language}" STREQUAL "octave") set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".oct") + elseif ("${swig_lowercase_language}" STREQUAL "go") + set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") elseif ("${swig_lowercase_language}" STREQUAL "java") if (APPLE) # In java you want: @@ -215,6 +256,8 @@ macro(SWIG_ADD_MODULE name language) # Linux : libLIBRARY.so set_target_properties (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib") endif () + elseif ("${swig_lowercase_language}" STREQUAL "lua") + set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") elseif ("${swig_lowercase_language}" STREQUAL "python") # this is only needed for the python case where a _modulename.so is generated set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") |