How do I solve this following rpi-fbcp error? - cmake

Does anyone know how to solve this?
~$ cd rpi-fbcp/
~/rpi-fbcp$ mkdir build
~/rpi-fbcp$ cd build/
~/rpi-fbcp/build$ cmake ..
CMake Warning (dev) in CMakeLists.txt:
No project() command is present. The top-level CMakeLists.txt file must contain a literal, direct call to the project() command. Add a line of code such as
project(ProjectName)
near the top of the file, but after cmake_minimum_required().
CMake is pretending there is a "project(Project)" command on the first
line.
I am trying to git this https://github.com/tasanakorn/rpi-fbcp
I am following this tutorial
https://www.instructables.com/Connected-Round-Screen-240x240-GC9A01-Controller-t/#discuss

Related

CMake - customize 'make help' output

I introduced CMake to my project it replaced Make's makefiles. Anyhow I'm not able to find how to customize 'make help' output. This target is created automagically anyhow I would like to add some descriptions for particular targets. It is anyhow possible?
Overwriting help with add_custom_target results in:
See also "/tmp/20/CMakeFiles/CMakeOutput.log".
CMake Error at CMakeLists.txt:5 (add_custom_target):
The target name "help" is reserved or not valid for certain CMake features,
such as generator expressions, and may result in undefined behavior.
Instead of overwriting what cmake generates, write your own make wrapper one directory above the cmake one. Like so:
$ cd /your/project
$ ls
_build CMakeLists.txt source_file.c Makefile
$ cmake -S. -B./_build
... configure the project in ./_build builddir ...
$ make
cmake --build _build --target all
<builds the project>
$ make help
This is your help
With Makefile:
all:
cmake --build _build --target all
configure_for_some_configuration:
cmake -S. -B_build -DSOME_OPTION=true
help:
#echo 'This is your help'
.PHONY: help configure_for_some_configuration all
Remember that make is one of several of supported generators. I recommend Ninja for faster builds. Use cmake --build <the build dir> to abstractly build the project independently of the used generator.

Set CMAKE_MAKE_PROGRAM to mingw32-make from inside the CMakeLists.txt

Following this post, if I run cmake .. inside my build folder with no options I get the error:
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_Fortran_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
which I can solve by running
cmake .. -D CMAKE_MAKE_PROGRAM:PATH=/mingw64/bin/mingw32-make
However, I want to set the CMAKE_MAKE_PROGRAM from inside the CMakeLists.txt file. I tried the
if(MSYS)
set(CMAKE_MAKE_PROGRAM /mingw64/bin/mingw32-make)
endif(MSYS)
but it doesn't work. I would appreciate it if you could help me know how I can resolve this problem.
P.S.1. Here is the code.
P.S.2. I tried the
set(CMAKE_MAKE_PROGRAM /mingw64/bin/mingw32-makemingw32-make CACHE FILEPATH "" FORCE)
as suggested in the comments but it did not help.
P.S.3. My operating system is Windows 10 version 1909, and I'm running the above commands in MSYS2 terminal MSYS_NT-10.0-18363
Ok, I think I solved the problem. From here, I needed to install the MSYS2's make:
pacman -S make
This seems like a trend too me. I have recently had several problems in MSYS2 which have been resolved by removing the MinGW package and replacing it with the MSYS2 package. So it tells me that when working inside MSYS2 I should favor MSYS2 packages if they are available.

Installing LLReve using Cmake. Unknown BISON_TARGET error

