From 62f27ce9c1157d25ea92e2ae98efbb7205cbd6bb Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Wed, 5 Oct 2022 21:52:19 +0200 Subject: [PATCH] NEW: When using a MSVC compiler, the generated PDB files are installed to CMAKE_INSTALL_PREFIX/bin/ --- CMakeLists.txt | 3 ++ cmake/jkqtplotter_macros.cmake | 22 +++++++++++ doc/dox/whatsnew.dox | 1 + lib/jkqtcommon/CMakeLists.txt | 39 ++----------------- .../CMakeLists.txt | 38 +----------------- lib/jkqtfastplotter/CMakeLists.txt | 38 +----------------- lib/jkqtmathtext/CMakeLists.txt | 38 +----------------- lib/jkqtplotter/CMakeLists.txt | 38 +----------------- 8 files changed, 37 insertions(+), 180 deletions(-) create mode 100644 cmake/jkqtplotter_macros.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 592877fdd9..2cd941c1c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,9 @@ include(jkqtplotter_common_compilersettings) # include Qt with appropriate options to build this lib include(jkqtplotter_common_qtsettings) +# additionnal common macros +include(jkqtplotter_macros) + # now add subdirectories with the library code ... diff --git a/cmake/jkqtplotter_macros.cmake b/cmake/jkqtplotter_macros.cmake new file mode 100644 index 0000000000..c47b5a6da1 --- /dev/null +++ b/cmake/jkqtplotter_macros.cmake @@ -0,0 +1,22 @@ +function(jkqtplotter_installlibrary lib_name libIncludeSubdir) + 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} + ) + if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600) AND (NOT CMAKE_VERSION VERSION_LESS "3.1")) + install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) + endif() + 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 ) +endfunction(jkqtplotter_installlibrary) diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox index cfc3acc8d1..ebad714ee2 100644 --- a/doc/dox/whatsnew.dox +++ b/doc/dox/whatsnew.dox @@ -18,6 +18,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
  • CLEANUP (BREAKING) of library structure
  • NEW: Using precompiled headers in CMake-build to speed up build times
  • NEW/BREAKING: split jkqtcommon into basic tools and jkqtcommon_statistics_and_math for advanced math tools not used by all libs
  • +
  • NEW: When using a MSVC compiler, the generated PDB files are installed to \c CMAKE_INSTALL_PREFIX/bin/
  • JKQTPlotter:
    • FIXED issue described in #62: Fix custom labels draw, because giving exactly two label-strings did not display all of them, thanks to user:FalsinSoft
    • diff --git a/lib/jkqtcommon/CMakeLists.txt b/lib/jkqtcommon/CMakeLists.txt index d7551015a1..0806daea3f 100644 --- a/lib/jkqtcommon/CMakeLists.txt +++ b/lib/jkqtcommon/CMakeLists.txt @@ -114,51 +114,18 @@ 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} - ) - - 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 "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake" - DESTINATION lib/cmake ) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Config.cmake" - DESTINATION lib/cmake ) + jkqtplotter_installlibrary(${libsh_name} ${libIncludeSubdir}) 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} - ) - 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 ) - + jkqtplotter_installlibrary(${lib_name} ${libIncludeSubdir}) endif(JKQtPlotter_BUILD_STATIC_LIBS) install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir} COMPONENT Headers) + configure_file(${PROJECT_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${libBasename}_Readme.txt @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libBasename}_Readme.txt" DESTINATION doc/JKQtPlotter ) install(FILES "${PROJECT_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${libBasename}_LICENSE.txt" ) diff --git a/lib/jkqtcommon_statistics_and_math/CMakeLists.txt b/lib/jkqtcommon_statistics_and_math/CMakeLists.txt index 770ae165ad..3e0377f748 100644 --- a/lib/jkqtcommon_statistics_and_math/CMakeLists.txt +++ b/lib/jkqtcommon_statistics_and_math/CMakeLists.txt @@ -115,45 +115,11 @@ 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} - ) - - 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 "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake" - DESTINATION lib/cmake ) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Config.cmake" - DESTINATION lib/cmake ) + jkqtplotter_installlibrary(${libsh_name} ${libIncludeSubdir}) 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} - ) - 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 ) - + jkqtplotter_installlibrary(${lib_name} ${libIncludeSubdir}) endif(JKQtPlotter_BUILD_STATIC_LIBS) install(FILES ${HEADERS} diff --git a/lib/jkqtfastplotter/CMakeLists.txt b/lib/jkqtfastplotter/CMakeLists.txt index 0e4d7aa474..cc80885f6d 100644 --- a/lib/jkqtfastplotter/CMakeLists.txt +++ b/lib/jkqtfastplotter/CMakeLists.txt @@ -85,45 +85,11 @@ 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} - ) - 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 ) + jkqtplotter_installlibrary(${libsh_name} ${libIncludeSubdir}) 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} - ) - 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 ) + jkqtplotter_installlibrary(${lib_name} ${libIncludeSubdir}) endif(JKQtPlotter_BUILD_STATIC_LIBS) install(FILES ${HEADERS} diff --git a/lib/jkqtmathtext/CMakeLists.txt b/lib/jkqtmathtext/CMakeLists.txt index 0de9b2e293..bc5489ec38 100644 --- a/lib/jkqtmathtext/CMakeLists.txt +++ b/lib/jkqtmathtext/CMakeLists.txt @@ -184,45 +184,11 @@ 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} - ) - 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 ) + jkqtplotter_installlibrary(${libsh_name} ${libIncludeSubdir}) 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} - ) - 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 ) + jkqtplotter_installlibrary(${lib_name} ${libIncludeSubdir}) endif(JKQtPlotter_BUILD_STATIC_LIBS) install(FILES ${HEADERS} diff --git a/lib/jkqtplotter/CMakeLists.txt b/lib/jkqtplotter/CMakeLists.txt index 230dfffd24..36ee887dd4 100644 --- a/lib/jkqtplotter/CMakeLists.txt +++ b/lib/jkqtplotter/CMakeLists.txt @@ -263,45 +263,11 @@ 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} - ) - 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 ) + jkqtplotter_installlibrary(${libsh_name} ${libIncludeSubdir}) 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} - ) - 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 ) + jkqtplotter_installlibrary(${lib_name} ${libIncludeSubdir}) endif(JKQtPlotter_BUILD_STATIC_LIBS) install(FILES ${HEADERS_BASE}