diff --git a/README.md b/README.md index 191bfd0d..cc458179 100644 --- a/README.md +++ b/README.md @@ -61,14 +61,14 @@ To install Cuttlefish from the source, you may use the following: ```bash git clone https://github.com/COMBINE-lab/cuttlefish.git cd cuttlefish && mkdir build && cd build - cmake .. + cmake -DCMAKE_INSTALL_PREFIX=../ .. make -j 8 install cd .. ``` -You may replace `8` in `make -j 8 install` with the preferred count for threads to use in the installation process. +You may replace `8` in `make -j 8` with the preferred count for threads to use in the installation process. -This compilation process installs Cuttlefish in a default sub-directory named `bin`, inside the project root directory. To specify a different installation directory, its path may be passed as the value of `-DCMAKE_INSTALL_PREFIX` with the `cmake` command, i.e. you may use `cmake -DCMAKE_INSTALL_PREFIX=custome-path/ ..` . +This compilation process installs Cuttlefish in a sub-directory named `bin`, inside the project root directory. To specify a different installation directory, its path may be passed as the value of `-DCMAKE_INSTALL_PREFIX` with the `cmake` command, i.e. you may use `cmake -DCMAKE_INSTALL_PREFIX=custom_path/ ..` . Then the installed Cuttlefish executable will be found in `custom_path/bin/`. Skipping `-DCMAKE_INSTALL_PREFIX` entirely will install Cuttlefish in `/usr/local/bin`, for which `sudo` access might be required (i.e. `sudo make -j 8 install`). ## Usage diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f68ee3e3..e9dbf75a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -65,21 +65,11 @@ target_link_libraries(${PROJECT_NAME} PRIVATE core) target_compile_options(${PROJECT_NAME} PRIVATE ${WARNING_FLAGS} ${SUPPRESS_WARNING_FLAGS} ${OPTIMIZE_FLAGS}) -# Set the parent directory for the target binaries inside the "installation directory". The -# installation directory is set to `/usr/local` by default. If it's set there, i.e. the user -# have not passed any other value for such, then the parent installation directory is set to -# a default (`bin`) directory at the top level of the source tree. To specify a different parent -# installation directory, pass its path as the value of the `-DCMAKE_INSTALL_PREFIX` with the -# `cmake` command. - -set(DEFAULT_INSTALL_DIR ${CMAKE_SOURCE_DIR}/bin) # Set our default installation directory as a `bin` directory inside the top level of the source tree. -set(INSTALL_DIR .) # Set the installation directory to what CMake has recieved, i.e. either the system default or the user-provided one. -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # If it's set to the system default, then set it to our defined default directory. - set(INSTALL_DIR ${DEFAULT_INSTALL_DIR}) -endif() - +# Set the installation directory. The parent directory is `/usr/local/` by default, and the +# user may set it to a different path by passing a value for `CMAKE_INSTALL_PREFIX`. The target +# executable is installed inside a sub-directory named `bin` within the parent directory. install(TARGETS ${PROJECT_NAME} - DESTINATION ${INSTALL_DIR} + DESTINATION bin )