Reputation: 878
I don't know how to explain why, but when I run cmake in a directory it works fine. If I go one level up and in the CMakeLists.txt use Add_SubDirectory then it is broken.
I will put the steps down.
These steps work to prove that the build works:
Ok that worked great. So next trying it one level up:
cmake_minimum_required(VERSION 3.0.0)
project(mariadb VERSION 1.0.0)
add_subdirectory(mariadb-connector-c)
And now it blows up. Does anyone know why this is the case?
As requested here is the first error of the log when it is built as a sub project.
Determining if files select.h exist failed with the following output:
Change Dir: /home/questionable/Desktop/Programming/source-mariadb/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/ninja cmTC_c650d && [1/2] Building C object CMakeFiles/cmTC_c650d.dir/HAVE_SELECT_H.c.o
FAILED: CMakeFiles/cmTC_c650d.dir/HAVE_SELECT_H.c.o
/usr/bin/cc -Wunused -Wlogical-op -Wno-uninitialized -Wall -Wextra -Wformat-security -Wno-init-self -Wwrite-strings -Wshift-count-overflow -Wdeclaration-after-statement -Wno-undef -Wno-unknown-pragmas -o CMakeFiles/cmTC_c650d.dir/HAVE_SELECT_H.c.o -c /home/questionable/Desktop/Programming/source-mariadb/build/CMakeFiles/CheckIncludeFiles/HAVE_SELECT_H.c
/home/questionable/Desktop/Programming/source-mariadb/build/CMakeFiles/CheckIncludeFiles/HAVE_SELECT_H.c:2:10: fatal error: select.h: No such file or directory
2 | #include <select.h>
| ^~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
Source:
/* */
#include <select.h>
int main(void){return 0;}
Upvotes: 0
Views: 884
Reputation: 140880
Errors I get at cmake configure stage from your source are:
CMake Deprecation Warning at mariadb-connector-c/CMakeLists.txt:5 (CMAKE_MINIMUM_REQUIRED):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Warning (dev) at mariadb-connector-c/CMakeLists.txt:19 (PROJECT):
Policy CMP0048 is not set: project() command manages VERSION variables.
Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
The following variable(s) would be set to empty:
PROJECT_VERSION
PROJECT_VERSION_MAJOR
PROJECT_VERSION_MINOR
PROJECT_VERSION_PATCH
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Error at mariadb-connector-c/cmake/install_plugins.cmake:11 (INSTALL):
INSTALL TARGETS given no LIBRARY DESTINATION for module target "dialog".
Call Stack (most recent call first):
mariadb-connector-c/cmake/plugins.cmake:82 (INSTALL_PLUGIN)
mariadb-connector-c/plugins/auth/CMakeLists.txt:30 (REGISTER_PLUGIN)
mariadb-connector-c/plugins/CMakeLists.txt:7 (INCLUDE)
mariadb-connector-c/CMakeLists.txt:392 (INCLUDE)
CMake Error at mariadb-connector-c/cmake/install_plugins.cmake:11 (INSTALL):
INSTALL TARGETS given no LIBRARY DESTINATION for module target
"client_ed25519".
Call Stack (most recent call first):
mariadb-connector-c/cmake/plugins.cmake:82 (INSTALL_PLUGIN)
mariadb-connector-c/plugins/auth/CMakeLists.txt:54 (REGISTER_PLUGIN)
mariadb-connector-c/plugins/CMakeLists.txt:7 (INCLUDE)
mariadb-connector-c/CMakeLists.txt:392 (INCLUDE)
CMake Error at mariadb-connector-c/cmake/install_plugins.cmake:11 (INSTALL):
INSTALL TARGETS given no LIBRARY DESTINATION for module target
"caching_sha2_password".
Call Stack (most recent call first):
mariadb-connector-c/cmake/plugins.cmake:82 (INSTALL_PLUGIN)
mariadb-connector-c/plugins/auth/CMakeLists.txt:70 (REGISTER_PLUGIN)
mariadb-connector-c/plugins/CMakeLists.txt:7 (INCLUDE)
mariadb-connector-c/CMakeLists.txt:392 (INCLUDE)
CMake Error at mariadb-connector-c/cmake/install_plugins.cmake:11 (INSTALL):
INSTALL TARGETS given no LIBRARY DESTINATION for module target
"sha256_password".
Call Stack (most recent call first):
mariadb-connector-c/cmake/plugins.cmake:82 (INSTALL_PLUGIN)
mariadb-connector-c/plugins/auth/CMakeLists.txt:81 (REGISTER_PLUGIN)
mariadb-connector-c/plugins/CMakeLists.txt:7 (INCLUDE)
mariadb-connector-c/CMakeLists.txt:392 (INCLUDE)
CMake Error at mariadb-connector-c/cmake/install_plugins.cmake:11 (INSTALL):
INSTALL TARGETS given no LIBRARY DESTINATION for module target
"auth_gssapi_client".
Call Stack (most recent call first):
mariadb-connector-c/cmake/plugins.cmake:82 (INSTALL_PLUGIN)
mariadb-connector-c/plugins/auth/CMakeLists.txt:106 (REGISTER_PLUGIN)
mariadb-connector-c/plugins/CMakeLists.txt:7 (INCLUDE)
mariadb-connector-c/CMakeLists.txt:392 (INCLUDE)
CMake Error at mariadb-connector-c/cmake/install_plugins.cmake:11 (INSTALL):
INSTALL TARGETS given no LIBRARY DESTINATION for module target
"mysql_clear_password".
Call Stack (most recent call first):
mariadb-connector-c/cmake/plugins.cmake:82 (INSTALL_PLUGIN)
mariadb-connector-c/plugins/auth/CMakeLists.txt:126 (REGISTER_PLUGIN)
mariadb-connector-c/plugins/CMakeLists.txt:7 (INCLUDE)
mariadb-connector-c/CMakeLists.txt:392 (INCLUDE)
CMake Error at mariadb-connector-c/cmake/install_plugins.cmake:11 (INSTALL):
INSTALL TARGETS given no LIBRARY DESTINATION for module target "remote_io".
Call Stack (most recent call first):
mariadb-connector-c/cmake/plugins.cmake:82 (INSTALL_PLUGIN)
mariadb-connector-c/plugins/io/CMakeLists.txt:7 (REGISTER_PLUGIN)
mariadb-connector-c/plugins/CMakeLists.txt:7 (INCLUDE)
mariadb-connector-c/CMakeLists.txt:392 (INCLUDE)
-- Configuring incomplete, errors occurred!
See also "/home/kamil/tmp/test/build/CMakeFiles/CMakeOutput.log".
See also "/home/kamil/tmp/test/build/CMakeFiles/CMakeError.log".
Looks like there's a problem in install.cmake. Looks like strangely INSTALL_PLUGINDIR
is not set, so DESTINATION
argument to install
has no parameter... :/ . The following:
cmake_minimum_required(VERSION 3.0.0)
project(mariadb VERSION 1.0.0)
set(INSTALL_PLUGINDIR /some/path)
add_subdirectory(mariadb-connector-c)
allows building the project.
Upvotes: 1