[llvm-commits] [PATCH] Compiler-RT CMake patch so it can be built in the LLVM tree

Ruben Van Boxem vanboxem.ruben at gmail.com
Sat Mar 17 07:24:15 PDT 2012


Hi,

The instructions at http://clang.llvm.org/get_started.html (at least for
Unix) say that you can place compiler-rt in the LLVM tree and have it built
along with LLVM and Clang.

I tried this on Windows with CMake, and got bitten by some bugs in the
Cmakelists.txt files. Attached is a patch to the compiler-rt Cmake file to
use CMAKE_CURRENT_SOURCE_DIR so the correct directories are found. I also
attached a patch to enable compiler-rt to be built if it is present in the
"projects" subdirectory.

These are both trivial changes.

Please comment or apply, thanks!

Ruben

PS: I'm not subscribed, please reply-to-all so I'm not missed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120317/9c38f141/attachment.html>
-------------- next part --------------
Index: projects/CMakeLists.txt
===================================================================
--- projects/CMakeLists.txt	(revision 152936)
+++ projects/CMakeLists.txt	(working copy)
@@ -4,8 +4,8 @@
 file(GLOB entries *)
 foreach(entry ${entries})
   if(IS_DIRECTORY ${entry} AND EXISTS ${entry}/CMakeLists.txt)
-    if(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/compiler-rt)
+    #if(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/compiler-rt)
       add_subdirectory(${entry})
-    endif()
+    #endif()
   endif()
 endforeach(entry)
-------------- next part --------------
Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt	(revision 152732)
+++ test/CMakeLists.txt	(working copy)
@@ -5,7 +5,7 @@
 
 # create test library
 # add_library(${CompilerRT_LIBRARY} STATIC support.c cmdline.c)
-TARGET_LINK_LIBRARIES( ${CompilerRT_LIBRARY} )
+#TARGET_LINK_LIBRARIES( ${CompilerRT_LIBRARY} )
 
 # FIXME: We should check Optmized versions of CompilerRT-* here also.
 SET( TEST_TARGET_LIBRARIES ${CompilerRT_LIBRARY}-Generic )
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 152732)
+++ CMakeLists.txt	(working copy)
@@ -8,7 +8,8 @@
 set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
 set(PACKAGE_BUGREPORT "llvmbugs at cs.uiuc.edu")
 
-SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules )
+SET( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules )
+message( "${CMAKE_MODULE_PATH}" )
 
 # add definitions
 include(DefineCompilerFlags)
@@ -19,8 +20,8 @@
  "${PROJECT_NAME} requires an out of source build. Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
  )
 
-INCLUDE( ${CMAKE_SOURCE_DIR}/cmake/ConfigureChecks.cmake )
-CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/cmake/config.h.cmake
+INCLUDE( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ConfigureChecks.cmake )
+CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.h.cmake
                 ${CMAKE_CURRENT_BINARY_DIR}/config.h )
 
 INCLUDE_DIRECTORIES(


More information about the llvm-commits mailing list