This is an automated email from the ASF dual-hosted git repository.
jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
The following commit(s) were added to refs/heads/main by this push:
new 5b27d07c9 PROTON-2786: Handle check_language(CXX) more correctly (#417)
5b27d07c9 is described below
commit 5b27d07c9f19c6a83f981c4f0a349c38f8132a76
Author: Jiri Daněk <[email protected]>
AuthorDate: Sun Dec 24 20:26:48 2023 +0100
PROTON-2786: Handle check_language(CXX) more correctly (#417)
---
CMakeLists.txt | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b56ea024..4344b9803 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,12 +71,18 @@ set (C_STANDARD_FLAGS ${C_STANDARD_${CMAKE_C_COMPILER_ID}})
set (C_EXTENDED_FLAGS ${C_EXTENDED_${CMAKE_C_COMPILER_ID}})
## C++
+set(UNSET_CMAKE_CXX_COMPILER OFF)
+if (NOT DEFINED CMAKE_CXX_COMPILER)
+ set(UNSET_CMAKE_CXX_COMPILER ON)
+endif ()
check_language (CXX)
if (CMAKE_CXX_COMPILER)
- # check_language(CXX) does not handle compiler parameters in CXX env
variable well
- # forget the result of the check and let enable_language(CXX) to do this
correctly
- unset(CMAKE_CXX_COMPILER)
- unset(CMAKE_CXX_COMPILER CACHE)
+ if (UNSET_CMAKE_CXX_COMPILER)
+ # https://gitlab.kitware.com/cmake/cmake/-/issues/25535: check_language
might set the variable incorrectly
+ unset(CMAKE_CXX_COMPILER)
+ unset(CMAKE_CXX_COMPILER CACHE)
+ endif ()
+
enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]