skapunch/box2d

LIB_INSTALL_DIR not set in CMakeList.txt

Closed this issue · 13 comments

When trying to build Box2D with CMake 2.8.8 you get the error:
"install TARGETS given no ARCHIVE DESTINATION for static library target"

On line 196 or 199 in Box2D CMakeList.txt there's a variable used with the name 
${LIB_INSTALL_DIR}, but it has never been declared anywhere.

Adding
set(LIB_INSTALL_DIR, CMAKE_INSTALL_PREFIX)
solves the problem.

Original issue reported on code.google.com by l.duerre...@gmail.com on 24 Jun 2012 at 8:03

[deleted comment]
tried this fix in a number of places, is there a less obscure build method than 
cmake?

Original comment by codifies on 22 Sep 2012 at 10:40

@codifies - I'm having trouble using CMake to compile Box2d (fresh from SVN), 
both on Ubuntu Linux and Windows (CMake 2.8.9/2.8.10). 

Cmake appears to be ignoring command-lines vars, so I can't pass or set() 
'CMAKE_INSTALL_PREFIX'). I've tried some simple CMake debug using the following:

#DEBUG - Value of CMAKE_INSTALL_PREFIX
get_cmake_property(INSTALLDIR CMAKE_INSTALL_PREFIX)
message(STATUS "*** CMAKE_INSTALL_PREFIX=${INSTALLDIR} ***")

at the top of <box2d-dir>/Box2d/CMakeLists.txt (main file), but all I get is 
'NOTFOUND', even if I set the variable *directly* within the CMake file.

I tried 'set(LIB_INSTALL_DIR, CMAKE_INSTALL_PREFIX)' in the file referred to by 
lines 196/199 (<box2d-proj>/Box2D/Box2D/CMakeLists.txt), but that doesn't work 
for me, either.

JFYI, there are a couple of Box2D-related projects on GitHub that are using 
'qmake'. This is OK with me, as I was thinking about coding with QT Creator 
anyway, which can use QMake or CMake. The projects are:

https://github.com/sudnikand/QBox2D -> Check out the Box2D/Box2d.pro script 
(qmake==pro)

https://github.com/jryannel/qw-box2d -> Uses qmake (pro) file to compile his 
project, assumes that Box2d has already been compiled/installed elsewhere (see 
.pro script).

Maybe you'll find these projects useful until we can fix the CMake stuff :-)

Original comment by sixm...@gmail.com on 5 Nov 2012 at 4:32

Any danger of using just Make in conjunction with backticked pkg-config
(it works very robustly) and follows the KISS principle

akaik if using mingw this should even work on Windows.

I don't know about Mac command line but if there is a port of gnu tools / 
pkg-config etc but this would be very low maintenance simple method.

just a thought but the larger a build system is the more there is to go 
wrong...    

Original comment by codifies on 5 Nov 2012 at 4:43

@codifies - I like the Keep It Simple mantra, however, I'm from a Java 
background and a newbie to C/C++, so for me, right now, keeping it simple is 
having a working build script/system ;-) .

If I ever get to understand your suggested pkg-config usage, I'll let you know 
;-) .

Thanks again.

Original comment by sixm...@gmail.com on 5 Nov 2012 at 5:08

have a look at gles2framework on githib - ignore the complications caused
by raspberry pi
the makefile shows an example using pkg-config in a makefile

java being less archaic has a number of advantages - you might want to look
at jipmunk - the guys done such a good job I was compelled to write some
extra examples!


-- 

Disclaimer:
By sending an email to ANY of my addresses you are agreeing that:

   1. I am by definition, "the intended recipient"

   2. All information in the email is mine to do with as I see fit and
make such financial profit, political mileage, or good joke as it
lends itself to. In particular, I may quote it where I please.

   3. I may take the contents as representing the views of your company.

   4. This overrides any disclaimer or statement of confidentiality
that may be included on your message.

Original comment by codifies on 5 Nov 2012 at 5:15

@codifies - Thanks, I'll take a look at both.

