Use CMAKE_EXE_LINKER_FLAGS

The newere target_link_options is not supported by our minimum cmake
version (3.5)
This commit is contained in:
patrick96 2021-07-11 14:41:16 +02:00 committed by Patrick Ziegler
parent 3652d5fe0d
commit c901826317
2 changed files with 6 additions and 4 deletions

View File

@ -99,8 +99,13 @@ elseif (CMAKE_BUILD_TYPE_UPPER STREQUAL "COVERAGE")
list(APPEND cxx_flags ${cxx_coverage}) list(APPEND cxx_flags ${cxx_coverage})
endif() endif()
list(APPEND cxx_linker_flags ${cxx_flags})
string(REPLACE " " ";" polybar_flags_list "${POLYBAR_FLAGS}") string(REPLACE " " ";" polybar_flags_list "${POLYBAR_FLAGS}")
list(APPEND cxx_flags ${polybar_flags_list}) list(APPEND cxx_flags ${polybar_flags_list})
string(REPLACE ";" " " cxx_flags_str "${cxx_flags}") string(REPLACE ";" " " cxx_flags_str "${cxx_flags}")
string(REPLACE ";" " " cxx_linker_flags_str "${cxx_linker_flags}") string(REPLACE ";" " " cxx_linker_flags_str "${cxx_linker_flags}")
# TODO use target_link_options once min cmake version is >= 3.13
set(CMAKE_EXE_LINKER_FLAGS "${cxx_linker_flags_str}")

View File

@ -206,7 +206,6 @@ if(BUILD_LIBPOLY)
endif() endif()
target_compile_options(poly PUBLIC ${cxx_flags}) target_compile_options(poly PUBLIC ${cxx_flags})
target_link_options(poly PUBLIC ${cxx_linker_flags})
set_target_properties(poly PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/libs) set_target_properties(poly PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/libs)
# }}} # }}}
@ -215,8 +214,7 @@ if(BUILD_LIBPOLY)
add_executable(polybar main.cpp) add_executable(polybar main.cpp)
target_link_libraries(polybar poly) target_link_libraries(polybar poly)
target_compile_options(polybar PUBLIC ${cxx_flags}) target_compile_options(polybar PUBLIC ${cxx_flags})
target_link_options(polybar PUBLIC ${cxx_linker_flags}) set_target_properties(polybar PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set_target_properties(poly PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
install(TARGETS polybar install(TARGETS polybar
DESTINATION ${CMAKE_INSTALL_BINDIR} DESTINATION ${CMAKE_INSTALL_BINDIR}
@ -234,7 +232,6 @@ if(BUILD_POLYBAR_MSG)
utils/string.cpp) utils/string.cpp)
target_include_directories(polybar-msg PRIVATE ${includes_dir}) target_include_directories(polybar-msg PRIVATE ${includes_dir})
target_compile_options(polybar-msg PUBLIC ${cxx_flags}) target_compile_options(polybar-msg PUBLIC ${cxx_flags})
target_link_options(polybar-msg PUBLIC ${cxx_linker_flags})
install(TARGETS polybar-msg install(TARGETS polybar-msg
DESTINATION ${CMAKE_INSTALL_BINDIR} DESTINATION ${CMAKE_INSTALL_BINDIR}