This file is part of MXE. See LICENSE.md for licensing information. Taken from https://github.com/slembcke/Chipmunk2D/pull/87. From e3f2b8aa221170988b9349cdce161fe0f109109b Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Thu, 4 Sep 2014 20:23:24 -0700 Subject: [PATCH] build: Make lib and executable install path settable Also changes DLL install dir to bin/ and install DLL import libs. --- CMakeLists.txt | 6 ++++++ src/CMakeLists.txt | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 863afc0..4c99925 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,12 @@ if(NOT CMAKE_BUILD_TYPE) FORCE) endif() +# 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") + # other options for the build, you can i.e. activate the shared library by passing # -D BUILD_SHARED=ON # to cmake. Other options analog diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2e817ea..633a101 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,7 +22,9 @@ if(BUILD_SHARED) # need to explicitly link to the math library because the CMake/Android toolchains may not do it automatically target_link_libraries(chipmunk m) endif(ANDROID) - install(TARGETS chipmunk RUNTIME DESTINATION lib LIBRARY DESTINATION lib) + install(TARGETS chipmunk RUNTIME DESTINATION ${BIN_INSTALL_DIR} + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) endif(BUILD_SHARED) if(BUILD_STATIC) @@ -37,7 +39,7 @@ if(BUILD_STATIC) # Sets chipmunk_static to output "libchipmunk.a" not "libchipmunk_static.a" set_target_properties(chipmunk_static PROPERTIES OUTPUT_NAME chipmunk) if(INSTALL_STATIC) - install(TARGETS chipmunk_static ARCHIVE DESTINATION lib) + install(TARGETS chipmunk_static ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) endif(INSTALL_STATIC) endif(BUILD_STATIC) -- 1.8.3.2