Skip to content

Commit cae9a7a

Browse files
committed
cmake: Do not set emulated PROJECT_IS_TOP_LEVEL as cache variable
Otherwise, downstream projects, which integrate the libsecp256k1 library using the `add_subdirectory()` command, will be affected.
1 parent 4155e62 commit cae9a7a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

CMakeLists.txt

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ project(libsecp256k1
1818
)
1919

2020
if(CMAKE_VERSION VERSION_LESS 3.21)
21+
# Emulates CMake 3.21+ behavior.
2122
get_directory_property(parent_directory PARENT_DIRECTORY)
2223
if(parent_directory)
23-
set(PROJECT_IS_TOP_LEVEL OFF CACHE INTERNAL "Emulates CMake 3.21+ behavior.")
24-
set(${PROJECT_NAME}_IS_TOP_LEVEL OFF CACHE INTERNAL "Emulates CMake 3.21+ behavior.")
24+
set(PROJECT_IS_TOP_LEVEL OFF)
25+
set(${PROJECT_NAME}_IS_TOP_LEVEL OFF)
2526
else()
26-
set(PROJECT_IS_TOP_LEVEL ON CACHE INTERNAL "Emulates CMake 3.21+ behavior.")
27-
set(${PROJECT_NAME}_IS_TOP_LEVEL ON CACHE INTERNAL "Emulates CMake 3.21+ behavior.")
27+
set(PROJECT_IS_TOP_LEVEL ON)
28+
set(${PROJECT_NAME}_IS_TOP_LEVEL ON)
2829
endif()
2930
unset(parent_directory)
3031
endif()

0 commit comments

Comments
 (0)