[Cmake-commits] CMake branch, next, updated. v3.0.0-rc6-3609-g42b7036
Stephen Kelly
steveire at gmail.com
Fri Jun 6 10:16:51 EDT 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 42b70361df27cd14e45169af2c037d0b95feb954 (commit)
via cd0508c0946dd375f96524077ad98e127a0b4a8e (commit)
from 1d91bd76031ecc35f5697c38f9f97528f174410b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=42b70361df27cd14e45169af2c037d0b95feb954
commit 42b70361df27cd14e45169af2c037d0b95feb954
Merge: 1d91bd7 cd0508c
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Jun 6 10:16:51 2014 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jun 6 10:16:51 2014 -0400
Merge topic 'WriteCompilerDetectionHeader-compiler-versions' into next
cd0508c0 Features: Add compiler version support to WriteCompilerDetectionHeader.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cd0508c0946dd375f96524077ad98e127a0b4a8e
commit cd0508c0946dd375f96524077ad98e127a0b4a8e
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Jun 5 13:16:56 2014 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Jun 6 16:16:27 2014 +0200
Features: Add compiler version support to WriteCompilerDetectionHeader.
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 3f8d835..ed83674 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -166,6 +166,8 @@ 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)
+ set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE)
endfunction()
function(write_compiler_detection_header
@@ -210,11 +212,20 @@ function(write_compiler_detection_header
GNU
Clang
)
+
+ set(_hex_compilers ADSP Borland Embarcadero SunPro)
+
foreach(_comp ${_WCD_COMPILERS})
list(FIND compilers ${_comp} idx)
if (idx EQUAL -1)
message(FATAL_ERROR "Unsupported compiler ${_comp}.")
endif()
+ if (NOT _need_hex_conversion)
+ list(FIND _hex_compilers ${_comp} idx)
+ if (NOT idx EQUAL -1)
+ set(_need_hex_conversion TRUE)
+ endif()
+ endif()
endforeach()
set(file_content "
@@ -228,6 +239,21 @@ function(write_compiler_detection_header
set(file_content "${file_content}\n${_WCD_PROLOG}\n")
endif()
+ if (_need_hex_conversion)
+ set(file_content "${file_content}
+#define ${prefix_arg}_DEC(X) (X)
+#define ${prefix_arg}_HEX(X) ( \\
+ ((X)>>28 & 0xF) * 10000000 + \\
+ ((X)>>24 & 0xF) * 1000000 + \\
+ ((X)>>20 & 0xF) * 100000 + \\
+ ((X)>>16 & 0xF) * 10000 + \\
+ ((X)>>12 & 0xF) * 1000 + \\
+ ((X)>>8 & 0xF) * 100 + \\
+ ((X)>>4 & 0xF) * 10 + \\
+ ((X) & 0xF) \\
+ )\n")
+ endif()
+
foreach(feature ${_WCD_FEATURES})
if (feature MATCHES "^cxx_")
list(APPEND _langs CXX)
@@ -271,6 +297,21 @@ function(write_compiler_detection_header
# if !(${_cmake_oldestSupported_${compiler}})
# error Unsupported compiler version
# endif\n")
+
+ set(PREFIX ${prefix_arg}_)
+ if (_need_hex_conversion)
+ set(MACRO_DEC ${prefix_arg}_DEC)
+ set(MACRO_HEX ${prefix_arg}_HEX)
+ else()
+ set(MACRO_DEC)
+ set(MACRO_HEX)
+ endif()
+ string(CONFIGURE "${_compiler_id_version_compute_${compiler}}" VERSION_BLOCK @ONLY)
+ set(file_content "${file_content}${VERSION_BLOCK}\n")
+ set(PREFIX)
+ set(MACRO_DEC)
+ set(MACRO_HEX)
+
set(pp_if "elif")
foreach(feature ${${_lang}_features})
string(TOUPPER ${feature} feature_upper)
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
index ab0ebc3..645cc65 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
+++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
@@ -35,6 +35,10 @@ if (NOT CMAKE_CXX_COMPILE_FEATURES AND NOT CMAKE_C_COMPILE_FEATURES)
return()
endif()
+string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" COMPILER_VERSION_MAJOR "${CMAKE_CXX_COMPILER_VERSION}")
+string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" COMPILER_VERSION_MINOR "${CMAKE_CXX_COMPILER_VERSION}")
+string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" COMPILER_VERSION_PATCH "${CMAKE_CXX_COMPILER_VERSION}")
+
macro(set_defines target true_defs false_defs)
set(defines)
foreach(def ${true_defs})
@@ -46,6 +50,9 @@ macro(set_defines target true_defs false_defs)
target_compile_definitions(${target}
PRIVATE
${defines}
+ EXPECTED_COMPILER_VERSION_MAJOR=${COMPILER_VERSION_MAJOR}
+ EXPECTED_COMPILER_VERSION_MINOR=${COMPILER_VERSION_MINOR}
+ EXPECTED_COMPILER_VERSION_PATCH=${COMPILER_VERSION_PATCH}
)
endmacro()
diff --git a/Tests/Module/WriteCompilerDetectionHeader/main.cpp b/Tests/Module/WriteCompilerDetectionHeader/main.cpp
index 8b4ea52..b807ad5 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/main.cpp
+++ b/Tests/Module/WriteCompilerDetectionHeader/main.cpp
@@ -13,6 +13,18 @@
#error cxx_variadic_templates expected availability did not match.
#endif
+#if !CHECK(VERSION_MAJOR)
+#error Compiler major version did not match.
+#endif
+
+#if !CHECK(VERSION_MINOR)
+#error Compiler minor version did not match.
+#endif
+
+#if !CHECK(VERSION_PATCH)
+#error Compiler patch version did not match.
+#endif
+
int main()
{
return 0;
-----------------------------------------------------------------------
Summary of changes:
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list