]> code.bitgloo.com Git - clyne/entityx.git/commitdiff
Set build_interface directories for integrated builds
authorSumedha Widyadharma <s-fairphone@wdya.de>
Sun, 23 Oct 2016 13:56:18 +0000 (15:56 +0200)
committerSumedha Widyadharma <s-fairphone@wdya.de>
Sun, 23 Oct 2016 13:56:18 +0000 (15:56 +0200)
This makes it very easy to integrate entityx into a build.
I.e:
add_subdirectories(3rdparty/entityx)
target_link_libraries(my_target entityx[_shared])

This makes #include entityx/entityx.h just work.

CMakeLists.txt

index 116b13745725a5dc844c0c7530d27826d1dcacc3..ba38a87db19b623d22dc9ff3e02b6c215b72abe4 100644 (file)
@@ -143,11 +143,15 @@ if (ENTITYX_BUILD_SHARED)
         VERSION ${ENTITYX_VERSION}
         SOVERSION ${ENTITYX_MAJOR_VERSION}
         FOLDER entityx)
-       set(install_libs entityx_shared)
+    set(install_libs entityx_shared)
+    set_property(TARGET entityx_shared APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
+          $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
 else()
     add_library(entityx STATIC ${sources})
     set_target_properties(entityx PROPERTIES DEBUG_POSTFIX -d FOLDER entityx)
     set(install_libs entityx)
+    set_property(TARGET entityx APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
+          $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
 endif (ENTITYX_BUILD_SHARED)
 
 if (ENTITYX_BUILD_TESTING)