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.
- mkdir MyFolder
- git clone https://github.com/mariadb-corporation/mariadb-connector-c.git
These steps work to prove that the build works:
- cd mariadb-connector-c
- mkdir build && cd build
- cmake -G Ninja ..
- ninja
Ok that worked great. So next trying it one level up:
- cd ../.. (Now located in "MyFolder")
- Add a CMakeLists.txt with this source.
cmake_minimum_required(VERSION 3.0.0)
project(mariadb VERSION 1.0.0)
add_subdirectory(mariadb-connector-c)
- mkdir build & cd build
- cmake -G Ninja ..
And now it blows up. Does anyone know why this is the case?
Edit
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;}
CMakeErrorLog.txt
file: these error messages are mostly not "real". Show the error message in the CMake output. – Tsyvarevmake VERBOSE=1
orcmake --verbose --build ..
) for even more pages of logs of errors and post it all then. You posted parts of CMakeErrorLog that was used for detection ofselect.h
- I do not feel it's even related to the problem, it's just detectingselect.h
, and sure it should be missing, it'ssys/select.h
. – KamilCuk