瀏覽代碼

Test try_compile project mode

The try_compile command project mode builds an entire source tree
instead of one source file.  It uses an existing CMakeLists.txt file in
the given source tree instead of generating one.  This commit creates a
test for the mode in the TryCompile test.
Brad King 16 年之前
父節點
當前提交
1a159bbf33
共有 2 個文件被更改,包括 11 次插入0 次删除
  1. 7 0
      Tests/TryCompile/CMakeLists.txt
  2. 4 0
      Tests/TryCompile/Inner/CMakeLists.txt

+ 7 - 0
Tests/TryCompile/CMakeLists.txt

@@ -106,6 +106,13 @@ ELSE(CMAKE_ANSI_FOR_SCOPE)
    MESSAGE("Compiler does not support ansi for scope")
 ENDIF(CMAKE_ANSI_FOR_SCOPE)
 
+MESSAGE("Testing try_compile project mode")
+TRY_COMPILE(TEST_INNER
+  ${TryCompile_BINARY_DIR}/CMakeFiles/Inner
+  ${TryCompile_SOURCE_DIR}/Inner
+  TryCompileInner)
+TEST_ASSERT(TEST_INNER "try_compile project mode failed")
+
 ADD_EXECUTABLE(TryCompile pass.c)
 
 ######################################

+ 4 - 0
Tests/TryCompile/Inner/CMakeLists.txt

@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.6)
+project(TryCompileInner C)
+
+add_executable(inner ../pass.c)