Skip to content

Commit 9cf61b1

Browse files
committed
Address CodeRabbit AI review feedback
- Fix README CMake version mismatch: update from >=3.10 to >=3.16 to match CMakeLists.txt requirement - Fix Windows MSVC import library conflict: when BUILD_BOTH_LIBRARIES is ON, both static and shared libraries would produce cpp_dotenv.lib on Windows. Add IMPORT_SUFFIX "_shared.lib" to the shared library's import library to avoid this conflict on Windows/MSVC.
1 parent 7bed243 commit 9cf61b1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ if(BUILD_BOTH_LIBRARIES)
7272
target_compile_options(cpp_dotenv_shared PRIVATE ${CPP_DOTENV_COMPILE_OPTIONS})
7373
# Set output name to libcpp_dotenv.so/.dylib (instead of libcpp_dotenv_shared.so)
7474
set_target_properties(cpp_dotenv_shared PROPERTIES OUTPUT_NAME cpp_dotenv)
75+
# On Windows (MSVC), the import library would conflict with the static library.
76+
# Add a suffix to the import library name to avoid this conflict.
77+
if(MSVC)
78+
set_target_properties(cpp_dotenv_shared PROPERTIES IMPORT_SUFFIX "_shared.lib")
79+
endif()
7580

7681
# Alias for backward compatibility:
7782
# When BUILD_BOTH_LIBRARIES is ON, the cpp_dotenv target is an alias to

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ C++ implementation of NodeJS [dotenv](https://github.com/motdotla/dotenv) projec
3939

4040
Supported build methods are:
4141

42-
- [CMake](#cmake) (>=3.10)
42+
- [CMake](#cmake) (>=3.16)
4343

4444
### CMake
4545

0 commit comments

Comments
 (0)