optimad / bitpit

Open source library for scientific HPC
http://optimad.github.io/bitpit/
GNU Lesser General Public License v3.0
117 stars 33 forks source link

On running basic examples via cmake. #123

Open hyuntae-cho opened 3 years ago

hyuntae-cho commented 3 years ago

Dear bitpit developers,

My experience are limited to making projects on windows by Visual Studio, so the question might sound silly to you. I think I've successfully installed bitpit, and trying to run some examples. What I've done is that I've copied the first Pablo example and trying to make my own CmakeLists.txt and run it, but it seems it does not work well.

`CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(helloworld)

SET(BITPIT_DIR "/usr/local/lib/cmake/bitpit-1.7")

FIND_PACKAGE(BITPIT REQUIRED) include(${BITPIT_USE_FILE}) INCLUDE_DIRECTORIES(${BITPIT_INCLUDE_DIRS}) ADD_DEFINITIONS(${BITPIT_DEFINITIONS})

ADD_EXECUTABLE(a.out main.cpp)

TARGET_LINK_LIBRARIES(a.out ${BITPIT_LIBRARIES})`

So here is my CMakeLists.txt file and cmake command works well, but when I run make , it keeps showing the error

icpc: error #10236: File not found: 'BITPIT_ENABLE_MPI=0'

Is there something that I've made mistake? I would like to thank you in advance.

andrea-iob commented 3 years ago

Could you try replacing the command

ADD_DEFINITIONS(${BITPIT_DEFINITIONS})

with

set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${BITPIT_DEFINITIONS})

?

The command ADD_DEFINITIONS expects definitions to have the format "-DFOO -DBAR", however BITPIT_DEFINITIONS contains only the list of definitions without the "-D" prefix.

hyuntae-cho commented 3 years ago

It works well now. Thank you and Merry Christmas!