|
| 1 | +############################################################# |
| 2 | +# sources |
| 3 | + |
| 4 | +# application test |
| 5 | + |
| 6 | +SET(applicationtest_SRCS testqgsapplication.cpp) |
| 7 | +SET(applicationtest_MOC_CPPS testqgsapplication.cpp) |
| 8 | +QT4_WRAP_CPP(applicationtest_MOC_SRCS ${applicationtest_MOC_CPPS}) |
| 9 | +ADD_CUSTOM_TARGET(applicationtestmoc ALL DEPENDS ${applicationtest_MOC_SRCS}) |
| 10 | +#QT4_GENERATE_MOC(${CMAKE_CURRENT_SOURCE_DIR}/testqgsapplication.cpp moc_testqgsapplication.cxx) |
| 11 | + |
| 12 | +##################################################### |
| 13 | + |
| 14 | +# Don't forget to include output directory, otherwise |
| 15 | +# the UI file won't be wrapped! |
| 16 | +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} |
| 17 | + ${CMAKE_CURRENT_BINARY_DIR} |
| 18 | + ${CMAKE_CURRENT_SOURCE_DIR}/../../../src/core |
| 19 | + ${QT_INCLUDE_DIR} |
| 20 | + ${GDAL_INCLUDE_DIR} |
| 21 | + ${PROJ_INCLUDE_DIR} |
| 22 | + ${GEOS_INCLUDE_DIR} |
| 23 | + ) |
| 24 | + |
| 25 | +# expect that classes are being IMPORTED for the exe |
| 26 | +IF (WIN32) |
| 27 | + # expect that classes are being imported |
| 28 | + # Note: MSVC doesn't like when the macros are quotes |
| 29 | + # and MSYS doesn't like them unqouted (bacause of braces) |
| 30 | + IF (MSVC) |
| 31 | + ADD_DEFINITIONS("-DCORE_EXPORT=__declspec(dllimport)") |
| 32 | + #ADD_DEFINITIONS("-DPLUGIN_EXPORT=__declspec(dllimport)") |
| 33 | + #next needed for qgis gui includes |
| 34 | + ADD_DEFINITIONS("-DGUI_EXPORT=__declspec(dllexport)") |
| 35 | + ELSE (MSVC) |
| 36 | + ADD_DEFINITIONS("\"-DCORE_EXPORT=__declspec(dllimport)\"") |
| 37 | + #ADD_DEFINITIONS("\"-DPLUGIN_EXPORT=__declspec(dllimport)\"") |
| 38 | + #next needed for qgis gui includes |
| 39 | + ADD_DEFINITIONS("\"-DGUI_EXPORT=__declspec(dllexport)\"") |
| 40 | + ENDIF (MSVC) |
| 41 | +ENDIF (WIN32) |
| 42 | + |
| 43 | +############################################################# |
| 44 | +# libraries |
| 45 | + |
| 46 | +# because of htonl |
| 47 | +IF (WIN32) |
| 48 | + SET(PLATFORM_LIBRARIES wsock32) |
| 49 | +ENDIF (WIN32) |
| 50 | + |
| 51 | + |
| 52 | +#note for tests we should not include the moc of our |
| 53 | +#qtests as they are directly included in teh sources |
| 54 | +#and should not be compiled twice. Trying to include |
| 55 | +#them in below will cause an error at build time |
| 56 | + |
| 57 | +ADD_EXECUTABLE(applicationtest |
| 58 | + ${applicationtest_SRCS} |
| 59 | + ) |
| 60 | +TARGET_LINK_LIBRARIES(applicationtest |
| 61 | + ${QT_LIBRARIES} |
| 62 | + qgis_core |
| 63 | +) |
| 64 | + |
| 65 | +# Since the tests are not actually installed, but rather |
| 66 | +# run directly from the build/src/tests dir we need to |
| 67 | +# ensure the libs can be found. |
| 68 | +IF (APPLE) |
| 69 | + # For Mac OS X, the executable must be at the root of the bundle's executable folder |
| 70 | + SET (CMAKE_INSTALL_NAME_DIR @executable_path/../lib) |
| 71 | + INSTALL(TARGETS applicationtest RUNTIME DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) |
| 72 | +ELSE (APPLE) |
| 73 | + INSTALL(TARGETS applicationtest RUNTIME DESTINATION ${OMG_BIN_DIR}) |
| 74 | +ENDIF (APPLE) |
| 75 | + |
| 76 | +ADD_TEST(application ${CMAKE_CURRENT_BINARY_DIR}/applicationtest) |
0 commit comments