View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012960CMakeCMakepublic2012-02-13 07:302014-10-06 10:32
ReporterDimitri Merejkowsky 
Assigned ToNils Gladitz 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0012960: CMake should reject targets with reserved names like "test"
DescriptionCMake error out when trying to installing a target named 'test' in
enable_testing() is called


Steps To ReproduceCreate a new project with the following CMakeLists.txt and an empty
test.cpp file

cmake_minimum_required(VERSION 2.8)
project(cmake_bug)
enable_testing()

add_executable(test test.cpp)
install(TARGETS test
  RUNTIME DESTINATION bin)

Run CMake:

WARNING: Target "test" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it. CMake does not define behavior for this case.
CMake Internal Error (please report a bug) in CMakeLists.txt:
  cmTarget::GetOutputInfo called for test which has type GLOBAL_TARGET

TagsNo tags attached.
Attached Files

 Relationships
related to 0008438closedKitware Robot add_dependencies() for "build-in cmake targets" 
related to 0006348closedKitware Robot custom global targets (targets which when built from the root build all targets with the same name in subdirs) 

  Notes
(0028569)
Brad King (manager)
2012-02-13 08:59

The "make test" target is to run tests. You can't add another target with that name. If you want an executable named "test" then use another target and set its OUTPUT_NAME property:

 add_executable(mytest test.cpp)
 set_property(TARGET mytest PROPERTY OUTPUT_NAME test)
(0028571)
Dimitri Merejkowsky (reporter)
2012-02-13 09:07

Yeah I know.

But should not I get an error message when I try to create the target 'test' ?

(something like:

-- add_executable called with a reserved target name "test"
   If you want an executable named "test" then use another target and set its OUTPUT_NAME property:
   
   add_executable(mytest test.cpp)
   set_property(TARGET mytest PROPERTY OUTPUT_NAME test)

) ?
(0035223)
Nils Gladitz (developer)
2014-03-02 14:56

This is now covered by policy CMP0037.
(0036922)
Robert Maynard (manager)
2014-10-06 10:32

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

 Issue History
Date Modified Username Field Change
2012-02-13 07:30 Dimitri Merejkowsky New Issue
2012-02-13 08:59 Brad King Note Added: 0028569
2012-02-13 09:07 Dimitri Merejkowsky Note Added: 0028571
2012-02-13 09:47 Brad King Status new => backlog
2012-02-13 09:47 Brad King Summary Cannot install a target named 'test' => CMake should reject targets with reserved names like "test"
2012-02-13 09:48 Brad King Relationship added related to 0008438
2012-02-13 09:49 Brad King Relationship added related to 0006348
2014-03-02 14:56 Nils Gladitz Note Added: 0035223
2014-03-02 14:56 Nils Gladitz Status backlog => resolved
2014-03-02 14:56 Nils Gladitz Resolution open => fixed
2014-03-02 14:56 Nils Gladitz Assigned To => Nils Gladitz
2014-10-06 10:32 Robert Maynard Note Added: 0036922
2014-10-06 10:32 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team