diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2024-08-12 22:15:35 (GMT) |
---|---|---|
committer | Alex Turbov <i.zaufi@gmail.com> | 2024-08-13 02:06:25 (GMT) |
commit | 3d9c018f3168d183b70c85aa3ce7b5e8847a3f35 (patch) | |
tree | f425f3fc4036a8444374d139583551bbe5ef8950 /Tests/CMakeLib | |
parent | a48097f7ae375ca52db4f204d3e93f9ccb8c40f2 (diff) | |
download | CMake-3d9c018f3168d183b70c85aa3ce7b5e8847a3f35.zip CMake-3d9c018f3168d183b70c85aa3ce7b5e8847a3f35.tar.gz CMake-3d9c018f3168d183b70c85aa3ce7b5e8847a3f35.tar.bz2 |
CMakeLibTests: Generate `testConfig.h` with source/build paths defined
And use it in all tests that had their particular files before.
Diffstat (limited to 'Tests/CMakeLib')
-rw-r--r-- | Tests/CMakeLib/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/CMakeLib/testConfig.h.in | 7 | ||||
-rw-r--r-- | Tests/CMakeLib/testVisualStudioSlnParser.cxx | 6 | ||||
-rw-r--r-- | Tests/CMakeLib/testVisualStudioSlnParser.h.in | 7 | ||||
-rw-r--r-- | Tests/CMakeLib/testXMLParser.cxx | 4 | ||||
-rw-r--r-- | Tests/CMakeLib/testXMLParser.h.in | 6 |
6 files changed, 16 insertions, 19 deletions
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index 4d43e08..008a7d9 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -1,3 +1,6 @@ +# Render the header file with source path macro +configure_file(testConfig.h.in testConfig.h @ONLY) + include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMake_BINARY_DIR}/Source @@ -65,10 +68,8 @@ if(WIN32) list(APPEND CMakeLib_TESTS testVisualStudioSlnParser.cxx ) - configure_file(testVisualStudioSlnParser.h.in testVisualStudioSlnParser.h @ONLY) endif() -configure_file(testXMLParser.h.in testXMLParser.h @ONLY) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testUVProcessChainInput.txt" "HELLO WORLD!") create_test_sourcelist(CMakeLib_TEST_SRCS CMakeLibTests.cxx ${CMakeLib_TESTS}) diff --git a/Tests/CMakeLib/testConfig.h.in b/Tests/CMakeLib/testConfig.h.in new file mode 100644 index 0000000..f57f97e --- /dev/null +++ b/Tests/CMakeLib/testConfig.h.in @@ -0,0 +1,7 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#pragma once + +#define SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@" +#define BUILD_DIR "@CMAKE_CURRENT_BINARY_DIR@" diff --git a/Tests/CMakeLib/testVisualStudioSlnParser.cxx b/Tests/CMakeLib/testVisualStudioSlnParser.cxx index 3485bac..3bab2ba 100644 --- a/Tests/CMakeLib/testVisualStudioSlnParser.cxx +++ b/Tests/CMakeLib/testVisualStudioSlnParser.cxx @@ -1,10 +1,12 @@ -#include "testVisualStudioSlnParser.h" - #include <iostream> #include "cmVisualStudioSlnData.h" #include "cmVisualStudioSlnParser.h" +#include "testConfig.h" + +#define SLN_EXTENSION "sln-file" + static bool parsedRight(cmVisualStudioSlnParser& parser, const std::string& file, cmSlnData& data, cmVisualStudioSlnParser::ParseResult expected = diff --git a/Tests/CMakeLib/testVisualStudioSlnParser.h.in b/Tests/CMakeLib/testVisualStudioSlnParser.h.in deleted file mode 100644 index 62c3f4d..0000000 --- a/Tests/CMakeLib/testVisualStudioSlnParser.h.in +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef testVisualStudioSlnParser_h -#define testVisualStudioSlnParser_h - -#define SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@" -#define SLN_EXTENSION "sln-file" - -#endif diff --git a/Tests/CMakeLib/testXMLParser.cxx b/Tests/CMakeLib/testXMLParser.cxx index 32ee3ec..3b7af3a 100644 --- a/Tests/CMakeLib/testXMLParser.cxx +++ b/Tests/CMakeLib/testXMLParser.cxx @@ -1,9 +1,9 @@ -#include "testXMLParser.h" - #include <iostream> #include "cmXMLParser.h" +#include "testConfig.h" + int testXMLParser(int /*unused*/, char* /*unused*/[]) { // TODO: Derive from parser and check attributes. diff --git a/Tests/CMakeLib/testXMLParser.h.in b/Tests/CMakeLib/testXMLParser.h.in deleted file mode 100644 index da0b275..0000000 --- a/Tests/CMakeLib/testXMLParser.h.in +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef testXMLParser_h -#define testXMLParser_h - -#define SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@" - -#endif |