The `${ }` syntax deferences the variable, so what you are asking is
if the variable `1_INC_PATH` exists.
What you want is `if(DEFINED WITH_LIB_GLAD_INC_PATH)` to check for the
existence of the variable `WITH_LIB_GLAD_INC_PATH`
On Fri, May 31, 2019 at 4:11 PM Steven Truppe wrote:
>
> Hi
Hi everyone,
i'm relative new to cmake (a few weeks now) and i have the following
problem:
set(WITH_LIB_GLAD 1)
IF(DEFINED ${WITH_LIB_GLAD}_INC_PATH)
I try to check if the variable WITH_LIB_GLAD_INC_PATH can be found.
best regards!
--
Powered by www.kitware.com
Please keep messages
This works:
set( project_count 0 CACHE INTERNAL )
function( define_project )
math( EXPR count ${project_count}+1 )
set( project_count ${count} CACHE INTERNAL )
endfunction()
define_project()
message(${project_count})
define_project()
message(${project_count})
define_project()
Doh :-) Thanks for pointing out what should perhaps have been obvious in
retrospect. Cache variables are one of the more confusing areas of cmake.
--
Glenn
On 10 October 2011 22:38, Bill Hoffman bill.hoff...@kitware.com wrote:
On 10/10/2011 3:52 PM, Robert Dailey wrote:
Yes, this works
I have a function that I define in my top-most CMakeLists.txt file (on
Windows using CMake version 2.8.6) called define_project() that calls
add_executable, sets up compile defintions, etc etc.
For each time define_project() is called *anywhere* in the directory
hierarchy, I need to increment a
Calling a function pushs a new variable scope. All variables visible in the
callers scope are copied into the new scope but changes by default only
affect the callee scope. You could try using the PARENT_SCOPE option to the
set command but I'm not sure that will achieve what you want as it only
Yes, this works perfectly.
It's a bit disappointing that cache variables are, for all intents and
purposes, read-only in functions. The property approach is a bit more
verbose but it functions! I think 'set' needs a new override specifically
for cases like this. Something similar to PARENT_SCOPE,
On 10/10/2011 3:52 PM, Robert Dailey wrote:
Yes, this works perfectly.
It's a bit disappointing that cache variables are, for all intents and
purposes, read-only in functions. The property approach is a bit more
verbose but it functions! I think 'set' needs a new override
specifically for cases