Skip to content

Commit

Permalink
fix(cmake): properly define POCO_DLL and POCO_STATIC based on BUILD_S…
Browse files Browse the repository at this point in the history
…HARED_LIBS.
  • Loading branch information
matejk committed Nov 7, 2024
1 parent c156f0b commit f25b3e4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 21 deletions.
11 changes: 2 additions & 9 deletions CppUnit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ if(WIN32)
endif()
endif()

if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(CppUnit
PUBLIC
POCO_STATIC
)
elseif(MINGW)
target_compile_definitions(CppUnit
PUBLIC
_DLL)
if(BUILD_SHARED_LIBS AND MINGW)
target_compile_definitions(CppUnit PUBLIC _DLL)
endif()
8 changes: 4 additions & 4 deletions DNSSD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( SRCS ${HDRS_G})

if (NOT POCO_STATIC)
add_compile_definitions(THREADSAFE)
endif (NOT POCO_STATIC)

add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}")
set_target_properties( "${LIBNAME}"
Expand All @@ -61,6 +57,10 @@ target_include_directories( "${LIBNAME}"
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})

if (BUILD_SHARED_LIBS)
target_compile_definitions(${LIBNAME} PUBLIC THREADSAFE)
endif ()

POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

Expand Down
7 changes: 0 additions & 7 deletions Foundation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,6 @@ if(NOT DISABLE_CPP14 AND CMAKE_VERSION VERSION_GREATER "3.8")
target_compile_features(Foundation PUBLIC cxx_std_14)
endif()

if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(Foundation
PUBLIC
POCO_STATIC
)
endif()

if(WIN32)
target_compile_definitions(Foundation PUBLIC POCO_OS_FAMILY_WINDOWS UNICODE _UNICODE)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
Expand Down
2 changes: 1 addition & 1 deletion build_cmake.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# POCO_STATIC=1 - for static build
# BUILD_SHARED_LIBS=OFF - for static build
# POCO_UNBUNDLED - for no built-in version of libs
# CMAKE_INSTALL_PREFIX=path - for install path

Expand Down
6 changes: 6 additions & 0 deletions cmake/DefinePlatformSpecific.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
# - PocoXmdd.lib for /MD debug build
# - PocoXmtd.lib for /MT debug build

if(BUILD_SHARED_LIBS)
add_compile_definitions(POCO_DLL)
else()
add_compile_definitions(POCO_STATIC)
endif()

if(MSVC)
if(POCO_MT)
set(CompilerFlags
Expand Down

0 comments on commit f25b3e4

Please sign in to comment.