This repository has been archived by the owner on Feb 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (51 loc) · 2.08 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
cmake_minimum_required (VERSION 2.6)
project(XrdOssCsi)
macro( define_default variable value )
if( NOT DEFINED ${variable} )
set( ${variable} ${value} )
endif()
endmacro()
#-------------------------------------------------------------------------------
# Define the default build parameters
#-------------------------------------------------------------------------------
if( "${CMAKE_BUILD_TYPE}" STREQUAL "" )
if(BUILD_TEST)
set( CMAKE_BUILD_TYPE Debug )
else()
set( CMAKE_BUILD_TYPE RelWithDebInfo )
endif()
endif()
define_default( PLUGIN_VERSION 5 )
add_definitions( -DXRDPLUGIN_SOVERSION="${PLUGIN_VERSION}" )
include(GNUInstallDirs)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${PROJECT_SOURCE_DIR}/src)
if(BUILD_TEST)
ENABLE_TESTING()
set(GCC_COVERAGE_COMPILE_FLAGS "-g -O0 --coverage -fprofile-arcs -ftest-coverage -std=c++0x")
set(GCC_COVERAGE_LINK_FLAGS "--coverage -lgcov")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}" )
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}" )
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
add_custom_target(gcov
COMMAND ${CMAKE_MAKE_PROGRAM} test_page
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
add_custom_command(TARGET gcov
COMMAND rm -f ${CMAKE_BINARY_DIR}/src/CMakeFiles/XrdOssCsi-5.dir/XrdOssCsi/*.gcda
COMMAND LD_LIBRARY_PATH=./src ./tests/test_page
COMMAND gcov ${CMAKE_SOURCE_DIR}/src/XrdOssCsi/XrdOssCsi*.cc -o ${CMAKE_BINARY_DIR}/src/CMakeFiles/XrdOssCsi-5.dir/XrdOssCsi
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
add_dependencies(gcov test_page XrdOssCsi-5)
else()
set(CMAKE_CXX_FLAGS "-O2 -fPIC -Wall -Wextra -Wshadow -Wno-unused-parameter -Wno-long-long -Wnon-virtual-dtor -std=c++0x -g")
endif()
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
# include the directory itself as a path to include directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(XRootD REQUIRED)
link_directories(${XROOTD_LIB_DIR})
add_subdirectory(src)
if(BUILD_TEST)
add_subdirectory(tests)
endif()