fix external dependency for ci build

The external dependency on phosphor-ipmi-host has changed
from autotools to meson, so the cmake blurb to build it
as an external project needs to change too.

This also removes the pinned version of ipmid

Tested: checked out unit-test scripts and built it locally

Change-Id: I82021cf401c7db134c45cd5d700753bc6fde8c55
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4aa0f03..ee58258 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,6 +32,12 @@
 add_definitions (-Wno-psabi)
 
 if (NOT YOCTO) # headers that can't be built without yocto
+
+    execute_process(
+        COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
+        OUTPUT_VARIABLE TRIPLE OUTPUT_STRIP_TRAILING_WHITESPACE)
+    message(STATUS "Target triple: ${TRIPLE}")
+
     include_directories (SYSTEM non-yocto)
 
     configure_file (CMakeLists.txt.in 3rdparty/CMakeLists.txt)
@@ -43,6 +49,7 @@
     set (CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/prefix ${CMAKE_PREFIX_PATH})
     include_directories (SYSTEM ${CMAKE_BINARY_DIR}/prefix/include)
     link_directories (${CMAKE_BINARY_DIR}/prefix/lib)
+    link_directories (${CMAKE_BINARY_DIR}/prefix/lib/${TRIPLE})
 
     include_directories (SYSTEM ${CMAKE_BINARY_DIR}/sdbusplus-src)
     link_directories (${CMAKE_BINARY_DIR}/sdbusplus-src/.libs)
diff --git a/CMakeLists.txt.in b/CMakeLists.txt.in
index 361534d..366f144 100644
--- a/CMakeLists.txt.in
+++ b/CMakeLists.txt.in
@@ -29,25 +29,21 @@
 
 externalproject_add (
     host-ipmid PREFIX ${CMAKE_BINARY_DIR}/phosphor-host-ipmid GIT_REPOSITORY
-    https://github.com/openbmc/phosphor-host-ipmid GIT_TAG
-    33457108dbd8ed337b4d4c92d94362acc9a6b437 SOURCE_DIR
+    https://github.com/openbmc/phosphor-host-ipmid SOURCE_DIR
     ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src BINARY_DIR
     ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-build CONFIGURE_COMMAND /usr/bin/bash -c
     "cd ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src && export \
     PYTHONPATH=${CMAKE_BINARY_DIR}/prefix/lib/python2.7/site-packages:$ENV{PYTHONPATH} \
-    && export PATH=${CMAKE_BINARY_DIR}/prefix/bin:$ENV{PATH} && export \
-    PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/prefix/lib/pkgconfig && ./bootstrap.sh \
-    && ./configure --prefix=${CMAKE_BINARY_DIR}/prefix \
-    CPPFLAGS=\'-I${CMAKE_BINARY_DIR}/prefix/include/ \' \
-    CXXFLAGS=\'-Wno-error=unused-result \' \
-    LDFLAGS=\'-L${CMAKE_BINARY_DIR}/prefix/lib/ \'"
+    && export PATH=${CMAKE_BINARY_DIR}/prefix/bin:$ENV{PATH} && \
+    export CPPFLAGS=\'-I${CMAKE_BINARY_DIR}/prefix/include/ \' && \
+    export LDFLAGS=\'-L${CMAKE_BINARY_DIR}/prefix/lib/ \' && \
+    meson --prefix=${CMAKE_BINARY_DIR}/prefix build-ext"
     BUILD_COMMAND /usr/bin/bash -c "cd ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src && export \
     PYTHONPATH=${CMAKE_BINARY_DIR}/prefix/lib/python2.7/site-packages:$ENV{PYTHONPATH} \
-    && export PATH=${CMAKE_BINARY_DIR}/prefix/bin:$ENV{PATH} && export \
-    PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/prefix/lib/pkgconfig && make -j \
-    verbose=1"
+    && export PATH=${CMAKE_BINARY_DIR}/prefix/bin:$ENV{PATH} && \
+    ninja --verbose -C build-ext"
     INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/phosphor-ipmi-host-src &&
-    make install && mkdir -p
+    ninja --verbose -C build-ext install && mkdir -p
     "${CMAKE_BINARY_DIR}/prefix/include/phosphor-ipmi-host" && cp
     sensorhandler.hpp selutility.hpp
     "${CMAKE_BINARY_DIR}/prefix/include/phosphor-ipmi-host/" && echo "ipmid config finish"