Create srcref in BasicConfig.cmake
This commit is contained in:
parent
ab42e9d96c
commit
969c574806
|
@ -283,4 +283,8 @@ if(NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# add a file called "srcdirref" to the build directory; this file contains the path of the sources so tests can easily find test files contained in the source directory
|
||||
# note: This is also useful when using the TestApplication class in the regular target, so this is created in BasicConfig.cmake (rather than only TestTarget.cmake)
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/srcdirref" "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
set(BASIC_PROJECT_CONFIG_DONE YES)
|
||||
|
|
|
@ -302,9 +302,6 @@ if(CPP_UNIT_LIB OR META_NO_CPP_UNIT)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# add a file called "srcdirref" to the build directory; this file contains the path of the sources so tests can easily find test files contained in the source directory
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/srcdirref" "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
set(META_HAVE_TESTS YES)
|
||||
|
||||
else()
|
||||
|
|
|
@ -446,7 +446,7 @@ void TestApplication::readFallbackTestfilePathFromSrcRef()
|
|||
{
|
||||
try {
|
||||
// read "srcdirref" file which should contain the path of the source directory; this file should have been
|
||||
// create by the CMake module "TestTarget.cmake"
|
||||
// create by the CMake module "BasicConfig.cmake"
|
||||
const string srcDirContent(readFile("srcdirref", 2 * 1024));
|
||||
if (srcDirContent.empty()) {
|
||||
cerr << Phrases::Warning << "The file \"srcdirref\" is empty." << Phrases::EndFlush;
|
||||
|
|
Loading…
Reference in New Issue