Jump to content
  • Advertisement
Sign in to follow this  
rogerdv

basic cmake setup

This topic is 1207 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im trying to create the cmake files for a project, but cant find how to achieve it. The project has this structure:

 

project-dir

  src

    sources1

    sources2

 

I have tried several combinations, but cant make it work. So, I have to specify all source files manually in the CMakeLists.txt located at src. How can I implement this?

 

Share this post


Link to post
Share on other sites
Advertisement

The problem with using glob is that CMake doesn't recognise when you add/remove files from the project. ;)


But you have to remember added each file to the CMakeLists.txt. I don't know how often I forgot to do this before I gave up and switched my project to globs. biggrin.png
At least with Visual Studio globbing works as long as you add every file via the Solution Explorer. You just need to run CMake manually after pulling an update from version control.

Share this post


Link to post
Share on other sites
Personally I see adding the files to the relevant CMakeLists by hand is a complete non-issue. At work some parts of the project work with GLOBs (because the whole thing was moved to CMake after years of growing outside it). It's an acceptable workaround for quickly moving a large existing codebase into CMake but when I'm working in an area I try to spare the time to drop the GLOBs and move to explicit listings. It's much less painless in the long run, especially if you also need to add/remove compilation units depending on the current platform or other factors.

Share this post


Link to post
Share on other sites

Personally I see adding the files to the relevant CMakeLists by hand is a complete non-issue. At work some parts of the project work with GLOBs (because the whole thing was moved to CMake after years of growing outside it). It's an acceptable workaround for quickly moving a large existing codebase into CMake but when I'm working in an area I try to spare the time to drop the GLOBs and move to explicit listings. It's much less painless in the long run, especially if you also need to add/remove compilation units depending on the current platform or other factors.

 

It also makes it obvious far earlier in the build process when someone forgets to upload a file to the SCM. Which happens a lot.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!