Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Add ALWAYS_INSTALL_HEADERS option #458

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set(LUV_VERSION ${LUV_VERSION_MAJOR}.${LUV_VERSION_MINOR}.${LUV_VERSION_PATCH})
option(BUILD_MODULE "Build as module" ON)
option(BUILD_SHARED_LIBS "Build shared library" OFF)
option(WITH_SHARED_LIBUV "Link to a shared libuv library instead of static linking" OFF)
option(ALWAYS_INSTALL_HEADERS "Install headers regardless of build type" OFF)

if (MINGW)
add_definitions(-D_WIN32_WINNT=0x0600)
Expand Down Expand Up @@ -185,12 +186,12 @@ if (NOT LUA)
else (WIN32)
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib/lua/${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}")
endif (WIN32)
else (BUILD_MODULE)
else ()
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib"
CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include/luv"
CACHE PATH "Installation directory for headers")
endif (BUILD_MODULE)
endif ()
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include/luv"
CACHE PATH "Installation directory for headers")
endif ()

if (CMAKE_INSTALL_PREFIX)
Expand All @@ -207,9 +208,11 @@ if (CMAKE_INSTALL_PREFIX)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libluv.pc
DESTINATION ${INSTALL_LIB_DIR}/pkgconfig)
endif()
endif (NOT BUILD_MODULE)
if (NOT BUILD_MODULE OR ALWAYS_INSTALL_HEADERS)
install(
FILES src/luv.h src/util.h src/lhandle.h src/lreq.h
DESTINATION "${INSTALL_INC_DIR}"
)
endif (NOT BUILD_MODULE)
endif ()
endif (CMAKE_INSTALL_PREFIX)