Changeset: 3af4eb893f3c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3af4eb893f3c
Modified Files:
        CMakeLists.txt
        clients/mapiclient/CMakeLists.txt
        clients/mapilib/CMakeLists.txt
        common/stream/CMakeLists.txt
        gdk/CMakeLists.txt
        monetdb5/tools/CMakeLists.txt
        tools/merovingian/client/CMakeLists.txt
        tools/merovingian/daemon/CMakeLists.txt
        tools/mserver/CMakeLists.txt
Branch: cmake-fun
Log Message:

Set iconv include directory if it's not built-in, plus compile dll libraries on 
windows.


diffs (197 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -955,6 +955,7 @@ if(NOT ${WITH_READLINE} STREQUAL "NO")
 endif()
 
 # Iconv
+set(ICONV_INCLUDE_DIR "")
 set(ICONV_LIBRARIES "")
 include(FindIconv)
 if(Iconv_FOUND)
@@ -962,6 +963,7 @@ if(Iconv_FOUND)
        set(HAVE_ICONV_H ON)
        cmake_push_check_state()
        if(NOT Iconv_IS_BUILT_IN)
+               set(ICONV_INCLUDE_DIR "${Iconv_INCLUDE_DIR}")
                set(ICONV_LIBRARIES "${Iconv_LIBRARY}")
                set(CMAKE_REQUIRED_LIBRARIES 
"${CMAKE_REQUIRED_LIBRARIES};${ICONV_LIBRARIES}")
        endif()
diff --git a/clients/mapiclient/CMakeLists.txt 
b/clients/mapiclient/CMakeLists.txt
--- a/clients/mapiclient/CMakeLists.txt
+++ b/clients/mapiclient/CMakeLists.txt
@@ -6,7 +6,8 @@
 # Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
 #]]
 
-include_directories(../mapilib ../../common/options ../../common/stream 
../../common/utils ${READLINE_INCLUDE_DIR})
+include_directories(../mapilib ../../common/options ../../common/stream 
../../common/utils ${READLINE_INCLUDE_DIR}
+                                       ${ICONV_INCLUDE_DIR})
 
 add_library(mcutil STATIC dump.c dotmonetdb.c dotmonetdb.h eventparser.c 
eventparser.h)
 
diff --git a/clients/mapilib/CMakeLists.txt b/clients/mapilib/CMakeLists.txt
--- a/clients/mapilib/CMakeLists.txt
+++ b/clients/mapilib/CMakeLists.txt
@@ -8,10 +8,25 @@
 
 include_directories(../../common/options ../../common/stream 
../../common/utils ${CRYPTO_INCLUDE_DIR})
 
-add_library(mapi SHARED mapi.c)
-target_link_libraries(mapi PRIVATE ${SOCKET_LIBRARIES} ${CRYPTO_LIBRARIES} 
moptions mcrypt stream)
-set_target_properties(mapi PROPERTIES VERSION ${MAPI_VERSION} SOVERSION 
${MAPI_VERSION_MAJOR})
-target_compile_definitions(mapi PRIVATE LIBMAPI)
+set(MAPI_OBJECTS mapi.c)
+set(MAPI_LIBRARIES ${SOCKET_LIBRARIES} ${CRYPTO_LIBRARIES} moptions mcrypt 
stream)
+
+if(MSVC)
+       add_library(mapi STATIC ${MAPI_OBJECTS})
+       target_link_libraries(mapi PRIVATE ${MAPI_LIBRARIES})
+
+       add_library(mapishared SHARED ${MAPI_OBJECTS})
+       target_link_libraries(mapishared PRIVATE ${MAPI_LIBRARIES})
+       set_target_properties(mapishared PROPERTIES OUTPUT_NAME mapi)
+       target_compile_definitions(mapishared PRIVATE LIBMAPI)
+
+       install(TARGETS mapishared LIBRARY DESTINATION ${LIBDIR})
+else()
+       add_library(mapi SHARED ${MAPI_OBJECTS})
+       target_link_libraries(mapi PRIVATE ${MAPI_LIBRARIES})
+       set_target_properties(mapi PROPERTIES VERSION ${MAPI_VERSION} SOVERSION 
${MAPI_VERSION_MAJOR})
+       target_compile_definitions(mapi PRIVATE LIBMAPI)
+endif()
 
 install(TARGETS mapi DESTINATION ${LIBDIR})
 install(FILES mapi.h DESTINATION ${INCLUDEDIR}/monetdb)
diff --git a/common/stream/CMakeLists.txt b/common/stream/CMakeLists.txt
--- a/common/stream/CMakeLists.txt
+++ b/common/stream/CMakeLists.txt
@@ -7,14 +7,28 @@
 #]]
 
 include_directories(${ZLIB_INCLUDE_DIR} ${BZIP2_INCLUDE_DIR} 
${SNAPPY_INCLUDE_DIR} ${LZ4_INCLUDE_DIR}
-                                   ${LIBLZMA_INCLUDE_DIR} ${CURL_INCLUDE_DIR})
+                                       ${LIBLZMA_INCLUDE_DIR} 
${CURL_INCLUDE_DIR} ${ICONV_INCLUDE_DIR})
+
+set(STREAM_OBJECTS stream.c stream.h stream_socket.h)
+set(STREAM_LIBRARIES ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${SNAPPY_LIBRARIES} 
${LZ4_LIBRARIES} ${LIBLZMA_LIBRARIES}
+                                        ${CURL_LIBRARIES} ${ICONV_LIBRARIES} 
${SOCKET_LIBRARIES})
+
+if(MSVC)
+       add_library(stream STATIC ${STREAM_OBJECTS})
+       target_link_libraries(stream PRIVATE ${STREAM_LIBRARIES})
 
