Commit cc26d4ea authored by Alexander David Hellwig's avatar Alexander David Hellwig
Browse files

Add fix for msbuild: additional cpp file is generated for static library

parent dc5a74ce
......@@ -113,7 +113,7 @@ public class GeneratorRosCpp {
if (generateCMake) {
LanguageUnitRosCMake languageUnitRosCMake = new LanguageUnitRosCMake();
res.add(languageUnitRosCMake.generate(component, languageUnitRosCppAdapter.getAdditionalPackages(),isRos2Mode()));
res.addAll(languageUnitRosCMake.generate(component, languageUnitRosCppAdapter.getAdditionalPackages(),isRos2Mode()));
}
res.add(apdapter);
......
......@@ -15,7 +15,7 @@ public class LanguageUnitRosCMake {
"\n" +
"<packages>\n" +
"\n" +
"add_library(<name> <name>.h)\n" +
"add_library(<name> <name>.cpp)\n" +
"set_target_properties(<name> PROPERTIES LINKER_LANGUAGE CXX)\n" +
"target_link_libraries(<name> <compName> <libraries>)\n" +
"target_include_directories(<name> PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} <include_dirs>)\n" +
......@@ -23,7 +23,7 @@ public class LanguageUnitRosCMake {
"\n" +
"export(TARGETS <name> FILE <name>.cmake)";
FileContent generate(EMAComponentInstanceSymbol componentInstanceSymbol, List<String> additionalPackages, boolean isRos2Mode) {
List<FileContent> generate(EMAComponentInstanceSymbol componentInstanceSymbol, List<String> additionalPackages, boolean isRos2Mode) {
FileContent fileContent = new FileContent();
fileContent.setFileName("CMakeLists.txt");
......@@ -70,7 +70,15 @@ public class LanguageUnitRosCMake {
.replace("<dependency>", dependency);
fileContent.setFileContent(content);
return fileContent;
List<FileContent> result = new ArrayList<>();
result.add(fileContent);
FileContent cppFile = new FileContent();
cppFile.setFileName(name + ".cpp");
cppFile.setFileContent("#include \""+ name +".h\"");
result.add(cppFile);
return result;
}
}
......@@ -3,7 +3,7 @@ project (RosAdapter_tests_msg_basicStructComp)
find_package(roscpp REQUIRED)
add_library(RosAdapter_tests_msg_basicStructComp RosAdapter_tests_msg_basicStructComp.h)
add_library(RosAdapter_tests_msg_basicStructComp RosAdapter_tests_msg_basicStructComp.cpp)
set_target_properties(RosAdapter_tests_msg_basicStructComp PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(RosAdapter_tests_msg_basicStructComp tests_msg_basicStructComp ${roscpp_LIBRARIES} ${struct_msgs_LIBRARIES})
target_include_directories(RosAdapter_tests_msg_basicStructComp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${roscpp_INCLUDE_DIRS} ${struct_msgs_INCLUDE_DIRS})
......
#include "RosAdapter_tests_msg_basicStructComp.h"
\ No newline at end of file
......@@ -5,7 +5,7 @@ find_package(automated_driving_msgs REQUIRED)
find_package(roscpp REQUIRED)
find_package(rosgraph_msgs REQUIRED)
add_library(RosAdapter_tests_a_compA RosAdapter_tests_a_compA.h)
add_library(RosAdapter_tests_a_compA RosAdapter_tests_a_compA.cpp)
set_target_properties(RosAdapter_tests_a_compA PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(RosAdapter_tests_a_compA tests_a_compA ${automated_driving_msgs_LIBRARIES} ${roscpp_LIBRARIES} ${rosgraph_msgs_LIBRARIES})
target_include_directories(RosAdapter_tests_a_compA PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${automated_driving_msgs_INCLUDE_DIRS} ${roscpp_INCLUDE_DIRS} ${rosgraph_msgs_INCLUDE_DIRS})
......
#include "RosAdapter_tests_a_compA.h"
\ No newline at end of file
......@@ -3,7 +3,7 @@ project (RosAdapter_test_instanceArrayComp_basicPorts_1_)
find_package(roscpp REQUIRED)
add_library(RosAdapter_test_instanceArrayComp_basicPorts_1_ RosAdapter_test_instanceArrayComp_basicPorts_1_.h)
add_library(RosAdapter_test_instanceArrayComp_basicPorts_1_ RosAdapter_test_instanceArrayComp_basicPorts_1_.cpp)
set_target_properties(RosAdapter_test_instanceArrayComp_basicPorts_1_ PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(RosAdapter_test_instanceArrayComp_basicPorts_1_ test_instanceArrayComp_basicPorts_1_ ${roscpp_LIBRARIES})
target_include_directories(RosAdapter_test_instanceArrayComp_basicPorts_1_ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${roscpp_INCLUDE_DIRS})
......
#include "RosAdapter_test_instanceArrayComp_basicPorts_1_.h"
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment