2018-05-03 16:18:15 -05:00
|
|
|
set(test_core_SOURCES
|
2015-12-07 11:17:08 -06:00
|
|
|
test-stuff.c
|
|
|
|
unittest-support.c
|
|
|
|
)
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set(test_core_noinst_HEADERS
|
2015-12-07 11:17:08 -06:00
|
|
|
test-stuff.h
|
|
|
|
unittest-support.h
|
|
|
|
)
|
|
|
|
|
|
|
|
INCLUDE_DIRECTORIES(
|
2017-08-10 06:56:00 -05:00
|
|
|
${CMAKE_BINARY_DIR}/common
|
|
|
|
${CMAKE_SOURCE_DIR}/common
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine
|
|
|
|
${CMAKE_SOURCE_DIR}/common/test-core
|
2015-12-07 11:17:08 -06:00
|
|
|
|
|
|
|
${GLIB2_INCLUDE_DIRS}
|
|
|
|
${GUILE_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set_dist_list(test_core_DIST ${test_core_SOURCES} ${test_core_noinst_HEADERS} CMakeLists.txt
|
2017-12-02 19:50:14 -06:00
|
|
|
unittest-support.i unittest-support.scm)
|
2017-02-01 21:48:46 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
add_library(test-core STATIC ${test_core_SOURCES} ${test_core_noinst_HEADERS})
|
2019-11-24 11:30:33 -06:00
|
|
|
target_link_libraries(test-core gnc-engine ${GLIB2_LDFLAGS})
|
2018-05-03 16:18:15 -05:00
|
|
|
if (UNIX)
|
|
|
|
target_compile_options(test-core PRIVATE -fPIC)
|
|
|
|
endif()
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-01-29 11:54:13 -06:00
|
|
|
# Command to generate the swig-unittest-support-guile.c wrapper file
|
|
|
|
gnc_add_swig_guile_command (swig-unittest-support-guile-c
|
|
|
|
SWIG_UNITTEST_SUPPORT_GUILE_C swig-unittest-support-guile.c
|
2019-09-30 15:31:46 -05:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/unittest-support.i "" ${test_core_HEADERS}
|
2018-01-29 11:54:13 -06:00
|
|
|
)
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-01-29 11:54:13 -06:00
|
|
|
# Command to generate the swig-unittest-support-python.c wrapper file
|
2018-01-29 11:04:08 -06:00
|
|
|
gnc_add_swig_python_command (swig-unittest-support-python
|
|
|
|
SWIG_UNITTEST_SUPPORT_PYTHON_C SWIG_UNITTEST_SUPPORT_PYTHON_PY
|
|
|
|
swig-unittest-support-python.c unittest_support.py
|
2019-09-30 15:31:46 -05:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/unittest-support.i ""
|
2018-01-29 11:04:08 -06:00
|
|
|
)
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
add_library(test-core-guile ${SWIG_UNITTEST_SUPPORT_GUILE_C})
|
2019-09-21 17:28:09 -05:00
|
|
|
target_link_libraries(test-core-guile test-core ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS})
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
if (WITH_PYTHON)
|
|
|
|
add_library(unittest_support MODULE ${SWIG_UNITTEST_SUPPORT_PYTHON_C})
|
|
|
|
target_link_libraries(unittest_support test-core ${PYTHON_LIBRARIES})
|
|
|
|
target_include_directories(unittest_support PRIVATE ${PYTHON_INCLUDE_DIRS})
|
|
|
|
set_target_properties(unittest_support PROPERTIES PREFIX "_")
|
2018-05-09 10:20:13 -05:00
|
|
|
if (HAVE_STRINGOP_TRUNCATION)
|
|
|
|
target_compile_options(unittest_support PRIVATE -Wno-error=stringop-truncation)
|
|
|
|
endif()
|
2018-05-03 16:18:15 -05:00
|
|
|
endif()
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set(test_core_SCHEME unittest-support.scm)
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2019-05-17 18:10:49 -05:00
|
|
|
set(GUILE_OUTPUT_DIR tests)
|
2018-05-03 16:18:15 -05:00
|
|
|
set(GUILE_DEPENDS test-core-guile)
|
2015-12-07 11:17:08 -06:00
|
|
|
|
|
|
|
|
2019-05-17 16:36:50 -05:00
|
|
|
gnc_add_scheme_test_targets(scm-test-core
|
2020-03-14 04:30:35 -05:00
|
|
|
SOURCES ${test_core_SCHEME}
|
|
|
|
OUTPUT_DIR ${GUILE_OUTPUT_DIR}
|
|
|
|
DEPENDS "${GUILE_DEPENDS}")
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-02-19 00:16:27 -06:00
|
|
|
add_dependencies(check scm-test-core)
|
|
|
|
|
2019-06-15 09:12:25 -05:00
|
|
|
|
2019-08-17 16:03:45 -05:00
|
|
|
if (GTEST_SRC_DIR)
|
2019-08-15 16:20:45 -05:00
|
|
|
# in contrast to GoogleTest build system libraries libgtest.a and libgtest_main.a
|
|
|
|
# are combined to one library libtest.a here
|
2018-05-03 16:18:15 -05:00
|
|
|
add_library(gtest STATIC ${lib_gtest_SOURCES})
|
|
|
|
if(APPLE)
|
|
|
|
target_compile_options(gtest PRIVATE -Wno-missing-prototypes)
|
|
|
|
else()
|
|
|
|
target_compile_options(gtest PRIVATE -Wno-missing-declarations)
|
|
|
|
endif()
|
2019-09-14 13:49:12 -05:00
|
|
|
target_link_libraries(gtest Threads::Threads)
|
2018-05-03 16:18:15 -05:00
|
|
|
target_include_directories(gtest PUBLIC ${GTEST_INCLUDE_DIR} ${GTEST_SRC_DIR})
|
2019-08-17 17:30:42 -05:00
|
|
|
else()
|
|
|
|
add_library(gtest UNKNOWN IMPORTED GLOBAL)
|
|
|
|
set_target_properties(gtest PROPERTIES
|
|
|
|
IMPORTED_LOCATION ${GTEST_SHARED_LIB}
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES ${GTEST_INCLUDE_DIR}
|
|
|
|
INTERFACE_LINK_LIBRARIES ${GTEST_MAIN_LIB}
|
|
|
|
)
|
2018-05-03 16:18:15 -05:00
|
|
|
endif()
|
2019-08-17 16:03:45 -05:00
|
|
|
if (GMOCK_SRC_DIR)
|
2018-05-03 16:18:15 -05:00
|
|
|
set (lib_gmock_SOURCES ${GMOCK_SRC})
|
|
|
|
add_library(gmock STATIC ${lib_gmock_SOURCES})
|
|
|
|
if (APPLE)
|
|
|
|
target_compile_options(gmock PRIVATE -Wno-missing-prototypes)
|
|
|
|
else()
|
|
|
|
target_compile_options(gmock PRIVATE -Wno-missing-declarations)
|
|
|
|
endif()
|
|
|
|
target_include_directories(gmock PUBLIC
|
2018-04-03 20:59:50 -05:00
|
|
|
${GTEST_INCLUDE_DIR} ${GTEST_SRC_DIR}
|
|
|
|
${GMOCK_INCLUDE_DIR} ${GMOCK_SRC_DIR})
|
2018-05-03 16:18:15 -05:00
|
|
|
endif()
|
2018-07-23 14:47:25 -05:00
|
|
|
|
|
|
|
add_executable(jenny ${CMAKE_SOURCE_DIR}/borrowed/jenny/jenny.c)
|