Skip to content

Commit

Permalink
add shared option in cmake
Browse files Browse the repository at this point in the history
Signed-off-by: Uilian Ries <[email protected]>
  • Loading branch information
uilianries committed Jan 10, 2024
1 parent ed0c1dc commit 3f9c475
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ option(LIBCORO_BUILD_TESTS "Build the tests, Default=ON." ON)
option(LIBCORO_CODE_COVERAGE "Enable code coverage, tests must also be enabled, Default=OFF" OFF)
option(LIBCORO_BUILD_EXAMPLES "Build the examples, Default=ON." ON)
option(LIBCORO_RUN_GITCONFIG "Set the githooks directory to auto format and update the readme, Default=OFF." OFF)
option(LIBCORO_BUILD_SHARED_LIBS "Build shared libraries, Default=OFF." OFF)

# Set the githooks directory to auto format and update the readme.
if (LIBCORO_RUN_GITCONFIG)
Expand All @@ -38,6 +39,8 @@ message("${PROJECT_NAME} LIBCORO_BUILD_EXAMPLES = ${LIBCORO_BUILD_EXAMPLE
message("${PROJECT_NAME} LIBCORO_FEATURE_PLATFORM = ${LIBCORO_FEATURE_PLATFORM}")
message("${PROJECT_NAME} LIBCORO_FEATURE_NETWORKING = ${LIBCORO_FEATURE_NETWORKING}")
message("${PROJECT_NAME} LIBCORO_FEATURE_TLS = ${LIBCORO_FEATURE_TLS}")
message("${PROJECT_NAME} LIBCORO_RUN_GITCONFIG = ${LIBCORO_RUN_GITCONFIG}")
message("${PROJECT_NAME} LIBCORO_BUILD_SHARED_LIBS = ${LIBCORO_BUILD_SHARED_LIBS}")

if(LIBCORO_EXTERNAL_DEPENDENCIES)
if(LIBCORO_FEATURE_NETWORKING)
Expand All @@ -56,6 +59,8 @@ else()
endif()
endif()

set(BUILD_SHARED_LIBS ${LIBCORO_BUILD_SHARED_LIBS} CACHE INTERNAL "")

set(LIBCORO_SOURCE_FILES
include/coro/concepts/awaitable.hpp
include/coro/concepts/buffer.hpp
Expand Down Expand Up @@ -130,7 +135,7 @@ if(DEFINED EMSCRIPTEN)
add_link_options(-sEXIT_RUNTIME)
endif()

add_library(${PROJECT_NAME} STATIC ${LIBCORO_SOURCE_FILES})
add_library(${PROJECT_NAME} ${LIBCORO_SOURCE_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX PREFIX "")
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
Expand Down

0 comments on commit 3f9c475

Please sign in to comment.