@@ -10,26 +10,26 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG")
1010set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" )
1111
1212# Compiler-specific C++11 activation.
13- if (" ${CMAKE_CXX_COMPILER_ID} " MATCHES "GNU" )
13+ if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU" )
1414 execute_process (
1515 COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
1616 if (NOT (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7))
1717 message (FATAL_ERROR "${PROJECT_NAME} requires g++ 4.7 or greater." )
1818 endif ()
19- elseif (" ${CMAKE_CXX_COMPILER_ID} " MATCHES "Clang" )
19+ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" )
2020 if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
2121 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++" )
2222 elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
2323 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
2424 endif ()
2525elseif (WIN32 )
2626 # So far only msvc is supported on Windows.
27- if (NOT CMAKE_CXX_COMPILER_ID MATCHES MSVC )
27+ if (NOT CMAKE_CXX_COMPILER_ID MATCHES " MSVC" )
2828 message (
2929 ERROR
3030 "qAccordion does not support compiling on Windows with "
3131 "${CMAKE_CXX_COMPILER_ID} . Please use MSVC." )
32- endif (NOT CMAKE_CXX_COMPILER_ID MATCHES MSVC )
32+ endif (NOT CMAKE_CXX_COMPILER_ID MATCHES " MSVC" )
3333
3434 # MSVC 1800 supports C++11; earlier versions don't. So, warn if you try to
3535 # use anything else.
@@ -47,6 +47,9 @@ else ()
4747 message (FATAL_ERROR "Your C++ compiler does not support C++11." )
4848endif ()
4949
50+ # include GenerateExportHeader module
51+ include (GenerateExportHeader)
52+
5053# Find includes in corresponding build directories
5154set (CMAKE_INCLUDE_CURRENT_DIR ON )
5255# Instruct CMake to run moc automatically when needed.
@@ -62,12 +65,8 @@ else ()
6265 set (base_path ${CMAKE_SOURCE_DIR} )
6366endif ()
6467
65- message (STATUS "base path: ${base_path} " )
66-
67-
68- # include this directories so all moc headers and wrapped ui files are found
6968include_directories (
70- ${PROJECT_BINARY_DIR}
69+ ${PROJECT_BINARY_DIR} # include this directory so all moc headers and wrapped ui files are found
7170 ${base_path} /include
7271)
7372
@@ -88,9 +87,13 @@ set(QACCORDION_ICON_RESOURCE "${base_path}/icons/qaccordionicons.qrc")
8887# add resource files so they can be compiled into the binary
8988qt5_add_resources(ICON_RESOURCE_ADDED ${QACCORDION_ICON_RESOURCE} )
9089
90+ # we are building a shared library
9191add_library (qAccordion SHARED ${QACCORDION_HEADER} ${QACCORDION_SOURCE} ${ICON_RESOURCE_ADDED} )
9292target_link_libraries (qAccordion Qt5::Widgets)
9393
94+ # generate the export header. this will be used to define a macro that exports functions on windows.
95+ generate_export_header(qAccordion)
96+
9497if (QACCORDION_BUILD_TESTER)
9598 # generate ui_*.h files
9699 qt5_wrap_ui(accordion_tester_FORMS ${TEST_UI} )
@@ -104,3 +107,4 @@ install(FILES ${base_path}/include/qAccordion/clickableframe.h DESTINATION inclu
104107install (FILES ${base_path} /include /qAccordion/contentpane.h DESTINATION include /qAccordion)
105108install (FILES ${base_path} /include /qAccordion/qaccordion.h DESTINATION include /qAccordion)
106109install (FILES ${CMAKE_CURRENT_BINARY_DIR} /config.h DESTINATION include /qAccordion)
110+ install (FILES ${CMAKE_CURRENT_BINARY_DIR} /qaccordion_export.h DESTINATION include /qAccordion)
0 commit comments