CMakeLists.txt: using target_sources() and making CPP-files private!

This commit is contained in:
jkriege2 2022-04-18 14:19:35 +02:00
parent 3dd8246405
commit 2697e66e31
4 changed files with 15 additions and 7 deletions

View File

@ -72,7 +72,8 @@ include(CMakePackageConfigHelpers)
if(JKQtPlotter_BUILD_SHARED_LIBS)
add_library(${libsh_name} SHARED ${SOURCES} ${HEADERS})
add_library(${libsh_name} SHARED )
target_sources(${libsh_name} PRIVATE ${SOURCES} PUBLIC ${HEADERS})
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)
@ -100,7 +101,8 @@ if(JKQtPlotter_BUILD_SHARED_LIBS)
endif()
if(JKQtPlotter_BUILD_STATIC_LIBS)
add_library(${lib_name} STATIC ${SOURCES} ${HEADERS})
add_library(${lib_name} STATIC )
target_sources(${lib_name} PRIVATE ${SOURCES} PUBLIC ${HEADERS})
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)

View File

@ -34,7 +34,8 @@ include(CMakePackageConfigHelpers)
if(JKQtPlotter_BUILD_SHARED_LIBS)
add_library(${libsh_name} SHARED ${SOURCES} ${HEADERS} ${RESOURCES})
add_library(${libsh_name} SHARED )
target_sources(${libsh_name} PRIVATE ${SOURCES} ${RESOURCES} PUBLIC ${HEADERS})
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)
@ -63,6 +64,7 @@ endif()
if(JKQtPlotter_BUILD_STATIC_LIBS)
add_library(${lib_name} STATIC ${SOURCES} ${HEADERS} ${RESOURCES})
target_sources(${lib_name} PRIVATE ${SOURCES} ${RESOURCES} PUBLIC ${HEADERS})
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)

View File

@ -39,7 +39,8 @@ endif(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
include(CMakePackageConfigHelpers)
if(JKQtPlotter_BUILD_SHARED_LIBS)
add_library(${libsh_name} SHARED ${SOURCES} ${HEADERS} ${RESOURCES})
add_library(${libsh_name} SHARED
target_sources(${libsh_name} PRIVATE ${SOURCES} ${RESOURCES} PUBLIC ${HEADERS})
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)
@ -70,7 +71,8 @@ if(JKQtPlotter_BUILD_SHARED_LIBS)
endif()
if(JKQtPlotter_BUILD_STATIC_LIBS)
add_library(${lib_name} STATIC ${SOURCES} ${HEADERS} ${RESOURCES})
add_library(${lib_name} STATIC )
target_sources(${lib_name} PRIVATE ${SOURCES} ${RESOURCES} PUBLIC ${HEADERS})
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)

View File

@ -141,7 +141,8 @@ include(CMakePackageConfigHelpers)
if(JKQtPlotter_BUILD_SHARED_LIBS)
add_library(${libsh_name} SHARED ${SOURCES} ${SOURCES_GRAPHS} ${SOURCES_GUI} ${HEADERS} ${HEADERS_GRAPHS} ${HEADERS_GUI} ${RESOURCES})
add_library(${libsh_name} SHARED )
target_sources(${libsh_name} PRIVATE ${SOURCES} ${SOURCES_GRAPHS} ${SOURCES_GUI} ${RESOURCES} PUBLIC ${HEADERS} ${HEADERS_GRAPHS} ${HEADERS_GUI})
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)
@ -169,7 +170,8 @@ if(JKQtPlotter_BUILD_SHARED_LIBS)
endif()
if(JKQtPlotter_BUILD_STATIC_LIBS)
add_library(${lib_name} STATIC ${SOURCES} ${SOURCES_GRAPHS} ${SOURCES_GUI} ${HEADERS} ${HEADERS_GRAPHS} ${HEADERS_GUI} ${RESOURCES})
add_library(${lib_name} STATIC )
target_sources(${libsh_name} PRIVATE ${SOURCES} ${SOURCES_GRAPHS} ${SOURCES_GUI} ${RESOURCES} PUBLIC ${HEADERS} ${HEADERS_GRAPHS} ${HEADERS_GUI})
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)