.../temp/JUCE/examples/CMake/GuiApp$ ls
build CMakeLists.txt MainComponent.cpp MainComponent.h Main.cpp
I made that build directory for executing cmake.
Executing the cmake is resulting in following error:
.../temp/JUCE/examples/CMake/GuiApp/build$ cmake ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:39 (juce_add_gui_app):
Unknown CMake command "juce_add_gui_app".
-- Configuring incomplete, errors occurred!
See also "/home/xyz/Documents/abc/work/juce/temp/JUCE/examples/CMake/GuiApp/build/CMakeFiles/CMakeOutput.log".
Was I supposed to change something in the CMakeList.txt? Please guide about how to get rid of Unknown CMake command "juce_add_gui_app". .
However, if you’re starting a new JUCE project, it’s recommended to copy the whole GuiApp folder to a new location outside the repo, and then to use add_subdirectory(path/to/JUCE) to point the project to a copy of JUCE.
Am thankful for your patience. I am not well versed with CMake yet.
I ran cmake . -B cmake-build-dir -D JUCE_BUILD_EXAMPLES=ON in the top level directory of the repository. It complained about missing ‘webkit2gtk-4.0’ , ‘gtk±x11-3.0’, and ‘alsa’.
Is it important to have these dependencies? Are they optional?
Secondly, where am I supposed to run the second command? cmake --build cmake-build-dir --target GuiApp?
I ran it in the top level repo’ build dir like this: cmake .. --build cmake-build-dir --target ../examples/CMake/GuiApp
It said:
CMake Error: The source "/home/xyz/Documents/abc/work/juce/temp/JUCE/examples/CMake/GuiApp/CMakeLists.txt" does not match the source "/home/xyz/Documents/abc/work/juce/temp/JUCE/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory.
Running it in the JUCE/examples/CMake/ repo complains about Unknown CMake command "juce_add_gui_app".
Besides what I wrote in the above post, I have also enabled find_package(JUCE CONFIG REQUIRED) in th GuiApp’s CMakeList.txt.
Now the innermost cmake says:
CMake Error at CMakeLists.txt:25 (find_package):
Could not find a package configuration file provided by "JUCE" with any of
the following names:
JUCEConfig.cmake
juce-config.cmake
Add the installation prefix of "JUCE" to CMAKE_PREFIX_PATH or set
"JUCE_DIR" to a directory containing one of the above files. If "JUCE"
provides a separate development package or SDK, be sure it has been
installed.
should I have done this?
I have added list(APPEND CMAKE_PREFIX_PATH "/home/xyz/Documents/abc/work/juce/temp/JUCE/")
This time I first uncommented find_package(JUCE) in /GuiApp' CMakeList.txt.
Then I ran cmake .. . -B cmake-build-dir -D JUCE_BUILD_EXAMPLES=ON
on the top level directory.
It says:
-- Checking for modules 'webkit2gtk-4.0;gtk+-x11-3.0'
-- No package 'webkit2gtk-4.0' found
-- No package 'gtk+-x11-3.0' found
-- Checking for module 'alsa'
-- No package 'alsa' found
-- Configuring juceaide
-- Building juceaide
-- Exporting juceaide
CMake Error at examples/CMake/GuiApp/CMakeLists.txt:27 (find_package):
Could not find a package configuration file provided by "JUCE" with any of
the following names:
JUCEConfig.cmake
juce-config.cmake
Add the installation prefix of "JUCE" to CMAKE_PREFIX_PATH or set
"JUCE_DIR" to a directory containing one of the above files. If "JUCE"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
To build a new GUI App project with JUCE/CMake, do this (starting from scratch):
Copy the GuiApp folder to a new location.
In the GuiApp CMakeLists that you copied, replace the add_subdirectory(JUCE) line with add_subdirectory("/home/xyz/Documents/abc/work/juce/temp/JUCE" JUCE), replacing the path with the real location of the JUCE repo on your system.
From the GuiApp folder that you copied, run
cmake . -B cmake-build-dir
This will create a build tree folder named cmake-build-dir
cmake --build cmake-build-dir
This will build all targets in the cmake-build-dir folder.