mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
make the "-Wl,--as-needed" flag optional
as there is not much harm done if it is not used but it may cause the build to fail if it is present (read: it causes _my_ build to fail), it defaults to OFF.
This commit is contained in:
committed by
Bård Skaflestad
parent
4fd75a4433
commit
d9920e34eb
@@ -23,9 +23,11 @@ function (prepend var_name value)
|
|||||||
endif (NOT ("${_var_pre}" STREQUAL "${value}"))
|
endif (NOT ("${_var_pre}" STREQUAL "${value}"))
|
||||||
endfunction (prepend var_name value)
|
endfunction (prepend var_name value)
|
||||||
|
|
||||||
|
option (ONLY_NEEDED_LIBRARIES "Instruct the linker to not use libraries which are unused" OFF)
|
||||||
|
|
||||||
# only ELF shared objects can be underlinked, and only GNU will accept
|
# only ELF shared objects can be underlinked, and only GNU will accept
|
||||||
# these parameters; otherwise just leave it to the defaults
|
# these parameters; otherwise just leave it to the defaults
|
||||||
if ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC)
|
if ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC AND ONLY_NEEDED_LIBRARIES)
|
||||||
# these are the modules whose probes will turn up incompatible
|
# these are the modules whose probes will turn up incompatible
|
||||||
# flags on some systems
|
# flags on some systems
|
||||||
set (_maybe_underlinked
|
set (_maybe_underlinked
|
||||||
@@ -45,4 +47,4 @@ if ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC)
|
|||||||
prepend (CMAKE_MODULE_LINKER_FLAGS "-Wl,--as-needed")
|
prepend (CMAKE_MODULE_LINKER_FLAGS "-Wl,--as-needed")
|
||||||
prepend (CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
|
prepend (CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
|
||||||
endif (NOT _underlinked)
|
endif (NOT _underlinked)
|
||||||
endif ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC)
|
endif ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC AND ONLY_NEEDED_LIBRARIES)
|
||||||
|
|||||||
Reference in New Issue
Block a user