Describe the bug
In the case of having submodules/subcomponents in a project, it is not possible to build our project with cmake using the cmakelists generated by evoke.
There seem to be two reasons for this:
1) Subdirectories for subcomponents comp/subcomp are added using the subcomponent name comp_subcomp instead of the path comp/subcomp.
2) All subcomponents are treated as system libraries (evokesystem...) and even when correcting add_subdirectories parameters, the build will fail because files #included won't be found.
To Reproduce
Steps to reproduce the behavior:
Run git clone https://github.com/PenguinLemma/evoke_examples.git in an empty folder.
Run `cd evoke_examples/3_subcomponents
Run evoke -v -cm
Run mkdir build && cd build
Run cmake ..
Run make
See the error. This time it is related to 3_subcomponents/CMakeLists.txt's add_subdirectories(sequences_base_sequence) and similar.
Edit 3_subcomponents/CMakeLists.txt changing sequences_* by sequences/* inside add_subdirectories.
See the error. Now it's complaining that base_sequence.cpp can not be found when included from any of the other two sequences.
Expected behavior
Subdirectories are added correctly as component/subcomponent and submodules are not treated as system libraries (unless they are indeed). 3_subcomponents can be built with cmake using the cmakelists generated by evoke.
Screenshots/Logs
First error can be found here:
cmake_output.txt
Second error can be reproduced, as stated above (I seem to not have saved the output in a file, sorry!)
System (please complete the following information):
OS: Ubuntu 18.04
Compiler: GCC
Version: 7.4
Usage: command line
CMake version > 3.12 (3.14.5).
Proposed solution
While trying to find out if this was a problem of the example project or not, and trying to understand the error, I found a way to solve this. Which is the following:
1) Add cmake_subdir_name to a component (in the case of comp/subcom, the name of the component will be "comp_subcomp" and cmake_subdir_name = "comp/subcom".
2) Refactor slightly Project::IsSystemComponent so that it receives a component and checks for both names (component.name and component.cmake_subdir_name).
3) Adapt CMakeProjectExporter::LookupLibraryName accordingly.
I will add a pull-request for this, please let me know of any possible side effects that I might have overlooked or any changes you consider pertinent.
Describe the bug In the case of having submodules/subcomponents in a project, it is not possible to build our project with
cmake
using the cmakelists generated byevoke
.There seem to be two reasons for this: 1) Subdirectories for subcomponents
comp/subcomp
are added using the subcomponent namecomp_subcomp
instead of the pathcomp/subcomp
. 2) All subcomponents are treated as system libraries (evokesystem...) and even when correctingadd_subdirectories
parameters, the build will fail because files#include
d won't be found.To Reproduce Steps to reproduce the behavior:
git clone https://github.com/PenguinLemma/evoke_examples.git
in an empty folder.evoke -v -cm
mkdir build && cd build
cmake ..
make
See the error. This time it is related to3_subcomponents/CMakeLists.txt
'sadd_subdirectories(sequences_base_sequence)
and similar.3_subcomponents/CMakeLists.txt
changingsequences_*
bysequences/*
insideadd_subdirectories
. See the error. Now it's complaining thatbase_sequence.cpp
can not be found when included from any of the other two sequences.Expected behavior Subdirectories are added correctly as
component/subcomponent
and submodules are not treated as system libraries (unless they are indeed).3_subcomponents
can be built withcmake
using the cmakelists generated by evoke.Screenshots/Logs First error can be found here: cmake_output.txt Second error can be reproduced, as stated above (I seem to not have saved the output in a file, sorry!)
System (please complete the following information):
Proposed solution While trying to find out if this was a problem of the example project or not, and trying to understand the error, I found a way to solve this. Which is the following:
1) Add cmake_subdir_name to a component (in the case of
comp/subcom
, the name of the component will be "comp_subcomp" andcmake_subdir_name = "comp/subcom"
. 2) Refactor slightlyProject::IsSystemComponent
so that it receives a component and checks for both names (component.name and component.cmake_subdir_name). 3) AdaptCMakeProjectExporter::LookupLibraryName
accordingly.I will add a pull-request for this, please let me know of any possible side effects that I might have overlooked or any changes you consider pertinent.