From 02a2d2b138f4671060308435bdf8be18bf61e63a Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Fri, 4 Jun 2021 10:56:57 +0200 Subject: [PATCH] Improve CMake * Do not hardcode paths * Specify RelWithDebugInfo as default CMAKE_BUILD_TYPE * Hopefully have correct rpath information on mac --- CMakeLists.txt | 8 +++++++- DebugGUI/CMakeLists.txt | 10 ++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 34ba017..17e4a77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,9 +11,15 @@ project(DebugGUI LANGUAGES C CXX ) - find_package(GLFW NAMES glfw3 CONFIG) # Set CMAKE_INSTALL_LIBDIR explicitly to lib (to avoid lib64 on CC7) +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "RelWithDebInfo" + CACHE + STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel Coverage." + FORCE + ) +endif() set(CMAKE_INSTALL_LIBDIR lib) add_subdirectory(DebugGUI) diff --git a/DebugGUI/CMakeLists.txt b/DebugGUI/CMakeLists.txt index 1d1be34..750d5c2 100644 --- a/DebugGUI/CMakeLists.txt +++ b/DebugGUI/CMakeLists.txt @@ -148,13 +148,15 @@ write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/cmake/DebugGUIConf COMPATIBILITY AnyNewerVersion ) +set(CMAKE_INSTALL_LIBDIR lib) + install(TARGETS DebugGUI EXPORT DebugGUITargets - RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin - LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib - ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/DebugGUI + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) install(TARGETS ${GLFW_TESTS} ImGUIHeadless