[CMake] Fwd: Can I choose toolchain file in CMakeLists.txt?
乃宏周
naive231 at gmail.com
Mon Dec 30 00:21:11 EST 2013
I know cross-platform toolchain should be set in a toolchain.cmake and use
it like this:
*cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake .*
I don't want a LONG command like that. I want another check_platform.cmake
to encapsulate those dirty process, then my project can just include
check_platform.cmake to go:
=== check_platform.cmake ===
if(WIN32)
# something need to be configed previously.
include(win32_toolchain.cmake) # setting win32 platform toolchains.
elseif(UNIX)
# something need to be configed previously.
include(arm_toolchain.cmake) # setting arm platform toolchains.
endif()
=== CMakeLists.txt in my project ===
include(check_platform.cmake)
# settings of my project.
I tried it already, but I found that cmake still seeks the native os
toolchains FIRST(--- check for working CXX compiler:/usr/bin/c++ ---
works), then override CMAKE_CXX_COMPILER with my arm_toolchain.cmake
settings, and thats incorrect at all. Instead, if I enter that LONG
command: *cmake -DCMAKE_TOOLCHAIN_FILE=arm_toolchain.cmake . *It will
use(check) my compiler setting completly. Is anything wrong of my
architeture?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131230/80862c25/attachment.htm>
More information about the CMake
mailing list