mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 19:36:11 +00:00
Trigger CMake reconfigure if iaito.pro changes and disallow in-source builds. (#184)
* Trigger CMake reconfigure if iaito.pro changes * Disallow in-source builds with CMake * CMake: move disallowing in source build to separate script
This commit is contained in:
parent
6dd0bd1c6a
commit
6c8adef74b
@ -1,12 +1,13 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
include(DisallowInSource)
|
||||
|
||||
project(Iaito VERSION 1.0.0)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
@ -42,7 +43,10 @@ endif()
|
||||
|
||||
# Parse iaito.pro to get filenames
|
||||
include(QMakeProParse)
|
||||
parse_qmake_pro("${CMAKE_CURRENT_SOURCE_DIR}/iaito.pro" IAITO_PRO)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/iaito.pro"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/iaito.pro"
|
||||
COPYONLY) # trigger reconfigure if iaito.pro changes
|
||||
parse_qmake_pro("${CMAKE_CURRENT_BINARY_DIR}/iaito.pro" IAITO_PRO)
|
||||
set(SOURCE_FILES ${IAITO_PRO_SOURCES})
|
||||
set(HEADER_FILES ${IAITO_PRO_HEADERS})
|
||||
set(UI_FILES ${IAITO_PRO_FORMS})
|
||||
|
13
src/cmake/DisallowInSource.cmake
Normal file
13
src/cmake/DisallowInSource.cmake
Normal file
@ -0,0 +1,13 @@
|
||||
function(DisallowInSource)
|
||||
get_filename_component(SRC_DIR_REALPATH "${CMAKE_SOURCE_DIR}" REALPATH)
|
||||
get_filename_component(BINARY_DIR_REALPATH "${CMAKE_BINARY_DIR}" REALPATH)
|
||||
if(SRC_DIR_REALPATH STREQUAL BINARY_DIR_REALPATH)
|
||||
message(FATAL_ERROR " In-source builds are not allowed.
|
||||
Please create a directory and run cmake from there:
|
||||
mkdir build && cd build && cmake ..
|
||||
This process created the file CMakeCache.txt and the directory CMakeFiles in ${CMAKE_SOURCE_DIR}.
|
||||
Please delete them manually!")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
DisallowInSource()
|
Loading…
Reference in New Issue
Block a user