• Advertisement
Sign in to follow this  

Compiled library is not placed in the cmake build directory

This topic is 567 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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? 

Share this post


Link to post
Share on other sites

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 ;)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement