Skip to content

Commit 773e158

Browse files
committed
Fix CMake custom targets for IDL
Do not generate target properties if custom_only.
1 parent 2ba2603 commit 773e158

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

modules/CMakeWorkspaceCreator.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use vars qw(@ISA);
2323
# Data Section
2424
# ************************************************************
2525

26-
my $version = '3.12.0';
26+
my $version = '3.20.0';
2727

2828
# ************************************************************
2929
# Subroutine Section

templates/cmake.mpd

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION <%cmake_minimum_required(3.12.0)%>)
1+
cmake_minimum_required(VERSION <%cmake_minimum_required(3.20.0)%>)
22

33
<%marker(top)%>
44
project(<%project_name%> <%language%>)
@@ -79,12 +79,13 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_<%uc(configuration)%> <%env_libout%>)
7979
<%endif%>
8080
<%endif%>
8181

82+
<%if(exename || sharedname || staticname)%>
8283
<%if(compile_flags)%>
8384
target_compile_options(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUBLIC <%compile_flags%>)
8485

8586
<%endif%>
8687
<%if(exename)%>
87-
add_executable(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>})
88+
add_executable(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>} ${HEADER_FILES_<%uc(normalize(project_name))%>})
8889
target_link_libraries(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%>})
8990
<%if(staticflags)%>
9091
if(NOT BUILD_SHARED_LIBS)
@@ -95,7 +96,7 @@ endif()
9596
<%endif%>
9697
<%else%>
9798
<%if(sharedname)%>
98-
add_library(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>})
99+
add_library(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>} ${HEADER_FILES_<%uc(normalize(project_name))%>})
99100
<%if(dynamicflags)%>
100101
if(BUILD_SHARED_LIBS)
101102
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%dynamicflags%>)
@@ -114,7 +115,7 @@ endif()
114115
target_link_libraries(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%>})
115116
<%else%>
116117
<%if(staticname)%>
117-
add_library(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>})
118+
add_library(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>} ${HEADER_FILES_<%uc(normalize(project_name))%>})
118119
<%if(staticflags)%>
119120
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%staticflags%>)
120121
<%endif%>
@@ -152,6 +153,7 @@ target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUB
152153
<%if(macros)%>
153154
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUBLIC <%macros%>)
154155

156+
<%endif%>
155157
<%endif%>
156158
<%if(custom_types)%>
157159
<%foreach(custom_types)%>
@@ -161,7 +163,7 @@ target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUB
161163
include(<%custom_type%> OPTIONAL)
162164
<%foreach(custom_type->input_files)%>
163165
<%uc(custom_type)%>_TARGET_SOURCES(
164-
${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUBLIC <%custom_type->input_file%>
166+
${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%custom_type->input_file%>
165167
<%uc(custom_type)%>_OPTIONS <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%><%if(custom_type->output_option)%> <%custom_type->output_option%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%endif%>)
166168

167169
<%endfor%>
@@ -172,7 +174,7 @@ include(<%custom_type%> OPTIONAL)
172174
include(<%custom_type%> OPTIONAL)
173175
<%endif%>
174176
<%uc(custom_type)%>_TARGET_SOURCES(
175-
${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUBLIC <%custom_type->input_file%>
177+
${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%custom_type->input_file%>
176178
<%foreach(custom_type->input_file->commands)%>
177179
<%uc(custom_type->input_file->command->type)%>_OPTIONS <%custom_type->input_file->command->flags%><%fornotlast("\n")%><%endfor%>)
178180

0 commit comments

Comments
 (0)