Author | Jamozed <[email protected]> |
Date | 2020-07-06 09:14:09 |
Commit | d8fa0c9bc6ec57ff061780b4354b54eb66237776 |
Parent | 29dd2d0e47d76bcdf262a0ef505615633be4b097 |
meta: Fix CMake directories
Using CMAKE_SOURCE_DIR was resulting in build failure when building as a submodule, so PROJECT_SOURCE_DIR is used to ensure correct paths.
Diffstat
M | CMakeLists.txt | | | 62 | +++++++++++++++++++++++++++++++------------------------------- |
M | README.md | | | 4 | ++-- |
M | build/buildUNIX.sh | | | 4 | ++-- |
3 files changed, 35 insertions, 35 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6590661..917be3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,41 +1,41 @@ # CMakeLists.txt # CMakeLists file for OMKOV coreutils -CMAKE_MINIMUM_REQUIRED(VERSION 3.9) +CMAKE_MINIMUM_REQUIRED(VERSION 3.12) PROJECT(coreutils C) SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/ext) +INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/ext) -ADD_EXECUTABLE(basename ${CMAKE_SOURCE_DIR}/src/basename.c) -ADD_EXECUTABLE(cat ${CMAKE_SOURCE_DIR}/src/cat.c) -ADD_EXECUTABLE(cksum ${CMAKE_SOURCE_DIR}/src/cksum.c) -ADD_EXECUTABLE(crc32 ${CMAKE_SOURCE_DIR}/src/crc32.c) -ADD_EXECUTABLE(dirname ${CMAKE_SOURCE_DIR}/src/dirname.c) -ADD_EXECUTABLE(echo ${CMAKE_SOURCE_DIR}/src/echo.c) -ADD_EXECUTABLE(env ${CMAKE_SOURCE_DIR}/src/env.c) -ADD_EXECUTABLE(false ${CMAKE_SOURCE_DIR}/src/false.c) -ADD_EXECUTABLE(head ${CMAKE_SOURCE_DIR}/src/head.c) -ADD_EXECUTABLE(id ${CMAKE_SOURCE_DIR}/src/id.c) -ADD_EXECUTABLE(link ${CMAKE_SOURCE_DIR}/src/link.c) -ADD_EXECUTABLE(logname ${CMAKE_SOURCE_DIR}/src/logname.c) -ADD_EXECUTABLE(mkdir ${CMAKE_SOURCE_DIR}/src/mkdir.c) -ADD_EXECUTABLE(nice ${CMAKE_SOURCE_DIR}/src/nice.c) -ADD_EXECUTABLE(od ${CMAKE_SOURCE_DIR}/src/od.c) -ADD_EXECUTABLE(pwd ${CMAKE_SOURCE_DIR}/src/pwd.c) -ADD_EXECUTABLE(rand ${CMAKE_SOURCE_DIR}/src/rand.c) -ADD_EXECUTABLE(realpath ${CMAKE_SOURCE_DIR}/src/realpath.c) -ADD_EXECUTABLE(rmdir ${CMAKE_SOURCE_DIR}/src/rmdir.c) -ADD_EXECUTABLE(sleep ${CMAKE_SOURCE_DIR}/src/sleep.c) -ADD_EXECUTABLE(sync ${CMAKE_SOURCE_DIR}/src/sync.c) -ADD_EXECUTABLE(tee ${CMAKE_SOURCE_DIR}/src/tee.c) -ADD_EXECUTABLE(time ${CMAKE_SOURCE_DIR}/src/time.c) -ADD_EXECUTABLE(touch ${CMAKE_SOURCE_DIR}/src/touch.c) -ADD_EXECUTABLE(true ${CMAKE_SOURCE_DIR}/src/true.c) -ADD_EXECUTABLE(tty ${CMAKE_SOURCE_DIR}/src/tty.c) -ADD_EXECUTABLE(uname ${CMAKE_SOURCE_DIR}/src/uname.c) -ADD_EXECUTABLE(unlink ${CMAKE_SOURCE_DIR}/src/unlink.c) -ADD_EXECUTABLE(yes ${CMAKE_SOURCE_DIR}/src/yes.c) +ADD_EXECUTABLE(basename ${PROJECT_SOURCE_DIR}/src/basename.c) +ADD_EXECUTABLE(cat ${PROJECT_SOURCE_DIR}/src/cat.c) +ADD_EXECUTABLE(cksum ${PROJECT_SOURCE_DIR}/src/cksum.c) +ADD_EXECUTABLE(crc32 ${PROJECT_SOURCE_DIR}/src/crc32.c) +ADD_EXECUTABLE(dirname ${PROJECT_SOURCE_DIR}/src/dirname.c) +ADD_EXECUTABLE(echo ${PROJECT_SOURCE_DIR}/src/echo.c) +ADD_EXECUTABLE(env ${PROJECT_SOURCE_DIR}/src/env.c) +ADD_EXECUTABLE(false ${PROJECT_SOURCE_DIR}/src/false.c) +ADD_EXECUTABLE(head ${PROJECT_SOURCE_DIR}/src/head.c) +ADD_EXECUTABLE(id ${PROJECT_SOURCE_DIR}/src/id.c) +ADD_EXECUTABLE(link ${PROJECT_SOURCE_DIR}/src/link.c) +ADD_EXECUTABLE(logname ${PROJECT_SOURCE_DIR}/src/logname.c) +ADD_EXECUTABLE(mkdir ${PROJECT_SOURCE_DIR}/src/mkdir.c) +ADD_EXECUTABLE(nice ${PROJECT_SOURCE_DIR}/src/nice.c) +ADD_EXECUTABLE(od ${PROJECT_SOURCE_DIR}/src/od.c) +ADD_EXECUTABLE(pwd ${PROJECT_SOURCE_DIR}/src/pwd.c) +ADD_EXECUTABLE(rand ${PROJECT_SOURCE_DIR}/src/rand.c) +ADD_EXECUTABLE(realpath ${PROJECT_SOURCE_DIR}/src/realpath.c) +ADD_EXECUTABLE(rmdir ${PROJECT_SOURCE_DIR}/src/rmdir.c) +ADD_EXECUTABLE(sleep ${PROJECT_SOURCE_DIR}/src/sleep.c) +ADD_EXECUTABLE(sync ${PROJECT_SOURCE_DIR}/src/sync.c) +ADD_EXECUTABLE(tee ${PROJECT_SOURCE_DIR}/src/tee.c) +ADD_EXECUTABLE(time ${PROJECT_SOURCE_DIR}/src/time.c) +ADD_EXECUTABLE(touch ${PROJECT_SOURCE_DIR}/src/touch.c) +ADD_EXECUTABLE(true ${PROJECT_SOURCE_DIR}/src/true.c) +ADD_EXECUTABLE(tty ${PROJECT_SOURCE_DIR}/src/tty.c) +ADD_EXECUTABLE(uname ${PROJECT_SOURCE_DIR}/src/uname.c) +ADD_EXECUTABLE(unlink ${PROJECT_SOURCE_DIR}/src/unlink.c) +ADD_EXECUTABLE(yes ${PROJECT_SOURCE_DIR}/src/yes.c) diff --git a/README.md b/README.md index 09b1ae7..18a08f6 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Utilities marked with a '\*' may be incomplete or non-complaint. ## Build Instructions -OMKOV coreutils uses CMake to build. +OMKOV coreutils uses CMake and Make to build. Binaries will be located in the `bin` directory. ### UNIX Build @@ -52,7 +52,7 @@ Run `buildUNIX.sh` in the `build` directory, or ```sh cd build -cmake ../ +cmake -DCMAKE_BUILD_TYPE=Release ../ make ``` diff --git a/build/buildUNIX.sh b/build/buildUNIX.sh index d7d509f..38dd3a2 100755 --- a/build/buildUNIX.sh +++ b/build/buildUNIX.sh @@ -1,4 +1,4 @@ #!/usr/bin/env sh -dir="$(dirname $(realpath "$0"))" -cd "$dir" && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ../ && make +dir="$(dirname $(realpath "$0"))" && cd "$dir" +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ../ && make mv -f "compile_commands.json" "../compile_commands.json"