From e85c2cb6f40af792281d2c9c4a1311ff98ad3301 Mon Sep 17 00:00:00 2001 From: Mikko Johannes Koivunalho Date: Tue, 22 Oct 2019 20:23:11 +0200 Subject: [PATCH] Append cmake subdir to CMAKE_MODULE_PATH It is important to append our own cmake module directory to the project wide CMAKE_MODULE_PATH. Normally CMAKE_MODULE_PATH is empty when project is started because the default module path is hard coded, e.g. /usr/share/cmake/Modules. But if this project is included into another project, the surrounding project might want to override how we find_package() our dependendies. Changed "${CMAKE_CURRENT_SOURCE_DIR}" to "${CMAKE_CURRENT_LIST_DIR}" because while current source can change, the cmake sub directory will always stay adjacent to this CMakeLists.txt file. Signed-off-by: Mikko Johannes Koivunalho --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec7e260..49fb6c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ project(UNIXem LANGUAGES C CXX) # Directory for CMake specific extensions and source files. -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") # Set build type to Debug if this is a Git repository. # Otherwise set to Release.