Index: lib/Fuzzer/test/CMakeLists.txt =================================================================== --- lib/Fuzzer/test/CMakeLists.txt +++ lib/Fuzzer/test/CMakeLists.txt @@ -215,10 +215,23 @@ set_target_properties(LLVMFuzzer-DSOTest PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/Fuzzer/test") -set_target_properties(LLVMFuzzer-DSO1 PROPERTIES LIBRARY_OUTPUT_DIRECTORY - "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib") -set_target_properties(LLVMFuzzer-DSO2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY - "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib") +if(MSVC) + # Import libraries will be created in the bin directory. + # Fixme: I couldn't modify CMAKE_CXX_CREATE_SHARED_LIBRARY to output the + # import library in the ARCHIVE_OUTPUT_DIRECTORY property of the target. + # Now, if we change ARCHIVE_OUTPUT_DIRECTORY to a different directory, the + # library won't be found when needed, because it will be created in the bin + # directory anyway. + set_target_properties(LLVMFuzzer-DSO1 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY + "${CMAKE_BINARY_DIR}/bin") + set_target_properties(LLVMFuzzer-DSO2 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY + "${CMAKE_BINARY_DIR}/bin") +else() + set_target_properties(LLVMFuzzer-DSO1 PROPERTIES LIBRARY_OUTPUT_DIRECTORY + "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib") + set_target_properties(LLVMFuzzer-DSO2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY + "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib") +endif() set(TestBinaries ${TestBinaries} LLVMFuzzer-DSOTest) Index: lib/Fuzzer/test/DSO1.cpp =================================================================== --- lib/Fuzzer/test/DSO1.cpp +++ lib/Fuzzer/test/DSO1.cpp @@ -2,7 +2,9 @@ // License. See LICENSE.TXT for details. // Source code for a simple DSO. - +#ifdef _WIN32 +__declspec( dllexport ) +#endif int DSO1(int a) { if (a < 123456) return 0; Index: lib/Fuzzer/test/DSO2.cpp =================================================================== --- lib/Fuzzer/test/DSO2.cpp +++ lib/Fuzzer/test/DSO2.cpp @@ -2,7 +2,9 @@ // License. See LICENSE.TXT for details. // Source code for a simple DSO. - +#ifdef _WIN32 +__declspec( dllexport ) +#endif int DSO2(int a) { if (a < 3598235) return 0;