From 1593d95726e5625f6288b06405772f11794fd8bd Mon Sep 17 00:00:00 2001 From: Michal Maly Date: Thu, 11 May 2017 11:48:01 +0200 Subject: [PATCH] Update Windows-specific bits of the CMake recipe --- CMakeLists.txt | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbf727e..ce2d6d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,10 +6,18 @@ project(libHPCS) option(BUILD_TEST_TOOL "Build a simple test tool to check the library's operation" OFF) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) -add_definitions("-std=c89 -Wall -Wextra -fvisibility=hidden") +if (NOT MSVC) + add_definitions("-std=c89 -Wall -Wextra -fvisibility=hidden") + if (CMAKE_BUILD_TYPE EQUAL "DEBUG") + add_definitions("-ggdb -g3") + endif() +endif() + -if (CMAKE_BUILD_TYPE EQUAL "DEBUG") - add_definitions("-ggdb -g3") +if (WIN32) + set(WIN32_EXTRA_LIBS Shlwapi) +else() + set(WIN32_EXTRA_LIBS "") endif() test_big_endian(HAVE_BIG_ENDIAN) @@ -33,14 +41,25 @@ include_directories( ${ICU_INCLUDE_DIRS}) add_library(HPCS SHARED ${libHPCS_SRCS}) -target_link_libraries(HPCS PRIVATE ${ICU_LIBRARIES}) +target_link_libraries(HPCS PRIVATE ${ICU_LIBRARIES} ${WIN32_EXTRA_LIBS}) set_target_properties(HPCS - PROPERTIES VERSION 5.0 - SOVERSION 5.0 - PUBLIC_HEADER "${PROJECT_SOURCE_DIR}/include/libHPCS.h") -install(TARGETS HPCS - LIBRARY DESTINATION lib - PUBLIC_HEADER DESTINATION include) + PROPERTIES VERSION 5.0 + SOVERSION 5.0 + PUBLIC_HEADER "${PROJECT_SOURCE_DIR}/include/libHPCS.h") +if (MSVC) + set_target_properties(HPCS + PROPERTIES PREFIX "lib") +endif() + +if (NOT WIN32) + install(TARGETS HPCS + LIBRARY DESTINATION lib + PUBLIC_HEADER DESTINATION include) +else() + install(TARGETS HPCS + RUNTIME DESTINATION lib + PUBLIC_HEADER DESTINATION include) +endif() if (BUILD_TEST_TOOL) -- 2.43.5