View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015753CMakeCMakepublic2015-09-21 08:492016-02-01 09:10
Reporterdanilcha 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionduplicate 
PlatformApple MacOSOS XOS Version10.9.5
Product VersionCMake 3.3.1 
Target VersionFixed in Version 
Summary0015753: CMake cannot detect changes in nested header files when using '-iquote'
DescriptionCreate a new project with such CMakeLists.txt:

cmake_minimum_required(VERSION 3.3)
project(test)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -iquote ${CMAKE_CURRENT_SOURCE_DIR}")
add_executable(test-iquote main.cpp dir/1.h dir/2.h)

And such structure:

CMakeLists.txt
Main.cpp (contains #include "dir/1.h")
dir\
    1.h (contains #include "dir/2.h")
    2.h

Build. Then modify 2.h. Build again. Nothing will happen, it will just say '[100%] Built target test-iquote'.
Additional InformationTried with both clang and GCC. GNU Make 3.81.
TagsNo tags attached.
Attached Files

 Relationships
duplicate of 0015491closedKitware Robot First-class support for GNU -iquote, -I- and -I=opt/foo include directory specifiers 

  Notes
(0039454)
Brad King (manager)
2015-09-21 08:52

CMake does not try to interpret include flags that are not specified through the include_directories or target_include_directories commands. Therefore the Makefile generator dependency scanner does not know about the specified directory.

The Ninja generator should work because it asks the compiler to report dependency information, and that has the full command line.
(0039455)
danilcha (reporter)
2015-09-21 08:58

Also tried with gmake 4.1, the same results.
(0039456)
danilcha (reporter)
2015-09-21 09:05

Brad Kind, thank you! But what is Ninja generator and how to use it? I'm not using the CMake directly, I'm using it though CLion, and at he moment they encourage to use -quote (http://blog.jetbrains.com/clion/2015/08/new-clion-1-1-eap-project-scopes-cmake-targets-and-other-changes/ [^]).

I opened a CLion ticket (https://youtrack.jetbrains.com/issue/CPP-4565 [^]), they said they are fixing the problem in another way, so maybe this issue won't be that important for CLion users soon.
(0039457)
Brad King (manager)
2015-09-21 09:11

> But what is Ninja generator and how to use it?

When running CMake directly in a fresh build tree one can specify a generator, e.g.

 cmake ../src -GNinja

That will generate build files for the "ninja" build tool instead of "make".

If you're using CMake through CLion then I don't know whether the generator can be selected in this way.
(0039458)
danilcha (reporter)
2015-09-21 09:12

Brad Kind, agha, Ninja is an alternative to 'make', it is even possible to use it with CLion: http://www.mergeconflict.net/2014/11/speeding-up-clion-build-times-with.html, [^] though not very reliably, because is requires manual edit of CMakeCache.
(0039459)
Brad King (manager)
2015-09-21 09:12

I'm resolving this as a duplicate of 0015491 because that issue covers the underlying problem of supporting -iquote. That issue is actually linked from the article linked in 0015753:0039456.
(0039460)
danilcha (reporter)
2015-09-21 09:13

OK, thank you!
(0040412)
Robert Maynard (manager)
2016-02-01 09:10

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

 Issue History
Date Modified Username Field Change
2015-09-21 08:49 danilcha New Issue
2015-09-21 08:52 Brad King Note Added: 0039454
2015-09-21 08:58 danilcha Note Added: 0039455
2015-09-21 09:05 danilcha Note Added: 0039456
2015-09-21 09:11 Brad King Note Added: 0039457
2015-09-21 09:11 Brad King Relationship added duplicate of 0015491
2015-09-21 09:12 danilcha Note Added: 0039458
2015-09-21 09:12 Brad King Note Added: 0039459
2015-09-21 09:12 Brad King Status new => resolved
2015-09-21 09:12 Brad King Resolution open => duplicate
2015-09-21 09:13 danilcha Note Added: 0039460
2016-02-01 09:10 Robert Maynard Note Added: 0040412
2016-02-01 09:10 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team