You can use `file(GENERATE` and the `$<CONFIG>` generator expression.

Here is an example:
https://gitlab.kitware.com/cmake/cmake/blob/v3.12.1/Tests/CudaOnly/ExportPTX/CMakeLists.txt#L13
On Thu, Aug 23, 2018 at 1:47 PM Michael Jackson
<mike.jack...@bluequartz.net> wrote:
>
> I would like to copy some files from my source dir into my binary RUNTIME_DIR 
> based on the current configuration being compiled. For generators like 
> “makefiles” and “ninja” this is easy and straight forward. I am having an 
> issue getting my head wrapped around how to use CMAKE_CFG_INTDIR properly.
>
>
>
> I know I can’t do this a cmake time so I tried the following:
>
>
>
> During CMake time write out another CMake file:
>
>
>
>   file(APPEND "${PYSIMPL_SCRIPT_COPY_RULE}"
>
>     "execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
>
>       \"${SIMPLPyBind11_SOURCE_DIR}/../Testing/${script}\"
>
>       
> \"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/\${CMAKE_CFG_INTDIR}/python/site-packages/${script}\")\n"
>
>   )
>
>
>
> Which creates entries like this in the written .cmake file:
>
>
>
> execute_process(COMMAND 
> C:/DREAM3D_SDK/cmake-3.12.0-rc2-win64-x64/bin/cmake.exe -E copy_if_different
>
>       
> "C:/Users/mjackson/DREAM3D-Dev/DREAM3D/ExternalProjects/SIMPL/Wrapping/Python/Pybind11/../Testing/AbstractFilterTest.py"
>
>       
> "C:/Users/mjackson/DREAM3D-Dev/DREAM3D-Builds/x64/Bin/${CMAKE_CFG_INTDIR}/python/site-packages/AbstractFilterTest.py")
>
>
>
> Which does not work. The files end up in 
> ${BUILD_DIR}/Bin/python/site-packages/. I need them to end up in 
> ${BUILD_DIR}/Bin/Release/python/site-packages for a Release build. Same for 
> Debug…
>
>
>
> Could someone tell me what I am doing wrong or the proper way to go about 
> this? I am about ready to write a simple C++ program to do the copy for me 
> (which seems ludicrous to have to do..)
>
> --
>
> Michael Jackson | Owner, President
>
>       BlueQuartz Software
>
> [e] mike.jack...@bluequartz.net
>
> [w] www.bluequartz.net
>
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
-- 

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:
https://cmake.org/mailman/listinfo/cmake

Reply via email to