Okay, so I have a problem:
I want to use CMake.
Now one could ask why.
Well, it’s as simple as that every other project/dependency etc. uses CMake so it only makes sense to try and use CMake for the JUCE part.
Now onto the tricky part:
The project does compile just fine with the auto generated files by the Projucer
(insert) dustvoice@dustvoice-VirtualBox:~/Projects/Development/CommuniCare_eV/CommuniCare_Manager/Builds/Linux$ make
Compiling AddComponent.cpp
Compiling AddEntryComponent.cpp
Compiling AddUserComponent.cpp
Compiling CustomTableListBox.cpp
Compiling ExpandArea.cpp
Compiling ExpandEntryArea.cpp
Compiling ExpandUserArea.cpp
Compiling Main.cpp
Compiling PostFunctions.cpp
Compiling BinaryData.cpp
Compiling include_juce_core.cpp
Compiling include_juce_data_structures.cpp
Compiling include_juce_events.cpp
Compiling include_juce_graphics.cpp
Compiling include_juce_gui_basics.cpp
Compiling include_juce_gui_extra.cpp
Compiling include_juce_opengl.cpp
Linking ComminuCare e.V. Manager - App
but not with my CMake file. I’m sure there is some easy solution (as it only seems to be a linker error) and I would be very glad if someone could help me with this.
Ok, so my general CMakeLists.txt can be found here.
(it is worth noting that currently nothing resides in the Libraries directory)
Now I am getting errors, when I try to compile it under MinGW-w64 (log), MSVC with Visual Studio 2019 (log) or g++ under Ubuntu (log).
For linux I discovered that in the auto-generated Makefile a call to pkg-config is made. So I ran
pkg-config --libs freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl
(copied from the auto-generated Linux makefile)
and got
-lfreetype -lX11 -lXext -lXinerama -lwebkit2gtk-4.0 -lgtk-3 -lsoup-2.4 -ljavascriptcoregtk-4.0 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lcurl
as an output. So I added
target_link_libraries(${PROJECT_NAME} "freetype" "webkit2gtk-4.0" "gtk-3" "soup-2.4" "javascriptcoregtk-4.0" "gtk-3" "gdk-3" "pangocairo-1.0" "pango-1.0" "atk-1.0" "cairo-gobject" "cairo" "gdk_pixbuf-2.0" "gio-2.0" "gobject-2.0" "glib-2.0" "curl")
to the end of my CMakeLists.txt.
At least I now got to the point where the only error reported (on Linux) was
[0/1] Re-running CMake...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dustvoice/Projects/Development/CommuniCare_eV/CommuniCare_Manager/Builds/Linux
[1/1] Linking CXX executable CommuniCare_eV_Manager
FAILED: CommuniCare_eV_Manager
: && /usr/bin/c++ -std=c++14 -std=c++14 CMakeFiles/CommuniCare_eV_Manager.dir/JuceLibraryCode/BinaryData.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/JuceLibraryCode/include_juce_core.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/JuceLibraryCode/include_juce_data_structures.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/JuceLibraryCode/include_juce_events.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/JuceLibraryCode/include_juce_graphics.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/JuceLibraryCode/include_juce_gui_basics.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/JuceLibraryCode/include_juce_gui_extra.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/JuceLibraryCode/include_juce_opengl.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/Source/AddComponent.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/Source/AddEntryComponent.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/Source/AddUserComponent.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/Source/CustomTableListBox.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/Source/ExpandArea.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/Source/ExpandEntryArea.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/Source/ExpandUserArea.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/Source/Main.cpp.o CMakeFiles/CommuniCare_eV_Manager.dir/Source/PostFunctions.cpp.o -o CommuniCare_eV_Manager -lfreetype -lX11 -lXext -lXinerama -lwebkit2gtk-4.0 -lgtk-3 -lsoup-2.4 -ljavascriptcoregtk-4.0 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lcurl -lsoup-2.4 -ljavascriptcoregtk-4.0 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lcurl && :
/usr/bin/ld: CMakeFiles/CommuniCare_eV_Manager.dir/JuceLibraryCode/include_juce_core.cpp.o: undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
but googling for over 2h yielded no results unfortunately.
Also (understandably) running that modified CMakeLists.txt file under windows produced only hot garbo:
[...]
D:/MSYS2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lfreetype
D:/MSYS2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwebkit2gtk-4.0
[...]
I’m completely lost as to what I have to do. As these are ONLY linker error, it shouldn’t be too difficult to get this sh*t to compile, right?
Any quick help is really appreciated.
Maybe someone with insight on the Projucer auto-generation for the individual platforms could help me out.
Thanks in advance,
David