Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
Enable precompiled headers for test/functional (microsoft#891)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris0x44 authored and BillyONeal committed Oct 9, 2018
1 parent 81eb4cf commit 2aa4a64
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Release/tests/functional/http/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ else()
target_link_libraries(httpclient_test PRIVATE httptest_utilities)
endif()

if(MSVC)
get_target_property(_srcs httpclient_test SOURCES)

if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
set_property(SOURCE stdafx.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
endif()

set_source_files_properties(stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
target_sources(httpclient_test PRIVATE stdafx.cpp)
target_compile_options(httpclient_test PRIVATE /Yustdafx.h /Zm200)
endif()

if(NOT WIN32)
cpprest_find_boost()
target_link_libraries(httpclient_test PRIVATE cpprestsdk_boost_internal)
Expand Down
13 changes: 13 additions & 0 deletions Release/tests/functional/json/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,16 @@ if(UNIX AND NOT APPLE)
cpprest_find_boost()
target_link_libraries(json_test PRIVATE cpprestsdk_boost_internal)
endif()

if(MSVC)
get_target_property(_srcs json_test SOURCES)

if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
set_property(SOURCE stdafx.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
endif()

set_source_files_properties(stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
target_sources(json_test PRIVATE stdafx.cpp)
target_compile_options(json_test PRIVATE /Yustdafx.h /Zm200)
endif()
13 changes: 13 additions & 0 deletions Release/tests/functional/pplx/pplx_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,16 @@ set(SOURCES
)

add_casablanca_test(pplx_test SOURCES)

if(MSVC)
get_target_property(_srcs pplx_test SOURCES)

if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
set_property(SOURCE stdafx.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
endif()

set_source_files_properties(stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
target_sources(pplx_test PRIVATE stdafx.cpp)
target_compile_options(pplx_test PRIVATE /Yustdafx.h /Zm200)
endif()
13 changes: 13 additions & 0 deletions Release/tests/functional/streams/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,16 @@ if(NOT WIN32 OR CPPREST_WEBSOCKETS_IMPL STREQUAL "wspp")
target_include_directories(streams_test PRIVATE $<TARGET_PROPERTY:cpprestsdk_boost_internal,INTERFACE_INCLUDE_DIRECTORIES>)
endif()
endif()

if(MSVC)
get_target_property(_srcs streams_test SOURCES)

if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
set_property(SOURCE stdafx.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
endif()

set_source_files_properties(stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
target_sources(streams_test PRIVATE stdafx.cpp)
target_compile_options(streams_test PRIVATE /Yustdafx.h /Zm200)
endif()
13 changes: 13 additions & 0 deletions Release/tests/functional/uri/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,16 @@ set(SOURCES
)

add_casablanca_test(uri_test SOURCES)

if(MSVC)
get_target_property(_srcs uri_test SOURCES)

if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
set_property(SOURCE stdafx.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
endif()

set_source_files_properties(stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
target_sources(uri_test PRIVATE stdafx.cpp)
target_compile_options(uri_test PRIVATE /Yustdafx.h /Zm200)
endif()
13 changes: 13 additions & 0 deletions Release/tests/functional/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,16 @@ add_casablanca_test(utils_test SOURCES)
if(CMAKE_COMPILER_IS_GNUCXX)
target_compile_options(utils_test PRIVATE "-Wno-deprecated-declarations")
endif()

if(MSVC)
get_target_property(_srcs utils_test SOURCES)

if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
set_property(SOURCE stdafx.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
endif()

set_source_files_properties(stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
target_sources(utils_test PRIVATE stdafx.cpp)
target_compile_options(utils_test PRIVATE /Yustdafx.h /Zm200)
endif()

0 comments on commit 2aa4a64

Please sign in to comment.