☰
Current Page
Main Menu
Home
Home
Editing
CMakeBuildDeps
Edit
Preview
h1
h2
h3
Keybinding
default
vim
emacs
Markup
Markdown
Plain Text
Pod
RDoc
reStructuredText
AsciiDoc
BibTeX
Creole
MediaWiki
Org-mode
Textile
Help 1
Help 1
Help 1
Help 2
Help 3
Help 4
Help 5
Help 6
Help 7
Help 8
Autosaved text is available. Click the button to restore it.
Restore Text
--- title: CMakeBuildDeps --- Build library dependencies from anywhere in the source tree. If you already have all your libraries under your project root, you don't need this. # Manifest Utils include(/path/to/ManifestFile) # Add a library from anywhere in the source tree, only once, as a "subdirectory" function(builddep\_find\_lib lib_name) # Already loaded? get_property(${lib_name}\_defined\_globally GLOBAL PROPERTY global_${lib_name}_loaded DEFINED) if(NOT ${lib_name}\_defined\_globally) define_property(GLOBAL PROPERTY global_${lib_name}_loaded BRIEF_DOCS "Boolean variable indicating whether a lib was loaded" FULL_DOCS "See Brief Docs") set_property(GLOBAL PROPERTY global_${lib_name}_loaded FALSE) endif(NOT ${lib_name}\_defined\_globally) get_property(${lib_name}\_loaded GLOBAL PROPERTY global\_${lib_name}_loaded) # Use the two arg form of add\_subdirectory to specify the binary\_dir for the dependency if(NOT ${lib_name}_loaded) set_property(GLOBAL PROPERTY global_${lib_name}_loaded TRUE) string(TOUPPER ${lib_name} lib\_name\_upper) add_subdirectory(${${lib\_name\_upper}\_IMPORT\_DIR} ${CMAKE\_BINARY\_DIR}/${lib_name}) endif(NOT ${lib_name}_loaded) endfunction() # Add just the library's public includes. # Only needed to handle circular header deps. # function(builddep\_target\_add\_headers target\_name scope lib_name) string(TOUPPER ${lib_name} lib\_name\_upper) target\_include\_directories(${target_name} ${scope} ${${lib\_name\_upper}\_IMPORT\_DIR}/include) endfunction() # Manifest File set(FOO\_IMPORT\_DIR /path/to/foo) set(BAR\_IMPORT\_DIR /path/to/bar) # Usage builddep\_find\_lib(foo) builddep\_find\_lib(bar) add_executable(helloworld helloworld.cpp ) target\_link\_libraries(helloworld PRIVATE foo bar ) [1]: CMakeBuildDeps?action=sourceblock&num=1 [2]: CMakeBuildDeps?action=sourceblock&num=2 [3]: CMakeBuildDeps?action=sourceblock&num=3
Uploading file...
Sidebar
# SideBar * [Home][1] * [Projects][2] * * * <!-- --> * [Code][3] * [Tech][4] * [Network][5] * [MediaCentre][6] * [UAV][7] * * * <!-- --> * [Travel][8] * [Music][9] * [Horse Riding][10] * [Study][11] * [Games][12] * [Other Activities][13] * * * <!-- --> * [Car][14] * [House][15] * [Watch][16] * [Clothing][17] * [Miscellany][18] * * * [1]: /Home [2]: /Projects [3]: /Code/Code [4]: /Tech/Tech [5]: /Network/Network [6]: /MediaCentre/MediaCentre [7]: /UAV/UAV [8]: /Travel/Travel [9]: /Music/Music [10]: /HorseRiding/HorseRiding [11]: /Study/Study [12]: /Games/Games [13]: /Do/Do [14]: /Car/Car [15]: /House/House [16]: /Watch/Watch [17]: /Clothing/Clothing [18]: /Miscellany/Miscellany
Edit message:
Cancel