##// END OF EJS Templates
Remove cmake function called that isn't necessary and makes failed the configuration test if test is enable
perrinel -
r1107:6684c2bc54eb
parent child
Show More
@@ -1,174 +1,173
1 ## core - CMakeLists.txt
1 ## core - CMakeLists.txt
2 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
2 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
3 SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}")
3 SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}")
4 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/")
4 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/")
5 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/")
5 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/")
6 SET(TESTS_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests-resources")
6 SET(TESTS_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests-resources")
7
7
8 # Include core directory
8 # Include core directory
9 include_directories("${INCLUDES_DIR}")
9 include_directories("${INCLUDES_DIR}")
10
10
11 # Set a variable to display a warning in the version files.
11 # Set a variable to display a warning in the version files.
12 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
12 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
13 # Generate the version file from the cmake version variables. The version
13 # Generate the version file from the cmake version variables. The version
14 # variables are defined in the cmake/sciqlop_version.cmake file.
14 # variables are defined in the cmake/sciqlop_version.cmake file.
15 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in"
15 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in"
16 "${INCLUDES_DIR}/Version.h")
16 "${INCLUDES_DIR}/Version.h")
17 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in"
17 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in"
18 "${SOURCES_DIR}/Version.cpp")
18 "${SOURCES_DIR}/Version.cpp")
19
19
20 # Find dependent modules
20 # Find dependent modules
21 find_package(sciqlop-plugin)
21 find_package(sciqlop-plugin)
22 INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR})
22 INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR})
23
23
24 #
24 #
25 # Find Qt modules
25 # Find Qt modules
26 #
26 #
27 SCIQLOP_FIND_QT(Core Network)
27 SCIQLOP_FIND_QT(Core Network)
28
28
29 #
29 #
30 # Compile the library library
30 # Compile the library library
31 #
31 #
32
32
33 ADD_DEFINITIONS(-DCORE_LIB)
33 ADD_DEFINITIONS(-DCORE_LIB)
34
34
35 FILE (GLOB_RECURSE MODULE_SOURCES
35 FILE (GLOB_RECURSE MODULE_SOURCES
36 ${INCLUDES_DIR}/*.h
36 ${INCLUDES_DIR}/*.h
37 ${SOURCES_DIR}/*.c
37 ${SOURCES_DIR}/*.c
38 ${SOURCES_DIR}/*.cpp
38 ${SOURCES_DIR}/*.cpp
39 ${SOURCES_DIR}/*.h)
39 ${SOURCES_DIR}/*.h)
40
40
41 ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES})
41 ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES})
42 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
42 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
43 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
43 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
44 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME})
44 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME})
45 qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core Network)
45 qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core Network)
46
46
47 # Find CATALOGUE_API
47 # Find CATALOGUE_API
48 include_directories("${CATALOGUEAPI_INCLUDE}")
48 include_directories("${CATALOGUEAPI_INCLUDE}")
49 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES})
49 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES})
50 INSTALL(TARGETS ${SQPCORE_LIBRARY_NAME}
50 INSTALL(TARGETS ${SQPCORE_LIBRARY_NAME}
51 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
51 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
52 LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
52 LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
53 ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
53 ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
54 )
54 )
55
55
56 add_dependencies(${SQPCORE_LIBRARY_NAME} CatalogueAPI)
56 add_dependencies(${SQPCORE_LIBRARY_NAME} CatalogueAPI)
57
57
58 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
58 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
59 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
59 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
60 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
60 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
61 IF(BUILD_SHARED_LIBS)
61 IF(BUILD_SHARED_LIBS)
62 SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
62 SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
63 ELSE()
63 ELSE()
64 TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
64 TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
65 ENDIF()
65 ENDIF()
66
66
67 # Set the variable to parent scope so that the other projects can copy the
67 # Set the variable to parent scope so that the other projects can copy the
68 # dependent shared libraries
68 # dependent shared libraries
69 SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME)
69 SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME)
70
70
71 ## Copy extern shared libraries to the lib folder
71 ## Copy extern shared libraries to the lib folder
72 LIST (APPEND ${EXTERN_SHARED_LIBRARIES} ${CATALOGUEAPI_LIBRARIES})
72 LIST (APPEND ${EXTERN_SHARED_LIBRARIES} ${CATALOGUEAPI_LIBRARIES})
73
73
74
74
75 SET (COPY_LIBS_DESTINATION LIBRARY)
75 SET (COPY_LIBS_DESTINATION LIBRARY)
76 if(APPLE)
76 if(APPLE)
77 SET (COPY_LIBS_DESTINATION RUNTIME)
77 SET (COPY_LIBS_DESTINATION RUNTIME)
78 endif()
78 endif()
79
79
80 add_custom_command(TARGET ${SQPCORE_LIBRARY_NAME} POST_BUILD
80 add_custom_command(TARGET ${SQPCORE_LIBRARY_NAME} POST_BUILD
81 COMMAND ${CMAKE_COMMAND} -E copy ${CATALOGUEAPI_LIBRARIES} ${EXECUTABLE_OUTPUT_PATH}
81 COMMAND ${CMAKE_COMMAND} -E copy ${CATALOGUEAPI_LIBRARIES} ${EXECUTABLE_OUTPUT_PATH}
82 )
82 )
83
83
84 # Add the files to the list of files to be analyzed
84 # Add the files to the list of files to be analyzed
85 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
85 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
86 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
86 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
87 # Vera++ exclusion files
87 # Vera++ exclusion files
88 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
88 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
89 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
89 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
90
90
91 #
91 #
92 # Compile the tests
92 # Compile the tests
93 #
93 #
94 IF(BUILD_TESTS)
94 IF(BUILD_TESTS)
95 INCLUDE_DIRECTORIES(${SOURCES_DIR})
95 INCLUDE_DIRECTORIES(${SOURCES_DIR})
96 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
96 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
97 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
97 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
98 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME})
98 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME})
99 list(APPEND TEST_LIBRARIES ${CATALOGUEAPI_LIBRARIES})
99 list(APPEND TEST_LIBRARIES ${CATALOGUEAPI_LIBRARIES})
100
100
101 SET(TARGETS_COV)
101 SET(TARGETS_COV)
102 FOREACH( testFile ${TESTS_SOURCES} )
102 FOREACH( testFile ${TESTS_SOURCES} )
103 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
103 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
104 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
104 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
105
105
106 # Add to the list of sources files all the sources in the same
106 # Add to the list of sources files all the sources in the same
107 # directory that aren't another test
107 # directory that aren't another test
108 FILE (GLOB currentTestSources
108 FILE (GLOB currentTestSources
109 ${testDirectory}/*.c
109 ${testDirectory}/*.c
110 ${testDirectory}/*.cpp
110 ${testDirectory}/*.cpp
111 ${testDirectory}/*.h)
111 ${testDirectory}/*.h)
112 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
112 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
113 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
113 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
114
114
115 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
115 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
116 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
116 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
117 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
117 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
118 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES})
118 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES})
119 qt5_use_modules(${testName} Test)
119 qt5_use_modules(${testName} Test)
120
120
121 ADD_TEST( NAME ${testName} COMMAND ${testName} )
121 ADD_TEST( NAME ${testName} COMMAND ${testName} )
122
122
123 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${CATALOGUEAPI_LIBRARIES})
124 set(Coverage_NAME ${testName})
123 set(Coverage_NAME ${testName})
125 if(UNIX)
124 if(UNIX)
126 SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName})
125 SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName})
127 LIST( APPEND TARGETS_COV ${testName}_coverage)
126 LIST( APPEND TARGETS_COV ${testName}_coverage)
128 endif(UNIX)
127 endif(UNIX)
129
128
130 ENDFOREACH( testFile )
129 ENDFOREACH( testFile )
131
130
132 add_custom_target(coverage)
131 add_custom_target(coverage)
133
132
134 FOREACH( target_cov ${TARGETS_COV} )
133 FOREACH( target_cov ${TARGETS_COV} )
135 add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov})
134 add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov})
136 ENDFOREACH( target_cov )
135 ENDFOREACH( target_cov )
137
136
138 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
137 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
139 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
138 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
140 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
139 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
141 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
140 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
142
141
143 ADD_DEFINITIONS(-DCORE_TESTS_RESOURCES_DIR="${TESTS_RESOURCES_DIR}")
142 ADD_DEFINITIONS(-DCORE_TESTS_RESOURCES_DIR="${TESTS_RESOURCES_DIR}")
144 ENDIF(BUILD_TESTS)
143 ENDIF(BUILD_TESTS)
145
144
146 #
145 #
147 # Set the files that must be formatted by clang-format.
146 # Set the files that must be formatted by clang-format.
148 #
147 #
149 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
148 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
150 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
149 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
151
150
152 #
151 #
153 # Set the directories that doxygen must browse to generate the
152 # Set the directories that doxygen must browse to generate the
154 # documentation.
153 # documentation.
155 #
154 #
156 # Source directories:
155 # Source directories:
157 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
156 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
158 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
157 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
159 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
158 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
160 # Source directories to exclude from the documentation generation
159 # Source directories to exclude from the documentation generation
161 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
160 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
162 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
161 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
163
162
164 #
163 #
165 # Set the directories with the sources to analyze and propagate the
164 # Set the directories with the sources to analyze and propagate the
166 # modification to the parent scope
165 # modification to the parent scope
167 #
166 #
168 # Source directories to analyze:
167 # Source directories to analyze:
169 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
168 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
170 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
169 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
171 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
170 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
172 # Source directories to exclude from the analysis
171 # Source directories to exclude from the analysis
173 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
172 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
174 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
173 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved

Status change > Approved

You need to be logged in to leave comments. Login now