[CMake] Problems to use TRY_COMPILE
Vitor Vasconcelos Araujo Silva
Vitor.Vasconcelos at loria.fr
Thu Apr 3 12:25:04 EDT 2008
Hello guys,
I'm trying to use the TRY_COMPILE command and I guess I'm probaly
making some mistake or I misunderstood the command.
My command is this one:
TRY_COMPILE(RESULT ${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/teste.cpp
CMAKE_FLAGS
COMPILE_DEFINITIONS -I${QT_INCLUDE_DIR}
-I${QT_QTCORE_INCLUDE_DIR}
-l${QT_QTCORE_LIBRARY}
OUTPUT_VARIABLE MY_OUT
)
My compile parameters (-I) are working, but my link parameter
is just throw away when compiling and, to link, it's no used. MY_OUT
output is this: (I just marked the important commands to try to make it
more readable).
-- Found Qt-Version 4.2.0
-- Trycompile teste: FALSE
-- MY_OUT: /usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make
CMakeFiles/cmTryCompileExec.dir/build
make[1]: entrant dans le répertoire «
/users/qgar/vasconcv/studies/QgarGui/build/CMakeFiles/CMakeTmp »
/usr/local/bin/cmake -E cmake_progress_report
/users/qgar/vasconcv/studies/QgarGui/build/CMakeFiles/CMakeTmp/CMakeFiles 1
-----------------------------------------------------------------------------
Building CXX object CMakeFiles/cmTryCompileExec.dir/teste.o
/usr/bin/c++ -I/usr/include/qt4 -I/usr/include/qt4/QtCore -o
CMakeFiles/cmTryCompileExec.dir/teste.o -c
/users/qgar/vasconcv/studies/QgarGui/teste.cpp
-----------------------------------------------------------------------------
Linking CXX executable cmTryCompileExec
/usr/local/bin/cmake -P
CMakeFiles/cmTryCompileExec.dir/cmake_clean_target.cmake
/usr/bin/c++ -fPIC "CMakeFiles/cmTryCompileExec.dir/teste.o" -o
cmTryCompileExec -rdynamic
-----------------------------------------------------------------------------
CMakeFiles/cmTryCompileExec.dir/teste.o: In function
`QString::QString(char const*)':
teste.cpp:(.text._ZN7QStringC1EPKc[QString::QString(char const*)]+0x15):
référence indéfinie vers « QString::fromAscii_helper(char const*, int)»
CMakeFiles/cmTryCompileExec.dir/teste.o: In function `QString::~QString()':
teste.cpp:(.text._ZN7QStringD1Ev[QString::~QString()]+0x23): référence
indéfinie vers « QString::free(QString::Data*)»
collect2: ld returned 1 exit status
make[1]: *** [cmTryCompileExec] Erreur 1
make[1]: quittant le répertoire «
/users/qgar/vasconcv/studies/QgarGui/build/CMakeFiles/CMakeTmp »
make: *** [cmTryCompileExec/fast] Erreur 2
-- Configuring done
-- Generating done
Thanks a lot in advance and have a nice day (or night),
--
Vitor VASCONCELOS
Projet QGAR
LORIA / INRIA-Lorraine
Campus Scientifique, BP 239
54506, Vandoeuvre-lès-Nancy, FRANCE
Tel: +33 (0)3 54 95 85 76
--
Vitor VASCONCELOS
Projet QGAR
LORIA / INRIA-Lorraine
Campus Scientifique, BP 239
54506, Vandoeuvre-lès-Nancy, FRANCE
Tel: +33 (0)3 54 95 85 76
More information about the CMake
mailing list