Skip to content

Commit

Permalink
Make: Install sources through CMake (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
Spixmaster authored Nov 6, 2024
1 parent 710d2e5 commit fe7a033
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ endif()
include(GNUInstallDirs)
set(STRINGZILLA_TARGET_NAME ${PROJECT_NAME})
set(STRINGZILLA_INCLUDE_BUILD_DIR "${PROJECT_SOURCE_DIR}/include/")
set(STRINGZILLA_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")

# Define our library
add_library(${STRINGZILLA_TARGET_NAME} INTERFACE)
Expand All @@ -90,17 +91,6 @@ target_include_directories(
INTERFACE $<BUILD_INTERFACE:${STRINGZILLA_INCLUDE_BUILD_DIR}>
$<INSTALL_INTERFACE:include>)

if(STRINGZILLA_INSTALL)
install(
TARGETS ${STRINGZILLA_TARGET_NAME}
EXPORT ${STRINGZILLA_TARGETS_EXPORT_NAME}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES
DESTINATION ${STRINGZILLA_INCLUDE_INSTALL_DIR})
install(DIRECTORY ${STRINGZILLA_INCLUDE_BUILD_DIR}
DESTINATION ${STRINGZILLA_INCLUDE_INSTALL_DIR})
endif()

if(${CMAKE_VERSION} VERSION_EQUAL 3.13 OR ${CMAKE_VERSION} VERSION_GREATER 3.13)
include(CTest)
Expand Down Expand Up @@ -303,8 +293,7 @@ if(${STRINGZILLA_BUILD_SHARED})
set_target_properties(${target} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1
POSITION_INDEPENDENT_CODE ON
PUBLIC_HEADER include/stringzilla/stringzilla.h)
POSITION_INDEPENDENT_CODE ON)

if (SZ_PLATFORM_X86)
if (MSVC)
Expand Down Expand Up @@ -357,3 +346,30 @@ if(${STRINGZILLA_BUILD_SHARED})


endif()

if(STRINGZILLA_INSTALL)
install(
TARGETS stringzilla_shared
ARCHIVE
BUNDLE
FRAMEWORK
LIBRARY
OBJECTS
PRIVATE_HEADER
PUBLIC_HEADER
RESOURCE
RUNTIME)
install(
TARGETS stringzillite
ARCHIVE
BUNDLE
FRAMEWORK
LIBRARY
OBJECTS
PRIVATE_HEADER
PUBLIC_HEADER
RESOURCE
RUNTIME)
install(DIRECTORY ${STRINGZILLA_INCLUDE_BUILD_DIR} DESTINATION ${STRINGZILLA_INCLUDE_INSTALL_DIR})
install(DIRECTORY ./c/ DESTINATION /usr/src/${PROJECT_NAME}/)
endif()

0 comments on commit fe7a033

Please sign in to comment.