Cmake error does not match the source

I tried to build OpenCV 3.1.0 on my Raspberry Pi 2B. Unfortunetly, when I trying: cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=OFF -D

I tried to build OpenCV 3.1.0 on my Raspberry Pi 2B. Unfortunetly, when I trying:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=OFF /home/pi/Downloads/opencv-3.1.0

It gave me a error :( :

CMake Error: The source «/home/pi/Downloads/opencv-3.1.0/CMakeLists.txt» does not match the source «/home/pi/Downloads/opencv-3.1.0/modules/CMakeLists.txt» used to generate cache. Re-run cmake with a different source directory.

I want to use OpenCV with C++ and Code::Bocks, which I have already installed.
I can’t found any solution on internet, so I will be very happy if smb help me. :) Forgot to say I using Raspbian Jezzy.

asked Mar 3, 2016 at 22:53

3Qax's user avatar

3Qax3Qax

1951 gold badge1 silver badge12 bronze badges

First, I hope you do run CMake outside your sources, in a separate directory. Not doing that is really not recommended

To understand the error message you have to know a little bit on how CMake works.

Basically, when you run

cd /path/to/opencv
mkdir build
cd build
cmake ..

CMake generates a cache in the build dir (It’s a simple file named CMakeCache.txt). This file contains some information like:

  • The path to the sources /path/to/opencv
  • The path to the build dir /path/to/opencv/build
  • The CMake Generator used (Ninja, Unix Makefiles …)

If you ever re-run CMake and change one of these values, (by re-running cmake with different arguments, setting an other generotor or moving files), CMake will complain with this kind of message.

A good solution is then to delete the CMakeCache, or even the whole build dir to be safe.

answered Mar 3, 2016 at 23:03

Dimitri Merejkowsky's user avatar

3

yeah, I realized that after I wrote the issue. Many thanks to your reply! I have solved that problem now. As a new in this area, I still have a lot to learn. Thanks a lot~

qnie

From: Steven Lovegrove
Date: 2017-01-19 02:39
To: stevenlovegrove/Pangolin
CC: NIEQiang001; Author
Subject: Re: [stevenlovegrove/Pangolin] CMakeLists.txt not match (#197)
It sounds as though you’ve made a small mistake with CMake. Try removing your current build files and starting over. From the Pangolin root directory:
git -f clean
mkdir build
cd build
cmake ..
make


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
==================================================================================
This email is scanned by IRONPORT anti-spam and anti-virus server.
Notes:
1) If you want to report this email to be «SPAM EMAIL»,
then please forward this email to «spam@access.ironport.com».
2) If you need any asistance, please contact our dept computing team.
==================================================================================

Содержание

  1. CMake Error: The source directory «/home/username» does not appear to contain CMakeLists.txt. #568
  2. Comments
  3. apt-get install libqt4-dev cmake intltool
  4. cmake error ‘the source does not appear to contain CMakeLists.txt’
  5. 5 Answers 5
  6. CMake says source dir does not appear to contain CMakeLists.txt #752
  7. Comments
  8. Operating System
  9. OBS Studio Version?
  10. StreamFX Version
  11. OBS Studio Log
  12. OBS Studio Crash Log
  13. Current Behavior
  14. Expected Behavior
  15. Steps to Reproduce the Bug
  16. Any additional Information we need to know?
  17. Cmake third_party: not contain CMakeLists.txt #219
  18. Comments
  19. Wrong CMakeCache.txt directory #12
  20. Comments

CMake Error: The source directory «/home/username» does not appear to contain CMakeLists.txt. #568

/Hotot-master$ cmake -DWITH_QT=off ..

CMake Error: The source directory «/home/felixdz» does not appear to contain CMakeLists.txt.

How can I fix this?

The text was updated successfully, but these errors were encountered:

have you created a build directory?? you should execute the cmake .. from the build directory.
from the tutorial:
«Create a new directory for creating build mkdir build cd build Once you are inside the build directory. Pass the command»

you can also follow the «building from source» instruction here (scroll down)
https://github.com/lyricat/Hotot

@mwgkdm I have same issue.
Is there any way to make build directory independent cmake 😕

not sure what you mean.
You want a different directory or to not use cmake?
Either way, that would require changing the code which is beyond my knowledge.

«Since Hotot core is largely based on HTML5, JavaScript and Webkit technology, It can be run under many Webkit implementations. Hotot officially supports Gtk, Qt, and Chrome webkit wrapper.

so cmake is a must,

the path for building is set to be build, so just create that directory and then execute «cmake ..» from it.

«On Ubuntu 11.10 all of these resources are available in the standard repositories.

