Skip to content

Commit 0d04219

Browse files
committed
improve schema search logic
1 parent 156143d commit 0d04219

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

data/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
# in the build dir, and it is compiled into a library. A p21read executable is
66
# compiled and linked to the lib. p21read is used to test the lib.
77
FUNCTION(BUILD_A_SCHEMA SCHEMA_FILE)
8-
if( EXISTS "${CMAKE_BINARY_DIR}/${SCHEMA_FILE}" ) #try absolute path. if that fails, must already be absolute.
8+
if( EXISTS "${CMAKE_BINARY_DIR}/${SCHEMA_FILE}" ) #is it a path relative to build dir?
99
set( SCHEMA_FILE "${CMAKE_BINARY_DIR}/${SCHEMA_FILE}" )
10-
else()
11-
if( NOT EXISTS ${SCHEMA_FILE} )
12-
message( FATAL_ERROR "Cannot find ${CMAKE_BINARY_DIR}/${SCHEMA_FILE} or ${SCHEMA_FILE}")
13-
endif()
10+
elseif( EXISTS "${SCL_SOURCE_DIR}/data/${SCHEMA_FILE}" ) # path relative to STEPcode/data?
11+
set( SCHEMA_FILE "${SCL_SOURCE_DIR}/data/${SCHEMA_FILE}" )
12+
elseif( NOT EXISTS ${SCHEMA_FILE} ) # absolute path
13+
message( FATAL_ERROR "Cannot find ${CMAKE_BINARY_DIR}/${SCHEMA_FILE} or ${SCL_SOURCE_DIR}/data/${SCHEMA_FILE} or ${SCHEMA_FILE}" )
1414
endif()
1515

1616
if( IS_DIRECTORY ${SCHEMA_FILE} ) #if it is a dir, look for one .exp file inside
@@ -30,7 +30,7 @@ FUNCTION(BUILD_A_SCHEMA SCHEMA_FILE)
3030

3131
project( sdai_${SCHEMA_SHORT_NAME} )
3232
message( STATUS "Generating code for ${SCHEMA_SHORT_NAME}.")
33-
set( SCHEMA_OUTPUT_DIR ${CMAKE_BINARY_DIR}/${SCHEMA_SHORT_NAME} )
33+
set( SCHEMA_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${SCHEMA_SHORT_NAME} )
3434

3535
#the names of the files that will be generated
3636
set( FEDEX_OUT ${SCHEMA_OUTPUT_DIR}/compstructs.cc ${SCHEMA_OUTPUT_DIR}/Sdaiclasses.h

0 commit comments

Comments
 (0)