Notes |
|
(0028551)
|
James Bigler
|
2012-02-10 02:16
|
|
Not that I'm suggesting CMake doesn't need this, but I've worked around this particular issue with my FindCUDA.cmake module by having a CMake script that is run by the build. The CMake script takes as one of its arguments the current configuration, and then the script decides how to interpret that.
in FindCUDA.cmake:
if(CMAKE_GENERATOR MATCHES "Visual Studio")
set( CUDA_build_configuration "$(ConfigurationName)" )
else()
set( CUDA_build_configuration "${CMAKE_BUILD_TYPE}")
endif()
add_custom_command(
OUTPUT ${generated_file}
COMMAND ${CMAKE_COMMAND} ARGS
-D build_configuration:STRING=${CUDA_build_configuration}
...
And then in the script (FindCUDA/run_nvcc.cmake):
if(NOT build_configuration)
set(build_configuration Debug)
endif()
string(TOUPPER "${build_configuration}" build_configuration)
I can then use the build_configuration variable to look for configuration dependent information:
foreach(flag ${CMAKE_HOST_FLAGS} ${CMAKE_HOST_FLAGS_${build_configuration}})
# Extra quotes are added around each flag to help nvcc parse out flags with spaces.
set(nvcc_host_compiler_flags "${nvcc_host_compiler_flags},\"${flag}\"")
endforeach() |
|
|
(0028886)
|
Brad King
|
2012-03-09 14:52
|
|
Resolving as duplicate of 0009974 now that it has been reopened.
Re 0012945:0028551: You can use the $<CONFIGURATION> generator expression in the custom command arguments to pass the configuration to the script independent of the generator. |
|
|
(0030834)
|
David Cole
|
2012-09-03 16:00
|
|
Closing resolved issues that have not been updated in more than 4 months. |
|