Tutorial by Examples

set(my_global_string "a string value" CACHE STRING "a description about the string variable") set(my_global_bool TRUE CACHE BOOL "a description on the boolean cache entry") In case a cached variable is already defined in the cache when CMake processes the ...
set(my_variable "the value is a string") By default, a local variable is only defined in the current directory and any subdirectories added through the add_subdirectory command. To extend the scope of a variable there are two possibilities: CACHE it, which will make it globally av...
It's important to know how CMake distinguishes between lists and plain strings. When you write: set(VAR "a b c") you create a string with the value "a b c". But when you write this line without quotes: set(VAR a b c) You create a list of three items instead: "a", &q...
Mostly you will use "normal variables": set(VAR TRUE) set(VAR "main.cpp") set(VAR1 ${VAR2}) But CMake does also know global "cached variables" (persisted in CMakeCache.txt). And if normal and cached variables of the same name exist in the current scope, normal var...
The series of events here is supposed to work as follows: Compile code with -pg option Link code with -pg option Run program Program generates gmon.out file Run gprof program To add profiling flags, you must add to your CMakeLists.txt: SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg&quot...

Page 1 of 1