improved CMake scripts: better output, less warnings

This commit is contained in:
jkriege2 2022-07-23 13:59:23 +02:00
parent 1c473e0717
commit e923a9de7b
13 changed files with 177 additions and 146 deletions

View File

@ -47,3 +47,4 @@ if(JKQtPlotter_BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE)
else()
set(JKQtPlotter_LIBNAME_ADDITION )
endif()

View File

@ -4,3 +4,9 @@ cmake_minimum_required(VERSION 3.1)
if(NOT APPLE)
set(CMAKE_INSTALL_RPATH $ORIGIN)
endif()
math(EXPR JKQtPlotter_BIT_DEPTH ${CMAKE_SIZEOF_VOID_P}*8)
find_package( CImg QUIET )
find_package( OpenCV QUIET )

View File

@ -33,3 +33,12 @@ else()
endif()
endif()
if(${QT_VERSION_MAJOR} VERSION_LESS "6")
set(JKQtPlotter_QT_CXX_STANDARD 11)
set(JKQtPlotter_QT_CXX_STANDARD_REQUIRED TRUE)
set(JKQtPlotter_QT_CXX_COMPILE_FEATURE cxx_std_11)
else()
set(JKQtPlotter_QT_CXX_STANDARD 17)
set(JKQtPlotter_QT_CXX_STANDARD_REQUIRED TRUE)
set(JKQtPlotter_QT_CXX_COMPILE_FEATURE cxx_std_17)
endif()

View File

@ -1,22 +1,45 @@
cmake_minimum_required(VERSION 3.16)
message( STATUS )
message( STATUS "............................................................................." )
message( STATUS ".. BUILDING EXAMPLES" )
message( STATUS "............................................................................." )
if(CImg_FOUND)
message( STATUS ".. - CIMG available: BUILDING CImg-binding examples" )
else()
message( STATUS ".. - CIMG NOT available: SKIPPING CImg-binding examples" )
endif()
if(OpenCV_FOUND)
message( STATUS ".. - OpenCV available: BUILDING OpenCV-binding examples" )
else()
message( STATUS ".. - OpenCV NOT available: SKIPPING OpenCV-binding examples" )
endif()
if (JKQtPlotter_BUILD_WITH_PRECOMPILED_HEADERS)
message( STATUS ".. - Precompiled Header: ON" )
else()
message( STATUS ".. - Precompiled Header: OFF")
endif()
# needs to be first for Precompiled Headers to work
add_subdirectory(simpletest)
message( STATUS "............................................................................." )
# examples for JKQtFastPlotter
message( STATUS ".. BUILDING EXAMPLES FOR JKQTFASTPLOTTER:" )
add_subdirectory(jkqtfastplotter_test)
# examples specific to JKQtMathText
message( STATUS ".. BUILDING EXAMPLES FOR JKQTMATHTEXT:" )
add_subdirectory(jkqtmathtext_simpletest)
add_subdirectory(jkqtmathtext_test)
add_subdirectory(jkqtplot_test)
# examples for JKQtPlotter
message( STATUS ".. BUILDING EXAMPLES FOR JKQTPLOTTER:" )
# needs to be first for Precompiled Headers to work
add_subdirectory(simpletest)
add_subdirectory(jkqtplot_test)
add_subdirectory(advplotstyling)
add_subdirectory(barchart)
add_subdirectory(boxplot)

View File

@ -1,8 +1,10 @@
cmake_minimum_required(VERSION 3.16)
if(NOT DEFINED CImg_FOUND)
find_package( CImg )
endif()
set(EXAMPLE_NAME imageplot_cimg)
if(CImg_FOUND)
set(EXAMPLE_NAME imageplot_cimg)
set(EXENAME jkqtptest_${EXAMPLE_NAME})
message( STATUS ".. Building Example ${EXAMPLE_NAME}" )
@ -32,5 +34,7 @@ if(CImg_FOUND)
#Installation of Qt DLLs on Windows
jkqtplotter_deployqt(${EXENAME})
else()
message( STATUS ".. SKIPPING Example ${EXAMPLE_NAME}, CImg not found" )
endif(CImg_FOUND)

View File

