Skip to content

Commit

Permalink
CMake: move findXXX of main dependencies to the main CMakeLists file
Browse files Browse the repository at this point in the history
Some variables provided by these functions are required for building testing modules
  • Loading branch information
Lukas955 committed Apr 23, 2020
1 parent 7eeafdf commit 5bda14a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ if (NOT COMPILER_SUPPORT_GNUXX11)
message(FATAL_ERROR "Compiler does NOT support C++11 with GNU extension")
endif()



# ------------------------------------------------------------------------------
# Set default build type if not specified by user
set(DEFAULT_BUILD_TYPE "Release")
Expand Down Expand Up @@ -76,6 +78,23 @@ if (ENABLE_TESTS AND ENABLE_TESTS_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
endif()

## -----------------------------------------------------------------------------
# Find libfds
find_package(LibFds 0.2.0 REQUIRED)

# Find rst2man
if (ENABLE_DOC_MANPAGE)
find_package(Rst2Man)
if (NOT RST2MAN_FOUND)
message(FATAL_ERROR "rst2man is not available")
endif()
endif()

# Find pthreads
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)

# ------------------------------------------------------------------------------
# Project components
add_subdirectory(include)
Expand Down
16 changes: 0 additions & 16 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,6 @@ configure_file(
"${PROJECT_BINARY_DIR}/src/build_config.h"
)

# Find libfds
find_package(LibFds 0.2.0 REQUIRED)
# Find rst2man

if (ENABLE_DOC_MANPAGE)
find_package(Rst2Man)
if (NOT RST2MAN_FOUND)
message(FATAL_ERROR "rst2man is not available. Install python-docutils or disable manual page generation (-DENABLE_DOC_MANPAGE=False)")
endif()
endif()

# Find pthreads
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)

# Header files for source code building
include_directories(
"${PROJECT_SOURCE_DIR}/include/"
Expand Down
8 changes: 8 additions & 0 deletions tests/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Header files for source code building
include_directories(
"${PROJECT_SOURCE_DIR}/include/"
"${PROJECT_BINARY_DIR}/include/" # for api.h
"${PROJECT_BINARY_DIR}/src/" # for build_config.h
"${FDS_INCLUDE_DIRS}" # libfds header files
)

add_subdirectory(input_failure)
add_subdirectory(intermediate_failure)
add_subdirectory(output_failure)

0 comments on commit 5bda14a

Please sign in to comment.