1
0
Fork 0

Test helper CMake macro.

Also build the test code first, so tests can reside in source tree as
well as the test tree.

Finally, build local Sqlite with -fpic to give consistent linkage when
using either built-in or system sqlite.
This commit is contained in:
James Turner 2017-03-26 12:15:29 +01:00
parent 7db8ed17c4
commit 09fe744de0
3 changed files with 12 additions and 11 deletions

View file

@ -2,4 +2,4 @@
add_definitions(-DSQLITE_OMIT_LOAD_EXTENSION) add_definitions(-DSQLITE_OMIT_LOAD_EXTENSION)
add_definitions(-DNDEBUG) add_definitions(-DNDEBUG)
add_library(fgsqlite3 sqlite3.c) add_library(fgsqlite3 sqlite3.c)
set_target_properties(fgsqlite3 PROPERTIES COMPILE_FLAGS "-fno-fast-math") set_target_properties(fgsqlite3 PROPERTIES COMPILE_FLAGS "-fpic -fno-fast-math")

View file

@ -509,8 +509,6 @@ configure_file (
add_subdirectory(3rdparty) add_subdirectory(3rdparty)
add_subdirectory(utils) add_subdirectory(utils)
add_subdirectory(src)
add_subdirectory(man)
if(ENABLE_TESTS) if(ENABLE_TESTS)
# enable CTest / make test target # enable CTest / make test target
@ -528,6 +526,9 @@ else()
message(STATUS "Tests: DISABLED") message(STATUS "Tests: DISABLED")
endif(ENABLE_TESTS) endif(ENABLE_TESTS)
add_subdirectory(src)
add_subdirectory(man)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
### uninstall target ### uninstall target
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------

View file

@ -94,16 +94,16 @@ if(FG_HAVE_GPERFTOOLS)
include_directories(${GooglePerfTools_INCLUDE_DIR}) include_directories(${GooglePerfTools_INCLUDE_DIR})
target_link_libraries(fgtestlib ${GooglePerfTools_LIBRARIES}) target_link_libraries(fgtestlib ${GooglePerfTools_LIBRARIES})
endif() endif()
target_link_libraries(fgtestlib SimGearCore ${PLATFORM_LIBS}) target_link_libraries(fgtestlib SimGearCore ${PLATFORM_LIBS} ${SQLITE3_LIBRARY})
add_executable(fgtest fgTestDriver.cxx) add_executable(fgtest fgTestDriver.cxx)
target_link_libraries(fgtest fgtestlib) target_link_libraries(fgtest fgtestlib)
# repeat this section for each unit-test executable macro(flightgear_test name sources)
add_executable(testnavs test_navaids2.cxx) add_executable(${name} ${sources})
target_link_libraries(testnavs fgtestlib ${SQLITE3_LIBRARY}) target_link_libraries(${name} fgtestlib)
add_test(testnavs ${EXECUTABLE_OUTPUT_PATH}/testnavs) add_test(${name} ${EXECUTABLE_OUTPUT_PATH}/${name})
endmacro()
add_executable(testflightplan test_flightplan.cxx) flightgear_test(test_navs test_navaids2.cxx)
target_link_libraries(testflightplan fgtestlib ${SQLITE3_LIBRARY}) flightgear_test(test_flightplan test_flightplan.cxx)
add_test(testflightplan ${EXECUTABLE_OUTPUT_PATH}/testflightplan)