Skip to content

Commit 0b622e4

Browse files
committed
Simplify "is top level" checks
Didn't know about PROJECT_IS_TOP_LEVEL
1 parent 9e906e8 commit 0b622e4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ project(rsp-cmake-scripts
5050
)
5151

5252
# Ensure parent project has modules and other properties available.
53-
if(NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
53+
#if(NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
54+
if(NOT PROJECT_IS_TOP_LEVEL)
5455
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE)
5556
set("${PROJECT_NAME}_VERSION" "${PROJECT_VERSION}" PARENT_SCOPE)
5657
set("${PROJECT_NAME}_SEMVER" "${version_SEMVER}" PARENT_SCOPE)
@@ -62,7 +63,7 @@ endif()
6263

6364
include("dependencies.cmake")
6465

65-
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
66+
if(PROJECT_IS_TOP_LEVEL)
6667
include("dev-dependencies.cmake")
6768
endif()
6869

@@ -82,7 +83,7 @@ endif ()
8283
# Post-dependencies project setup
8384
# -------------------------------------------------------------------------------------------------------------- #
8485

85-
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
86+
if(PROJECT_IS_TOP_LEVEL)
8687
include("rsp/debug")
8788
include("rsp/logging")
8889
endif()

0 commit comments

Comments
 (0)