How to hide certain targets in CMake?

0 votes
asked Nov 2, 2010 by dat-chu

I have a library that is built as part of my CMake-based project. This library has many targets and I am not interested in seeing them appearing in my target list (either under Visual Studio or QtCreator). Is there a way for me to have this library built as part of my project build (kindda like a dependency build) but not seeing the available targets of this library?

2 Answers

0 votes
answered Nov 7, 2011 by rumpel

Do you know the ExternalProject_Add command? It allows you to describe build (and download, patch, install, ...) steps of libraries that you want to build as a prerequisite of your own project. Using this command will show your library as a single target in make/Visual Studio/QtCreator.

0 votes
answered Sep 15, 2017 by ruipacheco

My solution to this is to have CMake execute a shell command that builds the dependencies I need instead of calling add_subdirectory. It's not elegant but beats the visual pollution caused by all those unwanted targets.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter