summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-11-26 18:06:12 (GMT)
committerBrad King <brad.king@kitware.com>2018-11-26 18:13:58 (GMT)
commit0369362132b3deae30828299131647cc3754abeb (patch)
treedaa1f2fa17b134b398ede90f34f390a39358cb95
parent05a2ca7f87b9ae73f373e9967fde1ee5210e33af (diff)
downloadCMake-0369362132b3deae30828299131647cc3754abeb.zip
CMake-0369362132b3deae30828299131647cc3754abeb.tar.gz
CMake-0369362132b3deae30828299131647cc3754abeb.tar.bz2
FindBoost: Restore finding without CXX language enabled
Since commit v3.13.0~7^2 (FindBoost: Improve compiler prefix detection for GCC 5+ and clang 4+, 2018-11-07) we run the internal `_Boost_COMPILER_DUMPVERSION` macro on all UNIX platforms. Teach the macro to tolerate missing `CMAKE_CXX_COMPILER_VERSION`, which occurs when the CXX language is not enabled. Fixes: #18624
-rw-r--r--Modules/FindBoost.cmake9
-rw-r--r--Tests/RunCMake/FindBoost/NoCXX-stderr.txt1
-rw-r--r--Tests/RunCMake/FindBoost/NoCXX.cmake1
-rw-r--r--Tests/RunCMake/FindBoost/RunCMakeTest.cmake1
4 files changed, 6 insertions, 6 deletions
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 3e011ad..bfab4ca 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -409,15 +409,12 @@ endmacro()
#-------------------------------------------------------------------------------
-#
-# Runs compiler with "-dumpversion" and parses major/minor
-# version with a regex.
-#
+# Convert CMAKE_CXX_COMPILER_VERSION to boost compiler suffix version.
function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION _OUTPUT_VERSION_MAJOR _OUTPUT_VERSION_MINOR)
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" "\\1"
- _boost_COMPILER_VERSION_MAJOR ${CMAKE_CXX_COMPILER_VERSION})
+ _boost_COMPILER_VERSION_MAJOR "${CMAKE_CXX_COMPILER_VERSION}")
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" "\\2"
- _boost_COMPILER_VERSION_MINOR ${CMAKE_CXX_COMPILER_VERSION})
+ _boost_COMPILER_VERSION_MINOR "${CMAKE_CXX_COMPILER_VERSION}")
set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}${_boost_COMPILER_VERSION_MINOR}")
diff --git a/Tests/RunCMake/FindBoost/NoCXX-stderr.txt b/Tests/RunCMake/FindBoost/NoCXX-stderr.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/NoCXX-stderr.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/FindBoost/NoCXX.cmake b/Tests/RunCMake/FindBoost/NoCXX.cmake
new file mode 100644
index 0000000..04b9cac
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/NoCXX.cmake
@@ -0,0 +1 @@
+find_package(Boost)
diff --git a/Tests/RunCMake/FindBoost/RunCMakeTest.cmake b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake
index a153ae1..5d0577b 100644
--- a/Tests/RunCMake/FindBoost/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake
@@ -1,3 +1,4 @@
include(RunCMake)
run_cmake(CMakePackage)
+run_cmake(NoCXX)