cxxmodules: Follow up problems with C++ modules installation
The sample project attached to #25568 (closed) still does not build. The previous issues are solved, but the final application does not link with the following errors:
: && /usr/bin/clang-17 -O3 -DNDEBUG CMakeFiles/application.dir/Release/application.cpp.o -o Release/application /home/mpusz/repos/cmake_issue/local/lib/libmy_library.a && :
/usr/bin/ld: CMakeFiles/application.dir/Release/application.cpp.o: in function `main':
application.cpp:(.text+0x4): undefined reference to `std::cout'
/usr/bin/ld: application.cpp:(.text+0xe): undefined reference to `std::ostream::operator<<(int)'
/usr/bin/ld: application.cpp:(.text+0x22): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
clang-17: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Am I doing something wrong?
Additionally, if I will comment out the following lines in the my_library/CMakeLists.txt file:
target_include_directories(my_library PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>
)
I get the following error while compiling the application:
Error while scanning dependencies for /home/mpusz/repos/cmake_issue/local/lib/miu/my_library.cpp:
/home/mpusz/repos/cmake_issue/local/lib/miu/my_library.cpp:7:10: fatal error: 'my_library/my_library.h' file not found
ninja: build stopped: subcommand failed.
Do I understand correctly, that when FILE_SET HEADERS
is installed then we do not have to provide target_include_directories
for a target?
Edited by Mateusz Pusz