Am 2012-08-01 08:53, schrieb Collin Eggert:
Hello,
I am working with cross-compiling code using CMake. I am able to get
the following CMakeLists.txt to work:
# ----------
SET(CMAKE_TOOLCHAIN_FILE ../toolchain/Prizm.cmake)
project(example1)
file(GLOB EXAMPLE1_SRC "src/example1/*.c*")
add_executable(example1 ${EXAMPLE1_SRC})
# ----------
Don't use file(GLOB) for source files. See the documentation.
This works just fine, everything is fine when I watch the output of
`make VERBOSE=1`. Now, I need to compile multiple targets. I tried
the following:
# ----------
SET(CMAKE_TOOLCHAIN_FILE ../toolchain/Prizm.cmake)
project(example1)
project(example2)
file(GLOB EXAMPLE1_SRC "src/example1/*.c*")
file(GLOB EXAMPLE2_SRC "src/example2/*.c*")
add_executable(example1 ${EXAMPLE1_SRC})
add_executable(example2 ${EXAMPLE2_SRC})
# ----------
However, when I look at the readout from `make VERBOSE=1`, I notice
that for one project, CMAKE_C_FLAGS/CMAKE_CXX_FLAGS/etc. are all set
and are used when compiling. When it gets the the other project,
these variables are reset to being empty. Below is the
toolchain/Prizm.cmake file:
Just drop the second project call, you don't need it.
eike
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake