change compiler in CMAKE sub_directory CMakeLists.txt file

后端 未结 2 504
暗喜
暗喜 2021-01-12 15:12

I would like to change CMAKE_C_COMPILER and CMAKE_CXX_COMPILER in an inner sub_directory being compiled as part of a bigger project.

changing from GNU to intel compi

相关标签:
2条回答
  • 2021-01-12 15:42

    Instead of using add_subdirectory consider making the subdirectory a self-contained CMake project, which can be configured and built independently of the bigger project. You can then add the subdirectory to your bigger project as an external project by using the ExternalProject_Add command.

    0 讨论(0)
  • 2021-01-12 15:52

    It depends, how you organize your project. If it is not single CMakeLists.txt for whole project, but one per each sub folder - just try to change CMAKE_C_COMPILER before project() definition. It should affect only this project definition.

    0 讨论(0)
提交回复
热议问题