@ -1,8 +1,10 @@
cmake_minimum_required(VERSION 3.16)
find_package( OpenCV )
if(NOT DEFINED OpenCV_FOUND)
find_package( OpenCV QUITE )
endif()
set(EXAMPLE_NAME imageplot_opencv)
if(OpenCV_FOUND)
set(EXAMPLE_NAME imageplot_opencv)
set(EXENAME jkqtptest_${EXAMPLE_NAME})
message( STATUS ".. Building Example ${EXAMPLE_NAME}" )
@ -37,5 +39,6 @@ if(OpenCV_FOUND)
#Installation of OpenCV DLLs on Windows
jkqtplotter_deployopencv(${EXENAME})
else()
message( STATUS ".. SKIPPING Example ${EXAMPLE_NAME}, OpenCV not found" )
endif(OpenCV_FOUND)

View File

@ -1,8 +1,10 @@
cmake_minimum_required(VERSION 3.16)
if(NOT DEFINED CImg_FOUND)
find_package( CImg )
endif()
set(EXAMPLE_NAME rgbimageplot_cimg)
if(CImg_FOUND)
set(EXAMPLE_NAME rgbimageplot_cimg)
set(EXENAME jkqtptest_${EXAMPLE_NAME})
message( STATUS ".. Building Example ${EXAMPLE_NAME}" )
@ -35,4 +37,6 @@ if(CImg_FOUND)
add_custom_command(TARGET ${EXENAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_LIST_DIR}/rgbimageplot_cimg_example.bmp" $<TARGET_FILE_DIR:${EXENAME}>
)
else()
message( STATUS ".. SKIPPING Example ${EXAMPLE_NAME}, CImg not found" )
endif(CImg_FOUND)

View File

@ -1,8 +1,10 @@
cmake_minimum_required(VERSION 3.16)
find_package( OpenCV )
if(NOT DEFINED OpenCV_FOUND)
find_package( OpenCV QUITE )
endif()
set(EXAMPLE_NAME rgbimageplot_opencv)
if (OpenCV_FOUND)
set(EXAMPLE_NAME rgbimageplot_opencv)
set(EXENAME jkqtptest_${EXAMPLE_NAME})
message( STATUS ".. Building Example ${EXAMPLE_NAME}" )
@ -38,5 +40,7 @@ if (OpenCV_FOUND)
add_custom_command(TARGET ${EXENAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_LIST_DIR}/rgbimageplot_opencv_example.bmp" $<TARGET_FILE_DIR:${EXENAME}>
)
else()
message( STATUS ".. SKIPPING Example ${EXAMPLE_NAME}, OpenCV not found" )
endif(OpenCV_FOUND)

View File

@ -13,8 +13,9 @@ endif(CMAKE_BUILD_TYPE)
message( STATUS "Using CMake: ${CMAKE_VERSION}")
message( STATUS " Generator: ${CMAKE_GENERATOR}")
message( STATUS "Using compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}, platform: ${CMAKE_CXX_PLATFORM_ID}" )
message( STATUS "C++ Standard: C++${CMAKE_CXX_STANDARD}, required: ${CMAKE_CXX_STANDARD_REQUIRED}" )
message( STATUS "Architecture: ${CMAKE_CXX_LIBRARY_ARCHITECTURE} / ${CMAKE_LIBRARY_ARCHITECTURE}" )
message( STATUS "C++ Standard: C++ ${JKQtPlotter_QT_CXX_STANDARD}, required: ${JKQtPlotter_QT_CXX_STANDARD_REQUIRED}" )
message( STATUS "LIB-Architecture: CXX: ${CMAKE_CXX_LIBRARY_ARCHITECTURE} / BASE: ${CMAKE_LIBRARY_ARCHITECTURE}" )
message( STATUS "bit depth: ${JKQtPlotter_BIT_DEPTH} bit" )
message( STATUS "System Name: ${CMAKE_SYSTEM_NAME}" )
message( STATUS "Processor Name: ${CMAKE_SYSTEM_PROCESSOR}" )
message( STATUS "Using Qt: ${QT_VERSION}" )

View File

