From e02a5e44aaeb192b290e3a75123004b3075ed311 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Fri, 30 May 2025 18:12:46 +0200 Subject: [PATCH 1/2] Use higher-bound policies --- CMakeLists.txt | 2 +- demo/CMakeLists.txt | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b1372b44..671317d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.7) +cmake_minimum_required(VERSION 3.7...4.0) project(chipmunk) diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index 2ce0a7e5..afe0a087 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_policy(SET CMP0015 NEW) # Convert relative paths - set(OpenGL_GL_PREFERENCE GLVND) find_package(OpenGL REQUIRED) From 5cccbbee773cf45d8518e0f7223cddfeee8607c9 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Fri, 30 May 2025 18:17:14 +0200 Subject: [PATCH 2/2] Use GNUInstallDirs defaults --- CMakeLists.txt | 16 ++++++++++++++-- demo/CMakeLists.txt | 2 +- src/CMakeLists.txt | 6 +++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 671317d5..c584c00a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,11 +14,23 @@ if(NOT CMAKE_BUILD_TYPE) FORCE) endif() +include(GNUInstallDirs) # to manually select install locations of libraries and executables # -D LIB_INSTALL_DIR mylib # -D BIN_INSTALL_DIR newbin -set(LIB_INSTALL_DIR lib CACHE STRING "Install location of libraries") -set(BIN_INSTALL_DIR bin CACHE STRING "Install location of executables") +if(DEFINED LIB_INSTALL_DIR) + message(WARNING + "LIB_INSTALL_DIR is deprecated, use the standard CMAKE_INSTALL_LIBDIR instead." + ) +else() + set(LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") +endif() +if(DEFINED BIN_INSTALL_DIR) + message(WARNING + "LIB_INSTALL_DIR is deprecated, use the standard CMAKE_INSTALL_LIBDIR instead." + ) + set(LIB_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}") +endif() # other options for the build, you can i.e. activate the shared library by passing # -D BUILD_SHARED=ON diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index afe0a087..de73d14e 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -42,5 +42,5 @@ add_executable(chipmunk_demos ${chipmunk_demos_source_files}) target_link_libraries(chipmunk_demos ${chipmunk_demos_libraries}) if(INSTALL_DEMOS) - install(TARGETS chipmunk_demos RUNTIME DESTINATION bin) + install(TARGETS chipmunk_demos) endif(INSTALL_DEMOS) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 34882d14..13443003 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -53,7 +53,7 @@ if(BUILD_STATIC) endif(BUILD_STATIC) if(BUILD_SHARED OR INSTALL_STATIC) - # FIXME: change to PUBLIC_HEADER to allow building frameworks - install(FILES ${chipmunk_public_header} DESTINATION include/chipmunk) - install(FILES ${chipmunk_constraint_header} DESTINATION include/chipmunk/constraints) + # FIXME: change to target_sources(FILE_SET) + install(FILES ${chipmunk_public_header} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/chipmunk) + install(FILES ${chipmunk_constraint_header} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/chipmunk/constraints) endif(BUILD_SHARED OR INSTALL_STATIC)