Skip to content

Commit b025203

Browse files
Merge pull request #59 from robotology/fix/windows
Update the main CMakeLists.txt file to be compatible with windows
2 parents 57f9d6b + 709aadc commit b025203

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All notable changes to this project are documented in this file.
55
### Added
66

77
### Changed
8-
8+
- Fix the windows compilation (https://github.com/robotology/walking-controllers/pull/59)
99
## [0.3.0] - 2020-03-16
1010
### Added
1111
- The `CHANGELOG.md` file

CMakeLists.txt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,35 @@ set(CMAKE_CXX_STANDARD 14)
77

88
## MAIN project
99
project(WalkingControllers
10-
VERSION 0.3.0)
10+
VERSION 0.3.1)
11+
12+
# Defines the CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_BINDIR and many other useful macros.
13+
# See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
14+
include(GNUInstallDirs)
15+
16+
# Control where libraries and executables are placed during the build.
17+
# With the following settings executables are placed in <the top level of the
18+
# build tree>/bin and libraries/archives in <top level of the build tree>/lib.
19+
# This is particularly useful to run ctests on libraries built on Windows
20+
# machines: tests, which are executables, are placed in the same folders of
21+
# dlls, which are treated as executables as well, so that they can properly
22+
# find the libraries to run. This is a because of missing RPATH on Windows.
23+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
24+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
25+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
26+
27+
# To build shared libraries in Windows, we set CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS to TRUE.
28+
# See https://cmake.org/cmake/help/v3.4/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.html
29+
# See https://blog.kitware.com/create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/
30+
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
31+
32+
# Under MSVC, we set CMAKE_DEBUG_POSTFIX to "d" to add a trailing "d" to library
33+
# built in debug mode. In this Windows user can compile, build and install the
34+
# library in both Release and Debug configuration avoiding naming clashes in the
35+
# installation directories.
36+
if(MSVC)
37+
set(CMAKE_DEBUG_POSTFIX "d")
38+
endif()
1139

1240
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
1341

0 commit comments

Comments
 (0)