View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0009590 | CMake | CMake | public | 2009-09-24 02:24 | 2010-12-14 18:49 | ||||
Reporter | Rolf Eike Beer | ||||||||
Assigned To | David Cole | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | won't fix | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake-2-6 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0009590: IF(VARIABLE) doesn't work inside Makro | ||||||||
Description | I'll attach a CMakeLists.txt that is a stripped down version of one of our makros where it took me some hours only to find out that IF(VARIABLE) simply doesn't work inside the makro even if the variable is set. | ||||||||
Additional Information | Example output (running on Win32 using CMake 2.6.4) -- BASE_DIR IS NOT! /usr/local/lib -- BASE_DIR IS NOT! /usr/local/lib -- BASE_DIR IS NOT! /usr/local/lib -- BASE_DIR IS! -- Lib_dirs: /usr/local/lib -- TESTVAR IS! -- TESTVAR IS! -- TESTVAR IS NOT! /usr/local/lib -- TESTVAR IS! | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | CMakeLists.txt [^] (1,467 bytes) 2009-09-24 02:25 [Show Content] | ||||||||
Relationships | ||||||
|
Relationships |
Notes | |
(0017743) David Cole (manager) 2009-09-25 11:50 |
This behavior is intentional and the way that CMake works. Macro arguments are not CMake variables. They are substituted when dereferenced inside a macro, but the argument names used in the MACRO command are not CMake variables. They can become CMake variables inside the macro if you do something like this at the very top of the macro: SET(BASE_DIR "${BASE_DIR}") SET(LIB_DIR "${LIB_DIR}") Alternatively, you can change the MACRO to a FUNCTION. Function arguments *do* become CMake variables for the scope of the function... From the cmake MACRO documentation: http://www.cmake.org/cmake/help/cmake2.6docs.html#command:macro [^] "Note that the parameters to a macro and values such as ARGN are not variables in the usual CMake sense. They are string replacements much like the c preprocessor would do with a macro. If you want true CMake variables you should look at the function command." |
(0024084) David Cole (manager) 2010-12-14 18:49 |
Closing bugs that have been resolved for more than 3 months without any further updates. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2009-09-24 02:24 | Rolf Eike Beer | New Issue | |
2009-09-24 02:25 | Rolf Eike Beer | File Added: CMakeLists.txt | |
2009-09-25 11:45 | David Cole | Status | new => assigned |
2009-09-25 11:45 | David Cole | Assigned To | => David Cole |
2009-09-25 11:50 | David Cole | Note Added: 0017743 | |
2009-09-25 11:50 | David Cole | Status | assigned => resolved |
2009-09-25 11:50 | David Cole | Resolution | open => won't fix |
2010-12-14 18:49 | David Cole | Note Added: 0024084 | |
2010-12-14 18:49 | David Cole | Status | resolved => closed |
2011-08-12 10:36 | David Cole | Relationship added | has duplicate 0012398 |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |