summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/FileAPI/codemodel-v2.cmake
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2018-11-09 18:54:41 (GMT)
committerBrad King <brad.king@kitware.com>2018-12-12 14:45:49 (GMT)
commitea0a0601682af00706cf57f6d3e27d4f0895ecbb (patch)
tree539ef9baee753df0254f5c207dcc3d0dc56af949 /Tests/RunCMake/FileAPI/codemodel-v2.cmake
parent3e922ceb5e8cc4c4d72ddcbd8b485803c49d84f1 (diff)
downloadCMake-ea0a0601682af00706cf57f6d3e27d4f0895ecbb.zip
CMake-ea0a0601682af00706cf57f6d3e27d4f0895ecbb.tar.gz
CMake-ea0a0601682af00706cf57f6d3e27d4f0895ecbb.tar.bz2
fileapi: Add test for codemodel v2
Diffstat (limited to 'Tests/RunCMake/FileAPI/codemodel-v2.cmake')
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2.cmake35
1 files changed, 34 insertions, 1 deletions
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2.cmake b/Tests/RunCMake/FileAPI/codemodel-v2.cmake
index 8c782b9..dca1dd1 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2.cmake
+++ b/Tests/RunCMake/FileAPI/codemodel-v2.cmake
@@ -1 +1,34 @@
-# FIXME: enable_language(C) and add targets to dump
+enable_language(C)
+
+include("${CMAKE_CURRENT_LIST_DIR}/include_test.cmake")
+
+add_library(c_lib empty.c)
+add_executable(c_exe empty.c)
+target_link_libraries(c_exe PRIVATE c_lib)
+
+add_library(c_shared_lib SHARED empty.c)
+add_executable(c_shared_exe empty.c)
+target_link_libraries(c_shared_exe PRIVATE c_shared_lib)
+
+add_library(c_static_lib STATIC empty.c)
+add_executable(c_static_exe empty.c)
+target_link_libraries(c_static_exe PRIVATE c_static_lib)
+
+add_subdirectory(cxx)
+add_subdirectory(alias)
+add_subdirectory(object)
+add_subdirectory(imported)
+add_subdirectory(custom)
+add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../FileAPIExternalSource" "${CMAKE_CURRENT_BINARY_DIR}/../FileAPIExternalBuild")
+
+set_property(TARGET c_shared_lib PROPERTY LIBRARY_OUTPUT_DIRECTORY lib)
+set_property(TARGET c_shared_lib PROPERTY RUNTIME_OUTPUT_DIRECTORY lib)
+
+include(CheckIPOSupported)
+check_ipo_supported(RESULT _ipo LANGUAGES C)
+if(_ipo)
+ set_property(TARGET c_shared_lib PROPERTY INTERPROCEDURAL_OPTIMIZATION ON)
+ set_property(TARGET c_shared_exe PROPERTY INTERPROCEDURAL_OPTIMIZATION ON)
+ set_property(TARGET c_static_lib PROPERTY INTERPROCEDURAL_OPTIMIZATION ON)
+ file(WRITE "${CMAKE_BINARY_DIR}/ipo_enabled.txt" "")
+endif()