CMakeLists.txt 1.95 KB
Newer Older
1
set(SRC_FILES src/MuonNexusReader.cpp src/NexusClasses.cpp src/NexusFileIO.cpp)
2
3
4
5
6

set(INC_FILES
    inc/MantidNexus/MuonNexusReader.h
    inc/MantidNexus/NexusClasses.h
    inc/MantidNexus/NexusFileIO.h
7
    inc/MantidNexus/NexusIOHelper.h)
8

9
set(TEST_FILES NexusIOHelperTest.h)
10

11
if(COVERAGE)
12
13
14
15
  foreach(loop_var ${SRC_FILES} ${INC_FILES})
    set_property(GLOBAL APPEND
                 PROPERTY COVERAGE_SRCS
                          "${CMAKE_CURRENT_SOURCE_DIR}/${loop_var}")
16
  endforeach(loop_var)
17
18
endif()

19
add_definitions(-DIN_NEXUS_CPP_LIBRARY)
20

21
# Add the target for this directory
22
add_library(Nexus ${SRC_FILES} ${INC_FILES})
23
24
25
26
27
28
add_library(Mantid::Nexus ALIAS Nexus)

target_include_directories(Nexus PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
		$<INSTALL_INTERFACE:include/Mantid>
)
29
# Set the name of the generated library
30
31
32
33
34
35
set_target_properties(Nexus
                      PROPERTIES OUTPUT_NAME
                                 MantidNexus
                                 COMPILE_DEFINITIONS
                                 IN_MANTID_NEXUS)

36
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
37
  set_target_properties(Nexus PROPERTIES INSTALL_RPATH "@loader_path/../MacOS;@loader_path/../Frameworks")
38
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
39
  set_target_properties(Nexus PROPERTIES INSTALL_RPATH "\$ORIGIN/../${LIB_DIR}")
40
endif()
41

42
# Add to the 'Framework' group in VS
43
set_property(TARGET Nexus PROPERTY FOLDER "MantidFramework")
44

Stephen's avatar
Stephen committed
45
target_link_libraries(Nexus PUBLIC Mantid::API Mantid::DataObjects Mantid::Kernel Nexus::nexus Nexus::nexuscpp)
46

47
# Add the unit tests directory
48
add_subdirectory(test)
49

50
# Installation settings
Stephen's avatar
Stephen committed
51
52
53
54
55
56
57
58
59
# Installation settings
set(TARGET_EXPORT_NAME "MantidNexusTargets")
mtd_install_dylib(TARGETS Nexus EXPORT_NAME ${TARGET_EXPORT_NAME} INSTALL_DIRS ${LIB_DIR} ${WORKBENCH_LIB_DIR})

install(EXPORT ${TARGET_EXPORT_NAME}
        FILE ${TARGET_EXPORT_NAME}.cmake
        NAMESPACE Mantid::
        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MantidFramework
)