forked from tbeu/matio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake: rework -Wl,--no-undefined/-Wl,-undefined,error handling
Issue tbeu#187 appears to indicate that OpenBSD requires an explicit specification of -lc on the linker line if -Wl,--no-undefined is used. Unfortunately, -lc is not available on MinGW (due to the C runtime working different on Windows), so adding it whenever -lm is also linked against does not work. This commit reworks the entire CMake linker flag logic: - Remove dependency on CMake >= 3.17.0 for some checks -- we need to do a manual check_c_source_compiles() anyway (due to check_linker_flag() not triggering the potential error when -lc is not supplied), so we can drop that dependency. - Check for -Wl,--no-undefined both without and with an explicit -lc on the command line. If either version works, assume we can pass GNU-style linker options. If only the explicit version works, also pass -lc explicitly. (If both work don't, because even if -lc works, such as on a standard Linux, one would typically not pass it explicitly while compiling software.) Fixes tbeu#233
- Loading branch information
Christian Seiler
committed
Feb 9, 2024
1 parent
18082eb
commit 58e52d6
Showing
2 changed files
with
47 additions
and
20 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
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