Leverage global BUILD_TESTING option

main
Miloš Komarčević 2 years ago committed by Rosen Penev
parent 5631e84237
commit b7c45b49aa

@ -79,7 +79,7 @@ if ( EXIV2_ENABLE_EXTERNAL_XMP )
set(EXIV2_ENABLE_XMP OFF)
endif()
if( EXIV2_BUILD_UNIT_TESTS )
if(BUILD_TESTING AND EXIV2_BUILD_UNIT_TESTS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) # Requires CMake 3.3.3
endif()
@ -102,7 +102,7 @@ include(cmake/compilerFlagsExiv2.cmake REQUIRED)
add_subdirectory( src )
if( EXIV2_BUILD_UNIT_TESTS )
if(BUILD_TESTING AND EXIV2_BUILD_UNIT_TESTS)
add_subdirectory ( unitTests )
endif()
@ -111,20 +111,20 @@ if( EXIV2_BUILD_FUZZ_TESTS )
endif()
if(EXIV2_BUILD_EXIV2_COMMAND)
add_subdirectory ( app )
add_subdirectory(app)
if( EXIV2_BUILD_SAMPLES )
add_subdirectory( samples )
if(EXIV2_BUILD_SAMPLES)
add_subdirectory(samples)
get_directory_property(SAMPLES DIRECTORY samples DEFINITION APPLICATIONS)
if (Python3_Interpreter_FOUND)
if(BUILD_TESTING AND Python3_Interpreter_FOUND)
add_test(NAME bashTests
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose bash_tests)
endif()
endif()
endif()
if (Python3_Interpreter_FOUND)
if(BUILD_TESTING AND Python3_Interpreter_FOUND)
add_test(NAME bugfixTests
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose bugfixes)
@ -140,8 +140,7 @@ if (Python3_Interpreter_FOUND)
add_test(NAME regressionTests
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose regression_tests)
endif()
endif()
endif()
if( EXIV2_ENABLE_NLS )

@ -30,9 +30,11 @@ endif()
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
find_package (Python3 COMPONENTS Interpreter)
if (NOT Python3_Interpreter_FOUND)
message(WARNING "Python3 was not found. Python tests under the 'tests' folder will not be executed")
if(BUILD_TESTING)
find_package(Python3 COMPONENTS Interpreter)
if(NOT Python3_Interpreter_FOUND)
message(WARNING "Python3 was not found. Python tests under the 'tests' folder will not be executed.")
endif()
endif()
find_package(Filesystem COMPONENTS Experimental Final REQUIRED)

@ -65,7 +65,7 @@ if (WIN32)
endif()
OptionOutput( "Building exiv2 command: " EXIV2_BUILD_EXIV2_COMMAND )
OptionOutput( "Building samples: " EXIV2_BUILD_SAMPLES AND EXIV2_BUILD_EXIV2_COMMAND )
OptionOutput( "Building unit tests: " EXIV2_BUILD_UNIT_TESTS )
OptionOutput( "Building unit tests: " EXIV2_BUILD_UNIT_TESTS AND BUILD_TESTING )
OptionOutput( "Building fuzz tests: " EXIV2_BUILD_FUZZ_TESTS )
OptionOutput( "Building doc: " EXIV2_BUILD_DOC )
OptionOutput( "Building with coverage flags: " BUILD_WITH_COVERAGE )

@ -1,6 +1,6 @@
# Note that this is a hack for testing the internals of the library. If EXIV2_BUILD_UNIT_TESTS==OFF
# Then we only export the symbols that are explicitly exported
if( EXIV2_BUILD_UNIT_TESTS )
if(BUILD_TESTING AND EXIV2_BUILD_UNIT_TESTS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) # Requires CMake 3.3.3
endif()

Loading…
Cancel
Save