Skip to content

Commit

Permalink
Fixed cmake script and windows pathing. (#53)
Browse files Browse the repository at this point in the history
* Fixed cmake script and windows pathing.
  • Loading branch information
JonathanHenson authored Feb 14, 2019
1 parent 6a483a5 commit 8f447e8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
cmake_minimum_required(VERSION 3.1)
project(aws-c-mqtt C)

if (DEFINED CMAKE_PREFIX_PATH)
file(TO_CMAKE_PATH ${CMAKE_PREFIX_PATH} CMAKE_PREFIX_PATH)
endif()

if (DEFINED CMAKE_INSTALL_PREFIX)
file(TO_CMAKE_PATH ${CMAKE_INSTALL_PREFIX} CMAKE_INSTALL_PREFIX)
endif()

if (UNIX AND NOT APPLE)
include(GNUInstallDirs)
elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
Expand Down
16 changes: 8 additions & 8 deletions codebuild/common-windows.bat
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
set CMAKE_ARGS=%*

set BUILDS_DIR=%TEMP%/builds
set INSTALL_DIR=%BUILDS_DIR%/install
set BUILDS_DIR=%TEMP%\builds
set INSTALL_DIR=%BUILDS_DIR%\install
mkdir %BUILDS_DIR%
mkdir %INSTALL_DIR%

CALL :install_library aws-c-common
CALL :install_library aws-c-io

mkdir %BUILDS_DIR%/aws-c-mqtt-build
cd %BUILDS_DIR%/aws-c-mqtt-build
cmake %CMAKE_ARGS% -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_PREFIX_PATH=%INSTALL_DIR% %CODEBUILD_SRC_DIR% || goto error
mkdir %BUILDS_DIR%\aws-c-mqtt-build
cd %BUILDS_DIR%\aws-c-mqtt-build
cmake %CMAKE_ARGS% -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%" -DCMAKE_PREFIX_PATH="%INSTALL_DIR%" %CODEBUILD_SRC_DIR% || goto error
cmake --build . --config RelWithDebInfo || goto error
ctest -V || goto error

goto :EOF

:install_library
mkdir %BUILDS_DIR%/%~1-build
cd %BUILDS_DIR%/%~1-build
mkdir %BUILDS_DIR%\%~1-build
cd %BUILDS_DIR%\%~1-build
git clone https://github.com/awslabs/%~1.git
cmake %CMAKE_ARGS% -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_PREFIX_PATH=%INSTALL_DIR% %~1 || goto error
cmake %CMAKE_ARGS% -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%" -DCMAKE_PREFIX_PATH="%INSTALL_DIR%" %~1 || goto error
cmake --build . --target install --config RelWithDebInfo || goto error
exit /b %errorlevel%

Expand Down

0 comments on commit 8f447e8

Please sign in to comment.