-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
46 lines (34 loc) · 1.5 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
cmake_minimum_required(VERSION 3.0)
project(VMBusPipe C CXX)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(CMakePackageConfigHelpers)
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" VERSION_STRINGS)
list(GET VERSION_STRINGS 0 VERSION_STRING)
string(REGEX REPLACE "([0-9]+).[0-9]+.[0-9]+" "\\1" VMBUSPIPE_VERSION_MAJOR ${VERSION_STRING})
string(REGEX REPLACE "[0-9]+.([0-9]+).[0-9]+" "\\1" VMBUSPIPE_VERSION_MINOR ${VERSION_STRING})
string(REGEX REPLACE "[0-9]+.[0-9]+.([0-9]+)" "\\1" VMBUSPIPE_VERSION_PATCH ${VERSION_STRING})
set(VMBUSPIPE_VERSION "${VMBUSPIPE_VERSION_MAJOR}.${VMBUSPIPE_VERSION_MINOR}.${VMBUSPIPE_VERSION_PATCH}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(MSVC)
include(MSVCRuntime)
if(NOT DEFINED MSVC_RUNTIME)
set(MSVC_RUNTIME "static")
endif()
configure_msvc_runtime()
endif()
if(WIN32)
set(C_FLAGS "")
set(C_FLAGS "${C_FLAGS} -D_UNICODE")
set(C_FLAGS "${C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
set(C_FLAGS "${C_FLAGS} -DWIN32_LEAN_AND_MEAN")
set(C_FLAGS "${C_FLAGS} -D_WINSOCK_DEPRECATED_NO_WARNINGS")
set(C_FLAGS "${C_FLAGS} -DWINVER=0x0602 -D_WIN32_WINNT=0x0602")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${C_FLAGS}")
endif()
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/VmBusPipe")
add_subdirectory(VmBusPipe)
add_subdirectory(VmBusPipeStub)
add_subdirectory(VmBusPipeTest)