diff options
31 files changed, 388 insertions, 48 deletions
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/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/CPackDeb.cmake b/Modules/CPackDeb.cmake index 458bbed..8a4fa49 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -240,7 +240,7 @@ if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS) # Check version of the dpkg-shlibdeps tool using CPackRPM method if(SHLIBDEPS_EXECUTABLE) - execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} --version + execute_process(COMMAND env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --version OUTPUT_VARIABLE _TMP_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) 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/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index a456d9c..d34941a 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -30,7 +30,16 @@ # # DOXYGEN_DOT_EXECUTABLE = The path to the dot program used by doxygen. # DOXYGEN_DOT_FOUND = Was Dot found or not? -# DOXYGEN_DOT_PATH = The path to dot not including the executable +# +# For compatibility with older versions of CMake, the now-deprecated +# variable ``DOXYGEN_DOT_PATH`` is set to the path to the directory +# containing ``dot`` as reported in ``DOXYGEN_DOT_EXECUTABLE``. +# The path may have forward slashes even on Windows and is not +# suitable for direct substitution into a ``Doxyfile.in`` template. +# If you need this value, use :command:`get_filename_component` +# to compute it from ``DOXYGEN_DOT_EXECUTABLE`` directly, and +# perhaps the :command:`file(TO_NATIVE_PATH)` command to prepare +# the path for a Doxygen configuration file. #============================================================================= # Copyright 2001-2009 Kitware, Inc. @@ -101,12 +110,18 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Doxygen REQUIRED_VARS DOXYGEN_EXECUTABLE VERSI # Find Dot... # +set(_x86 "(x86)") +file(GLOB _Doxygen_GRAPHVIZ_BIN_DIRS + "$ENV{ProgramFiles}/Graphviz*/bin" + "$ENV{ProgramFiles${_x86}}/Graphviz*/bin" + ) +unset(_x86) + if(NOT DOXYGEN_SKIP_DOT) find_program(DOXYGEN_DOT_EXECUTABLE NAMES dot PATHS - "$ENV{ProgramFiles}/Graphviz 2.21/bin" - "C:/Program Files/Graphviz 2.21/bin" + ${_Doxygen_GRAPHVIZ_BIN_DIRS} "$ENV{ProgramFiles}/ATT/Graphviz/bin" "C:/Program Files/ATT/Graphviz/bin" [HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin @@ -119,7 +134,7 @@ if(NOT DOXYGEN_SKIP_DOT) if(DOXYGEN_DOT_EXECUTABLE) set(DOXYGEN_DOT_FOUND TRUE) # The Doxyfile wants the path to Dot, not the entire path and executable - get_filename_component(DOXYGEN_DOT_PATH "${DOXYGEN_DOT_EXECUTABLE}" PATH CACHE) + get_filename_component(DOXYGEN_DOT_PATH "${DOXYGEN_DOT_EXECUTABLE}" PATH) endif() endif() @@ -153,5 +168,4 @@ set (DOT ${DOXYGEN_DOT_EXECUTABLE} ) mark_as_advanced( DOXYGEN_EXECUTABLE DOXYGEN_DOT_EXECUTABLE - DOXYGEN_DOT_PATH ) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c9ae7aa..154574f 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 20140528) +set(CMake_VERSION_PATCH 20140530) #set(CMake_VERSION_RC 1) diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index d5f00ff..6a95550 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -173,6 +173,10 @@ bool cmAddCustomCommandCommand break; } + if (cmSystemTools::FileIsFullPath(filename.c_str())) + { + filename = cmSystemTools::CollapseFullPath(filename); + } switch (doing) { case doing_working_directory: diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index cebd9f5..ebfbf7c 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -103,8 +103,18 @@ std::vector<std::string> const& cmCustomCommandGenerator::GetDepends() const { cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(*i); + std::vector<std::string> result; cmSystemTools::ExpandListArgument( - cge->Evaluate(this->Makefile, this->Config), this->Depends); + cge->Evaluate(this->Makefile, this->Config), result); + for (std::vector<std::string>::iterator it = result.begin(); + it != result.end(); ++it) + { + if (cmSystemTools::FileIsFullPath(it->c_str())) + { + *it = cmSystemTools::CollapseFullPath(*it); + } + } + this->Depends.insert(this->Depends.end(), result.begin(), result.end()); } } return this->Depends; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 42033c5..b581147 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -1024,11 +1024,11 @@ static cmVS7FlagTable cmVS7ExtraFlagTable[] = cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "", cmVS7FlagTable::UserValueRequired}, - {"WholeProgramOptimization", "LTCG", "WholeProgramOptimization", "TRUE", 0}, + {"WholeProgramOptimization", "LTCG", "WholeProgramOptimization", "true", 0}, // Exception handling mode. If no entries match, it will be FALSE. - {"ExceptionHandling", "GX", "enable c++ exceptions", "TRUE", 0}, - {"ExceptionHandling", "EHsc", "enable c++ exceptions", "TRUE", 0}, + {"ExceptionHandling", "GX", "enable c++ exceptions", "true", 0}, + {"ExceptionHandling", "EHsc", "enable c++ exceptions", "true", 0}, // The EHa option does not have an IDE setting. Let it go to false, // and have EHa passed on the command line by leaving out the table // entry. 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/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 47f9826..a6c6e8d 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -486,34 +486,34 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] = cmVS7FlagTable::UserValue}, // boolean flags - {"BufferSecurityCheck", "GS", "Buffer security check", "TRUE", 0}, - {"BufferSecurityCheck", "GS-", "Turn off Buffer security check", "FALSE", 0}, + {"BufferSecurityCheck", "GS", "Buffer security check", "true", 0}, + {"BufferSecurityCheck", "GS-", "Turn off Buffer security check", "false", 0}, {"Detect64BitPortabilityProblems", "Wp64", - "Detect 64-bit Portability Problems", "TRUE", 0}, + "Detect 64-bit Portability Problems", "true", 0}, {"EnableFiberSafeOptimizations", "GT", "Enable Fiber-safe Optimizations", - "TRUE", 0}, + "true", 0}, {"EnableFunctionLevelLinking", "Gy", - "EnableFunctionLevelLinking", "TRUE", 0}, - {"EnableIntrinsicFunctions", "Oi", "EnableIntrinsicFunctions", "TRUE", 0}, - {"GlobalOptimizations", "Og", "Global Optimize", "TRUE", 0}, + "EnableFunctionLevelLinking", "true", 0}, + {"EnableIntrinsicFunctions", "Oi", "EnableIntrinsicFunctions", "true", 0}, + {"GlobalOptimizations", "Og", "Global Optimize", "true", 0}, {"ImproveFloatingPointConsistency", "Op", - "ImproveFloatingPointConsistency", "TRUE", 0}, - {"MinimalRebuild", "Gm", "minimal rebuild", "TRUE", 0}, - {"OmitFramePointers", "Oy", "OmitFramePointers", "TRUE", 0}, - {"OptimizeForWindowsApplication", "GA", "Optimize for windows", "TRUE", 0}, + "ImproveFloatingPointConsistency", "true", 0}, + {"MinimalRebuild", "Gm", "minimal rebuild", "true", 0}, + {"OmitFramePointers", "Oy", "OmitFramePointers", "true", 0}, + {"OptimizeForWindowsApplication", "GA", "Optimize for windows", "true", 0}, {"RuntimeTypeInfo", "GR", - "Turn on Run time type information for c++", "TRUE", 0}, + "Turn on Run time type information for c++", "true", 0}, {"RuntimeTypeInfo", "GR-", - "Turn off Run time type information for c++", "FALSE", 0}, - {"SmallerTypeCheck", "RTCc", "smaller type check", "TRUE", 0}, - {"SuppressStartupBanner", "nologo", "SuppressStartupBanner", "TRUE", 0}, + "Turn off Run time type information for c++", "false", 0}, + {"SmallerTypeCheck", "RTCc", "smaller type check", "true", 0}, + {"SuppressStartupBanner", "nologo", "SuppressStartupBanner", "true", 0}, {"WholeProgramOptimization", "GL", - "Enables whole program optimization", "TRUE", 0}, + "Enables whole program optimization", "true", 0}, {"WholeProgramOptimization", "GL-", - "Disables whole program optimization", "FALSE", 0}, - {"WarnAsError", "WX", "Treat warnings as errors", "TRUE", 0}, + "Disables whole program optimization", "false", 0}, + {"WarnAsError", "WX", "Treat warnings as errors", "true", 0}, {"BrowseInformation", "FR", "Generate browse information", "1", 0}, - {"StringPooling", "GF", "Enable StringPooling", "TRUE", 0}, + {"StringPooling", "GF", "Enable StringPooling", "true", 0}, {0,0,0,0,0} }; @@ -523,8 +523,8 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] = { // option flags (some flags map to the same option) {"GenerateManifest", "MANIFEST:NO", - "disable manifest generation", "FALSE", 0}, - {"GenerateManifest", "MANIFEST", "enable manifest generation", "TRUE", 0}, + "disable manifest generation", "false", 0}, + {"GenerateManifest", "MANIFEST", "enable manifest generation", "true", 0}, {"LinkIncremental", "INCREMENTAL:NO", "link incremental", "1", 0}, {"LinkIncremental", "INCREMENTAL:YES", "link incremental", "2", 0}, {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK:NO", "", "false", 0}, @@ -540,7 +540,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] = {"IgnoreDefaultLibraryNames", "NODEFAULTLIB:", "default libs to ignore", "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, {"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "ignore all default libs", - "TRUE", 0}, + "true", 0}, {"FixedBaseAddress", "FIXED:NO", "Generate a relocation section", "1", 0}, {"FixedBaseAddress", "FIXED", "Image must be loaded at a fixed address", "2", 0}, @@ -579,7 +579,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] = "No assembly even if CLR information is present in objects.", "true", 0}, {"ModuleDefinitionFile", "DEF:", "add an export def file", "", cmVS7FlagTable::UserValue}, - {"GenerateMapFile", "MAP", "enable generation of map file", "TRUE", 0}, + {"GenerateMapFile", "MAP", "enable generation of map file", "true", 0}, {0,0,0,0,0} }; @@ -782,7 +782,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, << "\"\n" << "\t\t\tConfigurationType=\"" << configType << "\"\n" << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n" - << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"; + << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"false\"\n"; // If unicode is enabled change the character set to unicode, if not // then default to MBCS. @@ -895,7 +895,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, fout << ipath << ";"; } fout << "\"\n"; - fout << "\t\t\t\tMkTypLibCompatible=\"FALSE\"\n"; + fout << "\t\t\t\tMkTypLibCompatible=\"false\"\n"; if( this->PlatformName == "x64" ) { fout << "\t\t\t\tTargetEnvironment=\"3\"\n"; @@ -908,7 +908,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, { fout << "\t\t\t\tTargetEnvironment=\"1\"\n"; } - fout << "\t\t\t\tGenerateStublessProxies=\"TRUE\"\n"; + fout << "\t\t\t\tGenerateStublessProxies=\"true\"\n"; fout << "\t\t\t\tTypeLibraryName=\"$(InputName).tlb\"\n"; fout << "\t\t\t\tOutputDirectory=\"$(IntDir)\"\n"; fout << "\t\t\t\tHeaderFileName=\"$(InputName).h\"\n"; @@ -1132,7 +1132,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; if(targetOptions.IsDebug()) { - fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n"; + fout << "\t\t\t\tGenerateDebugInformation=\"true\"\n"; } if(this->WindowsCEProject) { @@ -1230,7 +1230,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, << "\"\n"; if(targetOptions.IsDebug()) { - fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n"; + fout << "\t\t\t\tGenerateDebugInformation=\"true\"\n"; } if ( this->WindowsCEProject ) { 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/cmake.h b/Source/cmake.h index 3db77e6..329b439 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -477,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) \ @@ -497,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) \ @@ -509,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) \ @@ -521,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/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/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index e0854ce..b97cd16 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -456,3 +456,30 @@ add_custom_target(source_in_custom_target SOURCES source_in_custom_target.cpp) set_property(SOURCE source_in_custom_target PROPERTY COMPILE_DEFINITIONS "TEST" ) + +set(gen_path "${CMAKE_CURRENT_BINARY_DIR}//./foo") +set(gen_file "${gen_path}/foo.cxx") + +add_custom_command( + OUTPUT "${gen_file}" + # Make sure the output directory exists before trying to write to it. + COMMAND ${CMAKE_COMMAND} -E make_directory "${gen_path}" + COMMAND ${CMAKE_COMMAND} -E touch "${gen_file}" +) + +add_library(NormOutput "${gen_file}") + +set(gen_path "${gen_path}/bar") +set(gen_file "${gen_path}/bar.cxx") + +add_custom_command( + OUTPUT "${gen_path}" + COMMAND ${CMAKE_COMMAND} -E make_directory "${gen_path}" +) + +add_custom_command( + OUTPUT "${gen_file}" + DEPENDS "${gen_path}" + COMMAND ${CMAKE_COMMAND} -E touch "${gen_file}") + +add_library(NormDepends "${gen_file}") 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}" |