View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010940CMakeCPackpublic2010-07-06 02:582016-06-10 14:31
ReporterBo Thorsen 
Assigned ToKitware Robot 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionFixed in Version 
Summary0010940: Access to the -C variable
DescriptionIt's currently quite difficult to figure out the build directory in CPack with Visual Studio. It would be trivial, if the contents of the -C argument would have this. And if no -C argument is given, it should of course have the default.

Right now, you have to take the complete path to an existing target file and strip the filename to get the build directory.

If I could write something like this instead:

INSTALL(FILES ${CPACK_BUILD_DIR}/myoddfile DESTINATION...)

where ${CPACK_BUILD_DIR} would be the normal build dir for the directory, modified for the -C argument, if it's there, or otherwise have Release in it.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0024263)
Eric NOULARD (developer)
2010-12-19 06:52

Hi Bo,

In which case would you have to install
something from build dir you don't know ?
Doesn't

INSTALL(FILES myoddfile DESTINATION...)

work as expected if the command is in inside the appropriate CMakeLists.txt?

If it doesn't did you try using "CMAKE_CFG_INTDIR", like in:

INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/myoddfile DESTINATION...)

Now if your INSTALL command is done in a script launched by CMake (and not directly in some CMakeLists.txt) then
$ENV{CMAKE_CONFIG_TYPE} should contain the value of the -C argument
or nothing if none was specified, so you should be able to build
CPACK_BUILD_DIR with something like:

set(config_type $ENV{CMAKE_CONFIG_TYPE})
if (MSVC)
if(config_type)
  set(CPACK_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/${config_type}")
else(config_type)
  set(CPACK_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/Release")
endif(config_type)
endif(MSVC)
(0033230)
Mark Stijnman (reporter)
2013-06-04 09:21

I ended up here when searching for the same information, because I want to use the build configuration name in the package name. While this is a different use case than the original submitter, I'm posting my solution here for those who are searching for the same: the information from -C is available in the variable CPACK_BUILD_CONFIG. Note that this variable is only available inside your project-specific CPack configuration file (as specified by CPACK_PROJECT_CONFIG_FILE).

This is not in the documentation, as far as I could tell. I found this from studying the source code, and doing some experimentation. So since this is currently an undocumented feature, I don't know if we can depend on this in the future. Maybe this should be made an officially supported feature, and have it added to the documentation? That should completely address this ticket, in my view.
(0041723)
Kitware Robot (administrator)
2016-06-10 14:28

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
2010-07-06 02:58 Bo Thorsen New Issue
2010-12-19 06:52 Eric NOULARD Note Added: 0024263
2011-01-17 15:06 David Cole Assigned To => David Cole
2011-01-17 15:06 David Cole Status new => assigned
2011-10-25 22:56 David Cole Assigned To David Cole =>
2011-10-25 22:56 David Cole Status assigned => backlog
2013-06-04 09:21 Mark Stijnman Note Added: 0033230
2016-06-10 14:28 Kitware Robot Note Added: 0041723
2016-06-10 14:28 Kitware Robot Status backlog => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:28 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team