diff --git a/CMakeLists.txt b/CMakeLists.txt index 3da19ca..e9bfca7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,38 +26,39 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) if(ULIB_SHARED_LIB) add_library(${PROJECT_NAME} SHARED "") else() - add_library(${PROJECT_NAME} STATIC "" src/ulib/system/timer.cpp - src/ulib/system/timer.h) + add_library(${PROJECT_NAME} STATIC "") endif() -target_sources(${PROJECT_NAME} - PRIVATE - 3party/mongoose/mongoose.c - src/ulib/base/location.cpp - src/ulib/base/location.h - src/ulib/concorrency/barrier.cpp - src/ulib/concorrency/barrier.h - src/ulib/concorrency/condition_variable.cpp - src/ulib/concorrency/condition_variable.h - src/ulib/concorrency/countdown_latch.cpp - src/ulib/concorrency/countdown_latch.h - src/ulib/concorrency/event.cpp - src/ulib/concorrency/event.h - src/ulib/concorrency/internal/condition_variable_impl.cpp - src/ulib/concorrency/internal/condition_variable_impl.h - src/ulib/concorrency/internal/mutex_impl.cpp - src/ulib/concorrency/internal/mutex_impl.h - src/ulib/concorrency/mutex.cpp - src/ulib/concorrency/mutex.h - src/ulib/status.cpp - src/ulib/status.h - src/ulib/system/thread.cpp - src/ulib/system/thread.h - src/ulib/system/thread_pool.cpp - src/ulib/system/thread_pool.h - src/ulib/system/timer.cpp - src/ulib/system/timer.h - src/ulib/utils/utils.cpp -) + +set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) + +target_sources( + ${PROJECT_NAME} + PRIVATE 3party/mongoose/mongoose.c + src/ulib/base/location.cpp + src/ulib/base/location.h + src/ulib/concorrency/barrier.cpp + src/ulib/concorrency/barrier.h + src/ulib/concorrency/condition_variable.cpp + src/ulib/concorrency/condition_variable.h + src/ulib/concorrency/countdown_latch.cpp + src/ulib/concorrency/countdown_latch.h + src/ulib/concorrency/event.cpp + src/ulib/concorrency/event.h + src/ulib/concorrency/internal/condition_variable_impl.cpp + src/ulib/concorrency/internal/condition_variable_impl.h + src/ulib/concorrency/internal/mutex_impl.cpp + src/ulib/concorrency/internal/mutex_impl.h + src/ulib/concorrency/mutex.cpp + src/ulib/concorrency/mutex.h + src/ulib/status.cpp + src/ulib/status.h + src/ulib/system/thread.cpp + src/ulib/system/thread.h + src/ulib/system/thread_pool.cpp + src/ulib/system/thread_pool.h + src/ulib/system/timer.cpp + src/ulib/system/timer.h + src/ulib/utils/utils.cpp) find_package(Threads REQUIRED) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") @@ -97,22 +98,20 @@ target_link_libraries(${PROJECT_NAME} PUBLIC fmt::fmt jsoncpp_static target_compile_definitions(${PROJECT_NAME} PRIVATE ULIB_LIBRARY_IMPL) target_include_directories( ${PROJECT_NAME} - PUBLIC - 3party/asio/include - 3party/bnflite - 3party/eventbus/include - 3party/inja - 3party/argagg/include - 3party/mongoose - 3party/nlohmann - 3party/nonstd - 3party/nonstd/ulib - 3party/rpc_core/include - 3party/rxcpp/Ix/CPP/src - 3party/rxcpp/Rx/v2/src - 3party/sigslot - src -) + PUBLIC 3party/asio/include + 3party/bnflite + 3party/eventbus/include + 3party/inja + 3party/argagg/include + 3party/mongoose + 3party/nlohmann + 3party/nonstd + 3party/nonstd/ulib + 3party/rpc_core/include + 3party/rxcpp/Ix/CPP/src + 3party/rxcpp/Rx/v2/src + 3party/sigslot + src) install(TARGETS ${PROJECT_NAME} DESTINATION lib)