DavidTruby wrote:

An example for my previous point. If I have a CMakeLists.txt:
```
project(test LANGUAGES CXX Fortran)
cmake_minimum_required(VERSION 3.28)

add_executable(hello test.cpp test.f90)
```
and the relevant files (doesn't really matter what they contain), then if I 
build with:
```
env CXX=clang++ FC=flang-new CXXFLAGS="-stdlib=libc++" cmake -GNinja ..
ninja -v
```
then I get the output:
```
[1/5] /home/davtru01/Sources/install/Release/bin/clang++   -stdlib=libc++ -MD 
-MT CMakeFiles/hello.dir/test.cpp.o -MF CMakeFiles/hello.dir/test.cpp.o.d -o 
CMakeFiles/hello.dir/test.cpp.o -c /home/davtru01/test/test.cpp
[2/5] /home/davtru01/Sources/install/Release/bin/flang-new -cpp    -E 
/home/davtru01/test/test.f90 > CMakeFiles/hello.dir/test.f90-pp.f90 && 
/nix/store/705xmcakc9xy8zfr81c76r7vg1ijd3x1-cmake-cursesUI-3.29.6/bin/cmake -E 
cmake_ninja_depends --tdi=CMakeFiles/hello.dir/FortranDependInfo.json 
--lang=Fortran --src=CMakeFiles/hello.dir/test.f90-pp.f90 
--out=CMakeFiles/hello.dir/test.f90-pp.f90 
--dep=CMakeFiles/hello.dir/test.f90-pp.f90.d 
--obj=CMakeFiles/hello.dir/test.f90.o --ddi=CMakeFiles/hello.dir/test.f90.o.ddi 
--src-orig=/home/davtru01/test/test.f90
[3/5] 
/nix/store/705xmcakc9xy8zfr81c76r7vg1ijd3x1-cmake-cursesUI-3.29.6/bin/cmake -E 
cmake_ninja_dyndep --tdi=CMakeFiles/hello.dir/FortranDependInfo.json 
--lang=Fortran --dd=CMakeFiles/hello.dir/Fortran.dd 
@CMakeFiles/hello.dir/Fortran.dd.rsp
[4/5] /home/davtru01/Sources/install/Release/bin/flang-new 
-I/home/davtru01/test -ffixed-line-length-72 -c 
CMakeFiles/hello.dir/test.f90-pp.f90 -o CMakeFiles/hello.dir/test.f90.o
[5/5] : && /home/davtru01/Sources/install/Release/bin/clang++ -stdlib=libc++  
CMakeFiles/hello.dir/test.cpp.o CMakeFiles/hello.dir/test.f90.o -o hello 
-L/home/davtru01/Sources/install/Release/lib -lFortranRuntime  -lFortranDecimal 
&& :
```
and a working binary linked to libc++ with no extra special anything required. 
As you can see on the last line, all the correct libraries are added by CMake.

https://github.com/llvm/llvm-project/pull/110598
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to