OSDN Git Service

[libFuzzer] Fix test with shared libraries on Windows.
authorMarcos Pividori <mpividori@google.com>
Sun, 22 Jan 2017 02:28:08 +0000 (02:28 +0000)
committerMarcos Pividori <mpividori@google.com>
Sun, 22 Jan 2017 02:28:08 +0000 (02:28 +0000)
commit2858ad7ec22c469fce14a2822b1e6a46b5f16d85
treee5903530bfad87d2c3d30671b2aec233145f902d
parent61d2c049412f63ee78ab803975b4a966627fb528
[libFuzzer] Fix test with shared libraries on Windows.

We need to set BINARY_DIR to: ${CMAKE_BINARY_DIR}/lib/Fuzzer/test , so the dll
is placed in the same directory than the test LLVMFuzzer-DSOTest, and is found
when executing that test.
As we are using CMAKE_CXX_CREATE_SHARED_LIBRARY to link the dll, we can't modify
the output directory for the import library. It will be created in the same
directory than the dll (in BINARY_DIR), no matter which value we set to
LIBRARY_DIR. So, if we set LIBRARY_DIR to a different directory than BINARY_DIR,
when linking LLVMFuzzer-DSOTest, cmake will look for the import library
LLVMFuzzer-DSO1.lib in LIBRARY_DIR, and won't find it, since it was created in
BINARY_DIR. So, for Windows, we need that LIBRARY_DIR and BINARY_DIR are the
same directory.

Differential Revision: https://reviews.llvm.org/D27870

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292748 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Fuzzer/test/CMakeLists.txt
lib/Fuzzer/test/DSO1.cpp
lib/Fuzzer/test/DSO2.cpp