diff options
-rw-r--r-- | cmake/opentrack-boilerplate.cmake | 82 | ||||
-rw-r--r-- | cmake/opentrack-version.cmake | 2 | ||||
-rw-r--r-- | compat/CMakeLists.txt | 3 | ||||
-rw-r--r-- | proto-fsuipc/CMakeLists.txt | 3 | ||||
-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 | 17 |
7 files changed, 24 insertions, 89 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index fca876ff..d08a1f6e 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -61,7 +61,7 @@ endfunction() function(otr_compat target) if(NOT MSVC) - otr_prop(SOURCE ${${target}-moc} COMPILE_FLAGS "-w -Wno-error") + set_property(SOURCE ${${target}-moc} APPEND_STRING PROPERTY COMPILE_FLAGS "-w -Wno-error ") endif() get_property(type TARGET "${n}" PROPERTY TYPE) @@ -70,17 +70,17 @@ function(otr_compat target) endif() if(CMAKE_COMPILER_IS_GNUCXX AND NOT MSVC) - otr_prop(TARGET ${target} COMPILE_FLAGS "-fvisibility=hidden") - # gives incorrect result #get_property(linker-lang TARGET ${target} PROPERTY LINKER_LANGUAGE) + set_property(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS "-fvisibility=hidden ") + if (NOT ".${${target}-cxx}" STREQUAL ".") # not a C only target - otr_prop(TARGET ${target} COMPILE_FLAGS "-fuse-cxa-atexit") + set_property(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS "-fuse-cxa-atexit ") endif() if(NOT APPLE) - otr_prop(TARGET ${target} LINK_FLAGS "-Wl,--as-needed") + set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS "-Wl,--as-needed ") endif() endif() endfunction() @@ -223,78 +223,6 @@ function(otr_module n_) set_property(GLOBAL APPEND PROPERTY opentrack-all-source-dirs "${CMAKE_CURRENT_SOURCE_DIR}") endfunction() -function(otr_prop type) - set(files "") - set(opts ${ARGN}) - # only SOURCE allows for multiple files - if(".${type}" STREQUAL ".SOURCE") - while(TRUE) - # keep popping first element off `opts' and adding to `files` - list(LENGTH opts len) - if(NOT "${len}" GREATER 0) - break() - endif() - list(GET opts 0 k) - string(FIND "${k}" "." idx1) - string(FIND "${k}" "/" idx2) - if("${idx1}" GREATER -1 AND "${idx2}" GREATER -1) - list(REMOVE_AT opts 0) - list(APPEND files "${k}") - else() - # not a pathname - break() - endif() - endwhile() - # no files, break early - # happens a few in the codebase - list(LENGTH files len) - if(len EQUAL 0) - return() - endif() - else() - # single file argument - set(opts "${ARGN}") - list(GET opts 0 files) - list(REMOVE_AT opts 0) - endif() - # must pass some properties at least - list(LENGTH opts len) - if(NOT "${len}" GREATER 0) - message(FATAL_ERROR "no properties given") - endif() - - # prop name but no value - list(LENGTH opts len) - math(EXPR mod "${len} % 2") - if(NOT "${mod}" EQUAL 0) - message(FATAL_ERROR "must specify parameter for each property") - endif() - - foreach(f ${files}) - set(opts-copy "${opts}") - - while(TRUE) - list(LENGTH opts-copy len) - if ("${len}" LESS 2) - break() - endif() - - # pop off two elements, set property - list(GET opts-copy 0 name) - list(GET opts-copy 1 value) - list(REMOVE_AT opts-copy 1 0) - - get_property(old "${type}" "${f}" PROPERTY "${name}") - if(".${old}" STREQUAL ".") - set(spc "") - else() - set(spc " ") - endif() - set_property("${type}" "${f}" APPEND_STRING PROPERTY "${name}" "${spc}${value}") - endwhile() - endforeach() -endfunction() - function(otr_add_target_dirs var) set(globs "") foreach(k ${ARGN}) diff --git a/cmake/opentrack-version.cmake b/cmake/opentrack-version.cmake index 05390659..24970b59 100644 --- a/cmake/opentrack-version.cmake +++ b/cmake/opentrack-version.cmake @@ -42,5 +42,5 @@ endif() add_library(opentrack-version STATIC "${file}") if(NOT MSVC) - otr_prop(TARGET opentrack-version COMPILE_FLAGS "-fno-lto") + set_property(TARGET opentrack-version APPEND_STRING PROPERTY COMPILE_FLAGS "-fno-lto ") endif() diff --git a/compat/CMakeLists.txt b/compat/CMakeLists.txt index d55c38c6..b58b54e9 100644 --- a/compat/CMakeLists.txt +++ b/compat/CMakeLists.txt @@ -9,5 +9,6 @@ if(WIN32) endif() if(CMAKE_COMPILER_IS_GNUCXX) - otr_prop(SOURCE nan.cpp COMPILE_FLAGS "-fno-lto -fno-fast-math -fno-finite-math-only -O0") + set_property(SOURCE nan.cpp APPEND_STRING PROPERTY + COMPILE_FLAGS "-fno-lto -fno-fast-math -fno-finite-math-only -O0 ") endif() diff --git a/proto-fsuipc/CMakeLists.txt b/proto-fsuipc/CMakeLists.txt index 99e362aa..3ba2c90c 100644 --- a/proto-fsuipc/CMakeLists.txt +++ b/proto-fsuipc/CMakeLists.txt @@ -5,7 +5,8 @@ if(WIN32) target_link_libraries(opentrack-proto-fsuipc ${SDK_FSUIPC}/FSUIPC_User.lib) target_include_directories(opentrack-proto-fsuipc SYSTEM PUBLIC ${SDK_FSUIPC}) if(MSVC) - otr_prop(TARGET opentrack-proto-fsuipc LINK_FLAGS "/NODEFAULTLIB:LIBC.lib") + set_property(TARGET opentrack-proto-fsuipc APPEND_STRING PROPERTY + LINK_FLAGS "/NODEFAULTLIB:LIBC.lib ") endif() endif() endif() diff --git a/proto-iokit-foohid/CMakeLists.txt b/proto-iokit-foohid/CMakeLists.txt index b997bf60..cdc8fb69 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) - otr_prop(TARGET opentrack-proto-iokit-foohid LINK_FLAGS "-framework IOKit") + set_property(TARGET opentrack-proto-iokit-foohid APPEND_STRING PROPERTY LINK_FLAGS "-framework IOKit ") endif() diff --git a/qxt-mini/CMakeLists.txt b/qxt-mini/CMakeLists.txt index b380e1b0..39f3525c 100644 --- a/qxt-mini/CMakeLists.txt +++ b/qxt-mini/CMakeLists.txt @@ -6,6 +6,8 @@ if(UNIX OR APPLE) target_link_libraries(opentrack-qxt-mini X11) add_definitions(-DQXT_BUILD) else() - otr_prop(TARGET opentrack-qxt-mini LINK_FLAGS "-framework Carbon -framework CoreFoundation") + set_property(TARGET opentrack-qxt-mini + APPEND_STRING PROPERTY + LINK_FLAGS "-framework Carbon -framework CoreFoundation ") endif() endif() diff --git a/x-plane-plugin/CMakeLists.txt b/x-plane-plugin/CMakeLists.txt index db712590..32ec16e2 100644 --- a/x-plane-plugin/CMakeLists.txt +++ b/x-plane-plugin/CMakeLists.txt @@ -7,18 +7,21 @@ if(LINUX OR APPLE) install(FILES ${opentrack-xplane-plugin-c} DESTINATION "${opentrack-doc-src-pfx}/opentrack-xplane-plugin") target_include_directories(opentrack-xplane-plugin SYSTEM PUBLIC ${SDK_XPLANE}/CHeaders ${SDK_XPLANE}/CHeaders/XPLM) - set(begin TARGET opentrack-xplane-plugin) - if(APPLE) - otr_prop(${begin} COMPILE_FLAGS "-iframework ${SDK_XPLANE}/Libraries/Mac/ -DAPL -DXPLM200 -DXPLM210 -framework XPLM -framework XPWidgets" - LINK_FLAGS "-F${SDK_XPLANE}/Libraries/Mac/ -framework XPLM -framework XPWidgets") + 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 ") elseif(CMAKE_COMPILER_IS_GNUCXX) - otr_prop(${begin} COMPILE_FLAGS "-fPIC -DLIN -DXPLM200 -DXPLM210" - LINK_FLAGS "-rdynamic -nodefaultlibs -fPIC") + set_property(TARGET opentrack-xplane-plugin APPEND_STRING PROPERTY + COMPILE_FLAGS "-fPIC -DLIN -DXPLM200 -DXPLM210 ") + set_property(TARGET opentrack-xplane-plugin APPEND_STRING PROPERTY + LINK_FLAGS "-rdynamic -nodefaultlibs -fPIC ") endif() if(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_COMPILER_IS_CLANG) - otr_prop(${begin} LINK_FLAGS "-undefined_warning") + set_property(TARGET opentrack-xplane-plugin APPEND_STRING PROPERTY + LINK_FLAGS "-undefined_warning ") endif() set_target_properties(opentrack-xplane-plugin PROPERTIES |