View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014279CMakeCMakepublic2013-07-08 10:562016-06-10 14:31
Reporterdbcfd 
Assigned ToKitware Robot 
PrioritylowSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product VersionCMake 2.8.11.2 
Target VersionFixed in Version 
Summary0014279: cmake should diagnose when no project() is invoked in the top directory
DescriptionIf a top level CMakeLists.txt does not have a project() command, but it has a macro which includes a project() command that is never called, cmMakefile.cxx will see that as a project() command.

Behavior for the Visual Studio generator, without macro:
* Solution project.sln is created

Behavior for the Visual Studio generator, with macro, no project command:
* No solution file created
* No errors/warnings
* Only project file created

Behavior for the Visual Studio generator, with macro, project command in include()'d file
* Solution file generated with desired name
* Cache variables set appropriately so they can be set prior to project() command
* No errors/warnings
Steps To ReproduceSee attached file.
Additional InformationSee 0014269 for more information (http://public.kitware.com/Bug/view.php?id=14269 [^]).

This is a result of line 650 in cmMakefile.cxx, which looks for any project() command in the top level file, even if that command is within a macro/function that is not called.
TagsNo tags attached.
Attached Fileszip file icon Reproduce.zip [^] (861 bytes) 2013-07-08 10:56

 Relationships
related to 0014278closed Adjust include() documentation to mirror changes to project() documentation 

  Notes
(0033507)
Brad King (manager)
2013-07-08 11:25

This is intentional. It can even be

    $ cat CMakeLists.txt
    if(0)
      project(Fake)
    endif()
    include(ModuleCallingProject)

The reason is that we want to support the hello-world use case of

    $ cat CMakeLists.txt
    add_executable(hello hello.c)

without requiring newcomers to learn the project() command so we insert one syntactically if there isn't a literal one. If we see project() anywhere then we assume the author knows about it.
(0033508)
Brad King (manager)
2013-07-08 11:28

The auto-insertion of project() at the top must be done before running the code because the inserted one must run first. Therefore this must be based on literal appearance of project().

What we can diagnose instead is that after configuration we have not seen any project() invocation in the top-level directory at all, included or otherwise.
(0033513)
dbcfd (reporter)
2013-07-08 17:46

> What we can diagnose instead is that after configuration we have not seen any project() invocation in the top-level directory at all, included or otherwise.

The other two behaviors seem correct (based on previous conversations), but it does seem if there is no project() invocation, a warning or failure to configure should occur.
(0042315)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2013-07-08 10:56 dbcfd New Issue
2013-07-08 10:56 dbcfd File Added: Reproduce.zip
2013-07-08 11:25 Brad King Note Added: 0033507
2013-07-08 11:28 Brad King Note Added: 0033508
2013-07-08 11:29 Brad King Status new => backlog
2013-07-08 11:29 Brad King Summary Project() command is incorrectly seen in cmMakefile.cxx if command() is in macro => cmake should diagnose when no project() is invoked in the top directory
2013-07-08 11:32 Brad King Relationship added related to 0014278
2013-07-08 17:46 dbcfd Note Added: 0033513
2016-06-10 14:29 Kitware Robot Note Added: 0042315
2016-06-10 14:29 Kitware Robot Status backlog => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team