View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014702CMake(No Category)public2014-01-16 06:392014-06-02 08:38
ReporterMattes D 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformWindows AnyOSWindowsOS VersionAny
Product VersionCMake 2.8.11.2 
Target VersionFixed in Version 
Summary0014702: PREFIX property is ignored for Visual Studio 2010+ generators
DescriptionThe Visual Studio 2010+ generator, as implemented in cmVistualStudio10Target.cpp, seems to half-ignore the setting of the PREFIX property. The executable is built without this prefix, although the PDB files do contain the prefix.

The Visual Studio 2008 and lower generators do handle the property as expected, which brings even more chaos.
Steps To ReproduceWe use the following code in our CMakeLists.txt:

```
add_executable(${EXECUTABLE} ${SOURCE})

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
set_target_properties(${EXECUTABLE} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)

if (MSVC)
    # MSVC generator adds a "Debug" or "Release" postfixes to the EXECUTABLE_OUTPUT_PATH, we need to cancel them:
    SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES PREFIX "../")
    SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES IMPORT_PREFIX "../")
endif()
```

In the MSVC2008 generator the executable correctly generates in the $/bin/ folder; MSVC2010+ generators generate the executable in $/bin/<configuration>/ folder instead.
Additional InformationThe full CMakeLists.txt is available at https://github.com/mc-server/MCServer/blob/d67cd8dafc9d87fc5f26fd40c965e4234ac0f3b1/CMakeLists.txt [^]

The project using this file is at GitHub: https://github.com/mc-server/MCServer [^]

We actually test on MSVC2013, but this part of the projectfile generation seems to be shared among 2010, 2012 and 2013 in CMake sources.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0034952)
Brad King (manager)
2014-01-16 09:46

The PREFIX "../" trick for avoiding per-config subdirectories was never officially documented or supported. It just happened to work due to implementation details of the VS <= 9 generators.

Since CMake 2.8.2 you can set a per-config output directory:

http://www.cmake.org/cmake/help/v2.8.12/cmake.html#prop_tgt:RUNTIME_OUTPUT_DIRECTORY_CONFIG [^]
(0036084)
Robert Maynard (manager)
2014-06-02 08:38

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

 Issue History
Date Modified Username Field Change
2014-01-16 06:39 Mattes D New Issue
2014-01-16 09:46 Brad King Note Added: 0034952
2014-01-16 09:46 Brad King Status new => resolved
2014-01-16 09:46 Brad King Resolution open => no change required
2014-06-02 08:38 Robert Maynard Note Added: 0036084
2014-06-02 08:38 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team