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: Warn (or error) about missing dependency #956

Closed
wants to merge 2 commits into from

Conversation

@Neui
Copy link
Contributor

commented Apr 19, 2017

With this change, when an dependency can't be build because it is missing something, it prints out an message (Couldn't find NAME! or Couldn't find NAME! Required for THING.).

If STRICT is set to ON, it'll send an error, kinda like other projects. It won't abort the process so the user can see further errors (but they won't be able to build). By default, it is set to OFF so existing builders won't break.

Also, an function not_found_msg is introduced for printing the message and determining whenever it should send an error. It is declared in the main CMakeLists.txt because it is small, but I'm unsure if it should go to an module.

This probably needs some more testing. I hope I covered all cases.

CMake: Warn about missing dependency
When an feature has been enabled but the dependency hasn't been
fulfilled, it now prints an warning. Please note that the minimum
version is CMake 2.4, but the message(WARNING ...) has been introduced
to CMake 2.8.

Also, there's the option STRICT, that lets the generation fail on such
error. This is OFF by default to not to break existing builders.
@@ -75,6 +79,8 @@ if(ENABLE_CHARSET)
# Check for iconv support.
if(ICONV_FOUND)
add_subdirectory(charset)
else()
not_found_msg("iconvi" "charset support")

This comment has been minimized.

Copy link
@arza-zara

arza-zara Apr 20, 2017

Contributor

last "i" a typo?

@@ -220,6 +239,8 @@ find_package(CppUTest)
if(ENABLE_TESTS AND CPPUTEST_FOUND)
enable_testing()
add_subdirectory(tests)
elseif(ENABLE_TESTS)
not_found_msg("CppUTest" "testing")

This comment has been minimized.

Copy link
@arza-zara

arza-zara Apr 20, 2017

Contributor

rather "compiling unit tests"

@arza-zara

This comment has been minimized.

Copy link
Contributor

commented Apr 20, 2017

Closes #916.

@Neui Neui force-pushed the Neui:cmake-strict branch from 9a6275c to 11d1089 Apr 20, 2017

@flashcode

This comment has been minimized.

Copy link
Member

commented Sep 15, 2019

Done, with a slightly different implementation.

flashcode added a commit that referenced this pull request Sep 15, 2019
core: remove obsolete file FindTCL.cmake (issue #916, issue #956)
This is file is provided by CMake and is not needed any more.  Moreover, it
causes an error on FreeBSD (TCL not found), even if TCL was properly detected
and used during the build.
flashcode added a commit that referenced this pull request Sep 16, 2019
debian: fix build of packages on Debian Jessie (issue #916, issue #956)
With the new errors on missing libraries in CMake, the PHP plugin must be
explicitly disabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.