diff options
author | Matt Strapp <matt@mattstrapp.net> | 2024-05-13 14:33:09 -0500 |
---|---|---|
committer | Matt Strapp <matt@mattstrapp.net> | 2024-05-13 14:33:09 -0500 |
commit | 0d7386c7529dc106dc12827ce0f2dee91c3945c2 (patch) | |
tree | 3070f83eb7f8990d61e21236caa3137203d2b5fa /CMakeLists.txt | |
parent | Add versioning to CMake and Meson (diff) | |
download | locusts-0d7386c7529dc106dc12827ce0f2dee91c3945c2.tar locusts-0d7386c7529dc106dc12827ce0f2dee91c3945c2.tar.gz locusts-0d7386c7529dc106dc12827ce0f2dee91c3945c2.tar.bz2 locusts-0d7386c7529dc106dc12827ce0f2dee91c3945c2.tar.lz locusts-0d7386c7529dc106dc12827ce0f2dee91c3945c2.tar.xz locusts-0d7386c7529dc106dc12827ce0f2dee91c3945c2.tar.zst locusts-0d7386c7529dc106dc12827ce0f2dee91c3945c2.zip |
Add a C file to make C compilers actually build this into a shared object
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f770a0..e5e8927 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ project(libocusts VERSION 1.0.0 DESCRIPTION "A completely normal C library" LANG include(GNUInstallDirs) -add_library(objlib OBJECT include/locusts.h) +add_library(objlib OBJECT src/locusts.c) target_include_directories(objlib PUBLIC include) set_target_properties(objlib PROPERTIES LINKER_LANGUAGE C) @@ -11,15 +11,26 @@ add_library(ocusts SHARED $<TARGET_OBJECTS:objlib> include/locusts.h) target_link_libraries(ocusts PUBLIC objlib) set_target_properties(ocusts PROPERTIES LINKER_LANGUAGE C) set_target_properties(ocusts PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) +set_target_properties(ocusts PROPERTIES PUBLIC_HEADER include/locusts.h) add_library(ocusts_static STATIC $<TARGET_OBJECTS:objlib> include/locusts.h) target_link_libraries(ocusts_static PUBLIC objlib) set_target_properties(ocusts_static PROPERTIES LINKER_LANGUAGE C) +set_target_properties(ocusts_static PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) +set_target_properties(ocusts_static PROPERTIES OUTPUT_NAME ocusts) # Make autoconf and cmake agree with each other set(prefix ${CMAKE_INSTALL_PREFIX}) -set(libdir $\${prefix}/${CMAKE_INSTALL_LIBDIR}) +set(libdir \${prefix}/${CMAKE_INSTALL_LIBDIR}) set(includedir \${prefix}/${CMAKE_INSTALL_INCLUDEDIR}) set(VERSION ${PROJECT_VERSION}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ocusts.pc.in ${CMAKE_CURRENT_BINARY_DIR}/ocusts.pc @ONLY) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ocusts.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
\ No newline at end of file +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/ocusts.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +) +install( + TARGETS ocusts ocusts_static + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +)
\ No newline at end of file |