View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015225CMakeCMakepublic2014-10-28 13:422015-04-06 09:07
ReporterIlya 
Assigned ToBrad King 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformAppleOSMac OS XOS Version10.10
Product VersionCMake 3.0.2 
Target VersionCMake 3.1Fixed in VersionCMake 3.1 
Summary0015225: Clarify add_compile_options command documentation
DescriptionThe flags specified via add_compile_options do not appear anywhere in generated Xcode project (I use Xcode 6)

In other hand, options specified via the add_definitions command will be properly placed under the OTHER_CFLAGS Xcode attribute. Moreover, generator seems to categorize these flags and put them under appropriate Xcode attributes.

E.g.

    add_definitions(
        -DHAVE_PTHREADS
        -Wduplicate-method-match
    )

-DHAVE_PTHREADS will be added to the GCC_PREPROCESSOR_DEFINITIONS Xcode attribute while -Wduplicate-method-match will be added to the OTHER_CFLAGS Xcode attribute.
TagsNo tags attached.
Attached Fileszip file icon TestCMake.zip [^] (100,266 bytes) 2014-10-28 16:23

 Relationships

  Notes
(0037089)
Brad King (manager)
2014-10-28 14:12

I cannot reproduce this. Our test suite covers add_compile_options and passes on Xcode.

Please provide an example CMakeLists.txt that shows the failure.
(0037090)
Ilya (reporter)
2014-10-28 16:24

I uploaded both CMakeLists.txt and generated Xcode project.
(0037094)
Nils Gladitz (developer)
2014-10-28 18:19

add_compile_options() populates the COMPILE_OPTIONS directory property.

When a target is created (e.g. add_executable()) these options are copied into the COMPILE_OPTIONS target property.

The attached test project sets the options after the target has been created which is why they don't take effect.
(0037098)
Brad King (manager)
2014-10-29 09:23

Re 0015225:0037094: Correct. However, it looks like the documentation could be clearer on this. Updated:

 Help: Clarify add_compile_options documentation
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9f8c50a [^]
(0037101)
Ilya (reporter)
2014-10-29 13:18

But it seems to work for add_definitions. I though add_compile_options is just a specific version of add_definitions. Why does it work in one case but not in the other?
(0037103)
Brad King (manager)
2014-10-29 14:49

Re 0015225:0037101: add_definitions was one of the earliest commands so its behavior has been kept for compatibility. The add_compile_options command is quite new and uses what we've learned from experience over the years. It is better for a target to use directory-level settings to initialize its main build properties upon creation but then not pay attention to them anymore. That way a target can be modified independent of further directory-level settings with the target_* commands or direct target property settings.
(0037104)
Ilya (reporter)
2014-10-29 15:16

If you're going to maintain this compatibility it would make sense to specify it command description.
(0037105)
Brad King (manager)
2014-10-29 15:25

Re 0015225:0037104: I've updated the add_definitions docs:

 Help: Reference add_compile_options from add_definitions
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=352cbb6e [^]
(0038435)
Robert Maynard (manager)
2015-04-06 09:07

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-10-28 13:42 Ilya New Issue
2014-10-28 14:12 Brad King Note Added: 0037089
2014-10-28 16:23 Ilya File Added: TestCMake.zip
2014-10-28 16:24 Ilya Note Added: 0037090
2014-10-28 18:19 Nils Gladitz Note Added: 0037094
2014-10-29 09:23 Brad King Note Added: 0037098
2014-10-29 09:23 Brad King Target Version => CMake 3.2
2014-10-29 09:23 Brad King Summary Xcode generator ignores the add_compile_options command => Clarify add_compile_options command documentation
2014-10-29 13:18 Ilya Note Added: 0037101
2014-10-29 14:49 Brad King Note Added: 0037103
2014-10-29 15:16 Ilya Note Added: 0037104
2014-10-29 15:25 Brad King Note Added: 0037105
2014-10-30 14:20 Brad King Status new => resolved
2014-10-30 14:20 Brad King Resolution open => fixed
2014-10-30 14:20 Brad King Fixed in Version => CMake 3.2
2014-10-31 11:41 Brad King Assigned To => Brad King
2014-10-31 11:41 Brad King Fixed in Version CMake 3.2 => CMake 3.1
2014-10-31 11:41 Brad King Target Version CMake 3.2 => CMake 3.1
2015-04-06 09:07 Robert Maynard Note Added: 0038435
2015-04-06 09:07 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team