Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build with cmake under windows. #305

Merged
merged 1 commit into from
Dec 4, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -244,30 +244,31 @@ else()
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
set(Boost_USE_MULTITHREADED ON)

set(Boost_USE_STATIC_RUNTIME ON)
endif()
set(Boost_USE_STATIC_LIBS ON)
add_library(torrent-rasterbar STATIC ${sources2})
endif()

# Boost
if(NOT DEFINED Boost_INCLUDE_DIR OR NOT DEFINED Boost_LIBRARIES)
FIND_PACKAGE(Boost REQUIRED COMPONENTS system chrono random)
endif()
include_directories(${Boost_INCLUDE_DIR})
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(torrent-rasterbar ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})

# this works around a bug in asio in boost-1.39
#add_definitions(-DBOOST_ASIO_HASH_MAP_BUCKETS=1021 -D__USE_W32_SOCKETS -DWIN32_LEAN_AND_MEAN )

if(NOT static_runtime)
add_definitions(-DBOOST_SYSTEM_DYN_LINK -DBOOST_CHRONO_DYN_LINK -DBOOST_RANDOM_DYN_LINK)
endif()

if (WIN32)
target_link_libraries(torrent-rasterbar wsock32 ws2_32)
target_link_libraries(torrent-rasterbar wsock32 ws2_32 Iphlpapi)
add_definitions(-D_WIN32_WINNT=0x0600)
# prevent winsock1 to be included
add_definitions(-DWIN32_LEAN_AND_MEAN)
if (MSVC)
add_definitions(-DBOOST_ALL_NO_LIB)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") # multicore compilation
endif()
endif()
Expand Down