Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » CMAKE_INSTALL_PREFIX ignored (Allegro 4.4.3 from GIT 08/12/2016)

Credits go to SiegeLord for helping out!
This thread is locked; no one can reply to it. rss feed Print
CMAKE_INSTALL_PREFIX ignored (Allegro 4.4.3 from GIT 08/12/2016)
Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Hey guys.

Just wanted to let you know, that CMAKE_INSTALL_PREFIX is ignored in the latest Allegro 4.4 branch from GIT as of 08/12/2016. I found out when it ignored me and installed to c:/mingw despite having CMAKE_INSTALL_PREFIX defined to c:/LIBS4814Distro/Allegro443 in cmake-gui.

For now I can manually install Allegro, but it's kind of a pain. Especially since there's no uninstall target. Feature request?

Or if the changes are easy enough to make myself I don't mind, but I don't know much about the cmake build system or how it goes about installing things.

EDIT
When generating config files, cmake says this :

Guessed MinGW directory: c:/mingw
CMAKE_INSTALL_PREFIX: c:/mingw

So for some reason it is overriding my CMAKE_INSTALL_PREFIX as I have it set.

SiegeLord
Member #7,827
October 2006
avatar

For some reason there's code to override it as you say, it probably should be removed... what it wants you to do is set the value of INSTALL_PREFIX instead, and then it'll set CMAKE_INSTALL_PREFIX to that value if it's not empty.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

All I see other than CMAKE_INSTALL_PREFIX is FRAMEWORK_INSTALL_PREFIX. There's no entry for INSTALL_PREFIX listed in cmake-gui. I don't want to run cmake from the command line because there are so many options I want to specify. I'm building a distro for Allegro 4.4.3 as well as 5.2.1.

EDIT
Are you working on a patch for this? I might be able to come up with one. I grepped for INSTALL_PREFIX and I sort of see what it is doing.

EDIT2
I see the code you're talking about.

#SelectExpand
227set(INSTALL_PREFIX "") 228 229if(CMAKE_COMPILER_IS_GNUCC) 230 set(COMPILER_GCC 1) 231 set(ALLEGRO_GCC 1) 232 set(WFLAGS "-W -Wall -Wno-unused-parameter") 233 set(WFLAGS_C_ONLY "-Wdeclaration-after-statement") 234 if(STRICT_WARN) 235 set(WFLAGS "${WFLAGS} -Werror -Wpointer-arith") 236 set(WFLAGS_C_ONLY "${WFLAGS_C_ONLY} -Wmissing-declarations") 237 set(WFLAGS_C_ONLY "${WFLAGS_C_ONLY} -Wstrict-prototypes") 238 endif(STRICT_WARN) 239endif(CMAKE_COMPILER_IS_GNUCC) 240 241if(MINGW) 242 set(ALLEGRO_MINGW32 1) 243 244 # Guess MINGDIR from the value of CMAKE_C_COMPILER if it's not set. 245 if("$ENV{MINGDIR}" STREQUAL "") 246 string(REGEX REPLACE "/bin/[^/]*$" "" MINGDIR "${CMAKE_C_COMPILER}") 247 message(STATUS "Guessed MinGW directory: ${MINGDIR}") 248 else("$ENV{MINGDIR}" STREQUAL "") 249 file(TO_CMAKE_PATH "$ENV{MINGDIR}" MINGDIR) 250 message(STATUS "Using MINGDIR: ${MINGDIR}") 251 endif("$ENV{MINGDIR}" STREQUAL "") 252 253 # Search in MINGDIR for headers and libraries. 254 set(CMAKE_PREFIX_PATH "${MINGDIR}") 255 256 # Install to MINGDIR 257 if(INSTALL_PREFIX STREQUAL "") 258 set(CMAKE_INSTALL_PREFIX ${MINGDIR}) 259 else(INSTALL_PREFIX STREQUAL "") 260 set(CMAKE_INSTALL_PREFIX ${INSTALL_PREFIX}) 261 endif(INSTALL_PREFIX STREQUAL "") 262 263 message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") 264endif(MINGW)

Basically, for MinGW, it ALWAYS sets CMAKE_INSTALL_PREFIX to c:/mingw. It doesnt' even get to the else(INSTALL_PREFIX STREQUAL "") code because it calls set (INSTALL_PREFIX "") right above it.

I dont' see why that code is needed, or even why it is there. :P

EDIT3
I made a patch that removes the useless INSTALL_PREFIX bit and makes CMake use MINGDIR for CMAKE_INSTALL_PREFIX if CMAKE_INSTALL_PREFIX doesn't exist.

Attached here : install_prefix_fix.diff

#SelectExpand
1 CMakeLists.txt | 8 ++------ 2 1 file changed, 2 insertions(+), 6 deletions(-) 3 4diff --git a/CMakeLists.txt b/CMakeLists.txt 5index dd22353..8f769cd 100644 6--- a/CMakeLists.txt 7+++ b/CMakeLists.txt 8@@ -224,8 +224,6 @@ endif(UNIX) 9 10 option(STRICT_WARN "Halt at warnings" off) 11 12-set(INSTALL_PREFIX "") 13- 14 if(CMAKE_COMPILER_IS_GNUCC) 15 set(COMPILER_GCC 1) 16 set(ALLEGRO_GCC 1) 17@@ -254,11 +252,9 @@ if(MINGW) 18 set(CMAKE_PREFIX_PATH "${MINGDIR}") 19 20 # Install to MINGDIR 21- if(INSTALL_PREFIX STREQUAL "") 22+ if(CMAKE_INSTALL_PREFIX STREQUAL "") 23 set(CMAKE_INSTALL_PREFIX ${MINGDIR}) 24- else(INSTALL_PREFIX STREQUAL "") 25- set(CMAKE_INSTALL_PREFIX ${INSTALL_PREFIX}) 26- endif(INSTALL_PREFIX STREQUAL "") 27+ endif(CMAKE_INSTALL_PREFIX STREQUAL "") 28 29 message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") 30 endif(MINGW)

I tested a new install with my patch applied and it seems to respect CMAKE_INSTALL_PREFIX now.

SiegeLord
Member #7,827
October 2006
avatar

There's a slightly better way to do it: https://github.com/liballeg/allegro5/commit/5fc337cf9225ce1706ff438a2dc5279cef79bcbf

Thanks for bringing this up.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Go to: