Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake ≥ 3.13 - Policy CMP0077 (option() behavior) #817

Open
TheRaf974 opened this issue Dec 31, 2023 · 0 comments
Open

CMake ≥ 3.13 - Policy CMP0077 (option() behavior) #817

TheRaf974 opened this issue Dec 31, 2023 · 0 comments

Comments

@TheRaf974
Copy link

Hi,

I'm adding cJSON to a project using CMake version 3.25.2
My project is on a Raspberry Pico microcontroller and I need a static library. In my original CMakeLists.txt, I added set(BUILD_SHARED_LIBS OFF) then add_subdirectory(cJSON).

At building, cmake awared me of an old behavior of option which cleared BUILD_SHARED_LIBS. (cf. CMake CMP0077)

[cmake] CMake Warning (dev) at cJSON/CMakeLists.txt:112 (option):
[cmake]   Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
[cmake]   --help-policy CMP0077" for policy details.  Use the cmake_policy command to
[cmake]   set the policy and suppress this warning.
[cmake] 
[cmake]   For compatibility with older versions of CMake, option is clearing the
[cmake]   normal variable 'BUILD_SHARED_LIBS'.
[cmake] This warning is for project developers.  Use -Wno-dev to suppress it.

I fixed this issue by adding set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) to my parent CMakeLists.txt. However, there is a fix possible directly in cJSON's CMakeLists.txt with cmake_policy(SET CMP0077 NEW).

I'll make a PR, you'll see if it is relevant or not

TheRaf974 added a commit to TheRaf974/cJSON that referenced this issue Dec 31, 2023
TheRaf974 added a commit to TheRaf974/cJSON that referenced this issue Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant