[CMake] sip, pyqt, and linking
luxInteg
lux-integ at btconnect.com
Wed Dec 8 18:08:32 EST 2010
Greetings
consider my small 'learn cmake/qt4 project'
It generates a library testLIB-static in $CMAKE_SOURCE_DIR}/testLIB
and an executible testBIN in ${CMAKE_SOURCE_DIR}/upstream/bin
A) For the library I used
add_library(testLIB-static testLIB.cpp )
B) For the executible
I use the sip generator to generate code like so
add_custom_command(OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/generatedfile1.cpp
----
---
COMMAND ${SIP_EXECUTABLE}
-c${CMAKE_CURRENT_BINARY_DIR}
-I${SIP_PATH}
-s ".cpp"
-t WS_X11 -t Qt$version -w
${CMAKE_SOURCE_DIR}/path/to/generator.sip
DEPENDS ${CMAKE_SOURCE_DIR}/path/to/generator.sip
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/path/to/generator.sip
COMMENT "Processing ${CMAKE_SOURCE_DIR}/path/to/generator.sip"
VERBATIM )
add_execitible(testBIN
testBIN.cpp
generatedfile1.cpp )
target_link_libraries(testLIB-static)
############### these are my findings
----If I add find_library(XXX testLIB-static) before I use the
add_executible() command cmake contends that testLIB-static is set to
NOTFOUND.
----If I do not use find_library(XXX testLIB-static) and run make, make
goes to 100 per cent and then all hell breaks loose with linking problems.
If I change the second line of the add_custom_command() statement to use
'absolute paths that I can understand such as:-
${CMAKE_SOURCE_DIR}/upstream/bin/generatedfile1.cpp the SIP generator fails
to generate generatedfile1.cpp
Advice ould be appreciated.
luxInteg
More information about the CMake
mailing list