-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (49 loc) · 1.78 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
cmake_minimum_required(VERSION 3.13.1)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE)
message(STATUS "CMAKE_BUILD_TYPE not set, defaulting to Release.")
endif()
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake")
if(NOT BUILD_NUMBER)
set(BUILD_NUMBER 0)
endif()
set(PIPC_VERSION 1.0.${BUILD_NUMBER})
set(PACKAGE_NAME pip2cmake)
project(${PACKAGE_NAME} VERSION "${PIPC_VERSION}" LANGUAGES CXX C)
message(STATUS "Generator .............. ${CMAKE_GENERATOR}")
message(STATUS "Build Type ............. ${CMAKE_BUILD_TYPE}")
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/usr)
include(ExternalProject)
ExternalProject_Add(pugixml
GIT_REPOSITORY https://github.com/zeux/pugixml.git
GIT_TAG v1.10
GIT_SHALLOW 1
BUILD_IN_SOURCE 0
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE=MinSizeRel
-DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE}
)
if(WIN32)
ExternalProject_Add(dirent
GIT_REPOSITORY https://github.com/tronkko/dirent.git
GIT_TAG 1.23.2
GIT_SHALLOW 1
BUILD_IN_SOURCE 0
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE=MinSizeRel
-DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE}
)
endif()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include_directories(${CMAKE_INSTALL_PREFIX}/include)
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
add_executable(pip2cmake main.cpp pip.cpp module.cpp utilities.cpp)
add_dependencies(pip2cmake pugixml)
if(UNIX)
target_link_libraries(pip2cmake -lpugixml)
elseif(MSVC)
target_link_libraries(pip2cmake pugixml.lib)
endif()