From 9a8ab0858f23e0936e24f1e969795b398c9b2ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Mon, 24 Jun 2019 15:39:06 +0200 Subject: [PATCH] include version resource in DLLs built with CMake --- CppParser/CMakeLists.txt | 6 ++++++ Crypto/CMakeLists.txt | 6 ++++++ Data/CMakeLists.txt | 5 +++++ Data/MySQL/CMakeLists.txt | 6 ++++++ Data/ODBC/CMakeLists.txt | 6 ++++++ Data/PostgreSQL/CMakeLists.txt | 6 ++++++ Data/SQLite/CMakeLists.txt | 6 ++++++ Encodings/CMakeLists.txt | 6 ++++++ Foundation/CMakeLists.txt | 8 +++++++- JSON/CMakeLists.txt | 6 ++++++ MongoDB/CMakeLists.txt | 6 ++++++ Net/CMakeLists.txt | 10 ++++++++-- NetSSL_OpenSSL/CMakeLists.txt | 6 ++++++ NetSSL_Win/CMakeLists.txt | 6 ++++++ PDF/CMakeLists.txt | 6 ++++++ Redis/CMakeLists.txt | 6 ++++++ SevenZip/CMakeLists.txt | 6 ++++++ Util/CMakeLists.txt | 6 ++++++ XML/CMakeLists.txt | 6 ++++++ Zip/CMakeLists.txt | 6 ++++++ 20 files changed, 122 insertions(+), 3 deletions(-) diff --git a/CppParser/CMakeLists.txt b/CppParser/CMakeLists.txt index 5efb0f8f4..1899c922f 100644 --- a/CppParser/CMakeLists.txt +++ b/CppParser/CMakeLists.txt @@ -6,6 +6,12 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(CppParser ${SRCS}) add_library(Poco::CppParser ALIAS CppParser) set_target_properties(CppParser diff --git a/Crypto/CMakeLists.txt b/Crypto/CMakeLists.txt index 8ba34a5b8..3b46cf799 100644 --- a/Crypto/CMakeLists.txt +++ b/Crypto/CMakeLists.txt @@ -6,6 +6,12 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(Crypto ${SRCS} ) add_library(Poco::Crypto ALIAS Crypto) set_target_properties(Crypto diff --git a/Data/CMakeLists.txt b/Data/CMakeLists.txt index dd806d1c7..884a7d4a3 100644 --- a/Data/CMakeLists.txt +++ b/Data/CMakeLists.txt @@ -11,6 +11,11 @@ if(MSVC AND NOT(MSVC_VERSION LESS 1400)) PROPERTIES COMPILE_FLAGS "/bigobj") endif() +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() add_library(Data ${SRCS} ) add_library(Poco::Data ALIAS Data) diff --git a/Data/MySQL/CMakeLists.txt b/Data/MySQL/CMakeLists.txt index cd1a67473..7c6a4eccb 100644 --- a/Data/MySQL/CMakeLists.txt +++ b/Data/MySQL/CMakeLists.txt @@ -6,6 +6,12 @@ POCO_SOURCES_AUTO( MYSQL_SRCS ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS_AUTO( MYSQL_SRCS ${HDRS_G}) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND MYSQL_SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(DataMySQL ${MYSQL_SRCS} ) add_library(Poco::DataMySQL ALIAS DataMySQL) set_target_properties(DataMySQL diff --git a/Data/ODBC/CMakeLists.txt b/Data/ODBC/CMakeLists.txt index f675bf60b..d2bd93644 100644 --- a/Data/ODBC/CMakeLists.txt +++ b/Data/ODBC/CMakeLists.txt @@ -6,6 +6,12 @@ POCO_SOURCES_AUTO( ODBC_SRCS ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS_AUTO( ODBC_SRCS ${HDRS_G}) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND ODBC_SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(DataODBC ${ODBC_SRCS}) add_library(Poco::DataODBC ALIAS DataODBC) set_target_properties(DataODBC diff --git a/Data/PostgreSQL/CMakeLists.txt b/Data/PostgreSQL/CMakeLists.txt index 6324fba28..eb68ce07c 100644 --- a/Data/PostgreSQL/CMakeLists.txt +++ b/Data/PostgreSQL/CMakeLists.txt @@ -6,6 +6,12 @@ POCO_SOURCES_AUTO( POSTGRESQL_SRCS ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS_AUTO( POSTGRESQL_SRCS ${HDRS_G}) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND POSTGRESQL_SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(DataPostgreSQL ${POSTGRESQL_SRCS} ) add_library(Poco::DataPostgreSQL ALIAS DataPostgreSQL) set_target_properties(DataPostgreSQL diff --git a/Data/SQLite/CMakeLists.txt b/Data/SQLite/CMakeLists.txt index 5e22ee631..6dae8deeb 100644 --- a/Data/SQLite/CMakeLists.txt +++ b/Data/SQLite/CMakeLists.txt @@ -19,6 +19,12 @@ else() ) endif() +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SQLITE_SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(DataSQLite ${SQLITE_SRCS} ) add_library(Poco::DataSQLite ALIAS DataSQLite) diff --git a/Encodings/CMakeLists.txt b/Encodings/CMakeLists.txt index e0a9c5cde..d1181f254 100644 --- a/Encodings/CMakeLists.txt +++ b/Encodings/CMakeLists.txt @@ -6,6 +6,12 @@ POCO_SOURCES( SRCS Encodings ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS( SRCS Encodings ${HDRS_G}) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(Encodings ${SRCS} ) add_library(Poco::Encodings ALIAS Encodings) set_target_properties(Encodings diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt index 2e4cf6948..ace0b186d 100644 --- a/Foundation/CMakeLists.txt +++ b/Foundation/CMakeLists.txt @@ -23,6 +23,12 @@ POCO_SOURCES_AUTO_PLAT( SRCS WIN32 ) endif() +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + # Messages POCO_MESSAGES( SRCS Logging src/pocomsg.mc) @@ -128,7 +134,7 @@ if(NOT BUILD_SHARED_LIBS) POCO_STATIC ) endif() - + if(WIN32) target_compile_definitions(Foundation PUBLIC POCO_NO_AUTOMATIC_LIBS POCO_OS_FAMILY_WINDOWS UNICODE _UNICODE) target_link_libraries(Foundation PUBLIC iphlpapi) diff --git a/JSON/CMakeLists.txt b/JSON/CMakeLists.txt index c5a9476ba..9f2cf32b2 100644 --- a/JSON/CMakeLists.txt +++ b/JSON/CMakeLists.txt @@ -7,6 +7,12 @@ file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS_AUTO( SRCS ${HDRS_G}) POCO_SOURCES(SRCS pdjson src/pdjson.c) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(JSON ${SRCS} ) add_library(Poco::JSON ALIAS JSON) set_target_properties(JSON diff --git a/MongoDB/CMakeLists.txt b/MongoDB/CMakeLists.txt index 83c9935b7..61134df30 100644 --- a/MongoDB/CMakeLists.txt +++ b/MongoDB/CMakeLists.txt @@ -6,6 +6,12 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(MongoDB ${SRCS} ) add_library(Poco::MongoDB ALIAS MongoDB) set_target_properties(MongoDB diff --git a/Net/CMakeLists.txt b/Net/CMakeLists.txt index 8198b1b2c..56cddc3fa 100644 --- a/Net/CMakeLists.txt +++ b/Net/CMakeLists.txt @@ -6,6 +6,12 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(Net ${SRCS} ) add_library(Poco::Net ALIAS Net) set_target_properties( Net @@ -21,9 +27,9 @@ if(WIN32) target_link_libraries(Net PUBLIC "iphlpapi.lib") if(WINCE) target_link_libraries(Net PUBLIC "ws2.lib") - else() + else() target_link_libraries(Net PUBLIC "ws2_32.lib") - endif() + endif() endif(WIN32) target_include_directories(Net diff --git a/NetSSL_OpenSSL/CMakeLists.txt b/NetSSL_OpenSSL/CMakeLists.txt index 56f4fe595..0929c6849 100644 --- a/NetSSL_OpenSSL/CMakeLists.txt +++ b/NetSSL_OpenSSL/CMakeLists.txt @@ -6,6 +6,12 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(NetSSL ${SRCS} ) add_library(Poco::NetSSL ALIAS NetSSL) set_target_properties( NetSSL diff --git a/NetSSL_Win/CMakeLists.txt b/NetSSL_Win/CMakeLists.txt index ef7609a8f..d1b2c3019 100644 --- a/NetSSL_Win/CMakeLists.txt +++ b/NetSSL_Win/CMakeLists.txt @@ -6,6 +6,12 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(NetSSLWin ${SRCS}) add_library(Poco::NetSSLWin ALIAS NetSSLWin) set_target_properties(NetSSLWin diff --git a/PDF/CMakeLists.txt b/PDF/CMakeLists.txt index ed850fd12..c00117d83 100644 --- a/PDF/CMakeLists.txt +++ b/PDF/CMakeLists.txt @@ -113,6 +113,12 @@ POCO_SOURCES( SRCS libpng src/pngwutil.c ) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + #TODO: Can we put this with the below includes? PRIVAT eg. include_directories( "include/Poco/PDF" ) # zip src diff --git a/Redis/CMakeLists.txt b/Redis/CMakeLists.txt index 3e7bc16ed..03b76ddc5 100644 --- a/Redis/CMakeLists.txt +++ b/Redis/CMakeLists.txt @@ -6,6 +6,12 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(Redis ${SRCS} ) add_library(Poco::Redis ALIAS Redis) set_target_properties(Redis diff --git a/SevenZip/CMakeLists.txt b/SevenZip/CMakeLists.txt index 792ebc6fc..4e9a3d6ee 100644 --- a/SevenZip/CMakeLists.txt +++ b/SevenZip/CMakeLists.txt @@ -47,6 +47,12 @@ POCO_SOURCES( SRCS 7z # src/XzIn.c ) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(SevenZip ${SRCS} ) add_library(Poco::SevenZip ALIAS SevenZip) set_target_properties(SevenZip diff --git a/Util/CMakeLists.txt b/Util/CMakeLists.txt index a412a6be5..9f818f4cf 100644 --- a/Util/CMakeLists.txt +++ b/Util/CMakeLists.txt @@ -6,6 +6,12 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + POCO_SOURCES_AUTO_PLAT( SRCS WIN32 src/WinRegistryConfiguration.cpp src/WinRegistryKey.cpp diff --git a/XML/CMakeLists.txt b/XML/CMakeLists.txt index a34c4fc63..01569c12a 100644 --- a/XML/CMakeLists.txt +++ b/XML/CMakeLists.txt @@ -11,6 +11,12 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + # If POCO_UNBUNDLED is enabled we try to find the required packages # The configuration will fail if the packages are not found if (POCO_UNBUNDLED) diff --git a/Zip/CMakeLists.txt b/Zip/CMakeLists.txt index b2739fd0d..64d3b12ba 100644 --- a/Zip/CMakeLists.txt +++ b/Zip/CMakeLists.txt @@ -6,6 +6,12 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h" ) POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +# Version Resource +if(MSVC AND NOT POCO_STATIC) + source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) +endif() + add_library(Zip ${SRCS} ) add_library(Poco::Zip ALIAS Zip) set_target_properties( Zip