summaryrefslogtreecommitdiffstats
path: root/chello
diff options
context:
space:
mode:
authorBernhard Guillon <Bernhard.Guillon@begu.org>2026-06-30 21:08:01 +0200
committerBernhard Guillon <Bernhard.Guillon@begu.org>2026-06-30 21:08:01 +0200
commit4aef7357af63fc20681f40fc77957811cd8f88a4 (patch)
tree472ce62fb149cb790c369cc90fdcd75b8197b92a /chello
parent17a7b6d602ec4e0bf39078a3a9a03ef71d65cf10 (diff)
downloadcsharp-cmake-4aef7357af63fc20681f40fc77957811cd8f88a4.tar.gz
csharp-cmake-4aef7357af63fc20681f40fc77957811cd8f88a4.zip
Use add_library instead of custom command for C library
Diffstat (limited to 'chello')
-rw-r--r--chello/CMakeLists.txt16
1 files changed, 3 insertions, 13 deletions
diff --git a/chello/CMakeLists.txt b/chello/CMakeLists.txt
index f7a276f..c48ba4b 100644
--- a/chello/CMakeLists.txt
+++ b/chello/CMakeLists.txt
@@ -1,15 +1,5 @@
-find_program(CMAKE_C_COMPILER NAMES gcc cc)
-if(NOT CMAKE_C_COMPILER)
- message(FATAL_ERROR "C compiler not found!")
-endif()
+add_library(hello_c SHARED hello.c)
-set(OUTPUT_FILE ${CMAKE_BINARY_DIR}/libhello_c.so)
-
-add_custom_command(
- OUTPUT ${OUTPUT_FILE}
- COMMAND ${CMAKE_C_COMPILER} -shared -fPIC -o ${OUTPUT_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/hello.c
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/hello.c
- COMMENT "Compiling hello_c shared library..."
+set_target_properties(hello_c PROPERTIES
+ LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
)
-
-add_custom_target(hello_c ALL DEPENDS ${OUTPUT_FILE})