Given a CMakeList.txt
which I cannot edit, can I set CMAKE_TRY_COMPILE_TARGET_TYPE
to be STATIC_LIBRARY
while configuring that file?
Ideally I could do this via an environmental variable, but if that is not possible, passing in my value as a command line argument would be ok too.
I am trying to build a Conan profile that will allow me to cross build using the GNU Arm Embedded Toolchain .
Conan provides a mechanism for specifying the compiler binary and compiler + linker flags I would like CMake to use, but I need to specify set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
in order for GNU Arm Embedded to pass CMake's compiler check.
In order to get my cross build toolchain to work, then, I am left with 2 options:
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
. This is annoying because it forces all projects to have to think about being embedded. CMAKE_TRY_COMPILE_TARGET_TYPE
to CMake without editing the CMakeList.txt
. I would like to do 2.
You may be able to get the functionality you're looking for with the -D
flag.
I would try something like this: cmake -D CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.