try_compile: Add whole-project signature option to forward toolchain settings
The try_compile
command has two signatures:
-
The "Source Files" signature takes a source file, generates a source tree with a
CMakeLists.txt
file, configures and generates a build tree, and then tries building. -
The "Whole Project" signature takes a source tree and build tree, configures and generates a build system, and then tries building.
The "Source Files" signature automatically forwards CMAKE_OSX_ARCHITECTURES
, CMAKE_OSX_SYSROOT
, CMAKE_OSX_DEPLOYMENT_TARGET
, and similar settings that configure the toolchain. The "Whole Project" signature does not forward these settings, but we have use cases where doing so would be helpful (such as in FortranCInterface
). We should consider adding an option and/or policy to forward these settings in the "Whole Project" signature.