Browse Source

CMake: Allow for shared library compilation

master
Riyyi 2 years ago
parent
commit
3b7d8d1e4a
  1. 8
      CMakeLists.txt

8
CMakeLists.txt

@ -4,8 +4,10 @@
# Set project name # Set project name
set(PROJECT "ruc") set(PROJECT "ruc")
# Unit tests
option(RUC_BUILD_TESTS "Build the RUC test programs" ON) option(RUC_BUILD_TESTS "Build the RUC test programs" ON)
# Options
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(RUC_BUILD_TESTS "Build the RUC test programs" OFF)
# ------------------------------------------ # ------------------------------------------
@ -55,7 +57,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Define library source files # Define library source files
file(GLOB_RECURSE LIBRARY_SOURCES "src/*.cpp") file(GLOB_RECURSE LIBRARY_SOURCES "src/*.cpp")
add_library(${PROJECT} STATIC ${LIBRARY_SOURCES}) add_library(${PROJECT} ${LIBRARY_SOURCES})
target_include_directories(${PROJECT} PRIVATE target_include_directories(${PROJECT} PRIVATE
"src") "src")
@ -65,7 +67,7 @@ target_include_directories(${PROJECT} PRIVATE
# Define source files # Define source files
file(GLOB TEST_LIBRARY_SOURCES "test/*.cpp" "src/ruc/timer.cpp") file(GLOB TEST_LIBRARY_SOURCES "test/*.cpp" "src/ruc/timer.cpp")
add_library(${PROJECT}-test STATIC ${TEST_LIBRARY_SOURCES}) add_library(${PROJECT}-test ${TEST_LIBRARY_SOURCES})
target_include_directories(${PROJECT}-test PRIVATE target_include_directories(${PROJECT}-test PRIVATE
"src" "src"
"test") "test")

Loading…
Cancel
Save