Skip to content

Commit

Permalink
CMake: Use lowercase project name for skipping tests and examples
Browse files Browse the repository at this point in the history
Previously one had to specify names like 'QtSvg' to -skip-tests
and -skip-examples, but this is not the same behavior as what
the -submodules and -skip options expect.

To keep it consistent, change the code to consider only the lower case
names.

Amends 25b89f2
Amends 7c9efdf

Pick-to: 6.7 6.8
Fixes: QTBUG-127857
Change-Id: Ie80edb98ce16b6835fe361198953e36b8255102a
Reviewed-by:  Alexey Edelev <[email protected]>
Reviewed-by: Joerg Bornemann <[email protected]>
  • Loading branch information
alcroito committed Aug 12, 2024
1 parent 40def71 commit 34f1278
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions cmake/QtBuildRepoHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -582,14 +582,17 @@ macro(qt_build_repo_impl_tests)
message(FATAL_ERROR
"Can't build both standalone tests and standalone examples at once.")
endif()
option(QT_BUILD_TESTS_PROJECT_${PROJECT_NAME} "Configure tests for project ${PROJECT_NAME}" TRUE)
string(TOLOWER "${PROJECT_NAME}" __qt_repo_project_name_lowercase)
option(QT_BUILD_TESTS_PROJECT_${__qt_repo_project_name_lowercase}
"Configure tests for project ${__qt_repo_project_name_lowercase}" TRUE)

if (QT_BUILD_TESTS_PROJECT_${PROJECT_NAME})
if (QT_BUILD_TESTS_PROJECT_${__qt_repo_project_name_lowercase})
add_subdirectory(tests)
if(NOT QT_BUILD_TESTS_BY_DEFAULT)
set_property(DIRECTORY tests PROPERTY EXCLUDE_FROM_ALL TRUE)
endif()
endif()
unset(__qt_repo_project_name_lowercase)
endif()
endmacro()

Expand All @@ -603,8 +606,10 @@ macro(qt_build_repo_impl_examples)

message(STATUS "Configuring examples.")

option(QT_BUILD_EXAMPLES_PROJECT_${PROJECT_NAME} "Configure examples for project ${PROJECT_NAME}" TRUE)
if(QT_BUILD_EXAMPLES_PROJECT_${PROJECT_NAME})
string(TOLOWER "${PROJECT_NAME}" __qt_repo_project_name_lowercase)
option(QT_BUILD_EXAMPLES_PROJECT_${__qt_repo_project_name_lowercase}
"Configure examples for project ${__qt_repo_project_name_lowercase}" TRUE)
if(QT_BUILD_EXAMPLES_PROJECT_${__qt_repo_project_name_lowercase})

# Set this before any examples subdirectories are added, to warn about examples that are
# added via add_subdirectory() calls instead of qt_internal_add_example().
Expand All @@ -615,6 +620,7 @@ macro(qt_build_repo_impl_examples)

add_subdirectory(examples)
endif()
unset(__qt_repo_project_name_lowercase)
endif()
endmacro()

Expand Down

0 comments on commit 34f1278

Please sign in to comment.