Skip to content

Commit

Permalink
Bring mini-plugin CMakeLists.txt config into alignment with the large…
Browse files Browse the repository at this point in the history
… one. Namely, default to compiling all source and automatically install headers and ROOT .pcm files on make install.
  • Loading branch information
faustus123 committed Jun 25, 2022
1 parent 8774d39 commit 80b5c06
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion scripts/jana-generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,40 @@ class {name} : public JEventSource {{
mini_plugin_cmakelists_txt = """
{extra_find_packages}
add_library({name}_plugin SHARED {name}.cc)
# According to the internet, CMake authors discourage the use
# of GLOB for identifying source files. IMHO, this is due to
# the flawed use of cache files in CMake itself. Here, GLOB
# is used as the default. What this means is you can add source
# files and re-run cmake (after clearing the cache file) and
# they will be found without needing to modify this file.
# You also have the option of switching the following to "false"
# and managing the source file list manually the way they recommend.
if(true)
# Automatically determine source file list.
file(GLOB mysourcefiles *.cpp *.cc *.c *.hpp *.hh *.h)
set( {name}_PLUGIN_SOURCES ${{mysourcefiles}} )
else()
# Manually manage source file list
set ({name}_PLUGIN_SOURCES
{name}.cc
)
endif()
add_library({name}_plugin SHARED ${{{name}_PLUGIN_SOURCES}})
target_include_directories({name}_plugin PUBLIC ${{CMAKE_SOURCE_DIR}} ${{JANA_INCLUDE_DIR}} {extra_includes})
target_link_libraries({name}_plugin ${{JANA_LIB}} {extra_libraries})
set_target_properties({name}_plugin PROPERTIES PREFIX "" OUTPUT_NAME "{name}" SUFFIX ".so")
install(TARGETS {name}_plugin DESTINATION plugins)
file(GLOB my_headers "*.h*")
install(FILES ${{my_headers}} DESTINATION include/{name})
# For root dictionaries
file(GLOB my_pcms "${{CMAKE_CURRENT_BINARY_DIR}}/*.pcm")
install(FILES ${{my_pcms}} DESTINATION plugins)
"""


Expand Down

0 comments on commit 80b5c06

Please sign in to comment.