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

Commit 2aa4a64

Browse files
chris0x44BillyONeal
authored andcommitted
Enable precompiled headers for test/functional (microsoft#891)
1 parent 81eb4cf commit 2aa4a64

File tree

6 files changed

+78
-0
lines changed

6 files changed

+78
-0
lines changed

Release/tests/functional/http/client/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@ else()
3232
target_link_libraries(httpclient_test PRIVATE httptest_utilities)
3333
endif()
3434

35+
if(MSVC)
36+
get_target_property(_srcs httpclient_test SOURCES)
37+
38+
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
39+
set_property(SOURCE stdafx.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
40+
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
41+
endif()
42+
43+
set_source_files_properties(stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
44+
target_sources(httpclient_test PRIVATE stdafx.cpp)
45+
target_compile_options(httpclient_test PRIVATE /Yustdafx.h /Zm200)
46+
endif()
47+
3548
if(NOT WIN32)
3649
cpprest_find_boost()
3750
target_link_libraries(httpclient_test PRIVATE cpprestsdk_boost_internal)

Release/tests/functional/json/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,16 @@ if(UNIX AND NOT APPLE)
1616
cpprest_find_boost()
1717
target_link_libraries(json_test PRIVATE cpprestsdk_boost_internal)
1818
endif()
19+
20+
if(MSVC)
21+
get_target_property(_srcs json_test SOURCES)
22+
23+
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
24+
set_property(SOURCE stdafx.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
25+
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
26+
endif()
27+
28+
set_source_files_properties(stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
29+
target_sources(json_test PRIVATE stdafx.cpp)
30+
target_compile_options(json_test PRIVATE /Yustdafx.h /Zm200)
31+
endif()

Release/tests/functional/pplx/pplx_test/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,16 @@ set(SOURCES
66
)
77

88
add_casablanca_test(pplx_test SOURCES)
9+
10+
if(MSVC)
11+
get_target_property(_srcs pplx_test SOURCES)
12+
13+
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
14+
set_property(SOURCE stdafx.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
15+
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
16+
endif()
17+
18+
set_source_files_properties(stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
19+
target_sources(pplx_test PRIVATE stdafx.cpp)
20+
target_compile_options(pplx_test PRIVATE /Yustdafx.h /Zm200)
21+
endif()

Release/tests/functional/streams/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,16 @@ if(NOT WIN32 OR CPPREST_WEBSOCKETS_IMPL STREQUAL "wspp")
2424
target_include_directories(streams_test PRIVATE $<TARGET_PROPERTY:cpprestsdk_boost_internal,INTERFACE_INCLUDE_DIRECTORIES>)
2525
endif()
2626
endif()
27+
28+
if(MSVC)
29+
get_target_property(_srcs streams_test SOURCES)
30+
31+
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
32+
set_property(SOURCE stdafx.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
33+
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
34+
endif()
35+
36+
set_source_files_properties(stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
37+
target_sources(streams_test PRIVATE stdafx.cpp)
38+
target_compile_options(streams_test PRIVATE /Yustdafx.h /Zm200)
39+
endif()

Release/tests/functional/uri/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,16 @@ set(SOURCES
1212
)
1313

1414
add_casablanca_test(uri_test SOURCES)
15+
16+
if(MSVC)
17+
get_target_property(_srcs uri_test SOURCES)
18+
19+
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
20+
set_property(SOURCE stdafx.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
21+
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
22+
endif()
23+
24+
set_source_files_properties(stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
25+
target_sources(uri_test PRIVATE stdafx.cpp)
26+
target_compile_options(uri_test PRIVATE /Yustdafx.h /Zm200)
27+
endif()

Release/tests/functional/utils/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,16 @@ add_casablanca_test(utils_test SOURCES)
1313
if(CMAKE_COMPILER_IS_GNUCXX)
1414
target_compile_options(utils_test PRIVATE "-Wno-deprecated-declarations")
1515
endif()
16+
17+
if(MSVC)
18+
get_target_property(_srcs utils_test SOURCES)
19+
20+
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
21+
set_property(SOURCE stdafx.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
22+
set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
23+
endif()
24+
25+
set_source_files_properties(stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
26+
target_sources(utils_test PRIVATE stdafx.cpp)
27+
target_compile_options(utils_test PRIVATE /Yustdafx.h /Zm200)
28+
endif()

0 commit comments

Comments
 (0)