TheLartians / ModernCppStarter

🚀 Kick-start your C++! A template for modern C++ projects using CMake, CI, code coverage, clang-format, reproducible dependency management and much more.
https://thelartians.github.io/ModernCppStarter
The Unlicense
4.45k stars 388 forks source link

Documentation build failure due to empty MCSS_SOURCE_DIR #105

Closed hazelnusse closed 3 years ago

hazelnusse commented 3 years ago

On 4212173c2fed1703f1e68a7585c074fa55578be0 when I follow the directions for building the documentation, I get the following:

[I] luke@t480s ~/r/ModernCppStarter (master)> cmake -Hdocumentation -Bbuild/doc
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Downloading CPM.cmake to /home/luke/repos/ModernCppStarter/build/doc/cmake/CPM_0.31.1.cmake
-- CPM: adding package m.css@0 (42d4a9a48f31f5df6e246c948403b54b50574a2a)
-- CPM: adding package Greeter@ (/home/luke/repos/ModernCppStarter/documentation/..)
-- CPM: Greeter: adding package PackageProject.cmake@1.4.1 (v1.4.1)
-- CPM: Greeter: adding package fmt@7.1.3 (7.1.3)
-- Version: 7.1.3
-- Build type: 
-- CXX_STANDARD: 11
-- Performing Test has_std_11_flag
-- Performing Test has_std_11_flag - Success
-- Performing Test has_std_0x_flag
-- Performing Test has_std_0x_flag - Success
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS - Success
-- Performing Test FMT_HAS_VARIANT
-- Performing Test FMT_HAS_VARIANT - Success
-- Required features: cxx_variadic_templates
-- Looking for strtod_l
-- Looking for strtod_l - not found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/luke/repos/ModernCppStarter/build/doc

[I] luke@t480s ~/r/ModernCppStarter (master)> cmake --build build/doc --target GenerateDocs
[0/2] Re-checking globbed directories...
[1/1] cd /home/luke/repos/ModernCppStarter/build/doc && /usr/bin/cmake -E make_directory /home/luke/repos/Moder...ernCppStarter/build/doc/conf.py && echo Docs\ written\ to:\ /home/luke/repos/ModernCppStarter/build/doc/doxygen
FAILED: CMakeFiles/GenerateDocs 
cd /home/luke/repos/ModernCppStarter/build/doc && /usr/bin/cmake -E make_directory /home/luke/repos/ModernCppStarter/build/doc/doxygen && /documentation/doxygen.py /home/luke/repos/ModernCppStarter/build/doc/conf.py && echo Docs\ written\ to:\ /home/luke/repos/ModernCppStarter/build/doc/doxygen
/bin/sh: line 1: /documentation/doxygen.py: No such file or directory
ninja: build stopped: subcommand failed.

I have Doxygen, jinja2, and pygments installed:

[I] luke@t480s ~/r/ModernCppStarter (master)> doxygen --version
1.9.1
                                                                                                                                                                                                      [ 0s008 | Mar 20 09:45AM ]
[I] luke@t480s ~/r/ModernCppStarter (master)> python -c "import jinja2; print(jinja2.__version__)"
2.11.3
                                                                                                                                                                                                      [ 0s073 | Mar 20 09:45AM ]
[I] luke@t480s ~/r/ModernCppStarter (master)> python -c "import pygments; print(pygments.__version__)"                                                                                                                           
2.8.1                                                                                                                                                                                                                            
                                                                                                                                                                                                      [ 0s023 | Mar 20 09:45AM ] 
[I] luke@t480s ~/r/ModernCppStarter (master)> python --version                                                                                                                                                                   
Python 3.9.2                                    

For some reason, the MCSS_SOURCE_DIR is empty and is causing the command of the GenerateDocs custom command to be just /documentation/doxygen.py.

hazelnusse commented 3 years ago

In case it matters, I'm using the following version of cmake:

$ cmake --version
cmake version 3.19.7
hazelnusse commented 3 years ago

Perhaps this is some difference in how CMake handles "." in names? I'm seeing this in build/doc/CMakeCache.txt:

$ rg "M\.CSS"
CMakeCache.txt
313:FETCHCONTENT_SOURCE_DIR_M.CSS:PATH=
329:FETCHCONTENT_UPDATES_DISCONNECTED_M.CSS:BOOL=OFF

I tried changing MCSS_SOURCE_DIR to M.CSS_SOURCE_DIR but it did not fix the problem either.

hazelnusse commented 3 years ago

Adding the following indicates the expected variable names are not getting set:

message("M.CSS_SOURCE_DIR = ${M.CSS_SOURCE_DIR}")
message("M.CSS_BINARY_DIR = ${M.CSS_BINARY_DIR}")
message("M.CSS_ADDED = ${M.CSS_ADDED}")
message("MCSS_SOURCE_DIR = ${MCSS_SOURCE_DIR}")
message("MCSS_BINARY_DIR = ${MCSS_BINARY_DIR}")
message("MCSS_ADDED = ${MCSS_ADDED}")
...
-- CPM: adding package m.css@0 (42d4a9a48f31f5df6e246c948403b54b50574a2a)
M.CSS_SOURCE_DIR = 
M.CSS_BINARY_DIR = 
M.CSS_ADDED = 
MCSS_SOURCE_DIR = 
MCSS_BINARY_DIR = 
MCSS_ADDED = 
hazelnusse commented 3 years ago

I've confirmed that CMake variables names can have dots in them so presumably this must be due to how CPMAddPackage() is parsing the github repository name?

TheLartians commented 3 years ago

Ehhm yeah this seems to be a bug I introduced in #88, by using the new CPM.cmake syntax. The repository name is now implicitly inferred by the source string "gh:mosra/m.css#42d4a9a48f31f5df6e246c948403b54b50574a2a", so it should be ${m.css_SOURCE_DIR} instead of the previous MCSS_SOURCE_DIR.

hazelnusse commented 3 years ago

Aha, it is case sensitive. Lol, you beat me! https://github.com/TheLartians/ModernCppStarter/pull/107