diff --git a/CMakeLists.txt b/CMakeLists.txt index faf61a839..094522f7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,9 @@ enable_language(ASM) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") include(InstallSymlink) +include(MacroEnsureOutOfSourceBuild) + +MACRO_ENSURE_OUT_OF_SOURCE_BUILD() set(DARLING_TOP_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") set(DARLING_NO_EXECUTABLES OFF) diff --git a/cmake/MacroEnsureOutOfSourceBuild.cmake b/cmake/MacroEnsureOutOfSourceBuild.cmake new file mode 100644 index 000000000..c78281f28 --- /dev/null +++ b/cmake/MacroEnsureOutOfSourceBuild.cmake @@ -0,0 +1,14 @@ +macro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD ) +string( COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource ) +if( _insource ) + message( FATAL_ERROR + "In-source builds are not allowed. + CMake would overwrite the Linux kernel module Makefile. + Please create a directory and run cmake from there, passing the path + to this source directory as the last argument. + This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. + Please delete them." + ) +endif( _insource ) +endmacro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD ) + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 981413012..e04f42b2a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -188,11 +188,6 @@ add_subdirectory(external/zsh) add_subdirectory(external/doc_cmds) add_subdirectory(external/libcxxabi) add_subdirectory(external/libcxx) +add_subdirectory(lkm) -####################### -# Linux kernel module # -####################### -add_custom_target(lkm - COMMAND gmake - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lkm") diff --git a/src/lkm b/src/lkm index 5a5b433f1..00c2c8e39 160000 --- a/src/lkm +++ b/src/lkm @@ -1 +1 @@ -Subproject commit 5a5b433f109933a584328ba2c161906f4165be8a +Subproject commit 00c2c8e39d2919736da09e0735d94eeb316929a5