From e906fb51129bef7c4243c570beb9f2594a59e8c1 Mon Sep 17 00:00:00 2001 From: Stephen Webb Date: Mon, 17 Jul 2023 17:11:49 +1000 Subject: [PATCH] Create Visual Studio folders for 'Examples' and 'UnitTests' --- CMakeLists.txt | 3 +++ src/examples/cpp/CMakeLists.txt | 5 ++++- .../cpp/{example-auto-configured.xml => auto-configured.xml} | 0 src/examples/cpp/custom-appender.cpp | 2 +- .../cpp/{example-custom-appender.xml => custom-appender.xml} | 0 src/site/markdown/extending.md | 2 +- src/test/cpp/CMakeLists.txt | 2 +- 7 files changed, 10 insertions(+), 4 deletions(-) rename src/examples/cpp/{example-auto-configured.xml => auto-configured.xml} (100%) rename src/examples/cpp/{example-custom-appender.xml => custom-appender.xml} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 61c04791c..ce9188ee4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,6 +114,9 @@ endif() # Don't allow for compiler-specific extensions set(CMAKE_CXX_EXTENSIONS OFF) +# Use solution folders. +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + # Building add_subdirectory(src) diff --git a/src/examples/cpp/CMakeLists.txt b/src/examples/cpp/CMakeLists.txt index 643ca7430..f1cf57d32 100644 --- a/src/examples/cpp/CMakeLists.txt +++ b/src/examples/cpp/CMakeLists.txt @@ -29,7 +29,7 @@ else() endif() foreach(exampleName IN LISTS ALL_LOG4CXX_EXAMPLES) - set(PROGRAM_NAME "example-${exampleName}") + set(PROGRAM_NAME "${exampleName}") add_executable(${PROGRAM_NAME} ${exampleName}.cpp) if(${exampleName} STREQUAL MyApp2) target_sources(${PROGRAM_NAME} PRIVATE com/foo/config2.cpp com/foo/bar.cpp) @@ -44,6 +44,7 @@ foreach(exampleName IN LISTS ALL_LOG4CXX_EXAMPLES) set_target_properties(${PROGRAM_NAME} PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=${ESCAPED_PATH}" VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + FOLDER Examples ) endif() endforeach() @@ -57,6 +58,8 @@ if(${fmt_FOUND}) if( WIN32 ) set_target_properties( format-string PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=${ESCAPED_PATH}" + VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + FOLDER Examples ) endif() endif(${fmt_FOUND}) diff --git a/src/examples/cpp/example-auto-configured.xml b/src/examples/cpp/auto-configured.xml similarity index 100% rename from src/examples/cpp/example-auto-configured.xml rename to src/examples/cpp/auto-configured.xml diff --git a/src/examples/cpp/custom-appender.cpp b/src/examples/cpp/custom-appender.cpp index 1507968d5..807dff93c 100644 --- a/src/examples/cpp/custom-appender.cpp +++ b/src/examples/cpp/custom-appender.cpp @@ -62,7 +62,7 @@ int main( int argc, char** argv ) { using namespace log4cxx; - xml::DOMConfigurator::configure( "example-custom-appender.xml" ); + xml::DOMConfigurator::configure( "custom-appender.xml" ); LoggerPtr rootLogger = Logger::getRootLogger(); LoggerPtr nullLogger = Logger::getLogger( "NullLogger" ); diff --git a/src/examples/cpp/example-custom-appender.xml b/src/examples/cpp/custom-appender.xml similarity index 100% rename from src/examples/cpp/example-custom-appender.xml rename to src/examples/cpp/custom-appender.xml diff --git a/src/site/markdown/extending.md b/src/site/markdown/extending.md index c060f693a..13170e1ea 100644 --- a/src/site/markdown/extending.md +++ b/src/site/markdown/extending.md @@ -142,5 +142,5 @@ to Log4cxx, including(but not limited to): \example custom-appender.cpp This example shows how to extend Log4cxx with a new appender. -\example example-custom-appender.xml +\example custom-appender.xml This example shows how to use a new appender in a configuration file. diff --git a/src/test/cpp/CMakeLists.txt b/src/test/cpp/CMakeLists.txt index 7208d1fcd..74d9a3f98 100644 --- a/src/test/cpp/CMakeLists.txt +++ b/src/test/cpp/CMakeLists.txt @@ -116,10 +116,10 @@ foreach(testName IN LISTS ALL_LOG4CXX_TESTS) WORKING_DIRECTORY ${UNIT_TEST_WORKING_DIR} ) set_tests_properties( ${testName} PROPERTIES TIMEOUT 120 ) - if(WIN32) set_target_properties(${testName} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${UNIT_TEST_WORKING_DIR} + FOLDER UnitTests ) set_target_properties(${testName} PROPERTIES VS_DEBUGGER_COMMAND_ARGUMENTS "-v"