While I still use hotot, I will probably forsake it soon as the 260 characters has really broke it, and messing with the code, though it doesn’t look very complicated is too time consuming for me to learn.

@mwgkdm i got it
the file named *Cache* was responsible 😆

@tbhaxor please tell me what to do with CMake.cache file . should I delete it, or place it in any other folder .

hell i am trying to run an open source project and i created the build dir inside my root folder withe the project files and then cd inot build but when i run cmake ..
i get noCmakelists.txt file

like where do i get this file or how do i crete this file
like its NOT in my project folder i only have makefile

sorry this is too complex for no reason
but anyway thxz for any solution
Lisa

Источник

cmake error ‘the source does not appear to contain CMakeLists.txt’

I’m installing opencv in ubuntu 16.04. After installing the necessary prerequisites I used the following command:-

but it produced an error:-

I used the command provided in the folder ‘module’ documentation. How do I solve it? I tried the answers here at stack-overflow and a few other question but still can’t figure it out.

Project Git repository here.

5 Answers 5

You should do mkdir build and cd build while inside opencv folder, not the opencv-contrib folder. The CMakeLists.txt is there.

Since you add .. after cmake, it will jump up and up (just like cd .. ) in the directory. But if you want to run cmake under the same folder with CMakeLists.txt, please use . instead of .. .

