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)
commit3e8c445c9695bde9856ba912841cb3ee4901e607
tree8a18fd615e5a55758bad1f4796e5469a286d3904
parent3d86b235119e4bd90c944228803c2d6fa622f3f8
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.

llvm-svn: 232662
llvm/CMakeLists.txt
llvm/cmake/modules/AddLLVM.cmake
llvm/examples/ExceptionDemo/CMakeLists.txt
llvm/tools/bugpoint/CMakeLists.txt
llvm/tools/llc/CMakeLists.txt
llvm/tools/lli/CMakeLists.txt
llvm/tools/llvm-stress/CMakeLists.txt
llvm/tools/opt/CMakeLists.txt