Compiled library is not placed in the cmake build directory

Started by
3 comments, last by deveee 7 years, 6 months ago

The compiled library is placed in a directory related to project sources dir:

set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../../lib)

This causes issues when you have more than single build directory in the project. I personally have maybe 10 different build directories for different compilers/platforms ;) (linux compilation, mingw-32bit, mingw-64bit, 32-bit linux static package, 64-bit static package etc...). All these build directories use by default single library which is placed in "${PROJECT_SOURCE_DIR}/../../lib". This causes erros when linking final executable. For example the 32-bit executable tries to link previously compiled 64-bit library.

Here is original bug report:

https://github.com/supertuxkart/stk-code/issues/2325

We fixed this by just removing this line. It would be nice to make this fix upstream, so that we won't need to apply this modification after every update.

Advertisement

Thanks for the bug report. It makes perfect sense. I'll have the changes made in the SVN.

Please excuse my ignorance (I'm not a Linux developer and don't personally use cmake), but where will the library be written to by removing this line?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Actually there were two lines that I removed. It was this commit:

https://github.com/supertuxkart/stk-code/commit/f351c359fd9100910e7e5336086233e24f73abeb

In our case it is placed in build directory:

stk-code\build\lib\angelscript\projects\cmake\libangelscript.a

The path seems to be a bit complicated because cmake file is in "projects\cmake". Otherwise it would be:

stk-code\build\lib\angelscript\libangelscript.a

If you need something more simple, you can use ${CMAKE_BINARY_DIR} for the LIBRARY_OUTPUT_PATH variable, for example something like:

set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/angelscript/lib)

set(RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/angelscript/bin)

Though I didn't check if it works ;)

I've checked in the changes in revision 2353 for the next 2.31.2 release.

Thanks,

Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Thanks a lot!

This topic is closed to new replies.

Advertisement