CMakeLists.txt 463 B

12345678910111213
  1. add_executable(test test.cxx)
  2. if (NOT DEFINED_AFTER_SUBDIRS_COMMAND)
  3. message(FATAL_ERROR "DEFINED_AFTER_SUBDIRS_COMMAND should be defined.")
  4. endif()
  5. string(FIND "${CMAKE_CURRENT_BINARY_DIR}" "SubDir/Executable" location)
  6. string(LENGTH "${CMAKE_CURRENT_BINARY_DIR}" dirLength)
  7. math(EXPR suffixLength "${dirLength} - ${location}")
  8. if (NOT suffixLength EQUAL 17)
  9. message(FATAL_ERROR "CMAKE_CURRENT_BINARY_DIR does not end with \"SubDir/Executable\"")
  10. endif()