Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake support to build ACE+TAO including IDL targets #177

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/CMakeWorkspaceCreator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use vars qw(@ISA);
# Data Section
# ************************************************************

my $version = '3.12.0';
my $version = '3.20.0';

# ************************************************************
# Subroutine Section
Expand Down
67 changes: 20 additions & 47 deletions templates/cmake.mpd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION <%cmake_minimum_required(3.12.0)%>)
cmake_minimum_required(VERSION <%cmake_minimum_required(3.20.0)%>)

<%marker(top)%>
project(<%project_name%> <%language%>)
Expand Down Expand Up @@ -33,59 +33,31 @@ endif()
<%endif%>
<%endfor%>
if(CMAKE_CONFIGURATION_TYPES)
set(TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%><%if(libs)%> <%foreach(configurations)%><%fornotfirst(" ")%>$<$<CONFIG:<%configuration%>>:<%foreach(libs)%><%fornotfirst(" ")%><%if(cmake_macro(lib))%>$<IF:$<BOOL:${<%cmake_macro(lib)%>_DEFINED}>,<%lib%>${LIBRARY_DECORATOR}<%lib_modifier%>,><%else%><%lib%>${LIBRARY_DECORATOR}<%lib_modifier%><%endif%><%endfor%>><%fornotlast("\n")%><%endfor%><%endif%><%if(lit_libs)%> <%lit_libs%><%endif%><%if(pure_libs)%> <%pure_libs%><%endif%>)
set(TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%><%if(libs)%>
<%foreach(libs)%><%fornotfirst(" ")%><%if(cmake_macro(lib))%>$<IF:$<BOOL:${<%cmake_macro(lib)%>_DEFINED}>,<%lib%>${LIBRARY_DECORATOR}<%lib_modifier%>,><%else%><%lib%>${LIBRARY_DECORATOR}<%lib_modifier%><%endif%><%endfor%><%endif%><%if(lit_libs)%>
<%lit_libs%><%endif%><%if(pure_libs)%>
<%pure_libs%><%endif%>)
else()
set(TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%><%if(libs)%><%foreach(libs)%> <%if(cmake_macro(lib))%>$<IF:$<BOOL:${<%cmake_macro(lib)%>_DEFINED}>,<%lib%>${LIBRARY_DECORATOR},><%else%><%lib%>${LIBRARY_DECORATOR}<%endif%><%endfor%><%endif%><%if(lit_libs)%> <%lit_libs%><%endif%><%if(pure_libs)%> <%pure_libs%><%endif%>)
set(TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%><%if(libs)%><%foreach(libs)%> <%if(cmake_macro(lib))%>$<IF:$<BOOL:${<%cmake_macro(lib)%>_DEFINED}>,<%lib%>${LIBRARY_DECORATOR},><%else%><%lib%>${LIBRARY_DECORATOR}<%endif%><%endfor%><%endif%><%if(lit_libs)%> <%lit_libs%><%endif%><%if(pure_libs)%> <%pure_libs%><%endif%>)
endif()
<%endif%>
set(PROJECT_TARGET_<%uc(normalize(project_name))%> <%if(exename)%><%exename%><%else%><%if(sharedname)%><%sharedname%>${LIBRARY_DECORATOR}<%else%><%if(staticname)%><%staticname%>${LIBRARY_DECORATOR}<%else%><%project_name%>${LIBRARY_DECORATOR}<%endif%><%endif%><%endif%>)
<%marker(macros)%>

<%if(exeout)%>
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY <%env_exeout%>)
<%if(use_lib_modifier)%>
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG <%env_exeout%>)
<%endif%>
<%endif%>
<%if(!exename)%>
<%if(libout)%>
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY <%env_libout%>)
<%if(use_lib_modifier)%>
<%foreach(configurations)%>
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_<%uc(configuration)%> <%env_libout%>)
<%endfor%>
<%endif%>
<%endif%>
<%if(dllout)%>
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY <%env_dllout%>)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY <%env_dllout%>)
<%if(use_lib_modifier)%>
<%foreach(configurations)%>
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_<%uc(configuration)%> <%env_dllout%>)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_<%uc(configuration)%> <%env_dllout%>)
<%endfor%>
<%endif%>
<%else%>
<%if(libout)%>
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY <%env_libout%>)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY <%env_libout%>)
<%if(use_lib_modifier)%>
<%foreach(configurations)%>
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_<%uc(configuration)%> <%env_libout%>)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_<%uc(configuration)%> <%env_libout%>)
<%endfor%>
<%endif%>
<%endif%>
<%endif%>
<%endif%>

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

<%endif%>
<%if(exename)%>
add_executable(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>})
add_executable(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>} ${HEADER_FILES_<%uc(normalize(project_name))%>} ${INLINE_FILES_<%uc(normalize(project_name))%>})
target_link_libraries(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%>})
if(CMAKE_IMPORT_LIBRARY_SUFFIX AND BUILD_SHARED_LIBS AND TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%>)
add_custom_command(TARGET ${PROJECT_TARGET_<%uc(normalize(project_name))%>} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:${PROJECT_TARGET_<%uc(normalize(project_name))%>}> $<TARGET_FILE_DIR:${PROJECT_TARGET_<%uc(normalize(project_name))%>}>
COMMAND_EXPAND_LISTS
)
endif()
<%if(staticflags)%>
if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%staticflags%>)
Expand All @@ -95,7 +67,7 @@ endif()
<%endif%>
<%else%>
<%if(sharedname)%>
add_library(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>})
add_library(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>} ${HEADER_FILES_<%uc(normalize(project_name))%>} ${INLINE_FILES_<%uc(normalize(project_name))%>})
<%if(dynamicflags)%>
if(BUILD_SHARED_LIBS)
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%dynamicflags%>)
Expand All @@ -111,10 +83,10 @@ if(NOT BUILD_SHARED_LIBS)
endif()
<%endif%>
<%endif%>
target_link_libraries(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%>})
target_link_libraries(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUBLIC ${TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%>})
<%else%>
<%if(staticname)%>
add_library(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>})
add_library(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>} ${HEADER_FILES_<%uc(normalize(project_name))%>} ${INLINE_FILES_<%uc(normalize(project_name))%>})
<%if(staticflags)%>
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%staticflags%>)
<%endif%>
Expand Down Expand Up @@ -152,6 +124,7 @@ target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUB
<%if(macros)%>
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUBLIC <%macros%>)

<%endif%>
<%endif%>
<%if(custom_types)%>
<%foreach(custom_types)%>
Expand All @@ -161,7 +134,7 @@ target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUB
include(<%custom_type%> OPTIONAL)
<%foreach(custom_type->input_files)%>
<%uc(custom_type)%>_TARGET_SOURCES(
${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUBLIC <%custom_type->input_file%>
${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%custom_type->input_file%>
<%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%>)

<%endfor%>
Expand All @@ -172,7 +145,7 @@ include(<%custom_type%> OPTIONAL)
include(<%custom_type%> OPTIONAL)
<%endif%>
<%uc(custom_type)%>_TARGET_SOURCES(
${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUBLIC <%custom_type->input_file%>
${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%custom_type->input_file%>
<%foreach(custom_type->input_file->commands)%>
<%uc(custom_type->input_file->command->type)%>_OPTIONS <%custom_type->input_file->command->flags%><%fornotlast("\n")%><%endfor%>)

Expand Down