Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using CMake why do some targets/path contain /__/?

Tags:

path

cmake

CMake introduces /__/ in paths. What's the reason?

Here an example from compiling METIS which uses CMake:

[  3%] Building C object libmetis/CMakeFiles/metis.dir/__/GKlib/b64.c.o
cd /workstuff/dune/zusatz/metis-5.0.2/build/Linux-x86_64/libmetis && /usr/bin/gcc
-DLINUX -D_FILE_OFFSET_BITS=64 -std=c99 -fno-strict-aliasing -fPIC -Wall 
-pedantic -Wno-unused-variable -Wno-unknown-pragmas -DNDEBUG -DNDEBUG2
-DHAVE_EXECINFO_H -DHAVE_GETLINE -O3 -I/workstuff/dune/zusatz/metis-5.0.2/GKlib
-I/workstuff/dune/zusatz/metis-5.0.2/include -I/workstuff/dune/zusatz/metis-5.0.2/libmetis/.
-o CMakeFiles/metis.dir/__/GKlib/b64.c.o -c /workstuff/dune/zusatz/metis-5.0.2/GKlib/b64.c
like image 757
usr1234567 Avatar asked Sep 14 '26 15:09

usr1234567


1 Answers

We observe this behavior when adding files to a library / an executable that are not located in a sub-directory of the "current source dir" thus using "/../".

Here an example of when we get this:

FILE(GLOB inFiles
    "${CMAKE_CURRENT_SOURCE_DIR}/../BuildEnvCommon/*.c"
    "${CMAKE_CURRENT_SOURCE_DIR}/../BuildEnvCommon/*.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/../BuildEnvCommon/*.hpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/../BuildEnvCommon/*.h"
)

(snip)

add_executable("ProjectName" ${inFiles})

In your example I can imagine that the GKlib is not located in the libmetis source tree but that the compiled source b64.c is added by hand into the library / the executable and compiled as part of it instead of linking against a (separately) compiled GKlib. I hope it's clear what I mean.

like image 158
Roland Sarrazin Avatar answered Sep 20 '26 10:09

Roland Sarrazin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!