-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reinstate LLVMCheckCompilerLinkerFlag, to correctly encapsulate link …
…flag check This partially reverts commit 1515c2c. Co-Authored-By: Ryan Prichard <[email protected]>
- Loading branch information
1 parent
b416b5e
commit 2f3fd55
Showing
7 changed files
with
51 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
include(CMakePushCheckState) | ||
|
||
include(CheckCompilerFlag OPTIONAL) | ||
|
||
if(NOT COMMAND check_compiler_flag) | ||
include(CheckCCompilerFlag) | ||
include(CheckCXXCompilerFlag) | ||
endif() | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
h-vetinari
Author
Contributor
|
||
|
||
function(llvm_check_compiler_linker_flag lang flag out_var) | ||
# If testing a flag with check_c_compiler_flag, it gets added to the compile | ||
This comment has been minimized.
Sorry, something went wrong. |
||
# command only, but not to the linker command in that test. If the flag | ||
# is vital for linking to succeed, the test would fail even if it would | ||
# have succeeded if it was included on both commands. | ||
# | ||
# Therefore, try adding the flag to CMAKE_REQUIRED_FLAGS, which gets | ||
# added to both compiling and linking commands in the tests. | ||
|
||
cmake_push_check_state() | ||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}") | ||
check_compiler_flag("${lang}" "" ${out_var}) | ||
cmake_pop_check_state() | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This can be simplified, too, to just:
CheckCompilerFlag
is always available in CMake 3.19+, and the code doesn't useCheckCCompilerFlag
/CheckCXXCompilerFlag
anymore.