summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/Compiler/AppleClang-C.cmake15
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake18
-rw-r--r--Modules/Compiler/CMakeCommonCompilerMacros.cmake31
-rw-r--r--Modules/Compiler/Clang-C.cmake15
-rw-r--r--Modules/Compiler/Clang-CXX.cmake20
-rw-r--r--Modules/Compiler/GNU-C.cmake15
-rw-r--r--Modules/Compiler/GNU-CXX.cmake20
-rw-r--r--Modules/Compiler/Intel-C.cmake17
-rw-r--r--Modules/Compiler/Intel-CXX.cmake18
-rw-r--r--Modules/Compiler/MSVC-CXX.cmake32
-rw-r--r--Modules/Compiler/SunPro-C.cmake15
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake18
-rw-r--r--Modules/FindGSL.cmake11
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/kwsys/SystemInformation.cxx3
-rw-r--r--Source/kwsys/SystemTools.cxx11
-rw-r--r--Source/kwsys/SystemTools.hxx.in4
-rw-r--r--Source/kwsys/testSystemTools.cxx8
-rw-r--r--Tests/CMakeCommands/target_compile_features/CMakeLists.txt70
-rw-r--r--Tests/CMakeCommands/target_compile_features/dummy.cpp5
-rw-r--r--Tests/CMakeLists.txt13
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt23
-rw-r--r--Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt13
-rw-r--r--Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake5
-rw-r--r--Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake5
-rw-r--r--Utilities/Release/hythloth_release.cmake10
-rw-r--r--Utilities/Release/linux64_release.cmake1
-rwxr-xr-xbootstrap65
28 files changed, 212 insertions, 271 deletions
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake
index c18f541..a48adec 100644
--- a/Modules/Compiler/AppleClang-C.cmake
+++ b/Modules/Compiler/AppleClang-C.cmake
@@ -13,18 +13,3 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
endif()
__compiler_check_default_language_standard(C 4.0 99)
-
-macro(cmake_record_c_compile_features)
- set(_result 0)
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
- if (_result EQUAL 0)
- _record_compiler_features_c(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(99)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(90)
- endif()
- endif()
-endmacro()
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index 904d965..e5fd647 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -28,21 +28,3 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
endif()
__compiler_check_default_language_standard(CXX 4.0 98)
-
-macro(cmake_record_cxx_compile_features)
- set(_result 0)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
- if(_result EQUAL 0 AND CMAKE_CXX17_STANDARD_COMPILE_OPTION)
- _record_compiler_features_cxx(17)
- endif()
- if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION)
- _record_compiler_features_cxx(14)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(98)
- endif()
- endif()
-endmacro()
diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
index cb365d6..684fd30 100644
--- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake
+++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
@@ -60,3 +60,34 @@ macro(__compiler_check_default_language_standard lang stdver1 std1)
endif ()
unset(__std_ver_pairs)
endmacro()
+
+# Define to allow compile features to be automatically determined
+macro(cmake_record_c_compile_features)
+ set(_result 0)
+ if(_result EQUAL 0 AND DEFINED CMAKE_C11_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_c(11)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_C99_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_c(99)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_C90_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_c(90)
+ endif()
+endmacro()
+
+# Define to allow compile features to be automatically determined
+macro(cmake_record_cxx_compile_features)
+ set(_result 0)
+ if(_result EQUAL 0 AND DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(17)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(14)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_CXX11_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(11)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_CXX98_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(98)
+ endif()
+endmacro()
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index b94087f..b881e2b 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -18,18 +18,3 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
endif()
__compiler_check_default_language_standard(C 3.4 99 3.6 11)
-
-macro(cmake_record_c_compile_features)
- set(_result 0)
- if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
- if (_result EQUAL 0)
- _record_compiler_features_c(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(99)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(90)
- endif()
- endif()
-endmacro()
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 5904efa..d3707ee 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -36,22 +36,4 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
-__compiler_check_default_language_standard(CXX 3.1 98)
-
-macro(cmake_record_cxx_compile_features)
- set(_result 0)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
- if(_result EQUAL 0 AND CMAKE_CXX17_STANDARD_COMPILE_OPTION)
- _record_compiler_features_cxx(17)
- endif()
- if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION)
- _record_compiler_features_cxx(14)
- endif()
- if (_result EQUAL 0 AND CMAKE_CXX11_STANDARD_COMPILE_OPTION)
- _record_compiler_features_cxx(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(98)
- endif()
- endif()
-endmacro()
+__compiler_check_default_language_standard(CXX 2.1 98)
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index 8090fa6..f072c54 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -23,18 +23,3 @@ elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
endif()
__compiler_check_default_language_standard(C 3.4 90 5.0 11)
-
-macro(cmake_record_c_compile_features)
- set(_result 0)
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
- if(_result EQUAL 0 AND CMAKE_C11_STANDARD_COMPILE_OPTION)
- _record_compiler_features_c(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(99)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(90)
- endif()
- endif()
-endmacro()
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index b221c4a..4f1f30e 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -38,22 +38,4 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
-__compiler_check_default_language_standard(CXX 4.4 98 6.0 14)
-
-macro(cmake_record_cxx_compile_features)
- set(_result 0)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
- if(_result EQUAL 0 AND CMAKE_CXX17_STANDARD_COMPILE_OPTION)
- _record_compiler_features_cxx(17)
- endif()
- if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION)
- _record_compiler_features_cxx(14)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(98)
- endif()
- endif()
-endmacro()
+__compiler_check_default_language_standard(CXX 3.4 98 6.0 14)
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake
index 20e29e2..4e4af29 100644
--- a/Modules/Compiler/Intel-C.cmake
+++ b/Modules/Compiler/Intel-C.cmake
@@ -37,22 +37,7 @@ else()
endif()
-__compiler_check_default_language_standard(C 12.1 90 15.0.0 11)
-
-macro(cmake_record_c_compile_features)
- set(_result 0)
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
- if (_result EQUAL 0 AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
- _record_compiler_features_C(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_C(99)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_C(90)
- endif()
- endif()
-endmacro()
+__compiler_check_default_language_standard(C 12.0 90 15.0.0 11)
set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake
index 08d23fc..0eb9e1f 100644
--- a/Modules/Compiler/Intel-CXX.cmake
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -56,23 +56,5 @@ endif()
__compiler_check_default_language_standard(CXX 12.1 98)
-macro(cmake_record_cxx_compile_features)
- set(_result 0)
- if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
- if (_result EQUAL 0 AND
- (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0
- OR (NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" AND
- NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)))
- _record_compiler_features_cxx(14)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(98)
- endif()
- endif()
-endmacro()
-
set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake
index 8fcfa0f..9371301 100644
--- a/Modules/Compiler/MSVC-CXX.cmake
+++ b/Modules/Compiler/MSVC-CXX.cmake
@@ -1,17 +1,21 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
-if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
- # MSVC has no specific language level or flags to change it.
+include(Compiler/CMakeCommonCompilerMacros)
+
+if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
+ # MSVC has no specific options to set language standards, but set them as
+ # empty strings anyways so the feature test infrastructure can at least check
+ # to see if they are defined.
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "")
+
+ # There is no meaningful default for this
set(CMAKE_CXX_STANDARD_DEFAULT "")
endif()
-
-macro(cmake_record_cxx_compile_features)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
- list(APPEND CMAKE_CXX_COMPILE_FEATURES
- cxx_std_98
- cxx_std_11
- cxx_std_14
- cxx_std_17
- )
- _record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES)
- endif()
-endmacro()
diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake
index ac88e6f..29c2f22 100644
--- a/Modules/Compiler/SunPro-C.cmake
+++ b/Modules/Compiler/SunPro-C.cmake
@@ -43,20 +43,5 @@ endif()
__compiler_check_default_language_standard(C 5.11 90 5.14 11)
-macro(cmake_record_c_compile_features)
- set(_result 0)
- if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.13)
- if(_result EQUAL 0 AND CMAKE_C11_STANDARD_COMPILE_OPTION)
- _record_compiler_features_c(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(99)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_c(90)
- endif()
- endif()
-endmacro()
-
set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index 4b0a21d..5cb7edc 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -43,21 +43,9 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION 1)
else()
- set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-library=stlport")
- set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-library=stlport")
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-library=stlport4")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-library=stlport4")
set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION 1)
endif()
-__compiler_check_default_language_standard(CXX 5.13 98)
-
-macro(cmake_record_cxx_compile_features)
- set(_result 0)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
- if (_result EQUAL 0)
- _record_compiler_features_cxx(11)
- endif()
- if (_result EQUAL 0)
- _record_compiler_features_cxx(98)
- endif()
- endif()
-endmacro()
+__compiler_check_default_language_standard(CXX 1 98)
diff --git a/Modules/FindGSL.cmake b/Modules/FindGSL.cmake
index 76059b3..8d10b6c 100644
--- a/Modules/FindGSL.cmake
+++ b/Modules/FindGSL.cmake
@@ -37,9 +37,10 @@
#
# This script expects to find libraries at ``$GSL_ROOT_DIR/lib`` and the GSL
# headers at ``$GSL_ROOT_DIR/include/gsl``. The library directory may
-# optionally provide Release and Debug folders. For Unix-like systems, this
-# script will use ``$GSL_ROOT_DIR/bin/gsl-config`` (if found) to aid in the
-# discovery GSL.
+# optionally provide Release and Debug folders. If available, the libraries
+# named ``gsld``, ``gslblasd`` or ``cblasd`` are recognized as debug libraries.
+# For Unix-like systems, this script will use ``$GSL_ROOT_DIR/bin/gsl-config``
+# (if found) to aid in the discovery of GSL.
#
# Cache Variables
# ^^^^^^^^^^^^^^^
@@ -105,12 +106,12 @@ find_library( GSL_CBLAS_LIBRARY
)
# Do we also have debug versions?
find_library( GSL_LIBRARY_DEBUG
- NAMES gsl
+ NAMES gsld gsl
HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR}
PATH_SUFFIXES Debug
)
find_library( GSL_CBLAS_LIBRARY_DEBUG
- NAMES gslcblas cblas
+ NAMES gslcblasd cblasd gslcblas cblas
HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR}
PATH_SUFFIXES Debug
)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 918e6b0..63eea25 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 8)
-set(CMake_VERSION_PATCH 20170531)
+set(CMake_VERSION_PATCH 20170601)
#set(CMake_VERSION_RC 1)
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index bfc895e..b7bd102 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -918,7 +918,8 @@ int LoadLines(const char* fileName, std::vector<std::string>& lines)
// ****************************************************************************
template <typename T>
-int NameValue(std::vector<std::string>& lines, std::string name, T& value)
+int NameValue(std::vector<std::string> const& lines, std::string const& name,
+ T& value)
{
size_t nLines = lines.size();
for (size_t i = 0; i < nLines; ++i) {
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 5ca382f..07da8dc 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -22,6 +22,7 @@
#include KWSYS_HEADER(FStream.hxx)
#include KWSYS_HEADER(Encoding.hxx)
+#include <algorithm>
#include <fstream>
#include <iostream>
#include <set>
@@ -3708,6 +3709,16 @@ std::string SystemTools::JoinPath(
return result;
}
+void SystemTools::RemoveEmptyPathElements(std::vector<std::string>& path)
+{
+ if (path.empty()) {
+ return;
+ }
+
+ path.erase(std::remove(path.begin() + 1, path.end(), std::string("")),
+ path.end());
+}
+
bool SystemTools::ComparePath(const std::string& c1, const std::string& c2)
{
#if defined(_WIN32) || defined(__APPLE__)
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 0849e1d..5e091c2 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -474,6 +474,10 @@ public:
static std::string JoinPath(std::vector<std::string>::const_iterator first,
std::vector<std::string>::const_iterator last);
+ /** Removes empty components from path.
+ */
+ static void RemoveEmptyPathElements(std::vector<std::string>& path);
+
/**
* Compare a path or components of a path.
*/
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index 900894c..e6fbf6c 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -54,7 +54,8 @@ static const char* toUnixPaths[][2] = {
{ 0, 0 }
};
-static bool CheckConvertToUnixSlashes(std::string input, std::string output)
+static bool CheckConvertToUnixSlashes(std::string const& input,
+ std::string const& output)
{
std::string result = input;
kwsys::SystemTools::ConvertToUnixSlashes(result);
@@ -71,8 +72,9 @@ static const char* checkEscapeChars[][4] = { { "1 foo 2 bar 2", "12", "\\",
{ " {} ", "{}", "#", " #{#} " },
{ 0, 0, 0, 0 } };
-static bool CheckEscapeChars(std::string input, const char* chars_to_escape,
- char escape_char, std::string output)
+static bool CheckEscapeChars(std::string const& input,
+ const char* chars_to_escape, char escape_char,
+ std::string const& output)
{
std::string result = kwsys::SystemTools::EscapeChars(
input.c_str(), chars_to_escape, escape_char);
diff --git a/Tests/CMakeCommands/target_compile_features/CMakeLists.txt b/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
index 555a08f..5096a58 100644
--- a/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
@@ -1,45 +1,65 @@
cmake_minimum_required(VERSION 3.0)
+cmake_policy(SET CMP0057 NEW)
project(target_compile_features)
-if (NOT CMAKE_CXX_COMPILE_FEATURES AND NOT CMAKE_C_COMPILE_FEATURES)
- file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_dummy.cpp"
- "int main(int,char**) { return 0; }\n"
- )
- add_executable(target_compile_features "${CMAKE_CURRENT_BINARY_DIR}/test_dummy.cpp")
- return()
-endif()
-
set(CMAKE_VERBOSE_MAKEFILE ON)
-if (CMAKE_C_COMPILE_FEATURES)
- add_executable(target_compile_features main.c)
- target_compile_features(target_compile_features
+if (c_restrict IN_LIST CMAKE_C_COMPILE_FEATURES)
+ add_executable(c_target_compile_features_specific main.c)
+ target_compile_features(c_target_compile_features_specific
PRIVATE c_restrict
)
- add_library(lib_restrict lib_restrict.c)
- target_compile_features(lib_restrict
+ add_library(c_lib_restrict_specific lib_restrict.c)
+ target_compile_features(c_lib_restrict_specific
PUBLIC c_restrict
)
- add_executable(restrict_user restrict_user.c)
- target_link_libraries(restrict_user lib_restrict)
+ add_executable(c_restrict_user_specific restrict_user.c)
+ target_link_libraries(c_restrict_user_specific c_lib_restrict_specific)
endif()
-if (CMAKE_CXX_COMPILE_FEATURES AND ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_auto_type;")
- if (CMAKE_C_COMPILE_FEATURES)
- set(target_suffix _cxx)
- endif()
- add_executable(target_compile_features${target_suffix} main.cpp)
- target_compile_features(target_compile_features${target_suffix}
+if (c_std_99 IN_LIST CMAKE_C_COMPILE_FEATURES)
+ add_executable(c_target_compile_features_meta main.c)
+ target_compile_features(c_target_compile_features_meta
+ PRIVATE c_std_99
+ )
+
+ add_library(c_lib_restrict_meta lib_restrict.c)
+ target_compile_features(c_lib_restrict_meta
+ PUBLIC c_std_99
+ )
+
+ add_executable(c_restrict_user_meta restrict_user.c)
+ target_link_libraries(c_restrict_user_meta c_lib_restrict_meta)
+endif()
+
+if (cxx_auto_type IN_LIST CMAKE_CXX_COMPILE_FEATURES)
+ add_executable(cxx_target_compile_features_specific main.cpp)
+ target_compile_features(cxx_target_compile_features_specific
PRIVATE cxx_auto_type
)
- add_library(lib_auto_type lib_auto_type.cpp)
- target_compile_features(lib_auto_type
+ add_library(cxx_lib_auto_type_specific lib_auto_type.cpp)
+ target_compile_features(cxx_lib_auto_type_specific
PUBLIC cxx_auto_type
)
- add_executable(lib_user lib_user.cpp)
- target_link_libraries(lib_user lib_auto_type)
+ add_executable(cxx_lib_user_specific lib_user.cpp)
+ target_link_libraries(cxx_lib_user_specific cxx_lib_auto_type_specific)
+endif()
+
+if (cxx_std_11 IN_LIST CMAKE_CXX_COMPILE_FEATURES)
+ add_executable(cxx_target_compile_features_meta main.cpp)
+ target_compile_features(cxx_target_compile_features_meta
+ PRIVATE cxx_std_11
+ )
+
+ add_library(cxx_lib_auto_type_meta lib_auto_type.cpp)
+ target_compile_features(cxx_lib_auto_type_meta
+ PUBLIC cxx_std_11
+ )
+
+ add_executable(cxx_lib_user_meta lib_user.cpp)
+ target_link_libraries(cxx_lib_user_meta cxx_lib_auto_type_meta)
endif()
diff --git a/Tests/CMakeCommands/target_compile_features/dummy.cpp b/Tests/CMakeCommands/target_compile_features/dummy.cpp
deleted file mode 100644
index e9ad257..0000000
--- a/Tests/CMakeCommands/target_compile_features/dummy.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-
-int main(int, char**)
-{
- return 0;
-}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 21fe641..d138f58 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1,6 +1,9 @@
# a macro for tests that have a simple format where the name matches the
# directory and project
-macro(ADD_TEST_MACRO NAME COMMAND)
+macro(ADD_TEST_MACRO NAME)
+ if(${ARGC} GREATER 1)
+ set(_test_command --test-command ${ARGN})
+ endif()
string(REPLACE "." "/" dir "${NAME}")
string(REGEX REPLACE "[^.]*\\." "" proj "${NAME}")
add_test(NAME "${NAME}" COMMAND "${CMAKE_CTEST_COMMAND}"
@@ -13,7 +16,8 @@ macro(ADD_TEST_MACRO NAME COMMAND)
${${NAME}_CTEST_OPTIONS}
--build-options ${build_options}
${${NAME}_BUILD_OPTIONS}
- --test-command ${COMMAND} ${ARGN})
+ ${_test_command})
+ unset(_test_command)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}")
endmacro()
@@ -271,7 +275,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(SystemInformation SystemInformation)
ADD_TEST_MACRO(MathTest MathTest)
ADD_TEST_MACRO(CompileFeatures CompileFeatures)
- ADD_TEST_MACRO(CMakeCommands.target_compile_features target_compile_features)
+ ADD_TEST_MACRO(CMakeCommands.target_compile_features)
if(CMake_TEST_RESOURCES)
ADD_TEST_MACRO(VSResource VSResource)
@@ -3110,6 +3114,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
endif ()
endif ()
+ if(CMake_TEST_EXTERNAL_CMAKE)
+ set(CMAKE_SKIP_BOOTSTRAP_TEST 1)
+ endif()
if("${CMAKE_GENERATOR}" MATCHES Xcode)
set(CMAKE_SKIP_BOOTSTRAP_TEST 1)
endif()
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index bb18543..4a5558d 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -1,10 +1,11 @@
cmake_minimum_required(VERSION 3.1)
+cmake_policy(SET CMP0057 NEW)
project(CompileFeatures)
macro(run_test feature lang)
- if (";${CMAKE_${lang}_COMPILE_FEATURES};" MATCHES ${feature})
+ if (${feature} IN_LIST CMAKE_${lang}_COMPILE_FEATURES)
add_library(test_${feature} OBJECT ${feature})
set_property(TARGET test_${feature}
PROPERTY COMPILE_FEATURES "${feature}"
@@ -15,12 +16,13 @@ macro(run_test feature lang)
endmacro()
get_property(c_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES)
-list(REMOVE_ITEM c_features c_std_90 c_std_99 c_std_11)
+list(FILTER c_features EXCLUDE REGEX "^c_std_[0-9][0-9]")
foreach(feature ${c_features})
run_test(${feature} C)
endforeach()
+
get_property(cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES)
-list(REMOVE_ITEM cxx_features cxx_std_98 cxx_std_11 cxx_std_14 cxx_std_17)
+list(FILTER cxx_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]")
foreach(feature ${cxx_features})
run_test(${feature} CXX)
endforeach()
@@ -171,12 +173,20 @@ if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
endif()
endif()
+if (CMAKE_C_COMPILE_FEATURES)
+ set(C_expected_features ${CMAKE_C_COMPILE_FEATURES})
+ list(FILTER C_expected_features EXCLUDE REGEX "^c_std_[0-9][0-9]")
+endif()
+if (CMAKE_CXX_COMPILE_FEATURES)
+ set(CXX_expected_features ${CMAKE_CXX_COMPILE_FEATURES})
+ list(FILTER CXX_expected_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]")
+endif ()
set(C_ext c)
set(C_standard_flag 11)
set(CXX_ext cpp)
set(CXX_standard_flag 14)
foreach(lang CXX C)
- if (CMAKE_${lang}_COMPILE_FEATURES)
+ if (${lang}_expected_features)
foreach(feature ${${lang}_non_features})
message("Testing feature : ${feature}")
try_compile(${feature}_works
@@ -198,7 +208,7 @@ foreach(lang CXX C)
endif()
endforeach()
-if (CMAKE_C_COMPILE_FEATURES)
+if (C_expected_features)
if (CMAKE_C_STANDARD_DEFAULT)
string(FIND "${CMAKE_C_FLAGS}" "-std=" std_flag_idx)
if (std_flag_idx EQUAL -1)
@@ -280,7 +290,8 @@ if (CMAKE_CXX_COMPILE_FEATURES)
endif ()
# always add a target "CompileFeatures"
-if (NOT ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_auto_type;")
+if ((NOT CXX_expected_features) OR
+ (NOT cxx_auto_type IN_LIST CXX_expected_features))
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp"
"int main(int,char**) { return 0; }\n"
)
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
index 2657aeb..52d4613 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
+++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
@@ -48,7 +48,14 @@ macro(set_defines target true_defs false_defs)
)
endmacro()
+# Only run the compiler detection header test for compilers with
+# detailed features tables, not just meta-features
+
if (CMAKE_C_COMPILE_FEATURES)
+ set(C_expected_features ${CMAKE_C_COMPILE_FEATURES})
+ list(FILTER C_expected_features EXCLUDE REGEX "^c_std_[0-9][0-9]")
+endif()
+if (C_expected_features)
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" COMPILER_VERSION_MAJOR "${CMAKE_C_COMPILER_VERSION}")
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" COMPILER_VERSION_MINOR "${CMAKE_C_COMPILER_VERSION}")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" COMPILER_VERSION_PATCH "${CMAKE_C_COMPILER_VERSION}")
@@ -85,7 +92,11 @@ if (CMAKE_C_COMPILE_FEATURES)
endif()
endif()
-if (NOT CMAKE_CXX_COMPILE_FEATURES)
+if (CMAKE_CXX_COMPILE_FEATURES)
+ set(CXX_expected_features ${CMAKE_CXX_COMPILE_FEATURES})
+ list(FILTER CXX_expected_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]")
+endif()
+if (NOT CXX_expected_features)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp"
"int main(int,char**) { return 0; }\n"
)
diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake
index 2d14a9e..b24a680 100644
--- a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake
+++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake
@@ -6,9 +6,10 @@ add_library(empty3 INTERFACE)
target_compile_features(empty3 INTERFACE cxx_std_11)
target_link_libraries(empty1
- # When starting, $<COMPILE_FEATURES:cxx_auto_type> is '0', so 'freeze' the
+ # When starting, $<COMPILE_FEATURES:cxx_std_11> is '0', so 'freeze' the
# CXX_STANDARD at 98 during computation.
- $<$<COMPILE_FEATURES:cxx_auto_type>:empty2>
+ $<$<COMPILE_FEATURES:cxx_std_11>:empty2>
+
# This would add cxx_std_11, but that would require CXX_STANDARD = 11,
# which is not allowed after freeze. Report an error.
empty3
diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
index 8dc627d..5a70da2 100644
--- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
@@ -1,3 +1,4 @@
+cmake_policy(SET CMP0057 NEW)
include(RunCMake)
run_cmake(NotAFeature)
@@ -28,13 +29,13 @@ endif()
if (NOT CXX_FEATURES)
run_cmake(NoSupportedCxxFeatures)
run_cmake(NoSupportedCxxFeaturesGenex)
-else()
+elseif (cxx_std_98 IN_LIST CXX_FEATURES AND cxx_std_11 IN_LIST CXX_FEATURES)
if(CXX_STANDARD_DEFAULT EQUAL 98)
run_cmake(LinkImplementationFeatureCycle)
endif()
run_cmake(LinkImplementationFeatureCycleSolved)
- if (";${CXX_FEATURES};" MATCHES ";cxx_final;")
+ if (cxx_final IN_LIST CXX_FEATURES)
set(RunCMake_TEST_OPTIONS "-DHAVE_FINAL=1")
endif()
run_cmake(NonValidTarget1)
diff --git a/Utilities/Release/hythloth_release.cmake b/Utilities/Release/hythloth_release.cmake
deleted file mode 100644
index d2f4ba5..0000000
--- a/Utilities/Release/hythloth_release.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-set(PROCESSORS 2)
-set(HOST hythloth)
-set(MAKE_PROGRAM "make")
-set(MAKE "${MAKE_PROGRAM} -j2")
-set(INITIAL_CACHE "
-CMAKE_BUILD_TYPE:STRING=Release
-CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
-")
-get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH)
-include(${path}/release_cmake.cmake)
diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake
index feba2a5..3d8ddba 100644
--- a/Utilities/Release/linux64_release.cmake
+++ b/Utilities/Release/linux64_release.cmake
@@ -35,6 +35,7 @@ OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2j/lib/libssl.a
PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3
CPACK_SYSTEM_NAME:STRING=Linux-x86_64
BUILD_QtDialog:BOOL:=TRUE
+CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
CMake_ENABLE_SERVER_MODE:BOOL=TRUE
CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3
CMake_INSTALL_DEPENDENCIES:BOOL=ON
diff --git a/bootstrap b/bootstrap
index daf405e..84285a8 100755
--- a/bootstrap
+++ b/bootstrap
@@ -6,6 +6,17 @@ die() {
echo "$@" 1>&2 ; exit 1
}
+# Compile flag extraction function.
+cmake_extract_standard_flags()
+{
+ cd "${cmake_source_dir}/Modules/Compiler/"
+ for file in ${1:-*}-${2}.cmake; do
+ cat "${file}" \
+ | sed -n "s/ *set *( *CMAKE_${2}${3}_EXTENSION_COMPILE_OPTION *\"\{0,1\}\([^\")]*\).*/\1/p" \
+ | tr ';' ' '
+ done
+}
+
# Version number extraction function.
cmake_version_component()
{
@@ -954,6 +965,17 @@ for a in ${cmake_c_compilers}; do
cmake_c_compiler="${a}"
fi
done
+for std in 11 99 90; do
+ try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`"
+ for flag in $try_flags; do
+ echo "Checking whether ${cmake_c_compiler} supports ${flag}" >> cmake_bootstrap.log 2>&1
+ if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags} ${flag}" \
+ "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
+ cmake_c_flags="${cmake_c_flags} ${flag}"
+ break 2
+ fi
+ done
+done
rm -f "${TMPFILE}.c"
if [ -z "${cmake_c_compiler}" ]; then
@@ -988,6 +1010,10 @@ echo '
# include <iostream.h>
#endif
+#if __cplusplus >= 201103L && defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
+#error "SunPro <= 5.13 C++ 11 mode not supported due to bug in move semantics."
+#endif
+
class NeedCXX
{
public:
@@ -1015,6 +1041,17 @@ for a in ${cmake_cxx_compilers}; do
fi
done
done
+for std in 14 11 98; do
+ try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`"
+ for flag in $try_flags; do
+ echo "Checking for wheter ${cmake_cxx_flags} supports ${flag}" >> cmake_bootstrap.log 2>&1
+ if cmake_try_run "${cmake_cxx_compiler}" "${cmake_cxx_flags} ${flag} -DTEST1" \
+ "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
+ cmake_cxx_flags="${cmake_cxx_flags} ${flag} "
+ break 2
+ fi
+ done
+done
rm -f "${TMPFILE}.cxx"
if [ -z "${cmake_cxx_compiler}" ]; then
@@ -1162,34 +1199,6 @@ if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
fi
-if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
- # Are we SolarisStudio?
-
- TMPFILE=`cmake_tmp_file`
- echo '
- #if defined(__SUNPRO_CC)
- #include <iostream>
- int main() { std::cout << "This is SolarisStudio" << std::endl; return 0;}
- #endif
- ' > ${TMPFILE}.cxx
- cmake_cxx_compiler_is_solarisstudio=0
- if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} " "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
- cmake_cxx_compiler_is_solarisstudio=1
- fi
- if [ "x${cmake_cxx_compiler_is_solarisstudio}" = "x1" ]; then
- echo "${cmake_cxx_compiler} is SolarisStudio compiler"
- else
- echo "${cmake_cxx_compiler} is not SolarisStudio compiler"
- fi
- rm -f "${TMPFILE}.cxx"
-
- if [ "x${cmake_cxx_compiler_is_solarisstudio}" = "x1" ]; then
- cmake_cxx_flags="${cmake_cxx_flags} -library=stlport4"
- fi
-fi
-
-
# Test for kwsys features
KWSYS_NAME_IS_KWSYS=0
KWSYS_BUILD_SHARED=0