Advertisement Jump to content
Sign in to follow this  

CMake - ExternalProject targets slowing down everything

This topic is 1574 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

My project uses CMake's externalproject module for pulling in dependencies not found on the host system. It was a great idea until I actually started working on the project's source code again.


Whenever I "make myproject", all dependencies are also pulled in to the make command. This means all repositories are pulled, all configure scripts are executed, and all dependencies are re-installed. Given the number and size of dependencies, this can take an annoying 20 seconds.


Is there a way to to tell CMake to build an externalproject exactly once and then ignore it if it was successful in the future?

Edited by TheComet

Share this post

Link to post
Share on other sites

You can just check if you have already downloaded or built it by creating a file after download or build steps and checking for that file later on.


Here is where I got this code from:

# are we building a source package or should we download from the internet ?
if(EXISTS ${CMAKE_SOURCE_DIR}/ThisIsASourcePackage.valid )	
  set(buildFromSourcePackage TRUE)
  set(buildFromSourcePackage FALSE)

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!