summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Auxiliary/cmake-mode.el1
-rw-r--r--Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst9
-rw-r--r--Help/release/dev/GNU-4.4-compile-features.rst (renamed from Help/release/dev/GNU-4.6-compile-features.rst)4
-rw-r--r--Help/release/dev/SolarisStudio-compile-features.rst5
-rw-r--r--Help/release/dev/WriteCompilerDetectionHeader-multi-file-lang.rst6
-rw-r--r--Modules/Compiler/GNU-C-FeatureTests.cmake4
-rw-r--r--Modules/Compiler/GNU-C.cmake6
-rw-r--r--Modules/Compiler/GNU-CXX-FeatureTests.cmake9
-rw-r--r--Modules/Compiler/GNU-CXX.cmake6
-rw-r--r--Modules/Compiler/SunPro-CXX-FeatureTests.cmake52
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake21
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake45
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx62
-rw-r--r--Source/cmGlobalXCodeGenerator.h6
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt32
-rw-r--r--Tests/CompileFeatures/cxx_auto_type.cpp9
-rw-r--r--Tests/CompileFeatures/cxx_inheriting_constructors.cpp2
-rw-r--r--Tests/CompileFeatures/cxx_variadic_templates.cpp21
-rw-r--r--Tests/CompileFeatures/genex_test.cpp13
-rw-r--r--Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt21
-rw-r--r--Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake6
22 files changed, 261 insertions, 81 deletions
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el
index 37ca942..7458a66 100644
--- a/Auxiliary/cmake-mode.el
+++ b/Auxiliary/cmake-mode.el
@@ -320,6 +320,7 @@ and store the result as a list in LISTVAR."
))
)
+(require 'thingatpt)
(defun cmake-symbol-at-point ()
(let ((symbol (symbol-at-point)))
(and (not (null symbol))
diff --git a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst
index e24822c..163ae34 100644
--- a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst
+++ b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst
@@ -130,9 +130,11 @@ The features known to this version of CMake are:
.. _N1987: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm
``cxx_final``
- Override control ``final`` keyword, as defined in N2928_.
+ Override control ``final`` keyword, as defined in N2928_, N3206_ and N3272_.
.. _N2928: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm
+ .. _N3206: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm
+ .. _N3272: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3272.htm
``cxx_func_identifier``
Predefined ``__func__`` identifier, as defined in N2340_.
@@ -195,9 +197,12 @@ The features known to this version of CMake are:
.. _N2431: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf
``cxx_override``
- Override control ``override`` keyword, as defined in N2928_.
+ Override control ``override`` keyword, as defined in N2928_, N3206_
+ and N3272_.
.. _N2928: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm
+ .. _N3206: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm
+ .. _N3272: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3272.htm
``cxx_range_for``
Range-based for, as defined in N2930_.
diff --git a/Help/release/dev/GNU-4.6-compile-features.rst b/Help/release/dev/GNU-4.4-compile-features.rst
index 059a075..d5c1356 100644
--- a/Help/release/dev/GNU-4.6-compile-features.rst
+++ b/Help/release/dev/GNU-4.4-compile-features.rst
@@ -1,5 +1,5 @@
-GNU-4.6-compile-features
+GNU-4.4-compile-features
------------------------
* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
- is now aware of features supported by GNU 4.6 compilers.
+ is now aware of features supported by GNU 4.4 to 4.6 compilers.
diff --git a/Help/release/dev/SolarisStudio-compile-features.rst b/Help/release/dev/SolarisStudio-compile-features.rst
new file mode 100644
index 0000000..83110cd
--- /dev/null
+++ b/Help/release/dev/SolarisStudio-compile-features.rst
@@ -0,0 +1,5 @@
+SolarisStudio-compile-features
+------------------------------
+
+* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
+ is now aware of features supported by Oracle SolarisStudio (``SunPro``).
diff --git a/Help/release/dev/WriteCompilerDetectionHeader-multi-file-lang.rst b/Help/release/dev/WriteCompilerDetectionHeader-multi-file-lang.rst
new file mode 100644
index 0000000..a8665da
--- /dev/null
+++ b/Help/release/dev/WriteCompilerDetectionHeader-multi-file-lang.rst
@@ -0,0 +1,6 @@
+WriteCompilerDetectionHeader-multi-file
+---------------------------------------
+
+* The :module:`WriteCompilerDetectionHeader` module learned to create
+ multiple output files per compiler and per language, instead of creating
+ one large file.
diff --git a/Modules/Compiler/GNU-C-FeatureTests.cmake b/Modules/Compiler/GNU-C-FeatureTests.cmake
index 7e840aa..d8e456c 100644
--- a/Modules/Compiler/GNU-C-FeatureTests.cmake
+++ b/Modules/Compiler/GNU-C-FeatureTests.cmake
@@ -1,5 +1,5 @@
-set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406")
+set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404")
# GNU 4.7 correctly sets __STDC_VERSION__ to 201112L, but GNU 4.6 sets it
# to 201000L. As the former is strictly greater than the latter, test only
@@ -9,7 +9,7 @@ set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406")
set(GNU46_C11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L")
set(_cmake_feature_test_c_static_assert "${GNU46_C11}")
# Since 4.4 at least:
-set(GNU44_C99 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
+set(GNU44_C99 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
set(_cmake_feature_test_c_restrict "${GNU44_C99}")
set(_cmake_feature_test_c_variadic_macros "${GNU44_C99}")
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index d5e747d..3036057 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -1,7 +1,7 @@
include(Compiler/GNU)
__compiler_gnu(C)
-if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
+if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
@@ -12,7 +12,7 @@ endif()
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
-elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
+elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c1x")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
endif()
@@ -29,7 +29,7 @@ macro(cmake_record_c_compile_features)
endmacro()
set(_result 0)
- if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
+ if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
_get_gcc_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
if (_result EQUAL 0)
_get_gcc_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)
diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake
index 267d658..5fc3deb 100644
--- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake
@@ -2,7 +2,7 @@
# Reference: http://gcc.gnu.org/projects/cxx0x.html
# http://gcc.gnu.org/projects/cxx1y.html
-set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406")
+set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404")
set(GNU50_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L")
set(_cmake_feature_test_cxx_variable_templates "${GNU50_CXX14}")
@@ -59,7 +59,6 @@ set(_cmake_feature_test_cxx_user_literals "${GNU47_CXX11}")
# __GXX_EXPERIMENTAL_CXX0X__ is defined in prior versions, but may not be
# defined in the future.
set(GNU_CXX0X_DEFINED "(__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))")
-# TODO: Should be supported by GNU 4.6
set(GNU46_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && ${GNU_CXX0X_DEFINED}")
set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}")
set(_cmake_feature_test_cxx_defaulted_move_initializers "${GNU46_CXX11}")
@@ -68,14 +67,12 @@ set(_cmake_feature_test_cxx_noexcept "${GNU46_CXX11}")
set(_cmake_feature_test_cxx_nullptr "${GNU46_CXX11}")
set(_cmake_feature_test_cxx_range_for "${GNU46_CXX11}")
set(_cmake_feature_test_cxx_unrestricted_unions "${GNU46_CXX11}")
-# TODO: Should be supported by GNU 4.5
-set(GNU45_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
+set(GNU45_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && ${GNU_CXX0X_DEFINED}")
set(_cmake_feature_test_cxx_explicit_conversions "${GNU45_CXX11}")
set(_cmake_feature_test_cxx_lambdas "${GNU45_CXX11}")
set(_cmake_feature_test_cxx_local_type_template_args "${GNU45_CXX11}")
set(_cmake_feature_test_cxx_raw_string_literals "${GNU45_CXX11}")
-# TODO: Should be supported by GNU 4.4
-set(GNU44_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
+set(GNU44_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && ${GNU_CXX0X_DEFINED}")
set(_cmake_feature_test_cxx_auto_type "${GNU44_CXX11}")
set(_cmake_feature_test_cxx_defaulted_functions "${GNU44_CXX11}")
set(_cmake_feature_test_cxx_deleted_functions "${GNU44_CXX11}")
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index eeada86..c471daf 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -11,7 +11,7 @@ else()
endif()
endif()
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
# Supported since 4.3
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
@@ -20,7 +20,7 @@ endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
-elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
+elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
# 4.3 supports 0x variants
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
@@ -45,7 +45,7 @@ macro(cmake_record_cxx_compile_features)
if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
_get_gcc_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
endif()
- if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
+ if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
if (_result EQUAL 0)
_get_gcc_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
endif()
diff --git a/Modules/Compiler/SunPro-CXX-FeatureTests.cmake b/Modules/Compiler/SunPro-CXX-FeatureTests.cmake
new file mode 100644
index 0000000..8e97e1d
--- /dev/null
+++ b/Modules/Compiler/SunPro-CXX-FeatureTests.cmake
@@ -0,0 +1,52 @@
+
+# Based on GNU 4.8.2
+# http://docs.oracle.com/cd/E37069_01/html/E37071/gncix.html
+# Reference: http://gcc.gnu.org/projects/cxx0x.html
+
+set(_cmake_oldestSupported "__SUNPRO_CC >= 0x5130")
+
+set(SolarisStudio124_CXX11 "(__SUNPRO_CC >= 0x5130) && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_alignas "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_alignof "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_attributes "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_inheriting_constructors "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_thread_local "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_alias_templates "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_delegating_constructors "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_extended_friend_declarations "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_final "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_noexcept "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_nonstatic_member_init "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_override "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_constexpr "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_defaulted_move_initializers "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_enum_forward_declarations "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_nullptr "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_range_for "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_unrestricted_unions "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_explicit_conversions "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_lambdas "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_local_type_template_args "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_raw_string_literals "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_auto_type "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_defaulted_functions "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_deleted_functions "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_generalized_initializers "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_inline_namespaces "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_sizeof_member "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_strong_enums "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_trailing_return_types "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_unicode_literals "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_uniform_initialization "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_variadic_templates "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_decltype "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_default_function_template_args "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_long_long_type "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_right_angle_brackets "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_rvalue_references "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_static_assert "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_extern_templates "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_func_identifier "${SolarisStudio124_CXX11}")
+set(_cmake_feature_test_cxx_variadic_macros "${SolarisStudio124_CXX11}")
+
+set(_cmake_feature_test_cxx_template_template_parameters "${_cmake_oldestSupported} && __cplusplus")
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index 5968712..cb37713 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -31,3 +31,24 @@ set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE> -
set(CMAKE_CXX_CREATE_STATIC_LIBRARY
"<CMAKE_CXX_COMPILER> -xar -o <TARGET> <OBJECTS> "
"<CMAKE_RANLIB> <TARGET> ")
+
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
+endif()
+
+set(CMAKE_CXX_STANDARD_DEFAULT 98)
+
+macro(cmake_record_cxx_compile_features)
+ macro(_get_solaris_studio_features std_version list)
+ record_compiler_features(CXX "${std_version}" ${list})
+ endmacro()
+
+ set(_result 0)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
+ _get_solaris_studio_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
+ if (_result EQUAL 0)
+ _get_solaris_studio_features("" CMAKE_CXX98_COMPILE_FEATURES)
+ endif()
+ endif()
+endmacro()
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index d61358f..e81bc08 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -234,7 +234,11 @@ function(_load_compiler_variables CompilerId lang)
foreach(feature ${ARGN})
set(_cmake_feature_test_${CompilerId}_${feature} ${_cmake_feature_test_${feature}} PARENT_SCOPE)
endforeach()
- include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-DetermineCompiler.cmake" OPTIONAL)
+ include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-${lang}-DetermineCompiler.cmake" OPTIONAL
+ RESULT_VARIABLE determinedCompiler)
+ if (NOT determinedCompiler)
+ include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-DetermineCompiler.cmake" OPTIONAL)
+ endif()
set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE)
endfunction()
@@ -317,6 +321,7 @@ function(write_compiler_detection_header
GNU
Clang
AppleClang
+ SunPro
)
set(_hex_compilers ADSP Borland Embarcadero SunPro)
@@ -382,6 +387,13 @@ function(write_compiler_detection_header
endif()
foreach(_lang ${_langs})
+ set(target_compilers)
+ foreach(compiler ${_WCD_COMPILERS})
+ _load_compiler_variables(${compiler} ${_lang} ${${_lang}_features})
+ if(_cmake_oldestSupported_${compiler})
+ list(APPEND target_compilers ${compiler})
+ endif()
+ endforeach()
get_property(known_features GLOBAL PROPERTY CMAKE_${_lang}_KNOWN_FEATURES)
foreach(feature ${${_lang}_features})
@@ -404,17 +416,16 @@ function(write_compiler_detection_header
set(file_content "${file_content}${ID_CONTENT}\n")
set(pp_if "if")
- foreach(compiler ${_WCD_COMPILERS})
- _load_compiler_variables(${compiler} ${_lang} ${${_lang}_features})
+ foreach(compiler ${target_compilers})
set(file_content "${file_content}\n# ${pp_if} ${prefix_arg}_COMPILER_IS_${compiler}\n")
if(_WCD_OUTPUT_FILES_VAR)
- set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}.h")
+ set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}_${_lang}.h")
set(file_content "${file_content}\n# include \"${compile_file_name}\"\n")
endif()
if(_WCD_OUTPUT_FILES_VAR)
- set(compiler_file_content compiler_file_content_${compiler})
+ set(compiler_file_content compiler_file_content_${compiler}_${_lang})
else()
set(compiler_file_content file_content)
endif()
@@ -617,16 +628,20 @@ function(write_compiler_detection_header
if(_WCD_OUTPUT_FILES_VAR)
foreach(compiler ${_WCD_COMPILERS})
- set(CMAKE_CONFIGURABLE_FILE_CONTENT "${compiler_file_content_}")
- set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}${compiler_file_content_${compiler}}")
-
- set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}.h")
- set(full_path "${main_file_dir}/${compile_file_name}")
- list(APPEND ${_WCD_OUTPUT_FILES_VAR} ${full_path})
- configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
- "${full_path}"
- @ONLY
- )
+ foreach(_lang ${_langs})
+ if(compiler_file_content_${compiler}_${_lang})
+ set(CMAKE_CONFIGURABLE_FILE_CONTENT "${compiler_file_content_}")
+ set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}${compiler_file_content_${compiler}_${_lang}}")
+
+ set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}_${_lang}.h")
+ set(full_path "${main_file_dir}/${compile_file_name}")
+ list(APPEND ${_WCD_OUTPUT_FILES_VAR} ${full_path})
+ configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
+ "${full_path}"
+ @ONLY
+ )
+ endif()
+ endforeach()
endforeach()
set(${_WCD_OUTPUT_FILES_VAR} ${${_WCD_OUTPUT_FILES_VAR}} PARENT_SCOPE)
endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index daae107..3dd8e7b 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 1)
-set(CMake_VERSION_PATCH 20150119)
+set(CMake_VERSION_PATCH 20150120)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 8831a8b..b6c428b 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -969,16 +969,40 @@ struct cmSourceFilePathCompare
};
//----------------------------------------------------------------------------
-void
+struct cmCompareTargets
+{
+ bool operator () (std::string const& a, std::string const& b) const
+ {
+ if (a == "ALL_BUILD")
+ {
+ return true;
+ }
+ if (b == "ALL_BUILD")
+ {
+ return false;
+ }
+ return strcmp(a.c_str(), b.c_str()) < 0;
+ }
+};
+
+//----------------------------------------------------------------------------
+bool
cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
std::vector<cmXCodeObject*>&
targets)
{
this->SetCurrentLocalGenerator(gen);
cmTargets &tgts = this->CurrentMakefile->GetTargets();
+ typedef std::map<std::string, cmTarget*, cmCompareTargets> cmSortedTargets;
+ cmSortedTargets sortedTargets;
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
{
- cmTarget& cmtarget = l->second;
+ sortedTargets[l->first] = &l->second;
+ }
+ for(cmSortedTargets::iterator l = sortedTargets.begin();
+ l != sortedTargets.end(); l++)
+ {
+ cmTarget& cmtarget = *l->second;
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
// make sure ALL_BUILD, INSTALL, etc are only done once
@@ -995,7 +1019,12 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
if(cmtarget.GetType() == cmTarget::UTILITY ||
cmtarget.GetType() == cmTarget::GLOBAL_TARGET)
{
- targets.push_back(this->CreateUtilityTarget(cmtarget));
+ cmXCodeObject* t = this->CreateUtilityTarget(cmtarget);
+ if (!t)
+ {
+ return false;
+ }
+ targets.push_back(t);
continue;
}
@@ -1003,7 +1032,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
std::vector<cmSourceFile*> classes;
if (!cmtarget.GetConfigCommonSourceFiles(classes))
{
- return;
+ return false;
}
std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare());
@@ -1230,6 +1259,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
targets.push_back(this->CreateXCodeTarget(cmtarget, buildPhases));
}
+ return true;
}
//----------------------------------------------------------------------------
@@ -2906,7 +2936,7 @@ void cmGlobalXCodeGenerator
}
//----------------------------------------------------------------------------
-void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
+bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>&
generators)
{
@@ -2949,7 +2979,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
std::vector<cmSourceFile*> classes;
if (!cmtarget.GetConfigCommonSourceFiles(classes))
{
- return;
+ return false;
}
// Put cmSourceFile instances in proper groups:
for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
@@ -2982,6 +3012,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
}
}
}
+ return true;
}
cmXCodeObject *cmGlobalXCodeGenerator
@@ -3102,7 +3133,7 @@ cmXCodeObject* cmGlobalXCodeGenerator
}
//----------------------------------------------------------------------------
-void cmGlobalXCodeGenerator
+bool cmGlobalXCodeGenerator
::CreateXCodeObjects(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>&
generators)
@@ -3183,7 +3214,10 @@ void cmGlobalXCodeGenerator
this->MainGroupChildren->AddObject(resourcesGroup);
// now create the cmake groups
- this->CreateGroups(root, generators);
+ if (!this->CreateGroups(root, generators))
+ {
+ return false;
+ }
cmXCodeObject* productGroup = this->CreateObject(cmXCodeObject::PBXGroup);
productGroup->AddAttribute("name", this->CreateString("Products"));
@@ -3383,7 +3417,10 @@ void cmGlobalXCodeGenerator
{
if(!this->IsExcluded(root, *i))
{
- this->CreateXCodeTargets(*i, targets);
+ if (!this->CreateXCodeTargets(*i, targets))
+ {
+ return false;
+ }
}
}
// loop over all targets and add link and depend info
@@ -3412,6 +3449,7 @@ void cmGlobalXCodeGenerator
}
}
this->RootObject->AddAttribute("targets", allTargets);
+ return true;
}
//----------------------------------------------------------------------------
@@ -3598,8 +3636,10 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
}
}
- this->CreateXCodeObjects(root,
- generators);
+ if (!this->CreateXCodeObjects(root, generators))
+ {
+ return;
+ }
std::string xcodeDir = root->GetMakefile()->GetStartOutputDirectory();
xcodeDir += "/";
xcodeDir += root->GetMakefile()->GetProjectName();
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index f38435e..a39c8c7 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -91,7 +91,7 @@ private:
cmSourceGroup* sg);
cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent,
std::string name);
- void CreateGroups(cmLocalGenerator* root,
+ bool CreateGroups(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>&
generators);
std::string XCodeEscapePath(const char* p);
@@ -150,7 +150,7 @@ private:
std::string ExtractFlag(const char* flag, std::string& flags);
// delete all objects in the this->XCodeObjects vector.
void ClearXCodeObjects();
- void CreateXCodeObjects(cmLocalGenerator* root,
+ bool CreateXCodeObjects(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
void OutputXCodeProject(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
@@ -169,7 +169,7 @@ private:
cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen,
cmSourceFile* sf,
cmTarget& cmtarget);
- void CreateXCodeTargets(cmLocalGenerator* gen,
+ bool CreateXCodeTargets(cmLocalGenerator* gen,
std::vector<cmXCodeObject*>&);
bool IsHeaderFile(cmSourceFile*);
void AddDependTarget(cmXCodeObject* target,
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index 106f29c..5cd0836 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -51,6 +51,25 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"
)
endif()
+if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro)
+ list(REMOVE_ITEM CXX_non_features
+ cxx_attribute_deprecated
+ cxx_contextual_conversions
+ cxx_extended_friend_declarations
+ cxx_long_long_type
+ cxx_sizeof_member
+ cxx_variadic_macros
+ )
+endif()
+
+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
+ AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
+ # The cxx_constexpr feature happens to work (for *this* testcase) with
+ # GNU 4.5, but it is first documented as available with GNU 4.6.
+ list(REMOVE_ITEM CXX_non_features
+ cxx_constexpr
+ )
+endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
# The cxx_alignof feature happens to work (for *this* testcase) with
@@ -188,13 +207,20 @@ if (CMAKE_CXX_COMPILE_FEATURES)
-DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0
)
endif()
+ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
+ add_definitions(
+ -DEXPECT_OVERRIDE_CONTROL=1
+ -DEXPECT_INHERITING_CONSTRUCTORS=1
+ -DEXPECT_FINAL=1
+ -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1
+ )
endif()
add_executable(CompileFeaturesGenex genex_test.cpp)
set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11)
target_compile_definitions(CompileFeaturesGenex PRIVATE
HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>
- HAVE_NULLPTR=$<COMPILE_FEATURES:cxx_nullptr>
+ HAVE_AUTO_TYPE=$<COMPILE_FEATURES:cxx_auto_type>
HAVE_INHERITING_CONSTRUCTORS=$<COMPILE_FEATURES:cxx_inheriting_constructors>
HAVE_FINAL=$<COMPILE_FEATURES:cxx_final>
HAVE_INHERITING_CONSTRUCTORS_AND_FINAL=$<COMPILE_FEATURES:cxx_inheriting_constructors,cxx_final>
@@ -204,7 +230,7 @@ if (CMAKE_CXX_COMPILE_FEATURES)
target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_static_assert)
target_compile_definitions(CompileFeaturesGenex2 PRIVATE
HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>
- HAVE_NULLPTR=$<COMPILE_FEATURES:cxx_nullptr>
+ HAVE_AUTO_TYPE=$<COMPILE_FEATURES:cxx_auto_type>
HAVE_INHERITING_CONSTRUCTORS=$<COMPILE_FEATURES:cxx_inheriting_constructors>
HAVE_FINAL=$<COMPILE_FEATURES:cxx_final>
HAVE_INHERITING_CONSTRUCTORS_AND_FINAL=$<COMPILE_FEATURES:cxx_inheriting_constructors,cxx_final>
@@ -216,7 +242,7 @@ if (CMAKE_CXX_COMPILE_FEATURES)
target_link_libraries(CompileFeaturesGenex3 PRIVATE static_assert_iface)
target_compile_definitions(CompileFeaturesGenex3 PRIVATE
HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>
- HAVE_NULLPTR=$<COMPILE_FEATURES:cxx_nullptr>
+ HAVE_AUTO_TYPE=$<COMPILE_FEATURES:cxx_auto_type>
HAVE_INHERITING_CONSTRUCTORS=$<COMPILE_FEATURES:cxx_inheriting_constructors>
HAVE_FINAL=$<COMPILE_FEATURES:cxx_final>
HAVE_INHERITING_CONSTRUCTORS_AND_FINAL=$<COMPILE_FEATURES:cxx_inheriting_constructors,cxx_final>
diff --git a/Tests/CompileFeatures/cxx_auto_type.cpp b/Tests/CompileFeatures/cxx_auto_type.cpp
index 7dbf04f..1f36a79 100644
--- a/Tests/CompileFeatures/cxx_auto_type.cpp
+++ b/Tests/CompileFeatures/cxx_auto_type.cpp
@@ -1,5 +1,12 @@
+double foo_ = 3.14;
+
+double& foo()
+{
+ return foo_;
+}
+
void someFunc()
{
- auto x = 3.14;
+ auto& x = foo();
}
diff --git a/Tests/CompileFeatures/cxx_inheriting_constructors.cpp b/Tests/CompileFeatures/cxx_inheriting_constructors.cpp
index a83b624..cfce880 100644
--- a/Tests/CompileFeatures/cxx_inheriting_constructors.cpp
+++ b/Tests/CompileFeatures/cxx_inheriting_constructors.cpp
@@ -13,6 +13,6 @@ struct B : public A
void someFunc()
{
- int i;
+ int i = 0;
B b(i);
}
diff --git a/Tests/CompileFeatures/cxx_variadic_templates.cpp b/Tests/CompileFeatures/cxx_variadic_templates.cpp
index a80e157..e1f641b 100644
--- a/Tests/CompileFeatures/cxx_variadic_templates.cpp
+++ b/Tests/CompileFeatures/cxx_variadic_templates.cpp
@@ -1,21 +1,30 @@
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) < 407)
+#define OLD_GNU
+#endif
+
+#ifdef OLD_GNU
template<int... Is>
struct Interface;
+#endif
-template<int I>
-struct Interface<I>
+template<int I, int... Is>
+struct Interface
+#ifdef OLD_GNU
+ <I, Is...>
+#endif
{
static int accumulate()
{
- return I;
+ return I + Interface<Is...>::accumulate();
}
};
-template<int I, int... Is>
-struct Interface<I, Is...>
+template<int I>
+struct Interface<I>
{
static int accumulate()
{
- return I + Interface<Is...>::accumulate();
+ return I;
}
};
diff --git a/Tests/CompileFeatures/genex_test.cpp b/Tests/CompileFeatures/genex_test.cpp
index 0389dbd..d9c8eec 100644
--- a/Tests/CompileFeatures/genex_test.cpp
+++ b/Tests/CompileFeatures/genex_test.cpp
@@ -17,9 +17,9 @@ struct B final : A
#endif
-#if !HAVE_NULLPTR
-#error "Expect nullptr feature"
-#else
+#if !HAVE_AUTO_TYPE
+# error Expect cxx_auto_type support
+#endif
#if !HAVE_INHERITING_CONSTRUCTORS
# if EXPECT_INHERITING_CONSTRUCTORS
@@ -51,13 +51,6 @@ struct B final : A
# endif
#endif
-const char* getString()
-{
- return nullptr;
-}
-
-#endif
-
int main()
{
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
index 401de95..b5e46c0 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
+++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
@@ -11,7 +11,7 @@ get_property(c_known_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES)
write_compiler_detection_header(
FILE "${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h"
PREFIX TEST
- COMPILERS GNU Clang AppleClang
+ COMPILERS GNU Clang AppleClang SunPro
VERSION 3.1
PROLOG "// something"
EPILOG "// more"
@@ -25,12 +25,14 @@ if (NOT CMAKE_CXX_COMPILE_FEATURES AND NOT CMAKE_C_COMPILE_FEATURES)
)
add_executable(WriteCompilerDetectionHeader "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp")
- include(CheckCXXSourceCompiles)
- check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h\"\nint main() { return 0; }\n"
- file_include_works
- )
- if (file_include_works)
- message(SEND_ERROR "Inclusion of ${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h was expected to cause an error, but did not.")
+ if(UNIX OR NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ include(CheckCXXSourceCompiles)
+ check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h\"\nint main() { return 0; }\n"
+ file_include_works
+ )
+ if (file_include_works)
+ message(SEND_ERROR "Inclusion of ${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h was expected to cause an error, but did not.")
+ endif()
endif()
return()
endif()
@@ -58,7 +60,8 @@ endmacro()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
- OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
+ OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"
+ OR CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
# False for C++98 mode.
list(APPEND false_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS)
list(APPEND false_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES)
@@ -81,7 +84,7 @@ write_compiler_detection_header(
PREFIX MULTI
OUTPUT_FILES_VAR multi_files
OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files/compiler_support"
- COMPILERS GNU Clang AppleClang
+ COMPILERS GNU Clang AppleClang SunPro
VERSION 3.1
FEATURES
${cxx_known_features} ${c_known_features}
diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake
index d2c95ec..09594bd 100644
--- a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake
+++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake
@@ -6,10 +6,10 @@ add_library(empty3 INTERFACE)
target_compile_features(empty3 INTERFACE cxx_static_assert)
target_link_libraries(empty1
- # When starting, $<COMPILE_FEATURES:cxx_nullptr> is '0', so 'freeze' the
+ # When starting, $<COMPILE_FEATURES:cxx_auto_type> is '0', so 'freeze' the
# CXX_STANDARD at 98 during computation.
- $<$<COMPILE_FEATURES:cxx_nullptr>:empty2>
- # This would add cxx_constexpr, but that would require CXX_STANDARD = 11,
+ $<$<COMPILE_FEATURES:cxx_auto_type>:empty2>
+ # This would add cxx_static_assert, but that would require CXX_STANDARD = 11,
# which is not allowed after freeze. Report an error.
empty3
)