This reply may be late but it may help users having similar problem. The opencv-contrib (available at https://github.com/opencv/opencv_contrib/releases) contains extra modules but the build procedure has to be done from core opencv (available at from https://github.com/opencv/opencv/releases) modules.

Follow below steps (assuming you are building it using CMake GUI)

Download openCV (from https://github.com/opencv/opencv/releases) and unzip it somewhere on your computer. Create build folder inside it

Download exra modules from OpenCV. (from https://github.com/opencv/opencv_contrib/releases). Ensure you download the same version.

Unzip the folder.

Click Browse Source and navigate to your openCV folder.

Click Browse Build and navigate to your build Folder.

Click the configure button. You will be asked how you would like to generate the files. Choose Unix-Makefile from the drop down menu and Click OK. CMake will perform some tests and return a set of red boxes appear in the CMake Window.

Search for «OPENCV_EXTRA_MODULES_PATH» and provide the path to modules folder (e.g. /Users/purushottam_d/Programs/OpenCV3_4_5_contrib/modules)

Click Configure again, then Click Generate.

Go to build folder

  1. This will install the opencv libraries on your computer.

An easier way to build OpenCV from source in a step by step fashion as given in this reference: Installing OpenCV from the Source is to,

step 1: install dependencies,

Step 2: create a directory opencv_build and Clone the necessary repositories as shown below,

step 3: cd into opencv directory, inside create another directory called build and cd into it,

step 4: evoke Cmake to build OpenCV,

If step 4 completes successfully you should see the following line at the end of the terminal, the build has been written to the directory created in step 3, along with the following lines above this line,

configuration done generating done

step 5: To start the compilation process where -j is a flag for the number of the processor inside your machine, for example -j6 means we have 6 processors available. to verify the number of processors type nproc on the terminal then use this number after -j. To start this process, we use the following command:

step 6: install OpenCV, We use,

then check the version Of OpenCV to verify the installation:

Источник

CMake says source dir does not appear to contain CMakeLists.txt #752

Operating System

Linux (like Arch Linux)

OBS Studio Version?

StreamFX Version

OBS Studio Log

cmake -H=source/ -B=build/

OBS Studio Crash Log

I’m trying to get OBS up on my new Manjaro install. It is working, installed from pamac, and does open. But I’d really like to have both the virtual camera, and the built-in RTSP server which seem to be missing compared to the install I had up on Kubuntu and Zorin prior. I’m normally a debian/Ubuntu user, but only recently switched to Manjaro. Noting that I can’t open .deb files (Manjaro can’t open .deb right?), I figured maybe I could compile it from source.

Current Behavior

But I get stuck with this error about missing file CMakeLists.txt which does not seem to be in the git repo:

Expected Behavior

I expected it would compile a binary that I can use in obs-studio to enable virtual camera.

Steps to Reproduce the Bug

  • install manjaro
  • install obs-studio using pamac
  • clone the streamfx repo recursively

Any additional Information we need to know?

Linux putin 5.15.7-1-MANJARO #1 SMP PREEMPT Wed Dec 8 10:09:19 UTC 2021 x86_64 GNU/Linux
cmake version 3.22.1
OBS Studio — 27.1.3-1 (linux)
ffmpeg version n4.4.1 Copyright (c) 2000-2021 the FFmpeg developers

commit 2d7fce5 (HEAD -> master, tag: 0.11.0c1, origin/master, origin/HEAD)
Date: Sun Dec 12 17:04:36 2021 +0100
project: Version 0.11.0c1

The text was updated successfully, but these errors were encountered:

Источник

Cmake third_party: not contain CMakeLists.txt #219

I follow the commands cmake third-party library:
cd $PYMESH_PATH/third_party
mkdir build
cd build
cmake ..
make
make install

and the result prompts:
CMake Error: The source directory «$PYMESH_PATH/third_party» does not appear to contain CMakeLists.txt.

I have confirmed that there is no CMakeLists.txt file in the third-party library. Did I make a mistake?

The text was updated successfully, but these errors were encountered:

I also am getting the same issue. I note that there is a build.py file, but this comes with a few problems that makes it using it unwieldy. Specifically, there is no ‘all’ option, and when I attempt to use the script going through dependencies 1-by-1 I get a failure on the first one (cgal) with the same issue (no CMakeLists).

I’ve tried going back to a previous commit (bb0bac9 which was made on the 13/10, which is well before the «Overhaul third party build process.» commit which I suspect is causing the issue). However, this does not work — I get a «error: Server does not allow request for unadvertised object. «.

Yes, sorry about the confusion. Please try using the setup.py build script for building both the third party and the main PyMesh code.

It is still possible to just build third party libraries by themselves, I have provided a build python script:

Thank you very much, Qingnan. I got it.

I have added an all option, and the doc has been updated. To build third party, you can simply

Thanks a lot. I am most grateful.

Hi, but I don’t think this issue should be closed because this has not resolved the issue — the command:

Returns the error: CMake Error: The source directory «

/third_party/build/cgal» does not appear to contain CMakeLists.txt.

Can you let me know your cmake version?

The build script assumes -B options is supported, which requires cmake 3.13.5 and above. Maybe that is why?

Ah yes, you are correct, but this is because the system cmake is used (Ubuntu 18.04 does not have cmake of the required version in the repositories). Could an option be added to specify the cmake bin? This would be very useful because it would enable everyone using Ubuntu 18.04 and older to use your package without having to go through a custom install process for cmake (which would involve overriding the system cmake).

@charlie0389 I have updated the build script. It should work for older cmake now. Please let me know if it is still an issue.

Hello, Qingnan!
When ./build.py draco, an error occurs: error: expected ‘;’ at end of member declaration.
How do I do it?

I seem to be encountering this same error with current pymesh — I have cmake 3.13.4 and I get:

It is running cmake as

@charlie0389 I have updated the build script. It should work for older cmake now. Please let me know if it is still an issue.

It still exists the same issue when the cmake version is 3.10.2.

Hi @qnzhou
After build using your instruction above, I try pymesh function and am getting error:
pymesh’ has no attribute ‘distance_to_mesh’
It states elsewhere ( #37) that it is caused by failure of CGAL to build. But I think it has built. I ran it again and attach herewith a log file, and screen grab.
Note: My problem is similar to the comment in the other thread ( #37) except my CGAL_DIR environmental value is empty.
Can you please help me to understand why I cannot use distance_to_mesh ?
cgal.log

Источник

Wrong CMakeCache.txt directory #12

After it runs the sudo ./LCD5-show command, it throws an error:
CMake Error: The current CMakeCache.txt directory /home/pi/downloads/LCD-show/rpi-fbcp/build/CMakeCache.txt is different than the directory /home/pi/LCD-show/rpi-fbcp/build where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt CMake Error: The source «/home/pi/downloads/LCD-show/rpi-fbcp/CMakeLists.txt» does not match the source «/home/pi/LCD-show/rpi-fbcp/CMakeLists.txt» used to generate cache. Re-run cmake with a different source directory. CMake Error: The source directory «/home/pi/LCD-show/rpi-fbcp» does not exist. Specify —help for usage, or press the help button on the CMake GUI. Makefile:176: recipe for target ‘cmake_check_build_system’ failed make: *** [cmake_check_build_system] Error 1 LCD configrue 0

The text was updated successfully, but these errors were encountered:

nothing on this one? I’m getting this one too.

You have the LCD-show folder in downloads folder /home/pi/downloads/LCD-show/ must be on /home/pi/LCD-show/ solved moving the directory to home path

who the hell is using raspbian default user pi for doing anything else than booting the os creating an individual admin account?

For me it is best security practice to not use pi as user.

I ran into this issue after running a c++ program on a new computer than the one I had originally ran it on.

The program used a CMakeLists.txt to do the build initially and then created a CMakeCache.txt file.

When I deleted the CMakeCache.txt and ran cmake again it worked as expected. 👍

I ran into this issue after running a c++ program on a new computer than the one I had originally ran it on.

The program used a CMakeLists.txt to do the build initially and then created a CMakeCache.txt file.

When I deleted the CMakeCache.txt and ran cmake again it worked as expected. 👍

Thank you. THIS WORKED. I have been stuck at this spot for 3 days now.

Источник

49 / 34 / 9

Регистрация: 27.12.2017

Сообщений: 1,450

1

21.10.2020, 20:45. Показов 10216. Ответов 4


Что я делаю не так?
Находясь в папке project создал папку src в которой находится main.cpp ,создал папку build в которой находится CMakeLists.txt
Находясь в папке build запускаю cmake ../scr и после этого ошибка
CMake Error: The source directory «/home/user/Projects/project/src» does not appear to contain CMakeLists.txt.
Specify —help for usage, or press the help button on the CMake GUI.

Переместил main.cpp в другую папку по адресу /home/user/Projects/C++/test и запускаю cmake ../../C++/test и всё срабатывает отлично

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



hoggy

Эксперт С++

8719 / 4299 / 958

Регистрация: 15.11.2014

Сообщений: 9,744

21.10.2020, 21:13

2

Лучший ответ Сообщение было отмечено ReYalp как решение

Решение

Цитата
Сообщение от ReYalp
Посмотреть сообщение

Что я делаю не так?

ты за каким то фигом перемещаешь main.cpp

вместо того что бы просто запустить cmake, указав ему путь к CMakeLists.txt

Windows Batch file
1
2
3
4
5
    cmake.exe ^
        -H"%ePATH_TO_CMAKELIST%" ^
        -B"%ePATH_TO_BUILD%"     ^
        -G"%eGENERATOR%"         ^
        -D"CMAKE_BUILD_TYPE=%eBUILD_TYPE%"



0



49 / 34 / 9

Регистрация: 27.12.2017

Сообщений: 1,450

21.10.2020, 21:18

 [ТС]

3

hoggy, разве не правильно разделять папку всё что связано с билдом в одну папку, всё что связано с исходниками в другую?



0



Комп_Оратор)

Эксперт по математике/физике

8776 / 4515 / 608

Регистрация: 04.12.2011

Сообщений: 13,468

Записей в блоге: 16

21.10.2020, 22:35

4

Цитата
Сообщение от ReYalp
Посмотреть сообщение

создал папку build в которой находится CMakeLists.txt

Он с сорсом должен быть. В папке построения будет создан построенный модуль (exe или что вы строите).



0



3 / 3 / 1

Регистрация: 15.03.2019

Сообщений: 574

28.10.2022, 14:52

5

Что бы не дублировать тему

загрузил проект и все вроде как сделал как описано здесь

https://github.com/FreeRDP/Fre… nd-64-bit)

но при команде

Код

cmake . -G"Visual Studio 16 2019"

получаю ошибки

Код

**********************************************************************
** Visual Studio 2019 Developer PowerShell v16.11.16
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
PS D:C#FreeRDP-master> cmake . -G"Visual Studio 16 2019"
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22000.
CMake Error in D:/C#/FreeRDP-master/CMakeFiles/_CMakeLTOTest-C/src/CMakeLists.txt:
  OUTPUT containing a "#" is not allowed.


CMake Error at D:/MicrosoftVisualStudio/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.20/Modules/CheckIPOSupported.cmake:120 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  D:/MicrosoftVisualStudio/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.20/Modules/CheckIPOSupported.cmake:240 (_ipo_run_language_check)
  CMakeLists.txt:30 (check_ipo_supported)


-- Configuring incomplete, errors occurred!
See also "D:/C#/FreeRDP-master/CMakeFiles/CMakeOutput.log".
PS D:C#FreeRDP-master> cmake . -G"Visual Studio 16 2019"
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22000.
CMake Error in D:/C#/FreeRDP-master/CMakeFiles/_CMakeLTOTest-C/src/CMakeLists.txt:
  OUTPUT containing a "#" is not allowed.


CMake Error at D:/MicrosoftVisualStudio/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.20/Modules/CheckIPOSupported.cmake:120 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  D:/MicrosoftVisualStudio/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.20/Modules/CheckIPOSupported.cmake:240 (_ipo_run_language_check)
  CMakeLists.txt:30 (check_ipo_supported)


-- Configuring incomplete, errors occurred!
See also "D:/C#/FreeRDP-master/CMakeFiles/CMakeOutput.log".
PS D:C#FreeRDP-master>

подскажите как исправить или как открыть анный проект в визуал студии?



0



Понравилась статья? Поделить с друзьями:
  • Cmake error cmake c compiler not set after enablelanguage
  • Cmake error cannot open file for write
  • Cmake error cannot determine link language for target
  • Cmake error at cmakelists txt 2 project
  • Cmake error 127