[CMake] Error if CMAKE_SYSTEM_NAME is placed wrongly

Chuck Atkins chuck.atkins at kitware.com
Wed May 18 11:45:39 EDT 2016


> when I place set(CMAKE_SYSTEM_NAME Generic) after cmake_minimum_required()
> and project() and set(VERSION_MAYOR/MINOR),
>

CMAKE_SYSTEM_NAME really shouldn't be in a CMakeLists.txt file at all.  It
should instead be in a stand alone toolchain file defining your various
cross-compiling requirements and then passed to cmake with
-DCMAKE_TOOLCHAIN_FILE=/path/to/Toolchain.cmake.  CMake has certain rules
for when the toolchain file get's loaded very early on and processed to
make sure that the subsequent processing of the CMakeLists.txt is done with
the appropriate platform and compiler information set.

- Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160518/0d15bc7e/attachment.html>


More information about the CMake mailing list