ruslo / CGold

:whale2: The Hitchhiker’s Guide to the CMake
https://cgold.readthedocs.io
BSD 2-Clause "Simplified" License
523 stars 56 forks source link

Ch 3.7.3: path to mymodule #43

Closed StefanRickli closed 5 years ago

StefanRickli commented 5 years ago

The example in cmake-sources/with-external-module-good doesn't work because the path to mymodule.cmake isn't fully specified (CMAKE Error: include could not find load file: mymodule).

How should the include statement look correctly? Add the line list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../external") before?

StefanRickli commented 5 years ago

Appending to CMAKE_MODULE_PATH is done on the command line: [cmake-sources]> cmake -S with-external-module-good/example -B _builds -D CMAKE_MODULE_PATH=pwd/with-external-module-good/external

respectively [cmake-sources]> cmake -Hwith-external-module-good/example -B_builds -DCMAKE_MODULE_PATH=pwd/with-external-module-good/external

in older cmake syntax.