##// END OF EJS Templates
Add Catalogue API dependency
perrinel -
r1058:bf5c5de37807
parent child
Show More
@@ -0,0 +1,29
1 # - Try to find CatalogueAPI Module
2 # Once done this will define
3 # CATALOGUEAPI_FOUND - System has CatalogueAPI
4 # CATALOGUEAPI_INCLUDE_DIRS - The CatalogueAPI include directories
5 # CATALOGUEAPI_LIBRARIES - The libraries needed to use CatalogueAPI
6 # CATALOGUEAPI_SHARED_LIBRARIES - The shared libraries for CatalogueAPI
7
8 set(CATALOGUEAPI_ROOT_DIR "${CATALOGUEAPI_EXTERN_FOLDER}"
9 CACHE PATHS
10 "Path to the installation of CatalogueAPI"
11 ${libRootDirForceValue})
12
13 find_path(CATALOGUEAPI_INCLUDE_DIR CatalogueDao.h
14 HINTS ${CATALOGUEAPI_ROOT_DIR} ${CATALOGUEAPI_EXTERN_FOLDER}
15 PATH_SUFFIXES src )
16
17 find_library(CATALOGUEAPI_LIBRARY NAMES CatalogueAPI
18 HINTS ${CATALOGUEAPI_ROOT_DIR} ${CATALOGUEAPI_EXTERN_FOLDER}
19 PATH_SUFFIXES lib)
20
21 set(CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_LIBRARY} )
22 set(CATALOGUEAPI_INCLUDE_DIRS ${CATALOGUEAPI_INCLUDE_DIR} )
23
24 include(FindPackageHandleStandardArgs)
25 # handle the QUIETLY and REQUIRED arguments and set CATALOGUEAPI_FOUND to TRUE
26 # if all listed variables are TRUE
27 find_package_handle_standard_args(CatalogueAPI FOUND_VAR CATALOGUEAPI_FOUND
28 REQUIRED_VARS CATALOGUEAPI_LIBRARY CATALOGUEAPI_INCLUDE_DIR)
29 mark_as_advanced(CATALOGUEAPI_INCLUDE_DIR CATALOGUEAPI_LIBRARY )
@@ -1,32 +1,39
1 1 #
2 2 # findslibs.cmake
3 3 #
4 4
5 5 #
6 6 # Qt
7 7 #
8 8 # Find Qt here so that a message is displayed in the console when executing
9 9 # cmake, but each application must call SCIQLOP_FIND_QT() to load the Qt modules that
10 10 # it needs.
11 11 FIND_PACKAGE(Qt5Core REQUIRED)
12 12 FIND_PACKAGE(Qt5Test REQUIRED)
13 13 FIND_PACKAGE(Qt5Gui REQUIRED)
14 14
15 15 #
16 # CatalogueAPI
17 #
18 LIST( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
19 FIND_PACKAGE(CatalogueAPI)
20
21
22 #
16 23 # doxygen tools
17 24 #
18 25 FIND_PACKAGE(Doxygen)
19 26
20 27 #
21 28 # Analyzer tools
22 29 #
23 30 LIST( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/analyzer/cmake")
24 31 FIND_PACKAGE(cppcheck)
25 32 FIND_PACKAGE(ClangAnalyzer)
26 33
27 34 #
28 35 # Formatting tools
29 36 #
30 37 LIST( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/formatting/cmake")
31 38 FIND_PACKAGE(vera++)
32 39 FIND_PACKAGE(ClangFormat)
@@ -1,159 +1,165
1 1
2 2 ## core - CMakeLists.txt
3 3 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
4 4 SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}")
5 5 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/")
6 6 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/")
7 7 SET(TESTS_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests-resources")
8 8
9 9 # Include core directory
10 10 include_directories("${INCLUDES_DIR}")
11 11
12 12 # Set a variable to display a warning in the version files.
13 13 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
14 14 # Generate the version file from the cmake version variables. The version
15 15 # variables are defined in the cmake/sciqlop_version.cmake file.
16 16 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in"
17 17 "${INCLUDES_DIR}/Version.h")
18 18 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in"
19 19 "${SOURCES_DIR}/Version.cpp")
20 20
21 21 # Find dependent modules
22 22 find_package(sciqlop-plugin)
23 23 INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR})
24 24
25 25 #
26 26 # Find Qt modules
27 27 #
28 28 SCIQLOP_FIND_QT(Core Network)
29 29
30 30 #
31 31 # Compile the library library
32 32 #
33 33
34 34 ADD_DEFINITIONS(-DCORE_LIB)
35 35
36 36 FILE (GLOB_RECURSE MODULE_SOURCES
37 37 ${INCLUDES_DIR}/*.h
38 38 ${SOURCES_DIR}/*.c
39 39 ${SOURCES_DIR}/*.cpp
40 40 ${SOURCES_DIR}/*.h)
41 41
42 42 ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES})
43 43 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
44 44 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
45 45 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME})
46 46 qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core Network)
47 47
48 # Find CATALOGUE_API
49 if(CATALOGUEAPI_FOUND)
50 include_directories("${CATALOGUEAPI_INCLUDE_DIRS}")
51 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES})
52 endif()
53
48 54 INSTALL(TARGETS ${SQPCORE_LIBRARY_NAME}
49 55 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
50 56 LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
51 57 ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
52 58 )
53 59
54 60 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
55 61 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
56 62 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
57 63 IF(BUILD_SHARED_LIBS)
58 64 SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
59 65 ELSE()
60 66 TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
61 67 ENDIF()
62 68
63 69 # Set the variable to parent scope so that the other projects can copy the
64 70 # dependent shared libraries
65 71 SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME)
66 72
67 73 # Copy extern shared libraries to the lib folder
68 74 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
69 75
70 76 # Add the files to the list of files to be analyzed
71 77 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
72 78 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
73 79 # Vera++ exclusion files
74 80 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
75 81 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
76 82
77 83 #
78 84 # Compile the tests
79 85 #
80 86 IF(BUILD_TESTS)
81 87 INCLUDE_DIRECTORIES(${SOURCES_DIR})
82 88 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
83 89 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
84 90 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME})
85 91
86 92 SET(TARGETS_COV)
87 93 FOREACH( testFile ${TESTS_SOURCES} )
88 94 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
89 95 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
90 96
91 97 # Add to the list of sources files all the sources in the same
92 98 # directory that aren't another test
93 99 FILE (GLOB currentTestSources
94 100 ${testDirectory}/*.c
95 101 ${testDirectory}/*.cpp
96 102 ${testDirectory}/*.h)
97 103 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
98 104 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
99 105
100 106 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
101 107 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
102 108 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
103 109 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
104 110 qt5_use_modules(${testName} Test)
105 111
106 112 ADD_TEST( NAME ${testName} COMMAND ${testName} )
107 113
108 114 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
109 115 set(Coverage_NAME ${testName})
110 116 if(UNIX)
111 117 SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName})
112 118 LIST( APPEND TARGETS_COV ${testName}_coverage)
113 119 endif(UNIX)
114 120
115 121 ENDFOREACH( testFile )
116 122
117 123 add_custom_target(coverage)
118 124
119 125 FOREACH( target_cov ${TARGETS_COV} )
120 126 add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov})
121 127 ENDFOREACH( target_cov )
122 128
123 129 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
124 130 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
125 131 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
126 132 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
127 133
128 134 ADD_DEFINITIONS(-DCORE_TESTS_RESOURCES_DIR="${TESTS_RESOURCES_DIR}")
129 135 ENDIF(BUILD_TESTS)
130 136
131 137 #
132 138 # Set the files that must be formatted by clang-format.
133 139 #
134 140 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
135 141 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
136 142
137 143 #
138 144 # Set the directories that doxygen must browse to generate the
139 145 # documentation.
140 146 #
141 147 # Source directories:
142 148 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
143 149 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
144 150 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
145 151 # Source directories to exclude from the documentation generation
146 152 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
147 153 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
148 154
149 155 #
150 156 # Set the directories with the sources to analyze and propagate the
151 157 # modification to the parent scope
152 158 #
153 159 # Source directories to analyze:
154 160 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
155 161 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
156 162 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
157 163 # Source directories to exclude from the analysis
158 164 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
159 165 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
General Comments 0
You need to be logged in to leave comments. Login now