@ -98,15 +98,9 @@ include(CMakePackageConfigHelpers)
function(JKQtCommon_setDefaultLibOptions TARGETNAME)
set_property(TARGET ${TARGETNAME} PROPERTY VERSION "${PROJECT_VERSION}")
target_link_libraries(${TARGETNAME} PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Xml Qt${QT_VERSION_MAJOR}::Widgets)
if(${QT_VERSION_MAJOR} VERSION_LESS "6")
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD_REQUIRED TRUE)
target_compile_features(${TARGETNAME} PUBLIC cxx_std_11)
else()
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD 17)
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD_REQUIRED TRUE)
target_compile_features(${TARGETNAME} PUBLIC cxx_std_17)
endif()
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD ${JKQtPlotter_QT_CXX_STANDARD})
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD_REQUIRED ${JKQtPlotter_QT_CXX_STANDARD_REQUIRED})
target_compile_features(${TARGETNAME} PUBLIC ${JKQtPlotter_QT_CXX_COMPILE_FEATURE})
if(MINGW)
# COMPILER-SETTINGS FOR MINGW
target_compile_options(${TARGETNAME} PUBLIC -fexceptions)

View File

@ -37,16 +37,9 @@ include(CMakePackageConfigHelpers)
function(JKQtFastPlotter_setDefaultLibOptions TARGETNAME)
set_property(TARGET ${TARGETNAME} PROPERTY VERSION "${PROJECT_VERSION}")
target_link_libraries(${TARGETNAME} PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::OpenGL Qt${QT_VERSION_MAJOR}::Widgets)
if(${QT_VERSION_MAJOR} VERSION_LESS "6")
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD_REQUIRED TRUE)
target_compile_features(${TARGETNAME} PUBLIC cxx_std_11)
else()
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD 17)
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD_REQUIRED TRUE)
target_compile_features(${TARGETNAME} PUBLIC cxx_std_17)
target_link_libraries(${TARGETNAME} PUBLIC Qt${QT_VERSION_MAJOR}::OpenGLWidgets)
endif()
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD ${JKQtPlotter_QT_CXX_STANDARD})
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD_REQUIRED ${JKQtPlotter_QT_CXX_STANDARD_REQUIRED})
target_compile_features(${TARGETNAME} PUBLIC ${JKQtPlotter_QT_CXX_COMPILE_FEATURE})
if(MINGW)
# COMPILER-SETTINGS FOR MINGW
target_compile_options(${TARGETNAME} PUBLIC -fexceptions)

View File

@ -92,15 +92,9 @@ include(CMakePackageConfigHelpers)
function(JKQtMathText_setDefaultLibOptions TARGETNAME)
set_property(TARGET ${TARGETNAME} PROPERTY VERSION "${PROJECT_VERSION}")
target_link_libraries(${TARGETNAME} PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets)
if(${QT_VERSION_MAJOR} VERSION_LESS "6")
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD_REQUIRED TRUE)
target_compile_features(${TARGETNAME} PUBLIC cxx_std_11)
else()
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD 17)
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD_REQUIRED TRUE)
target_compile_features(${TARGETNAME} PUBLIC cxx_std_17)
endif()
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD ${JKQtPlotter_QT_CXX_STANDARD})
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD_REQUIRED ${JKQtPlotter_QT_CXX_STANDARD_REQUIRED})
target_compile_features(${TARGETNAME} PUBLIC ${JKQtPlotter_QT_CXX_COMPILE_FEATURE})
if(MINGW)
# COMPILER-SETTINGS FOR MINGW
target_compile_options(${TARGETNAME} PUBLIC -fexceptions)

View File

@ -199,15 +199,10 @@ function(JKQtPlottter_setDefaultLibOptions TARGETNAME)
target_link_libraries(${TARGETNAME} PUBLIC Qt${QT_VERSION_MAJOR}::PrintSupport)
target_compile_definitions(${TARGETNAME} PUBLIC JKQTPLOTTER_HAS_PRINTSUPPORT)
endif()
if(${QT_VERSION_MAJOR} VERSION_LESS "6")
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD_REQUIRED TRUE)
target_compile_features(${TARGETNAME} PUBLIC cxx_std_11)
else()
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD 17)
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD_REQUIRED TRUE)
target_compile_features(${TARGETNAME} PUBLIC cxx_std_17)
endif()
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD ${JKQtPlotter_QT_CXX_STANDARD})
set_property(TARGET ${TARGETNAME} PROPERTY CXX_STANDARD_REQUIRED ${JKQtPlotter_QT_CXX_STANDARD_REQUIRED})
target_compile_features(${TARGETNAME} PUBLIC ${JKQtPlotter_QT_CXX_COMPILE_FEATURE})
if(MINGW)
# COMPILER-SETTINGS FOR MINGW
target_compile_options(${TARGETNAME} PUBLIC -fexceptions)