0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-27 15:41:05 +08:00

Problem: CMakelist missing support for Windows Precompiled headers

Solution: Add precompiled flags to CMakeList.txt for faster compiles
+ bonus - removed compilation warning on Windows by adding
	 add_definitions (-D_WINSOCK_DEPRECATED_NO_WARNINGS)
This commit is contained in:
Osiris 2016-03-06 06:23:26 -06:00
parent 2cd4c38b80
commit cd1dfb4092
2 changed files with 24 additions and 2 deletions

View File

@ -382,6 +382,7 @@ if (WIN32)
# Socket limit is 16K (can be raised arbitrarily) # Socket limit is 16K (can be raised arbitrarily)
add_definitions (-DFD_SETSIZE=16384) add_definitions (-DFD_SETSIZE=16384)
add_definitions (-D_CRT_SECURE_NO_WARNINGS) add_definitions (-D_CRT_SECURE_NO_WARNINGS)
add_definitions (-D_WINSOCK_DEPRECATED_NO_WARNINGS)
endif () endif ()
if (MSVC) if (MSVC)
@ -622,6 +623,26 @@ if (ZMQ_BUILD_FRAMEWORK)
COMMENT "Perf tools") COMMENT "Perf tools")
endif () endif ()
if (MSVC)
# default for all sources is to use precompiled headers
foreach(source ${sources})
set_source_files_properties(${source}
PROPERTIES
COMPILE_FLAGS "/Yuprecompiled.hpp"
)
endforeach()
# create precompiled header
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/precompiled.cpp
PROPERTIES
COMPILE_FLAGS "/Ycprecompiled.hpp"
)
# C and C++ can not use the same precompiled header
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/tweetnacl.c
PROPERTIES
COMPILE_FLAGS "/Y-"
)
endif ()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# output # output

View File

@ -112,6 +112,7 @@ endif()
# add location of platform.hpp for Windows builds # add location of platform.hpp for Windows builds
if(WIN32) if(WIN32)
add_definitions(-DZMQ_CUSTOM_PLATFORM_HPP) add_definitions(-DZMQ_CUSTOM_PLATFORM_HPP)
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
include_directories(../builds/msvc) include_directories(../builds/msvc)
link_libraries(Ws2_32.lib) link_libraries(Ws2_32.lib)
endif() endif()