diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-06-01 20:17:24 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-06-06 00:58:57 +0200 |
commit | 21c9db1861825cdc7f89e90bf166115a2581b663 (patch) | |
tree | f02ffcd7c1aeec8875a57710c9e9b3a59ea0f03a /src | |
parent | 5861dc596687b48e5817f944cdcffca50592fb38 (diff) | |
download | rneovim-21c9db1861825cdc7f89e90bf166115a2581b663.tar.gz rneovim-21c9db1861825cdc7f89e90bf166115a2581b663.tar.bz2 rneovim-21c9db1861825cdc7f89e90bf166115a2581b663.zip |
build/CMake: find_package(… REQUIRED)
"Always use `find_package` with `REQUIRED`."
- We make an exception for LuaJit (not REQUIRED): the `nvim-test` target
is included only if we can find LuaJit.
This is partially a cargo-cult (reference below), but it uncovered at
least one problem: `find_package(LibIntl REQUIRED)` fails on my vanilla
ubuntu 16.04 system.
ref: https://schneide.blog/2017/11/06/4-tips-for-better-cmake/
> optional dependencies is nice, but skipping on REQUIRED is not the way
> you want to do it. In the worst case, some of your features will just
> not work if those packages are not found, with no explanation
> whatsoever. Instead, use explicit feature-toggles (e.g. using option())
> that either skip the find_package call or use it with REQUIRED, so the
> user will know that another lib is needed for this feature.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/nvim/po/CMakeLists.txt | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 2d803792c8..bdedce8076 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -484,7 +484,9 @@ set_property( APPEND_STRING PROPERTY COMPILE_FLAGS " -DMAKE_LIB " ) -if(LUAJIT_FOUND) +if(NOT LUAJIT_FOUND) + message(STATUS "luajit not found, skipping nvim-test (unit tests) target") +else() set(NVIM_TEST_LINK_LIBRARIES ${NVIM_LINK_LIBRARIES} ${LUAJIT_LIBRARIES}) add_library( nvim-test diff --git a/src/nvim/po/CMakeLists.txt b/src/nvim/po/CMakeLists.txt index 94cc63baea..a7b910f0eb 100644 --- a/src/nvim/po/CMakeLists.txt +++ b/src/nvim/po/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(Gettext) +find_package(Gettext REQUIRED) find_program(XGETTEXT_PRG xgettext) find_program(ICONV_PRG iconv) |