From 0497f57268e8be7af69d37e24fa356e441c0d5f6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 1 Nov 2015 09:09:25 +0100 Subject: cmake: less linkage boilerplate --- cmake/opentrack-macros.cmake | 3 ++- csv/csv.h | 2 +- opentrack-compat/shm.h | 2 +- pose-widget/glwidget.h | 2 +- qxt-mini/qxtglobal.h | 2 +- spline-widget/functionconfig.h | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cmake/opentrack-macros.cmake b/cmake/opentrack-macros.cmake index e43dc3b5..46cf3c61 100644 --- a/cmake/opentrack-macros.cmake +++ b/cmake/opentrack-macros.cmake @@ -66,7 +66,8 @@ macro(opentrack_library n dir) set_target_properties(${n} PROPERTIES LINK_FLAGS "${link-flags} ${opentrack-foolib_LINK}" COMPILE_FLAGS "${opentrack-foolib_COMPILE}") set(link-flags) endif() - string(REPLACE "-" "_" n_ ${n}) + string(REGEX REPLACE "^opentrack-" "" n_ ${n}) + string(REPLACE "-" "_" n_ ${n_}) target_compile_definitions(${n} PRIVATE "BUILD_${n_}") if(NOT opentrack-foolib_STATIC) install(TARGETS ${n} RUNTIME DESTINATION . LIBRARY DESTINATION .) diff --git a/csv/csv.h b/csv/csv.h index 7ae1ad5c..e5a37793 100644 --- a/csv/csv.h +++ b/csv/csv.h @@ -7,7 +7,7 @@ #include #include -#ifdef BUILD_opentrack_csv +#ifdef BUILD_csv # define CSV_EXPORT Q_DECL_EXPORT #else # define CSV_EXPORT Q_DECL_IMPORT diff --git a/opentrack-compat/shm.h b/opentrack-compat/shm.h index c74534e7..28bda986 100644 --- a/opentrack-compat/shm.h +++ b/opentrack-compat/shm.h @@ -28,7 +28,7 @@ # define COMPAT_GNUC_VISIBILITY #endif -#ifdef BUILD_opentrack_compat +#ifdef BUILD_compat # ifdef _WIN32 # define COMPAT_WIN32_EXPORT __declspec(dllexport) # else diff --git a/pose-widget/glwidget.h b/pose-widget/glwidget.h index fca3502d..8896a3cf 100644 --- a/pose-widget/glwidget.h +++ b/pose-widget/glwidget.h @@ -13,7 +13,7 @@ #include "opentrack/plugin-api.hpp" #include "opentrack/simple-mat.hpp" -#ifdef BUILD_opentrack_pose_widget +#ifdef BUILD_pose_widget # define POSE_WIDGET_EXPORT Q_DECL_EXPORT #else # define POSE_WIDGET_EXPORT Q_DECL_IMPORT diff --git a/qxt-mini/qxtglobal.h b/qxt-mini/qxtglobal.h index 64fd35dc..913da556 100644 --- a/qxt-mini/qxtglobal.h +++ b/qxt-mini/qxtglobal.h @@ -51,7 +51,7 @@ #define QXT_DLLEXPORT DO_NOT_USE_THIS_ANYMORE -#ifdef BUILD_opentrack_qxt_mini +#ifdef BUILD_qxt_mini # define QXT_BUILD # define BUILD_QXT_GUI # define BUILD_QXT diff --git a/spline-widget/functionconfig.h b/spline-widget/functionconfig.h index 3d2fc23c..97a80cac 100644 --- a/spline-widget/functionconfig.h +++ b/spline-widget/functionconfig.h @@ -18,7 +18,7 @@ #include #include "opentrack-compat/qcopyable-mutex.hpp" -#ifdef BUILD_opentrack_spline_widget +#ifdef BUILD_spline_widget # define SPLINE_WIDGET_EXPORT Q_DECL_EXPORT #else # define SPLINE_WIDGET_EXPORT Q_DECL_IMPORT -- cgit v1.2.3