mirror of
https://github.com/curl/curl.git
synced 2026-08-25 14:23:39 +03:00
cmake: add libcurlu/libcurltool for unit tests
Add a `libcurlu`/`libcurltool` static library that is compiled only for unit tests. We use `EXCLUDE_FROM_ALL` to make sure that they're not built by default, they're only built if unit tests are built. These libraries allow us to compile every unit test with CMake. Closes #11446
This commit is contained in:
parent
c42c6eb245
commit
39e7c22bb4
3 changed files with 19 additions and 10 deletions
|
|
@ -64,6 +64,14 @@ add_library(
|
|||
${HHEADERS} ${CSOURCES}
|
||||
)
|
||||
|
||||
add_library(
|
||||
curlu # special libcurlu library just for unittests
|
||||
STATIC
|
||||
EXCLUDE_FROM_ALL
|
||||
${HHEADERS} ${CSOURCES}
|
||||
)
|
||||
target_compile_definitions(curlu PUBLIC UNITTESTS CURL_STATICLIB)
|
||||
|
||||
add_library(
|
||||
${PROJECT_NAME}::${LIB_NAME}
|
||||
ALIAS ${LIB_NAME}
|
||||
|
|
@ -80,6 +88,7 @@ if(NOT BUILD_SHARED_LIBS)
|
|||
endif()
|
||||
|
||||
target_link_libraries(${LIB_NAME} PRIVATE ${CURL_LIBS})
|
||||
target_link_libraries(curlu PRIVATE ${CURL_LIBS})
|
||||
|
||||
transform_makefile_inc("Makefile.soname" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake")
|
||||
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue