NCAR / VAPOR

VAPOR is the Visualization and Analysis Platform for Ocean, Atmosphere, and Solar Researchers
https://www.vapor.ucar.edu/
Other
176 stars 49 forks source link

CMake improvement #3434

Open sgpearse opened 10 months ago

sgpearse commented 10 months ago

Some of our CMake rules target individual files. We use the GLOB directive to put these files in a variable, and then install them. One example is with the following syntax, which can be seen in our root level CMakelists.txt:

454             file (GLOB STYLE_LIBS ${THIRD_PARTY_DIR}/plugins/styles/libqmacstyle.dylib)
455             install (
456                 FILES ${STYLE_LIBS}
457                 DESTINATION ${INSTALL_BIN_DIR}/styles
458                 COMPONENT Dependencies
459                 )

The problem here is that the install directive will not issue an error if libqmacstyle.dylib is not found. This leads broken installer without issuance of an error at build-time.

Untested theory: The TARGETS directive may be the more appropriate tool for this case.

install (
    TARGETS ${THIRD_PARTY_DIR}/plugins/styles/libqmacstyle.dylib
    DESTINATION ${INSTALL_BIN_DIR}/styles
    COMPONENT Dependencies
)
sgpearse commented 8 months ago

The TARGETS directive is only for objects compiled during build time. Try just not using GLOB instead.