Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PROTON-2786: Handle check_language(CXX) more correctly #417

Merged
merged 1 commit into from
Dec 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down