From ce54f6d9570eb2b5c80379e8a3849025f4ef183e Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 29 Feb 2016 23:06:35 +0000 Subject: [PATCH] Fix racing MSVC CMake build. The ``libz3`` target must have a different OUTPUT_NAME than the ``shell`` target to avoid conflicting file names. --- src/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e8edf8b5e..a85e025c3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -90,7 +90,6 @@ endif() add_library(libz3 ${lib_type} ${object_files}) # FIXME: Set "VERSION" and "SOVERSION" properly set_target_properties(libz3 PROPERTIES - OUTPUT_NAME z3 # FIXME: Should we be using ${Z3_VERSION} here? # VERSION: Sets up symlinks, does it do anything else? VERSION ${Z3_VERSION} @@ -98,6 +97,16 @@ set_target_properties(libz3 PROPERTIES # and should be incremented everytime the API changes SOVERSION ${Z3_VERSION}) +if (NOT MSVC) + # On UNIX like platforms if we don't change the OUTPUT_NAME + # the library gets a name like ``liblibz3.so`` so we change it + # here. We don't do a rename with MSVC because we get file naming + # conflicts (the z3 executable also has this OUTPUT_NAME) with + # ``.ilk``, ``.pdb``, ``.lib`` and ``.exp`` files sharing the same + # prefix. + set_target_properties(libz3 PROPERTIES OUTPUT_NAME z3) +endif() + # Using INTERFACE means that targets that try link against libz3 will # automatically link against the libs in Z3_DEPENDENT_LIBS target_link_libraries(libz3 INTERFACE ${Z3_DEPENDENT_LIBS})