summaryrefslogtreecommitdiff
path: root/cmake/helpers/EflMacros.cmake
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-01-23 18:57:53 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-01-23 18:59:36 -0200
commit62ec4c8aa2dd9765ff96d3631d1b24f7cd06e170 (patch)
treeca81b3b8f7c37c0e988714b93b32cdc78b4111f3 /cmake/helpers/EflMacros.cmake
parentc178d681f0d93341306f61a71f5ce185a0903e5b (diff)
cmake: cleanup EFL_CREATE_EO_RULES().
it wasn't using the given generation_dir parameter, it was reseting the loop variable (which worked, but is nasty).
Diffstat (limited to '')
-rw-r--r--cmake/helpers/EflMacros.cmake46
1 files changed, 20 insertions, 26 deletions
diff --git a/cmake/helpers/EflMacros.cmake b/cmake/helpers/EflMacros.cmake
index 111fde794c..7aad512ac5 100644
--- a/cmake/helpers/EflMacros.cmake
+++ b/cmake/helpers/EflMacros.cmake
@@ -1067,48 +1067,42 @@ endmacro()
1067# Will use the source of the given target to create rules for creating 1067# Will use the source of the given target to create rules for creating
1068# the .eo.c and .eo.h files. The INCLUDE_DIRECTORIES of the target will be used 1068# the .eo.c and .eo.h files. The INCLUDE_DIRECTORIES of the target will be used
1069function(EFL_CREATE_EO_RULES target generation_dir) 1069function(EFL_CREATE_EO_RULES target generation_dir)
1070 get_target_property(build_files ${target} SOURCES) 1070 get_target_property(source_files ${target} SOURCES)
1071 get_target_property(_link_libraries ${target} LINK_LIBRARIES) 1071 get_target_property(link_libraries ${target} LINK_LIBRARIES)
1072 #build a list of targets we use to scan for all files
1073 list(APPEND _include_targets ${target})
1074 foreach(lib ${_link_libraries})
1075 if (TARGET ${lib})
1076 list(APPEND _include_targets ${lib})
1077 endif()
1078 endforeach()
1079 1072
1080 #build a list of include directories 1073 set(all_libraries ${target} ${link_libraries})
1081 foreach(link_target ${_include_targets}) 1074 set(include_cmd "")
1075 foreach(link_target ${all_libraries})
1082 list(APPEND include_cmd -I${CMAKE_SOURCE_DIR}/src/lib/${link_target}) 1076 list(APPEND include_cmd -I${CMAKE_SOURCE_DIR}/src/lib/${link_target})
1083 endforeach() 1077 endforeach()
1084 1078
1085 foreach(file ${build_files}) 1079 set(all_eo_gen_files "")
1080 foreach(file ${source_files})
1086 get_filename_component(ext ${file} EXT) 1081 get_filename_component(ext ${file} EXT)
1087 get_filename_component(filename ${file} NAME) 1082 get_filename_component(filename ${file} NAME)
1088 1083
1089 if (${ext} MATCHES "^\\.eo$") 1084 if(${ext} STREQUAL ".eo")
1090 set(build_files ${EFL_LIB_BINARY_DIR}/${filename}.c ${EFL_LIB_BINARY_DIR}/${filename}.h) 1085 set(file_eo_gen_files ${generation_dir}/${filename}.c ${generation_dir}/${filename}.h)
1091 set(create_rule ON) 1086 elseif(${ext} STREQUAL ".eot")
1092 elseif (${ext} MATCHES "^\\.eot$") 1087 set(file_eo_gen_files ${generation_dir}/${filename}.h)
1093 set(build_files ${EFL_LIB_BINARY_DIR}/${filename}.h) 1088 else()
1094 set(create_rule ON) 1089 set(file_eo_gen_files "")
1095 endif() 1090 endif()
1096 1091
1097 #add the custom rule 1092 #add the custom rule
1098 if (create_rule) 1093 if(file_eo_gen_files)
1099 add_custom_command( 1094 add_custom_command(
1100 OUTPUT ${build_files} 1095 OUTPUT ${file_eo_gen_files}
1101 COMMAND ${CMAKE_COMMAND} -E env "EFL_RUN_IN_TREE=1" ${EOLIAN_BIN} ${include_cmd} -o c:${EFL_LIB_BINARY_DIR}/${filename}.c -o h:${EFL_LIB_BINARY_DIR}/${filename}.h ${file} 1096 COMMAND ${CMAKE_COMMAND} -E env "EFL_RUN_IN_TREE=1" ${EOLIAN_BIN} ${include_cmd} -o c:${generation_dir}/${filename}.c -o h:${generation_dir}/${filename}.h ${file}
1102 DEPENDS ${file} 1097 DEPENDS ${file}
1103 ) 1098 )
1104 unset(create_rule) 1099 list(APPEND all_eo_gen_files ${file_eo_gen_files})
1105 list(APPEND eo_gen_files ${build_files})
1106 endif() 1100 endif()
1107 endforeach() 1101 endforeach()
1108 if(eo_gen_files) 1102 if(all_eo_gen_files)
1109 file(MAKE_DIRECTORY ${EFL_LIB_BINARY_DIR}) 1103 file(MAKE_DIRECTORY ${generation_dir})
1110 add_custom_target(${target}-eo 1104 add_custom_target(${target}-eo
1111 DEPENDS ${eo_gen_files} 1105 DEPENDS ${all_eo_gen_files}
1112 ) 1106 )
1113 add_dependencies(${target} ${target}-eo) 1107 add_dependencies(${target} ${target}-eo)
1114 add_dependencies(${target}-eo eolian-bin) 1108 add_dependencies(${target}-eo eolian-bin)