summaryrefslogtreecommitdiff
path: root/unittests/Support/DynamicLibrary
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Support/DynamicLibrary')
-rw-r--r--unittests/Support/DynamicLibrary/CMakeLists.txt17
-rw-r--r--unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp8
-rw-r--r--unittests/Support/DynamicLibrary/ExportedFuncs.cpp (renamed from unittests/Support/DynamicLibrary/ExportedFuncs.cxx)2
-rw-r--r--unittests/Support/DynamicLibrary/PipSqueak.cpp (renamed from unittests/Support/DynamicLibrary/PipSqueak.cxx)4
4 files changed, 21 insertions, 10 deletions
diff --git a/unittests/Support/DynamicLibrary/CMakeLists.txt b/unittests/Support/DynamicLibrary/CMakeLists.txt
index 4f060e4020d1..ec202295ac15 100644
--- a/unittests/Support/DynamicLibrary/CMakeLists.txt
+++ b/unittests/Support/DynamicLibrary/CMakeLists.txt
@@ -1,14 +1,23 @@
+# Needed by LLVM's CMake checks because this file defines multiple targets.
+set(LLVM_OPTIONAL_SOURCES ExportedFuncs.cpp PipSqueak.cpp)
+
set(LLVM_LINK_COMPONENTS Support)
-add_library(DynamicLibraryLib STATIC ExportedFuncs.cxx)
+add_library(DynamicLibraryLib STATIC
+ ExportedFuncs.cpp
+ )
set_target_properties(DynamicLibraryLib PROPERTIES FOLDER "Tests")
-add_llvm_unittest(DynamicLibraryTests DynamicLibraryTest.cpp)
+add_llvm_unittest(DynamicLibraryTests
+ DynamicLibraryTest.cpp
+ )
target_link_libraries(DynamicLibraryTests PRIVATE DynamicLibraryLib)
export_executable_symbols(DynamicLibraryTests)
function(dynlib_add_module NAME)
- add_library(${NAME} SHARED PipSqueak.cxx)
+ add_library(${NAME} SHARED
+ PipSqueak.cpp
+ )
set_target_properties(${NAME} PROPERTIES FOLDER "Tests")
set_output_directory(${NAME}
@@ -18,7 +27,7 @@ function(dynlib_add_module NAME)
set_target_properties(${NAME}
PROPERTIES PREFIX ""
- SUFFIX ".so"
+ SUFFIX ${LTDL_SHLIB_EXT}
)
add_dependencies(DynamicLibraryTests ${NAME})
diff --git a/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp b/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
index 370e1c5ed5e8..50a0f1e621fb 100644
--- a/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
+++ b/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
@@ -20,12 +20,14 @@ using namespace llvm;
using namespace llvm::sys;
std::string LibPath(const std::string Name = "PipSqueak") {
- const std::vector<testing::internal::string>& Argvs = testing::internal::GetArgvs();
- const char *Argv0 = Argvs.size() > 0 ? Argvs[0].c_str() : "DynamicLibraryTests";
+ const std::vector<testing::internal::string> &Argvs =
+ testing::internal::GetArgvs();
+ const char *Argv0 =
+ Argvs.size() > 0 ? Argvs[0].c_str() : "DynamicLibraryTests";
void *Ptr = (void*)(intptr_t)TestA;
std::string Path = fs::getMainExecutable(Argv0, Ptr);
llvm::SmallString<256> Buf(path::parent_path(Path));
- path::append(Buf, (Name+".so").c_str());
+ path::append(Buf, (Name + LTDL_SHLIB_EXT).c_str());
return Buf.str();
}
diff --git a/unittests/Support/DynamicLibrary/ExportedFuncs.cxx b/unittests/Support/DynamicLibrary/ExportedFuncs.cpp
index 97f190b0b9bc..370c8cb471d1 100644
--- a/unittests/Support/DynamicLibrary/ExportedFuncs.cxx
+++ b/unittests/Support/DynamicLibrary/ExportedFuncs.cpp
@@ -1,4 +1,4 @@
-//===- llvm/unittest/Support/DynamicLibrary/DynamicLibraryLib.cpp ---------===//
+//===- llvm/unittest/Support/DynamicLibrary/ExportedFuncs.cpp -------------===//
//
// The LLVM Compiler Infrastructure
//
diff --git a/unittests/Support/DynamicLibrary/PipSqueak.cxx b/unittests/Support/DynamicLibrary/PipSqueak.cpp
index 375d72c0b535..e2f1cf7de082 100644
--- a/unittests/Support/DynamicLibrary/PipSqueak.cxx
+++ b/unittests/Support/DynamicLibrary/PipSqueak.cpp
@@ -1,4 +1,4 @@
-//===- llvm/unittest/Support/DynamicLibrary/PipSqueak.cxx -----------------===//
+//===- llvm/unittest/Support/DynamicLibrary/PipSqueak.cpp -----------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -46,4 +46,4 @@ extern "C" PIPSQUEAK_EXPORT void TestOrder(std::vector<std::string> &V) {
}
#define PIPSQUEAK_TESTA_RETURN "LibCall"
-#include "ExportedFuncs.cxx"
+#include "ExportedFuncs.cpp"