an-dr/abcmake

Error if the main.cpp file is near cmakelists.txt

an-dr opened this issue · 0 comments

Function to reproduce:

add_main_component(${PROJECT_NAME} SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}")

Error

/usr/bin/ld: CMakeFiles/VisionerWebcam.dir/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:/home/agramakov/VisioneR/src/VisionerWebcam/build/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp:388: multiple definition of `info_compiler'; CMakeFiles/VisionerWebcam.dir/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c.o:/home/agramakov/VisioneR/src/VisionerWebcam/build/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c:403: first defined here
/usr/bin/ld: CMakeFiles/VisionerWebcam.dir/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:/home/agramakov/VisioneR/src/VisionerWebcam/build/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp:717: multiple definition of `info_platform'; CMakeFiles/VisionerWebcam.dir/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c.o:/home/agramakov/VisioneR/src/VisionerWebcam/build/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c:732: first defined here
/usr/bin/ld: CMakeFiles/VisionerWebcam.dir/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:/home/agramakov/VisioneR/src/VisionerWebcam/build/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp:718: multiple definition of `info_arch'; CMakeFiles/VisionerWebcam.dir/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c.o:/home/agramakov/VisioneR/src/VisionerWebcam/build/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c:733: first defined here
/usr/bin/ld: CMakeFiles/VisionerWebcam.dir/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:/home/agramakov/VisioneR/src/VisionerWebcam/build/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp:738: multiple definition of `info_language_standard_default'; CMakeFiles/VisionerWebcam.dir/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c.o:/home/agramakov/VisioneR/src/VisionerWebcam/build/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c:754: first defined here
/usr/bin/ld: CMakeFiles/VisionerWebcam.dir/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:/home/agramakov/VisioneR/src/VisionerWebcam/build/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp:754: multiple definition of `info_language_extensions_default'; CMakeFiles/VisionerWebcam.dir/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c.o:/home/agramakov/VisioneR/src/VisionerWebcam/build/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c:757: first defined here
/usr/bin/ld: CMakeFiles/VisionerWebcam.dir/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp.o: in function `main':
/home/agramakov/VisioneR/src/VisionerWebcam/build/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp:768: multiple definition of `main'; CMakeFiles/VisionerWebcam.dir/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c.o:/home/agramakov/VisioneR/src/VisionerWebcam/build/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c:778: first defined here
/usr/bin/ld: CMakeFiles/VisionerWebcam.dir/main.cpp.o: in function `bool std::__constant_string_p<char>(char const*)':
/home/agramakov/VisioneR/src/VisionerWebcam/main.cpp:20: multiple definition of `main'; CMakeFiles/VisionerWebcam.dir/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c.o:/home/agramakov/VisioneR/src/VisionerWebcam/build/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c:778: first defined here
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.