Skip to content

Commit 5bda14a

Browse files
committed
CMake: move findXXX of main dependencies to the main CMakeLists file
Some variables provided by these functions are required for building testing modules
1 parent 7eeafdf commit 5bda14a

File tree

3 files changed

+27
-16
lines changed

3 files changed

+27
-16
lines changed

CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ if (NOT COMPILER_SUPPORT_GNUXX11)
3838
message(FATAL_ERROR "Compiler does NOT support C++11 with GNU extension")
3939
endif()
4040

41+
42+
4143
# ------------------------------------------------------------------------------
4244
# Set default build type if not specified by user
4345
set(DEFAULT_BUILD_TYPE "Release")
@@ -76,6 +78,23 @@ if (ENABLE_TESTS AND ENABLE_TESTS_COVERAGE)
7678
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
7779
endif()
7880

81+
## -----------------------------------------------------------------------------
82+
# Find libfds
83+
find_package(LibFds 0.2.0 REQUIRED)
84+
85+
# Find rst2man
86+
if (ENABLE_DOC_MANPAGE)
87+
find_package(Rst2Man)
88+
if (NOT RST2MAN_FOUND)
89+
message(FATAL_ERROR "rst2man is not available")
90+
endif()
91+
endif()
92+
93+
# Find pthreads
94+
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
95+
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
96+
find_package(Threads REQUIRED)
97+
7998
# ------------------------------------------------------------------------------
8099
# Project components
81100
add_subdirectory(include)

src/CMakeLists.txt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,6 @@ configure_file(
88
"${PROJECT_BINARY_DIR}/src/build_config.h"
99
)
1010

11-
# Find libfds
12-
find_package(LibFds 0.2.0 REQUIRED)
13-
# Find rst2man
14-
15-
if (ENABLE_DOC_MANPAGE)
16-
find_package(Rst2Man)
17-
if (NOT RST2MAN_FOUND)
18-
message(FATAL_ERROR "rst2man is not available. Install python-docutils or disable manual page generation (-DENABLE_DOC_MANPAGE=False)")
19-
endif()
20-
endif()
21-
22-
# Find pthreads
23-
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
24-
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
25-
find_package(Threads REQUIRED)
26-
2711
# Header files for source code building
2812
include_directories(
2913
"${PROJECT_SOURCE_DIR}/include/"

tests/modules/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Header files for source code building
2+
include_directories(
3+
"${PROJECT_SOURCE_DIR}/include/"
4+
"${PROJECT_BINARY_DIR}/include/" # for api.h
5+
"${PROJECT_BINARY_DIR}/src/" # for build_config.h
6+
"${FDS_INCLUDE_DIRS}" # libfds header files
7+
)
8+
19
add_subdirectory(input_failure)
210
add_subdirectory(intermediate_failure)
311
add_subdirectory(output_failure)

0 commit comments

Comments
 (0)