diff --git a/Base/ctkAppLauncherSettings.h b/Base/ctkAppLauncherSettings.h index a3f1bce..115de33 100644 --- a/Base/ctkAppLauncherSettings.h +++ b/Base/ctkAppLauncherSettings.h @@ -5,6 +5,9 @@ #include #include +// CTK includes +#include "CTKAppLauncherLibExport.h" + class ctkAppLauncherSettingsPrivate; /// @@ -129,7 +132,7 @@ class ctkAppLauncherSettingsPrivate; /// qDebug() << appLauncherSettings.envVars().value("FOO"); /// \endcode /// -class ctkAppLauncherSettings : public QObject +class CTKAPPLAUNCHERLIB_EXPORT ctkAppLauncherSettings : public QObject { Q_OBJECT public: diff --git a/Base/ctkSettingsHelper.h b/Base/ctkSettingsHelper.h index c73430c..a9598ac 100644 --- a/Base/ctkSettingsHelper.h +++ b/Base/ctkSettingsHelper.h @@ -5,23 +5,30 @@ #include #include +// CTK includes +#include "CTKAppLauncherLibExport.h" + class QSettings; class QStringList; namespace ctk { /// Read list of value stored in an array into a QStringList -QStringList readArrayValues(QSettings& settings, const QString& arrayName, const QString fieldName); +QStringList CTKAPPLAUNCHERLIB_EXPORT readArrayValues( + QSettings& settings, const QString& arrayName, const QString fieldName); /// Read list of value stored in a group into a QHash -QHash readKeyValuePairs(QSettings& settings, const QString& groupName); +QHash CTKAPPLAUNCHERLIB_EXPORT readKeyValuePairs( + QSettings& settings, const QString& groupName); /// Write QStringList -void writeArrayValues(QSettings& settings, const QStringList& values, +void CTKAPPLAUNCHERLIB_EXPORT writeArrayValues( + QSettings& settings, const QStringList& values, const QString& arrayName, const QString fieldName); /// Write QHash -void writeKeyValuePairs(QSettings& settings, +void CTKAPPLAUNCHERLIB_EXPORT writeKeyValuePairs( + QSettings& settings, const QHash& map, const QString& groupName); } // end of ctk namespace diff --git a/CMake/ctkMacroBuildLib.cmake b/CMake/ctkMacroBuildLib.cmake index e66d6c5..bf92229 100644 --- a/CMake/ctkMacroBuildLib.cmake +++ b/CMake/ctkMacroBuildLib.cmake @@ -18,10 +18,7 @@ # ########################################################################### -# -# Depends on: -# /CMake/ctkMacroParseArguments.cmake -# +include(GenerateExportHeader) macro(ctkMacroBuildLib) set(prefix ${PROJECT_NAME}) @@ -29,7 +26,7 @@ macro(ctkMacroBuildLib) message(SEND_ERROR "prefix should NOT be empty !") endif() set(options) - set(oneValueArgs NAME EXPORT_DIRECTIVE LIBRARY_TYPE LABEL) + set(oneValueArgs NAME LIBRARY_TYPE LABEL) set(multiValueArgs SRCS MOC_SRCS @@ -51,30 +48,11 @@ macro(ctkMacroBuildLib) if(NOT DEFINED ${prefix}_LABEL) set(${prefix}_LABEL ${${prefix}_NAME}) endif() - if(NOT DEFINED ${prefix}_EXPORT_DIRECTIVE) - if(${prefix}_LIBRARY_TYPE STREQUAL "SHARED") - message(SEND_ERROR "EXPORT_DIRECTIVE is mandatory") - endif() - endif() # Define library name set(lib_name ${${prefix}_NAME}) # -------------------------------------------------------------------------- - set(dynamicHeaders) - if(${prefix}_LIBRARY_TYPE STREQUAL "SHARED") - set(MY_LIBRARY_EXPORT_DIRECTIVE ${${prefix}_EXPORT_DIRECTIVE}) - set(MY_EXPORT_HEADER_PREFIX ${${prefix}_NAME}) - set(MY_LIBNAME ${lib_name}) - - configure_file( - ${CTK_SOURCE_DIR}/Libs/CTKExport.h.in - ${CMAKE_CURRENT_BINARY_DIR}/${MY_EXPORT_HEADER_PREFIX}Export.h - ) - set(dynamicHeaders - "${dynamicHeaders};${CMAKE_CURRENT_BINARY_DIR}/${MY_EXPORT_HEADER_PREFIX}Export.h") - endif() - # Make sure variable are cleared set(${prefix}_MOC_CXX) set(${prefix}_UI_CXX) @@ -130,6 +108,15 @@ macro(ctkMacroBuildLib) ) endforeach() + # Export header + generate_export_header(${lib_name} + BASE_NAME ${lib_name} + EXPORT_FILE_NAME ${lib_name}Export.h + ) + set(dynamicHeaders + ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Export.h + ) + # Install headers if(CTKAppLauncher_INSTALL_LauncherLibrary) file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h")