Skip to content

Commit

Permalink
Propagate deps and let VS target the correct platform
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmad-el-sayed committed Jan 13, 2025
1 parent 45bae55 commit 9e5b0b2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
2 changes: 1 addition & 1 deletion libs/UGrid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${Boost_INCLUDE_DIR})
# link required libraries
target_link_libraries(
${TARGET_NAME}
LINK_PUBLIC
PUBLIC
netCDF::netcdf
netCDF::netcdf-cxx4
)
Expand Down
5 changes: 1 addition & 4 deletions libs/UGridAPI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ target_sources(
BASE_DIRS
${INC_DIR} ${VERSION_INC_DIR}
FILES
${INC_LIST}
${INC_LIST}
)

# Expose the interface of the shared lib
Expand All @@ -56,9 +56,6 @@ target_link_libraries(
${TARGET_NAME}
PUBLIC
"$<TARGET_NAME:UGrid>"
PRIVATE
netCDF::netcdf
netCDF::netcdf-cxx4
)

# Make sure that coverage information is produced when using gcc
Expand Down
3 changes: 0 additions & 3 deletions libs/UGridNET/SWIG/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ target_link_libraries(
${TARGET_NAME}
PUBLIC
"$<TARGET_NAME:UGrid>"
PRIVATE
netCDF::netcdf
netCDF::netcdf-cxx4
)

# group the sources in IDE tree
Expand Down
15 changes: 15 additions & 0 deletions libs/UGridNET/dll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,18 @@ set_target_properties(
)

target_compile_options(${TARGET_NAME} PRIVATE "/unsafe")

# Set target architecture
# message(STATUS ">>>>>>>>>>>> Generator platform is set to '${CMAKE_GENERATOR_PLATFORM}'.")
# if(CMAKE_GENERATOR_PLATFORM STREQUAL "x64")
# set(TARGET_PLATFORM "/platform:x64")
# elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "Win32")
# set(TARGET_PLATFORM "/platform:x86")
# else()
# message(WARNING "Generator platform '${CMAKE_GENERATOR_PLATFORM}' is not supported by managed projects. Defaulting to 'AnyCPU'.")
# set(TARGET_PLATFORM "/platform:AnyCPU")
# endif()
# target_compile_options(${TARGET_NAME} PRIVATE ${TARGET_PLATFORM})


target_compile_options(${TARGET_NAME} PRIVATE "/platform:AnyCPU")
14 changes: 14 additions & 0 deletions libs/UGridNET/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,17 @@ set_target_properties(
VS_PACKAGE_REFERENCES "${PACKAGE_REFERENCES}"
VS_DOTNET_REFERENCEPROP_UGridNET_TAG_SetTargetFramework "TargetFramework=netstandard2.0"
)

# # Set target architecture
# message(STATUS ">>>>>>>>>>>> Generator platform is set to '${CMAKE_GENERATOR_PLATFORM}'.")
# if(CMAKE_GENERATOR_PLATFORM STREQUAL "x64")
# set(TARGET_PLATFORM "/platform:x64")
# elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "Win32")
# set(TARGET_PLATFORM "/platform:x86")
# else()
# message(WARNING "Generator platform '${CMAKE_GENERATOR_PLATFORM}' is not supported by managed projects. Defaulting to 'AnyCPU'.")
# set(TARGET_PLATFORM "/platform:AnyCPU")
# endif()
# target_compile_options(${TARGET_NAME} PRIVATE ${TARGET_PLATFORM})

target_compile_options(${TARGET_NAME} PRIVATE "/platform:AnyCPU")

0 comments on commit 9e5b0b2

Please sign in to comment.