Cannot find source file:

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Cannot find source file:

Sean Wayland
Hi all,
I am having trouble getting an application to build.
I keep getting this error "cannot find source file"


/Users/seanwayland/Desktop/CATSMAT-masterfri/catsmat/catsmat/Analysis/src/*.cpp

This is the first folder containing sources and when it doesn't find
anything here it stops.

There are indeed .cpp files in that directory.
I tried putting a ./ at the start of the directory tree but it didn't help.

My cmake file is below .. I am using CLION 2017.1.1 and OSX 10.12.1

Can anyone shed any light ??

Thanks for your help!

Best Sean

#######################################
# CMAKE CATSTMAT
#######################################
cmake_minimum_required(VERSION 2.4)
set(CMAKE_CXX_STANDARD 11)
if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES Debug Release)
endif()

if(UNIX)
add_definitions(-Wall -DGCC)
endif(UNIX)

##### RPATH SETTING #####
set(CMAKE_MACOSX_RPATH 1)

#if(APPLE)
# set (CMAKE_OSX_ARCHITECTURES "x86_64 i386")
# if (${CMAKE_SYSTEM_VERSION} VERSION_LESS 9.0.0)
# set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk)
# elseif (${CMAKE_SYSTEM_VERSION} VERSION_LESS 10.8.0)
# set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk)
# elseif (${XCODE_VERSION} VERSION_LESS 4.0.0)
# set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.6.sdk)
# else ()
# set (CMAKE_OSX_SYSROOT "macosx10.7")
# endif ()
# set (CMAKE_C++_FLAGS -mmacosx-version-min=10.4)
#endif(APPLE)
#
#if(WIN32)
# add_definitions(-DWINVER=0x0400 -DWIN32)
# if(${CMAKE_GENERATOR} STREQUAL "Visual Studio 6")
#  add_definitions(-DVC6)
# elseif(${CMAKE_GENERATOR} STREQUAL "Visual Studio 8 2005")
#  add_definitions(-DVC2005)
# endif(${CMAKE_GENERATOR} STREQUAL "Visual Studio 6")
#endif(WIN32)

###############  BOOST LIBRARIES ###########
if (APPLE)
set(BOOST_ROOT "/usr/local/boost")
set(BOOST_FILESYSTEM_LIB  /usr/local/boost/lib/libboost_filesystem.dylib)
set(BOOST_SYSTEM_LIB      /usr/local/boost/lib/libboost_system.dylib)

else ()
set(BOOST_ROOT "C:/local/boost_1_58_0")
set(BOOST_FILESYSTEM_LIB  C:/local/boost_1_58_0/lib64-msvc-12.0)
set(BOOST_SYSTEM_LIB      C:/local/boost_1_58_0/lib64-msvc-12.0)
endif ()

FIND_PACKAGE( Boost 1.58.0 REQUIRED  )
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )


#######################################
# set directories, src and headers.

set (CATSMAT_DIR
./Users/seanwayland/Desktop/CATSMAT-masterfri/catsmat/catsmat/ )

set (libIMUSANT_DIR    ${CMAKE_CURRENT_SOURCE_DIR}/../../libIMUSANT)
set (LOKI_DIR               ${CMAKE_CURRENT_SOURCE_DIR}/../../Loki)
set (SUFFIX_TREE_DIR        ${CMAKE_CURRENT_SOURCE_DIR}/../../SuffixTree)
set (GOOGLE_TEST_INC_DIR
${CMAKE_CURRENT_SOURCE_DIR}/../../googletest-master/googletest/include)
set (IMUSANT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../libIMUSANT)


set (LIBMUSICXML_DIR    ${CMAKE_CURRENT_SOURCE_DIR}/../../libMusicXMLv3)

set (SRCFOLDERS


${CATSMAT_DIR}/Analysis/src
${CATSMAT_DIR}/CounterpointAnalysis/src
${CATSMAT_DIR}/GeneralAnalysis/src
${CATSMAT_DIR}/Segmentation/FixedPeriodDetection/src
${CATSMAT_DIR}/Segmentation/LocalBoundaryDetectionModel/src
${CATSMAT_DIR}/Application
${CATSMAT_DIR}/Segmentation/LocalBoundaryDetectionModel/src
${CATSMAT_DIR}/Segmentation
${CATSMAT_DIR}/Utilities
)


set (INCFOLDERS
${libIMUSANT_DIR}
${CATSMAT_DIR}/Analysis/inc
        ${CATSMAT_DIR}/Application
        ${CATSMAT_DIR}/CounterpointAnalysis/inc
        ${CATSMAT_DIR}/GeneralAnalysis/inc
        ${CATSMAT_DIR}/Segmentation
        ${CATSMAT_DIR}/Segmentation/FixedPeriodDetection/inc
        ${CATSMAT_DIR}/Segmentation/LocalBoundaryDetectionModel/inc
        ${CATSMAT_DIR}/Utilities
${libIMUSANT_DIR}/DomainObjects/inc
${libIMUSANT_DIR}/Utilities/inc
${libIMUSANT_DIR}/FileProcessing/inc
${libIMUSANT_DIR}/Converters/MusicXML_v3
${libIMUSANT_DIR}/Converters/MusicXML_v3/inc
${libIMUSANT_DIR}/Converters/MusicXML_v3/shared/inc
                ${IMUSANT_DIR}/DomainObjects/inc
${IMUSANT_DIR}/Converters/MusicXML_v3
                ${IMUSANT_DIR}/Converters/MusicXML_v3/inc
${IMUSANT_DIR}/Converters/Shared/inc
                ${IMUSANT_DIR}/FileProcessing/inc
                ${IMUSANT_DIR}/Utilities/inc
                ${SUFFIXTREE_DIR}
${LIBMUSICXML_DIR}/libmusicxml-3.00-src/src
${LIBMUSICXML_DIR}/libmusicxml-3.00-src/src/lib
${LIBMUSICXML_DIR}/libmusicxml-3.00-src/src/visitors
${LIBMUSICXML_DIR}/libmusicxml-3.00-src/src/parser

${LOKI_DIR}
${SUFFIX_TREE_DIR}
${GOOGLE_TEST_INC_DIR}
)


foreach(folder ${SRCFOLDERS})
set(SRC ${SRC} "${folder}/*.cpp") # add source files
endforeach(folder)
file (GLOB CORESRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SRC})





foreach(folder ${INCFOLDERS})
set(HEADERS ${HEADERS} "${folder}/*.h") # add header files
set(INCL ${INCL} "${folder}") # add include folders
endforeach(folder)
file (GLOB COREH RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${HEADERS})


#######################################
# set includes
include_directories( ${INCL})
set_source_files_properties (${COREH} PROPERTIES HEADER_FILE_ONLY TRUE)


#######################################
# set library target
if(APPLE OR MSVC)
set(target catsmat)
else(APPLE OR MSVC)
set(target catsmat)
endif(APPLE OR MSVC)

##if(MSVC)
## enable_language(RC)
## set(LIBCONTENT ${CORESRC} ${COREH}
${CATSMAT_DIR}/win32/libIMUSANT/libIMUSANT.rc)
##else(MSVC)
## set(LIBCONTENT ${CORESRC} ${COREH})
##endif(MSVC)

add_executable(${target} ${SRC} )



###############  Targeted Libraries ###########

TARGET_LINK_LIBRARIES(${target} gtest)
TARGET_LINK_LIBRARIES(${target} ${BOOST_FILESYSTEM_LIB})
TARGET_LINK_LIBRARIES(${target} ${BOOST_SYSTEM_LIB})
TARGET_LINK_LIBRARIES(${target} libmusicxml2)
TARGET_LINK_LIBRARIES(${target} libIMUSANT)


set_target_properties (${target} PROPERTIES
FRAMEWORK TRUE
VERSION ${VERSION}
FRAMEWORK_VERSION ${VERSION}
PUBLIC_HEADER "${COREH}"
DEFINE_SYMBOL LIBMUSICXML_EXPORTS
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${STRVERS}
MACOSX_FRAMEWORK_BUNDLE_VERSION ${SSTRVERS}
)


#######################################
# install setup
if(NOT APPLE)
install ( TARGETS ${target} ${TOOLS}
RUNTIME DESTINATION bin
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib
    FRAMEWORK DESTINATION "/Library/Frameworks" CONFIGURATIONS Release
    PUBLIC_HEADER DESTINATION include/libmusicxml
)
endif()




www.seanwayland.com

Sean Wayland
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot find source file:

Dan Liew
On 24 June 2017 at 05:06, Sean Wayland <[hidden email]> wrote:

> Hi all,
> I am having trouble getting an application to build.
> I keep getting this error "cannot find source file"
>
>
> /Users/seanwayland/Desktop/CATSMAT-masterfri/catsmat/catsmat/Analysis/src/*.cpp
>
> This is the first folder containing sources and when it doesn't find
> anything here it stops.
>
> There are indeed .cpp files in that directory.
> I tried putting a ./ at the start of the directory tree but it didn't help.
>
> My cmake file is below .. I am using CLION 2017.1.1 and OSX 10.12.1
>
> Can anyone shed any light ??

My high level comment would be to not glob for source files. This an
anti-pattern and will break your incremental builds.

For example if you add a new source files say "foo.cpp" and then run
"make" (or whatever your CMake generator is) the build
will fail if "foo.cpp" is actually needed because CMake will not know
it needs to re-configure to discover "foo.cpp" and so will
not try to build "foo.cpp". By listing source files manually in
"CMakeLists.txt" files you will force CMake to re-configure when you
add/remove source files from the build.

I also note you are setting a very old minimum CMake version and are
using the old style condition syntax (condition appears in `endif()`
and `else()`).
I'd really advise you don't use that syntax and set a high minimum
CMake version so you get some of the useful new features in CMake
unless
you have a specific reason for supporting such an old version of CMake.

As for your globbing problem

* This is definitely wrong

```
set (CATSMAT_DIR
./Users/seanwayland/Desktop/CATSMAT-masterfri/catsmat/catsmat/ )
```

The leading `.` means current directory and I doubt there's a `Users`
folder in your current directory.
Also hard coding paths like is very bad style and is not portable.

* This doesn't make sense

```
file (GLOB CORESRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SRC})
```

"${SRC}" is a list of absolute paths but then you tell the `file()`
command to assume the paths are relative
to `${CMAKE_CURRENT_SOURCE_DIR}`.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Loading...