I use cmake + qt in the development of mac os x 10.12 platform, but when I use the set (CMAKE_OSX_DEPLOYMENT_TARGET "10.11") compiler generated app, the app copy to mac os x 10.11 on the computer application, prompted app need os X 10.12, but if not copy the app to the application, copy to other directories will not prompt the need for os x 10.12, very strange question, my app also depends on a lot of other dylib, please help me analyze this problem.
The following is the cmake code:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
#set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11")
PROJECT(toon)
set(PACKAGE "toon")
set(TOON_VERSION "1.1.0")
set(XCODE_BUILD "")
IF(APPLE)
#set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS}")
MESSAGE(STATUS "CMAKE_CXX_FLAGS:" ${CMAKE_CXX_FLAGS})
MESSAGE(STATUS "DEPLOYMENT_TARGET:" ${CMAKE_OSX_DEPLOYMENT_TARGET})
MESSAGE(STATUS "CMAKE_OSX_SYSROOT:" ${CMAKE_OSX_SYSROOT})
ENDIF()
#set(CMAKE_BUILD_TYPE Debug)
#set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}-std=c++11")
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
IF(CMAKE_BUILD_TYPE MATCHES "Release")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
ELSEIF(CMAKE_BUILD_TYPE MATCHES "Debug")
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -Wall -g")
MESSAGE(STATUS "build_type:" ${CMAKE_BUILD_TYPE})
MESSAGE(STATUS "cxx_flags:" ${CMAKE_CXX_FLAGS_DEBUG})
ENDIF()
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(MY_PRODUCT_NUMBER 1)
set(MY_PRODUCT_VERSION 1)
set(MY_BUILD_NUMBER 2)
ENDIF()
IF(APPLE)
set(CMAKE_MACOSX_RPATH ON)
#set(INSTALL_LIB_DIR "${PROJECT_SOURCE_DIR}/toonsdk/build/x64/Debug") # 假设安装目录在编译目录的lib子目录内
#set(CMAKE_SKIP_BUILD_RPATH FALSE)
#set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
#set(CMAKE_INSTALL_RPATH "${PROJECT_SOURCE_DIR}/toonsdk/build/x64/Debug")
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
IF(CMAKE_BUILD_TYPE MATCHES "Release")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
ELSEIF(CMAKE_BUILD_TYPE MATCHES "Debug")
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -Wall -g")
ENDIF()
ENDIF()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
ADD_SUBDIRECTORY(Common)
ADD_SUBDIRECTORY(LocalStorage)
ADD_SUBDIRECTORY(NetWorkAPI)
ADD_SUBDIRECTORY(IMCore)
ADD_SUBDIRECTORY(ToonProtocol)
ADD_SUBDIRECTORY(TNMVD)
ADD_SUBDIRECTORY(Notice)
ADD_SUBDIRECTORY(SetUp)
ADD_SUBDIRECTORY(CardCase)
#ADD_SUBDIRECTORY(Upgrade)
ADD_SUBDIRECTORY(Mine)
ADD_SUBDIRECTORY(Toon)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9") sloved;
Related
I am trying to install a package called DICe available here: https://github.com/dicengine/dice on my Ubuntu 20.04 LTS using source code. This package requires another package called Trilinos : https://trilinos.github.io/ . I have successfully build the Trilinos in the following path: ~/Documents/Trilinos/. Now the problem is, when I try to build the DCIe in ~/Documents/DCIe/ it shows error:
CMake Error at CMakeLists.txt:22 (find_package):
By not providing "FindTrilinos.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Trilinos",
but CMake did not find one.
Could not find a package configuration file provided by "Trilinos" with any
of the following names:
TrilinosConfig.cmake
trilinos-config.cmake
Add the installation prefix of "Trilinos" to CMAKE_PREFIX_PATH or set
"Trilinos_DIR" to a directory containing one of the above files. If
"Trilinos" provides a separate development package or SDK, be sure it has
been installed.
I have extracted DCIe source code in ~/Downloads/dice2.0. Can someone guide me how I am supposed to configure the CmakeLists.txt? Here is my changed version:
MESSAGE("\nConfiguring DICe...\n")
# check if the pre-compiled set of libraries and header for windows is being used:
IF(DEFINED DICE_DEVPACK_DIR)
MESSAGE(STATUS "***Using DevPack from: ${DICE_DEVPACK_DIR}")
MESSAGE(STATUS "Note: if any of the following variables have been defined, they will be reset\n DICE_TRILINOS_DIR\n OpenCV_DIR\n CLAPACK_DIR\n NetCDF_DIR\n HDF5_DIR")
SET(DICE_TRILINOS_DIR "${DICE_DEVPACK_DIR}/trilinos")
SET(OpenCV_DIR "${DICE_DEVPACK_DIR}/opencv")
SET(NetCDF_DIR "${DICE_DEVPACK_DIR}/netcdf/lib")
SET(HDF5_DIR "${DICE_DEVPACK_DIR}/netcdf/lib")
SET(CLAPACK_DIR "${DICE_DEVPACK_DIR}/lapack")
link_directories(${CLAPACK_DIR}/F2CLIBS)
ENDIF()
# Try to find Trilinos, if path was not given
IF (NOT DEFINED DICE_TRILINOS_DIR)
# Losely based on:
# https://github.com/trilinos/Trilinos_tutorial/wiki/CMakeFindPackageTrilinosExample
# /usr/share/doc/opencv-doc/examples/face/CMakeLists.txt
# * Find Trilinos
find_package(Trilinos REQUIRED)
IF(Trilinos_FOUND)
MESSAGE("\nFound Trilinos")
SET(DICE_TRILINOS_DIR ${Trilinos_DIR})
MESSAGE("Trilinos_DIR = ${DICE_TRILINOS_DIR}")
ELSE()
MESSAGE(FATAL_ERROR "Could not find Trilinos")
ENDIF()
ENDIF()
MESSAGE(STATUS "Using Trilinos installed in: ${DICE_TRILINOS_DIR}")
# If this is a windows build CLAPACK is required. Find package for
# clapack is automatically enabled by setting the CLAPACK_DIR variable
IF(WIN32 AND NOT DEFINED DICE_DEVPACK_DIR)
# must defined clapack_dir
IF (NOT DEFINED CLAPACK_DIR)
MESSAGE(FATAL_ERROR "\nDICe Error: this is a windows build, so cmake must define CLAPACK_DIR:
(-D CLAPACK_DIR:FILEPATH=<clapack_install_prefix>)!")
ENDIF()
FIND_PACKAGE(clapack PATHS ${CLAPACK_DIR})
IF(clapack_FOUND)
MESSAGE("\nFound CLAPACK in ${CLAPACK_DIR}")
link_directories(${CLAPACK_DIR}/F2CLIBS/libf2c)
ELSE()
MESSAGE("\nERROR: could not find CLAPACK in the following directory: ${CLAPACK_DIR}")
ENDIF()
ENDIF()
IF(WIN32)
IF(NOT BUILD_SHARED_LIBS)
MESSAGE("\nWarning: This is a windows build, but BUILD_SHARED_LIBS is OFF. Setting BUILD_SHARED_LIBS on automatically.")
SET(BUILD_SHARED_LIBS ON)
ENDIF(NOT BUILD_SHARED_LIBS)
ENDIF(WIN32)
IF(BUILD_SHARED_LIBS)
MESSAGE(STATUS "BUILD_SHARED_LIBS is set to ON")
ELSE(BUILD_SHARED_LIBS)
MESSAGE(STATUS "BUILD_SHARED_LIBS is set to OFF")
ENDIF(BUILD_SHARED_LIBS)
# Get Trilinos as one entity
# SET(Trilinos_DIR CACHE PATH "~/Documents/Trilinos")
SET(CMAKE_PREFIX_PATH ${DICE_TRILINOS_DIR} ${CMAKE_PREFIX_PATH})
FIND_PACKAGE(Trilinos PATHS ~/Documents/Trilinos)
IF(NOT Trilinos_FOUND)
MESSAGE(FATAL_ERROR "Could not find Trilinos!")
ENDIF()
MESSAGE("\nFound Trilinos! Here are the details: ")
MESSAGE(" Trilinos_DIR = ${Trilinos_DIR}")
MESSAGE(" Trilinos_VERSION = ${Trilinos_VERSION}")
MESSAGE(" Trilinos_PACKAGE_LIST = ${Trilinos_PACKAGE_LIST}")
MESSAGE(" Trilinos_LIBRARIES = ${Trilinos_LIBRARIES}")
MESSAGE(" Trilinos_INCLUDE_DIRS = ${Trilinos_INCLUDE_DIRS}")
MESSAGE(" Trilinos_LIBRARY_DIRS = ${Trilinos_LIBRARY_DIRS}")
MESSAGE(" Trilinos_TPL_LIST = ${Trilinos_TPL_LIST}")
MESSAGE(" Trilinos_TPL_INCLUDE_DIRS = ${Trilinos_TPL_INCLUDE_DIRS}")
MESSAGE(" Trilinos_TPL_LIBRARIES = ${Trilinos_TPL_LIBRARIES}")
MESSAGE(" Trilinos_TPL_LIBRARY_DIRS = ${Trilinos_TPL_LIBRARY_DIRS}")
MESSAGE(" Trilinos_BUILD_SHARED_LIBS = ${Trilinos_BUILD_SHARED_LIBS}")
MESSAGE("End of Trilinos details\n")
IF(NOT DEFINED DICE_DEVPACK_DIR)
SET(CMAKE_CXX_COMPILER ${Trilinos_CXX_COMPILER} )
SET(CMAKE_C_COMPILER ${Trilinos_C_COMPILER} )
ENDIF()
SET(CMAKE_VERBOSE_MAKEFILE OFF)
IF(NOT DEFINED DICE_MPI_EXEC)
SET(DICE_MPI_EXEC mpiexec)
ENDIF()
# End of setup and error checking
# NOTE: PROJECT command checks for compilers, so this statement
# is moved AFTER setting CMAKE_CXX_COMPILER opton
PROJECT(DICe)
MESSAGE(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
SET(DICE_OUTPUT_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
MESSAGE(STATUS "The output directory for DICe libraries will be: ${DICE_OUTPUT_PREFIX}/lib")
MESSAGE(STATUS "If 'make install' is exectued, the libraries will also be copied to: ${CMAKE_INSTALL_PREFIX}/lib")
# See if tracklib is available
IF(DEFINED TRACKLIB_DIR)
MESSAGE(STATUS "TRACKLIB is ON")
MESSAGE(STATUS "TRACKLIB_DIR is set to: ${TRACKLIB_DIR}")
ADD_DEFINITIONS(-DDICE_ENABLE_TRACKLIB=1)
ELSE()
MESSAGE(STATUS "TRACKLIB is OFF")
ENDIF()
# Try to find OpenCV, if path was not given
IF (NOT DEFINED OpenCV_DIR)
# Losely based on:
# https://github.com/trilinos/Trilinos_tutorial/wiki/CMakeFindPackageTrilinosExample
# /usr/share/doc/opencv-doc/examples/face/CMakeLists.txt
# * Find OpenCV
message(STATUS "OpenCV_DIR not specified, looking in default paths")
find_package(OpenCV REQUIRED)
ELSE()
message(STATUS "Looking for OpenCV in dir: ${OpenCV_DIR}")
find_package( OpenCV NO_DEFAULT_PATH PATHS ${OpenCV_DIR} )
ENDIF()
IF(OpenCV_FOUND)
set(DICE_ENABLE_OPENCV ON)
IF(WIN32)
FILE(GLOB OPENCV_DLLS ${OpenCV_DIR}/x64/vc12/bin/*.dll)
FILE(COPY ${OPENCV_DLLS} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin)
FILE(GLOB OPENCV_DLLS ${OpenCV_DIR}/x64/vc15/bin/*.dll)
FILE(COPY ${OPENCV_DLLS} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin)
ENDIF()
ELSE()
message(FATAL_ERROR "OpenCV not found. OpenCV is now a required package in DICe")
ENDIF()
# FIND NETCDF
set(DICE_ENABLE_NETCDF OFF)
if(DEFINED NetCDF_DIR)
set(DICE_ENABLE_NETCDF ON)
MESSAGE(STATUS "Looking for NetCDF in: ${NetCDF_DIR}")
find_library(NetCDF_lib NAMES libnetcdf.a netcdf PATHS ${NetCDF_DIR})
MESSAGE(STATUS "Looking for HDF5 in: ${HDF5_DIR}")
find_library(HDF5_lib NAMES libhdf5.a hdf5 PATHS ${HDF5_DIR} NO_DEFAULT_PATH)
find_library(HDF5_lib NAMES libhdf5.a hdf5 PATHS ${HDF5_DIR})
find_library(HDF5_hl_lib NAMES libhdf5_hl.a hdf5_hl PATHS ${HDF5_DIR} NO_DEFAULT_PATH)
find_library(HDF5_hl_lib NAMES libhdf5_hl.a hdf5_hl PATHS ${HDF5_DIR})
MESSAGE(STATUS "Using NetCDF lib: ${NetCDF_lib}")
MESSAGE(STATUS "Using HDF5 libs: ${HDF5_lib} ${HDF5_hl_lib}")
IF(NOT NetCDF_lib_NOTFOUND)
SET(DICE_LIBRARIES ${DICE_LIBRARIES} ${NetCDF_lib})
SET(DICE_LIBRARIES ${DICE_LIBRARIES} ${HDF5_lib})
SET(DICE_LIBRARIES ${DICE_LIBRARIES} ${HDF5_hl_lib})
ADD_DEFINITIONS(-DDICE_ENABLE_NETCDF=1)
include_directories(${NetCDF_DIR}/../include)
link_directories(${NetCDF_DIR}/../lib)
IF(WIN32)
FILE(GLOB NetCDF_DLLS ${NetCDF_DIR}/../bin/*.dll)
FILE(COPY ${NetCDF_DLLS} DESTINATION ${DICE_OUTPUT_PREFIX}/bin)
ENDIF()
ELSE()
message(FATAL_ERROR "Error, NetCDF enabled but not found")
ENDIF()
else()
MESSAGE(STATUS "NetCDF will NOT be enabled")
endif()
#
# Hypercine library for reading cine files
#
include(ExternalProject)
MESSAGE(STATUS "Configuring hypercine")
SET(HYPERCINE_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DHYPERCINE_DEBUG_MSG:BOOL=${DICE_DEBUG_MSG} -DOpenCV_DIR:PATH=${OpenCV_DIR})
# base data type:
if(DICE_USE_INT_STORAGE)
SET(HYPERCINE_CMAKE_ARGS ${HYPERCINE_CMAKE_ARGS} -DHYPERCINE_USE_INT_STORAGE:BOOL=ON)
ADD_DEFINITIONS(-DUSE_INT_STORAGE=1)
elseif(DICE_USE_DOUBLE)
SET(HYPERCINE_CMAKE_ARGS ${HYPERCINE_CMAKE_ARGS} -DHYPERCINE_USE_DOUBLE_STORAGE:BOOL=ON)
ADD_DEFINITIONS(-DUSE_DOUBLE_STORAGE=1)
else()
SET(HYPERCINE_CMAKE_ARGS ${HYPERCINE_CMAKE_ARGS} -DHYPERCINE_USE_FLOAT_STORAGE:BOOL=ON)
ADD_DEFINITIONS(-DUSE_FLOAT_STORAGE=1)
endif()
ExternalProject_Add(hypercine
GIT_REPOSITORY git://github.com/dicengine/hypercine.git
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/hypercine
CMAKE_ARGS ${HYPERCINE_CMAKE_ARGS}
)
# base data type:
if(DICE_USE_DOUBLE)
ADD_DEFINITIONS(-DDICE_USE_DOUBLE=1)
MESSAGE(STATUS "Scalar type will be: DOUBLE")
else()
MESSAGE(STATUS "Scalar type will be: FLOAT (default)")
endif()
if(DICE_USE_INT_STORAGE)
ADD_DEFINITIONS(-DDICE_USE_INT_STORAGE=1)
MESSAGE(STATUS "Image intensity storage type will be: INT")
else()
IF(DICE_USE_DOUBLE)
MESSAGE(STATUS "Image intensity storage type will be: DOUBLE")
ELSE()
MESSAGE(STATUS "Image intensity storage type will be: FLOAT (default)")
ENDIF()
endif()
# MPI check -- defaults to TRUE
LIST(FIND Trilinos_TPL_LIST MPI MPI_List_ID)
IF (MPI_List_ID GREATER -1)
MESSAGE(STATUS "Checking if MPI is enabled in Trilinos: MPI ENABLED")
SET(DICE_MPI TRUE)
ADD_DEFINITIONS(-DDICE_MPI=1)
MESSAGE(STATUS "Using DICE_MPI_EXEC: ${DICE_MPI_EXEC}")
ELSE()
MESSAGE(STATUS "Checking if MPI is enabled in Trilinos: MPI NOT ENABLED")
SET(DICE_MPI FALSE)
ENDIF()
SET(DICE_TRILINOS_HEADERS
${Trilinos_INCLUDE_DIRS}
${Trilinos_TPL_INCLUDE_DIRS}
)
SET(DICE_TRILINOS_LIB_DIRS
${Trilinos_LIBRARY_DIRS}
${Trilinos_TPL_LIBRARY_DIRS}
)
link_directories(${DICE_TRILINOS_LIB_DIRS})
ExternalProject_Get_Property(hypercine source_dir)
include_directories(${source_dir}/src)
set(libprefix "lib")
set(libsuffix ".a")
if(WIN32)
set(libprefix "")
set(libsuffix ".lib")
endif()
set(DICE_LIBRARIES ${DICE_LIBRARIES} "${libprefix}hypercine${libsuffix}")
set(DICE_UTILS_LIBRARIES ${DICE_UTILS_LIBRARIES} "${libprefix}hypercine${libsuffix}")
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
if(WIN32)
link_directories(${CMAKE_INSTALL_PREFIX}/bin)
endif()
SET(DICE_HEADER_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/src/api
${CMAKE_CURRENT_SOURCE_DIR}/src/base
${CMAKE_CURRENT_SOURCE_DIR}/src/core
${CMAKE_CURRENT_SOURCE_DIR}/src/netcdf
${CMAKE_CURRENT_SOURCE_DIR}/src/fft
${CMAKE_CURRENT_SOURCE_DIR}/src/ioutils
${CMAKE_CURRENT_SOURCE_DIR}/src/rawi
${CMAKE_CURRENT_SOURCE_DIR}/src/kdtree
${CMAKE_CURRENT_SOURCE_DIR}/src/mesh
)
IF(DEFINED TRACKLIB_DIR)
SET(DICE_HEADER_DIRS
${DICE_HEADER_DIRS}
${TRACKLIB_DIR}/src/
)
ENDIF()
MESSAGE(STATUS "DICE_ENABLE_GLOBAL: ${DICE_ENABLE_GLOBAL}")
IF(DICE_ENABLE_GLOBAL)
IF(NOT DICE_USE_DOUBLE)
MESSAGE(FATAL_ERROR "DICE_ENABLE_GLOBAL can only be used with DICE_USE_DOUBLE=ON")
ENDIF(NOT DICE_USE_DOUBLE)
SET(DICE_HEADER_DIRS
${DICE_HEADER_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/src/global
${CMAKE_CURRENT_SOURCE_DIR}/src/mesh/io
${CMAKE_CURRENT_SOURCE_DIR}/src/global/triangle)
add_definitions(-DTRILIBRARY -DANSI_DECLARATORS -DDICE_ENABLE_GLOBAL=1)
ENDIF()
IF(DICE_ENABLE_OPENCV)
SET(DICE_HEADER_DIRS
${DICE_HEADER_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/src/opencv
)
add_definitions(-DDICE_ENABLE_OPENCV=1)
ENDIF()
SET(DICE_LIBRARIES
${DICE_LIBRARIES}
teuchoscore
teuchosnumerics
teuchoscomm
teuchosparameterlist
)
IF(DICE_ENABLE_GLOBAL)
MESSAGE(STATUS "*** Enabling Global DIC (requires the Tpetra (or Epetra), Seacas libraries, and Belos in Trilinos) ***")
IF(DICE_USE_TPETRA)
SET(DICE_LIBRARIES
${DICE_LIBRARIES}
tpetra
exodus
belos
belostpetra
)
ADD_DEFINITIONS(-DDICE_TPETRA=1)
ELSE()
SET(DICE_LIBRARIES
${DICE_LIBRARIES}
epetra
exodus
belos
ifpack
belosepetra
)
ENDIF()
ELSE()
MESSAGE(STATUS "Global DIC will not be enabled (to enable, set -D DICE_ENABLE_GLOBAL:BOOL=ON in the CMake script)")
SET(DICE_LIBRARIES
${DICE_LIBRARIES}
epetra
)
ENDIF()
# WINDOWS CMake has a bug for find_package() for clapack
# f2clibs have to be added manually here
IF(WIN32)
SET(DICE_LIBRARIES ${DICE_LIBRARIES} libf2c)
ENDIF()
# if debug messages are turned on:
IF(DICE_DEBUG_MSG)
MESSAGE(STATUS "Debugging messages are ON")
ADD_DEFINITIONS(-DDICE_DEBUG_MSG=1)
ELSE(DICE_DEBUG_MSG)
MESSAGE(STATUS "Debugging messages are OFF")
ENDIF(DICE_DEBUG_MSG)
# Windows: use Trilinos compiler flags
# Linux: don't use compiler flags from Trilinos, instead set them manually
# but pick up openmp if Trilinos was compiled with it:
if(WIN32)
SET(CMAKE_CXX_FLAGS ${Trilinos_CXX_COMPILER_FLAGS})
SET(CMAKE_C_FLAGS ${Trilinos_C_COMPILER_FLAGS})
Else()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
STRING(FIND ${Trilinos_CXX_COMPILER_FLAGS} "openmp" OpenMPFound)
IF( ${OpenMPFound} GREATER -1 )
MESSAGE(STATUS "OpenMP was enabled in Trilinos so enabling it here. (Found flag at position ${OpenMPFound})")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
ENDIF()
STRING(FIND ${Trilinos_CXX_COMPILER_FLAGS} "c++11" CXX11Found)
IF( ${CXX11Found} GREATER -1 )
MESSAGE(STATUS "c++11 was enabled in Trilinos so enabling it here. (Found flag at position ${CXX11Found})")
ELSE()
MESSAGE(WARNING "could not find c++11 flag for Trilinos (c++11 is required)")
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
MESSAGE(STATUS "Trilinos CMAKE_CXX_FLAGS: ${Trilinos_CXX_COMPILER_FLAGS}")
MESSAGE(STATUS "Trilinos CMAKE_C_FLAGS: ${Trilinos_C_COMPILER_FLAGS}")
MESSAGE(STATUS "DICe CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
MESSAGE(STATUS "DICe CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
# Get the git information to put in the header message (to identify the commit corresponding
# to the executable that was run
execute_process(
COMMAND git describe --abbrev=6 --dirty --always --tags
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_SHA1
OUTPUT_STRIP_TRAILING_WHITESPACE)
MESSAGE(STATUS "Git sha1: ${GIT_SHA1}")
ADD_DEFINITIONS(-DGITSHA1=\"${GIT_SHA1}\")
add_subdirectory(src)
add_subdirectory(tools)
add_subdirectory(tests) ```
Thank you in advance.
Edit: I am using Ububtu in VirtualBox.
As #Tsyvarev rightly pointed out, I just added following lines to the CmakeLists.txt of DICe :
LIST(APPEND CMAKE_PREFIX_PATH "PATH TO TRILINOS INSTALLATION")
Hope it helps others like me. Peace.
I am using Qt 6.0.4 in Win10, the 'Help/About' says QtCreator version is 4.15.0. I have a very simple desktop application, built using CMake, and using QCustomPlot that crashes. I am using the Kit Qt 6.0.4 mingw81_64. When I look into the settings under manage kits, I see the debugger is supposedly set to 'GNU gdb 8.1 for MinGW 8.1.0 64Bit'. But when I start debugging, I get a message box that seems to indicate it is using cdb, not gdb. In the Debuggers tab for the kit, it shows all the GNU gdb debuggers, but also to CDB, all auto-detected. I can not remove the cdb entries, at least not that I can figure out. How do I turn off cdb so it only uses the gdb that seems to be called for in the kit settings??
My CMakeLists.txt file is:
project(QT60DataAcq VERSION 0.1 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
# Check https://doc.qt.io/qt/deployment-android.html for more information.
# They need to be set before the find_package( ...) calls below.
#if(ANDROID)
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
# if (ANDROID_ABI STREQUAL "armeabi-v7a")
# set(ANDROID_EXTRA_LIBS
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
# endif()
#endif()
find_package(QT NAMES Qt6 COMPONENTS Widgets PrintSupport REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets PrintSupport REQUIRED)
include_directories(C:/Pgms/Qt/QCUSTOMPLOT2X)
set(PROJECT_SOURCES
main.cpp
dacqmain.cpp
dacqmain.h
dacqmain.ui
C:/Pgms/Qt/QCUSTOMPLOT2X/qcustomplot.cpp
)
set(CMAKE_BUILD_TYPE Debug)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(QT60DataAcq
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
else()
if(ANDROID)
add_library(QT60DataAcq SHARED
${PROJECT_SOURCES}
)
else()
add_executable(QT60DataAcq
${PROJECT_SOURCES}
)
endif()
endif()
target_link_libraries(QT60DataAcq PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::PrintSupport)
set_target_properties(QT60DataAcq
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(QT60DataAcq)
endif()
I want to create one .exe file from the Sunshine GitHub program, I'm new to Cmake and I build that program with its help
git clone https://github.com/loki-47-6F-64/sunshine.git --recursive
cd sunshine && mkdir build && cd build
cmake -G"Unix Makefiles" ..
mingw32-make
It builds and runs correctly and creates .exe, but works only in my system.
On other systems, it gets filesystem errors and shows the path of the system that I build it:
terminate called after throwing an instance of
'std::filesystem::__cxx11::filesystem_error' what(): filesystem
error: cannot copy file: No such file or directory
[E:/sunshine/assets/sunshine.conf] [E:/sunshine/assets/sunshine.conf]
here is its CMakeLists.txt file:
cmake_minimum_required(VERSION 3.0)
project(Sunshine)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(third-party/Simple-Web-Server)
set(UPNPC_BUILD_SHARED OFF CACHE BOOL "no shared libraries")
set(UPNPC_BUILD_TESTS OFF CACHE BOOL "Don't build tests for miniupnpc")
set(UPNPC_BUILD_SAMPLE OFF CACHE BOOL "Don't build samples for miniupnpc")
set(UPNPC_NO_INSTALL ON CACHE BOOL "Don't install any libraries build for miniupnpc")
add_subdirectory(third-party/miniupnp/miniupnpc)
include_directories(third-party/miniupnp)
if(WIN32)
# Ugly hack to compile with #include <qos2.h>
add_compile_definitions(
QOS_FLOWID=UINT32
PQOS_FLOWID=UINT32*
QOS_NON_ADAPTIVE_FLOW=2)
endif()
add_subdirectory(third-party/moonlight-common-c/enet)
find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)
list(APPEND SUNSHINE_COMPILE_OPTIONS -fPIC -Wall -Wno-missing-braces -Wno-maybe-uninitialized -Wno-sign-compare)
if(WIN32)
file(
DOWNLOAD "https://github.com/TheElixZammuto/sunshine-prebuilt/releases/download/1.0.0/pre-compiled.zip" "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled.zip"
TIMEOUT 60
EXPECTED_HASH SHA256=5d59986bd7f619eaaf82b2dd56b5127b747c9cbe8db61e3b898ff6b485298ed6)
file(ARCHIVE_EXTRACT
INPUT "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled.zip"
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/pre-compiled)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
if(NOT DEFINED SUNSHINE_PREPARED_BINARIES)
set(SUNSHINE_PREPARED_BINARIES "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled/windows")
endif()
add_compile_definitions(SUNSHINE_PLATFORM="windows")
add_subdirectory(tools) #This is temporary, only tools for Windows are needed, for now
list(APPEND SUNSHINE_DEFINITIONS APPS_JSON="apps_windows.json")
include_directories(third-party/ViGEmClient/include)
set(PLATFORM_TARGET_FILES
sunshine/platform/windows/publish.cpp
sunshine/platform/windows/misc.h
sunshine/platform/windows/misc.cpp
sunshine/platform/windows/input.cpp
sunshine/platform/windows/display.h
sunshine/platform/windows/display_base.cpp
sunshine/platform/windows/display_vram.cpp
sunshine/platform/windows/display_ram.cpp
sunshine/platform/windows/audio.cpp
third-party/ViGEmClient/src/ViGEmClient.cpp
third-party/ViGEmClient/include/ViGEm/Client.h
third-party/ViGEmClient/include/ViGEm/Common.h
third-party/ViGEmClient/include/ViGEm/Util.h
third-party/ViGEmClient/include/ViGEm/km/BusShared.h)
set(OPENSSL_LIBRARIES
libssl.a
libcrypto.a)
set(FFMPEG_INCLUDE_DIRS
${SUNSHINE_PREPARED_BINARIES}/include)
set(FFMPEG_LIBRARIES
${SUNSHINE_PREPARED_BINARIES}/lib/libavcodec.a
${SUNSHINE_PREPARED_BINARIES}/lib/libavdevice.a
${SUNSHINE_PREPARED_BINARIES}/lib/libavfilter.a
${SUNSHINE_PREPARED_BINARIES}/lib/libavformat.a
${SUNSHINE_PREPARED_BINARIES}/lib/libavutil.a
${SUNSHINE_PREPARED_BINARIES}/lib/libpostproc.a
${SUNSHINE_PREPARED_BINARIES}/lib/libswresample.a
${SUNSHINE_PREPARED_BINARIES}/lib/libswscale.a
${SUNSHINE_PREPARED_BINARIES}/lib/libx264.a
${SUNSHINE_PREPARED_BINARIES}/lib/libx265.a
${SUNSHINE_PREPARED_BINARIES}/lib/libhdr10plus.a
z lzma bcrypt libiconv.a)
list(PREPEND PLATFORM_LIBRARIES
libstdc++.a
libwinpthread.a
libssp.a
ksuser
wsock32
ws2_32
d3d11 dxgi D3DCompiler
setupapi
)
set_source_files_properties(third-party/ViGEmClient/src/ViGEmClient.cpp PROPERTIES COMPILE_DEFINITIONS "UNICODE=1;ERROR_INVALID_DEVICE_OBJECT_PARAMETER=650")
set_source_files_properties(third-party/ViGEmClient/src/ViGEmClient.cpp PROPERTIES COMPILE_FLAGS "-Wno-unknown-pragmas -Wno-misleading-indentation -Wno-class-memaccess")
else()
add_compile_definitions(SUNSHINE_PLATFORM="linux")
list(APPEND SUNSHINE_DEFINITIONS APPS_JSON="apps_linux.json")
find_package(X11 REQUIRED)
find_package(FFmpeg REQUIRED)
set(PLATFORM_TARGET_FILES
sunshine/platform/linux/publish.cpp
sunshine/platform/linux/vaapi.h
sunshine/platform/linux/vaapi.cpp
sunshine/platform/linux/misc.h
sunshine/platform/linux/misc.cpp
sunshine/platform/linux/display.cpp
sunshine/platform/linux/audio.cpp
sunshine/platform/linux/input.cpp
third-party/glad/src/egl.c
third-party/glad/src/gl.c
third-party/glad/include/EGL/eglplatform.h
third-party/glad/include/KHR/khrplatform.h
third-party/glad/include/glad/gl.h
third-party/glad/include/glad/egl.h)
set(PLATFORM_LIBRARIES
Xfixes
Xtst
xcb
xcb-shm
xcb-xfixes
Xrandr
${X11_LIBRARIES}
dl
evdev
pulse
pulse-simple
)
set(PLATFORM_INCLUDE_DIRS
${X11_INCLUDE_DIR}
/usr/include/libevdev-1.0
third-party/glad/include)
if(NOT DEFINED SUNSHINE_EXECUTABLE_PATH)
set(SUNSHINE_EXECUTABLE_PATH "sunshine")
endif()
configure_file(gen-deb.in gen-deb #ONLY)
configure_file(sunshine.service.in sunshine.service #ONLY)
endif()
add_subdirectory(third-party/cbs)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost COMPONENTS log filesystem REQUIRED)
set(SUNSHINE_TARGET_FILES
third-party/moonlight-common-c/reedsolomon/rs.c
third-party/moonlight-common-c/reedsolomon/rs.h
third-party/moonlight-common-c/src/Input.h
third-party/moonlight-common-c/src/Rtsp.h
third-party/moonlight-common-c/src/RtspParser.c
third-party/moonlight-common-c/src/Video.h
sunshine/upnp.cpp
sunshine/upnp.h
sunshine/cbs.cpp
sunshine/utility.h
sunshine/uuid.h
sunshine/config.h
sunshine/config.cpp
sunshine/main.cpp
sunshine/main.h
sunshine/crypto.cpp
sunshine/crypto.h
sunshine/nvhttp.cpp
sunshine/nvhttp.h
sunshine/httpcommon.cpp
sunshine/httpcommon.h
sunshine/confighttp.cpp
sunshine/confighttp.h
sunshine/rtsp.cpp
sunshine/rtsp.h
sunshine/stream.cpp
sunshine/stream.h
sunshine/video.cpp
sunshine/video.h
sunshine/input.cpp
sunshine/input.h
sunshine/audio.cpp
sunshine/audio.h
sunshine/platform/common.h
sunshine/process.cpp
sunshine/process.h
sunshine/network.cpp
sunshine/network.h
sunshine/move_by_copy.h
sunshine/task_pool.h
sunshine/thread_pool.h
sunshine/thread_safe.h
sunshine/sync.h
sunshine/round_robin.h
${PLATFORM_TARGET_FILES})
set_source_files_properties(sunshine/upnp.cpp PROPERTIES COMPILE_FLAGS -Wno-pedantic)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/third-party
${CMAKE_CURRENT_SOURCE_DIR}/third-party/cbs/include
${CMAKE_CURRENT_SOURCE_DIR}/third-party/moonlight-common-c/enet/include
${CMAKE_CURRENT_SOURCE_DIR}/third-party/moonlight-common-c/reedsolomon
${FFMPEG_INCLUDE_DIRS}
${PLATFORM_INCLUDE_DIRS}
)
string(TOUPPER "x${CMAKE_BUILD_TYPE}" BUILD_TYPE)
if("${BUILD_TYPE}" STREQUAL "XDEBUG")
list(APPEND SUNSHINE_COMPILE_OPTIONS -O0 -pedantic -ggdb3)
if(WIN32)
set_source_files_properties(sunshine/nvhttp.cpp PROPERTIES COMPILE_FLAGS -O2)
endif()
else()
add_definitions(-DNDEBUG)
list(APPEND SUNSHINE_COMPILE_OPTIONS -O3)
endif()
if(NOT SUNSHINE_ASSETS_DIR)
set(SUNSHINE_ASSETS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/assets")
endif()
if(NOT SUNSHINE_CONFIG_DIR)
set(SUNSHINE_CONFIG_DIR "${SUNSHINE_ASSETS_DIR}")
endif()
if(NOT SUNSHINE_DEFAULT_DIR)
set(SUNSHINE_DEFAULT_DIR "${SUNSHINE_ASSETS_DIR}")
endif()
list(APPEND CBS_EXTERNAL_LIBRARIES
cbs)
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
libminiupnpc-static
${CBS_EXTERNAL_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
stdc++fs
enet
opus
${FFMPEG_LIBRARIES}
${Boost_LIBRARIES}
${OPENSSL_LIBRARIES}
${PLATFORM_LIBRARIES})
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_ASSETS_DIR="${SUNSHINE_ASSETS_DIR}")
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_CONFIG_DIR="${SUNSHINE_CONFIG_DIR}")
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_DEFAULT_DIR="${SUNSHINE_DEFAULT_DIR}")
add_executable(sunshine ${SUNSHINE_TARGET_FILES})
target_link_libraries(sunshine ${SUNSHINE_EXTERNAL_LIBRARIES})
target_compile_definitions(sunshine PUBLIC ${SUNSHINE_DEFINITIONS})
set_target_properties(sunshine PROPERTIES CXX_STANDARD 17)
target_compile_options(sunshine PRIVATE ${SUNSHINE_COMPILE_OPTIONS})
I think in this file something makes this issue but I don't know.
This is its release file that works correctly and doesn't have my issue:
https://github.com/loki-47-6F-64/sunshine/releases/download/v0.9.0/Sunshine-Windows.zip
How can I create like this?
I fixed My problem by running CMake with one additional parameter.
cmake -G "Unix Makefiles" -DSUNSHINE_ASSETS_DIR=assets ..
exe program needs to know assets and also after that assets folder should be near the exe file like a programmer release.
I was attempting to compile the cryptonote code for testing purposes and I recived this error on my CMake Build:
However, I confirmed that my Boost files are in the correct directory:
F:/boost_1_67_0/boost_1_67_0/libs
How do I make CMake recognize this?
Attached is my CMakeList.txt, I hope this helps
cmake_minimum_required(VERSION 2.8.6)
set(VERSION "0.1")
# $Format:Packaged from commit %H%nset(COMMIT %h)%nset(REFS "%d")$
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CONFIGURATION_TYPES Debug RelWithDebInfo Release CACHE TYPE INTERNAL)
set(CMAKE_SKIP_INSTALL_RULES ON)
set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY ON)
set(CMAKE_SUPPRESS_REGENERATION ON)
enable_testing()
# copy CTestCustom.cmake to build dir to disable long running tests in 'make test'
configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR})
project(CryptoNote)
include_directories(include src external "${CMAKE_BINARY_DIR}/version")
if(APPLE)
include_directories(SYSTEM /usr/include/malloc)
enable_language(ASM)
endif()
if(MSVC)
include_directories(src/Platform/Windows)
elseif(APPLE)
include_directories(src/Platform/OSX)
else()
include_directories(src/Platform/Linux)
endif()
set(STATIC ${MSVC} CACHE BOOL "Link libraries statically")
if(MSVC)
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /D_VARIADIC_MAX=8 /D__SSE4_1__")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10485760")
if(STATIC)
foreach(VAR CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
string(REPLACE "/MD" "/MT" ${VAR} "${${VAR}}")
endforeach()
endif()
include_directories(SYSTEM src/platform/msc)
else()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# This option has no effect in glibc version less than 2.20.
# Since glibc 2.20 _BSD_SOURCE is deprecated, this macro is recomended instead
add_definitions("-D_DEFAULT_SOURCE -D_GNU_SOURCE")
endif()
set(ARCH native CACHE STRING "CPU to build for: -march value or default")
if("${ARCH}" STREQUAL "default")
set(ARCH_FLAG "")
else()
set(ARCH_FLAG "-march=${ARCH}")
endif()
set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Werror -Wno-error=extra -Wno-error=unused-function -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wno-error=unused-result")
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(WARNINGS "${WARNINGS} -Wno-error=mismatched-tags -Wno-error=null-conversion -Wno-overloaded-shift-op-parentheses -Wno-error=shift-count-overflow -Wno-error=tautological-constant-out-of-range-compare -Wno-error=unused-private-field -Wno-error=unneeded-internal-declaration -Wno-error=unused-function")
else()
set(WARNINGS "${WARNINGS} -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=clobbered -Wno-error=unused-but-set-variable")
endif()
if(MINGW)
set(WARNINGS "${WARNINGS} -Wno-error=unused-value")
set(MINGW_FLAG "-DWIN32_LEAN_AND_MEAN")
include_directories(SYSTEM src/platform/mingw)
else()
set(MINGW_FLAG "")
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1))
set(WARNINGS "${WARNINGS} -Wno-error=odr")
endif()
set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes")
set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${MINGW_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} -maes")
if(NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} -maes")
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_HAS_TR1_TUPLE=0")
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8))
set(DEBUG_FLAGS "-g3 -Og")
else()
set(DEBUG_FLAGS "-g3 -O0")
endif()
set(RELEASE_FLAGS "-Ofast -DNDEBUG -Wno-unused-variable")
if(NOT APPLE)
# There is a clang bug that does not allow to compile code that uses AES-NI intrinsics if -flto is enabled
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux"
AND CMAKE_BUILD_TYPE STREQUAL "Release" AND ((CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.9) OR (CMAKE_C_COMPILER_VERSION VERSION_EQUAL 4.9)))
# On linux, to build in lto mode, check that ld.gold linker is used: 'update-alternatives --install /usr/bin/ld ld /usr/bin/ld.gold HIGHEST_PRIORITY'
set(CMAKE_AR gcc-ar)
set(CMAKE_RANLIB gcc-ranlib)
endif()
set(RELEASE_FLAGS "${RELEASE_FLAGS} -flto")
endif()
#if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT MINGW)
# set(RELEASE_FLAGS "${RELEASE_FLAGS} -fno-fat-lto-objects")
#endif()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_FLAGS}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
if(STATIC AND NOT APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
endif()
endif()
if(STATIC)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON)
endif()
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "F:/boost_1_67_0/boost_1_67_0")
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "F:/boost_1_67_0/boost_1_67_0/libs")
find_package(Boost 1.55 REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if(MINGW)
set(Boost_LIBRARIES "${Boost_LIBRARIES};ws2_32;mswsock")
elseif(APPLE)
set(Boost_LIBRARIES "${Boost_LIBRARIES}")
elseif(NOT MSVC)
set(Boost_LIBRARIES "${Boost_LIBRARIES};rt")
endif()
set(COMMIT_ID_IN_VERSION ON CACHE BOOL "Include commit ID in version")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/version")
if (NOT COMMIT_ID_IN_VERSION)
set(VERSION "${VERSION}-unknown")
configure_file("src/version.h.in" "version/version.h")
add_custom_target(version ALL)
elseif(DEFINED COMMIT)
string(REPLACE "." "\\." VERSION_RE "${VERSION}")
if(NOT REFS MATCHES "(\\(|, )tag: v${VERSION_RE}(\\)|, )")
set(VERSION "${VERSION}-g${COMMIT}")
endif()
configure_file("src/version.h.in" "version/version.h")
add_custom_target(version ALL)
else()
find_package(Git QUIET)
if(Git_FOUND OR GIT_FOUND)
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
add_custom_target(version ALL "${CMAKE_COMMAND}" "-D" "VERSION=${VERSION}" "-D" "GIT=${GIT_EXECUTABLE}" "-D" "TO=${CMAKE_BINARY_DIR}/version/version.h" "-P" "src/version.cmake" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
else()
message(STATUS "WARNING: Git was not found!")
set(VERSION "${VERSION}-unknown")
configure_file("src/version.h.in" "version/version.h")
add_custom_target(version ALL)
endif()
endif()
add_subdirectory(external)
add_subdirectory(src)
add_subdirectory(tests)
Thank you so much!!
It builds fine from console Cmake, but when I try to open the project and build it from Qt Creator I see no targets specified.
Qt Creator version 3.1.1
CMake file
project(wordnetTest)
cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
INCLUDE_DIRECTORIES(/usr/local/WordNet-3.0/include/ ./wordnet-blast-master)
add_executable(${PROJECT_NAME} ${SRC_LIST})
find_library(LIBWN WN HINTS "/usr/local/WordNet-3.0/lib")
if(NOT LIBWN)
message(FATAL_ERROR "Library `WN` not found")
endif()
target_link_libraries(${PROJECT_NAME} ${LIBWN})