-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
82 lines (61 loc) · 3.27 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
cmake_minimum_required(VERSION 3.7.0 FATAL_ERROR)
find_package(IRODS REQUIRED)
set(IRODS_CLI_REVISION "0")
set(IRODS_CLI_VERSION "${IRODS_VERSION}.${IRODS_CLI_REVISION}")
set(CMAKE_C_COMPILER ${IRODS_EXTERNALS_FULLPATH_CLANG}/bin/clang)
set(CMAKE_CXX_COMPILER ${IRODS_EXTERNALS_FULLPATH_CLANG}/bin/clang++)
project(irods_cli
VERSION "${IRODS_CLI_VERSION}"
LANGUAGES CXX)
set(IRODS_CLI_COMMANDS_INSTALL_DIR ${IRODS_PLUGINS_DIRECTORY}/cli)
include(${IRODS_TARGETS_PATH})
include(GNUInstallDirs)
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build {Debug, Release}." FORCE)
message(STATUS "Setting unspecified CMAKE_BUILD_TYPE to '${CMAKE_BUILD_TYPE}'")
endif()
if (NOT IRODS_EXTERNALS_PACKAGE_ROOT)
set(IRODS_EXTERNALS_PACKAGE_ROOT "/opt/irods-externals" CACHE STRING "Choose the location of iRODS external packages." FORCE)
message(STATUS "Setting unspecified IRODS_EXTERNALS_PACKAGE_ROOT to '${IRODS_EXTERNALS_PACKAGE_ROOT}'")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_RPATH ${IRODS_EXTERNALS_FULLPATH_CLANG_RUNTIME}/lib)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_MODULE_LINKER_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -stdlib=libc++ -Wl,--export-dynamic -pthread")
# Make ALL symbols in shared libraries hidden by default.
# TODO Verify this behavior.
set_property(GLOBAL PROPERTY CMAKE_CXX_VISIBILITY_PRESET hidden)
set(APP irods)
add_executable(${APP} ${CMAKE_SOURCE_DIR}/src/main.cpp)
set_target_properties(${APP} PROPERTIES CXX_STANDARD ${IRODS_CXX_STANDARD})
target_compile_options(${APP} PRIVATE -Wno-write-strings -nostdinc++)
target_compile_definitions(${APP} PRIVATE IRODS_CLI_VERSION="${IRODS_CLI_VERSION}" ${IRODS_COMPILE_DEFINITIONS})
target_include_directories(${APP} PRIVATE ${CMAKE_SOURCE_DIR}/include
${IRODS_INCLUDE_DIRS}
${IRODS_EXTERNALS_FULLPATH_BOOST}/include
${IRODS_EXTERNALS_FULLPATH_CLANG}/include/c++/v1
${IRODS_EXTERNALS_FULLPATH_FMT}/include)
target_link_libraries(${APP} PRIVATE irods_common
irods_plugin_dependencies
irods_client
${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_filesystem.so
${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_system.so
${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_program_options.so
${IRODS_EXTERNALS_FULLPATH_FMT}/lib/libfmt.so
dl)
# CLI Commands
add_subdirectory(commands/cp)
add_subdirectory(commands/get)
add_subdirectory(commands/ls)
add_subdirectory(commands/put)
add_subdirectory(commands/repl)
add_subdirectory(commands/rm)
add_subdirectory(commands/touch)
# Installation
install(TARGETS ${APP}
DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)