Skip to content
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
15 changes: 12 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
#
# It most probably doesn't work with MSVC.

cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.16)

project(cppwinrt LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set(CPPWINRT_BUILD_VERSION "2.3.4.5" CACHE STRING "The version string used for cppwinrt.")
add_compile_definitions(CPPWINRT_VERSION_STRING="${CPPWINRT_BUILD_VERSION}")
if(CPPWINRT_BUILD_VERSION STREQUAL "2.3.4.5" OR CPPWINRT_BUILD_VERSION STREQUAL "0.0.0.0")
message(WARNING "CPPWINRT_BUILD_VERSION has been set to a dummy version string. Do not use in production!")
endif()
message(STATUS "Using version string: ${CPPWINRT_BUILD_VERSION}")

# WinMD uses CreateFile2 which requires Windows 8.
add_compile_definitions(_WIN32_WINNT=0x0602)
Expand All @@ -24,6 +27,7 @@ set(PREBUILD_SRCS
prebuild/pch.h
)
add_executable(prebuild ${PREBUILD_SRCS})
target_compile_definitions(prebuild PRIVATE CPPWINRT_VERSION_STRING="${CPPWINRT_BUILD_VERSION}")
target_include_directories(prebuild PRIVATE cppwinrt/)


Expand Down Expand Up @@ -90,9 +94,12 @@ set(CPPWINRT_RESOURCES
)

add_executable(cppwinrt ${CPPWINRT_SRCS} ${CPPWINRT_RESOURCES} ${CPPWINRT_HEADERS})
target_compile_definitions(cppwinrt PRIVATE CPPWINRT_VERSION_STRING="${CPPWINRT_BUILD_VERSION}")
target_include_directories(cppwinrt PRIVATE ${PROJECT_BINARY_DIR})
target_link_libraries(cppwinrt shlwapi)

install(TARGETS cppwinrt)


# HACK: Handle the xmllite import lib.
# mingw-w64 before commit 5ac1a2c is missing the import lib for xmllite. This
Expand Down Expand Up @@ -164,4 +171,6 @@ target_include_directories(cppwinrt PRIVATE "${winmd_SOURCE_DIR}")


include(CTest)
add_subdirectory(test)
if(BUILD_TESTING)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm it still includes testing by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the option is created by the CTest module and is ON by default: https://cmake.org/cmake/help/latest/module/CTest.html

add_subdirectory(test)
endif()