https://github.com/Kitware/CMake
Raw File
Tip revision: 64130a7e793483e24c1d68bdd234f81d5edb2d51 authored by Brad King on 24 March 2016, 13:56:42 UTC
CMake 3.5.1
Tip revision: 64130a7
CMakeLists.txt
add_executable(test test.cxx)

if (NOT DEFINED_AFTER_SUBDIRS_COMMAND)
  message(FATAL_ERROR "DEFINED_AFTER_SUBDIRS_COMMAND should be defined.")
endif()

string(FIND "${CMAKE_CURRENT_BINARY_DIR}" "SubDir/Executable" location)
string(LENGTH "${CMAKE_CURRENT_BINARY_DIR}" dirLength)
math(EXPR suffixLength "${dirLength} - ${location}")

if (NOT suffixLength EQUAL 17)
  message(FATAL_ERROR "CMAKE_CURRENT_BINARY_DIR does not end with \"SubDir/Executable\"")
endif()
back to top