Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » CMake

This thread is locked; no one can reply to it. rss feed Print
CMake
Ariesnl
Member #2,902
November 2002
avatar

I tried several things to get a working makefile using CMake ( using allegro)
But it keeps giving me undefined references on the Allegro functions
does anyone know what I'm doing wrong ?
I want to start using makefiles for my Allegro projects
( Since I want them to be easily portable)

CMakelist.txt

#SelectExpand
1cmake_minimum_required (VERSION 2.6) 2project (GUI_TEST) 3 4find_library(ALLEGRO_LIBRARY allegro_monolith-debug.dll HINTS "D:/Development/Allegro5/lib") 5 6include_directories(D:/Development/Allegro5/include) 7 8 9file(GLOB SOURCES "*.cpp") 10add_executable(GUI_TEST ${SOURCES}) 11target_link_libraries(GUI_TEST PUBLIC ${ALLEGRO_LIBRARY} )

Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard)
Current project: [Star Trek Project ] Join if you want ;-)

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Peter Hull
Member #1,136
March 2001

Would be better to use CMake's package facility. See https://www.allegro.cc/forums/thread/617453 and https://github.com/hiltonm/nostos/blob/master/cmake/FindAllegro.cmake .
In Allegro's source there is a cmake subdir which includes snippets to find all its dependencies. Maybe Rodolfo's work could be used as the basis of an official FindAllegro.cmake which could be distributed?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Rodolfo's current implementation doesn't include all libraries, doesn't handle the monolith, and I'm not sure how he calls it.

A real FindAllegro.cmake would include MinGW and MSVC as well as MSYS and Linux pkg-config type searches.

Rodolfo Lam
Member #16,045
August 2015

Oh my... I have a really short t memory and totally forgot I was working on that...

Indeed it is not an universal FindCmake for Allegro, made it so that it just worked in my case.

For it to work in MSVC it would need to automatically fetch the NuGet Package for the project... However I don't know how to do that.

I could look into adding the monolith version support to that...

An ideal solution is to use a Config Module instead of a FindModule, however as always CMake docs are famous for being confusing and vague.

Go to: