View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0013462 | CMake | CMake | public | 2012-08-07 20:50 | 2013-01-09 10:55 | ||||
Reporter | Benjamin kay | ||||||||
Assigned To | David Cole | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | no change required | ||||||
Platform | Debian (unstable) | OS | Linux | OS Version | 3.2.0-3-amd64 | ||||
Product Version | CMake 2.8.8 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0013462: set_target_properties include_directories should accept multiple parameters | ||||||||
Description | The set_target_properties command can be used to set properties on a library or executable. One of the properties that can be set is INCLUDE_DIRECTORIES, which is discussed on the mailing list: http://www.cmake.org/pipermail/cmake/2009-June/030429.html [^] The ability to set INCLUDE_DIRECTORIES on a specific target without setting it on an entire directory (i.e. with the include_directories command) is useful; see related bugs 0008189 and 0001968. Unfortunately, it appears that only one include directory can be set in this way. Take a simple test project: project(TESTPROJECT) add_executable(test test.c) set_target_properties(test PROPERTIES INCLUDE_DIRECTORIES /var /tmp) Obviously there's no need to include anything from /var or /tmp -- they're just there to illustrate the following error that occurs when running cmake: CMake Error at CMakeLists.txt:3 (set_target_properties): set_target_properties called with incorrect number of arguments. The following alternative syntax appears to work, but running make with VERBOSE=1 reveals that only the last directory included (/tmp in this case) is actually included. /var is not included. project(TESTPROJECT) add_executable(test test.c) set_target_properties(test PROPERTIES INCLUDE_DIRECTORIES /var INCLUDE_DIRECTORIES /tmp) Other variations such as the following also fail (incorrect number of arguments): project(TESTPROJECT) add_executable(test test.c) set(LIST_OF_DIRECTORIES /var) list(APPEND LIST_OF_DIRECTORIES /tmp) set_target_properties(test PROPERTIES INCLUDE_DIRECTORIES ${LIST_OF_DIRECTORIES}) For set_target_properties(target PROPERTIES INCLUDE_DIRECTORIES ...) to be truly useful, it should be able to accept multiple parameters. | ||||||||
Additional Information | The version of CMake installed on my system is actually 2.8.9-rc3, not 2.8.8. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0030187) Rolf Eike Beer (developer) 2012-08-08 02:46 |
I will bet it's a list, so this should work: set_target_properties(test PROPERTIES INCLUDE_DIRECTORIES /var;/tmp) |
(0030188) Stephen Kelly (developer) 2012-08-08 03:42 |
Another one that works is set_property(TARGET foo PROPERTY INCLUDE_DIRECTORIES ${LIST_OF_DIRECTORIES}) Note that you shouldn't create test targets called 'test' generally because it confuses ctest. It's better to get used to not doing so. |
(0030189) David Cole (manager) 2012-08-08 06:58 |
Please see the other notes for more information. As noted: Prefer "set_property' for passing multiple values to a property. Or simply use a list as a single argument to the existing set_target_properties. |
(0030190) Benjamin kay (reporter) 2012-08-08 08:21 |
Thank you, Stephen Kelley has the right idea here. SET_PROPERTY(TARGET <target> PROPERTY <name> [value1 [value2 ...]]) Is the correct way to set a target property with multiple values. A careful re-reading of the documentation actually gives no indication that SET_TARGET_PROPERTIES() can do this at all. Rolf Eike Beer and David Cole, have you actually tried your suggestions to use semicolon-separated lists with SET_TARGET_PROPERTIES()? I have tried this and it does not work for me. If you feel it should work then please consider re-opening the bug, otherwise feel free to mark as invalid or resolved. |
(0030191) Brad King (manager) 2012-08-08 08:26 |
Re 0013462:0030190: Eike's suggestion is almost correct. You need to quote the argument to prevent it from getting split: set_target_properties(test PROPERTIES INCLUDE_DIRECTORIES "/var;/tmp") Unquoted arguments are divided on semicolons into multiple separate arguments. This is standard CMake syntax and is not specific to this command. |
(0032011) Robert Maynard (manager) 2013-01-09 10:55 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2012-08-07 20:50 | Benjamin kay | New Issue | |
2012-08-08 02:46 | Rolf Eike Beer | Note Added: 0030187 | |
2012-08-08 03:42 | Stephen Kelly | Note Added: 0030188 | |
2012-08-08 06:57 | David Cole | Assigned To | => David Cole |
2012-08-08 06:57 | David Cole | Status | new => assigned |
2012-08-08 06:58 | David Cole | Note Added: 0030189 | |
2012-08-08 06:58 | David Cole | Status | assigned => resolved |
2012-08-08 06:58 | David Cole | Resolution | open => no change required |
2012-08-08 08:21 | Benjamin kay | Note Added: 0030190 | |
2012-08-08 08:21 | Benjamin kay | Status | resolved => feedback |
2012-08-08 08:21 | Benjamin kay | Resolution | no change required => reopened |
2012-08-08 08:26 | Brad King | Note Added: 0030191 | |
2012-08-08 08:26 | Brad King | Status | feedback => resolved |
2012-08-08 08:26 | Brad King | Resolution | reopened => no change required |
2013-01-09 10:55 | Robert Maynard | Note Added: 0032011 | |
2013-01-09 10:55 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |