On 04/28/2015 10:57 AM, Gregor Jasny wrote:
Unfortunately the CPACK_BUILD_CONFIG approach does only work for
multi-config generators. As far as I understand CPACK_BUILD_CONFIG gets
only set if the -C command line option was given to cpack. But this
option is only added conditionally and omitted for Makefile builds:

void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
...
  if ( cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.' )
    {
    singleLine.push_back("-C");
    singleLine.push_back(cmakeCfgIntDir);
    }

Now I'm just wondering if conditionally setting -C / CPACK_BUILD_CONFIG
is the right thing to do?

I don't know ... but as a local workaround you might be able to set CPACK_BUILD_CONFIG before include(CPack) conditionally when using single-configuration generators.

Assuming nothing else messes with CMAKE_BUILD_TYPE when using multi-configuration generators e.g.:

  if(CMAKE_BUILD_TYPE)
    set(CPACK_BUILD_TYPE ${CMAKE_BUILD_TYPE})
  endif()

  include(CPack)

Nils
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to