From 9cefce09f63ebb19621e061a30fd5838ac834d0b Mon Sep 17 00:00:00 2001 From: Brad King Date: Sat, 15 Jan 2011 08:00:11 -0500 Subject: Report directory with missing source file (#11677) Previously the error message for code like add_executable(myexe does_not_exist/mysrc.c) mentioned only that "mysrc.c" is not found. Report the directory too. --- Source/cmSourceFile.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 26328cf..de7ff02 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -187,8 +187,13 @@ bool cmSourceFile::FindFullPath(std::string* error) } cmOStringStream e; - e << "Cannot find source file \"" << this->Location.GetName() << "\""; - e << ". Tried extensions"; + std::string missing = this->Location.GetDirectory(); + if(!missing.empty()) + { + missing += "/"; + } + missing += this->Location.GetName(); + e << "Cannot find source file:\n " << missing << "\nTried extensions"; for(std::vector::const_iterator ext = srcExts.begin(); ext != srcExts.end(); ++ext) { -- cgit v0.12 From 7af41c3492c5c11d6931383810e079be74309096 Mon Sep 17 00:00:00 2001 From: Brad King Date: Sat, 15 Jan 2011 08:16:50 -0500 Subject: Test that missing source mentions directory (#11677) Teach the MissingSourceFile test to verify that the directory portion of a missing source file is mentioned in the error message. --- Tests/CMakeLists.txt | 2 +- Tests/MissingSourceFile/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index c5331be..791a778 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -149,7 +149,7 @@ IF(BUILD_TESTING) ADD_TEST_MACRO(PreOrder PreOrder) ADD_TEST_MACRO(MissingSourceFile MissingSourceFile) SET_TESTS_PROPERTIES(MissingSourceFile PROPERTIES - PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file \"MissingSourceFile.c\"") + PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file:[ \r\n]*DoesNotExist/MissingSourceFile.c") ADD_TEST_MACRO(COnly COnly) ADD_TEST_MACRO(CxxOnly CxxOnly) ADD_TEST_MACRO(IPO COnly/COnly) diff --git a/Tests/MissingSourceFile/CMakeLists.txt b/Tests/MissingSourceFile/CMakeLists.txt index 42b7c51..a7206c8 100644 --- a/Tests/MissingSourceFile/CMakeLists.txt +++ b/Tests/MissingSourceFile/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required(VERSION 2.8) project(MissingSourceFile C) -add_executable(MissingSourceFile MissingSourceFile.c) +add_executable(MissingSourceFile DoesNotExist/MissingSourceFile.c) -- cgit v0.12