]> Devoid-pointer.net GitWeb - libHPCS.git/commitdiff
Update Windows-specific bits of the CMake recipe
authorMichal Maly <madcatxster@devoid-pointer.net>
Thu, 11 May 2017 09:48:01 +0000 (11:48 +0200)
committerMichal Maly <madcatxster@devoid-pointer.net>
Thu, 11 May 2017 09:48:01 +0000 (11:48 +0200)
CMakeLists.txt

index dbf727e0a343698cd80ddd3e37f70b61da17a966..ce2d6d9048916c819d1173c6c6d051cbbedc2f2a 100644 (file)
@@ -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)