I am getting the following error :
CMake Error at CMakeLists.txt:9 (BISON_TARGET):
Unknown CMake command "BISON_TARGET".
when I run the command :
cmake .. -GNinja
Please tell me what to do. I tried searching on google a lot and thus came up with the additions and finally ran the command :
cmake .. -D LLVM_DIR=/usr/lib/llvm-5.0/cmake/ -D FLEX_EXECUTABLE=/usr/local/Cellar/flex/2.5.37/bin/ -D FLEX_INCLUDE_DIR=/usr/local/Cellar/flex/2.5.37/include/ -D BISON_EXECUTABLE=/usr/bin/bison
but it still shows the same error :(.
Please someone help.
Your error is occurring because the BISON_TARGET function definition has not yet been supplied. This method, as commented, is supplied by FindBISON. The error indicates that either Bison was not found on your system (hopefully, you have it installed), or cmake was ran from the wrong directory. Bison is included in the top-level CMake file via:
find_package(BISON REQUIRED)
This line to include Bison must be called before using the BISON_TARGET CMake function. The LLReve instructions for compiling this repository are explicit about which directory to run the build commands in:
Go to the llreve directory and run
cd reve
mkdir build
cd build
cmake .. -GNinja
ninja
This would run on the CMake file in the llreve/reve directory, not the llreve/reve/reve directory. Please ensure you are running CMake from the correct location, as not running cmake on the top-level CMake file will often yield errors.

generate CMakeList.text for OS X

I'm trying to create a plugin for OBS using C, and compiling it using cmake .. && make see - https://github.com/jp9000/obs-studio/wiki/Install-Instructions#mac-osx
when running cmake .. && make from cmd it gives me an error that cmake: command not found and when I run it from the program it gives me an error - CMake Error: The source directory "/Users/gerwin/Desktop/soOBS" does not appear to contain CMakeList.text specify --help for usage, or press the help button on the cmake GUI
How can I generate a CMakeList.Text to compile my soOBS script to a .so file?
One problem is that cmake is not in your path. So, if you type cmake from your command line it cannot be found. The other problem is that you are not specifying correctly your source directory: you have to specify as source directory the location of the main/root CMakeLists.txt.
So, proceed as follow:
Locate your cmake executable, obtaining your <full path to cmake>
Open a shell
Go to your source directory (location of the main/root of obs-studio CMakeLists.txt)
mkdir build
cd build
<full path to cmake> ..The first argument .. is your source directory, location of the main CMakeLists.txt
make

cmake: Selecting a generator within CMakeLists.txt

I would like to force CMake to use the "Unix Makefiles" generator from within CMakeLists.txt.
This is the command I use now.
cmake -G "Unix Makefiles" .
I would like it to be this.
cmake .
When running on windows with VC installed and a custom tool-chain.
I would expect to be-able to set the generator in the CMakeLists.txt file.
Maybe something like this.
set(CMAKE_GENERATOR "Unix Makefiles")
Here is what worked for me - create a file called PreLoad.cmake in your project dir containing this:
set (CMAKE_GENERATOR "Unix Makefiles" CACHE INTERNAL "" FORCE)
It seems to me that the variable CMAKE_GENERATOR is set too late if set in the CMakeLists.txt. If you use (even at the beginning of CMakeLists.txt)
set(CMAKE_GENERATOR "Ninja")
message("generator is set to ${CMAKE_GENERATOR}")
you can see in the output something like
% cmake ../source
-- The C compiler identification is GNU 4.9.2
...
-- Detecting CXX compile features - done
generator is set to Ninja
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/build
So the variable is only set at the very end of the generation procedure. If you use something like
set(CMAKE_GENERATOR "Ninja" CACHE INTERNAL "" FORCE)
in CMakeLists.txt, then in the very first run of cmake ../source (without -G) the default generator is used. The variable CMAKE_GENERATOR is stored in the cache, though. So if you rerun cmake ../source afterwards, it will use the generator as specified in the CMAKE_GENERATOR variable in the cache.
This is surely not the most elegant solution, though ;-) Maybe use a batch file that will actually execute the cmake -G generator for the user...
This is not what I get, when I run the same command, cmake will look for a gcc compiler / make utility. If the PATH is not set up correctly it will fail with something like:
D:\Development\build>cmake -G "Unix Makefiles" ..\source
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set.
You probably need to select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:D:/Development/build/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:D:/Development/build/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
when gcc / mingw is in the path then everything works fine. So could you provide more information as to your PATH variable or CMAKE version?
You need to set the generator at the Generate stage so it is written into the cache.
You only need to run this command once for the first configuration
cmake .. -DCMAKE_GENERATOR:INTERNAL=Ninja
This will configure Ninja as the default generator.
Later you can simply run
cmake ..
And it would use the Ninja generator as default
You can read more about it under Running CMake from the command line
When running cmake from the command line, it is possible to specify command line options to cmake that will set values in the cache. This is done with a -DVARIABLE:TYPE=VALUE syntax on the command line. This is useful for non-interactive nightly test builds.
CMake 3.19 introduces a new feature - presets. So, to select proper generator automatically, you can specify it name in CMakePresets.json.
Full description for these files available here: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html