When I use target_precompile_headers() in visual studio I will get the following structure:
+-- Precompile Header File
| |
| +-- cmake_pch.hxx
| +-- cmake_pch.hxx
| +-- cmake_pch.hxx
| +-- cmake_pch.hxx
+-- Source Files
| |
| +-- cmake_pch.cxx
Calling source_group() after this method doesn't work. How do I group these files together?
For example you can make:
source_group("Generated Files" FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${PROJECT_NAME}.dir/cmake_pch.cxx)
foreach(config_type ${CMAKE_CONFIGURATION_TYPES})
source_group("Generated Files" FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${PROJECT_NAME}.dir/${config_type}/cmake_pch.hxx)
endforeach()
There is no cmake variable than contains the path to CMakeFiles/${PROJECT_NAME}.dir, hence the above usage rather is a hack.
The result:
Generated Files
|
+-- cmake_pch.cxx
+-- cmake_pch.hxx
+-- cmake_pch.hxx
+-- cmake_pch.hxx
+-- cmake_pch.hxx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With