Skip to content
Permalink
Browse files

Added Cmake: shared lib

and install target for both static and shared libs.
Enjoy!!
  • Loading branch information...
danieagle committed Mar 19, 2019
1 parent d175c40 commit ef039555cf9828a61b18bb794ef09086870add99
Showing with 31 additions and 0 deletions.
  1. +31 −0 CMakeLists.txt
@@ -70,6 +70,7 @@ endif()
include_directories(.)

add_library(wirehair STATIC ${LIB_SOURCE_FILES})
set_target_properties(wirehair PROPERTIES PUBLIC_HEADER wirehair.h)

add_executable(unit_test ${UNIT_TEST_SOURCE_FILES})
target_link_libraries(unit_test wirehair)
@@ -87,3 +88,33 @@ add_executable(gen_dcounts ${GEN_DCOUNTS})
target_link_libraries(gen_dcounts wirehair)

add_executable(gen_tables ${GEN_TABLES})

add_library(wirehair-shared SHARED ${LIB_SOURCE_FILES})
set_target_properties(wirehair-shared PROPERTIES VERSION 2)
set_target_properties(wirehair-shared PROPERTIES SOVERSION 2)
set_target_properties(wirehair-shared PROPERTIES PUBLIC_HEADER wirehair.h)

add_executable(unit_test_shared ${UNIT_TEST_SOURCE_FILES})
target_link_libraries(unit_test_shared wirehair-shared)

add_executable(gen_small_dseeds_shared ${GEN_SMALL_DSEEDS})
target_link_libraries(gen_small_dseeds_shared wirehair-shared)

add_executable(gen_peel_seeds_shared ${GEN_PEEL_SEEDS})
target_link_libraries(gen_peel_seeds_shared wirehair-shared)

add_executable(gen_most_dseeds_shared ${GEN_MOST_DSEEDS})
target_link_libraries(gen_most_dseeds_shared wirehair-shared)

add_executable(gen_dcounts_shared ${GEN_DCOUNTS})
target_link_libraries(gen_dcounts_shared wirehair-shared)

include(GNUInstallDirs)

install(TARGETS wirehair
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

install(TARGETS wirehair-shared
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

0 comments on commit ef03955

Please sign in to comment.
You can’t perform that action at this time.