我在ExternalProject_Add中包含一个外部项目。我想要做的是
cmake -DCMAKE_CXX_COMPILER=<some compiler> <assume correct path>
Run Code Online (Sandbox Code Playgroud)
顶级项目,以便我选择的编译器传播到外部包含的项目。我希望可以在ExternalProject_Add命令中添加一些内容:
ExternalProject_Add (
some_external_project
PREFIX ... # Assume this works.
GIT_REPOSITORY ... # Assume this works too.
# What should I write here to tell it to use the ${CMAKE_CXX_COMPILER}
# of the top-level project ?
)
Run Code Online (Sandbox Code Playgroud)
以下内容为我在顶级项目中工作:
ExternalProject_Add (
some_external_project
PREFIX ... # Assume this works.
GIT_REPOSITORY ... # Assume this works too.
# This did the trick for me.
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
)
Run Code Online (Sandbox Code Playgroud)