forked from openucx/xucg
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathCMakeLists.txt
58 lines (49 loc) · 1.62 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
#
# Copyright (c) Huawei Technologies Co., Ltd. 2022-2024. All rights reserved.
#
cmake_minimum_required(VERSION 2.8.12)
if(POLICY CMP0048)
set(SUPPORT_CMAKE3 "ON")
else()
set(SUPPORT_CMAKE3 "OFF")
endif()
if(SUPPORT_CMAKE3 MATCHES "ON")
cmake_policy(SET CMP0048 NEW)
project(xucg VERSION 2.4.0)
else()
project(xucg C CXX)
set(PROJECT_VERSION_MAJOR 2)
set(PROJECT_VERSION_MINOR 4)
set(PROJECT_VERSION_PATCH 0)
endif()
# Define options
option(UCG_BUILD_TOOLS "Build ucg tools" ON)
option(UCG_BUILD_TESTS "Build ucg tests" ON)
# Set base include search path.
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
if (IS_DIRECTORY ${UCG_BUILD_WITH_UCX})
# Currently the util & tests header file includes some UCS header file,
# so the path of the UCS header file is needed.
include_directories(${UCG_BUILD_WITH_UCX}/include)
endif()
if (IS_DIRECTORY ${UCG_BUILD_WITH_HCCL})
# Currently the tests header file includes some HCCL header file,
# so the path of the HCCL header file is needed.
include_directories(${UCG_BUILD_WITH_HCCL}/include)
endif()
# Set installation directories
set(UCG_INSTALL_BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
set(UCG_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include)
set(UCG_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
set(UCG_INSTALL_PLANCDIR ${CMAKE_INSTALL_PREFIX}/lib/planc)
# Make all warnings into errors
add_compile_options(-Wall -Werror)
# Other targets depend on target under src.
add_subdirectory(src)
if (UCG_BUILD_TOOLS MATCHES "ON")
add_subdirectory(tools)
endif ()
if (UCG_BUILD_TESTS MATCHES "ON")
enable_testing()
add_subdirectory(tests)
endif ()