diff options
author | Alec Thomas <alec@swapoff.org> | 2016-04-13 10:58:33 +1000 |
---|---|---|
committer | Alec Thomas <alec@swapoff.org> | 2016-04-13 10:58:33 +1000 |
commit | b6c5fcb1de2aa53d9a8b9f1ece9b77f49f9d3cf8 (patch) | |
tree | 8e49867defe543369a5e0c1c6e91f7177bada290 /CMakeLists.txt | |
parent | 4a4d3f4735c2f0fc38078622bc38dfe61e6fda80 (diff) | |
parent | 2dcddf58bd0112d2c8a8c242415d21552c00d563 (diff) |
Merge pull request #142 from roig/master
Fixed shared library compilation and Function to retrieve the entity from ComponentHandle
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 993badb..116b137 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,14 +91,14 @@ macro(require FEATURE_NAME MESSAGE_STRING) endif() endmacro(require) -macro(create_test TARGET_NAME SOURCE) +macro(create_test TARGET_NAME SOURCE DEPENDENCIES) add_executable(${TARGET_NAME} ${SOURCE}) + set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "entityx/tests") target_link_libraries( ${TARGET_NAME} - entityx + ${DEPENDENCIES} ${ARGN} ) - set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "entityx/tests") # Special case for benchmark tests if (${TARGET_NAME} MATCHES .*benchmark.*) @@ -129,36 +129,36 @@ message("-- Checking misc features") require(HAVE_STDINT_H "stdint.h") # Things to install -set(install_libs entityx) + set(sources entityx/System.cc entityx/Event.cc entityx/Entity.cc entityx/help/Timer.cc entityx/help/Pool.cc) -add_library(entityx STATIC ${sources}) -set_target_properties(entityx PROPERTIES DEBUG_POSTFIX -d FOLDER entityx) if (ENTITYX_BUILD_SHARED) message("-- Building shared libraries (-DENTITYX_BUILD_SHARED=0 to only build static librarires)") add_library(entityx_shared SHARED ${sources}) - target_link_libraries( - entityx_shared - ) + set_target_properties(entityx_shared PROPERTIES OUTPUT_NAME entityx DEBUG_POSTFIX -d VERSION ${ENTITYX_VERSION} SOVERSION ${ENTITYX_MAJOR_VERSION} FOLDER entityx) - list(APPEND install_libs entityx_shared) + set(install_libs entityx_shared) +else() + add_library(entityx STATIC ${sources}) + set_target_properties(entityx PROPERTIES DEBUG_POSTFIX -d FOLDER entityx) + set(install_libs entityx) endif (ENTITYX_BUILD_SHARED) if (ENTITYX_BUILD_TESTING) enable_testing() - create_test(pool_test entityx/help/Pool_test.cc) - create_test(entity_test entityx/Entity_test.cc) - create_test(event_test entityx/Event_test.cc) - create_test(system_test entityx/System_test.cc) - create_test(tags_component_test entityx/tags/TagsComponent_test.cc) - create_test(dependencies_test entityx/deps/Dependencies_test.cc) - create_test(benchmarks_test entityx/Benchmarks_test.cc) + create_test(pool_test entityx/help/Pool_test.cc ${install_libs}) + create_test(entity_test entityx/Entity_test.cc ${install_libs}) + create_test(event_test entityx/Event_test.cc ${install_libs}) + create_test(system_test entityx/System_test.cc ${install_libs}) + create_test(tags_component_test entityx/tags/TagsComponent_test.cc ${install_libs}) + create_test(dependencies_test entityx/deps/Dependencies_test.cc ${install_libs}) + create_test(benchmarks_test entityx/Benchmarks_test.cc ${install_libs}) if (ENTITYX_RUN_BENCHMARKS) message("-- Running benchmarks") else () @@ -197,4 +197,5 @@ install( TARGETS ${install_libs} LIBRARY DESTINATION "${libdir}" ARCHIVE DESTINATION "${libdir}" + RUNTIME DESTINATION "bin" ) |