CMakeLists.txt: replace option STATIC_LIB to RAPROT_SHARED_LIB. The

default behavior is now build a static library
This commit is contained in:
Timur A. Fatkhullin 2024-12-27 16:04:12 +03:00
parent 69bba48ce1
commit 99e072be78

View File

@ -18,7 +18,7 @@ find_package(cxxopts CONFIG)
set(RAPTOR_EAGLEV_LIB raptor_eaglev) set(RAPTOR_EAGLEV_LIB raptor_eaglev)
option(STATIC_LIB "Create static '${RAPTOR_EAGLEV_LIB}' library" OFF) option(RAPROT_SHARED_LIB "Create shared '${RAPTOR_EAGLEV_LIB}' library" OFF)
set(RAPTOR_EAGLEV_LIB_SRC set(RAPTOR_EAGLEV_LIB_SRC
raptor_eagle_ccd.h raptor_eagle_ccd.h
@ -27,10 +27,10 @@ set(RAPTOR_EAGLEV_LIB_SRC
raptor_eagle_exception.h raptor_eagle_exception.h
raptor_eagle_acqproc.cpp) raptor_eagle_acqproc.cpp)
if (STATIC_LIB) if (RAPROT_SHARED_LIB)
add_library(${RAPTOR_EAGLEV_LIB} STATIC ${RAPTOR_EAGLEV_LIB_SRC})
else()
add_library(${RAPTOR_EAGLEV_LIB} SHARED ${RAPTOR_EAGLEV_LIB_SRC}) add_library(${RAPTOR_EAGLEV_LIB} SHARED ${RAPTOR_EAGLEV_LIB_SRC})
else()
add_library(${RAPTOR_EAGLEV_LIB} STATIC ${RAPTOR_EAGLEV_LIB_SRC})
endif() endif()
# include(FetchContent) # include(FetchContent)
@ -69,13 +69,13 @@ add_executable(${RAPTOR_EAGLEV_SERVER} raptor_eaglev_server.cpp)
target_link_libraries(${RAPTOR_EAGLEV_SERVER} PUBLIC ${RAPTOR_EAGLEV_LIB} cxxopts::cxxopts) target_link_libraries(${RAPTOR_EAGLEV_SERVER} PUBLIC ${RAPTOR_EAGLEV_LIB} cxxopts::cxxopts)
include(GNUInstallDirs) include(GNUInstallDirs)
if (STATIC_LIB) # install only server binary if (RAPROT_SHARED_LIB) # install shared library and server binary
install(TARGETS ${RAPTOR_EAGLEV_SERVER} install(TARGETS ${RAPTOR_EAGLEV_LIB} ${RAPTOR_EAGLEV_SERVER}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
else() else()
install(TARGETS ${RAPTOR_EAGLEV_LIB} ${RAPTOR_EAGLEV_SERVER} install(TARGETS ${RAPTOR_EAGLEV_SERVER}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
endif() endif()