[CMake] cross compiling not working for me

Rami Jiossy sramij at gmail.com
Sat Dec 15 13:46:01 EST 2012


I am try to follow instructions at "Using executables in the build created
during the build" from the site "
http://www.vtk.org/Wiki/CMake_Cross_Compiling";

# when crosscompiling import the executable targets from a file
IF(CMAKE_CROSSCOMPILING)
  SET(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Point
it to the export file from a native build")
  INCLUDE(${IMPORT_EXECUTABLES})
ENDIF(CMAKE_CROSSCOMPILING)

...


# only build the generator if not crosscompiling
IF(NOT CMAKE_CROSSCOMPILING)
   ADD_EXECUTABLE(mygenerator mygen.cpp)
   TARGET_LINK_LIBRARIES(mygenerator ${SOME_LIBS})
ENDIF(NOT CMAKE_CROSSCOMPILING)

# then use the target name as COMMAND, CMake >= 2.6 knows how to handle this
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated.c
                   COMMAND mygenerator foo.dat -o
${CMAKE_CURRENT_BINARY_DIR}/generated.c
                   DEPENDS foo.dat )


...
# export the generator target to a file, so it can be imported (see
above) by another build
# the IF() is not necessary, but makes the intention clearer
IF(NOT CMAKE_CROSSCOMPILING)
  EXPORT(TARGETS mygenerator FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake )
ENDIF(NOT CMAKE_CROSSCOMPILING)


however; i fail on the "INCLUDE(${IMPORT_EXECUTABLES}" since the file
"IMPORTFILE-NOTFOUND" isn't found!!!

i suspect this happens since the CMAKE_CROSSCOMPILING gets processed before
the Native (NOT CMAKE_CROSSCOMPILING) part;

i am using CMake 2.8; any ideas?




-- 
Rami
     Tel.     4-865-6245
     Pele.    54-8159949
     e-mail. sramij at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121215/081d363e/attachment.htm>


More information about the CMake mailing list