Skip to content

Commit

Permalink
fix(CMake): Correct TestLibrary DLL name when building with MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
matejk committed Dec 20, 2024
1 parent 17d5ca1 commit 59f2048
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ include(GNUInstallDirs)
# Include some common macros to simpilfy the Poco CMake files
include(PocoMacros)

option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
option(BUILD_SHARED_LIBS "Build shared libraries" ON)

set(POCO_SANITIZEFLAGS CACHE STRING "Compiler-dependent sanitizer flags (like -fsanitize=address or /fsanitize=address")

Expand Down
8 changes: 7 additions & 1 deletion Foundation/testsuite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ target_link_libraries(TestApp PUBLIC Poco::Foundation)

# TestLibrary
add_library(TestLibrary SHARED src/TestLibrary.cpp src/TestPlugin.cpp src/TestPlugin.h)
set_target_properties(TestLibrary PROPERTIES PREFIX "" DEBUG_POSTFIX "d") # The test requires the library named TestLibrary. By default it is prefixed with lib.
set_target_properties(TestLibrary PROPERTIES DEBUG_POSTFIX "d")
set_target_properties(TestLibrary PROPERTIES RELEASE_POSTFIX "")
set_target_properties(TestLibrary PROPERTIES CMAKE_MINSIZEREL_POSTFIX "")
set_target_properties(TestLibrary PROPERTIES CMAKE_RELWITHDEBINFO_POSTFIX "")
# The test requires the library named TestLibrary. By default it is prefixed with lib.
set_target_properties(TestLibrary PROPERTIES PREFIX "")

# The test is run in the runtime directory. So the TestLibrary is built there too because it is used by the tests
set_target_properties(TestLibrary PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
target_link_libraries(TestLibrary PUBLIC Poco::Foundation)
Expand Down
2 changes: 2 additions & 0 deletions cmake/DefinePlatformSpecific.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ if(MSVC)
set(STATIC_POSTFIX "md" CACHE STRING "Set static library postfix" FORCE)
endif(POCO_MT)

message(STATUS "MSVC runtime library: ${CMAKE_MSVC_RUNTIME_LIBRARY}")

if(POCO_SANITIZE_ASAN)
message(WARNING "Use POCO_SANITIZEFLAGS instead of POCO_SANITIZE_ASAN")
add_compile_options("/fsanitize=address")
Expand Down

0 comments on commit 59f2048

Please sign in to comment.