Skip to content

Commit

Permalink
Neater implemtation for test builder ready for cloning...
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6959 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed May 23, 2007
1 parent ee8e008 commit f875996
Showing 1 changed file with 23 additions and 34 deletions.
57 changes: 23 additions & 34 deletions tests/src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
#############################################################
# sources

# application test

SET(applicationtest_SRCS testqgsapplication.cpp)
#QT4_GENERATE_MOC(${CMAKE_CURRENT_SOURCE_DIR}/testqgsapplication.cpp testqgsapplication.moc)
#SET_SOURCE_FILES_PROPERTIES(testqgsapplication.moc PROPERTIES GENERATED TRUE)
SET(applicationtest_MOC_CPPS testqgsapplication.cpp)
QT4_WRAP_CPP(applicationtest_MOC_SRCS ${applicationtest_MOC_CPPS})
ADD_CUSTOM_TARGET(applicationtestmoc ALL DEPENDS ${applicationtest_MOC_SRCS})
#QT4_GENERATE_MOC(${CMAKE_CURRENT_SOURCE_DIR}/testqgsapplication.cpp moc_testqgsapplication.cxx)

#####################################################

# Don't forget to include output directory, otherwise
# the UI file won't be wrapped!
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
Expand Down Expand Up @@ -50,30 +36,33 @@ IF (WIN32)
SET(PLATFORM_LIBRARIES wsock32)
ENDIF (WIN32)


#note for tests we should not include the moc of our
#qtests as they are directly included in teh sources
#and should not be compiled twice. Trying to include
#them in below will cause an error at build time

ADD_EXECUTABLE(applicationtest
${applicationtest_SRCS}
)
ADD_DEPENDENCIES(applicationtest applicationtestmoc)
TARGET_LINK_LIBRARIES(applicationtest
${QT_LIBRARIES}
qgis_core
)

# Since the tests are not actually installed, but rather
# run directly from the build/src/tests dir we need to
# ensure the libs can be found.
# ensure the omg libs can be found.
IF (APPLE)
# For Mac OS X, the executable must be at the root of the bundle's executable folder
SET (CMAKE_INSTALL_NAME_DIR @executable_path/../lib)
INSTALL(TARGETS applicationtest RUNTIME DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
ELSE (APPLE)
INSTALL(TARGETS applicationtest RUNTIME DESTINATION ${OMG_BIN_DIR})
SET (CMAKE_INSTALL_NAME_DIR @executable_path/../../../src/core)
ENDIF (APPLE)

#note for tests we should not include the moc of our
#qtests in the executable file list as the moc is
#directly included in the sources
#and should not be compiled twice. Trying to include
#them in will cause an error at build time

#############################################################
# Tests:

SET(applicationtest_SRCS testqgsapplication.cpp)
SET(applicationtest_MOC_CPPS testqgsapplication.cpp)
QT4_WRAP_CPP(applicationtest_MOC_SRCS ${applicationtest_MOC_CPPS})
ADD_CUSTOM_TARGET(applicationtestmoc ALL DEPENDS ${applicationtest_MOC_SRCS})
ADD_EXECUTABLE(applicationtest ${applicationtest_SRCS})
ADD_DEPENDENCIES(applicationtest applicationtestmoc)
TARGET_LINK_LIBRARIES(applicationtest ${QT_LIBRARIES} qgis_core)
INSTALL(TARGETS applicationtest RUNTIME DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
ADD_TEST(application ${CMAKE_CURRENT_BINARY_DIR}/applicationtest)

#
##
#

0 comments on commit f875996

Please sign in to comment.