• 9
• 9
• 11
• 12
• 9

# 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.

## 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 on other sites

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 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 on other sites

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

Thanks,

Andreas
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2880656123161316, "perplexity": 3574.4321306483093}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-17/segments/1524125937090.0/warc/CC-MAIN-20180420003432-20180420023432-00140.warc.gz"}