Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected Use of CMake Variable #4

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
project(qAccordion VERSION 0.2.2)

option(QACCORDION_BUILD_TESTER OFF)
option(QACCORDION_EXTERNAL OFF)

# let cmake handle all the export business on windows
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
if(WIN32)
if(${CMAKE_VERSION} VERSION_LESS 3.4.3)
message(FATAL_ERROR "Windows builds require CMake 3.4.3 or greator")
else(${CMAKE_VERSION} VERSION_LESS 3.4.3)
# let cmake handle all the export business on windows
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif(${CMAKE_VERSION} VERSION_LESS 3.4.3)
endif(WIN32)

add_subdirectory(demo)
add_subdirectory(include/qaccordion)
Expand Down
10 changes: 9 additions & 1 deletion include/qaccordion/qaccordion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@

#include "qaccordion_config.hpp"

#ifdef _WIN32
#include "qaccordion_exports.hpp"
#endif

#ifndef QACCORDION_EXPORT
#define QACCORDION_EXPORT
#endif

#include "contentpane.hpp"

class ContentPane;
Expand Down Expand Up @@ -65,7 +73,7 @@ class ContentPane;
* Currently Headers have to be unique
*
*/
class QAccordion : public QWidget
class QACCORDION_EXPORT QAccordion : public QWidget
{
Q_OBJECT
public:
Expand Down
20 changes: 14 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ find_package(Qt5Widgets 5.2 REQUIRED)
message(STATUS "Found Qt version ${Qt5Widgets_VERSION_STRING}")

if(QACCORDION_EXTERNAL)
set(base_path ${CMAKE_SOURCE_DIR}/external/qaccordion/)
set(base_path ${PROJECT_SOURCE_DIR}/external/qaccordion/)
message(STATUS
"Using qAccordion external config with base path: ${base_path}")
# provide the current build path to parent scope. add this to include
Expand All @@ -23,7 +23,7 @@ if(QACCORDION_EXTERNAL)
PARENT_SCOPE
)
else()
set(base_path ${CMAKE_SOURCE_DIR})
set(base_path ${PROJECT_SOURCE_DIR})
endif()

# configure a header file to pass some of the CMake settings
Expand All @@ -49,6 +49,10 @@ add_library(qaccordion SHARED
${QACCORDION_SOURCE}
${ICON_RESOURCE_ADDED})

set (CMAKE_INCLUDE_CURRENT_DIR ON)
include(GenerateExportHeader)
generate_export_header(qaccordion EXPORT_FILE_NAME "qaccordion_exports.hpp")

target_link_libraries(qaccordion Qt5::Widgets)

set_property(TARGET qaccordion PROPERTY CXX_STANDARD_REQUIRED ON)
Expand All @@ -70,7 +74,10 @@ if(QACCORDION_BUILD_DEMO)
set_property(TARGET accordion_demo PROPERTY CXX_STANDARD 14)
endif()

install(TARGETS qaccordion DESTINATION lib)
install(TARGETS qaccordion
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
install(FILES ${base_path}/include/qaccordion/clickableframe.hpp
DESTINATION include/qaccordion)
install(FILES ${base_path}/include/qaccordion/contentpane.hpp
Expand All @@ -79,6 +86,7 @@ install(FILES ${base_path}/include/qaccordion/qaccordion.hpp
DESTINATION include/qaccordion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qaccordion_config.hpp
DESTINATION include/qaccordion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qaccordion_export.hpp
DESTINATION include/qaccordion)

if(WIN32)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qaccordion_exports.hpp
DESTINATION include/qaccordion)
endif(WIN32)