Skip to content

Commit

Permalink
Append cmake subdir to CMAKE_MODULE_PATH
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mikkoi committed Oct 22, 2019
1 parent 7a59392 commit e85c2cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e85c2cb

Please sign in to comment.