cmakeconverter icon indicating copy to clipboard operation
cmakeconverter copied to clipboard

No support of more than one target type per target. (add_library doesn't support GenEx for target type)

Open bigla opened this issue 5 years ago • 2 comments

A week ago i converted a vcxproj containing

<ConfigurationType>StaticLibrary</ConfigurationType> vs. <ConfigurationType>DynamicLibrary</ConfigurationType>

for different Build Configurations.

  • I got: add_library(${PROJECT_NAME} SHARED ${ALL_FILES})

  • I expected some conversion similar to:

if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") add_library(${PROJECT_NAME} STATIC ${ALL_FILES}) else() add_library(${PROJECT_NAME} SHARED ${ALL_FILES}) endif()

  • Parts of source .vcxproj:

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>MultiByte</CharacterSet> <WholeProgramOptimization>true</WholeProgramOptimization> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <CharacterSet>MultiByte</CharacterSet> <WholeProgramOptimization>true</WholeProgramOptimization> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup>

bigla avatar Jun 14 '19 09:06 bigla

In this case you must get a warning like this(check your log): "Target has more than one output binary type. CMake does not support it!" It's tricky to implement this only for architectures. I prefer to leave it as it now. At least until upcoming release of cmakeconverter. Also your example looks very synthetic. I think that cases like this are very rare in real life. The solution is - to create yet another target with necessary type.

pavelliavonau avatar Jun 17 '19 15:06 pavelliavonau

To be honest I never worked with Visual Studio (Projects) before. Other people configured the project that I am working on. I remember some explanation along the lines of "We do not have (source-of)libXY for x64, which is why we have to do it like this". Maybe that explanation is more useful for you than for me.

I do not intend to waste your time. And I am very thankful for your work! I'll do my best to be as precise as possible with my descriptions and to be as helpful as i can.

bigla avatar Jun 25 '19 11:06 bigla