Skip to content

Commit

Permalink
Fix issue CMake building for UWP
Browse files Browse the repository at this point in the history
  • Loading branch information
ras0219-msft committed Oct 21, 2017
1 parent 71332b5 commit 28919d0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Release/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ elseif(UNIX AND NOT APPLE) # Note: also android
set(CPPREST_HTTP_CLIENT_IMPL asio CACHE STRING "Internal use.")
set(CPPREST_HTTP_LISTENER_IMPL asio CACHE STRING "Internal use.")
elseif(WINDOWS_PHONE OR WINDOWS_STORE)
set(CPPREST_PPLX_IMPL win CACHE STRING "Internal use.")
set(CPPREST_PPLX_IMPL winrt CACHE STRING "Internal use.")
set(CPPREST_WEBSOCKETS_IMPL winrt CACHE STRING "Internal use.")
set(CPPREST_FILEIO_IMPL winrt CACHE STRING "Internal use.")
set(CPPREST_HTTP_CLIENT_IMPL winrt CACHE STRING "Internal use.")
Expand Down Expand Up @@ -115,7 +115,12 @@ elseif(ANDROID)
)
elseif(UNIX) # This includes OSX
elseif(WIN32)
add_definitions(-DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0600 -DWIN32 -D_SCL_SECURE_NO_WARNINGS)
add_definitions(-DUNICODE -D_UNICODE -DWIN32 -D_SCL_SECURE_NO_WARNINGS)
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
add_definitions(-D_WIN32_WINNT=0x0A00)
else()
add_definitions(-D_WIN32_WINNT=0x0600)
endif()

if(NOT BUILD_SHARED_LIBS)
# This causes cmake to not link the test libraries separately, but instead hold onto their object files.
Expand Down
6 changes: 6 additions & 0 deletions Release/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ elseif(CPPREST_PPLX_IMPL STREQUAL "winpplx")
pplx/threadpool.cpp
pplx/pplxwin.cpp
)
elseif(CPPREST_PPLX_IMPL STREQUAL "winrt")
list(APPEND SOURCES
pplx/pplxwin.cpp
)
list(FILTER HEADERS_PPLX EXCLUDE REGEX "threadpool\\.h")
endif()

# Http client component
Expand Down Expand Up @@ -186,6 +191,7 @@ if(CPPREST_PPLX_IMPL STREQUAL "apple")
target_link_libraries(cpprest PRIVATE ${COREFOUNDATION} ${SECURITY})
elseif(CPPREST_PPLX_IMPL STREQUAL "linux")
elseif(CPPREST_PPLX_IMPL STREQUAL "win")
elseif(CPPREST_PPLX_IMPL STREQUAL "winrt")
elseif(CPPREST_PPLX_IMPL STREQUAL "winpplx")
target_compile_definitions(cpprest PUBLIC -DCPPREST_FORCE_PPLX=1)
else()
Expand Down

0 comments on commit 28919d0

Please sign in to comment.