Skip to content

Commit

Permalink
fix for win32
Browse files Browse the repository at this point in the history
  • Loading branch information
EricCousineau-TRI committed May 5, 2019
1 parent 0b21550 commit 8e8c4a3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ target_include_directories(${PROJECT_NAME}
PUBLIC
include
)
if(WIN32)
target_compile_definitions(${PROJECT_NAME}
PRIVATE "RCPPUTILS_BUILDING_LIBRARY")
endif()
ament_target_dependencies(${PROJECT_NAME} rcutils)
ament_export_libraries(${PROJECT_NAME})

Expand Down
9 changes: 8 additions & 1 deletion test/test_find_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <stdlib.h>

#include <string>

#include "gtest/gtest.h"
Expand Down Expand Up @@ -43,8 +45,13 @@ TEST(test_find_library, find_library)
#else
env_var = "LD_LIBRARY_PATH";
#endif

#ifdef _WIN32
EXPECT_EQ(_putenv_s(env_var, test_lib_dir), 0);
#else
const int override = 1;
setenv(env_var, test_lib_dir, override);
EXPECT_EQ(setenv(env_var, test_lib_dir, override), 0);
#endif

// Positive test.
const std::string test_lib_actual = find_library_path("test_library");
Expand Down
3 changes: 2 additions & 1 deletion test/test_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
// limitations under the License.

/// @file
/// Trivial library to ensure we have some linking present.
/// Trivial library to ensure we have some linking present for
/// `test_find_library`.

namespace test_library
{
Expand Down

0 comments on commit 8e8c4a3

Please sign in to comment.