Skip to content

Commit 037a66c

Browse files
authored
Merge pull request #37 from doug1234/CmakeInstall
Added an option to install for idl2lib
2 parents de5c75c + 6785fea commit 037a66c

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

idl2library.cmake

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# idl2library(IDLS <files> [BUILD_STATIC])
1+
# idl2library(IDLS <files> [BUILD_STATIC] [INSTALL_OUTPUT])
22
# Generate a shared or static library for each IDL in a list.
33
#
4-
# Example:
4+
# Examples:
55
# idl2library(IDLS idl/example.idl idl/std_doc.idl)
6-
# idl2library(IDLS idl/example.idl idl/std_doc.idl BUILD_STATIC)
6+
# idl2library(IDLS idl/example.idl idl/std_doc.idl BUILD_STATIC INSTALL_OUTPUT)
77
# idl2library(IDLS idl/example.idl idl/std_doc.idl INCLUDE_DIRS "${PATH_TO_STD_QOS_IDL}/idl/")
88
#
99

@@ -49,7 +49,7 @@ function(find_idl_dependencies input_file)
4949
endfunction()
5050

5151
function(idl2library)
52-
set(options BUILD_STATIC)
52+
set(options BUILD_STATIC INSTALL_OUTPUT)
5353
set(singleValueArgs)
5454
set(multiValueArgs IDLS INCLUDE_DIRS)
5555

@@ -189,7 +189,7 @@ function(idl2library)
189189
add_library(${current_idl_target} SHARED)
190190
endif()
191191

192-
opendds_target_sources(${current_idl_target}
192+
opendds_target_sources(${current_idl_target} PUBLIC
193193
${${current_idl_target}_RELPATH}
194194
OPENDDS_IDL_OPTIONS ${current_idl_include_opts} -Gxtypes-complete
195195
TAO_IDL_OPTIONS ${current_idl_include_opts}
@@ -203,6 +203,21 @@ function(idl2library)
203203
# Group the IDL projects together
204204
set_target_properties(${current_idl_target} PROPERTIES FOLDER IDL)
205205
target_compile_definitions(${current_idl_target} PUBLIC _HAS_AUTO_PTR_ETC=1 _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING)
206+
207+
#Set the PUBLIC_HEADER for the target
208+
if (${idl2library_INSTALL_OUTPUT})
209+
opendds_install_interface_files(${current_idl_target})
210+
211+
# Add each idl to the project target list for export and make them exportable
212+
LIST(APPEND PROJECT_TARGET_LIST ${current_idl_target})
213+
install(TARGETS ${current_idl_target}
214+
EXPORT ${PROJECT_NAME}
215+
LIBRARY DESTINATION lib
216+
ARCHIVE DESTINATION lib
217+
PUBLIC_HEADER DESTINATION include
218+
)
219+
220+
endif()
206221

207222
# Add this project to the IDL list so it's only loaded 1x
208223
list(APPEND IDL_TARGETS "${current_idl_target}")

0 commit comments

Comments
 (0)