-add_library(stream SHARED stream.c stream.h stream_socket.h)
-target_link_libraries(stream PRIVATE ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} 
${SNAPPY_LIBRARIES} ${LZ4_LIBRARIES}
-                                         ${LIBLZMA_LIBRARIES} 
${CURL_LIBRARIES} ${ICONV_LIBRARIES} ${SOCKET_LIBRARIES})
-target_include_directories(stream PRIVATE ${Iconv_INCLUDE_DIR})
-set_target_properties(stream PROPERTIES VERSION ${STREAM_VERSION} SOVERSION 
${STREAM_VERSION_MAJOR})
-target_compile_definitions(stream PRIVATE LIBSTREAM)
+       add_library(streamshared SHARED ${STREAM_OBJECTS})
+       target_link_libraries(streamshared PRIVATE ${STREAM_LIBRARIES})
+       set_target_properties(streamshared PROPERTIES OUTPUT_NAME stream)
+       target_compile_definitions(streamshared PRIVATE LIBSTREAM)
+
+       install(TARGETS streamshared LIBRARY DESTINATION ${LIBDIR})
+else()
+       add_library(stream SHARED ${STREAM_OBJECTS})
+       target_link_libraries(stream PRIVATE ${STREAM_LIBRARIES})
+       set_target_properties(stream PROPERTIES VERSION ${STREAM_VERSION} 
SOVERSION ${STREAM_VERSION_MAJOR})
+       target_compile_definitions(stream PRIVATE LIBSTREAM)
+endif()
 
 install(TARGETS stream LIBRARY DESTINATION ${LIBDIR})
 install(FILES stream_socket.h stream.h DESTINATION ${INCLUDEDIR}/monetdb)
diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt
--- a/gdk/CMakeLists.txt
+++ b/gdk/CMakeLists.txt
@@ -33,20 +33,20 @@ set(GDK_OBJECTS
        gdk_firstn.c
        gdk_analytic_bounds.c
        gdk_analytic_func.c gdk_analytic.h)
-
 set(GDK_LIBRARIES ${MATH_LIBRARIES} ${SOCKET_LIBRARIES} ${MALLOC_LIBRARIES} 
${PTHREAD_LIBRARIES} ${DL_LIBRARIES}
-                                 moptions mutils stream)
+       moptions mutils stream)
 
 if(MSVC)
        add_library(gdk STATIC ${GDK_OBJECTS})
-       target_link_libraries(monetdb5 PRIVATE ${GDK_LIBRARIES})
+       target_link_libraries(gdk PRIVATE ${GDK_LIBRARIES})
        set_target_properties(gdk PROPERTIES OUTPUT_NAME bat)
 
        add_library(gdkshared SHARED ${GDK_OBJECTS})
        target_link_libraries(gdkshared PRIVATE ${GDK_LIBRARIES})
        set_target_properties(gdkshared PROPERTIES OUTPUT_NAME bat)
+       target_compile_definitions(gdkshared PRIVATE LIBGDK)
+
        install(TARGETS gdkshared LIBRARY DESTINATION ${LIBDIR})
-       target_compile_definitions(gdkshared PRIVATE LIBGDK)
 else()
        add_library(gdk SHARED ${GDK_OBJECTS})
        target_link_libraries(gdk PRIVATE PRIVATE ${GDK_LIBRARIES})
diff --git a/monetdb5/tools/CMakeLists.txt b/monetdb5/tools/CMakeLists.txt
--- a/monetdb5/tools/CMakeLists.txt
+++ b/monetdb5/tools/CMakeLists.txt
@@ -6,7 +6,6 @@
 # Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
 #]]
 
