summaryrefslogtreecommitdiffhomepage
path: root/x-plane-plugin/CMakeLists.txt
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-23 11:37:53 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-23 13:20:22 +0200
commite28c988a04c15c2cedfe7e069a066463f4e4c452 (patch)
tree7eda372353b8d309380ebe1f524e2a136bd818a1 /x-plane-plugin/CMakeLists.txt
parent163c717dec73df7a907821cfb092a2ab6c62286a (diff)
cmake: refactor boilerplate for projects
Don't rely on a macro that shouldn't be necessary. The information "opentrack_boilerplate" retrieves is now factored out to be easily available to projects themselves. opentrack_boilerplate can now also build executables. When appropriate, target properties are now concatenated rather than replaced.
Diffstat (limited to 'x-plane-plugin/CMakeLists.txt')
-rw-r--r--x-plane-plugin/CMakeLists.txt33
1 files changed, 15 insertions, 18 deletions
diff --git a/x-plane-plugin/CMakeLists.txt b/x-plane-plugin/CMakeLists.txt
index 616f60ee..de17b60d 100644
--- a/x-plane-plugin/CMakeLists.txt
+++ b/x-plane-plugin/CMakeLists.txt
@@ -1,31 +1,28 @@
-
if(LINUX OR APPLE)
- opentrack_boilerplate(opentrack-xplane-plugin NO-LIBRARY)
set(SDK_XPLANE "" CACHE PATH "Path to X-Plane SDK")
+ opentrack_boilerplate(opentrack-xplane-plugin NO-QT)
+
if(SDK_XPLANE)
# probably librt already included
- add_library(opentrack-xplane-plugin SHARED ${opentrack-xplane-plugin-c})
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(vis "-fvisibility=hidden")
+ set(begin TARGET opentrack-xplane-plugin APPEND_STRING PROPERTY)
+
if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE)
- SET_TARGET_PROPERTIES(opentrack-xplane-plugin
- PROPERTIES LINK_FLAGS
- "-shared -rdynamic -nodefaultlibs -undefined_warning -fPIC"
- COMPILE_FLAGS "${vis} -Wall -O2 -pipe -fPIC -DLIN -DXPLM200 -DXPLM210"
- LIBRARY_OUTPUT_NAME "opentrack.xpl"
- PREFIX "" SUFFIX "")
- endif()
- if(APPLE)
- SET_TARGET_PROPERTIES(opentrack-xplane-plugin PROPERTIES
- COMPILE_FLAGS "${vis} -iframework ${SDK_XPLANE}/Libraries/Mac/ -DAPL -DXPLM200 -DXPLM210 -framework XPLM -framework XPWidgets"
- LINK_FLAGS "-F${SDK_XPLANE}/Libraries/Mac/ -framework XPLM -framework XPWidgets"
- LIBRARY_OUTPUT_NAME "opentrack.xpl"
- PREFIX "" SUFFIX "")
+ set_property(${begin} COMPILE_FLAGS "-O2 -pipe -fPIC -DLIN -DXPLM200 -DXPLM210")
+ set_property(${begin} LINK_FLAGS "-shared -rdynamic -nodefaultlibs -undefined_warning -fPIC")
+ elseif(APPLE)
+ set_property(${begin} COMPILE_FLAGS "-iframework ${SDK_XPLANE}/Libraries/Mac/ -DAPL -DXPLM200 -DXPLM210 -framework XPLM -framework XPWidgets")
+ set_property(${begin} LINK_FLAGS "-F${SDK_XPLANE}/Libraries/Mac/ -framework XPLM -framework XPWidgets")
endif()
+
+ set_target_properties(opentrack-xplane-plugin PROPERTIES
+ LIBRARY_OUTPUT_NAME "opentrack.xpl"
+ PREFIX ""
+ SUFFIX "")
+
if(UNIX AND NOT APPLE)
target_link_libraries(opentrack-xplane-plugin rt)
endif()
- install(TARGETS opentrack-xplane-plugin RUNTIME DESTINATION ${opentrack-hier-pfx} LIBRARY DESTINATION ${opentrack-hier-pfx} )
endif()
endif()