forked from learning-process/parallel_programming_course
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibenvpp.cmake
More file actions
57 lines (52 loc) · 2.2 KB
/
libenvpp.cmake
File metadata and controls
57 lines (52 loc) · 2.2 KB
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
include_guard()
include(ExternalProject)
ExternalProject_Add(
ppc_libenvpp
SOURCE_DIR "${CMAKE_SOURCE_DIR}/3rdparty/libenvpp"
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/ppc_libenvpp"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/ppc_libenvpp/build"
INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/ppc_libenvpp/install"
CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}
-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
-DCMAKE_CXX_STANDARD_REQUIRED=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
${PPC_EXTERNAL_PROJECT_CMAKE_ARGS}
-DLIBENVPP_TESTS=OFF
-DLIBENVPP_EXAMPLES=OFF
BUILD_COMMAND
"${CMAKE_COMMAND}" --build "${CMAKE_CURRENT_BINARY_DIR}/ppc_libenvpp/build"
--config $<CONFIG> --parallel
INSTALL_COMMAND
"${CMAKE_COMMAND}" --install
"${CMAKE_CURRENT_BINARY_DIR}/ppc_libenvpp/build" --config $<CONFIG>
--prefix "${CMAKE_CURRENT_BINARY_DIR}/ppc_libenvpp/install"
${PPC_EXTERNAL_PROJECT_LOG_ARGS})
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower)
if(cmake_build_type_lower STREQUAL "debug")
set(PPC_FMT_LIB_NAME fmtd)
else()
set(PPC_FMT_LIB_NAME fmt)
endif()
if(WIN32)
set(PPC_ENVPP_LIB_NAME libenvpp)
else()
set(PPC_ENVPP_LIB_NAME envpp)
endif()
function(ppc_link_envpp exec_func_lib)
# Add external project include directories
target_include_directories(
${exec_func_lib} PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/libenvpp/include)
target_include_directories(
${exec_func_lib} SYSTEM
PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/libenvpp/external/fmt/include)
add_dependencies(${exec_func_lib} ppc_libenvpp)
target_link_directories(${exec_func_lib} PUBLIC
"${CMAKE_BINARY_DIR}/ppc_libenvpp/install/lib")
target_link_directories(${exec_func_lib} PUBLIC
"${CMAKE_BINARY_DIR}/ppc_libenvpp/build")
target_link_libraries(${exec_func_lib} PUBLIC ${PPC_ENVPP_LIB_NAME})
target_link_libraries(${exec_func_lib} PUBLIC $<$<CONFIG:Debug>:fmtd>
$<$<NOT:$<CONFIG:Debug>>:fmt>)
endfunction()