diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-02-10 02:06:27 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-02-10 02:06:27 +0100 |
commit | 94e6e5be8281cb759a06a3b18f4f25a1c87142e2 (patch) | |
tree | ba00eca761beb0064c066071d24b027bd7c93211 | |
parent | 3c702e840b23aa350412d53437b34fee7516e00e (diff) |
cmake: use target_{compile,link}_options
-rw-r--r-- | cmake/opentrack-boilerplate.cmake | 2 | ||||
-rw-r--r-- | cmake/opentrack-pkg-config.cmake | 16 | ||||
-rw-r--r-- | cmake/opentrack-version.cmake | 2 | ||||
-rw-r--r-- | migration/CMakeLists.txt | 2 | ||||
-rw-r--r-- | proto-iokit-foohid/CMakeLists.txt | 2 | ||||
-rw-r--r-- | qxt-mini/CMakeLists.txt | 4 | ||||
-rw-r--r-- | x-plane-plugin/CMakeLists.txt | 27 |
7 files changed, 22 insertions, 33 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index d86dde11..683f63a4 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -217,7 +217,7 @@ function(otr_module n_) header-hygiene ) foreach(k ${opts}) - set_property(TARGET "${n}" APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-${k} ") + target_compile_options(${n} PRIVATE "-Wno-${k}") endforeach() endif() diff --git a/cmake/opentrack-pkg-config.cmake b/cmake/opentrack-pkg-config.cmake index 7d70070e..5b84cf40 100644 --- a/cmake/opentrack-pkg-config.cmake +++ b/cmake/opentrack-pkg-config.cmake @@ -2,26 +2,18 @@ include_guard(GLOBAL) include(FindPkgConfig) function(otr_pkgconfig target) - set(cflags "") - set(includes "") - set(ldflags "") - set(libs "") foreach(i ${ARGN}) set(k pkg-config_${i}) pkg_check_modules(${k} QUIET ${i}) if(${${k}_FOUND}) - set(cflags "${cflags} ${${k}_CFLAGS} ") - set(includes ${includes} ${${k}_INCLUDE_DIRS} ${${k}_INCLUDEDIR}) - set(ldflags "${ldflags} ${${k}_LDFLAGS} ") - set(libs ${libs} ${${k}_LIBRARIES}) + target_compile_options(${target} PRIVATE "${${k}_CFLAGS}") + target_link_options(${target} PRIVATE ${${k}_LDFLAGS}) + target_include_directories(${target} SYSTEM PRIVATE ${${k}_INCLUDE_DIRS} ${${k}_INCLUDEDIR}) + target_link_libraries(${target} ${${k}_LIBRARIES}) else() message(FATAL_ERROR "Can't find '${i}'. Please install development files for this package.") endif() endforeach() - set_property(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS "${cflags} ") - target_include_directories(${target} SYSTEM PRIVATE ${includes}) - set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS "${ldflags} ") - target_link_libraries(${target} ${libs}) endfunction() diff --git a/cmake/opentrack-version.cmake b/cmake/opentrack-version.cmake index ca6c70f6..0ff516f2 100644 --- a/cmake/opentrack-version.cmake +++ b/cmake/opentrack-version.cmake @@ -32,5 +32,5 @@ endif() add_library(opentrack-version STATIC "${file}") if(NOT MSVC) - set_property(TARGET opentrack-version APPEND_STRING PROPERTY COMPILE_FLAGS "-fno-lto ") + target_compile_options(opentrack-version PRIVATE -fno-lto) endif() diff --git a/migration/CMakeLists.txt b/migration/CMakeLists.txt index 1e187971..b2dfac6d 100644 --- a/migration/CMakeLists.txt +++ b/migration/CMakeLists.txt @@ -1,5 +1,5 @@ otr_module(migration BIN) target_link_libraries(opentrack-migration opentrack-logic opentrack-spline) if(CMAKE_COMPILER_IS_CLANGXX) - target_compile_options(${self} PRIVATE "-Wno-weak-vtables") + target_compile_options(${self} PRIVATE -Wno-weak-vtables) endif() diff --git a/proto-iokit-foohid/CMakeLists.txt b/proto-iokit-foohid/CMakeLists.txt index 37036a09..31d3dcdc 100644 --- a/proto-iokit-foohid/CMakeLists.txt +++ b/proto-iokit-foohid/CMakeLists.txt @@ -1,4 +1,4 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin") otr_module(proto-iokit-foohid) - set_property(TARGET opentrack-proto-iokit-foohid APPEND_STRING PROPERTY LINK_FLAGS "-framework IOKit ") + target_link_options(${self} PRIVATE -framework IOKit) endif() diff --git a/qxt-mini/CMakeLists.txt b/qxt-mini/CMakeLists.txt index 487b48d0..f355b943 100644 --- a/qxt-mini/CMakeLists.txt +++ b/qxt-mini/CMakeLists.txt @@ -2,9 +2,7 @@ if(UNIX OR APPLE) set(self opentrack-qxt-mini) otr_module(qxt-mini NO-COMPAT BIN) if(APPLE) - set_property(TARGET ${self} - APPEND_STRING PROPERTY - LINK_FLAGS " -framework Carbon -framework CoreFoundation ") + target_link_options(${self} PUBLIC -framework Carbon -framework CoreFoundation) else() otr_pkgconfig(${self} x11 xcb xproto) endif() diff --git a/x-plane-plugin/CMakeLists.txt b/x-plane-plugin/CMakeLists.txt index f7bb7a3f..1d686d98 100644 --- a/x-plane-plugin/CMakeLists.txt +++ b/x-plane-plugin/CMakeLists.txt @@ -8,29 +8,28 @@ if(LINUX OR APPLE) target_include_directories(opentrack-xplane-plugin SYSTEM PUBLIC ${SDK_XPLANE}/CHeaders ${SDK_XPLANE}/CHeaders/XPLM) if(APPLE) - set_property(TARGET opentrack-xplane-plugin APPEND_STRING PROPERTY - COMPILE_FLAGS "-iframework ${SDK_XPLANE}/Libraries/Mac/ -DAPL -DXPLM200 -DXPLM210 -framework XPLM -framework XPWidgets ") - set_property(TARGET opentrack-xplane-plugin APPEND_STRING PROPERTY - LINK_FLAGS "-F${SDK_XPLANE}/Libraries/Mac/ -framework XPLM -framework XPWidgets ") + target_compile_options(${self} PRIVATE + -iframework "${SDK_XPLANE}/Libraries/Mac/" + -DAPL -DXPLM200 -DXPLM210 + -framework XPLM -framework XPWidgets) + target_link_options(${self} + "-F${SDK_XPLANE}/Libraries/Mac/" + -framework XPLM -framework XPWidgets) elseif(CMAKE_COMPILER_IS_GNUCXX) - set_property(TARGET opentrack-xplane-plugin APPEND_STRING PROPERTY - COMPILE_FLAGS "-DLIN -DXPLM200 -DXPLM210 ") - set_property(TARGET opentrack-xplane-plugin APPEND_STRING PROPERTY - LINK_FLAGS "-rdynamic -nodefaultlibs ") + target_compile_options(${self} PRIVATE -DLIN -DXPLM200 -DXPLM210) + target_link_options(${self} PRIVATE -rdynamic -nodefaultlibs) endif() if(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_COMPILER_IS_CLANG) - set_property(TARGET opentrack-xplane-plugin APPEND_STRING PROPERTY - LINK_FLAGS "-undefined_warning ") + target_link_options(${self} PRIVATE -undefined_warning) endif() - set_target_properties(opentrack-xplane-plugin PROPERTIES + set_target_properties(${self} PROPERTIES LIBRARY_OUTPUT_NAME "opentrack.xpl" - PREFIX "" - SUFFIX "") + PREFIX "" SUFFIX "") if(UNIX AND NOT APPLE) - target_link_libraries(opentrack-xplane-plugin rt) + target_link_libraries(${self} rt) endif() endif() endif() |