2017-11-25 15:53:32 -08:00
|
|
|
cmake_minimum_required(VERSION 3.3)
|
2018-03-13 05:21:17 -07:00
|
|
|
project(vcpkg C CXX)
|
2017-11-25 15:53:32 -08:00
|
|
|
|
2017-12-14 14:31:16 -08:00
|
|
|
if(CMAKE_COMPILER_IS_GNUXX OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
2017-11-28 13:06:56 -08:00
|
|
|
set(GCC 1)
|
2018-03-29 15:29:16 -07:00
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
|
2018-03-30 14:46:22 -07:00
|
|
|
if(NOT VCPKG_ALLOW_APPLE_CLANG)
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"Building the vcpkg tool requires support for the C++ Filesystem TS.
|
|
|
|
Apple clang versions 9 and below do not have support for it.
|
|
|
|
Please install gcc6 or newer from homebrew (brew install gcc6).
|
|
|
|
If you would like to try anyway, set VCPKG_ALLOW_APPLE_CLANG.")
|
2018-03-29 15:29:16 -07:00
|
|
|
else()
|
|
|
|
set(CLANG 1)
|
|
|
|
endif()
|
2017-11-28 13:06:56 -08:00
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang")
|
|
|
|
set(CLANG 1)
|
2018-03-02 22:16:49 +03:00
|
|
|
elseif(MSVC)
|
|
|
|
add_compile_options(/std:c++latest)
|
2017-12-14 14:31:16 -08:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
|
2017-11-28 13:06:56 -08:00
|
|
|
endif()
|
|
|
|
|
2018-03-02 22:16:49 +03:00
|
|
|
if(GCC OR CLANG)
|
|
|
|
add_compile_options(-std=c++1z)
|
|
|
|
endif()
|
|
|
|
|
2017-11-25 15:53:32 -08:00
|
|
|
file(GLOB_RECURSE VCPKGLIB_SOURCES src/vcpkg/*.cpp)
|
|
|
|
|
2018-02-19 12:20:16 -08:00
|
|
|
add_executable(vcpkg src/vcpkg.cpp ${VCPKGLIB_SOURCES})
|
|
|
|
target_compile_definitions(vcpkg PRIVATE -DDISABLE_METRICS=0)
|
2018-03-13 05:21:17 -07:00
|
|
|
target_include_directories(vcpkg PRIVATE include)
|
2017-11-28 10:50:33 -08:00
|
|
|
|
2017-11-28 13:06:56 -08:00
|
|
|
if(GCC)
|
2018-03-13 05:21:17 -07:00
|
|
|
target_link_libraries(vcpkg PRIVATE stdc++fs)
|
2017-11-28 13:06:56 -08:00
|
|
|
elseif(CLANG)
|
2018-03-13 05:21:17 -07:00
|
|
|
target_link_libraries(vcpkg PRIVATE c++experimental)
|
2017-11-28 10:50:33 -08:00
|
|
|
endif()
|
2018-03-13 05:21:17 -07:00
|
|
|
|
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
target_link_libraries(vcpkg PRIVATE Threads::Threads)
|