Skip to content

Commit

Permalink
CMake: Fix header install paths for shared/static builds when using L…
Browse files Browse the repository at this point in the history
…uaRocks

Fixes #463
  • Loading branch information
squeek502 committed Mar 14, 2020
1 parent 02237cd commit 1b3749c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1b3749c

Please sign in to comment.