Thing is, I've decided on making something cross-platform for both Android and 
IOS (and possibly Blackberry, don't ask) and I'm drawn to using Marmalade 
(www.madewithmarmalade.com) which is C/C++ based. A decent Box2d fork is 
already available for it, just thought I 'dabble', first.

I could go Java/Android, but I'm being lazy and trying to catch 2 birds with 
one stone. So going C/C++ it is, also gives me a reason to add a new language 
to my belt ;-)

Apologies to Box2d for hijacking your issues page.

Cheers

Original comment by sixm...@gmail.com on 5 Nov 2012 at 5:29

Add this argument to the cmake call: -DLIB_INSTALL_DIR=<THE_PATH_YOU_WANT>

or, if you prefer to edit CMakeLists, use something like:

set(LIB_INSTALL_DIR, ${CMAKE_INSTALL_PREFIX}) # notice the ${}

Original comment by anselmo...@gmail.com on 29 Nov 2012 at 12:49

Anselmo, the '-DLIB_INSTALL_DIR=<THE_PATH_YOU_WANT>' argument seems to do the 
trick ;-)

Thanks man,

Cheers

Rich

Original comment by sixm...@gmail.com on 29 Nov 2012 at 2:21

Damn this a huge problem why cmake gui did not show option LIB_INSTALL_DIR 
without it i can't install Box2D.

And one more thing... why you need this option(LIB_INSTALL_DIR)??? All normal 
devs uses
CMAKE_INSTALL_PREFIX which user setting to dir where they want install. Look at 
libraries SFML, TGUI, MyGUI, Bullet Physics and Ogre3D and enother 1500+ libs...

And another thing... are you disable CMAKE_DEBUG_POSTFIX ??? All libs have 
prefix for debug version, so all project can link debug version with debug and 
release with release.

With this problem i must have this config script to build Box2D on windows and 
probably something similar in linux:

cmake -G "MinGW Makefiles" -D 
CMAKE_INSTALL_PREFIX:STRING="%current_dir%\%install_dir%" -D 
LIB_INSTALL_DIR:STRING="%current_dir%\%install_dir%" -D 
CMAKE_DEBUG_POSTFIX:STRING="-d"  -D BOX2D_BUILD_SHARED:BOOL=false -D 
BOX2D_BUILD_STATIC:BOOL=true -D BOX2D_BUILD_EXAMPLES:BOOL=false -D 
BOX2D_INSTALL:BOOL=true -D BOX2D_INSTALL_DOC:BOOL=false 
"%current_dir%/%sources_dir%"
::building Debug
cmake -D CMAKE_BUILD_TYPE:STRING=Debug "%current_dir%/%sources_dir%"
mingw32-make.exe
mingw32-make.exe install
::building Release
cmake -D CMAKE_BUILD_TYPE:STRING=Release "%current_dir%/%sources_dir%"
mingw32-make.exe
mingw32-make.exe install

Guys really WTF??? I understand that this is open source and no one no one is 
obliged to... but... really wtf?

I'm new with this physics engine. I download the source from svn and 
immediately get my hands dirty in shit)

BTW Box2D is awesome)))

I'm done)))

Original comment by Hro...@gmail.com on 24 Sep 2013 at 6:51

All the CMake stuff for Linux is from contributions. I really don't like cmake 
so I don't want to spend time to learn it better. Also, I don't have Linux, so 
I cannot test it.

I will happily apply a patch.

Original comment by erinca...@gmail.com on 23 Oct 2013 at 6:03

  • Changed state: Accepted
Hi,

Here is a patch, you need to set LIB_INSTALL_DIR to 'lib':
set(LIB_INSTALL_DIR lib${LIB_SUFFIX})
so libraries will be installed in CMAKE_INSTALL_PREFIX/lib

LIB_SUFFIX is needed and can be set to '64' for rpm distros where x86_64 
libraries are installed to /usr/lib64

J.

Original comment by julien.s...@gmail.com on 30 Oct 2013 at 7:20

Attachments:

Thanks for the patch!

Completed: At revision: 273  

Original comment by erinca...@gmail.com on 31 Oct 2013 at 5:32

  • Changed state: Fixed