From 1b3749cccfe4b70a2a9e598795e3b1eae8e9bf50 Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Sat, 14 Mar 2020 14:46:14 -0700 Subject: [PATCH] CMake: Fix header install paths for shared/static builds when using LuaRocks Fixes #463 --- CMakeLists.txt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d609546e..85e3f1a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,24 +202,28 @@ if (NOT LUA) if (BUILD_STATIC_LIBS) set(STATICLIBS_INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for static libraries") - set(STATICLIBS_INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include/luv" - CACHE PATH "Installation directory for headers") endif (BUILD_STATIC_LIBS) if (BUILD_SHARED_LIBS) set(SHAREDLIBS_INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for shared libraries") - set(SHAREDLIBS_INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include/luv" - CACHE PATH "Installation directory for headers") endif (BUILD_SHARED_LIBS) else () # use paths from luaRocks set(MODULE_INSTALL_LIB_DIR "${INSTALL_LIB_DIR}") set(STATICLIBS_INSTALL_LIB_DIR "${INSTALL_LIB_DIR}") - set(STATICLIBS_INSTALL_INC_DIR "${INSTALL_INC_DIR}") set(SHAREDLIBS_INSTALL_LIB_DIR "${INSTALL_LIB_DIR}") - set(SHAREDLIBS_INSTALL_INC_DIR "${INSTALL_INC_DIR}") endif () +# header install paths are LuaRocks-agnostic, so just use CMAKE_INSTALL_PREFIX regardless +if (BUILD_STATIC_LIBS) + set(STATICLIBS_INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include/luv" + CACHE PATH "Installation directory for headers") +endif (BUILD_STATIC_LIBS) +if (BUILD_SHARED_LIBS) + set(SHAREDLIBS_INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include/luv" + CACHE PATH "Installation directory for headers") +endif (BUILD_SHARED_LIBS) + if (CMAKE_INSTALL_PREFIX) if (BUILD_MODULE) install(TARGETS luv