Skip to content

Commit 429e9a8

Browse files
jcfrNicole Aucoin
andcommitted
ENH: Fix GenerateCLP install rules. See Slicer#44
* Introduce GenerateCLP_INSTALL_CMAKE_DIR variable allowing to configure install location for "GenerateCLP.cmake" macro. * GenerateCLP_INSTALL_NO_DEVELOPMENT: Change default value from ON to OFF. This will ensure GenerateCLP macro and dependent files are installed by default. * GenerateCLPLauncher: - Update hardcoded location of ITK libraries. It was changed from "bin" to "lib" in ITKv4. - Update forward install dir to account for that fact both GenerateCLP and launcher are installed in the same directory. * Ensure following files are installed: - UseGenerateCLP.cmake - GenerateCLPConfig.cmake - GenerateCLP.cmake Co-authored-by: Nicole Aucoin <[email protected]>
1 parent 291e251 commit 429e9a8

File tree

2 files changed

+42
-20
lines changed

2 files changed

+42
-20
lines changed

GenerateCLP/CMakeLists.txt

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ endif()
6767
#-----------------------------------------------------------------------------
6868
include(CTest)
6969

70+
#-----------------------------------------------------------------------------
71+
# Install tree directories
72+
#-----------------------------------------------------------------------------
73+
74+
if(NOT DEFINED GenerateCLP_INSTALL_CMAKE_DIR)
75+
set(GenerateCLP_INSTALL_CMAKE_DIR lib/GenerateCLP)
76+
endif()
77+
7078
#-----------------------------------------------------------------------------
7179
# Output directories.
7280
#-----------------------------------------------------------------------------
@@ -127,27 +135,12 @@ if(NOT DEFINED GenerateCLP_INSTALL_BIN_DIR)
127135
set(GenerateCLP_INSTALL_BIN_DIR bin)
128136
endif()
129137
if(NOT DEFINED ${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT)
130-
set(${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT ON)
138+
set(${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT OFF)
131139
endif()
132140
if(NOT ${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT)
133-
install(TARGETS GenerateCLP RUNTIME
134-
DESTINATION ${GenerateCLP_INSTALL_BIN_DIR} COMPONENT Development
135-
)
136-
endif()
137-
138-
# --------------------------------------------------------------------------
139-
# Install support files
140-
# --------------------------------------------------------------------------
141-
if(NOT ${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT)
142-
install(FILES ${GenerateCLP_BINARY_DIR}/GenerateCLPConfig.cmake_install
143-
DESTINATION lib/GenerateCLP
144-
COMPONENT Development
145-
RENAME GenerateCLPConfig.cmake
146-
)
147-
install(FILES ${GenerateCLP_BINARY_DIR}/UseGenerateCLP.cmake_install
148-
DESTINATION lib/GenerateCLP
141+
install(TARGETS GenerateCLP
142+
RUNTIME DESTINATION ${GenerateCLP_INSTALL_BIN_DIR}
149143
COMPONENT Development
150-
RENAME UseGenerateCLP.cmake
151144
)
152145
endif()
153146

@@ -177,12 +170,12 @@ set(GenerateCLP_FORWARD_PATH_BUILD " \\
177170
")
178171
set(GenerateCLP_FORWARD_PATH_INSTALL " \\
179172
\".\", \\
180-
\"${ITK_DIR}/bin\", \\
173+
\"${ITK_DIR}/lib\", \\
181174
${json_forward_path_install} \\
182175
\"${ModuleDescriptionParser_DIR}/bin\" \\
183176
")
184177
set(GenerateCLP_FORWARD_EXE GenerateCLP)
185-
set(GenerateCLP_FORWARD_DIR_INSTALL "..")
178+
set(GenerateCLP_FORWARD_DIR_INSTALL ".")
186179

187180
# --------------------------------------------------------------------------
188181
# Build launcher
@@ -235,6 +228,34 @@ configure_file(
235228
)
236229
include(GenerateGenerateCLPConfig.cmake)
237230

231+
# --------------------------------------------------------------------------
232+
# Install support files
233+
# --------------------------------------------------------------------------
234+
if(NOT ${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT)
235+
236+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/GenerateCLP.cmake
237+
DESTINATION ${GenerateCLP_INSTALL_CMAKE_DIR}
238+
COMPONENT Development
239+
)
240+
241+
configure_file(
242+
GenerateCLPInstallConfig.cmake.in
243+
${GenerateCLP_BINARY_DIR}/GenerateCLPConfig.cmake_install
244+
@ONLY
245+
)
246+
install(FILES ${GenerateCLP_BINARY_DIR}/GenerateCLPConfig.cmake_install
247+
DESTINATION lib/GenerateCLP
248+
COMPONENT Development
249+
RENAME GenerateCLPConfig.cmake
250+
)
251+
252+
install(FILES ${GenerateCLP_SOURCE_DIR}/UseGenerateCLP.cmake.in
253+
DESTINATION lib/GenerateCLP
254+
COMPONENT Development
255+
RENAME UseGenerateCLP.cmake
256+
)
257+
endif()
258+
238259
# --------------------------------------------------------------------------
239260
# Testing
240261
# --------------------------------------------------------------------------

GenerateCLP/GenerateCLPInstallConfig.cmake.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ endif(WIN32)
99

1010
set(GenerateCLP_INCLUDE_DIRS "${GenerateCLP_CONFIG_DIR}/../../include/GenerateCLP")
1111
set(GenerateCLP_LIBRARY_DIRS "${GenerateCLP_CONFIG_DIR}")
12+
set(GenerateCLP_CMAKE_DIR "${GenerateCLP_CONFIG_DIR}")
1213
set(GenerateCLP_USE_FILE "${GenerateCLP_CONFIG_DIR}/UseGenerateCLP.cmake")
1314
set(GENERATECLP_EXE "${GenerateCLP_CONFIG_DIR}/../../bin/GenerateCLP")
1415
if(NOT WIN32)

0 commit comments

Comments
 (0)