diff --git a/cmake/cxx.cmake b/cmake/cxx.cmake index 5ca83887..128b12ca 100644 --- a/cmake/cxx.cmake +++ b/cmake/cxx.cmake @@ -99,8 +99,13 @@ elseif (CMAKE_BUILD_TYPE_UPPER STREQUAL "COVERAGE") list(APPEND cxx_flags ${cxx_coverage}) endif() +list(APPEND cxx_linker_flags ${cxx_flags}) + string(REPLACE " " ";" polybar_flags_list "${POLYBAR_FLAGS}") list(APPEND cxx_flags ${polybar_flags_list}) string(REPLACE ";" " " cxx_flags_str "${cxx_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}") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d09d8ba7..d4022142 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -206,7 +206,6 @@ if(BUILD_LIBPOLY) endif() 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) # }}} @@ -215,8 +214,7 @@ if(BUILD_LIBPOLY) add_executable(polybar main.cpp) target_link_libraries(polybar poly) target_compile_options(polybar PUBLIC ${cxx_flags}) - target_link_options(polybar PUBLIC ${cxx_linker_flags}) - set_target_properties(poly PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(polybar PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) install(TARGETS polybar DESTINATION ${CMAKE_INSTALL_BINDIR} @@ -234,7 +232,6 @@ if(BUILD_POLYBAR_MSG) utils/string.cpp) target_include_directories(polybar-msg PRIVATE ${includes_dir}) target_compile_options(polybar-msg PUBLIC ${cxx_flags}) - target_link_options(polybar-msg PUBLIC ${cxx_linker_flags}) install(TARGETS polybar-msg DESTINATION ${CMAKE_INSTALL_BINDIR}