CMakeLists.txt fix

This commit is contained in:
Arvid Norberg 2012-06-16 23:19:36 +00:00
parent 1b2805118d
commit 9e8488048e
1 changed files with 24 additions and 10 deletions

View File

@ -147,8 +147,10 @@ else (dht)
add_definitions(-DTORRENT_DISABLE_DHT)
endif (dht)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fvisibility-inlines-hidden")
if(NOT MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fvisibility-inlines-hidden")
endif()
if (shared)
add_library(torrent-rasterbar SHARED ${sources2})
@ -157,7 +159,11 @@ else (shared)
endif (shared)
if (NOT Boost_VERSION LESS 103500)
FIND_PACKAGE( Boost 1.35 COMPONENTS system)
if(NOT MSVC)
FIND_PACKAGE( Boost 1.35 COMPONENTS system)
else(NOT MSVC)
FIND_PACKAGE( Boost 1.35 COMPONENTS system thread date_time)
endif(NOT MSVC)
endif (NOT Boost_VERSION LESS 103500)
include_directories(${Boost_INCLUDE_DIR})
target_link_libraries(torrent-rasterbar ${Boost_LIBRARIES})
@ -165,17 +171,17 @@ target_link_libraries(torrent-rasterbar ${Boost_LIBRARIES})
# this works around a bug in asio in boost-1.39
add_definitions(-DBOOST_ASIO_HASH_MAP_BUCKETS=1021 -DBOOST_ASIO_DYN_LINK -D__USE_W32_SOCKETS -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0500)
add_definitions(-DBOOST_DATE_TIME_DYN_LINK -DBOOST_THREAD_DYN_LINK -DBOOST_SYSTEM_DYN_LINK)
if (WIN32)
target_link_libraries(torrent-rasterbar wsock32 ws2_32)
endif (WIN32)
if (encryption)
FIND_PACKAGE(OpenSSL REQUIRED)
add_definitions(-DTORRENT_USE_OPENSSL)
if (WIN32)
target_link_libraries(torrent-rasterbar ssleay32 libeay32 advapi32 user32 shell32 gdi32)
else (WIN32)
target_link_libraries(torrent-rasterbar crypto ssl)
endif (WIN32)
include_directories(${OPENSSL_INCLUDE_DIR})
target_link_libraries(torrent-rasterbar ${OPENSSL_LIBRARIES})
else (encryption)
add_definitions(-DTORRENT_DISABLE_ENCRYPTION)
list(APPEND sources sha1)
@ -202,7 +208,11 @@ if (NOT deprecated-functions)
endif (NOT deprecated-functions)
if (exceptions)
add_definitions(-fexceptions)
if (MSVC)
add_definitions(/EHsc)
else (MSVC)
add_definitions(-fexceptions)
endif (MSVC)
else (exceptions)
add_definitions(-fno-exceptions)
endif (exceptions)
@ -212,6 +222,8 @@ if (MSVC)
add_definitions(-D_SCL_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE)
# these compiler settings just makes the compiler standard conforming
add_definitions(/Zc:wchar_t /Zc:forScope)
# for multi-core compilation
add_definitions(/MP)
# <toolset>msvc,<variant>release:<linkflags>/OPT:ICF=5
# <toolset>msvc,<variant>release:<linkflags>/OPT:REF
@ -241,7 +253,9 @@ foreach (s ${COMPILETIME_OPTIONS_LIST})
set (COMPILETIME_OPTIONS "${COMPILETIME_OPTIONS} -D${s}")
endforeach (s)
configure_file(libtorrent-rasterbar-cmake.pc.in libtorrent-rasterbar.pc)
if (MSVC)
configure_file(libtorrent-rasterbar-cmake.pc.in libtorrent-rasterbar.pc)
endif (MSVC)
string (COMPARE EQUAL "${CMAKE_SIZEOF_VOID_P}" "8" IS64BITS)