Allow disabling building of tests
This commit is contained in:
parent
c7fdfb8116
commit
a89cbf116d
@ -6,7 +6,7 @@ if(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
project(Launcher)
|
project(Launcher)
|
||||||
enable_testing()
|
include(CTest)
|
||||||
|
|
||||||
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BUILD_DIR}" IS_IN_SOURCE_BUILD)
|
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BUILD_DIR}" IS_IN_SOURCE_BUILD)
|
||||||
if(IS_IN_SOURCE_BUILD)
|
if(IS_IN_SOURCE_BUILD)
|
||||||
|
@ -5,6 +5,7 @@ set(TEST_RESOURCE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
|||||||
message(${TEST_RESOURCE_PATH})
|
message(${TEST_RESOURCE_PATH})
|
||||||
|
|
||||||
function(add_unit_test name)
|
function(add_unit_test name)
|
||||||
|
if(BUILD_TESTING)
|
||||||
set(options "")
|
set(options "")
|
||||||
set(oneValueArgs DATA)
|
set(oneValueArgs DATA)
|
||||||
set(multiValueArgs SOURCES LIBS)
|
set(multiValueArgs SOURCES LIBS)
|
||||||
@ -45,4 +46,5 @@ function(add_unit_test name)
|
|||||||
target_include_directories(${name}_test PRIVATE "${TEST_RESOURCE_PATH}/UnitTest/")
|
target_include_directories(${name}_test PRIVATE "${TEST_RESOURCE_PATH}/UnitTest/")
|
||||||
|
|
||||||
add_test(NAME ${name} COMMAND ${name}_test WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
add_test(NAME ${name} COMMAND ${name}_test WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@ -353,6 +353,7 @@ add_unit_test(GradleSpecifier
|
|||||||
LIBS Launcher_logic
|
LIBS Launcher_logic
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(BUILD_TESTING)
|
||||||
add_executable(PackageManifest
|
add_executable(PackageManifest
|
||||||
mojang/PackageManifest_test.cpp
|
mojang/PackageManifest_test.cpp
|
||||||
)
|
)
|
||||||
@ -368,6 +369,7 @@ add_test(
|
|||||||
COMMAND PackageManifest
|
COMMAND PackageManifest
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_unit_test(MojangVersionFormat
|
add_unit_test(MojangVersionFormat
|
||||||
SOURCES minecraft/MojangVersionFormat_test.cpp
|
SOURCES minecraft/MojangVersionFormat_test.cpp
|
||||||
|
Loading…
Reference in New Issue
Block a user