Fix conanfile.py/CMakeLists.txt for C consumers
The new configuration should make C consumers link to "stdc++" by default, which should fix building with static libs for C programs.
This commit is contained in:
parent
83aacc3090
commit
c3182cb127
4 changed files with 11 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
cmake_minimum_required(VERSION 3.7)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
project(UDPC)
|
project(UDPC)
|
||||||
|
|
||||||
set(UDPC_VERSION 1.1)
|
set(UDPC_VERSION 1.2)
|
||||||
set(UDPC_SOVERSION 1)
|
set(UDPC_SOVERSION 1)
|
||||||
|
|
||||||
set(UDPC_SOURCES
|
set(UDPC_SOURCES
|
||||||
|
@ -42,6 +42,12 @@ find_package(libsodium REQUIRED)
|
||||||
target_compile_definitions(UDPC PUBLIC UDPC_LIBSODIUM_ENABLED)
|
target_compile_definitions(UDPC PUBLIC UDPC_LIBSODIUM_ENABLED)
|
||||||
target_link_libraries(UDPC PUBLIC libsodium::libsodium)
|
target_link_libraries(UDPC PUBLIC libsodium::libsodium)
|
||||||
|
|
||||||
|
# Enforce linking with libstdc++ even with C targets.
|
||||||
|
# Doesn't affect conan, so conanfile.py was also modified for this.
|
||||||
|
set_target_properties(UDPC PROPERTIES
|
||||||
|
INTERFACE_LINK_LIBRARIES "stdc++"
|
||||||
|
)
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE MATCHES "Debug")
|
if(CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||||
set(UDPC_UnitTest_SOURCES
|
set(UDPC_UnitTest_SOURCES
|
||||||
src/CXX11_shared_spin_lock.cpp
|
src/CXX11_shared_spin_lock.cpp
|
||||||
|
|
|
@ -22,4 +22,4 @@ find_package(udpc CONFIG REQUIRED)
|
||||||
add_executable(UDPC_NetworkTest
|
add_executable(UDPC_NetworkTest
|
||||||
${UDPC_NetworkTest_SOURCES}
|
${UDPC_NetworkTest_SOURCES}
|
||||||
)
|
)
|
||||||
target_link_libraries(UDPC_NetworkTest udpc::udpc stdc++)
|
target_link_libraries(UDPC_NetworkTest PUBLIC udpc::udpc)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[requires]
|
[requires]
|
||||||
udpc/1.1
|
udpc/1.2
|
||||||
|
|
||||||
[generators]
|
[generators]
|
||||||
CMakeDeps
|
CMakeDeps
|
||||||
|
|
|
@ -5,7 +5,7 @@ import os
|
||||||
|
|
||||||
class udpcRecipe(ConanFile):
|
class udpcRecipe(ConanFile):
|
||||||
name = "udpc"
|
name = "udpc"
|
||||||
version = "1.1"
|
version = "1.2"
|
||||||
package_type = "library"
|
package_type = "library"
|
||||||
|
|
||||||
# Optional metadata
|
# Optional metadata
|
||||||
|
@ -54,4 +54,4 @@ class udpcRecipe(ConanFile):
|
||||||
|
|
||||||
def package_info(self):
|
def package_info(self):
|
||||||
self.cpp_info.libs = ["UDPC"]
|
self.cpp_info.libs = ["UDPC"]
|
||||||
|
self.cpp_info.system_libs = ["stdc++"]
|
||||||
|
|
Loading…
Reference in a new issue