Hi,
I have a toolchain file that sets a custom CMAKE_SYSTEM_NAME. I also have the Platform/-Files that I need. The problem is that try_compile() cannot see those.
I tried:
cmake_minimum_required(VERSION 3.22)
set ( CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/CMakeModules/toolchain.cmake )
set ( CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/CMakeModules )
set ( CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_MODULE_PATH )
project ( MyProject LANGUAGES C )
include ( CheckIPOSupported )
check_ipo_supported ( RESULT _IPO_SUPPORTED OUTPUT IPO_SUPPORTED_CHECK_OUTPUT LANGUAGES C )
But still I get:
System is unknown to cmake, create:
Platform/XXX to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
The system itself is not of public interest. More interesting is that I also use --debug-trycompile and the IPO test does NOT have CMAKE_MODULE_PATH in its CMakeCache.txt file (CMakeFiles/_CMakeLTOTest-C/bin/CMakeCache.txt).
This means that CMAKE_TRY_COMPILE_PLATFORM_VARIABLES essentially does not work.
I also tried another variable name and this also does not appear in the try-compile cache file.
Any insights?