-
 set(MONETDB5_PRIVATE_LINK_OBJECTS ${UUID_LIBRARIES} ${MATH_LIBRARIES} 
${SOCKET_LIBRARIES} ${MALLOC_LIBRARIES}
                                                                  
${PTHREAD_LIBRARIES} ${DL_LIBRARIES} ${CRYPTO_LIBRARIES} ${PCRE_LIBRARIES}
                                                                  
${LIBXML2_LIBRARIES} gdk stream)
@@ -22,6 +21,7 @@ if(MSVC)
        add_library(monetdb5shared SHARED monetdb.c)
        target_link_libraries(monetdb5shared PRIVATE 
${MONETDB5_PRIVATE_LINK_OBJECTS} PUBLIC ${MONETDB5_PUBLIC_LINK_OBJECTS})
        set_target_properties(monetdb5shared PROPERTIES OUTPUT_NAME monetdb5)
+
        install(TARGETS monetdb5shared DESTINATION ${LIBDIR})
 else()
        add_library(monetdb5 SHARED monetdb.c)
diff --git a/tools/merovingian/client/CMakeLists.txt 
b/tools/merovingian/client/CMakeLists.txt
--- a/tools/merovingian/client/CMakeLists.txt
+++ b/tools/merovingian/client/CMakeLists.txt
@@ -6,7 +6,7 @@
 # Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
 #]]
 
-include_directories(../../../common/stream ../../../common/utils ../utils)
+include_directories(../../../common/stream ../../../common/utils ../utils 
${ICONV_INCLUDE_DIR})
 
 add_executable(monetdb monetdb.c)
 target_link_libraries(monetdb PRIVATE meroutil mcrypt msabaoth mutils stream 
${UUID_LIBRARIES} ${CRYPTO_LIBRARIES}
diff --git a/tools/merovingian/daemon/CMakeLists.txt 
b/tools/merovingian/daemon/CMakeLists.txt
--- a/tools/merovingian/daemon/CMakeLists.txt
+++ b/tools/merovingian/daemon/CMakeLists.txt
@@ -9,15 +9,15 @@
 add_subdirectory(config)
 
 include_directories(.. ../../../common/stream ../../../common/utils 
../../../common/options ../../../clients/mapilib
-                                       ../../../gdk ../../../monetdb5/mal)
+                                       ../../../gdk ../../../monetdb5/mal 
${ICONV_INCLUDE_DIR})
 
 add_executable(monetdbd merovingian.c merovingian.h argvcmds.c argvcmds.h 
client.c client.h connections.c connections.h
                           controlrunner.c controlrunner.h discoveryrunner.c 
discoveryrunner.h forkmserver.c forkmserver.h
                           handlers.c handlers.h multiplex-funnel.c 
multiplex-funnel.h proxy.c proxy.h)
 target_link_libraries(monetdbd PRIVATE meroutil mcrypt msabaoth mutils stream 
mapi monetdb5 gdk ${UUID_LIBRARIES}
                                          ${CRYPTO_LIBRARIES} 
${SOCKET_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${SNAPPY_LIBRARIES}
-                                         ${LZ4_LIBRARIES} ${LIBLZMA_LIBRARIES} 
${CURL_LIBRARIES} ${ICONV_LIBRARIES} ${MATH_LIBRARIES} ${MALLOC_LIBRARIES}
-                                         ${PTHREAD_LIBRARIES} ${DL_LIBRARIES} 
${PCRE_LIBRARIES} ${LIBXML2_LIBRARIES})
+                                         ${LZ4_LIBRARIES} ${LIBLZMA_LIBRARIES} 
${CURL_LIBRARIES} ${ICONV_LIBRARIES} ${MATH_LIBRARIES}
+                                         ${MALLOC_LIBRARIES} 
${PTHREAD_LIBRARIES} ${DL_LIBRARIES} ${PCRE_LIBRARIES} ${LIBXML2_LIBRARIES})
 install(TARGETS monetdbd DESTINATION ${BINDIR})
 
 configure_file(monetdbd.1.in ${CMAKE_CURRENT_BINARY_DIR}/monetdbd.1 @ONLY)
diff --git a/tools/mserver/CMakeLists.txt b/tools/mserver/CMakeLists.txt
--- a/tools/mserver/CMakeLists.txt
+++ b/tools/mserver/CMakeLists.txt
@@ -9,7 +9,7 @@
 include_directories(. ../../monetdb5/mal ../../gdk ../../common/stream 
../../common/utils ../../common/options
                                        ../../monetdb5/modules/atoms 
../../monetdb5/modules/mal ../../sql/backends/monet5 ../../sql/common
                                        ../../sql/include ../../sql/server 
../../sql/storage ${CRYPTO_INCLUDE_DIR} ${PCRE_INCLUDE_DIR}
-                                       ${LIBXML2_INCLUDE_DIR})
+                                       ${LIBXML2_INCLUDE_DIR} 
${ICONV_INCLUDE_DIR})
 
 configure_file(monet_version.c.in ${CMAKE_CURRENT_BINARY_DIR}/monet_version.c 
@ONLY)
 
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to