Improve CMake configuration

Don't search for QtSingleApplication library.
Fix building on Windows with MinGW.
This commit is contained in:
Vladimir Golovnev (Glassez) 2019-07-20 19:43:08 +03:00
commit 38cf1fb3ee
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7
6 changed files with 36 additions and 115 deletions

View file

@ -2,15 +2,22 @@
list(APPEND CMAKE_LIBRARY_PATH "$ENV{LIB}")
# We want to link with static version of
# libtorrent
set(LibtorrentRasterbar_USE_STATIC_LIBS True)
set(LibtorrentRasterbar_CUSTOM_DEFINITIONS
-DBOOST_ASIO_DISABLE_CONNECTEX
-DBOOST_EXCEPTION_DISABLE
-DBOOST_SYSTEM_STATIC_LINK=1
-DTORRENT_USE_OPENSSL
-D__USE_W32_SOCKETS
-D_FILE_OFFSET_BITS=64)
-DTORRENT_DISABLE_RESOLVE_COUNTRIES)
set(LibtorrentRasterbar_CUSTOM_BOOST_DEPENDENCIES system)
# If you want to link with static version of libtorrent
#set(LibtorrentRasterbar_USE_STATIC_LIBS True)
#list(APPEND LibtorrentRasterbar_CUSTOM_DEFINITIONS
# -DBOOST_SYSTEM_STATIC_LINK=1)
# and boost
#set(Boost_USE_STATIC_LIBS True)
#set(Boost_USE_STATIC_RUNTIME True)
add_definitions(-DUNICODE
-D_UNICODE
@ -24,9 +31,16 @@ add_definitions(-DUNICODE
-D_SCL_SECURE_NO_DEPRECATE
-DNOMINMAX
)
# and boost
set(Boost_USE_STATIC_LIBS True)
# set(Boost_USE_STATIC_RUNTIME True)
# Enable if libtorrent was built with this flag defined
#list(APPEND LibtorrentRasterbar_CUSTOM_DEFINITIONS -DTORRENT_NO_DEPRECATE)
if (("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") OR ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo"))
list(APPEND LibtorrentRasterbar_CUSTOM_DEFINITIONS
-DTORRENT_DEBUG)
else ()
add_definitions(-DNDEBUG)
endif ()
# Here we assume that all required libraries are installed into the same prefix
# with usual unix subdirectories (bin, lib, include)
@ -36,17 +50,9 @@ set(COMMON_INSTALL_PREFIX "c:/usr" CACHE PATH "Prefix used to install all the re
list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${COMMON_INSTALL_PREFIX}")
# If two version of Qt are installed, separate prefixes are needed most likely
set(QT4_INSTALL_PREFIX "${COMMON_INSTALL_PREFIX}/lib/qt4" CACHE PATH "Prefix where Qt4 is installed")
set(QT5_INSTALL_PREFIX "${COMMON_INSTALL_PREFIX}/lib/qt5" CACHE PATH "Prefix where Qt5 is installed")
# it is safe to set Qt dirs even if their files are directly in the prefix
# Qt4
if(NOT QT5)
# for qt 4 we need qmake, Qt5 provides cmake config files
LIST(APPEND CMAKE_PROGRAM_PATH "${QT4_INSTALL_PREFIX}/bin/")
endif(NOT QT5)
# Qt5
set(Qt5_DIR "${QT5_INSTALL_PREFIX}/lib/cmake/Qt5")
# And now we can set specific values for the Boost and libtorrent libraries.