CMakeLibTests: Generate testConfig.h with source/build paths defined

And use it in all tests that had their particular files before.
This commit is contained in:
Alex Turbov
2024-08-13 02:15:35 +04:00
parent a48097f7ae
commit 3d9c018f31
6 changed files with 16 additions and 19 deletions
+3 -2
View File
@@ -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})
+7
View File
@@ -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@"
+4 -2
View File
@@ -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 =
@@ -1,7 +0,0 @@
#ifndef testVisualStudioSlnParser_h
#define testVisualStudioSlnParser_h
#define SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@"
#define SLN_EXTENSION "sln-file"
#endif
+2 -2
View File
@@ -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.
-6
View File
@@ -1,6 +0,0 @@
#ifndef testXMLParser_h
#define testXMLParser_h
#define SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@"
#endif