From 451499f79c051da56ab2b5a78b9f8a88fceebe63 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Wed, 25 Oct 2017 19:04:40 +0200 Subject: [PATCH 1/2] Set WINDOWS_EXPORT_ALL_SYMBOLS property for for shared flangrti target. This works around the issue with missing __declspec(dllexport/dllimport) declerations in the source files. --- runtime/flangrti/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/flangrti/CMakeLists.txt b/runtime/flangrti/CMakeLists.txt index 82cbe1bfb6b..2dc0cda32f1 100644 --- a/runtime/flangrti/CMakeLists.txt +++ b/runtime/flangrti/CMakeLists.txt @@ -234,6 +234,8 @@ set_target_properties(flangrti_shared flangrti_static if (NOT MSVC) target_compile_options(flangrti_static PRIVATE -fPIC) target_compile_options(flangrti_shared PRIVATE -fPIC) +else() + set_target_properties(flangrti_shared PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) endif() target_compile_options(flangrti_static PUBLIC $<$:-Mreentrant>) From 970f43bb7387a4f29b1b7a87cace277b64da55ec Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Wed, 25 Oct 2017 19:09:31 +0200 Subject: [PATCH 2/2] Set the target linker language for the flang libraries to CXX on windows. This makes sure link.exe from Visual Studio is used to link the libraries, even though the libraries include fortran code. CMake is not able to detect this since the flang fortran compiler is not working at CMake configure time and thus the CMAKE_Fortran_COMPILER_ID is unknown. --- runtime/flang/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/flang/CMakeLists.txt b/runtime/flang/CMakeLists.txt index 345cc88c2ad..a6a4403fa66 100644 --- a/runtime/flang/CMakeLists.txt +++ b/runtime/flang/CMakeLists.txt @@ -579,6 +579,9 @@ add_dependencies(flang_shared if (NOT MSVC) target_compile_options(flang_static PRIVATE -fPIC) target_compile_options(flang_shared PRIVATE -fPIC) +else() + set_target_properties(flang_static PROPERTIES LINKER_LANGUAGE CXX) + set_target_properties(flang_shared PROPERTIES LINKER_LANGUAGE CXX) endif() target_compile_options(flang_static PUBLIC $<$:-Mreentrant>)