mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-11-15 10:05:47 +08:00
improvements in CMake setup:
- removed more global settings (these are now target-specific) - exporting now Config.cmake, which contains find_package(Qt) and loads a separate Targets.cmake
This commit is contained in:
parent
5f1579314e
commit
52d3349199
@ -1,7 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
# Project Name and Version
|
||||
project(JKQTPlotter LANGUAGES CXX VERSION 2020.01.1)
|
||||
# starting from 2020: using semantic version number <major>.<minor>.<patch>
|
||||
# - bugfixes which do not change the API/ABI lead to an increase in <patch>
|
||||
# - backward-compatible API/ABI-changes mean an increasing <minor> version
|
||||
# - NON backward-compatible API/ABI-changes mean an increasing <major> version
|
||||
# relation to older versioning scheme:
|
||||
# - v2015.10 <--> 1.0.0
|
||||
# - v2018.08 <--> 2.0.0
|
||||
# - v2019.11 <--> 3.x.y
|
||||
# ==> sematic versioning starts with 4.0.0
|
||||
project(JKQTPlotter LANGUAGES CXX VERSION 4.0.0)
|
||||
|
||||
|
||||
# set search path for CMake files
|
||||
|
@ -4,18 +4,6 @@ cmake_minimum_required(VERSION 3.1)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED on)
|
||||
|
||||
if(MINGW)
|
||||
# COMPILER-SETTINGS FOR MINGW
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
|
||||
elseif(MSVC)
|
||||
# COMPILER-SETTINGS FOR MS VISUAL C++
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
|
||||
# To fix error: C2338: va_start argument must not
|
||||
# have reference type and must not be parenthesized
|
||||
add_definitions(/D_CRT_NO_VA_START_VALIDATION)
|
||||
add_definitions(/DNOMINMAX)
|
||||
endif()
|
||||
|
||||
if(NOT APPLE)
|
||||
set(CMAKE_INSTALL_RPATH $ORIGIN)
|
||||
endif()
|
||||
|
@ -16,8 +16,6 @@ set(CMAKE_CXX_STANDARD 11)
|
||||
find_package(Qt5 COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGl REQUIRED)
|
||||
|
||||
# include JKQTPlotter
|
||||
find_package(JKQTCommonLib REQUIRED)
|
||||
find_package(JKQTMathTextLib REQUIRED)
|
||||
find_package(JKQTPlotterLib REQUIRED)
|
||||
|
||||
# For Visual Studio, we need to set some additional compiler options
|
||||
|
@ -71,13 +71,23 @@ include(CMakePackageConfigHelpers)
|
||||
|
||||
if(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
add_library(${libsh_name} SHARED ${SOURCES} ${HEADERS})
|
||||
target_compile_features(${libsh_name} PUBLIC cxx_std_11)
|
||||
set_property(TARGET ${libsh_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
||||
set_property(TARGET ${libsh_name} PROPERTY OUTPUT_NAME "${libsh_name_decorated}")
|
||||
target_link_libraries(${libsh_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Xml Qt5::Widgets Qt5::PrintSupport)
|
||||
target_compile_definitions(${libsh_name} PUBLIC JKQTCOMMON_LIB_IN_DLL)
|
||||
target_compile_definitions(${libsh_name} PRIVATE JKQTCOMMON_LIB_EXPORT_LIBRARY)
|
||||
target_include_directories(${libsh_name} PUBLIC
|
||||
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD 11)
|
||||
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD_REQUIRED TRUE)
|
||||
target_compile_features(${libsh_name} PUBLIC cxx_std_11)
|
||||
if(MINGW)
|
||||
# COMPILER-SETTINGS FOR MINGW
|
||||
target_compile_options(${libsh_name} PUBLIC -fexceptions)
|
||||
elseif(MSVC)
|
||||
# COMPILER-SETTINGS FOR MS VISUAL C++
|
||||
target_compile_options(${libsh_name} PUBLIC /EHsc)
|
||||
target_compile_definitions(${libsh_name} PUBLIC /DNOMINMAX)
|
||||
endif()
|
||||
target_include_directories(${libsh_name} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
@ -89,10 +99,20 @@ endif()
|
||||
|
||||
if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
add_library(${lib_name} STATIC ${SOURCES} ${HEADERS})
|
||||
target_compile_features(${lib_name} PUBLIC cxx_std_11)
|
||||
set_property(TARGET ${lib_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
||||
set_property(TARGET ${lib_name} PROPERTY OUTPUT_NAME "${lib_name_decorated}")
|
||||
target_include_directories(${lib_name} PUBLIC
|
||||
set_property(TARGET ${lib_name} PROPERTY CXX_STANDARD 11)
|
||||
set_property(TARGET ${lib_name} PROPERTY CXX_STANDARD_REQUIRED TRUE)
|
||||
target_compile_features(${lib_name} PUBLIC cxx_std_11)
|
||||
if(MINGW)
|
||||
# COMPILER-SETTINGS FOR MINGW
|
||||
target_compile_options(${lib_name} PUBLIC -fexceptions)
|
||||
elseif(MSVC)
|
||||
# COMPILER-SETTINGS FOR MS VISUAL C++
|
||||
target_compile_options(${lib_name} PUBLIC /EHsc)
|
||||
target_compile_definitions(${lib_name} PUBLIC /DNOMINMAX)
|
||||
endif()
|
||||
target_include_directories(${lib_name} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
@ -106,40 +126,52 @@ endif()
|
||||
|
||||
# Installation
|
||||
if(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
install(TARGETS ${libsh_name} EXPORT ${libsh_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
)
|
||||
install(EXPORT ${libsh_name}_TARGETS
|
||||
FILE ${libsh_name}Config.cmake
|
||||
DESTINATION lib/cmake/${libsh_name}
|
||||
)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake"
|
||||
DESTINATION lib/cmake/${libsh_name} )
|
||||
endif(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
install(TARGETS ${libsh_name} EXPORT ${libsh_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
)
|
||||
|
||||
if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
install(TARGETS ${lib_name} EXPORT ${lib_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
)
|
||||
install(EXPORT ${lib_name}_TARGETS
|
||||
FILE ${lib_name}Config.cmake
|
||||
DESTINATION lib/cmake/${lib_name}
|
||||
)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake"
|
||||
DESTINATION lib/cmake/${lib_name} )
|
||||
endif(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
set(JKQTP_CURRENT_TARGET_FILENAME "${libsh_name}Targets.cmake")
|
||||
configure_file(LibTarget.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Config.cmake" @ONLY)
|
||||
install(EXPORT ${libsh_name}_TARGETS
|
||||
FILE "${JKQTP_CURRENT_TARGET_FILENAME}"
|
||||
DESTINATION lib/cmake
|
||||
)
|
||||
|
||||
install(FILES ${HEADERS}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
COMPONENT Headers)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Config.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
endif(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt @ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt" DESTINATION doc/JKQtPlotter )
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_LICENSE.txt" )
|
||||
if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
install(TARGETS ${lib_name} EXPORT ${lib_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
)
|
||||
set(JKQTP_CURRENT_TARGET_FILENAME "${lib_name}Targets.cmake")
|
||||
configure_file(LibTarget.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Config.cmake" @ONLY)
|
||||
install(EXPORT ${lib_name}_TARGETS
|
||||
FILE "${JKQTP_CURRENT_TARGET_FILENAME}"
|
||||
DESTINATION lib/cmake
|
||||
)
|
||||
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Config.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
|
||||
endif(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
|
||||
install(FILES ${HEADERS}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
COMPONENT Headers)
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt @ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt" DESTINATION doc/JKQtPlotter )
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_LICENSE.txt" )
|
||||
|
||||
|
13
lib/jkqtcommon/LibTarget.cmake.in
Normal file
13
lib/jkqtcommon/LibTarget.cmake.in
Normal file
@ -0,0 +1,13 @@
|
||||
# Package-config file for @libBasename@ library
|
||||
# (part of JKQtPlotter, version @PROJECT_VERSION@)
|
||||
#
|
||||
# see: https://github.com/jkriege2/JKQtPlotter
|
||||
# Copyright: (c) Jan Krieger <jan@jkrieger.de>
|
||||
#
|
||||
|
||||
|
||||
# package requires Qt 5
|
||||
find_package(Qt5 5.0 REQUIRED Core Gui Widgets PrintSupport Svg Xml OpenGL)
|
||||
|
||||
# include auto-generated targets.cmake file
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@JKQTP_CURRENT_TARGET_FILENAME@")
|
@ -35,11 +35,21 @@ include(CMakePackageConfigHelpers)
|
||||
|
||||
if(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
add_library(${libsh_name} SHARED ${SOURCES} ${HEADERS} ${RESOURCES})
|
||||
target_compile_features(${libsh_name} PUBLIC cxx_std_11)
|
||||
set_property(TARGET ${libsh_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
||||
set_property(TARGET ${libsh_name} PROPERTY OUTPUT_NAME "${libsh_name_decorated}")
|
||||
target_link_libraries(${libsh_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::OpenGL JKQTCommonSharedLib)
|
||||
target_compile_definitions(${libsh_name} PUBLIC JKQTFASTPLOTTER_LIB_IN_DLL)
|
||||
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD 11)
|
||||
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD_REQUIRED TRUE)
|
||||
target_compile_features(${libsh_name} PUBLIC cxx_std_11)
|
||||
if(MINGW)
|
||||
# COMPILER-SETTINGS FOR MINGW
|
||||
target_compile_options(${libsh_name} PUBLIC -fexceptions)
|
||||
elseif(MSVC)
|
||||
# COMPILER-SETTINGS FOR MS VISUAL C++
|
||||
target_compile_options(${libsh_name} PUBLIC /EHsc)
|
||||
target_compile_definitions(${libsh_name} PUBLIC /DNOMINMAX)
|
||||
endif()
|
||||
target_compile_definitions(${libsh_name} PRIVATE JKQTFASTPLOTTER_LIB_EXPORT_LIBRARY)
|
||||
target_include_directories(${libsh_name} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
|
||||
@ -53,9 +63,19 @@ endif()
|
||||
|
||||
if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
add_library(${lib_name} STATIC ${SOURCES} ${HEADERS} ${RESOURCES})
|
||||
target_compile_features(${lib_name} PUBLIC cxx_std_11)
|
||||
set_property(TARGET ${lib_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
||||
set_property(TARGET ${lib_name} PROPERTY OUTPUT_NAME "${lib_name_decorated}")
|
||||
set_property(TARGET ${lib_name} PROPERTY CXX_STANDARD 11)
|
||||
set_property(TARGET ${lib_name} PROPERTY CXX_STANDARD_REQUIRED TRUE)
|
||||
if(MINGW)
|
||||
# COMPILER-SETTINGS FOR MINGW
|
||||
target_compile_options(${lib_name} PUBLIC -fexceptions)
|
||||
elseif(MSVC)
|
||||
# COMPILER-SETTINGS FOR MS VISUAL C++
|
||||
target_compile_options(${lib_name} PUBLIC /EHsc)
|
||||
target_compile_definitions(${lib_name} PUBLIC /DNOMINMAX)
|
||||
endif()
|
||||
target_compile_features(${lib_name} PUBLIC cxx_std_11)
|
||||
target_link_libraries(${lib_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::OpenGL JKQTCommonLib)
|
||||
target_include_directories(${lib_name} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
|
||||
@ -70,33 +90,45 @@ endif()
|
||||
|
||||
# Installation
|
||||
if(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
install(TARGETS ${libsh_name} EXPORT ${libsh_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
)
|
||||
install(EXPORT ${libsh_name}_TARGETS
|
||||
FILE ${libsh_name}Config.cmake
|
||||
DESTINATION lib/cmake/${libsh_name}
|
||||
)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake"
|
||||
DESTINATION lib/cmake/${libsh_name} )
|
||||
install(TARGETS ${libsh_name} EXPORT ${libsh_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
)
|
||||
set(JKQTP_CURRENT_TARGET_FILENAME "${libsh_name}Targets.cmake")
|
||||
set(JKQTP_CURRENT_TARGET_SHAREDPART "Shared")
|
||||
configure_file(LibTarget.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Config.cmake" @ONLY)
|
||||
install(EXPORT ${libsh_name}_TARGETS
|
||||
FILE "${JKQTP_CURRENT_TARGET_FILENAME}"
|
||||
DESTINATION lib/cmake
|
||||
)
|
||||
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Config.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
endif(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
|
||||
if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
install(TARGETS ${lib_name} EXPORT ${lib_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
)
|
||||
install(EXPORT ${lib_name}_TARGETS
|
||||
FILE ${lib_name}Config.cmake
|
||||
DESTINATION lib/cmake/${lib_name}
|
||||
)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake"
|
||||
DESTINATION lib/cmake/${lib_name} )
|
||||
install(TARGETS ${lib_name} EXPORT ${lib_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
)
|
||||
set(JKQTP_CURRENT_TARGET_FILENAME "${lib_name}Targets.cmake")
|
||||
set(JKQTP_CURRENT_TARGET_SHAREDPART "")
|
||||
configure_file(LibTarget.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Config.cmake" @ONLY)
|
||||
install(EXPORT ${lib_name}_TARGETS
|
||||
FILE "${JKQTP_CURRENT_TARGET_FILENAME}"
|
||||
DESTINATION lib/cmake
|
||||
)
|
||||
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Config.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
endif(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
|
||||
install(FILES ${HEADERS}
|
||||
|
14
lib/jkqtfastplotter/LibTarget.cmake.in
Normal file
14
lib/jkqtfastplotter/LibTarget.cmake.in
Normal file
@ -0,0 +1,14 @@
|
||||
# Package-config file for @libBasename@ library
|
||||
# (part of JKQtPlotter, version @PROJECT_VERSION@)
|
||||
#
|
||||
# see: https://github.com/jkriege2/JKQtPlotter
|
||||
# Copyright: (c) Jan Krieger <jan@jkrieger.de>
|
||||
#
|
||||
|
||||
|
||||
# package requires Qt 5
|
||||
find_package(Qt5 5.0 REQUIRED Core Gui Widgets PrintSupport Svg Xml OpenGL)
|
||||
find_package(JKQTCommon@JKQTP_CURRENT_TARGET_SHAREDPART@Lib REQUIRED PATHS ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_MODULE_PATH})
|
||||
|
||||
# include auto-generated targets.cmake file
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@JKQTP_CURRENT_TARGET_FILENAME@")
|
@ -40,13 +40,23 @@ include(CMakePackageConfigHelpers)
|
||||
|
||||
if(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
add_library(${libsh_name} SHARED ${SOURCES} ${HEADERS} ${RESOURCES})
|
||||
target_compile_features(${libsh_name} PUBLIC cxx_std_11)
|
||||
set_property(TARGET ${libsh_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
||||
set_property(TARGET ${libsh_name} PROPERTY OUTPUT_NAME "${libsh_name_decorated}")
|
||||
target_link_libraries(${libsh_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport JKQTCommonSharedLib)
|
||||
target_compile_definitions(${libsh_name} PUBLIC JKQTMATHTEXT_LIB_IN_DLL)
|
||||
target_compile_definitions(${libsh_name} PRIVATE JKQTMATHTEXT_LIB_EXPORT_LIBRARY)
|
||||
target_include_directories(${libsh_name} PUBLIC
|
||||
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD 11)
|
||||
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD_REQUIRED TRUE)
|
||||
target_compile_features(${libsh_name} PUBLIC cxx_std_11)
|
||||
if(MINGW)
|
||||
# COMPILER-SETTINGS FOR MINGW
|
||||
target_compile_options(${libsh_name} PUBLIC -fexceptions)
|
||||
elseif(MSVC)
|
||||
# COMPILER-SETTINGS FOR MS VISUAL C++
|
||||
target_compile_options(${libsh_name} PUBLIC /EHsc)
|
||||
target_compile_definitions(${libsh_name} PUBLIC /DNOMINMAX)
|
||||
endif()
|
||||
target_include_directories(${libsh_name} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
@ -61,9 +71,19 @@ endif()
|
||||
|
||||
if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
add_library(${lib_name} STATIC ${SOURCES} ${HEADERS} ${RESOURCES})
|
||||
target_compile_features(${lib_name} PUBLIC cxx_std_11)
|
||||
set_property(TARGET ${lib_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
||||
set_property(TARGET ${lib_name} PROPERTY OUTPUT_NAME "${lib_name_decorated}")
|
||||
set_property(TARGET ${lib_name} PROPERTY CXX_STANDARD 11)
|
||||
set_property(TARGET ${lib_name} PROPERTY CXX_STANDARD_REQUIRED TRUE)
|
||||
target_compile_features(${lib_name} PUBLIC cxx_std_11)
|
||||
if(MINGW)
|
||||
# COMPILER-SETTINGS FOR MINGW
|
||||
target_compile_options(${lib_name} PUBLIC -fexceptions)
|
||||
elseif(MSVC)
|
||||
# COMPILER-SETTINGS FOR MS VISUAL C++
|
||||
target_compile_options(${lib_name} PUBLIC /EHsc)
|
||||
target_compile_definitions(${lib_name} PUBLIC /DNOMINMAX)
|
||||
endif()
|
||||
if(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
||||
target_compile_definitions(${lib_name} PRIVATE JKQTMATHTEXT_COMPILED_WITH_XITS)
|
||||
endif(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
||||
@ -81,33 +101,45 @@ endif()
|
||||
|
||||
# Installation
|
||||
if(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
install(TARGETS ${libsh_name} EXPORT ${libsh_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
)
|
||||
install(EXPORT ${libsh_name}_TARGETS
|
||||
FILE ${libsh_name}Config.cmake
|
||||
DESTINATION lib/cmake/${libsh_name}
|
||||
)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake"
|
||||
DESTINATION lib/cmake/${libsh_name} )
|
||||
install(TARGETS ${libsh_name} EXPORT ${libsh_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
)
|
||||
set(JKQTP_CURRENT_TARGET_FILENAME "${libsh_name}Targets.cmake")
|
||||
set(JKQTP_CURRENT_TARGET_SHAREDPART "Shared")
|
||||
configure_file(LibTarget.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Config.cmake" @ONLY)
|
||||
install(EXPORT ${libsh_name}_TARGETS
|
||||
FILE "${JKQTP_CURRENT_TARGET_FILENAME}"
|
||||
DESTINATION lib/cmake
|
||||
)
|
||||
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Config.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
endif(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
|
||||
if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
install(TARGETS ${lib_name} EXPORT ${lib_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
)
|
||||
install(EXPORT ${lib_name}_TARGETS
|
||||
FILE ${lib_name}Config.cmake
|
||||
DESTINATION lib/cmake/${lib_name}
|
||||
)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake"
|
||||
DESTINATION lib/cmake/${lib_name} )
|
||||
install(TARGETS ${lib_name} EXPORT ${lib_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
|
||||
)
|
||||
set(JKQTP_CURRENT_TARGET_FILENAME "${lib_name}Targets.cmake")
|
||||
set(JKQTP_CURRENT_TARGET_SHAREDPART "")
|
||||
configure_file(LibTarget.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Config.cmake" @ONLY)
|
||||
install(EXPORT ${lib_name}_TARGETS
|
||||
FILE "${JKQTP_CURRENT_TARGET_FILENAME}"
|
||||
DESTINATION lib/cmake
|
||||
)
|
||||
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Config.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
endif(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
|
||||
install(FILES ${HEADERS}
|
||||
|
14
lib/jkqtmathtext/LibTarget.cmake.in
Normal file
14
lib/jkqtmathtext/LibTarget.cmake.in
Normal file
@ -0,0 +1,14 @@
|
||||
# Package-config file for @libBasename@ library
|
||||
# (part of JKQtPlotter, version @PROJECT_VERSION@)
|
||||
#
|
||||
# see: https://github.com/jkriege2/JKQtPlotter
|
||||
# Copyright: (c) Jan Krieger <jan@jkrieger.de>
|
||||
#
|
||||
|
||||
|
||||
# package requires Qt 5
|
||||
find_package(Qt5 5.0 REQUIRED Core Gui Widgets PrintSupport Svg Xml OpenGL)
|
||||
find_package(JKQTCommon@JKQTP_CURRENT_TARGET_SHAREDPART@Lib REQUIRED PATHS ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_MODULE_PATH})
|
||||
|
||||
# include auto-generated targets.cmake file
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@JKQTP_CURRENT_TARGET_FILENAME@")
|
@ -132,13 +132,23 @@ include(CMakePackageConfigHelpers)
|
||||
|
||||
if(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
add_library(${libsh_name} SHARED ${SOURCES} ${SOURCES_GRAPHS} ${SOURCES_GUI} ${SOURCES_OVERLAYS} ${HEADERS} ${HEADERS_GRAPHS} ${HEADERS_GUI} ${HEADERS_OVERLAYS} ${RESOURCES})
|
||||
target_compile_features(${libsh_name} PUBLIC cxx_std_11)
|
||||
set_property(TARGET ${libsh_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
||||
set_property(TARGET ${libsh_name} PROPERTY OUTPUT_NAME "${libsh_name_decorated}")
|
||||
target_link_libraries(${libsh_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::Svg Qt5::Xml JKQTCommonSharedLib JKQTMathTextSharedLib)
|
||||
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD 11)
|
||||
set_property(TARGET ${libsh_name} PROPERTY CXX_STANDARD_REQUIRED TRUE)
|
||||
target_compile_features(${libsh_name} PUBLIC cxx_std_11)
|
||||
target_compile_definitions(${libsh_name} PUBLIC JKQTPLOTTER_LIB_IN_DLL)
|
||||
target_compile_definitions(${libsh_name} PRIVATE JKQTPLOTTER_LIB_EXPORT_LIBRARY)
|
||||
target_include_directories(${libsh_name} PUBLIC
|
||||
if(MINGW)
|
||||
# COMPILER-SETTINGS FOR MINGW
|
||||
target_compile_options(${libsh_name} PUBLIC -fexceptions)
|
||||
elseif(MSVC)
|
||||
# COMPILER-SETTINGS FOR MS VISUAL C++
|
||||
target_compile_options(${libsh_name} PUBLIC /EHsc)
|
||||
target_compile_definitions(${libsh_name} PUBLIC /DNOMINMAX)
|
||||
endif()
|
||||
target_include_directories(${libsh_name} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
@ -150,10 +160,20 @@ endif()
|
||||
|
||||
if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
add_library(${lib_name} STATIC ${SOURCES} ${SOURCES_GRAPHS} ${SOURCES_GUI} ${SOURCES_OVERLAYS} ${HEADERS} ${HEADERS_GRAPHS} ${HEADERS_GUI} ${HEADERS_OVERLAYS} ${RESOURCES})
|
||||
target_compile_features(${lib_name} PUBLIC cxx_std_11)
|
||||
set_property(TARGET ${lib_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
||||
set_property(TARGET ${lib_name} PROPERTY OUTPUT_NAME "${lib_name_decorated}")
|
||||
target_include_directories(${lib_name} PUBLIC
|
||||
set_property(TARGET ${lib_name} PROPERTY CXX_STANDARD 11)
|
||||
set_property(TARGET ${lib_name} PROPERTY CXX_STANDARD_REQUIRED TRUE)
|
||||
if(MINGW)
|
||||
# COMPILER-SETTINGS FOR MINGW
|
||||
target_compile_options(${lib_name} PUBLIC -fexceptions)
|
||||
elseif(MSVC)
|
||||
# COMPILER-SETTINGS FOR MS VISUAL C++
|
||||
target_compile_options(${lib_name} PUBLIC /EHsc)
|
||||
target_compile_definitions(${lib_name} PUBLIC /DNOMINMAX)
|
||||
endif()
|
||||
target_compile_features(${lib_name} PUBLIC cxx_std_11)
|
||||
target_include_directories(${lib_name} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
@ -167,33 +187,45 @@ endif()
|
||||
|
||||
# Installation
|
||||
if(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
install(TARGETS ${libsh_name} EXPORT ${libsh_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
install(EXPORT ${libsh_name}_TARGETS
|
||||
FILE ${libsh_name}Config.cmake
|
||||
DESTINATION lib/cmake/${libsh_name}
|
||||
)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake"
|
||||
DESTINATION lib/cmake/${libsh_name} )
|
||||
install(TARGETS ${libsh_name} EXPORT ${libsh_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
set(JKQTP_CURRENT_TARGET_FILENAME "${libsh_name}Targets.cmake")
|
||||
set(JKQTP_CURRENT_TARGET_SHAREDPART "Shared")
|
||||
configure_file(LibTarget.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Config.cmake" @ONLY)
|
||||
install(EXPORT ${libsh_name}_TARGETS
|
||||
FILE "${JKQTP_CURRENT_TARGET_FILENAME}"
|
||||
DESTINATION lib/cmake
|
||||
)
|
||||
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Config.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
endif(JKQtPlotter_BUILD_SHARED_LIBS)
|
||||
|
||||
if(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
install(TARGETS ${lib_name} EXPORT ${lib_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
install(EXPORT ${lib_name}_TARGETS
|
||||
FILE ${lib_name}Config.cmake
|
||||
DESTINATION lib/cmake/${lib_name}
|
||||
)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake"
|
||||
DESTINATION lib/cmake/${lib_name} )
|
||||
install(TARGETS ${lib_name} EXPORT ${lib_name}_TARGETS
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
set(JKQTP_CURRENT_TARGET_FILENAME "${lib_name}Targets.cmake")
|
||||
set(JKQTP_CURRENT_TARGET_SHAREDPART "")
|
||||
configure_file(LibTarget.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Config.cmake" @ONLY)
|
||||
install(EXPORT ${lib_name}_TARGETS
|
||||
FILE "${JKQTP_CURRENT_TARGET_FILENAME}"
|
||||
DESTINATION lib/cmake
|
||||
)
|
||||
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Config.cmake"
|
||||
DESTINATION lib/cmake )
|
||||
endif(JKQtPlotter_BUILD_STATIC_LIBS)
|
||||
|
||||
install(FILES ${HEADERS}
|
||||
|
14
lib/jkqtplotter/LibTarget.cmake.in
Normal file
14
lib/jkqtplotter/LibTarget.cmake.in
Normal file
@ -0,0 +1,14 @@
|
||||
# Package-config file for @libBasename@ library
|
||||
# (part of JKQtPlotter, version @PROJECT_VERSION@)
|
||||
#
|
||||
# see: https://github.com/jkriege2/JKQtPlotter
|
||||
# Copyright: (c) Jan Krieger <jan@jkrieger.de>
|
||||
#
|
||||
|
||||
# package requires Qt 5
|
||||
find_package(Qt5 5.0 REQUIRED Core Gui Widgets PrintSupport Svg Xml OpenGL)
|
||||
find_package(JKQTCommon@JKQTP_CURRENT_TARGET_SHAREDPART@Lib REQUIRED PATHS ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_MODULE_PATH})
|
||||
find_package(JKQTMathText@JKQTP_CURRENT_TARGET_SHAREDPART@Lib REQUIRED PATHS ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_MODULE_PATH})
|
||||
|
||||
# include auto-generated targets.cmake file
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@JKQTP_CURRENT_TARGET_FILENAME@")
|
Loading…
Reference in New Issue
Block a user