cmake and custom build targets
Alexander Dymo
dymo at mk.ukrtelecom.ua
Mon Mar 13 22:14:00 CET 2006
Hi!
I'm using add_custom_target to create some files before building ThreadWeaver
library (http://websvn.kde.org/trunk/kdenonbeta/threadweaver/Weaver).
The problem is I want to generate Job_moc.cpp only once but
it is recreated each time i run make. Can anybody please tell me how can I
avoid that?
-------------- next part --------------
kde4_header()
project(weaver)
include_directories(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
add_definitions(-DUSE_CMAKE)
########### next target ###############
set(ThreadWeaver_LIB_SRCS
DestructedState.cpp
WeaverImpl.cpp
Job.cpp
InConstructionState.cpp
State.cpp
ShuttingDownState.cpp
WeaverInterface.cpp
WeaverObserver.cpp
SuspendedState.cpp
WorkingHardState.cpp
DebuggingAids.cpp
ThreadWeaver.cpp
Thread.cpp
SuspendingState.cpp
IncludeMocs.cpp
)
kde4_automoc(${ThreadWeaver_LIB_SRCS})
QT4_GET_MOC_INC_DIRS(_moc_INCS)
add_custom_target(Moc1 ${QT_MOC_EXECUTABLE} ${_moc_INCS} ${CMAKE_CURRENT_SOURCE_DIR}/Job.cpp -o ${CMAKE_CURRENT_BINARY_DIR}/Job_moc.cpp)
add_custom_target(Moc2 ${QT_MOC_EXECUTABLE} ${_moc_INCS} ${CMAKE_CURRENT_SOURCE_DIR}/Thread.cpp -o ${CMAKE_CURRENT_BINARY_DIR}/Thread_moc.cpp)
kde4_add_library(ThreadWeaver SHARED ${ThreadWeaver_LIB_SRCS})
add_dependencies(ThreadWeaver Moc1 Moc2)
target_link_libraries(ThreadWeaver ${QT_QTCORE_LIBRARY})
set_target_properties(ThreadWeaver PROPERTIES VERSION 4.2.0 SOVERSION 4)
install_targets(/lib ThreadWeaver)
macro_additional_clean_files(${CMAKE_CURRENT_BINARY_DIR}/Job_moc.cpp ${CMAKE_CURRENT_BINARY_DIR}/Thread_moc.cpp)
kde4_footer()
More information about the Kde-buildsystem
mailing list