tests: macOS CMake fixes for Xcode generator
authorMike Schuchardt <mikes@lunarg.com>
Thu, 29 Mar 2018 16:12:04 +0000 (10:12 -0600)
committerMike Schuchardt <mikes@lunarg.com>
Thu, 29 Mar 2018 19:32:59 +0000 (13:32 -0600)
Put icd and test layer json files in $<CONFIG> directory when using
Xcode generator so layer tests can be executed and debugged from within
Xcode.

Change-Id: I079a89ea065ddeec98ce95766e284220c67b1859

icd/CMakeLists.txt

index 3fe467d..44851bf 100644 (file)
@@ -55,12 +55,23 @@ if (WIN32)
 elseif(APPLE)
     # extra setup for out-of-tree builds
     if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR))
-        foreach (config_file ${ICD_JSON_FILES})
-            add_custom_target(${config_file}-json ALL
-                COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/macos/${config_file}.json
-                VERBATIM
-                )
-        endforeach(config_file)
+        if (CMAKE_GENERATOR MATCHES "^Xcode.*")
+            add_custom_target(mk_icd_config_dir ALL COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)
+            foreach (config_file ${ICD_JSON_FILES})
+                add_custom_target(${config_file}-json ALL
+                    DEPENDS mk_icd_config_dir
+                    COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/macos/${config_file}.json $<CONFIG>
+                    VERBATIM
+                    )
+            endforeach(config_file)
+        else()
+            foreach (config_file ${ICD_JSON_FILES})
+                add_custom_target(${config_file}-json ALL
+                    COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/macos/${config_file}.json
+                    VERBATIM
+                    )
+            endforeach(config_file)
+        endif()
     endif()
 else()
     # extra setup for out-of-tree builds