aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2024-05-13 12:02:03 -0500
committerMatt Strapp <matt@mattstrapp.net>2024-05-13 12:02:03 -0500
commit804701d4e6d862f67a6b17c5162beefd309f7bbf (patch)
treefaa788d3d42d5e87cba0222f33f73b9c1b003284
parentAdd autotools because why not (diff)
downloadlocusts-804701d4e6d862f67a6b17c5162beefd309f7bbf.tar
locusts-804701d4e6d862f67a6b17c5162beefd309f7bbf.tar.gz
locusts-804701d4e6d862f67a6b17c5162beefd309f7bbf.tar.bz2
locusts-804701d4e6d862f67a6b17c5162beefd309f7bbf.tar.lz
locusts-804701d4e6d862f67a6b17c5162beefd309f7bbf.tar.xz
locusts-804701d4e6d862f67a6b17c5162beefd309f7bbf.tar.zst
locusts-804701d4e6d862f67a6b17c5162beefd309f7bbf.zip
Add CMake
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
-rw-r--r--.gitignore5
-rw-r--r--CMakeLists.txt23
2 files changed, 27 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 49a2c65..696818a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -108,4 +108,7 @@ GNUmakefile
/build-aux
*~
-ocusts.pc \ No newline at end of file
+ocusts.pc
+
+# CMake
+build/**/*
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..4740aec
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,23 @@
+cmake_minimum_required(VERSION 3.14)
+project(libocusts VERSION 1.0.0 DESCRIPTION "A completely normal C library" LANGUAGES C)
+
+include(GNUInstallDirs)
+
+add_library(objlib OBJECT include/locusts.h)
+target_include_directories(objlib PUBLIC include)
+set_target_properties(objlib PROPERTIES LINKER_LANGUAGE C)
+
+add_library(ocusts SHARED $<TARGET_OBJECTS:objlib> include/locusts.h)
+target_link_libraries(ocusts PUBLIC objlib)
+set_target_properties(ocusts PROPERTIES LINKER_LANGUAGE C)
+
+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(prefix ${CMAKE_INSTALL_PREFIX})
+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