diff options
author | Jan Kotas <jkotas@microsoft.com> | 2017-11-09 03:20:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-09 03:20:39 +0300 |
commit | 162cead08753e6440d7e90ec4fb453a1a651785a (patch) | |
tree | dbb0478e51bd5b376386e6d0a38df7037fe51526 /src/Native/ObjWriter/CMakeLists.txt | |
parent | 2bc2edc1e2b1b0e835366668b53ccfc48ece0949 (diff) | |
parent | 0566d28cd25fb5a8b708b94dd9ba7960a75e3b07 (diff) |
Merge pull request #4894 from dotnet/master
Merge master to nmirror
Diffstat (limited to 'src/Native/ObjWriter/CMakeLists.txt')
-rw-r--r-- | src/Native/ObjWriter/CMakeLists.txt | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/Native/ObjWriter/CMakeLists.txt b/src/Native/ObjWriter/CMakeLists.txt new file mode 100644 index 000000000..ead1db75b --- /dev/null +++ b/src/Native/ObjWriter/CMakeLists.txt @@ -0,0 +1,41 @@ +project(objwriter) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti") +include_directories(${LLVM_INCLUDE_DIRS}) +include_directories(.) +add_definitions(${LLVM_DEFINITIONS}) + +if (WIN32) + # Create .def file containing a list of exports preceeded by + # 'EXPORTS'. The file "objwriter.exports" already contains the list, so we + # massage it into the correct format here to create "objwriter.exports.def". + set(OBJWRITER_EXPORTS_DEF ${CMAKE_CURRENT_BINARY_DIR}/objwriter.exports.def) + set(OBJWRITER_EXPORTS_DEF_TEMP ${OBJWRITER_EXPORTS_DEF}.txt) + file(READ "objwriter.exports" exports_list) + file(WRITE ${OBJWRITER_EXPORTS_DEF_TEMP} "LIBRARY OBJWRITER\n") + file(APPEND ${OBJWRITER_EXPORTS_DEF_TEMP} "EXPORTS\n") + file(APPEND ${OBJWRITER_EXPORTS_DEF_TEMP} ${exports_list}) + # Copy the file only if it has changed. + execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${OBJWRITER_EXPORTS_DEF_TEMP} ${OBJWRITER_EXPORTS_DEF}) +endif() + +# Now build our tools +add_library(objwriter + SHARED + objwriter.cpp + typeBuilder.cpp + objwriter.h # Visual Studio generator doesn't include necessary header files into the project automatically + typeBuilder.h + ${OBJWRITER_EXPORTS_DEF} +) + +# Find the libraries that correspond to the LLVM components +# that we wish to use +llvm_map_components_to_libnames(llvm_libs + ${LLVM_TARGETS_TO_BUILD} +) + +# Link against LLVM libraries +target_link_libraries(objwriter +${llvm_libs}) |