]> granicus.if.org Git - esp-idf/commitdiff
soc: fix compiling unit tests with CMake
authorIvan Grokhotkov <ivan@espressif.com>
Tue, 19 Mar 2019 03:42:51 +0000 (11:42 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Tue, 19 Mar 2019 03:42:51 +0000 (11:42 +0800)
soc unit tests have not been included when compiling with CMake,
because ../${SOC_NAME}/test was not evaluated relative to the
CMakeLists.txt directory.

Also call register_components() regardless of the presence of test
directory for particular target.

components/soc/test/CMakeLists.txt

index 461e7fee68e73cbccc095a463b3119bcf768ca9f..b70b4b5fd9419df8bb8437bec0ee894537b2f572 100644 (file)
@@ -1,9 +1,10 @@
 set(SOC_NAME ${IDF_TARGET})
-if(EXISTS "../${SOC_NAME}/test")
-    set(COMPONENT_SRCDIRS "../${SOC_NAME}/test")
-    set(COMPONENT_ADD_INCLUDEDIRS "../${SOC_NAME}/test")
+set(SOC_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../${SOC_NAME}/test)
+if(EXISTS "${SOC_TEST_DIR}")
+    set(COMPONENT_SRCDIRS "${SOC_TEST_DIR}")
+    set(COMPONENT_ADD_INCLUDEDIRS "${SOC_TEST_DIR}")
+endif()
 
-    set(COMPONENT_REQUIRES unity test_utils)
+set(COMPONENT_REQUIRES unity test_utils)
 
-    register_component()
-endif()
+register_component()