Finding headers in packages without relative paths

Hi

I have a large software project which requires its own software environment to be sourced in order for a lot of CMake functions to be understood. In my workflow, I would usually do 
> source setup.sh
> cmake ../ProjectSource/Projects/thisProject
> cmake --build ./

I can set this environment up within the Docker integration framework, but I cannot get CLion to understand my project CMakeLists.txt because
a) It is not held in the top directory (as you see above it is actually lower down in a separate package)
b) It uses functions which are undefined until the appropriate environments are sourced

I primarily want to use CLion just for code insight between source files and headers, but all our packages are set up as
ProjectSource/PackageA/
ProjectSource/PackageA/CMakeLists.txt
ProjectSource/PackageA/PackageA/*.h
ProjectSource/PackageA/src/*.cxx

All header includes are defined like "PackageA/header1.h" but CLion is unable to find these, even when I set a full path down to the first PackageA, ie include_directory("ProjectSource/PackageA/"). Is there a way I can get CLion to understand where to look for all my headers, such that it can find headers of this format? I am unable to use the proper project CMakeLists.txt because it has dependencies I cannot configure inside CLion (and I also cannot configure without going into a docker container). 

I hope this question makes sense.

Thanks
Ian

PS If I had the headers defined as "../PackageA/header1.h" this is found by CLion to be linked between, but I cannot make these changes to the project as it would break the compatibility with the primary compilation method.

0
1 comment

Hi, Ian.

As for the a) - you can open your project folder in CLion, find your CMakeLists.txt in the Project Tree, do a right click and select Load CMake Project. 

As for the b) - unfortunately, the possibility of running some script to use for CMake generation hasn't been implemented in CLion yet. Feel free to comment or upvote a feature request in our tracker: https://youtrack.jetbrains.com/issue/CPP-8414.

Do I understand correctly that you've written new CMakeLists.txt for your project in the proper location and set include_directory with the full path but CLion couldn't find your header files? If yes, could you please send us the CMake output?

0

Please sign in to leave a comment.