[CMake] libsndfile in winodws

aishwarya selvaraj aishwaryaselvaraj1708 at gmail.com
Thu Mar 2 07:07:48 EST 2017


Hi all ,
I was trying to build my .cpp file in windows in Windows platform (windows
10) using cmake .
My .cpp file makes use of two external libraries 1)armadillo 2)libsnd file.
I have written a corresponding cmakelist.txt to compile and obtain the
binary .
I was successful in doing so in Linux , when it come to Windows I obtain
the following error .

















*3>Time Elapsed 00:00:02.062>         Current branch master is up to
date.2>         No patch step for 'project_libsndfile'2>         Performing
autogen step for 'project_libsndfile'2>         Performing configure step
for 'project_libsndfile'2>
'C:\Users\computing7\Desktop\TSM_cmake\build\lib\libsndfile\src\project_libsndfile\configure'
is not recognized as an internal or external command,2>         operable
program or batch file.2>     1>2>C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5):
error MSB6006: "cmd.exe" exited with code 9009.2>       Done executing task
"CustomBuild" -- FAILED.2>     1>2>Done building target "CustomBuild" in
project "project_libsndfile.vcxproj" -- FAILED.2>2>Build FAILED.*
PFA of the cmakelist.txt in case for clarifications.
Why does this error come ?
Is it possible to compile and build libsndfile in windows successfully ?


-- 
Regards,
Aishwarya Selvaraj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170302/11f75836/attachment.html>
-------------- next part --------------
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(TSM2)


include(ExternalProject)
MESSAGE(STATUS "Trying to install armadillo...")

ExternalProject_Add(armadillo
  URL https://github.com/lsolanka/armadillo/archive/master.zip
  PREFIX ${CMAKE_CURRENT_BINARY_DIR}/armadillo_library
  CONFIGURE_COMMAND ""
    #--Build step-----------------
  BUILD_COMMAND ""
    #--Install step---------------
  UPDATE_COMMAND "" # Skip annoying updates for every build
  INSTALL_COMMAND ""
 )
include_directories(${CMAKE_CURRENT_BINARY_DIR}/armadillo_library/src/armadillo/include)



include(ExternalProject)
MESSAGE(STATUS "Trying to install libsndfile...")

ExternalProject_Add(project_libsndfile
    GIT_REPOSITORY     https://github.com/erikd/libsndfile.git
    PREFIX              lib/libsndfile
    CONFIGURE_COMMAND   <SOURCE_DIR>/configure
    BUILD_COMMAND       make
    BUILD_IN_SOURCE     1
    INSTALL_COMMAND     echo Skipping install step for libsndfile
)



ExternalProject_Add_Step(project_libsndfile autogen
   COMMAND              <SOURCE_DIR>/autogen.sh
   DEPENDEES            update
   DEPENDERS            configure
)

ExternalProject_Get_Property(project_libsndfile BINARY_DIR)
SET(libsndfile_lib_dir "${BINARY_DIR}/src/.libs")
SET(libsndfile_inc_dir "${BINARY_DIR}/src")


ADD_LIBRARY(libsndfile STATIC IMPORTED)
SET_PROPERTY(TARGET libsndfile PROPERTY IMPORTED_LOCATION ${libsndfile_lib_dir}/libsndfile.a)

SET(LIBSNDFILE_INCLUDE_PATH "${install_dir}/src/project_libsndfile-build/src/")

INCLUDE_DIRECTORIES(include ${libsndfile_inc_dir})



ADD_EXECUTABLE(tsm ${PROJECT_SOURCE_DIR}/src/TSM_CODE_V3.cpp)
TARGET_LINK_LIBRARIES(tsm ${ARMADILLO} libsndfile )






More information about the CMake mailing list