diff options
74 files changed, 1016 insertions, 66 deletions
diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index 4ab9786..81adea0 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -376,10 +376,10 @@ documentation: See the :manual:`cmake-policies(7)` manual and the :command:`cmake_policy` command. -``prop_cache, prop_dir, prop_gbl, prop_sf, prop_test, prop_tgt`` - A CMake cache, directory, global, source file, test, or target - property, respectively. See the :manual:`cmake-properties(7)` manual - and the :command:`set_property` command. +``prop_cache, prop_dir, prop_gbl, prop_sf, prop_inst, prop_test, prop_tgt`` + A CMake cache, directory, global, source file, installed file, test, + or target property, respectively. See the :manual:`cmake-properties(7)` + manual and the :command:`set_property` command. ``variable`` A CMake language variable. diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 52dfd02..e4546c1 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -308,3 +308,12 @@ Properties on Cache Entries /prop_cache/STRINGS /prop_cache/TYPE /prop_cache/VALUE + +Properties on Installed Files +============================= + +.. toctree:: + :maxdepth: 1 + + /prop_inst/CPACK_NEVER_OVERWRITE.rst + /prop_inst/CPACK_PERMANENT.rst diff --git a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst index ed89d40..cf35467 100644 --- a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst @@ -14,6 +14,11 @@ compile features. The features known to this version of CMake are: +``cxx_aggregate_default_initializers`` + Aggregate default initializers, as defined in N3605_. + + .. _N3605: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3605.html + ``cxx_alias_templates`` Template aliases, as defined in N2258_. @@ -34,16 +39,31 @@ The features known to this version of CMake are: .. _N2761: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf +``cxx_attribute_deprecated`` + ``[[deprecated]]`` attribute, as defined in N3760_. + + .. _N3760: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3760.html + ``cxx_auto_type`` Automatic type deduction, as defined in N1984_. .. _N1984: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf +``cxx_binary_literals`` + Binary literals, as defined in N3472_. + + .. _N3472: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3472.pdf + ``cxx_constexpr`` Constant expressions, as defined in N2235_. .. _N2235: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf +``cxx_contextual_conversions`` + Contextual conversions, as defined in N3323_. + + .. _N3323: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3323.pdf + ``cxx_decltype_incomplete_return_types`` Decltype on incomplete return types, as defined in N3276_. @@ -54,6 +74,11 @@ The features known to this version of CMake are: .. _N2343: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf +``cxx_decltype_auto`` + ``decltype(auto)`` semantics, as defined in N3638_. + + .. _N3638: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3638.html + ``cxx_default_function_template_args`` Default template arguments for function templates, as defined in DR226_ @@ -79,6 +104,11 @@ The features known to this version of CMake are: .. _N2346: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm +``cxx_digit_separators`` + Digit separators, as defined in N3781_. + + .. _N3781: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf + ``cxx_enum_forward_declarations`` Enum forward declarations, as defined in N2764_. @@ -114,6 +144,11 @@ The features known to this version of CMake are: .. _N2672: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm +``cxx_generic_lambdas`` + Generic lambdas, ss defined in N3649_. + + .. _N3649: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3649.html + ``cxx_inheriting_constructors`` Inheriting constructors, as defined in N2540_. @@ -129,6 +164,11 @@ The features known to this version of CMake are: .. _N2927: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2927.pdf +``cxx_lambda_init_captures`` + Initialized lambda captures, as defined in N3648_. + + .. _N3648: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3648.html + ``cxx_local_type_template_args`` Local and unnamed types as template arguments, as defined in N2657_. @@ -174,6 +214,16 @@ The features known to this version of CMake are: .. _N2439: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm +``cxx_relaxed_constexpr`` + Relaxed constexpr, as defined in N3652_. + + .. _N3652: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3652.html + +``cxx_return_type_deduction`` + Return type deduction on normal functions, as defined in N3386_. + + .. _N3386: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3386.html + ``cxx_right_angle_brackets`` Right angle bracket parsing, as defined in N1757_. @@ -229,6 +279,11 @@ The features known to this version of CMake are: .. _N2765: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf +``cxx_variable_templates`` + Variable templates, as defined in N3651_. + + .. _N3651: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3651.pdf + ``cxx_variadic_macros`` Variadic macros, as defined in N1653_. diff --git a/Help/prop_inst/CPACK_NEVER_OVERWRITE.rst b/Help/prop_inst/CPACK_NEVER_OVERWRITE.rst new file mode 100644 index 0000000..11f44d0 --- /dev/null +++ b/Help/prop_inst/CPACK_NEVER_OVERWRITE.rst @@ -0,0 +1,6 @@ +CPACK_NEVER_OVERWRITE +--------------------- + +Request that this file not be overwritten on install or reinstall. + +The property is currently only supported by the WIX generator. diff --git a/Help/prop_inst/CPACK_PERMANENT.rst b/Help/prop_inst/CPACK_PERMANENT.rst new file mode 100644 index 0000000..5e191d0 --- /dev/null +++ b/Help/prop_inst/CPACK_PERMANENT.rst @@ -0,0 +1,6 @@ +CPACK_PERMANENT +--------------- + +Request that this file not be removed on uninstall. + +The property is currently only supported by the WIX generator. diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 6e531ca..af79a31 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -5,6 +5,7 @@ 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_CXX14_COMPILE_FEATURES "@CMAKE_CXX14_COMPILE_FEATURES@") set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@") set(CMAKE_CXX_SIMULATE_ID "@CMAKE_CXX_SIMULATE_ID@") diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompileFeatures.cmake index da68e94..2bb7a74 100644 --- a/Modules/CMakeDetermineCompileFeatures.cmake +++ b/Modules/CMakeDetermineCompileFeatures.cmake @@ -57,6 +57,7 @@ function(cmake_determine_compile_features lang) set(CMAKE_CXX98_COMPILE_FEATURES) set(CMAKE_CXX11_COMPILE_FEATURES) + set(CMAKE_CXX14_COMPILE_FEATURES) include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake") @@ -67,7 +68,10 @@ function(cmake_determine_compile_features lang) return() endif() - if (CMAKE_CXX11_COMPILE_FEATURES AND CMAKE_CXX98_COMPILE_FEATURES) + if (CMAKE_CXX11_COMPILE_FEATURES AND CMAKE_CXX14_COMPILE_FEATURES) + list(REMOVE_ITEM CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES}) + endif() + if (CMAKE_CXX98_COMPILE_FEATURES AND CMAKE_CXX11_COMPILE_FEATURES) list(REMOVE_ITEM CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES}) endif() @@ -75,12 +79,14 @@ function(cmake_determine_compile_features lang) set(CMAKE_CXX_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES} ${CMAKE_CXX11_COMPILE_FEATURES} + ${CMAKE_CXX14_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) + set(CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX14_COMPILE_FEATURES} PARENT_SCOPE) message(STATUS "Detecting ${lang} compile features - done") endif() diff --git a/Modules/Compiler/Clang-CXX-FeatureTests.cmake b/Modules/Compiler/Clang-CXX-FeatureTests.cmake index c4092c4..4c532fb 100644 --- a/Modules/Compiler/Clang-CXX-FeatureTests.cmake +++ b/Modules/Compiler/Clang-CXX-FeatureTests.cmake @@ -7,7 +7,9 @@ set(testable_features cxx_alignas cxx_attributes cxx_auto_type + cxx_binary_literals cxx_constexpr + cxx_contextual_conversions cxx_decltype cxx_decltype_incomplete_return_types cxx_default_function_template_args @@ -25,6 +27,8 @@ set(testable_features cxx_range_for cxx_raw_string_literals cxx_reference_qualified_functions + cxx_relaxed_constexpr + cxx_return_type_deduction cxx_rvalue_references cxx_static_assert cxx_strong_enums @@ -32,6 +36,7 @@ set(testable_features cxx_unicode_literals cxx_unrestricted_unions cxx_user_literals + cxx_variable_templates cxx_variadic_templates ) @@ -43,12 +48,24 @@ endforeach() unset(testable_features) +set(_cmake_feature_test_cxx_aggregate_default_initializers "${_cmake_oldestSupported} && __has_feature(cxx_aggregate_nsdmi)") + set(_cmake_feature_test_cxx_trailing_return_types "${_cmake_oldestSupported} && __has_feature(cxx_trailing_return)") set(_cmake_feature_test_cxx_alignof "${_cmake_oldestSupported} && __has_feature(cxx_alignas)") set(_cmake_feature_test_cxx_final "${_cmake_oldestSupported} && __has_feature(cxx_override_control)") set(_cmake_feature_test_cxx_override "${_cmake_oldestSupported} && __has_feature(cxx_override_control)") set(_cmake_feature_test_cxx_uniform_initialization "${_cmake_oldestSupported} && __has_feature(cxx_generalized_initializers)") set(_cmake_feature_test_cxx_defaulted_move_initializers "${_cmake_oldestSupported} && __has_feature(cxx_defaulted_functions)") +set(_cmake_feature_test_cxx_lambda_init_captures "${_cmake_oldestSupported} && __has_feature(cxx_init_captures)") + +set(Clang34_CXX14 "((__clang_major__ * 100) + __clang_minor__) >= 304 && __cplusplus > 201103L") +# http://llvm.org/bugs/show_bug.cgi?id=19242 +set(_cmake_feature_test_cxx_attribute_deprecated "${Clang34_CXX14}") +# http://llvm.org/bugs/show_bug.cgi?id=19698 +set(_cmake_feature_test_cxx_decltype_auto "${Clang34_CXX14}") +set(_cmake_feature_test_cxx_digit_separators "${Clang34_CXX14}") +# http://llvm.org/bugs/show_bug.cgi?id=19674 +set(_cmake_feature_test_cxx_generic_lambdas "${Clang34_CXX14}") # TODO: Should be supported by Clang 3.1 set(Clang31_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L") diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index c65c22c..9c98e44 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -2,6 +2,26 @@ # Reference: http://gcc.gnu.org/projects/cxx0x.html set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 407") + +set(GNU49_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L") +set(_cmake_feature_test_cxx_contextual_conversions "${GNU49_CXX14}") +set(_cmake_feature_test_cxx_attribute_deprecated "${GNU49_CXX14}") +set(_cmake_feature_test_cxx_decltype_auto "${GNU49_CXX14}") +set(_cmake_feature_test_cxx_digit_separators "${GNU49_CXX14}") +set(_cmake_feature_test_cxx_generic_lambdas "${GNU49_CXX14}") +set(_cmake_feature_test_cxx_lambda_init_captures "${GNU49_CXX14}") +# GNU 4.3 supports binary literals as an extension, but may warn about +# use of extensions prior to GNU 4.9 +# http://stackoverflow.com/questions/16334024/difference-between-gcc-binary-literals-and-c14-ones +set(_cmake_feature_test_cxx_binary_literals "${GNU49_CXX14}") +# The feature below is documented as available in GNU 4.8 (by implementing an +# earlier draft of the standard paper), but that version of the compiler +# does not set __cplusplus to a value greater than 201103L until GNU 4.9: +# http://gcc.gnu.org/onlinedocs/gcc-4.8.2/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros +# http://gcc.gnu.org/onlinedocs/gcc-4.9.0/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros +# So, CMake only reports availability for it with GNU 4.9 or later. +set(_cmake_feature_test_cxx_return_type_deduction "${GNU49_CXX14}") + # Introduced in GCC 4.8.1 set(GNU481_CXX11 "((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L") set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${GNU481_CXX11}") diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index 1ecdad2..14dc76a 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -24,6 +24,11 @@ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.3) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x") endif() +if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") +endif() + set(CMAKE_CXX_STANDARD_DEFAULT 98) macro(cmake_record_cxx_compile_features) @@ -31,8 +36,14 @@ macro(cmake_record_cxx_compile_features) record_compiler_features(CXX "-std=${std_version}" ${list}) endmacro() + set(_result 0) + if (UNIX AND NOT APPLE AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) + _get_gcc_features(c++1y CMAKE_CXX14_COMPILE_FEATURES) + endif() if (UNIX AND NOT APPLE AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) - _get_gcc_features(c++11 CMAKE_CXX11_COMPILE_FEATURES) + if (_result EQUAL 0) + _get_gcc_features(c++11 CMAKE_CXX11_COMPILE_FEATURES) + endif() if (_result EQUAL 0) _get_gcc_features(c++98 CMAKE_CXX98_COMPILE_FEATURES) endif() diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 1779b78..7d46d15 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -51,7 +51,9 @@ # wants explicit full paths and this trickery doesn't work too well. # I'm going to attempt to cut out the middleman and hope # everything still works. -find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h +find_path( + FREETYPE_INCLUDE_DIR_ft2build + ft2build.h HINTS ENV FREETYPE_DIR PATHS @@ -62,10 +64,14 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h ENV GTKMM_BASEPATH [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] - PATH_SUFFIXES include/freetype2 include freetype2 + PATH_SUFFIXES + include/freetype2 + include + freetype2 ) -find_path(FREETYPE_INCLUDE_DIR_freetype2 +find_path( + FREETYPE_INCLUDE_DIR_freetype2 NAMES freetype/config/ftheader.h config/ftheader.h @@ -79,14 +85,19 @@ find_path(FREETYPE_INCLUDE_DIR_freetype2 ENV GTKMM_BASEPATH [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] - PATH_SUFFIXES include/freetype2 include freetype2 + PATH_SUFFIXES + include/freetype2 + include + freetype2 ) find_library(FREETYPE_LIBRARY - NAMES freetype libfreetype freetype219 + NAMES + freetype + libfreetype + freetype219 HINTS ENV FREETYPE_DIR - PATH_SUFFIXES lib PATHS /usr/X11R6 /usr/local/X11R6 @@ -95,6 +106,8 @@ find_library(FREETYPE_LIBRARY ENV GTKMM_BASEPATH [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] + PATH_SUFFIXES + lib ) # set the user variables @@ -111,31 +124,41 @@ elseif(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h") endif() if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H) - file(STRINGS "${FREETYPE_H}" freetype_version_str - REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$") + file(STRINGS "${FREETYPE_H}" freetype_version_str + REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$") - unset(FREETYPE_VERSION_STRING) - foreach(VPART MAJOR MINOR PATCH) - foreach(VLINE ${freetype_version_str}) - if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$") - set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}") - if(FREETYPE_VERSION_STRING) - set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}") - else() - set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}") - endif() - unset(FREETYPE_VERSION_PART) - endif() - endforeach() + unset(FREETYPE_VERSION_STRING) + foreach(VPART MAJOR MINOR PATCH) + foreach(VLINE ${freetype_version_str}) + if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$") + set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}") + if(FREETYPE_VERSION_STRING) + set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}") + else() + set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}") + endif() + unset(FREETYPE_VERSION_PART) + endif() endforeach() + endforeach() endif() # handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if # all listed variables are TRUE include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype - REQUIRED_VARS FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS - VERSION_VAR FREETYPE_VERSION_STRING) -mark_as_advanced(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build) +find_package_handle_standard_args( + Freetype + REQUIRED_VARS + FREETYPE_LIBRARY + FREETYPE_INCLUDE_DIRS + VERSION_VAR + FREETYPE_VERSION_STRING +) + +mark_as_advanced( + FREETYPE_LIBRARY + FREETYPE_INCLUDE_DIR_freetype2 + FREETYPE_INCLUDE_DIR_ft2build +) diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 990acea..ffc5657 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -154,6 +154,7 @@ macro(__windows_compiler_gnu_abi lang) find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars32.bat DOC "Visual Studio vcvars32.bat" PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC;ProductDir]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin" @@ -163,9 +164,10 @@ macro(__windows_compiler_gnu_abi lang) ) set(CMAKE_GNUtoMS_ARCH x86) elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvarsamd64.bat + find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars64.bat vcvarsamd64.bat DOC "Visual Studio vcvarsamd64.bat" PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC;ProductDir]/bin/amd64" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin/amd64" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin/amd64" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin/amd64" diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 660c0c5..8ecf83c 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -163,6 +163,8 @@ set(SRCS cmComputeLinkInformation.h cmComputeTargetDepends.h cmComputeTargetDepends.cxx + cmCPackPropertiesGenerator.h + cmCPackPropertiesGenerator.cxx cmCryptoHash.cxx cmCryptoHash.h cmCustomCommand.cxx @@ -243,6 +245,8 @@ set(SRCS cmInstallGenerator.h cmInstallGenerator.cxx cmInstallExportGenerator.cxx + cmInstalledFile.h + cmInstalledFile.cxx cmInstallFilesGenerator.h cmInstallFilesGenerator.cxx cmInstallScriptGenerator.h diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 659b695..1640c73 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140527) +set(CMake_VERSION_PATCH 20140529) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index ec59715..a2995d1 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -15,6 +15,7 @@ #include <cmSystemTools.h> #include <cmGeneratedFileStream.h> #include <cmCryptoHash.h> +#include <cmInstalledFile.h> #include <CPack/cmCPackLog.h> #include <CPack/cmCPackComponentGroup.h> @@ -871,8 +872,11 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( } else { + cmInstalledFile const* installedFile = + this->GetInstalledFile(relativePath); + std::string componentId = fileDefinitions.EmitComponentFile( - directoryId, id, fullPath, *(this->Patch)); + directoryId, id, fullPath, *(this->Patch), installedFile); featureDefinitions.EmitComponentRef(componentId); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index 3fd959e..451188e 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -12,6 +12,8 @@ #include "cmWIXFilesSourceWriter.h" +#include <cmInstalledFile.h> + #include <sys/types.h> #include <sys/stat.h> @@ -135,7 +137,8 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile( std::string const& directoryId, std::string const& id, std::string const& filePath, - cmWIXPatch &patch) + cmWIXPatch &patch, + cmInstalledFile const* installedFile) { std::string componentId = std::string("CM_C") + id; std::string fileId = std::string("CM_F") + id; @@ -147,6 +150,18 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile( AddAttribute("Id", componentId); AddAttribute("Guid", "*"); + if(installedFile) + { + if(installedFile->GetPropertyAsBool("CPACK_NEVER_OVERWRITE")) + { + AddAttribute("NeverOverwrite", "yes"); + } + if(installedFile->GetPropertyAsBool("CPACK_PERMANENT")) + { + AddAttribute("Permanent", "yes"); + } + } + BeginElement("File"); AddAttribute("Id", fileId); AddAttribute("Source", filePath); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h index 13122c2..23ef561 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h @@ -53,7 +53,8 @@ public: std::string const& directoryId, std::string const& id, std::string const& filePath, - cmWIXPatch &patch); + cmWIXPatch &patch, + cmInstalledFile const* installedFile); private: void EmitInstallRegistryValue( diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 9cdf5aa..91f92c5 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1314,6 +1314,14 @@ int cmCPackGenerator::CleanTemporaryDirectory() } //---------------------------------------------------------------------- +cmInstalledFile const* cmCPackGenerator::GetInstalledFile( + std::string const& name) const +{ + cmake const* cm = this->MakefileMap->GetCMakeInstance(); + return cm->GetInstalledFile(name); +} + +//---------------------------------------------------------------------- int cmCPackGenerator::PrepareGroupingKind() { // find a component package method specified by the user diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index e780f0e..ed89b53 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -47,6 +47,7 @@ class cmMakefile; class cmCPackLog; +class cmInstalledFile; /** \class cmCPackGenerator * \brief A superclass of all CPack Generators @@ -129,6 +130,8 @@ protected: int CleanTemporaryDirectory(); + cmInstalledFile const* GetInstalledFile(std::string const& name) const; + virtual const char* GetOutputExtension() { return ".cpack"; } virtual const char* GetOutputPostfix() { return 0; } diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 9eabdca..2aa5991 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -257,6 +257,11 @@ int main (int argc, char const* const* argv) return 1; } + if ( !cpackBuildConfig.empty() ) + { + globalMF->AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig.c_str()); + } + if ( cmSystemTools::FileExists(cpackConfigFile.c_str()) ) { cpackConfigFile = @@ -317,10 +322,6 @@ int main (int argc, char const* const* argv) cpackProjectDirectory.c_str()); } } - if ( !cpackBuildConfig.empty() ) - { - globalMF->AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig.c_str()); - } cpackDefinitions::MapType::iterator cdit; for ( cdit = definitions.Map.begin(); cdit != definitions.Map.end(); diff --git a/Source/CTest/cmParsePythonCoverage.cxx b/Source/CTest/cmParsePythonCoverage.cxx index 2578bb8..817b8dc 100644 --- a/Source/CTest/cmParsePythonCoverage.cxx +++ b/Source/CTest/cmParsePythonCoverage.cxx @@ -33,19 +33,25 @@ protected: << atts[tagCount+1] << std::endl); this->CurFileName = this->Coverage.SourceDir + "/" + atts[tagCount+1]; - FileLinesType& curFileLines = - this->Coverage.TotalCoverage[this->CurFileName]; cmsys::ifstream fin(this->CurFileName.c_str()); if(!fin) { - cmCTestLog(this->CTest, ERROR_MESSAGE, - "Python Coverage: Error opening " << this->CurFileName - << std::endl); - this->Coverage.Error++; - break; + this->CurFileName = this->Coverage.BinaryDir + "/" + + atts[tagCount+1]; + fin.open(this->CurFileName.c_str()); + if (!fin) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Python Coverage: Error opening " << this->CurFileName + << std::endl); + this->Coverage.Error++; + break; + } } std::string line; + FileLinesType& curFileLines = + this->Coverage.TotalCoverage[this->CurFileName]; curFileLines.push_back(-1); while(cmSystemTools::GetLineFromStream(fin, line)) { @@ -73,11 +79,11 @@ protected: curNumber = atoi(atts[tagCount+1]); } - if(curHits > -1 && curNumber > -1) + if(curHits > -1 && curNumber > 0) { FileLinesType& curFileLines = this->Coverage.TotalCoverage[this->CurFileName]; - curFileLines[curNumber] = curHits; + curFileLines[curNumber-1] = curHits; break; } ++tagCount; diff --git a/Source/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx new file mode 100644 index 0000000..cf24c13 --- /dev/null +++ b/Source/cmCPackPropertiesGenerator.cxx @@ -0,0 +1,45 @@ +#include "cmCPackPropertiesGenerator.h" + +#include "cmLocalGenerator.h" + +cmCPackPropertiesGenerator::cmCPackPropertiesGenerator( + cmMakefile* mf, + cmInstalledFile const& installedFile, + std::vector<std::string> const& configurations): + cmScriptGenerator("CPACK_BUILD_CONFIG", configurations), + Makefile(mf), + InstalledFile(installedFile) +{ + this->ActionsPerConfig = true; +} + +void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os, + const std::string& config, Indent const& indent) +{ + std::string const& expandedFileName = + this->InstalledFile.GetNameExpression().Evaluate(this->Makefile, config); + + cmInstalledFile::PropertyMapType const& properties = + this->InstalledFile.GetProperties(); + + for(cmInstalledFile::PropertyMapType::const_iterator i = properties.begin(); + i != properties.end(); ++i) + { + std::string const& name = i->first; + cmInstalledFile::Property const& property = i->second; + + os << indent << "set_property(INSTALL " << + cmLocalGenerator::EscapeForCMake(expandedFileName) << " PROPERTY " << + cmLocalGenerator::EscapeForCMake(name); + + for(cmInstalledFile::ExpressionVectorType::const_iterator + j = property.ValueExpressions.begin(); + j != property.ValueExpressions.end(); ++j) + { + std::string value = (*j)->Evaluate(this->Makefile, config); + os << " " << cmLocalGenerator::EscapeForCMake(value); + } + + os << ")\n"; + } +} diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h new file mode 100644 index 0000000..71e2eaa --- /dev/null +++ b/Source/cmCPackPropertiesGenerator.h @@ -0,0 +1,38 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2014 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmCPackPropertiesGenerator_h +#define cmCPackPropertiesGenerator_h + +#include "cmScriptGenerator.h" +#include "cmInstalledFile.h" + +/** \class cmCPackPropertiesGenerator + * \brief Support class for generating CPackProperties.cmake. + * + */ +class cmCPackPropertiesGenerator: public cmScriptGenerator +{ +public: + cmCPackPropertiesGenerator( + cmMakefile* mf, + cmInstalledFile const& installedFile, + std::vector<std::string> const& configurations); + +protected: + virtual void GenerateScriptForConfig(std::ostream& os, + const std::string& config, Indent const& indent); + + cmMakefile* Makefile; + cmInstalledFile const& InstalledFile; +}; + +#endif diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 8f352b1..d6b84a0 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -751,11 +751,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, } e.SetProperty("HELPSTRING", helpString? helpString : "(This variable does not exist and should not be used)"); - if (this->Cache[key].Value == e.Value) - { - this->CMakeInstance->UnwatchUnusedCli(key); - } - this->Cache[key] = e; + this->CMakeInstance->UnwatchUnusedCli(key); } bool cmCacheManager::CacheIterator::IsAtEnd() const diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 512d789..9a88191 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -67,12 +67,16 @@ bool cmGetPropertyCommand { scope = cmProperty::CACHE; } + else if(args[1] == "INSTALL") + { + scope = cmProperty::INSTALL; + } else { cmOStringStream e; e << "given invalid scope " << args[1] << ". " << "Valid scopes are " - << "GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, VARIABLE, CACHE."; + << "GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, VARIABLE, CACHE, INSTALL."; this->SetError(e.str()); return false; } @@ -190,6 +194,7 @@ bool cmGetPropertyCommand case cmProperty::TEST: return this->HandleTestMode(); case cmProperty::VARIABLE: return this->HandleVariableMode(); case cmProperty::CACHE: return this->HandleCacheMode(); + case cmProperty::INSTALL: return this->HandleInstallMode(); case cmProperty::CACHED_VARIABLE: break; // should never happen @@ -395,3 +400,33 @@ bool cmGetPropertyCommand::HandleCacheMode() this->StoreResult(value); return true; } + +//---------------------------------------------------------------------------- +bool cmGetPropertyCommand::HandleInstallMode() +{ + if(this->Name.empty()) + { + this->SetError("not given name for INSTALL scope."); + return false; + } + + // Get the installed file. + cmake* cm = this->Makefile->GetCMakeInstance(); + + if(cmInstalledFile* file = cm->GetOrCreateInstalledFile( + this->Makefile, this->Name)) + { + std::string value; + bool isSet = file->GetProperty(this->PropertyName, value); + + return this->StoreResult(isSet ? value.c_str() : 0); + } + else + { + cmOStringStream e; + e << "given INSTALL name that could not be found or created: " + << this->Name; + this->SetError(e.str()); + return false; + } +} diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h index 8c3738f..40b7dbc 100644 --- a/Source/cmGetPropertyCommand.h +++ b/Source/cmGetPropertyCommand.h @@ -60,6 +60,7 @@ private: bool HandleTestMode(); bool HandleVariableMode(); bool HandleCacheMode(); + bool HandleInstallMode(); }; #endif diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2a30593..dba4f46 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -28,6 +28,7 @@ #include "cmGeneratorExpression.h" #include "cmGeneratorExpressionEvaluationFile.h" #include "cmExportBuildFileGenerator.h" +#include "cmCPackPropertiesGenerator.h" #include <cmsys/Directory.hxx> #include <cmsys/FStream.hxx> @@ -1269,6 +1270,13 @@ void cmGlobalGenerator::Generate() } this->SetCurrentLocalGenerator(0); + if(!this->GenerateCPackPropertiesFile()) + { + this->GetCMakeInstance()->IssueMessage( + cmake::FATAL_ERROR, "Could not write CPack properties file.", + cmListFileBacktrace()); + } + for (std::map<std::string, cmExportBuildFileGenerator*>::iterator it = this->BuildExportSets.begin(); it != this->BuildExportSets.end(); ++it) @@ -3014,3 +3022,39 @@ std::string cmGlobalGenerator::ExpandCFGIntDir(const std::string& str, { return str; } + +//---------------------------------------------------------------------------- +bool cmGlobalGenerator::GenerateCPackPropertiesFile() +{ + cmake::InstalledFilesMap const& installedFiles = + this->CMakeInstance->GetInstalledFiles(); + + cmMakefile* mf = this->LocalGenerators[0]->GetMakefile(); + + std::vector<std::string> configs; + std::string config = mf->GetConfigurations(configs, false); + + std::string path = this->CMakeInstance->GetStartOutputDirectory(); + path += "/CPackProperties.cmake"; + + if(!cmSystemTools::FileExists(path.c_str()) && installedFiles.empty()) + { + return true; + } + + cmGeneratedFileStream file(path.c_str()); + file << "# CPack properties\n"; + + for(cmake::InstalledFilesMap::const_iterator i = installedFiles.begin(); + i != installedFiles.end(); ++i) + { + cmInstalledFile const& installedFile = i->second; + + cmCPackPropertiesGenerator cpackPropertiesGenerator( + mf, installedFile, configs); + + cpackPropertiesGenerator.Generate(file, config, configs); + } + + return true; +} diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 14ec99a..617e708 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -329,6 +329,8 @@ public: virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; + bool GenerateCPackPropertiesFile(); + protected: typedef std::vector<cmLocalGenerator*> GeneratorVector; // for a project collect all its targets by following depend diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx new file mode 100644 index 0000000..7e78ec0 --- /dev/null +++ b/Source/cmInstalledFile.cxx @@ -0,0 +1,115 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2014 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmInstalledFile.h" +#include "cmSystemTools.h" +#include "cmMakefile.h" + +//---------------------------------------------------------------------------- +cmInstalledFile::cmInstalledFile(): + NameExpression(0) +{ + +} + +//---------------------------------------------------------------------------- +cmInstalledFile::~cmInstalledFile() +{ + if(NameExpression) + { + delete NameExpression; + } +} + +//---------------------------------------------------------------------------- +void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name) +{ + cmListFileBacktrace backtrace; + mf->GetBacktrace(backtrace); + cmGeneratorExpression ge(backtrace); + + this->Name = name; + this->NameExpression = ge.Parse(name).release(); +} + +//---------------------------------------------------------------------------- +std::string const& cmInstalledFile::GetName() const +{ + return this->Name; +} + +//---------------------------------------------------------------------------- +cmCompiledGeneratorExpression const& cmInstalledFile::GetNameExpression() const +{ + return *(this->NameExpression); +} + +//---------------------------------------------------------------------------- +void cmInstalledFile::RemoveProperty(const std::string& prop) +{ + this->Properties.erase(prop); +} + +//---------------------------------------------------------------------------- +void cmInstalledFile::SetProperty(cmMakefile const* mf, + const std::string& prop, const char* value) +{ + this->RemoveProperty(prop); + this->AppendProperty(mf, prop, value); +} + +//---------------------------------------------------------------------------- +void cmInstalledFile::AppendProperty(cmMakefile const* mf, + const std::string& prop, const char* value, bool /*asString*/) +{ + cmListFileBacktrace backtrace; + mf->GetBacktrace(backtrace); + cmGeneratorExpression ge(backtrace); + + Property& property = this->Properties[prop]; + property.ValueExpressions.push_back(ge.Parse(value).release()); +} + +//---------------------------------------------------------------------------- +bool cmInstalledFile::GetProperty( + const std::string& prop, std::string& value) const +{ + PropertyMapType::const_iterator i = this->Properties.find(prop); + if(i == this->Properties.end()) + { + return false; + } + + Property const& property = i->second; + + std::string output; + std::string separator; + + for(ExpressionVectorType::const_iterator + j = property.ValueExpressions.begin(); + j != property.ValueExpressions.end(); ++j) + { + output += separator; + output += (*j)->GetInput(); + separator = ";"; + } + + value = output; + return true; +} + +//---------------------------------------------------------------------------- +bool cmInstalledFile::GetPropertyAsBool(const std::string& prop) const +{ + std::string value; + bool isSet = this->GetProperty(prop, value); + return isSet && cmSystemTools::IsOn(value.c_str()); +} diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h new file mode 100644 index 0000000..df28221 --- /dev/null +++ b/Source/cmInstalledFile.h @@ -0,0 +1,83 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2014 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmInstalledFile_h +#define cmInstalledFile_h + +#include "cmGeneratorExpression.h" + +/** \class cmInstalledFile + * \brief Represents a file intended for installation. + * + * cmInstalledFile represents a file intended for installation. + */ +class cmInstalledFile +{ +public: + + typedef cmsys::auto_ptr<cmCompiledGeneratorExpression> + CompiledGeneratorExpressionPtrType; + + typedef std::vector<cmCompiledGeneratorExpression*> + ExpressionVectorType; + + struct Property + { + Property() + { + + } + + ~Property() + { + for(ExpressionVectorType::iterator i = ValueExpressions.begin(); + i != ValueExpressions.end(); ++i) + { + delete *i; + } + } + + ExpressionVectorType ValueExpressions; + }; + + typedef std::map<std::string, Property> PropertyMapType; + + cmInstalledFile(); + + ~cmInstalledFile(); + + void RemoveProperty(const std::string& prop); + + void SetProperty(cmMakefile const* mf, + const std::string& prop, const char *value); + + void AppendProperty(cmMakefile const* mf, + const std::string& prop, const char* value,bool asString=false); + + bool GetProperty(const std::string& prop, std::string& value) const; + + bool GetPropertyAsBool(const std::string& prop) const; + + void SetName(cmMakefile* mf, const std::string& name); + + std::string const& GetName() const; + + cmCompiledGeneratorExpression const& GetNameExpression() const; + + PropertyMapType const& GetProperties() const { return this->Properties; } + +private: + std::string Name; + cmCompiledGeneratorExpression* NameExpression; + PropertyMapType Properties; +}; + +#endif diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e80b8ee..f83981e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2222,6 +2222,7 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target, if (langStdMap.empty()) { // Maintain sorted order, most recent first. + langStdMap["CXX"].push_back("14"); langStdMap["CXX"].push_back("11"); langStdMap["CXX"].push_back("98"); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index aca7a93..2620471 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4987,6 +4987,7 @@ static const char * const C_STANDARDS[] = { static const char * const CXX_STANDARDS[] = { "98" , "11" + , "14" }; //---------------------------------------------------------------------------- @@ -5209,7 +5210,8 @@ bool cmMakefile::HaveCxxFeatureAvailable(cmTarget const* target, { bool needCxx98 = false; bool needCxx11 = false; - this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11); + bool needCxx14 = false; + this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11, needCxx14); const char *existingCxxStandard = target->GetProperty("CXX_STANDARD"); if (!existingCxxStandard) @@ -5252,7 +5254,8 @@ bool cmMakefile::HaveCxxFeatureAvailable(cmTarget const* target, //---------------------------------------------------------------------------- void cmMakefile::CheckNeededCxxLanguage(const std::string& feature, bool& needCxx98, - bool& needCxx11) const + bool& needCxx11, + bool& needCxx14) const { if (const char *propCxx98 = this->GetDefinition("CMAKE_CXX98_COMPILE_FEATURES")) @@ -5268,6 +5271,13 @@ void cmMakefile::CheckNeededCxxLanguage(const std::string& feature, cmSystemTools::ExpandListArgument(propCxx11, props); needCxx11 = std::find(props.begin(), props.end(), feature) != props.end(); } + if (const char *propCxx14 = + this->GetDefinition("CMAKE_CXX14_COMPILE_FEATURES")) + { + std::vector<std::string> props; + cmSystemTools::ExpandListArgument(propCxx14, props); + needCxx14 = std::find(props.begin(), props.end(), feature) != props.end(); + } } //---------------------------------------------------------------------------- @@ -5277,8 +5287,9 @@ AddRequiredTargetCxxFeature(cmTarget *target, { bool needCxx98 = false; bool needCxx11 = false; + bool needCxx14 = false; - this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11); + this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11, needCxx14); const char *existingCxxStandard = target->GetProperty("CXX_STANDARD"); if (existingCxxStandard) @@ -5301,8 +5312,16 @@ AddRequiredTargetCxxFeature(cmTarget *target, bool setCxx98 = needCxx98 && !existingCxxStandard; bool setCxx11 = needCxx11 && !existingCxxStandard; + bool setCxx14 = needCxx14 && !existingCxxStandard; - if (needCxx11 && existingCxxStandard && existingCxxIt < + if (needCxx14 && existingCxxStandard && existingCxxIt < + std::find_if(cmArrayBegin(CXX_STANDARDS), + cmArrayEnd(CXX_STANDARDS), + cmStrCmp("14"))) + { + setCxx14 = true; + } + else if (needCxx11 && existingCxxStandard && existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS), cmStrCmp("11"))) @@ -5317,7 +5336,11 @@ AddRequiredTargetCxxFeature(cmTarget *target, setCxx98 = true; } - if (setCxx11) + if (setCxx14) + { + target->SetProperty("CXX_STANDARD", "14"); + } + else if (setCxx11) { target->SetProperty("CXX_STANDARD", "11"); } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 9a4b9c7..e3b83af 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -1121,7 +1121,7 @@ private: void CheckNeededCLanguage(const std::string& feature, bool& needC90, bool& needC99, bool& needC11) const; void CheckNeededCxxLanguage(const std::string& feature, bool& needCxx98, - bool& needCxx11) const; + bool& needCxx11, bool& needCxx14) const; bool HaveCFeatureAvailable(cmTarget const* target, const std::string& feature) const; diff --git a/Source/cmProperty.h b/Source/cmProperty.h index 34897e8..659c4c3 100644 --- a/Source/cmProperty.h +++ b/Source/cmProperty.h @@ -18,7 +18,7 @@ class cmProperty { public: enum ScopeType { TARGET, SOURCE_FILE, DIRECTORY, GLOBAL, CACHE, - TEST, VARIABLE, CACHED_VARIABLE }; + TEST, VARIABLE, CACHED_VARIABLE, INSTALL }; // set this property void Set(const std::string& name, const char *value); diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 7ff12dd..cca995b 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -39,7 +39,8 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot): ModuleRST("^#\\[(=*)\\[\\.rst:$"), CMakeRole("(:cmake)?:(" "command|generator|variable|module|policy|" - "prop_cache|prop_dir|prop_gbl|prop_sf|prop_test|prop_tgt|" + "prop_cache|prop_dir|prop_gbl|prop_inst|prop_sf|" + "prop_test|prop_tgt|" "manual" "):`(<*([^`<]|[^` \t]<)*)([ \t]+<[^`]*>)?`"), Substitution("(^|[^A-Za-z0-9_])" diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 5f970f8..c624d17 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -61,11 +61,16 @@ bool cmSetPropertyCommand { scope = cmProperty::CACHE; } + else if(*arg == "INSTALL") + { + scope = cmProperty::INSTALL; + } else { cmOStringStream e; e << "given invalid scope " << *arg << ". " - << "Valid scopes are GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, CACHE."; + << "Valid scopes are GLOBAL, DIRECTORY, " + "TARGET, SOURCE, TEST, CACHE, INSTALL."; this->SetError(e.str()); return false; } @@ -135,6 +140,7 @@ bool cmSetPropertyCommand case cmProperty::SOURCE_FILE: return this->HandleSourceMode(); case cmProperty::TEST: return this->HandleTestMode(); case cmProperty::CACHE: return this->HandleCacheMode(); + case cmProperty::INSTALL: return this->HandleInstallMode(); case cmProperty::VARIABLE: case cmProperty::CACHED_VARIABLE: @@ -488,3 +494,54 @@ bool cmSetPropertyCommand::HandleCacheEntry(cmCacheManager::CacheIterator& it) return true; } + +//---------------------------------------------------------------------------- +bool cmSetPropertyCommand::HandleInstallMode() +{ + cmake* cm = this->Makefile->GetCMakeInstance(); + + for(std::set<std::string>::const_iterator i = this->Names.begin(); + i != this->Names.end(); ++i) + { + if(cmInstalledFile* file = cm->GetOrCreateInstalledFile( + this->Makefile, *i)) + { + if(!this->HandleInstall(file)) + { + return false; + } + } + else + { + cmOStringStream e; + e << "given INSTALL name that could not be found or created: " << *i; + this->SetError(e.str()); + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- +bool cmSetPropertyCommand::HandleInstall(cmInstalledFile* file) +{ + // Set or append the property. + std::string const& name = this->PropertyName; + + cmMakefile* mf = this->Makefile; + + const char *value = this->PropertyValue.c_str(); + if (this->Remove) + { + file->RemoveProperty(name); + } + else if(this->AppendMode) + { + file->AppendProperty(mf, name, value, this->AppendAsString); + } + else + { + file->SetProperty(mf, name, value); + } + return true; +} diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index eaa0233..b06cb68 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -62,6 +62,8 @@ private: bool HandleTest(cmTest* test); bool HandleCacheMode(); bool HandleCacheEntry(cmCacheManager::CacheIterator&); + bool HandleInstallMode(); + bool HandleInstall(cmInstalledFile* file); }; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index a83ebd5..60e92a0 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1236,7 +1236,10 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) if(ci.Find(save.key)) { save.type = ci.GetType(); - save.help = ci.GetProperty("HELPSTRING"); + if(const char* help = ci.GetProperty("HELPSTRING")) + { + save.help = help; + } } saved.push_back(save); } @@ -2291,6 +2294,41 @@ bool cmake::GetPropertyAsBool(const std::string& prop) return cmSystemTools::IsOn(this->GetProperty(prop)); } +cmInstalledFile *cmake::GetOrCreateInstalledFile( + cmMakefile* mf, const std::string& name) +{ + std::map<std::string, cmInstalledFile>::iterator i = + this->InstalledFiles.find(name); + + if(i != this->InstalledFiles.end()) + { + cmInstalledFile &file = i->second; + return &file; + } + else + { + cmInstalledFile &file = this->InstalledFiles[name]; + file.SetName(mf, name); + return &file; + } +} + +cmInstalledFile const* cmake::GetInstalledFile(const std::string& name) const +{ + std::map<std::string, cmInstalledFile>::const_iterator i = + this->InstalledFiles.find(name); + + if(i != this->InstalledFiles.end()) + { + cmInstalledFile const& file = i->second; + return &file; + } + else + { + return 0; + } +} + int cmake::GetSystemInformation(std::vector<std::string>& args) { // so create the directory diff --git a/Source/cmake.h b/Source/cmake.h index 33a5d78..329b439 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -16,6 +16,7 @@ #include "cmSystemTools.h" #include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" +#include "cmInstalledFile.h" class cmGlobalGeneratorFactory; class cmGlobalGenerator; @@ -92,6 +93,7 @@ class cmake FIND_PACKAGE_MODE }; typedef std::map<std::string, cmCommand*> RegisteredCommandsMap; + typedef std::map<std::string, cmInstalledFile> InstalledFilesMap; /// Default constructor cmake(); @@ -280,6 +282,15 @@ class cmake // Get the properties cmPropertyMap &GetProperties() { return this->Properties; } + ///! Get or create an cmInstalledFile instance and return a pointer to it + cmInstalledFile *GetOrCreateInstalledFile( + cmMakefile* mf, const std::string& name); + + cmInstalledFile const* GetInstalledFile(const std::string& name) const; + + InstalledFilesMap const& GetInstalledFiles() const + { return this->InstalledFiles; } + ///! Do all the checks before running configure int DoPreConfigureChecks(); @@ -445,6 +456,7 @@ private: cmFileTimeComparison* FileComparison; std::string GraphVizFile; std::vector<std::string> DebugConfigs; + InstalledFilesMap InstalledFiles; void UpdateConversionPathTable(); }; @@ -465,19 +477,25 @@ private: F(c_variadic_macros) #define FOR_EACH_CXX_FEATURE(F) \ + F(cxx_aggregate_default_initializers) \ F(cxx_alias_templates) \ F(cxx_alignas) \ F(cxx_alignof) \ F(cxx_attributes) \ + F(cxx_attribute_deprecated) \ F(cxx_auto_type) \ + F(cxx_binary_literals) \ F(cxx_constexpr) \ + F(cxx_contextual_conversions) \ F(cxx_decltype) \ + F(cxx_decltype_auto) \ F(cxx_decltype_incomplete_return_types) \ F(cxx_default_function_template_args) \ F(cxx_defaulted_functions) \ F(cxx_defaulted_move_initializers) \ F(cxx_delegating_constructors) \ F(cxx_deleted_functions) \ + F(cxx_digit_separators) \ F(cxx_enum_forward_declarations) \ F(cxx_explicit_conversions) \ F(cxx_extended_friend_declarations) \ @@ -485,9 +503,11 @@ private: F(cxx_final) \ F(cxx_func_identifier) \ F(cxx_generalized_initializers) \ + F(cxx_generic_lambdas) \ F(cxx_inheriting_constructors) \ F(cxx_inline_namespaces) \ F(cxx_lambdas) \ + F(cxx_lambda_init_captures) \ F(cxx_local_type_template_args) \ F(cxx_long_long_type) \ F(cxx_noexcept) \ @@ -497,6 +517,8 @@ private: F(cxx_range_for) \ F(cxx_raw_string_literals) \ F(cxx_reference_qualified_functions) \ + F(cxx_relaxed_constexpr) \ + F(cxx_return_type_deduction) \ F(cxx_right_angle_brackets) \ F(cxx_rvalue_references) \ F(cxx_sizeof_member) \ @@ -509,6 +531,7 @@ private: F(cxx_uniform_initialization) \ F(cxx_unrestricted_unions) \ F(cxx_user_literals) \ + F(cxx_variable_templates) \ F(cxx_variadic_macros) \ F(cxx_variadic_templates) diff --git a/Templates/CPackConfig.cmake.in b/Templates/CPackConfig.cmake.in index 79b8d93..c00ea2a 100644 --- a/Templates/CPackConfig.cmake.in +++ b/Templates/CPackConfig.cmake.in @@ -10,3 +10,11 @@ # usually begin with CPACK_<GENNAME>_xxxx. @_CPACK_OTHER_VARIABLES_@ + +if(NOT CPACK_PROPERTIES_FILE) + set(CPACK_PROPERTIES_FILE "@CMAKE_BINARY_DIR@/CPackProperties.cmake") +endif() + +if(EXISTS ${CPACK_PROPERTIES_FILE}) + include(${CPACK_PROPERTIES_FILE}) +endif() diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 7a8a975..d02ddaf 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -37,11 +37,24 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL GNU cxx_alignof ) endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL GNU + AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) + # GNU prior to 4.9 does not set any preprocessor define to distinguish + # c++1y from c++11, so CMake does not support c++1y features before GNU 4.9. + list(REMOVE_ITEM CXX_non_features + # GNU 4.8 knows cxx_attributes, but doesn't know [[deprecated]] + # and warns that it is unknown and ignored. + cxx_attribute_deprecated + cxx_binary_literals + cxx_lambda_init_captures + cxx_return_type_deduction + ) +endif() set(C_ext c) set(C_standard_flag 11) set(CXX_ext cpp) -set(CXX_standard_flag 11) +set(CXX_standard_flag 14) foreach(lang CXX C) if (CMAKE_${lang}_COMPILE_FEATURES) foreach(feature ${${lang}_non_features}) diff --git a/Tests/CompileFeatures/cxx_aggregate_default_initializers.cpp b/Tests/CompileFeatures/cxx_aggregate_default_initializers.cpp new file mode 100644 index 0000000..63a3713 --- /dev/null +++ b/Tests/CompileFeatures/cxx_aggregate_default_initializers.cpp @@ -0,0 +1,9 @@ + +struct X { int i, j, k = 42; }; + +int someFunc() +{ + X a[] = { 1, 2, 3, 4, 5, 6 }; + X b[2] = { { 1, 2, 3 }, { 4, 5, 6 } }; + return a[0].k == b[0].k && a[1].k == b[1].k ? 0 : 1; +} diff --git a/Tests/CompileFeatures/cxx_attribute_deprecated.cpp b/Tests/CompileFeatures/cxx_attribute_deprecated.cpp new file mode 100644 index 0000000..b6f307d --- /dev/null +++ b/Tests/CompileFeatures/cxx_attribute_deprecated.cpp @@ -0,0 +1,11 @@ + +[[deprecated]] +int foo() +{ + return 0; +} + +int someFunc() +{ + return foo(); +} diff --git a/Tests/CompileFeatures/cxx_binary_literals.cpp b/Tests/CompileFeatures/cxx_binary_literals.cpp new file mode 100644 index 0000000..14a9e75 --- /dev/null +++ b/Tests/CompileFeatures/cxx_binary_literals.cpp @@ -0,0 +1,6 @@ + +int someFunc() +{ + int i = 0b101; + return i - 5; +} diff --git a/Tests/CompileFeatures/cxx_contextual_conversions.cpp b/Tests/CompileFeatures/cxx_contextual_conversions.cpp new file mode 100644 index 0000000..3438624 --- /dev/null +++ b/Tests/CompileFeatures/cxx_contextual_conversions.cpp @@ -0,0 +1,33 @@ + +#define assert(E) if(!(E)) return 1; + +template<class T> +class zero_init +{ +public: + zero_init( ) + : val( static_cast<T>(0) ) { } + zero_init( T val ) : val( val ) + { } + operator T & ( ) { return val; } + operator T ( ) const { return val; } +private: + T val; +}; + +int someFunc() +{ + zero_init<int*> p; assert( p == 0 ); + p = new int(7); + assert( *p == 7 ); + delete p; + + zero_init<int> i; assert( i == 0 ); + i = 7; + assert( i == 7 ); + switch( i ) { } + + int *vp = new int[i]; + + return 0; +} diff --git a/Tests/CompileFeatures/cxx_decltype_auto.cpp b/Tests/CompileFeatures/cxx_decltype_auto.cpp new file mode 100644 index 0000000..900bb6d --- /dev/null +++ b/Tests/CompileFeatures/cxx_decltype_auto.cpp @@ -0,0 +1,6 @@ + +int someFunc(int argc, char**) +{ + decltype(auto) i = argc; + return 0; +} diff --git a/Tests/CompileFeatures/cxx_digit_separators.cpp b/Tests/CompileFeatures/cxx_digit_separators.cpp new file mode 100644 index 0000000..abcd1c8 --- /dev/null +++ b/Tests/CompileFeatures/cxx_digit_separators.cpp @@ -0,0 +1,6 @@ + +int someFunc() +{ + int one_thousand = 1'000; + return one_thousand - 1000; +} diff --git a/Tests/CompileFeatures/cxx_generic_lambdas.cpp b/Tests/CompileFeatures/cxx_generic_lambdas.cpp new file mode 100644 index 0000000..ae1b78e --- /dev/null +++ b/Tests/CompileFeatures/cxx_generic_lambdas.cpp @@ -0,0 +1,6 @@ + +int someFunc() +{ + auto identity = [](auto a) { return a; }; + return identity(0); +} diff --git a/Tests/CompileFeatures/cxx_lambda_init_captures.cpp b/Tests/CompileFeatures/cxx_lambda_init_captures.cpp new file mode 100644 index 0000000..7e337fa --- /dev/null +++ b/Tests/CompileFeatures/cxx_lambda_init_captures.cpp @@ -0,0 +1,6 @@ + +int someFunc() +{ + int a = 0; + return [b = static_cast<int&&>(a)]() { return b; }(); +} diff --git a/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp b/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp new file mode 100644 index 0000000..bce82e3 --- /dev/null +++ b/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp @@ -0,0 +1,23 @@ + +struct X { + constexpr X() : n(5) { + n *= 2; + } + int n; +}; + +constexpr int g(const int (&is)[4]) { + X x; + int r = x.n; + for (int i = 0; i < 5; ++i) + r += i; + for (auto& i : is) + r += i; + return r; +} + +int someFunc() +{ + constexpr int k3 = g({ 4, 5, 6, 7 }); + return k3 - 42; +} diff --git a/Tests/CompileFeatures/cxx_return_type_deduction.cpp b/Tests/CompileFeatures/cxx_return_type_deduction.cpp new file mode 100644 index 0000000..009e919 --- /dev/null +++ b/Tests/CompileFeatures/cxx_return_type_deduction.cpp @@ -0,0 +1,10 @@ + +auto sum(int a, int b) +{ + return a+b; +} + +int someFunc() +{ + return sum(3, -3); +} diff --git a/Tests/CompileFeatures/cxx_variable_templates.cpp b/Tests/CompileFeatures/cxx_variable_templates.cpp new file mode 100644 index 0000000..5d4bdbc --- /dev/null +++ b/Tests/CompileFeatures/cxx_variable_templates.cpp @@ -0,0 +1,10 @@ + +template<typename T> +constexpr T pi = T(3.1415926535897932385); + +int someFunc() +{ + auto pi_int = pi<int>; + auto pi_float = pi<float>; + return pi_int - 3; +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 165f027..d5af542 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -138,3 +138,4 @@ add_RunCMake_test(CheckModules) add_RunCMake_test(CommandLine) add_RunCMake_test(install) +add_RunCMake_test(CPackInstallProperties) diff --git a/Tests/RunCMake/CPackInstallProperties/Append-check.cmake b/Tests/RunCMake/CPackInstallProperties/Append-check.cmake new file mode 100644 index 0000000..017b30d --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/Append-check.cmake @@ -0,0 +1,3 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_property("append.txt" CPACK_TEST_PROP "value1;value2;value3") diff --git a/Tests/RunCMake/CPackInstallProperties/Append.cmake b/Tests/RunCMake/CPackInstallProperties/Append.cmake new file mode 100644 index 0000000..cecc45f --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/Append.cmake @@ -0,0 +1,2 @@ +set_property(INSTALL append.txt PROPERTY CPACK_TEST_PROP value1) +set_property(INSTALL append.txt PROPERTY CPACK_TEST_PROP value2 value3 APPEND) diff --git a/Tests/RunCMake/CPackInstallProperties/CMakeLists.txt b/Tests/RunCMake/CPackInstallProperties/CMakeLists.txt new file mode 100644 index 0000000..89ff7c4 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.0) + +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake) + +include(CPack) diff --git a/Tests/RunCMake/CPackInstallProperties/FilenameGenex-check.cmake b/Tests/RunCMake/CPackInstallProperties/FilenameGenex-check.cmake new file mode 100644 index 0000000..8c9e967 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/FilenameGenex-check.cmake @@ -0,0 +1,3 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_property(${EXPECTED_MYTEST_NAME} CPACK_TEST_PROP2 PROP_VALUE2) diff --git a/Tests/RunCMake/CPackInstallProperties/FilenameGenex.cmake b/Tests/RunCMake/CPackInstallProperties/FilenameGenex.cmake new file mode 100644 index 0000000..1a373b9 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/FilenameGenex.cmake @@ -0,0 +1,7 @@ +add_executable(mytest test.cpp) + +file(GENERATE OUTPUT runtest_info.cmake CONTENT [[ +set(EXPECTED_MYTEST_NAME "$<TARGET_FILE_NAME:mytest>") +]]) + +set_property(INSTALL $<TARGET_FILE_NAME:mytest> PROPERTY CPACK_TEST_PROP2 PROP_VALUE2) diff --git a/Tests/RunCMake/CPackInstallProperties/MultipleValues-check.cmake b/Tests/RunCMake/CPackInstallProperties/MultipleValues-check.cmake new file mode 100644 index 0000000..91278ba --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/MultipleValues-check.cmake @@ -0,0 +1,3 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_property("multiple_values.txt" CPACK_TEST_PROP "value1;value2;value3") diff --git a/Tests/RunCMake/CPackInstallProperties/MultipleValues.cmake b/Tests/RunCMake/CPackInstallProperties/MultipleValues.cmake new file mode 100644 index 0000000..26db52a --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/MultipleValues.cmake @@ -0,0 +1 @@ +set_property(INSTALL multiple_values.txt PROPERTY CPACK_TEST_PROP value1 value2 value3) diff --git a/Tests/RunCMake/CPackInstallProperties/PerConfigValue-check.cmake b/Tests/RunCMake/CPackInstallProperties/PerConfigValue-check.cmake new file mode 100644 index 0000000..2966d88 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/PerConfigValue-check.cmake @@ -0,0 +1,13 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +file(GLOB INFO_FILES ${RunCMake_TEST_BINARY_DIR}/runtest_info_*.cmake) + +if(NOT INFO_FILES) + message(FATAL_ERROR "missing expected info files") +endif() + +foreach(INFO_FILE IN LISTS INFO_FILES) + include(${INFO_FILE}) + include(${RunCMake_TEST_BINARY_DIR}/CPackProperties.cmake) + test_property("config.cpp" FOO ${EXPECTED_MYTEST_NAME}) +endforeach() diff --git a/Tests/RunCMake/CPackInstallProperties/PerConfigValue.cmake b/Tests/RunCMake/CPackInstallProperties/PerConfigValue.cmake new file mode 100644 index 0000000..77fe8ed --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/PerConfigValue.cmake @@ -0,0 +1,14 @@ +add_executable(mytest test.cpp) + +foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES) + string(TOUPPER ${CONFIG} UPPER_CONFIG) + set_property(TARGET mytest PROPERTY + OUTPUT_NAME_${UPPER_CONFIG} bar_${CONFIG}) +endforeach() + +file(GENERATE OUTPUT runtest_info_$<CONFIG>.cmake CONTENT [[ +set(CPACK_BUILD_CONFIG "$<CONFIG>") +set(EXPECTED_MYTEST_NAME "$<TARGET_FILE_NAME:mytest>") +]]) + +set_property(INSTALL config.cpp PROPERTY FOO $<TARGET_FILE_NAME:mytest>) diff --git a/Tests/RunCMake/CPackInstallProperties/Replace-check.cmake b/Tests/RunCMake/CPackInstallProperties/Replace-check.cmake new file mode 100644 index 0000000..6e492e7 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/Replace-check.cmake @@ -0,0 +1,3 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_property("replace.txt" CPACK_TEST_PROP "value2") diff --git a/Tests/RunCMake/CPackInstallProperties/Replace.cmake b/Tests/RunCMake/CPackInstallProperties/Replace.cmake new file mode 100644 index 0000000..104d5a4 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/Replace.cmake @@ -0,0 +1,2 @@ +set_property(INSTALL replace.txt PROPERTY CPACK_TEST_PROP value1) +set_property(INSTALL replace.txt PROPERTY CPACK_TEST_PROP value2) diff --git a/Tests/RunCMake/CPackInstallProperties/RunCMakeTest.cmake b/Tests/RunCMake/CPackInstallProperties/RunCMakeTest.cmake new file mode 100644 index 0000000..d244ac5 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +include(RunCMake) + +run_cmake(Simple) +run_cmake(FilenameGenex) +run_cmake(ValueGenex) +run_cmake(MultipleValues) +run_cmake(Append) +run_cmake(Replace) +run_cmake(PerConfigValue) diff --git a/Tests/RunCMake/CPackInstallProperties/Simple-check.cmake b/Tests/RunCMake/CPackInstallProperties/Simple-check.cmake new file mode 100644 index 0000000..6a7ee2a --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/Simple-check.cmake @@ -0,0 +1,3 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_property("foo/test.cpp" CPACK_TEST_PROP PROP_VALUE) diff --git a/Tests/RunCMake/CPackInstallProperties/Simple.cmake b/Tests/RunCMake/CPackInstallProperties/Simple.cmake new file mode 100644 index 0000000..2eb8755 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/Simple.cmake @@ -0,0 +1 @@ +set_property(INSTALL foo/test.cpp PROPERTY CPACK_TEST_PROP PROP_VALUE) diff --git a/Tests/RunCMake/CPackInstallProperties/ValueGenex-check.cmake b/Tests/RunCMake/CPackInstallProperties/ValueGenex-check.cmake new file mode 100644 index 0000000..cdfbcda --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/ValueGenex-check.cmake @@ -0,0 +1,3 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_property("bar/test.cpp" CPACK_TEST_PROP ${EXPECTED_MYTEST_NAME}) diff --git a/Tests/RunCMake/CPackInstallProperties/ValueGenex.cmake b/Tests/RunCMake/CPackInstallProperties/ValueGenex.cmake new file mode 100644 index 0000000..2e1d465 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/ValueGenex.cmake @@ -0,0 +1,7 @@ +add_executable(mytest test.cpp) + +file(GENERATE OUTPUT runtest_info.cmake CONTENT [[ +set(EXPECTED_MYTEST_NAME "$<TARGET_FILE_NAME:mytest>") +]]) + +set_property(INSTALL bar/test.cpp PROPERTY CPACK_TEST_PROP $<TARGET_FILE_NAME:mytest>) diff --git a/Tests/RunCMake/CPackInstallProperties/check.cmake b/Tests/RunCMake/CPackInstallProperties/check.cmake new file mode 100644 index 0000000..65aa467 --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/check.cmake @@ -0,0 +1,12 @@ +function(test_property FILE NAME EXPECTED_VALUE) + get_property(ACTUAL_VALUE INSTALL "${FILE}" PROPERTY "${NAME}") + + if(NOT "${ACTUAL_VALUE}" STREQUAL "${EXPECTED_VALUE}") + message(FATAL_ERROR "${NAME}@${FILE}: property mismatch expected [${EXPECTED_VALUE}] actual [${ACTUAL_VALUE}] (Config:${CPACK_BUILD_CONFIG})") + endif() +endfunction() + +set(CPACK_BUILD_CONFIG Debug) +include(${RunCMake_TEST_BINARY_DIR}/CPackProperties.cmake) + +include(${RunCMake_TEST_BINARY_DIR}/runtest_info.cmake OPTIONAL) diff --git a/Tests/RunCMake/CPackInstallProperties/test.cpp b/Tests/RunCMake/CPackInstallProperties/test.cpp new file mode 100644 index 0000000..237c8ce --- /dev/null +++ b/Tests/RunCMake/CPackInstallProperties/test.cpp @@ -0,0 +1 @@ +int main() {} diff --git a/Tests/SystemInformation/SystemInformation.in b/Tests/SystemInformation/SystemInformation.in index 7e1ee24..f7e81e6 100644 --- a/Tests/SystemInformation/SystemInformation.in +++ b/Tests/SystemInformation/SystemInformation.in @@ -38,6 +38,7 @@ CMAKE_CXX11_EXTENSION_COMPILE_OPTION == "${CMAKE_CXX11_EXTENSION_COMPILE_OPTION} CMAKE_CXX_COMPILE_FEATURES == "${CMAKE_CXX_COMPILE_FEATURES}" CMAKE_CXX98_COMPILE_FEATURES == "${CMAKE_CXX98_COMPILE_FEATURES}" CMAKE_CXX11_COMPILE_FEATURES == "${CMAKE_CXX11_COMPILE_FEATURES}" +CMAKE_CXX14_COMPILE_FEATURES == "${CMAKE_CXX14_COMPILE_FEATURES}" // C shared library flag CMAKE_SHARED_LIBRARY_C_FLAGS == "${CMAKE_SHARED_LIBRARY_C_FLAGS}" diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index 6e6e48a..2629bb3 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -142,6 +142,7 @@ _cmake_index_objs = { 'prop_cache': _cmake_index_entry('cache property'), 'prop_dir': _cmake_index_entry('directory property'), 'prop_gbl': _cmake_index_entry('global property'), + 'prop_inst': _cmake_index_entry('installed file property'), 'prop_sf': _cmake_index_entry('source file property'), 'prop_test': _cmake_index_entry('test property'), 'prop_tgt': _cmake_index_entry('target property'), @@ -269,6 +270,7 @@ class CMakeDomain(Domain): 'prop_cache': ObjType('prop_cache', 'prop_cache'), 'prop_dir': ObjType('prop_dir', 'prop_dir'), 'prop_gbl': ObjType('prop_gbl', 'prop_gbl'), + 'prop_inst': ObjType('prop_inst', 'prop_inst'), 'prop_sf': ObjType('prop_sf', 'prop_sf'), 'prop_test': ObjType('prop_test', 'prop_test'), 'prop_tgt': ObjType('prop_tgt', 'prop_tgt'), @@ -284,6 +286,7 @@ class CMakeDomain(Domain): # 'prop_cache': CMakeObject, # 'prop_dir': CMakeObject, # 'prop_gbl': CMakeObject, + # 'prop_inst': CMakeObject, # 'prop_sf': CMakeObject, # 'prop_test': CMakeObject, # 'prop_tgt': CMakeObject, @@ -298,6 +301,7 @@ class CMakeDomain(Domain): 'prop_cache': CMakeXRefRole(), 'prop_dir': CMakeXRefRole(), 'prop_gbl': CMakeXRefRole(), + 'prop_inst': CMakeXRefRole(), 'prop_sf': CMakeXRefRole(), 'prop_test': CMakeXRefRole(), 'prop_tgt': CMakeXRefRole(), @@ -232,6 +232,7 @@ CMAKE_CXX_SOURCES="\ cmCommandArgumentLexer \ cmCommandArgumentParser \ cmCommandArgumentParserHelper \ + cmCPackPropertiesGenerator \ cmDefinitions \ cmDepends \ cmDependsC \ @@ -258,6 +259,7 @@ CMAKE_CXX_SOURCES="\ cmGeneratorExpression \ cmGlobalGenerator \ cmLocalGenerator \ + cmInstalledFile \ cmInstallGenerator \ cmInstallExportGenerator \ cmInstallFilesGenerator \ |