CMake: Disable ENABLE_EXPORTS for executables with MSVC
authorReid Kleckner <reid@kleckner.net>
Wed, 18 Mar 2015 20:09:13 +0000 (20:09 +0000)
committerReid Kleckner <reid@kleckner.net>
Wed, 18 Mar 2015 20:09:13 +0000 (20:09 +0000)
commit85ab1e7fe79dcc05d2402c4cfc34f324c9ece65f
treeda5feeba9deff8f1b482975f1a89044329cd451f
parent325aa050d595b9a1bbf0123ebfef029598624aee
CMake: Disable ENABLE_EXPORTS for executables with MSVC

The MSVC linker won't produce a .lib file for an executable that doesn't
export anything, and LLVM doesn't maintain dllexport annotations or .def
files listing all C++ symbols. It also doesn't support exporting all
symbols, like binutils ld.

CMake 3.2 changed the Ninja generator to list both the .exe and .lib
files as outputs of executable build targets. Ninja would always re-link
executables with ENABLE_EXPORTS because the .lib output file was not
present, and therefore the target was out of date.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232662 91177308-0d34-0410-b5e6-96231b3b80d8
CMakeLists.txt
cmake/modules/AddLLVM.cmake
examples/ExceptionDemo/CMakeLists.txt
tools/bugpoint/CMakeLists.txt
tools/llc/CMakeLists.txt
tools/lli/CMakeLists.txt
tools/llvm-stress/CMakeLists.txt
tools/opt/CMakeLists.txt